@chillicream/nitro-embedded 32.0.1 → 32.0.2

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.
Files changed (27) hide show
  1. package/assets/{context-providers.af358442.L6HRWLsq.js → context-providers.cbb9dd2a.cIEPV5um.js} +6 -6
  2. package/assets/{editor.worker.af358442.v0iaGZSm.js → editor.worker.cbb9dd2a.bpPxd4HN.js} +1 -1
  3. package/assets/{graphql-engine-scheduler.af358442.X41z7Glg.js → graphql-engine-scheduler.cbb9dd2a.wOPnKfNr.js} +3 -3
  4. package/assets/{graphql-indexer-scheduler.af358442.HDfUZTEA.js → graphql-indexer-scheduler.cbb9dd2a.CG604HRm.js} +2 -2
  5. package/assets/{graphql.worker.af358442.De-JUNf0.js → graphql.worker.cbb9dd2a.xpDyakfn.js} +1 -1
  6. package/assets/{index.af358442.CBE7L1tx.js → index.cbb9dd2a.vQhlIpdT.js} +1 -1
  7. package/assets/{json.worker.af358442.DW0uoc6x.js → json.worker.cbb9dd2a.DzqSgOmm.js} +1 -1
  8. package/assets/{jsonMode.af358442.D_T9q_zY.js → jsonMode.cbb9dd2a.CASrsvge.js} +1 -1
  9. package/assets/{main.af358442.BtoGS3h2.js → main.cbb9dd2a.ChRcIDX9.js} +4 -4
  10. package/assets/{monaco.af358442.EzLMkAv9.css → monaco.cbb9dd2a.1cPGLvp7.css} +1 -1
  11. package/assets/{monaco.af358442.BppfOwyk.css → monaco.cbb9dd2a.gxBQgwYh.css} +1 -1
  12. package/assets/{monaco.af358442.Dp6dtAbQ.js → monaco.cbb9dd2a.lpARKB0G.js} +2 -2
  13. package/assets/{session-scheduler.af358442.Dh9Cs0Tu.js → session-scheduler.cbb9dd2a.DNSZrB_J.js} +1 -1
  14. package/assets/{yaml.af358442.CdIo49Ee.js → yaml.cbb9dd2a.r5d-htbt.js} +1 -1
  15. package/assets/{yaml.worker.af358442.pUNszxRM.js → yaml.worker.cbb9dd2a.FMre_zZ7.js} +1 -1
  16. package/index.html +4 -4
  17. package/package.json +1 -1
  18. package/service-worker.js +1 -1
  19. /package/assets/{FiraCode-Medium.af358442.-YTCSZkP.woff2 → FiraCode-Medium.cbb9dd2a.-YTCSZkP.woff2} +0 -0
  20. /package/assets/{codicon.af358442.Hscy-R9e.ttf → codicon.cbb9dd2a.Hscy-R9e.ttf} +0 -0
  21. /package/assets/{context-providers.af358442.3HkX5s82.css → context-providers.cbb9dd2a.3HkX5s82.css} +0 -0
  22. /package/assets/{main.af358442.BdMtxJz7.css → main.cbb9dd2a.BdMtxJz7.css} +0 -0
  23. /package/assets/{monaco.af358442.BO10LLSO.js → monaco.cbb9dd2a.B1Kqe1Kf.js} +0 -0
  24. /package/assets/{monaco.af358442.DebZM0yg.js → monaco.cbb9dd2a.C_OHPGWO.js} +0 -0
  25. /package/assets/{monaco.af358442.fH51QxJ-.js → monaco.cbb9dd2a.D4ai2qOB.js} +0 -0
  26. /package/assets/{monaco.af358442.BEzTSdvi.js → monaco.cbb9dd2a.D85_ONb-.js} +0 -0
  27. /package/assets/{monaco.af358442.e3J4IGMh.js → monaco.cbb9dd2a.D_5Blgsx.js} +0 -0
@@ -1,4 +1,4 @@
1
- var pr=(r,n)=>()=>(n||r((n={exports:{}}).exports,n),n.exports);import{p as process$1,B as Buffer}from"./monaco.af358442.e3J4IGMh.js";var vr=pr((exports,module)=>{getOsName();isMacLike();const IS_RUNNING_IN_ELECTRON=navigator.userAgent.indexOf("Electron")>=0;function getOsName(){return navigator.userAgent.indexOf("Win")>=0?"Windows":navigator.userAgent.indexOf("Mac")>=0?"macOS":navigator.userAgent.indexOf("X11")>=0||navigator.userAgent.indexOf("Linux")>=0?"Linux":"Unknown"}function isMacLike(){const r=navigator.userAgent.toLowerCase();return r.includes("mac os")||r.includes("ipad")}const APP_NAME="Nitro",APP_VERSION="32.0.1",APP_GRAPHQL_CLIENT_ID="Q2xpZW50Cmc5ZjAwOTFmNTY5NmQ0NTZkOWUwZDQ0ZDMzYjJhZDJlOA==",cloudUriPattern=new RegExp("^https?:\\/\\/.*?\\.(bananacakepop\\.com|chillicream\\.com|chillicream\\.cloud)","i"),IS_RUNNING_IN_CLOUD=cloudUriPattern?.test(self.origin)??!1,APP_TYPE=IS_RUNNING_IN_CLOUD?"cloud":IS_RUNNING_IN_ELECTRON?"app":"middleware",APP_AGENT=`${APP_NAME}/${APP_VERSION} (${APP_TYPE})`,HEADER_AUTHORIZATION="Authorization",HEADER_CONTENT_TYPE="Content-Type",HEADER_USER_AGENT="User-Agent",HTTP_SCHEME_PATTERN=/^https?:\/\//i,INTERPOLATION_VARIABLE_NAME_PATTERN=/{{\s*([a-z0-9_\-|.:+#$!?;,]+)\s*}}/gi,FUSION_OPERATION_PLAN_HEADER_NAME_PATTERN=/fusion-operation-plan/i,INTROSPECTION_PREFIX=/^_{2}(?!_)/i,ABORT_ERROR_NAME="AbortError",ABORT_ERROR=new DOMException("Action cancelled",ABORT_ERROR_NAME),TIMEOUT_ABORT_ERROR_MESSAGE="Action timed out",TIMEOUT_ABORT_ERROR=new DOMException(TIMEOUT_ABORT_ERROR_MESSAGE,ABORT_ERROR_NAME);class TimeoutAbortSignal{#e;#t;#r;constructor(n,a){this.#e=n,this.#t=a}get aborted(){return this.#e.aborted}get cancelled(){return this.#t()}get onabort(){return this.#e.onabort}get reason(){return this.#e.reason}dispatchEvent(n){return this.#e.dispatchEvent(n)}throwIfAborted(){this.#e.throwIfAborted()}toAbortSignal(){return this.#e}toPromise(){if(this.#r)return this.#r;const n=this;let a=!1;return this.#r=new Promise((i,o)=>{if(n.aborted){a=!0,o(TIMEOUT_ABORT_ERROR);return}if(n.cancelled){a=!0,i();return}function s(){n.removeEventListener("abort",s),n.removeEventListener("cancelled",l),a||(a=!0,o(TIMEOUT_ABORT_ERROR))}function l(){n.removeEventListener("abort",s),n.removeEventListener("cancelled",l),a||(a=!0,i())}n.addEventListener("abort",s),n.addEventListener("cancelled",l)}),this.#r}addEventListener(n,a,i){this.#e.addEventListener(n,a,i)}removeEventListener(n,a,i){this.#e.removeEventListener(n,a,i)}}class TimeoutAbortController{_controller=new AbortController;_signal=new TimeoutAbortSignal(this._controller.signal,()=>this._cancelled);_cancelled=!1;_timeoutHandle;constructor(n){this._timeoutHandle=self.setTimeout(()=>{this.abort(TIMEOUT_ABORT_ERROR_MESSAGE)},n)}get signal(){return this._signal}abort(n){this._controller.abort(n)}cancel(){this._cancelled=!0,self.clearTimeout(this._timeoutHandle),this._signal.dispatchEvent(new Event("cancelled"))}}function isAbortError(r){return r instanceof DOMException&&r.name===ABORT_ERROR_NAME}function isTimeoutAbortError(r){return isAbortError(r)&&r.message===TIMEOUT_ABORT_ERROR_MESSAGE}function createAbortScope(r,n,a){return a?a.aborted?Promise.reject(ABORT_ERROR):(a.addEventListener("abort",r),n().finally(()=>{a.removeEventListener("abort",r)})):n()}function distinct(r){return r.filter((n,a,i)=>i.indexOf(n)===a)}function isObjectArray(r){return typeof r!="string"&&Array.isArray(r)&&r.every(n=>typeof n=="object"&&!Array.isArray(n))}function isStringArray(r){return typeof r!="string"&&Array.isArray(r)&&r.every(n=>typeof n=="string")}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function getAugmentedNamespace(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var n=r.default;if(typeof n=="function"){var a=function i(){var o=!1;try{o=this instanceof i}catch{}return o?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};a.prototype=n.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var o=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(a,i,o.get?o:{enumerable:!0,get:function(){return r[i]}})}),a}var inherits_browser={exports:{}},hasRequiredInherits_browser;function requireInherits_browser(){return hasRequiredInherits_browser||(hasRequiredInherits_browser=1,typeof Object.create=="function"?inherits_browser.exports=function(n,a){a&&(n.super_=a,n.prototype=Object.create(a.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(n,a){if(a){n.super_=a;var i=function(){};i.prototype=a.prototype,n.prototype=new i,n.prototype.constructor=n}}),inherits_browser.exports}var safeBuffer$1={exports:{}},dist={},hasRequiredDist;function requireDist(){return hasRequiredDist||(hasRequiredDist=1,function(r){Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var n={},a={};a.byteLength=c,a.toByteArray=h,a.fromByteArray=_;for(var i=[],o=[],s=typeof Uint8Array<"u"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,d=l.length;f<d;++f)i[f]=l[f],o[l.charCodeAt(f)]=f;o[45]=62,o[95]=63;function u(O){var M=O.length;if(M%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=O.indexOf("=");F===-1&&(F=M);var L=F===M?0:4-F%4;return[F,L]}function c(O){var M=u(O),F=M[0],L=M[1];return(F+L)*3/4-L}function v(O,M,F){return(M+F)*3/4-F}function h(O){var M,F=u(O),L=F[0],k=F[1],P=new s(v(O,L,k)),U=0,B=k>0?L-4:L,j;for(j=0;j<B;j+=4)M=o[O.charCodeAt(j)]<<18|o[O.charCodeAt(j+1)]<<12|o[O.charCodeAt(j+2)]<<6|o[O.charCodeAt(j+3)],P[U++]=M>>16&255,P[U++]=M>>8&255,P[U++]=M&255;return k===2&&(M=o[O.charCodeAt(j)]<<2|o[O.charCodeAt(j+1)]>>4,P[U++]=M&255),k===1&&(M=o[O.charCodeAt(j)]<<10|o[O.charCodeAt(j+1)]<<4|o[O.charCodeAt(j+2)]>>2,P[U++]=M>>8&255,P[U++]=M&255),P}function m(O){return i[O>>18&63]+i[O>>12&63]+i[O>>6&63]+i[O&63]}function g(O,M,F){for(var L,k=[],P=M;P<F;P+=3)L=(O[P]<<16&16711680)+(O[P+1]<<8&65280)+(O[P+2]&255),k.push(m(L));return k.join("")}function _(O){for(var M,F=O.length,L=F%3,k=[],P=16383,U=0,B=F-L;U<B;U+=P)k.push(g(O,U,U+P>B?B:U+P));return L===1?(M=O[F-1],k.push(i[M>>2]+i[M<<4&63]+"==")):L===2&&(M=(O[F-2]<<8)+O[F-1],k.push(i[M>>10]+i[M>>4&63]+i[M<<2&63]+"=")),k.join("")}var S={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */S.read=function(O,M,F,L,k){var P,U,B=k*8-L-1,j=(1<<B)-1,$=j>>1,A=-7,R=F?k-1:0,y=F?-1:1,b=O[M+R];for(R+=y,P=b&(1<<-A)-1,b>>=-A,A+=B;A>0;P=P*256+O[M+R],R+=y,A-=8);for(U=P&(1<<-A)-1,P>>=-A,A+=L;A>0;U=U*256+O[M+R],R+=y,A-=8);if(P===0)P=1-$;else{if(P===j)return U?NaN:(b?-1:1)*(1/0);U=U+Math.pow(2,L),P=P-$}return(b?-1:1)*U*Math.pow(2,P-L)},S.write=function(O,M,F,L,k,P){var U,B,j,$=P*8-k-1,A=(1<<$)-1,R=A>>1,y=k===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=L?0:P-1,D=L?1:-1,I=M<0||M===0&&1/M<0?1:0;for(M=Math.abs(M),isNaN(M)||M===1/0?(B=isNaN(M)?1:0,U=A):(U=Math.floor(Math.log(M)/Math.LN2),M*(j=Math.pow(2,-U))<1&&(U--,j*=2),U+R>=1?M+=y/j:M+=y*Math.pow(2,1-R),M*j>=2&&(U++,j/=2),U+R>=A?(B=0,U=A):U+R>=1?(B=(M*j-1)*Math.pow(2,k),U=U+R):(B=M*Math.pow(2,R-1)*Math.pow(2,k),U=0));k>=8;O[F+b]=B&255,b+=D,B/=256,k-=8);for(U=U<<k|B,$+=k;$>0;O[F+b]=U&255,b+=D,U/=256,$-=8);O[F+b-D]|=I*128};/*!
1
+ var pr=(r,n)=>()=>(n||r((n={exports:{}}).exports,n),n.exports);import{p as process$1,B as Buffer}from"./monaco.cbb9dd2a.D_5Blgsx.js";var vr=pr((exports,module)=>{getOsName();isMacLike();const IS_RUNNING_IN_ELECTRON=navigator.userAgent.indexOf("Electron")>=0;function getOsName(){return navigator.userAgent.indexOf("Win")>=0?"Windows":navigator.userAgent.indexOf("Mac")>=0?"macOS":navigator.userAgent.indexOf("X11")>=0||navigator.userAgent.indexOf("Linux")>=0?"Linux":"Unknown"}function isMacLike(){const r=navigator.userAgent.toLowerCase();return r.includes("mac os")||r.includes("ipad")}const APP_NAME="Nitro",APP_VERSION="32.0.2",APP_GRAPHQL_CLIENT_ID="Q2xpZW50Cmc5ZjAwOTFmNTY5NmQ0NTZkOWUwZDQ0ZDMzYjJhZDJlOA==",cloudUriPattern=new RegExp("^https?:\\/\\/.*?\\.(bananacakepop\\.com|chillicream\\.com|chillicream\\.cloud)","i"),IS_RUNNING_IN_CLOUD=cloudUriPattern?.test(self.origin)??!1,APP_TYPE=IS_RUNNING_IN_CLOUD?"cloud":IS_RUNNING_IN_ELECTRON?"app":"middleware",APP_AGENT=`${APP_NAME}/${APP_VERSION} (${APP_TYPE})`,HEADER_AUTHORIZATION="Authorization",HEADER_CONTENT_TYPE="Content-Type",HEADER_USER_AGENT="User-Agent",HTTP_SCHEME_PATTERN=/^https?:\/\//i,INTERPOLATION_VARIABLE_NAME_PATTERN=/{{\s*([a-z0-9_\-|.:+#$!?;,]+)\s*}}/gi,FUSION_OPERATION_PLAN_HEADER_NAME_PATTERN=/fusion-operation-plan/i,INTROSPECTION_PREFIX=/^_{2}(?!_)/i,ABORT_ERROR_NAME="AbortError",ABORT_ERROR=new DOMException("Action cancelled",ABORT_ERROR_NAME),TIMEOUT_ABORT_ERROR_MESSAGE="Action timed out",TIMEOUT_ABORT_ERROR=new DOMException(TIMEOUT_ABORT_ERROR_MESSAGE,ABORT_ERROR_NAME);class TimeoutAbortSignal{#e;#t;#r;constructor(n,a){this.#e=n,this.#t=a}get aborted(){return this.#e.aborted}get cancelled(){return this.#t()}get onabort(){return this.#e.onabort}get reason(){return this.#e.reason}dispatchEvent(n){return this.#e.dispatchEvent(n)}throwIfAborted(){this.#e.throwIfAborted()}toAbortSignal(){return this.#e}toPromise(){if(this.#r)return this.#r;const n=this;let a=!1;return this.#r=new Promise((i,o)=>{if(n.aborted){a=!0,o(TIMEOUT_ABORT_ERROR);return}if(n.cancelled){a=!0,i();return}function s(){n.removeEventListener("abort",s),n.removeEventListener("cancelled",l),a||(a=!0,o(TIMEOUT_ABORT_ERROR))}function l(){n.removeEventListener("abort",s),n.removeEventListener("cancelled",l),a||(a=!0,i())}n.addEventListener("abort",s),n.addEventListener("cancelled",l)}),this.#r}addEventListener(n,a,i){this.#e.addEventListener(n,a,i)}removeEventListener(n,a,i){this.#e.removeEventListener(n,a,i)}}class TimeoutAbortController{_controller=new AbortController;_signal=new TimeoutAbortSignal(this._controller.signal,()=>this._cancelled);_cancelled=!1;_timeoutHandle;constructor(n){this._timeoutHandle=self.setTimeout(()=>{this.abort(TIMEOUT_ABORT_ERROR_MESSAGE)},n)}get signal(){return this._signal}abort(n){this._controller.abort(n)}cancel(){this._cancelled=!0,self.clearTimeout(this._timeoutHandle),this._signal.dispatchEvent(new Event("cancelled"))}}function isAbortError(r){return r instanceof DOMException&&r.name===ABORT_ERROR_NAME}function isTimeoutAbortError(r){return isAbortError(r)&&r.message===TIMEOUT_ABORT_ERROR_MESSAGE}function createAbortScope(r,n,a){return a?a.aborted?Promise.reject(ABORT_ERROR):(a.addEventListener("abort",r),n().finally(()=>{a.removeEventListener("abort",r)})):n()}function distinct(r){return r.filter((n,a,i)=>i.indexOf(n)===a)}function isObjectArray(r){return typeof r!="string"&&Array.isArray(r)&&r.every(n=>typeof n=="object"&&!Array.isArray(n))}function isStringArray(r){return typeof r!="string"&&Array.isArray(r)&&r.every(n=>typeof n=="string")}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function getAugmentedNamespace(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var n=r.default;if(typeof n=="function"){var a=function i(){var o=!1;try{o=this instanceof i}catch{}return o?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};a.prototype=n.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var o=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(a,i,o.get?o:{enumerable:!0,get:function(){return r[i]}})}),a}var inherits_browser={exports:{}},hasRequiredInherits_browser;function requireInherits_browser(){return hasRequiredInherits_browser||(hasRequiredInherits_browser=1,typeof Object.create=="function"?inherits_browser.exports=function(n,a){a&&(n.super_=a,n.prototype=Object.create(a.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(n,a){if(a){n.super_=a;var i=function(){};i.prototype=a.prototype,n.prototype=new i,n.prototype.constructor=n}}),inherits_browser.exports}var safeBuffer$1={exports:{}},dist={},hasRequiredDist;function requireDist(){return hasRequiredDist||(hasRequiredDist=1,function(r){Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var n={},a={};a.byteLength=c,a.toByteArray=h,a.fromByteArray=_;for(var i=[],o=[],s=typeof Uint8Array<"u"?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,d=l.length;f<d;++f)i[f]=l[f],o[l.charCodeAt(f)]=f;o[45]=62,o[95]=63;function u(O){var M=O.length;if(M%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var F=O.indexOf("=");F===-1&&(F=M);var L=F===M?0:4-F%4;return[F,L]}function c(O){var M=u(O),F=M[0],L=M[1];return(F+L)*3/4-L}function v(O,M,F){return(M+F)*3/4-F}function h(O){var M,F=u(O),L=F[0],k=F[1],P=new s(v(O,L,k)),U=0,B=k>0?L-4:L,j;for(j=0;j<B;j+=4)M=o[O.charCodeAt(j)]<<18|o[O.charCodeAt(j+1)]<<12|o[O.charCodeAt(j+2)]<<6|o[O.charCodeAt(j+3)],P[U++]=M>>16&255,P[U++]=M>>8&255,P[U++]=M&255;return k===2&&(M=o[O.charCodeAt(j)]<<2|o[O.charCodeAt(j+1)]>>4,P[U++]=M&255),k===1&&(M=o[O.charCodeAt(j)]<<10|o[O.charCodeAt(j+1)]<<4|o[O.charCodeAt(j+2)]>>2,P[U++]=M>>8&255,P[U++]=M&255),P}function m(O){return i[O>>18&63]+i[O>>12&63]+i[O>>6&63]+i[O&63]}function g(O,M,F){for(var L,k=[],P=M;P<F;P+=3)L=(O[P]<<16&16711680)+(O[P+1]<<8&65280)+(O[P+2]&255),k.push(m(L));return k.join("")}function _(O){for(var M,F=O.length,L=F%3,k=[],P=16383,U=0,B=F-L;U<B;U+=P)k.push(g(O,U,U+P>B?B:U+P));return L===1?(M=O[F-1],k.push(i[M>>2]+i[M<<4&63]+"==")):L===2&&(M=(O[F-2]<<8)+O[F-1],k.push(i[M>>10]+i[M>>4&63]+i[M<<2&63]+"=")),k.join("")}var S={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */S.read=function(O,M,F,L,k){var P,U,B=k*8-L-1,j=(1<<B)-1,$=j>>1,A=-7,R=F?k-1:0,y=F?-1:1,b=O[M+R];for(R+=y,P=b&(1<<-A)-1,b>>=-A,A+=B;A>0;P=P*256+O[M+R],R+=y,A-=8);for(U=P&(1<<-A)-1,P>>=-A,A+=L;A>0;U=U*256+O[M+R],R+=y,A-=8);if(P===0)P=1-$;else{if(P===j)return U?NaN:(b?-1:1)*(1/0);U=U+Math.pow(2,L),P=P-$}return(b?-1:1)*U*Math.pow(2,P-L)},S.write=function(O,M,F,L,k,P){var U,B,j,$=P*8-k-1,A=(1<<$)-1,R=A>>1,y=k===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=L?0:P-1,D=L?1:-1,I=M<0||M===0&&1/M<0?1:0;for(M=Math.abs(M),isNaN(M)||M===1/0?(B=isNaN(M)?1:0,U=A):(U=Math.floor(Math.log(M)/Math.LN2),M*(j=Math.pow(2,-U))<1&&(U--,j*=2),U+R>=1?M+=y/j:M+=y*Math.pow(2,1-R),M*j>=2&&(U++,j/=2),U+R>=A?(B=0,U=A):U+R>=1?(B=(M*j-1)*Math.pow(2,k),U=U+R):(B=M*Math.pow(2,R-1)*Math.pow(2,k),U=0));k>=8;O[F+b]=B&255,b+=D,B/=256,k-=8);for(U=U<<k|B,$+=k;$>0;O[F+b]=U&255,b+=D,U/=256,$-=8);O[F+b-D]|=I*128};/*!
2
2
  * The buffer module from node.js, for the browser.
3
3
  *
4
4
  * @author Feross Aboukhadijeh <https://feross.org>
@@ -243,7 +243,7 @@ ${v}}`}return`
243
243
  deprecationReason`}:{includeDeprecated:"",isDeprecated:"",deprecationReason:""},s=r.inputValueDeprecation?{includeDeprecated:"(includeDeprecated: true)",isDeprecated:`
244
244
  isDeprecated`,deprecationReason:`
245
245
  deprecationReason`}:{includeDeprecated:"",isDeprecated:"",deprecationReason:""},l=addOfTypeFieldRecursively(6),f=r.oneOf?`
246
- oneOf`:"",d=r.specifiedByUrl?`
246
+ isOneOf`:"",d=r.specifiedByUrl?`
247
247
  specifiedByURL`:"";return`query IntrospectionQuery {
248
248
  __schema {
249
249
  queryType {
@@ -360,4 +360,4 @@ ${i}}`}return n}class DocumentValidatorContext{#e;#t;#r;#n;constructor(n){this.#
360
360
  }
361
361
  }
362
362
  }
363
- `,_gql_doc={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"IntrospectionQuery"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__type"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"StringValue",value:"__Type",block:!1}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"fields"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}}]}}]}}]}}],loc:{start:0,end:137,source:{name:"GraphQL request",locationOffset:{line:1,column:1},body:_gql_source}}},INTROSPECTION_QUERY_DIRECTIVE=print(_gql_doc$4),INTROSPECTION_QUERY_INPUT_VALUE=print(_gql_doc$3),INTROSPECTION_QUERY_SCHEMA=print(_gql_doc$2),INTROSPECTION_QUERY_SEARCH_RESULT=print(_gql_doc$1),INTROSPECTION_QUERY_TYPE=print(_gql_doc);function executeOperation(r,n,a,i,o,s){return fetchCore(r,n,a,i,o,s).then(async({response:l})=>{const{kind:f,responseOrError:d}=l;if(!(d instanceof Response))return{kind:f,error:d};switch(f){case GraphQLResponseKind.INCREMENTAL:return{kind:f,parsedBody:{}};case GraphQLResponseKind.VARIABLE_BATCHING:return{kind:f,parsedBody:n.variables?.map(()=>({}))??[]}}const{operationResult:u,error:c}=await parseAndCheckHttpResponse(d,!1);return c?{kind:f,error:c}:{kind:f,parsedBody:u}})}async function fetchSchemaBySdlEndpoint(r,n,a,i,o,s,l){const f=(c,v)=>createHttpLogger(r,n,c,s===GraphQLSchemaKind.SDL_FETCH?RequestKind.GRAPHQL_SDL_FETCH:RequestKind.GRAPHQL_SDL_PROBE,{name:v,scopeId:a}),[d,u]=await Promise.all([fetchSchemaBySdlEndpointCore$1(i,s,o,f,l),fetchGraphQLIntrospectionSearchResult(o,f,l)]);if(d instanceof Response){const c=await d.text();return{schema:buildSchema(c),sdlSchema:c,supportsSemanticIntrospection:"operationResult"in u&&!!u.operationResult.data.__type}}return d}function fetchSchemaBySdlEndpointCore$1(r,n,a,i,o){const s=createRequestId(),l=i(s,n===GraphQLSchemaKind.SDL_FETCH?"SDL Schema Fetch":"SDL Schema Probe"),f=a.includeCookies?"include":"same-origin",d=new Headers(a.headers),u="GET",c={cache:"no-cache",credentials:f,headers:d,method:u,referrerPolicy:IS_RUNNING_IN_ELECTRON?"no-referrer":"strict-origin-when-cross-origin",signal:o};return a.disableCors&&(c.mode="no-cors"),d.append("User-Agent",navigator.userAgent),l.requestInterceptor(r,u,d),fetch(r,c).then(v=>l.responseInterceptor(v)??v).catch(catchNetworkError).then(v=>l.responseErrorInterceptor(v)??v)}async function fetchSchemaByApiSdlEndpoint(r,n,a,i,o){const s=await getHttpOptions(i),l=(u,c)=>createHttpLogger(r,n,u,RequestKind.GRAPHQL_SDL_FETCH,{name:c,scopeId:a}),[f,d]=await Promise.all([fetchSchemaByApiSdlEndpointCore(i,s,o),fetchGraphQLIntrospectionSearchResult(s,l,o)]);if(f instanceof Response){const u=await f.text();return{schema:buildSchema(u),sdlSchema:u,supportsSemanticIntrospection:"operationResult"in d&&!!d.operationResult.data.__type}}return f}async function fetchSchemaByApiSdlEndpointCore(r,n,a){const i=n.includeCookies?"include":"same-origin",o=new Headers(n.headers),l={cache:"no-cache",credentials:i,headers:o,method:"GET",referrerPolicy:IS_RUNNING_IN_ELECTRON?"no-referrer":"strict-origin-when-cross-origin",signal:a};return n.disableCors&&(l.mode="no-cors"),o.append("User-Agent",navigator.userAgent),fetch(r,l).catch(catchNetworkError)}async function fetchGraphQLSchema(r,n,a){const[i,o,s,l,f]=await Promise.all([fetchGraphQLIntrospectionDirective(r,n,a),fetchGraphQLIntrospectionInputValue(r,n,a),fetchGraphQLIntrospectionSchema(r,n,a),fetchGraphQLIntrospectionSearchResult(r,n,a),fetchGraphQLIntrospectionType(r,n,a)]);if("name"in i)return i;if(i.error)return i.error;if("name"in o)return o;if(o.error)return o.error;if("name"in s)return s;if(s.error)return s.error;if("name"in l)return l;if(l.error)return l.error;if("name"in f)return f;if(f.error)return f.error;const d=determineIntrospectionFeatures({schema:s.operationResult.data.__type,directive:i.operationResult.data.__type,inputValue:o.operationResult.data.__type,type:f.operationResult.data.__type}),u=await fetchGraphQLSchemaByFeatures(r,d,n,a);return isIntrospectionQuery(u)?{schema:buildClientSchema(u),supportsSemanticIntrospection:!!l.operationResult.data.__type}:u}function isIntrospectionQuery(r){return"__schema"in r}function isInvalidHttpHeader(r){return"kind"in r}function getHttpHeaders(r,n){const a=r.authentication?.headerValue,i=new Headers;if(i.append(HEADER_USER_AGENT,navigator.userAgent),a&&i.set(HEADER_AUTHORIZATION,a),!r.headers)return i;for(const o of r.headers){if(!o.enabled||n&&!n(o)||o.name===HEADER_USER_AGENT)continue;const{name:s,value:l}=o;if(!s.length)return{kind:"empty-name",name:s};if(!isHttpHeaderKeyValid(s))return{kind:"invalid-name",name:s};(s!==HEADER_AUTHORIZATION||!a)&&i.append(s,l)}return i}async function fetchGraphQLIntrospectionDirective(r,n,a){const{response:{responseOrError:i}}=await fetchCore(r,{query:INTROSPECTION_QUERY_DIRECTIVE,operationName:"IntrospectionQuery"},void 0,void 0,n(createRequestId(),"Detect Directive Capabilities"),a);return i instanceof Response?parseAndCheckHttpResponse(i,!0):i}async function fetchGraphQLIntrospectionInputValue(r,n,a){const{response:{responseOrError:i}}=await fetchCore(r,{query:INTROSPECTION_QUERY_INPUT_VALUE,operationName:"IntrospectionQuery"},void 0,void 0,n(createRequestId(),"Detect InputValue Capabilities"),a);return i instanceof Response?parseAndCheckHttpResponse(i,!0):i}async function fetchGraphQLIntrospectionSchema(r,n,a){const{response:{responseOrError:i}}=await fetchCore(r,{query:INTROSPECTION_QUERY_SCHEMA,operationName:"IntrospectionQuery"},void 0,void 0,n(createRequestId(),"Detect Schema Capabilities"),a);return i instanceof Response?parseAndCheckHttpResponse(i,!0):i}async function fetchGraphQLIntrospectionSearchResult(r,n,a){const{response:{responseOrError:i}}=await fetchCore(r,{query:INTROSPECTION_QUERY_SEARCH_RESULT,operationName:"IntrospectionQuery"},void 0,void 0,n(createRequestId(),"Detect Semantic Introspection Capabilities"),a);return i instanceof Response?parseAndCheckHttpResponse(i,!0):i}async function fetchGraphQLIntrospectionType(r,n,a){const{response:{responseOrError:i}}=await fetchCore(r,{query:INTROSPECTION_QUERY_TYPE,operationName:"IntrospectionQuery"},void 0,void 0,n(createRequestId(),"Detect Type Capabilities"),a);return i instanceof Response?parseAndCheckHttpResponse(i,!0):i}async function fetchGraphQLSchemaByFeatures(r,n,a,i){const o=getIntrospectionQuery(n),s=await fetchCore(r,{query:o,operationName:"IntrospectionQuery"},void 0,void 0,a(createRequestId(),"Introspection"),i),{responseOrError:l}=s.response;if(!(l instanceof Response))return l;const f=await parseAndCheckHttpResponse(l,!0);return f.error?f.error:f.operationResult.data}async function fetchCore(r,n,a,i,o,s){const l=r.includeCookies?"include":"same-origin",{extensions:f,operationName:d,query:u,variables:c,files:v}=n,h={cache:"no-cache",credentials:l,referrerPolicy:IS_RUNNING_IN_ELECTRON?"no-referrer":"strict-origin-when-cross-origin"},m=new Headers(r.headers);let g,_,S;if(r.disableCors&&(h.mode="no-cors"),r.useGET)_={...h,method:"GET",headers:m},S=rewriteURIForGET(r.uri,n),o?.requestInterceptor(S,"GET",m),g=async O=>createFetchResult(S,"GET",O,mapHeadersToDictionary(m),_.credentials,_.referrerPolicy);else{const N={extensions:f,operationName:d,query:u,variables:c};let O;if(isGraphQLVariableMap(c)&&v?.length){const F=structuredClone(c),L=new FormData,k=v.flatMap(({variableName:B,fieldPath:j,fileOrFiles:$})=>Array.isArray($)?$.map((A,R)=>({variableName:B,fieldPath:j,file:A,index:R})):[{variableName:B,fieldPath:j,file:$}]);k.forEach(({variableName:B,fieldPath:j,index:$})=>{if(j?.length){let A=F[B];const R=j.length-1;for(let y=0;y<j.length;y++)y===R?$===void 0?A[j[y]]=null:A[j[y]][$]=null:A=A[j[y]]}else $===void 0?F[B]=null:F[B][$]=null}),N.variables=F,L.append("operations",JSON.stringify(N));const P=k.reduce((B,{variableName:j,fieldPath:$,index:A},R)=>({...B,[R]:[`variables.${j}${$?.length?"."+$?.join("."):""}${A===void 0?"":"."+A}`]}),{});L.append("map",JSON.stringify(P));const U=(await getFileContents(distinct(k.map(({file:{id:B}})=>B)))).reduce((B,j)=>({...B,[j.itemId]:j.content}),{});k.forEach(({file:{id:B}},j)=>{L.append(`${j}`,U[B])}),O=L}else m.append(HEADER_CONTENT_TYPE,"application/json"),O=JSON.stringify(N);const M="POST";_={...h,method:M,headers:m,body:O},S=r.uri,o?.requestInterceptor(S,M,m,O),g=async F=>createFetchResult(S,M,F,mapHeadersToDictionary(m),_.credentials,_.referrerPolicy,N)}return await fetch(S,{..._,signal:s}).then(N=>o?.responseInterceptor(N)??N).catch(catchNetworkError).then(N=>o?.responseErrorInterceptor(N)??N).then(N=>isGraphQLVariableBatch(c)?handleVariableBatchingResponse(N,i):handleIncrementalResponse(N,a)).then(N=>g(N))}function createFetchResult(r,n,a,i,o,s,l){return{request:{uri:r,cache:"no-cache",credentials:o,headers:i,method:n,referrerPolicy:s,body:l},response:a}}const SERVER_NOT_REACHABLE="Server Not Reachable";function catchNetworkError(r){return isAbortError(r)?new ClientAbortError:r instanceof TypeError?createServerNetworkError(SERVER_NOT_REACHABLE,r.message):createServerNetworkError(SERVER_NOT_REACHABLE)}async function handleVariableBatchingResponse(r,n){let a=GraphQLResponseKind.SIMPLE;if(r instanceof Response&&r.ok&&!r.bodyUsed&&r.headers&&n){const i=r.headers.get("content-type")?.startsWith("application/jsonl")?await parseJSONLStream(r):await e(r);if(isAsyncIterable$1(i)){const o=async()=>{let s=0;try{for await(const l of i)isJSONLError(l)?n.onError(l,s++):"json"in l?l.json?n.onNext(l.body,s++):n.onError(createMultipartBodyParsingError(l.body),s++):n.onNext(l,s++)}catch(l){isAbortError(l)?n.onError(new ClientAbortError,s):n.onError(createServerParseError(r,l,""),s)}n.onComplete(s)};a=GraphQLResponseKind.VARIABLE_BATCHING,setTimeout(o,0)}}return{kind:a,responseOrError:r}}async function handleIncrementalResponse(r,n){let a=GraphQLResponseKind.SIMPLE;if(r instanceof Response&&r.ok&&!r.bodyUsed&&r.headers&&n){const i=r.headers.get("content-type")?.startsWith("application/jsonl")?await parseJSONLStream(r):await e(r);if(isAsyncIterable$1(i)){const o=async()=>{let s=0;try{for await(const l of i)isJSONLError(l)?n.onError(l,s++):"json"in l?l.json?n.onNext(l.body,s++):n.onError(createMultipartBodyParsingError(l.body),s++):n.onNext(l,s++)}catch(l){isAbortError(l)?n.onError(new ClientAbortError,s):n.onError(createServerParseError(r,l,""),s)}n.onComplete(s)};a=GraphQLResponseKind.INCREMENTAL,setTimeout(o,0)}}return{kind:a,responseOrError:r}}function createMultipartBodyParsingError(r){return createMultipartError(new Error("The multipart body could not be converted into JSON."),r)}function parseAndCheckHttpResponse(r,n){return r.text().then(a=>{try{const i=JSON.parse(a);return typeof i=="object"&&(n&&i.data||!n&&(i.data||i.errors))?{operationResult:i,contentLength:a.length}:{error:createServerError(r,a,`Response not successful: Received status code ${r.status}`),contentLength:a.length}}catch(i){return{error:createServerParseError(r,i,a),contentLength:a.length}}})}function rewriteURIForGET(r,{query:n,operationName:a,variables:i,extensions:o}){const s=[],l=(h,m)=>{s.push(`${h}=${encodeURIComponent(m)}`)};n&&l("query",n),a&&l("operationName",a),i&&l("variables",JSON.stringify(i)),o&&l("extensions",JSON.stringify(o));let f="",d=r;const u=r.indexOf("#");u!==-1&&(f=r.substr(u),d=r.substr(0,u));const c=d.indexOf("?")===-1?"?":"&";return d+c+s.join("&")+f}function createMultipartError(r,n){return{...r,name:MULTIPART_ERROR_NAME,body:n}}function createServerError({status:r,statusText:n},a,i){return{message:i,name:SERVER_ERROR_NAME,statusCode:r,statusText:n,bodyText:a}}function createServerNetworkError(r,n){return{message:r,name:SERVER_NETWORK_ERROR_NAME,statusText:n}}function createServerParseError({status:r,statusText:n},a,i){return{...a,name:SERVER_PARSE_ERROR_NAME,statusCode:r,statusText:n,bodyText:i}}function determineIntrospectionFeatures({schema:r,directive:n,inputValue:a,type:i}){return{directiveIsRepeatable:!!n?.fields.some(o=>o.name==="isRepeatable"),directiveLocations:!n||n.fields.some(o=>o.name==="locations"),directiveDeprecation:!!n?.fields.some(o=>o.name==="isDeprecated"),inputValueDeprecation:!!a?.fields.some(o=>o.name==="isDeprecated"),oneOf:!!i?.fields.some(o=>o.name==="oneOf"),specifiedByUrl:!!i?.fields.some(o=>o.name==="specifiedByURL"),subscription:!!r?.fields.some(o=>o.name==="subscriptionType")}}function createHttpLogger(r,n,a,i,o){return{requestInterceptor:createHttpRequestInterceptor(r,n,a,i,o),responseInterceptor:createHttpResponseInterceptor(r,n,a,i,o),responseErrorInterceptor:createHttpResponseErrorInterceptor(r,n,a,i,o)}}function createHttpRequestInterceptor(r,n,a,i,o){return(s,l,f,d,u,c)=>{const v=now(),h=mapHeadersToDictionary(f),m=mapFormDataToString(d);sendHttpRequest(r,n,a,i,o?.scopeId,v,s,l,h,m,u,c,o?.name)}}function createHttpResponseInterceptor(r,n,a,i,o){return s=>{const l=now(),{status:f,statusText:d}=s,u=mapHeadersToDictionary(s.headers),c=o?.scopeId;sendHttpResponse(r,n,a,i,c,l,f,d,u);const v=s.clone();return new Promise(async h=>{let m=0;try{const g=v.body?.getReader();if(g)try{const _=new TextDecoder;let S,N=0;for(;!(S=await g.read()).done;){const O=now(),M=_.decode(S.value);m+=M.length,sendHttpResponseBodyChunk(r,n,a,c,O,M,N++)}s.status>299?sendHttpResponseFailed(r,n,a,i,c,now(),createServerError(s,"",""),m):sendHttpResponseFinished(r,n,a,i,c,now(),m)}finally{await g.cancel()}}catch(g){g instanceof ClientAbortError?sendHttpResponseCancelled(r,n,a,i,c,now(),g,m):sendHttpResponseFailed(r,n,a,i,c,now(),createServerError(s,"",""),m)}finally{h()}}),s}}function createHttpResponseErrorInterceptor(r,n,a,i,o){return s=>{if(s instanceof Response)return s;const l=now(),f=o?.scopeId;return s instanceof ClientAbortError?(sendHttpResponseCancelled(r,n,a,i,f,l,s,0),s):(sendHttpResponseFailed(r,n,a,i,f,l,s,0),s)}}function mapFormDataToString(r){if(!r||typeof r=="string")return r;const n={};for(const[a,i]of r.entries()){const o=i.valueOf();typeof o=="string"?n[a]=o:n[a]="File Data omitted"}return JSON.stringify(n,void 0,2)}function mapHeadersToDictionary(r){let n={};return r.forEach((a,i)=>{n[i]?Array.isArray(n[i])?n={...n,[i]:[...n[i],a]}:n={...n,[i]:[n[i],a]}:n={...n,[i]:a}}),n}class SchemaCache{#e=new LRUMap;get(n){return this.#e.get(n)??null}set(n,a){const i=new SchemaCacheItem(a);return this.#e.get(n)?.dispose(),this.#e.set(n,i),i}remove(n){this.#e.get(n)?.dispose(),this.#e.delete(n)}}class SchemaCacheItem{#e;#t;#r;#n;constructor(n){this.#e=new Map(n.directives),this.#t=new Map(n.fields),this.#r=new Map(n.types),this.#n=new Map(n.fields)}getDirective(n){return this.#e.get(n)??null}getDirectives(n){const a=[];if(n?.length){const i=n.toLocaleLowerCase();this.#e.forEach(o=>{!INTROSPECTION_PREFIX.test(o.name)&&o.name.toLocaleLowerCase().includes(i)&&a.push(o)})}else this.#e.forEach(i=>{INTROSPECTION_PREFIX.test(i.name)||a.push(i)});return a.sort(objectNameComparer)}getField(n){return this.#t.get(n)??null}getFields(n,a){const i=n+".",o=[];if(a?.includeIntrospectionFields&&this.addIntrospectionFields(n,o),a?.filter?.length){const s=a.filter.toLocaleLowerCase();this.#t.forEach(l=>{l.coordinate.startsWith(i)&&l.name.toLocaleLowerCase().includes(s)&&o.push(l)})}else this.#t.forEach(s=>{s.coordinate.startsWith(i)&&o.push(s)});return o.sort(objectNameComparer)}getType(n){return this.#r.get(n)??null}getTypes(n){const a=[];if(n?.length){const i=n.toLocaleLowerCase();this.#r.forEach(o=>{!INTROSPECTION_PREFIX.test(o.name)&&o.name.toLocaleLowerCase().includes(i)&&a.push(o)})}else this.#r.forEach(i=>{INTROSPECTION_PREFIX.test(i.name)||a.push(i)});return a.sort(objectNameComparer)}getInterfaces(n,a){const i=this.#r.get(n);if(!i?.interfaces?.length)return[];if(a?.length){const o=a.toLocaleLowerCase();return i.interfaces.filter(({name:s})=>s.toLocaleLowerCase().includes(o)).sort(objectNameComparer)}return i.interfaces.sort(objectNameComparer)}getPossibleTypes(n,a){const i=this.#r.get(n);if(!i?.types?.length)return[];if(a?.length){const o=a.toLocaleLowerCase();return i.types.map(getInnerType).filter(({name:s})=>s.toLocaleLowerCase().includes(o)).sort(objectNameComparer)}return i.types.map(getInnerType).sort(objectNameComparer)}getTypesByTypeKind(n,a){const i=[];if(a?.length){const o=a.toLocaleLowerCase();this.#r.forEach(s=>{s.typeKind===n&&!INTROSPECTION_PREFIX.test(s.name)&&s.name.toLocaleLowerCase().includes(o)&&i.push(s)})}else this.#r.forEach(o=>{o.typeKind===n&&!INTROSPECTION_PREFIX.test(o.name)&&i.push(o)});return i.sort(objectNameComparer)}dispose(){this.#e.clear(),this.#t.clear(),this.#r.clear()}addIntrospectionFields(n,a){const i=this.#r.get(n),o=i?.kind==="query-type",s=i?.kind==="subscription-type";if(o){const l=this.getIntrospectionSchemaField(i.name);l&&a.push(l);const f=this.getIntrospectionTypeField(i.name);f&&a.push(f)}if(!s&&i){const l=this.getIntrospectionTypenameField(i.name);l&&a.push(l)}}getIntrospectionSchemaField(n){const a=IntrospectionField.SCHEMA_FIELD;let i=this.#n.get(a);if(!i){const o=this.#r.get("__Schema");o&&(i={kind:"field",name:a,coordinate:createSchemaMemberCoordinate(n,a),valueType:{kind:"value-type",isList:!1,isOptional:!1,type:o}},this.#n.set(a,i))}return i}getIntrospectionTypeField(n){const a=IntrospectionField.TYPE_FIELD;let i=this.#n.get(a);if(!i){const o=this.#r.get("__Type"),s=this.#r.get("String");o&&s&&(i={kind:"field",name:a,coordinate:createSchemaMemberCoordinate(n,a),valueType:{kind:"value-type",isList:!1,isOptional:!0,type:o},arguments:[{kind:"argument",name:"name",coordinate:createSchemaMemberCoordinate(n,a,"name"),type:{kind:"value-type",isList:!1,isOptional:!1,type:s}}]},this.#n.set(a,i))}return i}getIntrospectionTypenameField(n){const a=IntrospectionField.TYPENAME_FIELD;let i=this.#n.get(a);if(i)i={...i,coordinate:createSchemaMemberCoordinate(n,IntrospectionField.TYPE_FIELD)};else{const o=this.#r.get("String");o&&(i={kind:"field",name:a,coordinate:createSchemaMemberCoordinate(n,a),valueType:{kind:"value-type",isList:!1,isOptional:!1,type:o}},this.#n.set(a,i))}return i}}const schemaCache=new SchemaCache;async function getSchemaCacheItem(r){const n=harmonizeSchemaUrl(r),a=schemaCache.get(n);if(a)return a;const i=await getGraphQLSchemaItems(n);return i?schemaCache.set(n,i):null}function removeSchemaCacheItem(r){schemaCache.remove(harmonizeSchemaUrl(r))}function getResolvedFiles(r,n,a,i,o){return isGraphQLVariableBatch(o)?Promise.resolve(void 0):getSchemaCacheItem(a.sdlEndpoint||a.endpoint).then(s=>!a.useGet&&n&&s&&r?resolveFiles(n,i,o,s,(...l)=>getFileItemInfosByNames(r,...l)):Promise.resolve(void 0))}async function resolveFiles(r,n,a,i,o){let s=[];try{for(const l of r.definitions)if(l.kind===ASTNodeKind.OPERATION_DEFINITION&&l.name?.value===n){if(!l.variablesDefinition?.variableDefinitions.length)return s;for(const f of l.variablesDefinition.variableDefinitions){const d=getTypeNodeName(f.type),u=i.getType(d),c=f.variable.name?.value??"",v=await resolveFieldPathsOfUploadTypes(c,a?.[c],u,o,i);v.length&&(s=[...s,...v])}}}catch(l){console.error(l)}return s}async function resolveFieldPathsOfUploadTypes(r,n,a,i,o){if(!n)return[];if(typeof n=="object"){const s=[],l=[[[],n]];let f;for(;(f=l.shift())!==void 0;){const[d,u]=f;if(u){if(isObjectArray(u))for(let c=0;c<u.length;c++)l.push([[...d,c],u[c]]);else if(typeof u=="object"&&!Array.isArray(u))for(const c of Object.keys(u))l.push([[...d,c],u[c]]);else if((typeof u=="string"||isStringArray(u))&&isUploadScalarType(a,o,d)){const c=await resolveFileInfos(u,d,i);c&&s.push({variableName:r,fieldPath:d,fileOrFiles:c})}}}return s}else if((typeof n=="string"||isStringArray(n))&&isUploadScalarType(a,o)){const s=await resolveFileInfos(n,void 0,i);if(s)return[{variableName:r,fileOrFiles:s}]}return[]}function resolveFileInfos(r,n,a){if(!r)return Promise.resolve(void 0);if(n?.length&&typeof r=="object"&&!Array.isArray(r)){let i=0,o=r;for(;i<n.length&&o!==void 0&&typeof o=="object"&&!Array.isArray(o);){const s=n[i++];o=o[s]}if(typeof o=="string")return a(o).then(s=>s?.[0]);if(isStringArray(o))return a(...o)}else{if(typeof r=="string")return a(r).then(i=>i?.[0]);if(isStringArray(r))return a(...r)}return Promise.resolve(void 0)}function isUploadScalarType(r,n,a){if(!r)return!1;if(a?.length&&r.typeKind==="input-object"){const i=a.filter(l=>typeof l=="string");let o=getInnerType(r),s;for(const l of i){const f=createSchemaMemberCoordinate(o.name,l);if(s=n.getField(f))o=getInnerType(s.valueType);else return!1}return o.typeKind==="scalar"&&o.name==="Upload"}return r.typeKind==="scalar"&&r.name==="Upload"}function getTypeNodeName(r){if(!r)return"UnknownType";let n=r;for(;n.kind!==ASTNodeKind.NAMED_TYPE;){if(!n.type)return"UnknownType";n=n.type}return n.name.value}function getSchema(r){return getGraphQLSchemaEntity(r.sdlEndpoint||r.endpoint)}async function setSchema(r,n,a,i,o){const s=await getGraphQLSchemaEntity(r),l=harmonizeSchemaUrl(r),f=calculateGraphQLSchemaEntityHash(l,a);if(!s||s.hash!==f){const d=await setGraphQLSchemaEntity(l,n,a,i,o);return removeSchemaCacheItem(l),d}return s}async function fetchItemsByCategory(r,n,a){const i=await getSchemaCacheItem(r);return i?n==="root"?await getSchemaRootTypesCore(r,a):n==="directive"?i.getDirectives(a):i.getTypesByTypeKind(n,a):[]}async function fetchRootTypes(r,n){const a=await getSchemaRootTypesCore(r,n);return a.length?a:void 0}async function getSchemaReference(r,n,a){const i=await getGraphQLSchemaStatistics(r);if(!i)return;const o=await fetchItemsByCategory(r,n,a),s=await getSchemaRootTypesCore(r);return{items:o,rootTypes:s,statistics:i}}async function getSchemaRootTypesCore(r,n){const[a,i]=await Promise.all([getSchemaCacheItem(r),getGraphQLSchemaEntity(r)]);if(!a||!i)return[];const o=[i.queryTypeName?a.getType(i.queryTypeName):void 0,i.mutationTypeName?a.getType(i.mutationTypeName):void 0,i.subscriptionTypeName?a.getType(i.subscriptionTypeName):void 0].filter(isSchemaType);if(n?.length){const s=n.toLocaleLowerCase();return o.filter(({name:l})=>l.toLocaleLowerCase().includes(s))}return o}const runningTasks=new Map;function cancelTask(r){runningTasks.get(r)?.cancel()}function enqueueTask(r){runningTasks.has(r.id)||(runningTasks.set(r.id,r),SCHEDULER_CONTEXT.sendMessage(new Message("scheduler-status-updated",{idling:!1,lastUpdated:now()})),deferWork(()=>{r.execute().catch(n=>{n instanceof TaskFailedError?failTask(SCHEDULER_CONTEXT,r.id,n.message,n.kind,n.details):n instanceof Error?failTask(SCHEDULER_CONTEXT,r.id,n.message,"UNEXPECTED_ERROR"):failTask(SCHEDULER_CONTEXT,r.id,"There was a unexpected error in the task","UNEXPECTED_ERROR")}).finally(()=>{runningTasks.delete(r.id),SCHEDULER_CONTEXT.sendMessage(new Message("scheduler-status-updated",{idling:runningTasks.size===0,lastUpdated:now()}))})}))}function deferWork(r){self.setTimeout(r,0)}const SCHEDULER_CONTEXT={sendMessage:r=>self.postMessage(r)};class SchedulerBase extends MessageObserver{#e={sendMessage:n=>self.postMessage(n)};constructor(){super(),this.initialize()}getContext(){return this.#e}initialize(){self.onmessage=({data:n})=>{this.handleMessage(this.#e,n)},this.registerReceiveMessageHandler(CANCEL_TASK_MESSAGE_TYPE,n=>{cancelTask(n.payload.taskId)}),this.registerReceiveMessageHandler(INITIALIZE_WORKER_MESSAGE_TYPE,n=>{self.appNamespace=n.payload.appNamespace}),this.registerMessageReceiveHandlers()}}const DOCUMENT_ANALYSIS_MESSAGE_TYPE="analyze-document";function analyzeDocument({id:r,payload:{documentId:n},type:a},i){const o=new AbortController;enqueueTask({id:r,cancel:()=>o.abort(),execute:async()=>{const s=await getDocumentItemAndContent(n,o.signal);let l={documentId:n,operations:[]};if(!s){i.sendMessage(new Message(a,l,r));return}const f=await getInterpolatedHttpConnectionForActiveEnvironment(n,o.signal);if(!f){i.sendMessage(new Message(a,l,r));return}const d=getGraphQLDocument(i,s);if(!d){i.sendMessage(new Message(a,{documentId:n,operations:[]},r));return}const u=getOperations(d),c=await getSchemaCacheItem(f.sdlEndpoint||f.endpoint);let v;if(c){const h=s.workspaceId?await getAllFileItemInfos(s.workspaceId):void 0,m=generateVariableJsonSchema(d,g=>c.getType(g),g=>c.getFields(g),h);v=(await setVariableJsonSchema(n,m))?.hash}i.sendMessage(new Message(a,{documentId:n,operations:u,variableJsonSchemaHash:v},r))}})}const DOCUMENT_OPERATIONS_ANALYSIS_MESSAGE_TYPE="analyze-document-operations";function analyzeDocumentOperations({id:r,payload:{documentId:n},type:a},i){const o=new AbortController;enqueueTask({id:r,cancel:()=>o.abort(),execute:async()=>{const s=await getDocumentItemAndContent(n,o.signal),l=getGraphQLDocument(i,s);if(!l){i.sendMessage(new Message(a,{documentId:n,operations:[]},r));return}const f=getOperations(l);i.sendMessage(new Message(a,{documentId:n,operations:f},r))}})}function noop(){}const FILES_UPDATED_MESSAGE_TYPE="files-updated",VARIABLE_JSON_SCHEMA_UPDATED_MESSAGE_TYPE="variable-json-schema-updated";function updatedFiles({id:r,payload:{documentId:n}},a){enqueueTask({id:r,cancel:noop,execute:async()=>{const i=await getDocumentItemAndContent(n);let o={documentId:n};if(i&&i.workspaceId){const s=await getInterpolatedHttpConnectionForActiveEnvironment(n);if(s){const l=getGraphQLDocument(a,i),f=await getSchemaCacheItem(s.sdlEndpoint||s.endpoint);if(l&&f){const d=await getAllFileItemInfos(i.workspaceId),u=generateVariableJsonSchema(l,v=>f.getType(v),v=>f.getFields(v),d),c=await setVariableJsonSchema(n,u);o={documentId:n,variableJsonSchemaHash:c?.hash}}}}a.sendMessage(new Message(VARIABLE_JSON_SCHEMA_UPDATED_MESSAGE_TYPE,o,r))}})}const global$1=globalThis||void 0||self;function extendedTypeof(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function isObject$2(r){return extendedTypeof(r)==="object"}function areGraphQLErrors(r){return Array.isArray(r)&&r.length>0&&r.every(n=>"message"in n)}function limitCloseReason(r,n){return r.length<124?r:n}const GRAPHQL_TRANSPORT_WS_PROTOCOL="graphql-transport-ws";var CloseCode;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(CloseCode||(CloseCode={}));var MessageType;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(MessageType||(MessageType={}));function validateMessage(r){if(!isObject$2(r))throw new Error(`Message is expected to be an object, but got ${extendedTypeof(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${extendedTypeof(r.type)}`);switch(r.type){case MessageType.ConnectionInit:case MessageType.ConnectionAck:case MessageType.Ping:case MessageType.Pong:{if(r.payload!=null&&!isObject$2(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case MessageType.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!isObject$2(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${extendedTypeof(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${extendedTypeof(r.payload.query)}`);if(r.payload.variables!=null&&!isObject$2(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${extendedTypeof(r.payload.variables)}`);if(r.payload.operationName!=null&&extendedTypeof(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${extendedTypeof(r.payload.operationName)}`);if(r.payload.extensions!=null&&!isObject$2(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${extendedTypeof(r.payload.extensions)}`);break}case MessageType.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!isObject$2(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${extendedTypeof(r.payload)}`);break}case MessageType.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!areGraphQLErrors(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case MessageType.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function parseMessage(r,n){return validateMessage(typeof r=="string"?JSON.parse(r,n):r)}function stringifyMessage(r,n){return validateMessage(r),JSON.stringify(r,n)}var __await=function(r){return this instanceof __await?(this.v=r,this):new __await(r)},__asyncGenerator=function(r,n,a){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=a.apply(r,n||[]),o,s=[];return o={},l("next"),l("throw"),l("return"),o[Symbol.asyncIterator]=function(){return this},o;function l(h){i[h]&&(o[h]=function(m){return new Promise(function(g,_){s.push([h,m,g,_])>1||f(h,m)})})}function f(h,m){try{d(i[h](m))}catch(g){v(s[0][3],g)}}function d(h){h.value instanceof __await?Promise.resolve(h.value.v).then(u,c):v(s[0][2],h)}function u(h){f("next",h)}function c(h){f("throw",h)}function v(h,m){h(m),s.shift(),s.length&&f(s[0][0],s[0][1])}};function createClient(r){const{url:n,connectionParams:a,lazy:i=!0,onNonLazyError:o=console.error,lazyCloseTimeout:s=0,keepAlive:l=0,disablePong:f,connectionAckWaitTimeout:d=0,retryAttempts:u=5,retryWait:c=async function(D){let I=1e3;for(let T=0;T<D;T++)I*=2;await new Promise(T=>setTimeout(T,I+Math.floor(Math.random()*2700+300)))},shouldRetry:v=isLikeCloseEvent,isFatalConnectionProblem:h,on:m,webSocketImpl:g,generateID:_=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,D=>{const I=Math.random()*16|0;return(D=="x"?I:I&3|8).toString(16)})},jsonMessageReplacer:S,jsonMessageReviver:N}=r;let O;if(g){if(!isWebSocket(g))throw new Error("Invalid WebSocket implementation provided");O=g}else typeof WebSocket<"u"?O=WebSocket:typeof global$1<"u"?O=global$1.WebSocket||global$1.MozWebSocket:typeof window<"u"&&(O=window.WebSocket||window.MozWebSocket);if(!O)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const M=O,F=(()=>{const b=(()=>{const I={};return{on(T,C){return I[T]=C,()=>{delete I[T]}},emit(T){var C;"id"in T&&((C=I[T.id])===null||C===void 0||C.call(I,T))}}})(),D={connecting:m?.connecting?[m.connecting]:[],opened:m?.opened?[m.opened]:[],connected:m?.connected?[m.connected]:[],ping:m?.ping?[m.ping]:[],pong:m?.pong?[m.pong]:[],message:m?.message?[b.emit,m.message]:[b.emit],closed:m?.closed?[m.closed]:[],error:m?.error?[m.error]:[]};return{onMessage:b.on,on(I,T){const C=D[I];return C.push(T),()=>{C.splice(C.indexOf(T),1)}},emit(I,...T){for(const C of[...D[I]])C(...T)}}})();function L(b){const D=[F.on("error",I=>{D.forEach(T=>T()),b(I)}),F.on("closed",I=>{D.forEach(T=>T()),b(I)})]}let k,P=0,U,B=!1,j=0,$=!1;async function A(){clearTimeout(U);const[b,D]=await(k??(k=new Promise((C,x)=>(async()=>{if(B){if(await c(j),!P)return k=void 0,x({code:1e3,reason:"All Subscriptions Gone"});j++}F.emit("connecting",B);const w=new M(typeof n=="function"?await n():n,GRAPHQL_TRANSPORT_WS_PROTOCOL);let E,q;function G(){isFinite(l)&&l>0&&(clearTimeout(q),q=setTimeout(()=>{w.readyState===M.OPEN&&(w.send(stringifyMessage({type:MessageType.Ping})),F.emit("ping",!1,void 0))},l))}L(H=>{k=void 0,clearTimeout(E),clearTimeout(q),x(H),H instanceof TerminatedCloseEvent&&(w.close(4499,"Terminated"),w.onerror=null,w.onclose=null)}),w.onerror=H=>F.emit("error",H),w.onclose=H=>F.emit("closed",H),w.onopen=async()=>{try{F.emit("opened",w);const H=typeof a=="function"?await a():a;if(w.readyState!==M.OPEN)return;w.send(stringifyMessage(H?{type:MessageType.ConnectionInit,payload:H}:{type:MessageType.ConnectionInit},S)),isFinite(d)&&d>0&&(E=setTimeout(()=>{w.close(CloseCode.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},d)),G()}catch(H){F.emit("error",H),w.close(CloseCode.InternalClientError,limitCloseReason(H instanceof Error?H.message:new Error(H).message,"Internal client error"))}};let z=!1;w.onmessage=({data:H})=>{try{const V=parseMessage(H,N);if(F.emit("message",V),V.type==="ping"||V.type==="pong"){F.emit(V.type,!0,V.payload),V.type==="pong"?G():f||(w.send(stringifyMessage(V.payload?{type:MessageType.Pong,payload:V.payload}:{type:MessageType.Pong})),F.emit("pong",!1,V.payload));return}if(z)return;if(V.type!==MessageType.ConnectionAck)throw new Error(`First message cannot be of type ${V.type}`);clearTimeout(E),z=!0,F.emit("connected",w,V.payload,B),B=!1,j=0,C([w,new Promise((K,Z)=>L(Z))])}catch(V){w.onmessage=null,F.emit("error",V),w.close(CloseCode.BadResponse,limitCloseReason(V instanceof Error?V.message:new Error(V).message,"Bad response"))}}})())));b.readyState===M.CLOSING&&await D;let I=()=>{};const T=new Promise(C=>I=C);return[b,I,Promise.race([T.then(()=>{if(!P){const C=()=>b.close(1e3,"Normal Closure");isFinite(s)&&s>0?U=setTimeout(()=>{b.readyState===M.OPEN&&C()},s):C()}}),D])]}function R(b){if(isLikeCloseEvent(b)&&(isFatalInternalCloseCode(b.code)||[CloseCode.InternalServerError,CloseCode.InternalClientError,CloseCode.BadRequest,CloseCode.BadResponse,CloseCode.Unauthorized,CloseCode.SubprotocolNotAcceptable,CloseCode.SubscriberAlreadyExists,CloseCode.TooManyInitialisationRequests].includes(b.code)))throw b;if($)return!1;if(isLikeCloseEvent(b)&&b.code===1e3)return P>0;if(!u||j>=u||!v(b)||h?.(b))throw b;return B=!0}i||(async()=>{for(P++;;)try{const[,,b]=await A();await b}catch(b){try{if(!R(b))return}catch(D){return o?.(D)}}})();function y(b,D){const I=_(b);let T=!1,C=!1,x=()=>{P--,T=!0};return(async()=>{for(P++;;)try{const[w,E,q]=await A();if(T)return E();const G=F.onMessage(I,z=>{switch(z.type){case MessageType.Next:{D.next(z.payload);return}case MessageType.Error:{C=!0,T=!0,D.error(z.payload),x();return}case MessageType.Complete:{T=!0,x();return}}});w.send(stringifyMessage({id:I,type:MessageType.Subscribe,payload:b},S)),x=()=>{!T&&w.readyState===M.OPEN&&w.send(stringifyMessage({id:I,type:MessageType.Complete},S)),P--,T=!0,E()},await q.finally(G);return}catch(w){if(!R(w))return}})().then(()=>{C||D.complete()}).catch(w=>{D.error(w)}),()=>{T||x()}}return{on:F.on,subscribe:y,iterate(b){const D=[],I={done:!1,error:null,resolve:()=>{}},T=y(b,{next(x){D.push(x),I.resolve()},error(x){I.done=!0,I.error=x,I.resolve()},complete(){I.done=!0,I.resolve()}}),C=function(){return __asyncGenerator(this,arguments,function*(){for(;;){for(D.length||(yield __await(new Promise(E=>I.resolve=E)));D.length;)yield yield __await(D.shift());if(I.error)throw I.error;if(I.done)return yield __await(void 0)}})}();return C.throw=async x=>(I.done||(I.done=!0,I.error=x,I.resolve()),{done:!0,value:void 0}),C.return=async()=>(T(),{done:!0,value:void 0}),C},async dispose(){if($=!0,k){const[b]=await k;b.close(1e3,"Normal Closure")}},terminate(){k&&F.emit("closed",new TerminatedCloseEvent)}}}class TerminatedCloseEvent extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function isLikeCloseEvent(r){return isObject$2(r)&&"code"in r&&"reason"in r}function isFatalInternalCloseCode(r){return[1e3,1001,1006,1005,1012,1013,1014].includes(r)?!1:r>=1e3&&r<=1999}function isWebSocket(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}var backo2,hasRequiredBacko2;function requireBacko2(){if(hasRequiredBacko2)return backo2;hasRequiredBacko2=1,backo2=r;function r(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}return r.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var a=Math.random(),i=Math.floor(a*this.jitter*n);n=(Math.floor(a*10)&1)==0?n-i:n+i}return Math.min(n,this.max)|0},r.prototype.reset=function(){this.attempts=0},r.prototype.setMin=function(n){this.ms=n},r.prototype.setMax=function(n){this.max=n},r.prototype.setJitter=function(n){this.jitter=n},backo2}var backo2Exports=requireBacko2(),Backoff=getDefaultExportFromCjs(backo2Exports),eventemitter3={exports:{}},hasRequiredEventemitter3;function requireEventemitter3(){return hasRequiredEventemitter3||(hasRequiredEventemitter3=1,function(r){var n=Object.prototype.hasOwnProperty,a="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(a=!1));function o(d,u,c){this.fn=d,this.context=u,this.once=c||!1}function s(d,u,c,v,h){if(typeof c!="function")throw new TypeError("The listener must be a function");var m=new o(c,v||d,h),g=a?a+u:u;return d._events[g]?d._events[g].fn?d._events[g]=[d._events[g],m]:d._events[g].push(m):(d._events[g]=m,d._eventsCount++),d}function l(d,u){--d._eventsCount===0?d._events=new i:delete d._events[u]}function f(){this._events=new i,this._eventsCount=0}f.prototype.eventNames=function(){var u=[],c,v;if(this._eventsCount===0)return u;for(v in c=this._events)n.call(c,v)&&u.push(a?v.slice(1):v);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},f.prototype.listeners=function(u){var c=a?a+u:u,v=this._events[c];if(!v)return[];if(v.fn)return[v.fn];for(var h=0,m=v.length,g=new Array(m);h<m;h++)g[h]=v[h].fn;return g},f.prototype.listenerCount=function(u){var c=a?a+u:u,v=this._events[c];return v?v.fn?1:v.length:0},f.prototype.emit=function(u,c,v,h,m,g){var _=a?a+u:u;if(!this._events[_])return!1;var S=this._events[_],N=arguments.length,O,M;if(S.fn){switch(S.once&&this.removeListener(u,S.fn,void 0,!0),N){case 1:return S.fn.call(S.context),!0;case 2:return S.fn.call(S.context,c),!0;case 3:return S.fn.call(S.context,c,v),!0;case 4:return S.fn.call(S.context,c,v,h),!0;case 5:return S.fn.call(S.context,c,v,h,m),!0;case 6:return S.fn.call(S.context,c,v,h,m,g),!0}for(M=1,O=new Array(N-1);M<N;M++)O[M-1]=arguments[M];S.fn.apply(S.context,O)}else{var F=S.length,L;for(M=0;M<F;M++)switch(S[M].once&&this.removeListener(u,S[M].fn,void 0,!0),N){case 1:S[M].fn.call(S[M].context);break;case 2:S[M].fn.call(S[M].context,c);break;case 3:S[M].fn.call(S[M].context,c,v);break;case 4:S[M].fn.call(S[M].context,c,v,h);break;default:if(!O)for(L=1,O=new Array(N-1);L<N;L++)O[L-1]=arguments[L];S[M].fn.apply(S[M].context,O)}}return!0},f.prototype.on=function(u,c,v){return s(this,u,c,v,!1)},f.prototype.once=function(u,c,v){return s(this,u,c,v,!0)},f.prototype.removeListener=function(u,c,v,h){var m=a?a+u:u;if(!this._events[m])return this;if(!c)return l(this,m),this;var g=this._events[m];if(g.fn)g.fn===c&&(!h||g.once)&&(!v||g.context===v)&&l(this,m);else{for(var _=0,S=[],N=g.length;_<N;_++)(g[_].fn!==c||h&&!g[_].once||v&&g[_].context!==v)&&S.push(g[_]);S.length?this._events[m]=S.length===1?S[0]:S:l(this,m)}return this},f.prototype.removeAllListeners=function(u){var c;return u?(c=a?a+u:u,this._events[c]&&l(this,c)):(this._events=new i,this._eventsCount=0),this},f.prototype.off=f.prototype.removeListener,f.prototype.addListener=f.prototype.on,f.prefixed=a,f.EventEmitter=f,r.exports=f}(eventemitter3)),eventemitter3.exports}var eventemitter3Exports=requireEventemitter3(),defaults={},hasRequiredDefaults;function requireDefaults(){if(hasRequiredDefaults)return defaults;hasRequiredDefaults=1,Object.defineProperty(defaults,"__esModule",{value:!0}),defaults.WS_TIMEOUT=defaults.MIN_WS_TIMEOUT=void 0;var r=1e3;defaults.MIN_WS_TIMEOUT=r;var n=3e4;return defaults.WS_TIMEOUT=n,defaults}var defaultsExports=requireDefaults(),messageTypes={},hasRequiredMessageTypes;function requireMessageTypes(){if(hasRequiredMessageTypes)return messageTypes;hasRequiredMessageTypes=1,Object.defineProperty(messageTypes,"__esModule",{value:!0});var r=function(){function n(){throw new Error("Static Class")}return n.GQL_CONNECTION_INIT="connection_init",n.GQL_CONNECTION_ACK="connection_ack",n.GQL_CONNECTION_ERROR="connection_error",n.GQL_CONNECTION_KEEP_ALIVE="ka",n.GQL_CONNECTION_TERMINATE="connection_terminate",n.GQL_START="start",n.GQL_DATA="data",n.GQL_ERROR="error",n.GQL_COMPLETE="complete",n.GQL_STOP="stop",n.SUBSCRIPTION_START="subscription_start",n.SUBSCRIPTION_DATA="subscription_data",n.SUBSCRIPTION_SUCCESS="subscription_success",n.SUBSCRIPTION_FAIL="subscription_fail",n.SUBSCRIPTION_END="subscription_end",n.INIT="init",n.INIT_SUCCESS="init_success",n.INIT_FAIL="init_fail",n.KEEP_ALIVE="keepalive",n}();return messageTypes.default=r,messageTypes}var messageTypesExports=requireMessageTypes(),MessageTypes=getDefaultExportFromCjs(messageTypesExports),protocol={},hasRequiredProtocol;function requireProtocol(){if(hasRequiredProtocol)return protocol;hasRequiredProtocol=1,Object.defineProperty(protocol,"__esModule",{value:!0}),protocol.GRAPHQL_SUBSCRIPTIONS=protocol.GRAPHQL_WS=void 0;var r="graphql-ws";protocol.GRAPHQL_WS=r;var n="graphql-subscriptions";return protocol.GRAPHQL_SUBSCRIPTIONS=n,protocol}var protocolExports=requireProtocol(),isObject$1={},hasRequiredIsObject;function requireIsObject(){if(hasRequiredIsObject)return isObject$1;hasRequiredIsObject=1,Object.defineProperty(isObject$1,"__esModule",{value:!0});function r(n){return n!==null&&typeof n=="object"}return isObject$1.default=r,isObject$1}var isObjectExports=requireIsObject(),isObject=getDefaultExportFromCjs(isObjectExports),isString$1={},hasRequiredIsString;function requireIsString(){if(hasRequiredIsString)return isString$1;hasRequiredIsString=1,Object.defineProperty(isString$1,"__esModule",{value:!0});function r(n){return typeof n=="string"}return isString$1.default=r,isString$1}var isStringExports=requireIsString(),isString=getDefaultExportFromCjs(isStringExports);function symbolObservablePonyfill(r){var n,a=r.Symbol;return typeof a=="function"?a.observable?n=a.observable:(n=a("observable"),a.observable=n):n="@@observable",n}var root;typeof self<"u"?root=self:typeof window<"u"?root=window:typeof global$1<"u"?root=global$1:typeof module<"u"?root=module:root=Function("return this")();var result=symbolObservablePonyfill(root);const _global=typeof global$1<"u"?global$1:typeof window<"u"?window:{},NativeWebSocket=_global.WebSocket||_global.MozWebSocket;class SubscriptionClient{client;operations;url;nextOperationId;connectionParams;minWsTimeout;wsTimeout;unsentMessagesQueue;reconnect;reconnecting;reconnectionAttempts;backoff;connectionCallback;eventEmitter;lazy;inactivityTimeout;inactivityTimeoutId;closedByUser;wsImpl;wsProtocols;wasKeepAliveReceived;tryReconnectTimeoutId;checkConnectionIntervalId;maxConnectTimeoutId;middlewares;maxConnectTimeGenerator;wsOptionArguments;wsOnMessage;constructor(n,a,i,o){const{connectionCallback:s=void 0,connectionParams:l={},minTimeout:f=defaultsExports.MIN_WS_TIMEOUT,timeout:d=defaultsExports.WS_TIMEOUT,reconnect:u=!1,reconnectionAttempts:c=1/0,lazy:v=!1,inactivityTimeout:h=0,wsOptionArguments:m=[],onMessage:g}=a||{};if(this.wsOnMessage=g,this.wsImpl=i||NativeWebSocket,!this.wsImpl)throw new Error("Unable to find native implementation, or alternative implementation for WebSocket!");this.wsProtocols=o||protocolExports.GRAPHQL_WS,this.connectionCallback=s,this.url=n,this.operations={},this.nextOperationId=0,this.minWsTimeout=f,this.wsTimeout=d,this.unsentMessagesQueue=[],this.reconnect=u,this.reconnecting=!1,this.reconnectionAttempts=c,this.lazy=!!v,this.inactivityTimeout=h,this.closedByUser=!1,this.backoff=new Backoff({jitter:.5}),this.eventEmitter=new eventemitter3Exports.EventEmitter,this.middlewares=[],this.client=null,this.maxConnectTimeGenerator=this.createMaxConnectTimeGenerator(),this.connectionParams=this.getConnectionParams(l),this.wsOptionArguments=m,this.lazy||this.connect()}get status(){return this.client===null?this.wsImpl.CLOSED:this.client.readyState}close(n=!0,a=!0){this.clearInactivityTimeout(),this.client!==null&&(this.closedByUser=a,n&&(this.clearCheckConnectionInterval(),this.clearMaxConnectTimeout(),this.clearTryReconnectTimeout(),this.unsubscribeAll(),this.sendMessage(void 0,MessageTypes.GQL_CONNECTION_TERMINATE,null)),this.client.close(),this.client.onopen=null,this.client.onclose=null,this.client.onerror=null,this.client.onmessage=null,this.client=null,this.eventEmitter.emit("disconnected"),n||this.tryReconnect())}request(n){const a=this.getObserver.bind(this),i=this.executeOperation.bind(this),o=this.unsubscribe.bind(this);let s=null;return this.clearInactivityTimeout(),{[result](){return this},subscribe(l,f,d){const u=a(l,f,d);return s=i(n,(c,v)=>{c===null&&v===null?u.complete&&u.complete():c?u.error&&u.error(c[0]):u.next&&u.next(v)}),{unsubscribe:()=>{s&&(o(s),s=null)}}}}}on(n,a,i){const o=this.eventEmitter.on(n,a,i);return()=>{o.off(n,a,i)}}onConnected(n,a){return this.on("connected",n,a)}onConnecting(n,a){return this.on("connecting",n,a)}onDisconnected(n,a){return this.on("disconnected",n,a)}onReconnected(n,a){return this.on("reconnected",n,a)}onReconnecting(n,a){return this.on("reconnecting",n,a)}onError(n,a){return this.on("error",n,a)}unsubscribeAll(){Object.keys(this.operations).forEach(n=>{this.unsubscribe(n)})}applyMiddlewares(n){return new Promise((a,i)=>{((s,l)=>{const f=d=>{if(d)i(d);else if(s.length>0){const u=s.shift();u&&u.applyMiddleware.apply(l,[n,f])}else a(n)};f()})([...this.middlewares],this)})}use(n){return n.forEach(a=>{if(isFunction(a.applyMiddleware))this.middlewares.push(a);else throw new Error("Middleware must implement the applyMiddleware function.")}),this}getConnectionParams(n){return()=>new Promise((a,i)=>{if(isFunction(n))try{return a(n.call(null))}catch(o){return i(o)}a(n)})}executeOperation(n,a){this.client===null&&this.connect();const i=this.generateOperationId();return this.operations[i]={options:n,handler:a},this.applyMiddlewares(n).then(o=>{this.checkOperationOptions(o,a),this.operations[i]&&(this.operations[i]={options:o,handler:a},this.sendMessage(i,MessageTypes.GQL_START,o))}).catch(o=>{this.unsubscribe(i),a(this.formatErrors(o))}),i}getObserver(n,a,i){return isFunction(n)?{next:o=>n(o),error:o=>a&&a(o),complete:()=>i&&i()}:n}createMaxConnectTimeGenerator(){const n=this.minWsTimeout,a=this.wsTimeout;return new Backoff({min:n,max:a,factor:1.2})}clearCheckConnectionInterval(){this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnectionIntervalId=null)}clearMaxConnectTimeout(){this.maxConnectTimeoutId&&(clearTimeout(this.maxConnectTimeoutId),this.maxConnectTimeoutId=null)}clearTryReconnectTimeout(){this.tryReconnectTimeoutId&&(clearTimeout(this.tryReconnectTimeoutId),this.tryReconnectTimeoutId=null)}clearInactivityTimeout(){this.inactivityTimeoutId&&(clearTimeout(this.inactivityTimeoutId),this.inactivityTimeoutId=null)}setInactivityTimeout(){this.inactivityTimeout>0&&Object.keys(this.operations).length===0&&(this.inactivityTimeoutId=setTimeout(()=>{Object.keys(this.operations).length===0&&this.close()},this.inactivityTimeout))}checkOperationOptions(n,a){const{query:i,variables:o,operationName:s}=n;if(!i)throw new Error("Must provide a query.");if(!a)throw new Error("Must provide an handler.");if(!isString(i)&&!getOperationAST(i,s)||s&&!isString(s)||o&&!isObject(o))throw new Error("Incorrect option types. query must be a string or a document,`operationName` must be a string, and `variables` must be an object.")}buildMessage(n,a,i){const o=i&&i.query?{...i,query:typeof i.query=="string"?i.query:print(i.query)}:i;return{id:n,type:a,payload:o}}formatErrors(n){return Array.isArray(n)?n:n&&n.errors?this.formatErrors(n.errors):n&&n.message?[n]:[{name:"FormattedError",message:"Unknown error",originalError:n}]}sendMessage(n,a,i){this.sendMessageRaw(this.buildMessage(n,a,i))}sendMessageRaw(n){switch(this.status){case this.wsImpl.OPEN:let a=JSON.stringify(n);try{JSON.parse(a)}catch{this.eventEmitter.emit("error",new Error(`Message must be JSON-serializable. Got: ${n}`))}this.client.send(a);break;case this.wsImpl.CONNECTING:this.unsentMessagesQueue.push(n);break;default:this.reconnecting||this.eventEmitter.emit("error",new Error("A message was not sent because socket is not connected, is closing or is already closed. Message was: "+JSON.stringify(n)))}}generateOperationId(){return String(++this.nextOperationId)}tryReconnect(){if(!this.reconnect||this.backoff.attempts>=this.reconnectionAttempts)return;this.reconnecting||(Object.keys(this.operations).forEach(a=>{this.unsentMessagesQueue.push(this.buildMessage(a,MessageTypes.GQL_START,this.operations[a].options))}),this.reconnecting=!0),this.clearTryReconnectTimeout();const n=this.backoff.duration();this.tryReconnectTimeoutId=setTimeout(()=>{this.connect()},n)}flushUnsentMessagesQueue(){this.unsentMessagesQueue.forEach(n=>{this.sendMessageRaw(n)}),this.unsentMessagesQueue=[]}checkConnection(){if(this.wasKeepAliveReceived){this.wasKeepAliveReceived=!1;return}this.reconnecting||this.close(!1,!0)}checkMaxConnectTimeout(){this.clearMaxConnectTimeout(),this.maxConnectTimeoutId=setTimeout(()=>{this.status!==this.wsImpl.OPEN&&(this.reconnecting=!0,this.close(!1,!0))},this.maxConnectTimeGenerator.duration())}connect(){this.client=new this.wsImpl(this.url,this.wsProtocols,...this.wsOptionArguments),this.checkMaxConnectTimeout(),this.client.onopen=async()=>{if(this.status===this.wsImpl.OPEN){this.clearMaxConnectTimeout(),this.closedByUser=!1,this.eventEmitter.emit(this.reconnecting?"reconnecting":"connecting");try{const n=await this.connectionParams();this.sendMessage(void 0,MessageTypes.GQL_CONNECTION_INIT,n),this.flushUnsentMessagesQueue()}catch(n){this.sendMessage(void 0,MessageTypes.GQL_CONNECTION_ERROR,n),this.flushUnsentMessagesQueue()}}},this.client.onclose=()=>{this.closedByUser||this.close(!1,!1)},this.client.onerror=n=>{this.eventEmitter.emit("error",n)},this.client.onmessage=({data:n})=>{this.wsOnMessage?.(n),this.processReceivedData(n)}}processReceivedData(n){let a,i;try{a=JSON.parse(n),i=a.id}catch{throw new Error(`Message must be JSON-parseable. Got: ${n}`)}if([MessageTypes.GQL_DATA,MessageTypes.GQL_COMPLETE,MessageTypes.GQL_ERROR].indexOf(a.type)!==-1&&!this.operations[i]){this.unsubscribe(i);return}switch(a.type){case MessageTypes.GQL_CONNECTION_ERROR:this.connectionCallback&&this.connectionCallback(a.payload);break;case MessageTypes.GQL_CONNECTION_ACK:this.eventEmitter.emit(this.reconnecting?"reconnected":"connected",a.payload),this.reconnecting=!1,this.backoff.reset(),this.maxConnectTimeGenerator.reset(),this.connectionCallback&&this.connectionCallback();break;case MessageTypes.GQL_COMPLETE:const o=this.operations[i].handler;delete this.operations[i],o.call(this,null,null);break;case MessageTypes.GQL_ERROR:this.operations[i].handler(this.formatErrors(a.payload),null),delete this.operations[i];break;case MessageTypes.GQL_DATA:const s=a.payload.errors?{...a.payload,errors:this.formatErrors(a.payload.errors)}:a.payload;this.operations[i].handler(null,s);break;case MessageTypes.GQL_CONNECTION_KEEP_ALIVE:const l=typeof this.wasKeepAliveReceived>"u";this.wasKeepAliveReceived=!0,l&&this.checkConnection(),this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnection()),this.checkConnectionIntervalId=setInterval(this.checkConnection.bind(this),this.wsTimeout);break;default:throw new Error("Invalid message type!")}}unsubscribe(n){this.operations[n]&&(delete this.operations[n],this.setInactivityTimeout(),this.sendMessage(n,MessageTypes.GQL_STOP,void 0))}}const INVALID_ENDPOINT_ERROR_MESSAGE="Invalid Schema Endpoint for more info double click on the failed Result.",INVALID_HTTP_HEADER_ERROR_MESSAGE="Invalid HTTP Header for more info double click on the failed Result.",EXECUTE_OPERATION_REQUEST_MESSAGE_TYPE="execute-operation";function runOperation({payload:{documentId:r,workspaceId:n,environmentId:a,operationIndex:i=0}},o){const s=new AbortController;enqueueTask({id:r,cancel:()=>s.abort(),execute:async()=>{const l=await getDocumentItemAndContent(r,s.signal);if(!l)return;const[f,d]=await Promise.all([getConnectionSettings(r,s.signal),getResolvedVariables(a)]),u=interpolateHttpConnectionSettings(f,d);if(!u)return;let c;function v(){c?.cancel(),s.signal.removeEventListener("abort",v)}s.signal.addEventListener("abort",v);const h=createId(),m=getGraphQLDocument(o,l,!0),g=getHttpHeaders(u),_=getGraphQLVariables(o,l,a,i,d);if(m&&(_||!l.variables?.length)){const[S,N]=getOperation(m,i),O=validateDocument(m);if(O.success||(console.warn(O.errorMessage),sendWarning(o,O.errorMessage,r)),isInvalidHttpHeader(g)){const k=S===OperationType.SUBSCRIPTION?{id:h,operationName:N,operationType:S,operationStatus:"failed",started:now(),payload:{errors:[{message:INVALID_HTTP_HEADER_ERROR_MESSAGE}]}}:{id:h,operationName:N,operationType:S,operationStatus:"failed",started:now(),data:{kind:GraphQLResponseKind.SIMPLE,parsedBody:{errors:[{message:INVALID_HTTP_HEADER_ERROR_MESSAGE}]}}};sendOperationResult(o,r,k),sendOperationRequestFailed(o,r,h,S),sendInvalidHttpHeaderError(o,r,g,createLogMessagePrefix(S,N),h);return}const M=!0,[F,L]=O.success&&M?splitOperation(m,l.body,i)(l,_):[l,_];if(S===OperationType.SUBSCRIPTION)c=createSubscriptionExecutor(o,n,h,F,S,N,i,L,u,g);else{const k=O.success&&(u.endpoint.length||u.sdlEndpoint?.length)?await getResolvedFiles(n,m,u,N,L):void 0;c=createDefaultExecutor(o,n,h,F,S,N,i,L,u,g,k,M)}}else{if(isInvalidHttpHeader(g)){const S=OperationType.QUERY;sendOperationResult(o,r,{id:h,operationType:S,operationStatus:"failed",started:now(),data:{kind:GraphQLResponseKind.SIMPLE,parsedBody:{errors:[{message:INVALID_HTTP_HEADER_ERROR_MESSAGE}]}}}),sendOperationRequestFailed(o,r,h,S),sendInvalidHttpHeaderError(o,r,g,createLogMessagePrefix(S),h);return}c=createDefaultExecutor(o,n,h,l,OperationType.QUERY,void 0,i,_,u,g)}s.signal.aborted||await c.execute()}})}function createLogMessagePrefix(r,n){const a=n?`"${n}" `:"";return`${createHumanReadableOperationType(r)} operation ${a}`}function createHumanReadableOperationType(r){switch(r){case OperationType.MUTATION:return"Mutation";case OperationType.SUBSCRIPTION:return"Subscription";default:return"Query"}}const createDefaultExecutor=(r,n,a,i,o,s,l,f,d,u,c,v=!1)=>{if(o===OperationType.SUBSCRIPTION)throw new Error("Subscription type is not allowed!");const h=new AbortController,{id:m,body:g}=i,_=()=>{sendOperationRequestSucceeded(r,m,a,o)};return{cancel:async()=>h.abort(),execute:()=>new Promise(async S=>{if(d?.endpoint.length){const N=now();sendOperationRequestStarted(r,m,a,o);const M={headers:u??new Headers,uri:d.endpoint,useGET:d.useGet,includeCookies:d.includeCookies};let F=!1;const L=await executeOperation(M,{operationName:v?void 0:s,query:g,variables:f,files:c},{onComplete:()=>{F||_(),S()},onError:(P,U)=>{F=!0,P instanceof ClientAbortError?sendOperationRequestCancelled(r,m,a,o):(sendOperationResultPatch(r,m,a,{payload:P,success:!1,received:now(),index:U}),sendOperationRequestFailed(r,m,a,o))},onNext:(P,U)=>{sendOperationResultPatch(r,m,a,{payload:P,success:!0,received:now(),index:U})}},{onComplete:()=>{F||_(),S()},onError:(P,U)=>{F=!0,P instanceof ClientAbortError?sendOperationRequestCancelled(r,m,a,o):(sendOperationVariableBatchingResult(r,m,a,{payload:P,success:!1,received:now(),index:U}),sendOperationRequestFailed(r,m,a,o))},onNext:(P,U)=>{sendOperationVariableBatchingResult(r,m,a,{payload:P,success:!0,received:now(),index:U})}},createHttpLogger(r,m,a,RequestKind.GRAPHQL_OPERATION,{name:s}),h.signal),k=L.error?.name==="ClientAbortError"?"cancelled":L.error||L.kind!==GraphQLResponseKind.VARIABLE_BATCHING&&L.parsedBody?.errors?.length?"failed":"succeeded";switch(n&&sendHistoryEntry(r,m,createDocumentId(),n,k,o,s,l),sendOperationResult(r,m,{id:a,operationName:s,operationStatus:k,operationType:o,started:N,data:L}),k){case"cancelled":sendOperationRequestCancelled(r,m,a,o),S();break;case"failed":sendOperationRequestFailed(r,m,a,o),S();break;default:L.kind===GraphQLResponseKind.SIMPLE&&(_(),S());break}}else sendOperationResult(r,m,{id:a,operationName:s,operationType:o,operationStatus:"failed",started:now(),data:{kind:GraphQLResponseKind.SIMPLE,parsedBody:{errors:[{message:INVALID_ENDPOINT_ERROR_MESSAGE}]}}}),sendOperationRequestFailed(r,m,a,o),sendInvalidEndpointWarning(r,m,createLogMessagePrefix(o,s),a),S()})}},createSubscriptionExecutor=(r,n,a,i,o,s,l,f,d,u)=>{if(o!==OperationType.SUBSCRIPTION)throw new Error("Only the Subscription type is allowed here!");const c=new AbortController,{id:v,body:h}=i;return{cancel:async()=>c.abort(),execute:async()=>{let m=!1;const g=getSSESubscriptionEndpoint(d),_=getWSSubscriptionEndpoint(d);if(g.length||_.length)return new Promise(async S=>{const N=createDocumentId(),O=u?Object.fromEntries(u.entries()):{},M=d.subscriptionProtocol??DEFAULT_SUBSCRIPTION_PROTOCOL,F=P=>P===GRAPHQL_SSE_SUBSCRIPTION_PROTOCOL?g:_;sendOperationRequestStarted(r,v,a,o),sendSubscriptionRequestStarted(r,v,a,RequestKind.GRAPHQL_OPERATION,now(),F(M),M,O);const L=P=>{if(m)return;m=!0;const U=mapToGraphQLErrors(P);sendSubscriptionRequestStopped(r,v,a,RequestKind.GRAPHQL_OPERATION,now(),"failed",U),sendOperationResult(r,v,{id:a,operationName:s,operationType:o,operationStatus:"failed",started:now(),payload:{errors:U}}),n&&sendHistoryEntry(r,v,N,n,"failed",o,s,l),sendOperationRequestFailed(r,v,a,o),S()},k=SUBSCRIPTION_PROVIDERS[M](F,O,{includeCookies:d.includeCookies,onConnected:P=>{if(P){L(P);return}sendOperationResult(r,v,{id:a,operationName:s,operationType:o,operationStatus:"succeeded",started:now()}),n&&sendHistoryEntry(r,v,N,n,"succeeded",o,s,l)}});try{let P=function(){k.close(),sendOperationRequestCancelled(r,v,a,o),sendSubscriptionRequestStopped(r,v,a,RequestKind.GRAPHQL_OPERATION,now(),"closed"),c.signal.removeEventListener("abort",P),S()};const U=await k.execute({query:h,operationName:s,variables:f},j=>sendSubscriptionRequestMessage(r,v,a,now(),typeof j=="string"?j:JSON.stringify(j)));k instanceof AutoSubscriptionProvider&&k.protocol&&sendSubscriptionRequestProtocol(r,v,a,RequestKind.GRAPHQL_OPERATION,k.protocol);let B=0;U.subscribe({next:j=>{sendOperationResultEvent(r,v,a,{payload:j,received:now(),success:!j?.errors?.length,index:B++})},error:L,complete:()=>{sendOperationRequestSucceeded(r,v,a,o),sendSubscriptionRequestStopped(r,v,a,RequestKind.GRAPHQL_OPERATION,now(),"completed"),S()}}),c.signal.aborted?P():c.signal.addEventListener("abort",P)}catch(P){L(P)}});sendOperationResult(r,v,{id:a,operationName:s,operationType:o,operationStatus:"failed",started:now(),payload:{errors:[{message:INVALID_ENDPOINT_ERROR_MESSAGE}]}}),sendOperationRequestFailed(r,v,a,o),sendInvalidEndpointWarning(r,v,createLogMessagePrefix(o,s),a)}}};function getSSESubscriptionEndpoint(r){return r?r.sseSubscriptionEndpoint||r.endpoint:""}function getWSSubscriptionEndpoint(r){return r?r.subscriptionEndpoint||r.endpoint.replace(/^http/i,"ws"):""}function mapToGraphQLErrors(r){return"type"in r?[r.type==="closed"&&"code"in r?{message:"Subscription closed",extensions:{code:r.code,reason:r.reason,wasClean:r.wasClean}}:{message:"Unknown subscription error"}]:isObjectArray(r)?r.every(n=>"message"in n)?r.map(({message:n})=>({message:n})):r.length<=1?[{message:"Unknown subscription error"}]:[{message:`${r.length} unknown subscription errors`}]:["message"in r?{message:r.message}:r]}const SUBSCRIPTION_PROVIDERS={[AUTO_SUBSCRIPTION_PROTOCOL]:(r,n,a)=>new AutoSubscriptionProvider(r,n,a),[GRAPHQL_WS_SUBSCRIPTION_PROTOCOL]:(r,n,a)=>new GraphQLWSSubscriptionProvider(r,n,a),[APOLLO_SUBSCRIPTION_PROTOCOL]:(r,n,a)=>new ApolloSubscriptionProvider(r,n,a),[GRAPHQL_SSE_SUBSCRIPTION_PROTOCOL]:(r,n,a)=>new GraphQLSSESubscriptionProvider(r,n,a)};class SubscriptionProvider{constructor(n,a,i){this.resolveSubscriptionUrl=n,this.connectionParams=a,this.extraOptions=i}}class AutoSubscriptionProvider extends SubscriptionProvider{provider;subscriptionProtocol;async execute(n,a){const i=this;if(!this.provider){const[o,s]=await new Promise(l=>{const f=i.resolveSubscriptionUrl(AUTO_SUBSCRIPTION_PROTOCOL);if(!f.length){l([new GraphQLSSESubscriptionProvider(i.resolveSubscriptionUrl,i.connectionParams,i.extraOptions),GRAPHQL_SSE_SUBSCRIPTION_PROTOCOL]);return}const d=new WebSocket(f,[GRAPHQL_WS_SUBSCRIPTION_PROTOCOL,APOLLO_SUBSCRIPTION_PROTOCOL]);d.onopen=function(){switch(d.protocol){case APOLLO_SUBSCRIPTION_PROTOCOL:l([new ApolloSubscriptionProvider(i.resolveSubscriptionUrl,i.connectionParams,i.extraOptions),APOLLO_SUBSCRIPTION_PROTOCOL]);break;default:l([new GraphQLWSSubscriptionProvider(i.resolveSubscriptionUrl,i.connectionParams,i.extraOptions),GRAPHQL_WS_SUBSCRIPTION_PROTOCOL]);break}d.close()},d.onerror=function(){l([new GraphQLSSESubscriptionProvider(i.resolveSubscriptionUrl,i.connectionParams,i.extraOptions),GRAPHQL_SSE_SUBSCRIPTION_PROTOCOL]),d.close()}});this.provider=o,this.subscriptionProtocol=s}return this.provider.execute(n,a)}get protocol(){return this.subscriptionProtocol}close(){this.provider?.close()}}class ApolloSubscriptionProvider extends SubscriptionProvider{closeFunc;observable;createClient(n){const a=new SubscriptionClient(this.resolveSubscriptionUrl(APOLLO_SUBSCRIPTION_PROTOCOL),{lazy:!1,reconnect:!1,connectionParams:this.connectionParams,connectionCallback:this.extraOptions?.onConnected,onMessage:n});return this.closeFunc=()=>{a.close(!0)},a}execute(n,a){return this.observable||(this.observable=createObservable(i=>{const o=this.createClient(a);return o.onError(s=>i.error(s)),o.request(n).subscribe(i).unsubscribe})),Promise.resolve(this.observable)}close(){this.closeFunc?.()}}class GraphQLWSSubscriptionProvider extends SubscriptionProvider{closeFunc;observable;createClient(n){let a,i;const o=createClient({url:this.resolveSubscriptionUrl(GRAPHQL_WS_SUBSCRIPTION_PROTOCOL),lazy:!0,retryAttempts:0,keepAlive:ONE_MINUTE,connectionParams:this.connectionParams,on:{connected:s=>{if(!(s instanceof WebSocket)){this.extraOptions?.onConnected?.({message:"Unknown socket"});return}a=s,this.extraOptions?.onConnected?.()},error:s=>{this.extraOptions?.onConnected?.(s)},ping:s=>{s||(i=self.setTimeout(()=>{a?.readyState===WebSocket.OPEN&&a.close(4408,"Request Timeout")},FIVE_SECONDS))},pong:s=>{s&&self.clearTimeout(i)},message:n}});return this.close=()=>{o.dispose()},o}execute(n,a){return this.observable||(this.observable=createObservable(i=>this.createClient(a).subscribe(n,{next:(...o)=>i.next(...o),error:o=>i.error(o),complete:()=>i.complete()}))),Promise.resolve(this.observable)}close(){this.closeFunc?.()}}class GraphQLSSESubscriptionProvider extends SubscriptionProvider{closeFunc;observable;createClient(n){const a=createClient$1({url:this.resolveSubscriptionUrl(GRAPHQL_SSE_SUBSCRIPTION_PROTOCOL),retryAttempts:0,credentials:this.extraOptions?.includeCookies?"include":"same-origin",referrerPolicy:IS_RUNNING_IN_ELECTRON?"no-referrer":"strict-origin-when-cross-origin",headers:{...this.connectionParams,"content-type":"application/json"},onMessage:n});return this.extraOptions?.onConnected?.(),this.close=()=>{a.dispose()},a}execute(n,a){return this.observable||(this.observable=createObservable(i=>this.createClient(a).subscribe(n,{next:(...o)=>i.next(...o),error:o=>i.error(o),complete:()=>i.complete()}))),Promise.resolve(this.observable)}close(){this.closeFunc?.()}}function createObservable(r){return{subscribe:r}}const node=function(){var r=[{defaultValue:null,kind:"LocalArgument",name:"stageId"}],n=[{kind:"Variable",name:"id",variableName:"stageId"}],a={alias:null,args:null,kind:"ScalarField",name:"downloadUrl",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"tag",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:r,kind:"Fragment",metadata:null,name:"schemaApiFetcherTaskQuery",selections:[{alias:null,args:n,concreteType:"Stage",kind:"LinkedField",name:"stageById",plural:!1,selections:[{alias:null,args:null,concreteType:"PublishedSchemaVersion",kind:"LinkedField",name:"publishedSchema",plural:!1,selections:[{alias:null,args:null,concreteType:"SchemaVersion",kind:"LinkedField",name:"version",plural:!1,selections:[a,i],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:r,kind:"Operation",name:"schemaApiFetcherTaskQuery",selections:[{alias:null,args:n,concreteType:"Stage",kind:"LinkedField",name:"stageById",plural:!1,selections:[{alias:null,args:null,concreteType:"PublishedSchemaVersion",kind:"LinkedField",name:"publishedSchema",plural:!1,selections:[{alias:null,args:null,concreteType:"SchemaVersion",kind:"LinkedField",name:"version",plural:!1,selections:[a,i,o],storageKey:null}],storageKey:null},o],storageKey:null}]},params:{id:"8cddc0556879bf1f147b06775d33b192",metadata:{},name:"schemaApiFetcherTaskQuery",operationKind:"query",text:null}}}();node.hash="1359c500cfecb2578c682124e7dad7ec";const DEFAULT_SCHEMA_INFO={endpoint:"",exists:!1,hash:"",indexed:!1,hasMutationType:!1,hasSubscriptionType:!1,hasUploadType:!1,supportsSemanticIntrospection:!1},CANCEL_OPERATION_REQUEST_MESSAGE_TYPE="cancel-request",SCHEMA_API_FETCHER_MESSAGE_TYPE="fetch-api-schema",apiIdOfRunningFetches=new Set;function fetchApiSchema({id:r,type:n,payload:{apiId:a,stageId:i}},o){const s=new AbortController;enqueueTask({id:r,cancel:()=>s.abort(),execute:async()=>{if(apiIdOfRunningFetches.has(a))throw new TaskFailedError("The schema fetch task cannot be executed concurrently on the same API","MULTIPLE_SCHEMA_FETCHES_DETECTED");try{apiIdOfRunningFetches.add(a);const f=(await fetchRelayQuery(node,{stageId:i},s.signal))?.stageById?.publishedSchema?.version;if(f){const d=await fetchSchemaCore$1(o,a,f.downloadUrl,createSchemaInfoApiUrl(i),s.signal);o.sendMessage(new Message(n,d,r));return}o.sendMessage(new Message(n,DEFAULT_SCHEMA_INFO,r))}finally{apiIdOfRunningFetches.delete(a)}}})}async function fetchSchemaCore$1(r,n,a,i,o){const s=createScopeId();sendScopeBegin(r,n,s,now(),"SDL Schema Fetch",{uri:a,kind:"introspection"});try{const l=await fetchSchemaByApiSdlEndpoint(r,n,s,a,o);if("schema"in l){const f=await setSchema(i,l.schema,l.sdlSchema,GraphQLSchemaKind.SDL_FETCH,l.supportsSemanticIntrospection);return{endpoint:f.endpoint,exists:!0,hash:f.hash,indexed:f.indexed,updatedAt:f.updatedAt,hasMutationType:!!f.mutationTypeName,hasSubscriptionType:!!f.subscriptionTypeName,hasUploadType:f.hasUploadType,supportsSemanticIntrospection:f.supportsSemanticIntrospection}}}finally{sendScopeEnd(r,n,s,now())}throw new TaskFailedError("Loading schema failed.","SCHEMA_FETCHING_FAILED")}const FETCH_SCHEMA_DIRECTIVE="fetch-directive";function fetchSchemaDirective({id:r,payload:{schemaEndpoint:n,coordinate:a},type:i},o){enqueueTask({id:r,cancel:noop,execute:async()=>{const s=(await getSchemaCacheItem(n))?.getDirective(a)??void 0;o.sendMessage(new Message(i,s,r))}})}const FETCH_SCHEMA_DIRECTIVES="fetch-directives";function fetchSchemaDirectives({id:r,payload:{schemaEndpoint:n},type:a},i){enqueueTask({id:r,cancel:noop,execute:async()=>{const o=(await getSchemaCacheItem(n))?.getDirectives()??void 0;i.sendMessage(new Message(a,o,r))}})}const SCHEMA_FETCHER_CACHED_MESSAGE_TYPE="get-cached-schema";function getCachedSchema({id:r,type:n,payload:{documentId:a,environmentId:i}},o){const s=new AbortController;enqueueTask({id:r,cancel:()=>s.abort(),execute:async()=>{const l=await getInterpolatedHttpConnection(a,i,s.signal);if(!l?.endpoint.length&&!l?.sdlEndpoint?.length){o.sendMessage(new Message(n,DEFAULT_SCHEMA_INFO,r));return}const f=getHttpHeaders(l,({name:u})=>!FUSION_OPERATION_PLAN_HEADER_NAME_PATTERN.test(u));if(isInvalidHttpHeader(f)){o.sendMessage(new Message(n,DEFAULT_SCHEMA_INFO,r)),sendInvalidHttpHeaderError(o,a,f,"Introspection Query");return}const d=await getSchemaFromCache(l);o.sendMessage(new Message(n,d??DEFAULT_SCHEMA_INFO,r))}})}async function getSchemaFromCache(r){const n=await getSchema(r);if(n)return{endpoint:n.endpoint,exists:!0,hash:n.hash,indexed:n.indexed,updatedAt:n.updatedAt,hasMutationType:!!n.mutationTypeName,hasSubscriptionType:!!n.subscriptionTypeName,hasUploadType:n.hasUploadType,supportsSemanticIntrospection:n.supportsSemanticIntrospection}}const SCHEMA_FETCHER_MESSAGE_TYPE="fetch-schema",documentIdOfRunningFetches=new Set;function fetchSchema({id:r,type:n,payload:{documentId:a,environmentId:i}},o){const s=new AbortController;enqueueTask({id:r,cancel:()=>s.abort(),execute:async()=>{if(documentIdOfRunningFetches.has(a))throw new TaskFailedError("The schema fetch task cannot be executed concurrently on the same document","MULTIPLE_SCHEMA_FETCHES_DETECTED");try{documentIdOfRunningFetches.add(a);const l=await getInterpolatedHttpConnection(a,i,s.signal);if(!l?.endpoint.length&&!l?.sdlEndpoint?.length){o.sendMessage(new Message(n,DEFAULT_SCHEMA_INFO,r));return}const f=getHttpHeaders(l,({name:c})=>!FUSION_OPERATION_PLAN_HEADER_NAME_PATTERN.test(c));if(isInvalidHttpHeader(f)){o.sendMessage(new Message(n,DEFAULT_SCHEMA_INFO,r)),sendInvalidHttpHeaderError(o,a,f,"Introspection Query");return}const d={headers:f,uri:l.endpoint,useGET:l.useGet,includeCookies:l.includeCookies};if(l.sdlEndpoint){const c=await fetchSchemaBySdlEndpointCore(o,a,{...d,uri:l.sdlEndpoint,useGET:!0},GraphQLSchemaKind.SDL_FETCH,l.sdlEndpoint,s.signal);o.sendMessage(new Message(n,c,r));return}try{const c=ensureEndsWithSlash(l.endpoint)+"schema.graphql",v=await fetchSchemaBySdlEndpointCore(o,a,{...d,uri:c,useGET:!0},GraphQLSchemaKind.SDL_PROBE,l.endpoint,s.signal);o.sendMessage(new Message(n,v,r));return}catch{}const u=await fetchSchemaCore(o,a,d,s.signal);o.sendMessage(new Message(n,u,r))}finally{documentIdOfRunningFetches.delete(a)}}})}function ensureEndsWithSlash(r){return r.endsWith("/")?r:r+"/"}async function fetchSchemaBySdlEndpointCore(r,n,a,i,o,s){const l=createScopeId(),f=a.useGET?"GET":"POST";sendScopeBegin(r,n,l,now(),i===GraphQLSchemaKind.SDL_FETCH?"SDL Schema Fetch":"SDL Schema Probe",{uri:a.uri,kind:"introspection",method:f});try{const d=await fetchSchemaBySdlEndpoint(r,n,l,a.uri,a,i,s);if("schema"in d){const u=await setSchema(o,d.schema,d.sdlSchema,i,d.supportsSemanticIntrospection);return{endpoint:u.endpoint,exists:!0,hash:u.hash,indexed:u.indexed,updatedAt:u.updatedAt,hasMutationType:!!u.mutationTypeName,hasSubscriptionType:!!u.subscriptionTypeName,hasUploadType:u.hasUploadType,supportsSemanticIntrospection:u.supportsSemanticIntrospection}}}finally{sendScopeEnd(r,n,l,now())}throw new TaskFailedError("Loading schema failed.","SCHEMA_FETCHING_FAILED")}async function fetchSchemaCore(r,n,a,i){const o=createScopeId(),s=a.useGET?"GET":"POST";sendScopeBegin(r,n,o,now(),"Introspection",{uri:a.uri,kind:"introspection",method:s});let l;try{const f=await fetchGraphQLSchema(a,(d,u)=>createHttpLogger(r,n,d,RequestKind.GRAPHQL_INTROSPECTION,{scopeId:o,name:u}),i);if("schema"in f){const d=await setSchema(a.uri,f.schema,printSchema(f.schema),GraphQLSchemaKind.INTROSPECTION,f.supportsSemanticIntrospection);return{endpoint:d.endpoint,exists:!0,hash:d.hash,indexed:d.indexed,updatedAt:d.updatedAt,hasMutationType:!!d.mutationTypeName,hasSubscriptionType:!!d.subscriptionTypeName,hasUploadType:d.hasUploadType,supportsSemanticIntrospection:d.supportsSemanticIntrospection}}l={itemId:n,scopeId:o}}finally{sendScopeEnd(r,n,o,now())}throw new TaskFailedError("Loading schema failed.","SCHEMA_FETCHING_FAILED",l)}const FETCH_SCHEMA_FIELD_TYPE="fetch-field";function fetchSchemaFieldType({id:r,payload:{schemaEndpoint:n,coordinate:a},type:i},o){enqueueTask({id:r,cancel:noop,execute:async()=>{const s=await getSchemaCacheItem(n);if(!s){o.sendMessage(new Message(i,void 0,r));return}const l=s.getField(a);o.sendMessage(new Message(i,l,r))}})}const FETCH_SCHEMA_FIELD_TYPES="fetch-fields";function fetchSchemaFieldTypes({id:r,payload:{schemaEndpoint:n,typeName:a,options:i},type:o},s){enqueueTask({id:r,cancel:noop,execute:async()=>{const l=(await getSchemaCacheItem(n))?.getFields(a,i);s.sendMessage(new Message(o,l,r))}})}const FETCH_SCHEMA_FIELDS_AND_TYPES="fetch-fields-and-types";function fetchSchemaFieldsAndTypes({id:r,payload:{schemaEndpoint:n,coordinate:a,options:i},type:o},s){enqueueTask({id:r,cancel:noop,execute:async()=>{const l=await getSchemaCacheItem(n);if(!l){s.sendMessage(new Message(o,void 0,r));return}const f={fields:l.getFields(a,i),interfaces:l.getInterfaces(a,i?.filter),possibleTypes:l.getPossibleTypes(a,i?.filter)};s.sendMessage(new Message(o,f,r))}})}const FETCH_SCHEMA_REFERENCE="fetch-schema-reference";function fetchSchemaReference({id:r,payload:{schemaEndpoint:n,typeCategory:a,filter:i},type:o},s){enqueueTask({id:r,cancel:noop,execute:async()=>{const l=await getSchemaReference(n,a,i);s.sendMessage(new Message(o,l,r))}})}const FETCH_SCHEMA_ROOT_TYPES="fetch-schema-root-types";function fetchSchemaRootTypes({id:r,payload:{schemaEndpoint:n,filter:a},type:i},o){enqueueTask({id:r,cancel:noop,execute:async()=>{const s=await fetchRootTypes(n,a);o.sendMessage(new Message(i,s,r))}})}const FETCH_SCHEMA_TYPE="fetch-type";function fetchSchemaType({id:r,payload:{schemaEndpoint:n,typeName:a},type:i},o){enqueueTask({id:r,cancel:noop,execute:async()=>{const s=(await getSchemaCacheItem(n))?.getType(a)??void 0;o.sendMessage(new Message(i,s,r))}})}const FETCH_SCHEMA_TYPES="fetch-types";function fetchSchemaTypes({id:r,payload:{schemaEndpoint:n,filter:a},type:i},o){enqueueTask({id:r,cancel:noop,execute:async()=>{const s=(await getSchemaCacheItem(n))?.getTypes(a);o.sendMessage(new Message(i,s,r))}})}class GraphQLEngineScheduler extends SchedulerBase{registerMessageReceiveHandlers(){this.registerReceiveMessageHandler(SCHEMA_FETCHER_MESSAGE_TYPE,fetchSchema),this.registerReceiveMessageHandler(SCHEMA_API_FETCHER_MESSAGE_TYPE,fetchApiSchema),this.registerReceiveMessageHandler(SCHEMA_FETCHER_CACHED_MESSAGE_TYPE,getCachedSchema),this.registerReceiveMessageHandler(FETCH_SCHEMA_DIRECTIVE,fetchSchemaDirective),this.registerReceiveMessageHandler(FETCH_SCHEMA_DIRECTIVES,fetchSchemaDirectives),this.registerReceiveMessageHandler(FETCH_SCHEMA_FIELD_TYPE,fetchSchemaFieldType),this.registerReceiveMessageHandler(FETCH_SCHEMA_FIELD_TYPES,fetchSchemaFieldTypes),this.registerReceiveMessageHandler(FETCH_SCHEMA_REFERENCE,fetchSchemaReference),this.registerReceiveMessageHandler(FETCH_SCHEMA_ROOT_TYPES,fetchSchemaRootTypes),this.registerReceiveMessageHandler(FETCH_SCHEMA_TYPE,fetchSchemaType),this.registerReceiveMessageHandler(FETCH_SCHEMA_TYPES,fetchSchemaTypes),this.registerReceiveMessageHandler(FETCH_SCHEMA_FIELDS_AND_TYPES,fetchSchemaFieldsAndTypes),this.registerReceiveMessageHandler(DOCUMENT_ANALYSIS_MESSAGE_TYPE,analyzeDocument),this.registerReceiveMessageHandler(DOCUMENT_OPERATIONS_ANALYSIS_MESSAGE_TYPE,analyzeDocumentOperations),this.registerReceiveMessageHandler(CANCEL_OPERATION_REQUEST_MESSAGE_TYPE,n=>cancelTask(n.payload.documentId)),this.registerReceiveMessageHandler(FILES_UPDATED_MESSAGE_TYPE,updatedFiles),this.registerReceiveMessageHandler(EXECUTE_OPERATION_REQUEST_MESSAGE_TYPE,runOperation)}}new GraphQLEngineScheduler});export default vr();
363
+ `,_gql_doc={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"IntrospectionQuery"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__type"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"StringValue",value:"__Type",block:!1}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"fields"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}}]}}]}}]}}],loc:{start:0,end:137,source:{name:"GraphQL request",locationOffset:{line:1,column:1},body:_gql_source}}},INTROSPECTION_QUERY_DIRECTIVE=print(_gql_doc$4),INTROSPECTION_QUERY_INPUT_VALUE=print(_gql_doc$3),INTROSPECTION_QUERY_SCHEMA=print(_gql_doc$2),INTROSPECTION_QUERY_SEARCH_RESULT=print(_gql_doc$1),INTROSPECTION_QUERY_TYPE=print(_gql_doc);function executeOperation(r,n,a,i,o,s){return fetchCore(r,n,a,i,o,s).then(async({response:l})=>{const{kind:f,responseOrError:d}=l;if(!(d instanceof Response))return{kind:f,error:d};switch(f){case GraphQLResponseKind.INCREMENTAL:return{kind:f,parsedBody:{}};case GraphQLResponseKind.VARIABLE_BATCHING:return{kind:f,parsedBody:n.variables?.map(()=>({}))??[]}}const{operationResult:u,error:c}=await parseAndCheckHttpResponse(d,!1);return c?{kind:f,error:c}:{kind:f,parsedBody:u}})}async function fetchSchemaBySdlEndpoint(r,n,a,i,o,s,l){const f=(c,v)=>createHttpLogger(r,n,c,s===GraphQLSchemaKind.SDL_FETCH?RequestKind.GRAPHQL_SDL_FETCH:RequestKind.GRAPHQL_SDL_PROBE,{name:v,scopeId:a}),[d,u]=await Promise.all([fetchSchemaBySdlEndpointCore$1(i,s,o,f,l),fetchGraphQLIntrospectionSearchResult(o,f,l)]);if(d instanceof Response){const c=await d.text();return{schema:buildSchema(c),sdlSchema:c,supportsSemanticIntrospection:"operationResult"in u&&!!u.operationResult.data.__type}}return d}function fetchSchemaBySdlEndpointCore$1(r,n,a,i,o){const s=createRequestId(),l=i(s,n===GraphQLSchemaKind.SDL_FETCH?"SDL Schema Fetch":"SDL Schema Probe"),f=a.includeCookies?"include":"same-origin",d=new Headers(a.headers),u="GET",c={cache:"no-cache",credentials:f,headers:d,method:u,referrerPolicy:IS_RUNNING_IN_ELECTRON?"no-referrer":"strict-origin-when-cross-origin",signal:o};return a.disableCors&&(c.mode="no-cors"),d.append("User-Agent",navigator.userAgent),l.requestInterceptor(r,u,d),fetch(r,c).then(v=>l.responseInterceptor(v)??v).catch(catchNetworkError).then(v=>l.responseErrorInterceptor(v)??v)}async function fetchSchemaByApiSdlEndpoint(r,n,a,i,o){const s=await getHttpOptions(i),l=(u,c)=>createHttpLogger(r,n,u,RequestKind.GRAPHQL_SDL_FETCH,{name:c,scopeId:a}),[f,d]=await Promise.all([fetchSchemaByApiSdlEndpointCore(i,s,o),fetchGraphQLIntrospectionSearchResult(s,l,o)]);if(f instanceof Response){const u=await f.text();return{schema:buildSchema(u),sdlSchema:u,supportsSemanticIntrospection:"operationResult"in d&&!!d.operationResult.data.__type}}return f}async function fetchSchemaByApiSdlEndpointCore(r,n,a){const i=n.includeCookies?"include":"same-origin",o=new Headers(n.headers),l={cache:"no-cache",credentials:i,headers:o,method:"GET",referrerPolicy:IS_RUNNING_IN_ELECTRON?"no-referrer":"strict-origin-when-cross-origin",signal:a};return n.disableCors&&(l.mode="no-cors"),o.append("User-Agent",navigator.userAgent),fetch(r,l).catch(catchNetworkError)}async function fetchGraphQLSchema(r,n,a){const[i,o,s,l,f]=await Promise.all([fetchGraphQLIntrospectionDirective(r,n,a),fetchGraphQLIntrospectionInputValue(r,n,a),fetchGraphQLIntrospectionSchema(r,n,a),fetchGraphQLIntrospectionSearchResult(r,n,a),fetchGraphQLIntrospectionType(r,n,a)]);if("name"in i)return i;if(i.error)return i.error;if("name"in o)return o;if(o.error)return o.error;if("name"in s)return s;if(s.error)return s.error;if("name"in l)return l;if(l.error)return l.error;if("name"in f)return f;if(f.error)return f.error;const d=determineIntrospectionFeatures({schema:s.operationResult.data.__type,directive:i.operationResult.data.__type,inputValue:o.operationResult.data.__type,type:f.operationResult.data.__type}),u=await fetchGraphQLSchemaByFeatures(r,d,n,a);return isIntrospectionQuery(u)?{schema:buildClientSchema(u),supportsSemanticIntrospection:!!l.operationResult.data.__type}:u}function isIntrospectionQuery(r){return"__schema"in r}function isInvalidHttpHeader(r){return"kind"in r}function getHttpHeaders(r,n){const a=r.authentication?.headerValue,i=new Headers;if(i.append(HEADER_USER_AGENT,navigator.userAgent),a&&i.set(HEADER_AUTHORIZATION,a),!r.headers)return i;for(const o of r.headers){if(!o.enabled||n&&!n(o)||o.name===HEADER_USER_AGENT)continue;const{name:s,value:l}=o;if(!s.length)return{kind:"empty-name",name:s};if(!isHttpHeaderKeyValid(s))return{kind:"invalid-name",name:s};(s!==HEADER_AUTHORIZATION||!a)&&i.append(s,l)}return i}async function fetchGraphQLIntrospectionDirective(r,n,a){const{response:{responseOrError:i}}=await fetchCore(r,{query:INTROSPECTION_QUERY_DIRECTIVE,operationName:"IntrospectionQuery"},void 0,void 0,n(createRequestId(),"Detect Directive Capabilities"),a);return i instanceof Response?parseAndCheckHttpResponse(i,!0):i}async function fetchGraphQLIntrospectionInputValue(r,n,a){const{response:{responseOrError:i}}=await fetchCore(r,{query:INTROSPECTION_QUERY_INPUT_VALUE,operationName:"IntrospectionQuery"},void 0,void 0,n(createRequestId(),"Detect InputValue Capabilities"),a);return i instanceof Response?parseAndCheckHttpResponse(i,!0):i}async function fetchGraphQLIntrospectionSchema(r,n,a){const{response:{responseOrError:i}}=await fetchCore(r,{query:INTROSPECTION_QUERY_SCHEMA,operationName:"IntrospectionQuery"},void 0,void 0,n(createRequestId(),"Detect Schema Capabilities"),a);return i instanceof Response?parseAndCheckHttpResponse(i,!0):i}async function fetchGraphQLIntrospectionSearchResult(r,n,a){const{response:{responseOrError:i}}=await fetchCore(r,{query:INTROSPECTION_QUERY_SEARCH_RESULT,operationName:"IntrospectionQuery"},void 0,void 0,n(createRequestId(),"Detect Semantic Introspection Capabilities"),a);return i instanceof Response?parseAndCheckHttpResponse(i,!0):i}async function fetchGraphQLIntrospectionType(r,n,a){const{response:{responseOrError:i}}=await fetchCore(r,{query:INTROSPECTION_QUERY_TYPE,operationName:"IntrospectionQuery"},void 0,void 0,n(createRequestId(),"Detect Type Capabilities"),a);return i instanceof Response?parseAndCheckHttpResponse(i,!0):i}async function fetchGraphQLSchemaByFeatures(r,n,a,i){const o=getIntrospectionQuery(n),s=await fetchCore(r,{query:o,operationName:"IntrospectionQuery"},void 0,void 0,a(createRequestId(),"Introspection"),i),{responseOrError:l}=s.response;if(!(l instanceof Response))return l;const f=await parseAndCheckHttpResponse(l,!0);return f.error?f.error:f.operationResult.data}async function fetchCore(r,n,a,i,o,s){const l=r.includeCookies?"include":"same-origin",{extensions:f,operationName:d,query:u,variables:c,files:v}=n,h={cache:"no-cache",credentials:l,referrerPolicy:IS_RUNNING_IN_ELECTRON?"no-referrer":"strict-origin-when-cross-origin"},m=new Headers(r.headers);let g,_,S;if(r.disableCors&&(h.mode="no-cors"),r.useGET)_={...h,method:"GET",headers:m},S=rewriteURIForGET(r.uri,n),o?.requestInterceptor(S,"GET",m),g=async O=>createFetchResult(S,"GET",O,mapHeadersToDictionary(m),_.credentials,_.referrerPolicy);else{const N={extensions:f,operationName:d,query:u,variables:c};let O;if(isGraphQLVariableMap(c)&&v?.length){const F=structuredClone(c),L=new FormData,k=v.flatMap(({variableName:B,fieldPath:j,fileOrFiles:$})=>Array.isArray($)?$.map((A,R)=>({variableName:B,fieldPath:j,file:A,index:R})):[{variableName:B,fieldPath:j,file:$}]);k.forEach(({variableName:B,fieldPath:j,index:$})=>{if(j?.length){let A=F[B];const R=j.length-1;for(let y=0;y<j.length;y++)y===R?$===void 0?A[j[y]]=null:A[j[y]][$]=null:A=A[j[y]]}else $===void 0?F[B]=null:F[B][$]=null}),N.variables=F,L.append("operations",JSON.stringify(N));const P=k.reduce((B,{variableName:j,fieldPath:$,index:A},R)=>({...B,[R]:[`variables.${j}${$?.length?"."+$?.join("."):""}${A===void 0?"":"."+A}`]}),{});L.append("map",JSON.stringify(P));const U=(await getFileContents(distinct(k.map(({file:{id:B}})=>B)))).reduce((B,j)=>({...B,[j.itemId]:j.content}),{});k.forEach(({file:{id:B}},j)=>{L.append(`${j}`,U[B])}),O=L}else m.append(HEADER_CONTENT_TYPE,"application/json"),O=JSON.stringify(N);const M="POST";_={...h,method:M,headers:m,body:O},S=r.uri,o?.requestInterceptor(S,M,m,O),g=async F=>createFetchResult(S,M,F,mapHeadersToDictionary(m),_.credentials,_.referrerPolicy,N)}return await fetch(S,{..._,signal:s}).then(N=>o?.responseInterceptor(N)??N).catch(catchNetworkError).then(N=>o?.responseErrorInterceptor(N)??N).then(N=>isGraphQLVariableBatch(c)?handleVariableBatchingResponse(N,i):handleIncrementalResponse(N,a)).then(N=>g(N))}function createFetchResult(r,n,a,i,o,s,l){return{request:{uri:r,cache:"no-cache",credentials:o,headers:i,method:n,referrerPolicy:s,body:l},response:a}}const SERVER_NOT_REACHABLE="Server Not Reachable";function catchNetworkError(r){return isAbortError(r)?new ClientAbortError:r instanceof TypeError?createServerNetworkError(SERVER_NOT_REACHABLE,r.message):createServerNetworkError(SERVER_NOT_REACHABLE)}async function handleVariableBatchingResponse(r,n){let a=GraphQLResponseKind.SIMPLE;if(r instanceof Response&&r.ok&&!r.bodyUsed&&r.headers&&n){const i=r.headers.get("content-type")?.startsWith("application/jsonl")?await parseJSONLStream(r):await e(r);if(isAsyncIterable$1(i)){const o=async()=>{let s=0;try{for await(const l of i)isJSONLError(l)?n.onError(l,s++):"json"in l?l.json?n.onNext(l.body,s++):n.onError(createMultipartBodyParsingError(l.body),s++):n.onNext(l,s++)}catch(l){isAbortError(l)?n.onError(new ClientAbortError,s):n.onError(createServerParseError(r,l,""),s)}n.onComplete(s)};a=GraphQLResponseKind.VARIABLE_BATCHING,setTimeout(o,0)}}return{kind:a,responseOrError:r}}async function handleIncrementalResponse(r,n){let a=GraphQLResponseKind.SIMPLE;if(r instanceof Response&&r.ok&&!r.bodyUsed&&r.headers&&n){const i=r.headers.get("content-type")?.startsWith("application/jsonl")?await parseJSONLStream(r):await e(r);if(isAsyncIterable$1(i)){const o=async()=>{let s=0;try{for await(const l of i)isJSONLError(l)?n.onError(l,s++):"json"in l?l.json?n.onNext(l.body,s++):n.onError(createMultipartBodyParsingError(l.body),s++):n.onNext(l,s++)}catch(l){isAbortError(l)?n.onError(new ClientAbortError,s):n.onError(createServerParseError(r,l,""),s)}n.onComplete(s)};a=GraphQLResponseKind.INCREMENTAL,setTimeout(o,0)}}return{kind:a,responseOrError:r}}function createMultipartBodyParsingError(r){return createMultipartError(new Error("The multipart body could not be converted into JSON."),r)}function parseAndCheckHttpResponse(r,n){return r.text().then(a=>{try{const i=JSON.parse(a);return typeof i=="object"&&(n&&i.data||!n&&(i.data||i.errors))?{operationResult:i,contentLength:a.length}:{error:createServerError(r,a,`Response not successful: Received status code ${r.status}`),contentLength:a.length}}catch(i){return{error:createServerParseError(r,i,a),contentLength:a.length}}})}function rewriteURIForGET(r,{query:n,operationName:a,variables:i,extensions:o}){const s=[],l=(h,m)=>{s.push(`${h}=${encodeURIComponent(m)}`)};n&&l("query",n),a&&l("operationName",a),i&&l("variables",JSON.stringify(i)),o&&l("extensions",JSON.stringify(o));let f="",d=r;const u=r.indexOf("#");u!==-1&&(f=r.substr(u),d=r.substr(0,u));const c=d.indexOf("?")===-1?"?":"&";return d+c+s.join("&")+f}function createMultipartError(r,n){return{...r,name:MULTIPART_ERROR_NAME,body:n}}function createServerError({status:r,statusText:n},a,i){return{message:i,name:SERVER_ERROR_NAME,statusCode:r,statusText:n,bodyText:a}}function createServerNetworkError(r,n){return{message:r,name:SERVER_NETWORK_ERROR_NAME,statusText:n}}function createServerParseError({status:r,statusText:n},a,i){return{...a,name:SERVER_PARSE_ERROR_NAME,statusCode:r,statusText:n,bodyText:i}}function determineIntrospectionFeatures({schema:r,directive:n,inputValue:a,type:i}){return{directiveIsRepeatable:!!n?.fields.some(o=>o.name==="isRepeatable"),directiveLocations:!n||n.fields.some(o=>o.name==="locations"),directiveDeprecation:!!n?.fields.some(o=>o.name==="isDeprecated"),inputValueDeprecation:!!a?.fields.some(o=>o.name==="isDeprecated"),oneOf:!!i?.fields.some(o=>o.name==="isOneOf"),specifiedByUrl:!!i?.fields.some(o=>o.name==="specifiedByURL"),subscription:!!r?.fields.some(o=>o.name==="subscriptionType")}}function createHttpLogger(r,n,a,i,o){return{requestInterceptor:createHttpRequestInterceptor(r,n,a,i,o),responseInterceptor:createHttpResponseInterceptor(r,n,a,i,o),responseErrorInterceptor:createHttpResponseErrorInterceptor(r,n,a,i,o)}}function createHttpRequestInterceptor(r,n,a,i,o){return(s,l,f,d,u,c)=>{const v=now(),h=mapHeadersToDictionary(f),m=mapFormDataToString(d);sendHttpRequest(r,n,a,i,o?.scopeId,v,s,l,h,m,u,c,o?.name)}}function createHttpResponseInterceptor(r,n,a,i,o){return s=>{const l=now(),{status:f,statusText:d}=s,u=mapHeadersToDictionary(s.headers),c=o?.scopeId;sendHttpResponse(r,n,a,i,c,l,f,d,u);const v=s.clone();return new Promise(async h=>{let m=0;try{const g=v.body?.getReader();if(g)try{const _=new TextDecoder;let S,N=0;for(;!(S=await g.read()).done;){const O=now(),M=_.decode(S.value);m+=M.length,sendHttpResponseBodyChunk(r,n,a,c,O,M,N++)}s.status>299?sendHttpResponseFailed(r,n,a,i,c,now(),createServerError(s,"",""),m):sendHttpResponseFinished(r,n,a,i,c,now(),m)}finally{await g.cancel()}}catch(g){g instanceof ClientAbortError?sendHttpResponseCancelled(r,n,a,i,c,now(),g,m):sendHttpResponseFailed(r,n,a,i,c,now(),createServerError(s,"",""),m)}finally{h()}}),s}}function createHttpResponseErrorInterceptor(r,n,a,i,o){return s=>{if(s instanceof Response)return s;const l=now(),f=o?.scopeId;return s instanceof ClientAbortError?(sendHttpResponseCancelled(r,n,a,i,f,l,s,0),s):(sendHttpResponseFailed(r,n,a,i,f,l,s,0),s)}}function mapFormDataToString(r){if(!r||typeof r=="string")return r;const n={};for(const[a,i]of r.entries()){const o=i.valueOf();typeof o=="string"?n[a]=o:n[a]="File Data omitted"}return JSON.stringify(n,void 0,2)}function mapHeadersToDictionary(r){let n={};return r.forEach((a,i)=>{n[i]?Array.isArray(n[i])?n={...n,[i]:[...n[i],a]}:n={...n,[i]:[n[i],a]}:n={...n,[i]:a}}),n}class SchemaCache{#e=new LRUMap;get(n){return this.#e.get(n)??null}set(n,a){const i=new SchemaCacheItem(a);return this.#e.get(n)?.dispose(),this.#e.set(n,i),i}remove(n){this.#e.get(n)?.dispose(),this.#e.delete(n)}}class SchemaCacheItem{#e;#t;#r;#n;constructor(n){this.#e=new Map(n.directives),this.#t=new Map(n.fields),this.#r=new Map(n.types),this.#n=new Map(n.fields)}getDirective(n){return this.#e.get(n)??null}getDirectives(n){const a=[];if(n?.length){const i=n.toLocaleLowerCase();this.#e.forEach(o=>{!INTROSPECTION_PREFIX.test(o.name)&&o.name.toLocaleLowerCase().includes(i)&&a.push(o)})}else this.#e.forEach(i=>{INTROSPECTION_PREFIX.test(i.name)||a.push(i)});return a.sort(objectNameComparer)}getField(n){return this.#t.get(n)??null}getFields(n,a){const i=n+".",o=[];if(a?.includeIntrospectionFields&&this.addIntrospectionFields(n,o),a?.filter?.length){const s=a.filter.toLocaleLowerCase();this.#t.forEach(l=>{l.coordinate.startsWith(i)&&l.name.toLocaleLowerCase().includes(s)&&o.push(l)})}else this.#t.forEach(s=>{s.coordinate.startsWith(i)&&o.push(s)});return o.sort(objectNameComparer)}getType(n){return this.#r.get(n)??null}getTypes(n){const a=[];if(n?.length){const i=n.toLocaleLowerCase();this.#r.forEach(o=>{!INTROSPECTION_PREFIX.test(o.name)&&o.name.toLocaleLowerCase().includes(i)&&a.push(o)})}else this.#r.forEach(i=>{INTROSPECTION_PREFIX.test(i.name)||a.push(i)});return a.sort(objectNameComparer)}getInterfaces(n,a){const i=this.#r.get(n);if(!i?.interfaces?.length)return[];if(a?.length){const o=a.toLocaleLowerCase();return i.interfaces.filter(({name:s})=>s.toLocaleLowerCase().includes(o)).sort(objectNameComparer)}return i.interfaces.sort(objectNameComparer)}getPossibleTypes(n,a){const i=this.#r.get(n);if(!i?.types?.length)return[];if(a?.length){const o=a.toLocaleLowerCase();return i.types.map(getInnerType).filter(({name:s})=>s.toLocaleLowerCase().includes(o)).sort(objectNameComparer)}return i.types.map(getInnerType).sort(objectNameComparer)}getTypesByTypeKind(n,a){const i=[];if(a?.length){const o=a.toLocaleLowerCase();this.#r.forEach(s=>{s.typeKind===n&&!INTROSPECTION_PREFIX.test(s.name)&&s.name.toLocaleLowerCase().includes(o)&&i.push(s)})}else this.#r.forEach(o=>{o.typeKind===n&&!INTROSPECTION_PREFIX.test(o.name)&&i.push(o)});return i.sort(objectNameComparer)}dispose(){this.#e.clear(),this.#t.clear(),this.#r.clear()}addIntrospectionFields(n,a){const i=this.#r.get(n),o=i?.kind==="query-type",s=i?.kind==="subscription-type";if(o){const l=this.getIntrospectionSchemaField(i.name);l&&a.push(l);const f=this.getIntrospectionTypeField(i.name);f&&a.push(f)}if(!s&&i){const l=this.getIntrospectionTypenameField(i.name);l&&a.push(l)}}getIntrospectionSchemaField(n){const a=IntrospectionField.SCHEMA_FIELD;let i=this.#n.get(a);if(!i){const o=this.#r.get("__Schema");o&&(i={kind:"field",name:a,coordinate:createSchemaMemberCoordinate(n,a),valueType:{kind:"value-type",isList:!1,isOptional:!1,type:o}},this.#n.set(a,i))}return i}getIntrospectionTypeField(n){const a=IntrospectionField.TYPE_FIELD;let i=this.#n.get(a);if(!i){const o=this.#r.get("__Type"),s=this.#r.get("String");o&&s&&(i={kind:"field",name:a,coordinate:createSchemaMemberCoordinate(n,a),valueType:{kind:"value-type",isList:!1,isOptional:!0,type:o},arguments:[{kind:"argument",name:"name",coordinate:createSchemaMemberCoordinate(n,a,"name"),type:{kind:"value-type",isList:!1,isOptional:!1,type:s}}]},this.#n.set(a,i))}return i}getIntrospectionTypenameField(n){const a=IntrospectionField.TYPENAME_FIELD;let i=this.#n.get(a);if(i)i={...i,coordinate:createSchemaMemberCoordinate(n,IntrospectionField.TYPE_FIELD)};else{const o=this.#r.get("String");o&&(i={kind:"field",name:a,coordinate:createSchemaMemberCoordinate(n,a),valueType:{kind:"value-type",isList:!1,isOptional:!1,type:o}},this.#n.set(a,i))}return i}}const schemaCache=new SchemaCache;async function getSchemaCacheItem(r){const n=harmonizeSchemaUrl(r),a=schemaCache.get(n);if(a)return a;const i=await getGraphQLSchemaItems(n);return i?schemaCache.set(n,i):null}function removeSchemaCacheItem(r){schemaCache.remove(harmonizeSchemaUrl(r))}function getResolvedFiles(r,n,a,i,o){return isGraphQLVariableBatch(o)?Promise.resolve(void 0):getSchemaCacheItem(a.sdlEndpoint||a.endpoint).then(s=>!a.useGet&&n&&s&&r?resolveFiles(n,i,o,s,(...l)=>getFileItemInfosByNames(r,...l)):Promise.resolve(void 0))}async function resolveFiles(r,n,a,i,o){let s=[];try{for(const l of r.definitions)if(l.kind===ASTNodeKind.OPERATION_DEFINITION&&l.name?.value===n){if(!l.variablesDefinition?.variableDefinitions.length)return s;for(const f of l.variablesDefinition.variableDefinitions){const d=getTypeNodeName(f.type),u=i.getType(d),c=f.variable.name?.value??"",v=await resolveFieldPathsOfUploadTypes(c,a?.[c],u,o,i);v.length&&(s=[...s,...v])}}}catch(l){console.error(l)}return s}async function resolveFieldPathsOfUploadTypes(r,n,a,i,o){if(!n)return[];if(typeof n=="object"){const s=[],l=[[[],n]];let f;for(;(f=l.shift())!==void 0;){const[d,u]=f;if(u){if(isObjectArray(u))for(let c=0;c<u.length;c++)l.push([[...d,c],u[c]]);else if(typeof u=="object"&&!Array.isArray(u))for(const c of Object.keys(u))l.push([[...d,c],u[c]]);else if((typeof u=="string"||isStringArray(u))&&isUploadScalarType(a,o,d)){const c=await resolveFileInfos(u,d,i);c&&s.push({variableName:r,fieldPath:d,fileOrFiles:c})}}}return s}else if((typeof n=="string"||isStringArray(n))&&isUploadScalarType(a,o)){const s=await resolveFileInfos(n,void 0,i);if(s)return[{variableName:r,fileOrFiles:s}]}return[]}function resolveFileInfos(r,n,a){if(!r)return Promise.resolve(void 0);if(n?.length&&typeof r=="object"&&!Array.isArray(r)){let i=0,o=r;for(;i<n.length&&o!==void 0&&typeof o=="object"&&!Array.isArray(o);){const s=n[i++];o=o[s]}if(typeof o=="string")return a(o).then(s=>s?.[0]);if(isStringArray(o))return a(...o)}else{if(typeof r=="string")return a(r).then(i=>i?.[0]);if(isStringArray(r))return a(...r)}return Promise.resolve(void 0)}function isUploadScalarType(r,n,a){if(!r)return!1;if(a?.length&&r.typeKind==="input-object"){const i=a.filter(l=>typeof l=="string");let o=getInnerType(r),s;for(const l of i){const f=createSchemaMemberCoordinate(o.name,l);if(s=n.getField(f))o=getInnerType(s.valueType);else return!1}return o.typeKind==="scalar"&&o.name==="Upload"}return r.typeKind==="scalar"&&r.name==="Upload"}function getTypeNodeName(r){if(!r)return"UnknownType";let n=r;for(;n.kind!==ASTNodeKind.NAMED_TYPE;){if(!n.type)return"UnknownType";n=n.type}return n.name.value}function getSchema(r){return getGraphQLSchemaEntity(r.sdlEndpoint||r.endpoint)}async function setSchema(r,n,a,i,o){const s=await getGraphQLSchemaEntity(r),l=harmonizeSchemaUrl(r),f=calculateGraphQLSchemaEntityHash(l,a);if(!s||s.hash!==f){const d=await setGraphQLSchemaEntity(l,n,a,i,o);return removeSchemaCacheItem(l),d}return s}async function fetchItemsByCategory(r,n,a){const i=await getSchemaCacheItem(r);return i?n==="root"?await getSchemaRootTypesCore(r,a):n==="directive"?i.getDirectives(a):i.getTypesByTypeKind(n,a):[]}async function fetchRootTypes(r,n){const a=await getSchemaRootTypesCore(r,n);return a.length?a:void 0}async function getSchemaReference(r,n,a){const i=await getGraphQLSchemaStatistics(r);if(!i)return;const o=await fetchItemsByCategory(r,n,a),s=await getSchemaRootTypesCore(r);return{items:o,rootTypes:s,statistics:i}}async function getSchemaRootTypesCore(r,n){const[a,i]=await Promise.all([getSchemaCacheItem(r),getGraphQLSchemaEntity(r)]);if(!a||!i)return[];const o=[i.queryTypeName?a.getType(i.queryTypeName):void 0,i.mutationTypeName?a.getType(i.mutationTypeName):void 0,i.subscriptionTypeName?a.getType(i.subscriptionTypeName):void 0].filter(isSchemaType);if(n?.length){const s=n.toLocaleLowerCase();return o.filter(({name:l})=>l.toLocaleLowerCase().includes(s))}return o}const runningTasks=new Map;function cancelTask(r){runningTasks.get(r)?.cancel()}function enqueueTask(r){runningTasks.has(r.id)||(runningTasks.set(r.id,r),SCHEDULER_CONTEXT.sendMessage(new Message("scheduler-status-updated",{idling:!1,lastUpdated:now()})),deferWork(()=>{r.execute().catch(n=>{n instanceof TaskFailedError?failTask(SCHEDULER_CONTEXT,r.id,n.message,n.kind,n.details):n instanceof Error?failTask(SCHEDULER_CONTEXT,r.id,n.message,"UNEXPECTED_ERROR"):failTask(SCHEDULER_CONTEXT,r.id,"There was a unexpected error in the task","UNEXPECTED_ERROR")}).finally(()=>{runningTasks.delete(r.id),SCHEDULER_CONTEXT.sendMessage(new Message("scheduler-status-updated",{idling:runningTasks.size===0,lastUpdated:now()}))})}))}function deferWork(r){self.setTimeout(r,0)}const SCHEDULER_CONTEXT={sendMessage:r=>self.postMessage(r)};class SchedulerBase extends MessageObserver{#e={sendMessage:n=>self.postMessage(n)};constructor(){super(),this.initialize()}getContext(){return this.#e}initialize(){self.onmessage=({data:n})=>{this.handleMessage(this.#e,n)},this.registerReceiveMessageHandler(CANCEL_TASK_MESSAGE_TYPE,n=>{cancelTask(n.payload.taskId)}),this.registerReceiveMessageHandler(INITIALIZE_WORKER_MESSAGE_TYPE,n=>{self.appNamespace=n.payload.appNamespace}),this.registerMessageReceiveHandlers()}}const DOCUMENT_ANALYSIS_MESSAGE_TYPE="analyze-document";function analyzeDocument({id:r,payload:{documentId:n},type:a},i){const o=new AbortController;enqueueTask({id:r,cancel:()=>o.abort(),execute:async()=>{const s=await getDocumentItemAndContent(n,o.signal);let l={documentId:n,operations:[]};if(!s){i.sendMessage(new Message(a,l,r));return}const f=await getInterpolatedHttpConnectionForActiveEnvironment(n,o.signal);if(!f){i.sendMessage(new Message(a,l,r));return}const d=getGraphQLDocument(i,s);if(!d){i.sendMessage(new Message(a,{documentId:n,operations:[]},r));return}const u=getOperations(d),c=await getSchemaCacheItem(f.sdlEndpoint||f.endpoint);let v;if(c){const h=s.workspaceId?await getAllFileItemInfos(s.workspaceId):void 0,m=generateVariableJsonSchema(d,g=>c.getType(g),g=>c.getFields(g),h);v=(await setVariableJsonSchema(n,m))?.hash}i.sendMessage(new Message(a,{documentId:n,operations:u,variableJsonSchemaHash:v},r))}})}const DOCUMENT_OPERATIONS_ANALYSIS_MESSAGE_TYPE="analyze-document-operations";function analyzeDocumentOperations({id:r,payload:{documentId:n},type:a},i){const o=new AbortController;enqueueTask({id:r,cancel:()=>o.abort(),execute:async()=>{const s=await getDocumentItemAndContent(n,o.signal),l=getGraphQLDocument(i,s);if(!l){i.sendMessage(new Message(a,{documentId:n,operations:[]},r));return}const f=getOperations(l);i.sendMessage(new Message(a,{documentId:n,operations:f},r))}})}function noop(){}const FILES_UPDATED_MESSAGE_TYPE="files-updated",VARIABLE_JSON_SCHEMA_UPDATED_MESSAGE_TYPE="variable-json-schema-updated";function updatedFiles({id:r,payload:{documentId:n}},a){enqueueTask({id:r,cancel:noop,execute:async()=>{const i=await getDocumentItemAndContent(n);let o={documentId:n};if(i&&i.workspaceId){const s=await getInterpolatedHttpConnectionForActiveEnvironment(n);if(s){const l=getGraphQLDocument(a,i),f=await getSchemaCacheItem(s.sdlEndpoint||s.endpoint);if(l&&f){const d=await getAllFileItemInfos(i.workspaceId),u=generateVariableJsonSchema(l,v=>f.getType(v),v=>f.getFields(v),d),c=await setVariableJsonSchema(n,u);o={documentId:n,variableJsonSchemaHash:c?.hash}}}}a.sendMessage(new Message(VARIABLE_JSON_SCHEMA_UPDATED_MESSAGE_TYPE,o,r))}})}const global$1=globalThis||void 0||self;function extendedTypeof(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function isObject$2(r){return extendedTypeof(r)==="object"}function areGraphQLErrors(r){return Array.isArray(r)&&r.length>0&&r.every(n=>"message"in n)}function limitCloseReason(r,n){return r.length<124?r:n}const GRAPHQL_TRANSPORT_WS_PROTOCOL="graphql-transport-ws";var CloseCode;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(CloseCode||(CloseCode={}));var MessageType;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(MessageType||(MessageType={}));function validateMessage(r){if(!isObject$2(r))throw new Error(`Message is expected to be an object, but got ${extendedTypeof(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${extendedTypeof(r.type)}`);switch(r.type){case MessageType.ConnectionInit:case MessageType.ConnectionAck:case MessageType.Ping:case MessageType.Pong:{if(r.payload!=null&&!isObject$2(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case MessageType.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!isObject$2(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${extendedTypeof(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${extendedTypeof(r.payload.query)}`);if(r.payload.variables!=null&&!isObject$2(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${extendedTypeof(r.payload.variables)}`);if(r.payload.operationName!=null&&extendedTypeof(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${extendedTypeof(r.payload.operationName)}`);if(r.payload.extensions!=null&&!isObject$2(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${extendedTypeof(r.payload.extensions)}`);break}case MessageType.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!isObject$2(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${extendedTypeof(r.payload)}`);break}case MessageType.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!areGraphQLErrors(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case MessageType.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${extendedTypeof(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function parseMessage(r,n){return validateMessage(typeof r=="string"?JSON.parse(r,n):r)}function stringifyMessage(r,n){return validateMessage(r),JSON.stringify(r,n)}var __await=function(r){return this instanceof __await?(this.v=r,this):new __await(r)},__asyncGenerator=function(r,n,a){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=a.apply(r,n||[]),o,s=[];return o={},l("next"),l("throw"),l("return"),o[Symbol.asyncIterator]=function(){return this},o;function l(h){i[h]&&(o[h]=function(m){return new Promise(function(g,_){s.push([h,m,g,_])>1||f(h,m)})})}function f(h,m){try{d(i[h](m))}catch(g){v(s[0][3],g)}}function d(h){h.value instanceof __await?Promise.resolve(h.value.v).then(u,c):v(s[0][2],h)}function u(h){f("next",h)}function c(h){f("throw",h)}function v(h,m){h(m),s.shift(),s.length&&f(s[0][0],s[0][1])}};function createClient(r){const{url:n,connectionParams:a,lazy:i=!0,onNonLazyError:o=console.error,lazyCloseTimeout:s=0,keepAlive:l=0,disablePong:f,connectionAckWaitTimeout:d=0,retryAttempts:u=5,retryWait:c=async function(D){let I=1e3;for(let T=0;T<D;T++)I*=2;await new Promise(T=>setTimeout(T,I+Math.floor(Math.random()*2700+300)))},shouldRetry:v=isLikeCloseEvent,isFatalConnectionProblem:h,on:m,webSocketImpl:g,generateID:_=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,D=>{const I=Math.random()*16|0;return(D=="x"?I:I&3|8).toString(16)})},jsonMessageReplacer:S,jsonMessageReviver:N}=r;let O;if(g){if(!isWebSocket(g))throw new Error("Invalid WebSocket implementation provided");O=g}else typeof WebSocket<"u"?O=WebSocket:typeof global$1<"u"?O=global$1.WebSocket||global$1.MozWebSocket:typeof window<"u"&&(O=window.WebSocket||window.MozWebSocket);if(!O)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");const M=O,F=(()=>{const b=(()=>{const I={};return{on(T,C){return I[T]=C,()=>{delete I[T]}},emit(T){var C;"id"in T&&((C=I[T.id])===null||C===void 0||C.call(I,T))}}})(),D={connecting:m?.connecting?[m.connecting]:[],opened:m?.opened?[m.opened]:[],connected:m?.connected?[m.connected]:[],ping:m?.ping?[m.ping]:[],pong:m?.pong?[m.pong]:[],message:m?.message?[b.emit,m.message]:[b.emit],closed:m?.closed?[m.closed]:[],error:m?.error?[m.error]:[]};return{onMessage:b.on,on(I,T){const C=D[I];return C.push(T),()=>{C.splice(C.indexOf(T),1)}},emit(I,...T){for(const C of[...D[I]])C(...T)}}})();function L(b){const D=[F.on("error",I=>{D.forEach(T=>T()),b(I)}),F.on("closed",I=>{D.forEach(T=>T()),b(I)})]}let k,P=0,U,B=!1,j=0,$=!1;async function A(){clearTimeout(U);const[b,D]=await(k??(k=new Promise((C,x)=>(async()=>{if(B){if(await c(j),!P)return k=void 0,x({code:1e3,reason:"All Subscriptions Gone"});j++}F.emit("connecting",B);const w=new M(typeof n=="function"?await n():n,GRAPHQL_TRANSPORT_WS_PROTOCOL);let E,q;function G(){isFinite(l)&&l>0&&(clearTimeout(q),q=setTimeout(()=>{w.readyState===M.OPEN&&(w.send(stringifyMessage({type:MessageType.Ping})),F.emit("ping",!1,void 0))},l))}L(H=>{k=void 0,clearTimeout(E),clearTimeout(q),x(H),H instanceof TerminatedCloseEvent&&(w.close(4499,"Terminated"),w.onerror=null,w.onclose=null)}),w.onerror=H=>F.emit("error",H),w.onclose=H=>F.emit("closed",H),w.onopen=async()=>{try{F.emit("opened",w);const H=typeof a=="function"?await a():a;if(w.readyState!==M.OPEN)return;w.send(stringifyMessage(H?{type:MessageType.ConnectionInit,payload:H}:{type:MessageType.ConnectionInit},S)),isFinite(d)&&d>0&&(E=setTimeout(()=>{w.close(CloseCode.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},d)),G()}catch(H){F.emit("error",H),w.close(CloseCode.InternalClientError,limitCloseReason(H instanceof Error?H.message:new Error(H).message,"Internal client error"))}};let z=!1;w.onmessage=({data:H})=>{try{const V=parseMessage(H,N);if(F.emit("message",V),V.type==="ping"||V.type==="pong"){F.emit(V.type,!0,V.payload),V.type==="pong"?G():f||(w.send(stringifyMessage(V.payload?{type:MessageType.Pong,payload:V.payload}:{type:MessageType.Pong})),F.emit("pong",!1,V.payload));return}if(z)return;if(V.type!==MessageType.ConnectionAck)throw new Error(`First message cannot be of type ${V.type}`);clearTimeout(E),z=!0,F.emit("connected",w,V.payload,B),B=!1,j=0,C([w,new Promise((K,Z)=>L(Z))])}catch(V){w.onmessage=null,F.emit("error",V),w.close(CloseCode.BadResponse,limitCloseReason(V instanceof Error?V.message:new Error(V).message,"Bad response"))}}})())));b.readyState===M.CLOSING&&await D;let I=()=>{};const T=new Promise(C=>I=C);return[b,I,Promise.race([T.then(()=>{if(!P){const C=()=>b.close(1e3,"Normal Closure");isFinite(s)&&s>0?U=setTimeout(()=>{b.readyState===M.OPEN&&C()},s):C()}}),D])]}function R(b){if(isLikeCloseEvent(b)&&(isFatalInternalCloseCode(b.code)||[CloseCode.InternalServerError,CloseCode.InternalClientError,CloseCode.BadRequest,CloseCode.BadResponse,CloseCode.Unauthorized,CloseCode.SubprotocolNotAcceptable,CloseCode.SubscriberAlreadyExists,CloseCode.TooManyInitialisationRequests].includes(b.code)))throw b;if($)return!1;if(isLikeCloseEvent(b)&&b.code===1e3)return P>0;if(!u||j>=u||!v(b)||h?.(b))throw b;return B=!0}i||(async()=>{for(P++;;)try{const[,,b]=await A();await b}catch(b){try{if(!R(b))return}catch(D){return o?.(D)}}})();function y(b,D){const I=_(b);let T=!1,C=!1,x=()=>{P--,T=!0};return(async()=>{for(P++;;)try{const[w,E,q]=await A();if(T)return E();const G=F.onMessage(I,z=>{switch(z.type){case MessageType.Next:{D.next(z.payload);return}case MessageType.Error:{C=!0,T=!0,D.error(z.payload),x();return}case MessageType.Complete:{T=!0,x();return}}});w.send(stringifyMessage({id:I,type:MessageType.Subscribe,payload:b},S)),x=()=>{!T&&w.readyState===M.OPEN&&w.send(stringifyMessage({id:I,type:MessageType.Complete},S)),P--,T=!0,E()},await q.finally(G);return}catch(w){if(!R(w))return}})().then(()=>{C||D.complete()}).catch(w=>{D.error(w)}),()=>{T||x()}}return{on:F.on,subscribe:y,iterate(b){const D=[],I={done:!1,error:null,resolve:()=>{}},T=y(b,{next(x){D.push(x),I.resolve()},error(x){I.done=!0,I.error=x,I.resolve()},complete(){I.done=!0,I.resolve()}}),C=function(){return __asyncGenerator(this,arguments,function*(){for(;;){for(D.length||(yield __await(new Promise(E=>I.resolve=E)));D.length;)yield yield __await(D.shift());if(I.error)throw I.error;if(I.done)return yield __await(void 0)}})}();return C.throw=async x=>(I.done||(I.done=!0,I.error=x,I.resolve()),{done:!0,value:void 0}),C.return=async()=>(T(),{done:!0,value:void 0}),C},async dispose(){if($=!0,k){const[b]=await k;b.close(1e3,"Normal Closure")}},terminate(){k&&F.emit("closed",new TerminatedCloseEvent)}}}class TerminatedCloseEvent extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}}function isLikeCloseEvent(r){return isObject$2(r)&&"code"in r&&"reason"in r}function isFatalInternalCloseCode(r){return[1e3,1001,1006,1005,1012,1013,1014].includes(r)?!1:r>=1e3&&r<=1999}function isWebSocket(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}var backo2,hasRequiredBacko2;function requireBacko2(){if(hasRequiredBacko2)return backo2;hasRequiredBacko2=1,backo2=r;function r(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}return r.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var a=Math.random(),i=Math.floor(a*this.jitter*n);n=(Math.floor(a*10)&1)==0?n-i:n+i}return Math.min(n,this.max)|0},r.prototype.reset=function(){this.attempts=0},r.prototype.setMin=function(n){this.ms=n},r.prototype.setMax=function(n){this.max=n},r.prototype.setJitter=function(n){this.jitter=n},backo2}var backo2Exports=requireBacko2(),Backoff=getDefaultExportFromCjs(backo2Exports),eventemitter3={exports:{}},hasRequiredEventemitter3;function requireEventemitter3(){return hasRequiredEventemitter3||(hasRequiredEventemitter3=1,function(r){var n=Object.prototype.hasOwnProperty,a="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(a=!1));function o(d,u,c){this.fn=d,this.context=u,this.once=c||!1}function s(d,u,c,v,h){if(typeof c!="function")throw new TypeError("The listener must be a function");var m=new o(c,v||d,h),g=a?a+u:u;return d._events[g]?d._events[g].fn?d._events[g]=[d._events[g],m]:d._events[g].push(m):(d._events[g]=m,d._eventsCount++),d}function l(d,u){--d._eventsCount===0?d._events=new i:delete d._events[u]}function f(){this._events=new i,this._eventsCount=0}f.prototype.eventNames=function(){var u=[],c,v;if(this._eventsCount===0)return u;for(v in c=this._events)n.call(c,v)&&u.push(a?v.slice(1):v);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},f.prototype.listeners=function(u){var c=a?a+u:u,v=this._events[c];if(!v)return[];if(v.fn)return[v.fn];for(var h=0,m=v.length,g=new Array(m);h<m;h++)g[h]=v[h].fn;return g},f.prototype.listenerCount=function(u){var c=a?a+u:u,v=this._events[c];return v?v.fn?1:v.length:0},f.prototype.emit=function(u,c,v,h,m,g){var _=a?a+u:u;if(!this._events[_])return!1;var S=this._events[_],N=arguments.length,O,M;if(S.fn){switch(S.once&&this.removeListener(u,S.fn,void 0,!0),N){case 1:return S.fn.call(S.context),!0;case 2:return S.fn.call(S.context,c),!0;case 3:return S.fn.call(S.context,c,v),!0;case 4:return S.fn.call(S.context,c,v,h),!0;case 5:return S.fn.call(S.context,c,v,h,m),!0;case 6:return S.fn.call(S.context,c,v,h,m,g),!0}for(M=1,O=new Array(N-1);M<N;M++)O[M-1]=arguments[M];S.fn.apply(S.context,O)}else{var F=S.length,L;for(M=0;M<F;M++)switch(S[M].once&&this.removeListener(u,S[M].fn,void 0,!0),N){case 1:S[M].fn.call(S[M].context);break;case 2:S[M].fn.call(S[M].context,c);break;case 3:S[M].fn.call(S[M].context,c,v);break;case 4:S[M].fn.call(S[M].context,c,v,h);break;default:if(!O)for(L=1,O=new Array(N-1);L<N;L++)O[L-1]=arguments[L];S[M].fn.apply(S[M].context,O)}}return!0},f.prototype.on=function(u,c,v){return s(this,u,c,v,!1)},f.prototype.once=function(u,c,v){return s(this,u,c,v,!0)},f.prototype.removeListener=function(u,c,v,h){var m=a?a+u:u;if(!this._events[m])return this;if(!c)return l(this,m),this;var g=this._events[m];if(g.fn)g.fn===c&&(!h||g.once)&&(!v||g.context===v)&&l(this,m);else{for(var _=0,S=[],N=g.length;_<N;_++)(g[_].fn!==c||h&&!g[_].once||v&&g[_].context!==v)&&S.push(g[_]);S.length?this._events[m]=S.length===1?S[0]:S:l(this,m)}return this},f.prototype.removeAllListeners=function(u){var c;return u?(c=a?a+u:u,this._events[c]&&l(this,c)):(this._events=new i,this._eventsCount=0),this},f.prototype.off=f.prototype.removeListener,f.prototype.addListener=f.prototype.on,f.prefixed=a,f.EventEmitter=f,r.exports=f}(eventemitter3)),eventemitter3.exports}var eventemitter3Exports=requireEventemitter3(),defaults={},hasRequiredDefaults;function requireDefaults(){if(hasRequiredDefaults)return defaults;hasRequiredDefaults=1,Object.defineProperty(defaults,"__esModule",{value:!0}),defaults.WS_TIMEOUT=defaults.MIN_WS_TIMEOUT=void 0;var r=1e3;defaults.MIN_WS_TIMEOUT=r;var n=3e4;return defaults.WS_TIMEOUT=n,defaults}var defaultsExports=requireDefaults(),messageTypes={},hasRequiredMessageTypes;function requireMessageTypes(){if(hasRequiredMessageTypes)return messageTypes;hasRequiredMessageTypes=1,Object.defineProperty(messageTypes,"__esModule",{value:!0});var r=function(){function n(){throw new Error("Static Class")}return n.GQL_CONNECTION_INIT="connection_init",n.GQL_CONNECTION_ACK="connection_ack",n.GQL_CONNECTION_ERROR="connection_error",n.GQL_CONNECTION_KEEP_ALIVE="ka",n.GQL_CONNECTION_TERMINATE="connection_terminate",n.GQL_START="start",n.GQL_DATA="data",n.GQL_ERROR="error",n.GQL_COMPLETE="complete",n.GQL_STOP="stop",n.SUBSCRIPTION_START="subscription_start",n.SUBSCRIPTION_DATA="subscription_data",n.SUBSCRIPTION_SUCCESS="subscription_success",n.SUBSCRIPTION_FAIL="subscription_fail",n.SUBSCRIPTION_END="subscription_end",n.INIT="init",n.INIT_SUCCESS="init_success",n.INIT_FAIL="init_fail",n.KEEP_ALIVE="keepalive",n}();return messageTypes.default=r,messageTypes}var messageTypesExports=requireMessageTypes(),MessageTypes=getDefaultExportFromCjs(messageTypesExports),protocol={},hasRequiredProtocol;function requireProtocol(){if(hasRequiredProtocol)return protocol;hasRequiredProtocol=1,Object.defineProperty(protocol,"__esModule",{value:!0}),protocol.GRAPHQL_SUBSCRIPTIONS=protocol.GRAPHQL_WS=void 0;var r="graphql-ws";protocol.GRAPHQL_WS=r;var n="graphql-subscriptions";return protocol.GRAPHQL_SUBSCRIPTIONS=n,protocol}var protocolExports=requireProtocol(),isObject$1={},hasRequiredIsObject;function requireIsObject(){if(hasRequiredIsObject)return isObject$1;hasRequiredIsObject=1,Object.defineProperty(isObject$1,"__esModule",{value:!0});function r(n){return n!==null&&typeof n=="object"}return isObject$1.default=r,isObject$1}var isObjectExports=requireIsObject(),isObject=getDefaultExportFromCjs(isObjectExports),isString$1={},hasRequiredIsString;function requireIsString(){if(hasRequiredIsString)return isString$1;hasRequiredIsString=1,Object.defineProperty(isString$1,"__esModule",{value:!0});function r(n){return typeof n=="string"}return isString$1.default=r,isString$1}var isStringExports=requireIsString(),isString=getDefaultExportFromCjs(isStringExports);function symbolObservablePonyfill(r){var n,a=r.Symbol;return typeof a=="function"?a.observable?n=a.observable:(n=a("observable"),a.observable=n):n="@@observable",n}var root;typeof self<"u"?root=self:typeof window<"u"?root=window:typeof global$1<"u"?root=global$1:typeof module<"u"?root=module:root=Function("return this")();var result=symbolObservablePonyfill(root);const _global=typeof global$1<"u"?global$1:typeof window<"u"?window:{},NativeWebSocket=_global.WebSocket||_global.MozWebSocket;class SubscriptionClient{client;operations;url;nextOperationId;connectionParams;minWsTimeout;wsTimeout;unsentMessagesQueue;reconnect;reconnecting;reconnectionAttempts;backoff;connectionCallback;eventEmitter;lazy;inactivityTimeout;inactivityTimeoutId;closedByUser;wsImpl;wsProtocols;wasKeepAliveReceived;tryReconnectTimeoutId;checkConnectionIntervalId;maxConnectTimeoutId;middlewares;maxConnectTimeGenerator;wsOptionArguments;wsOnMessage;constructor(n,a,i,o){const{connectionCallback:s=void 0,connectionParams:l={},minTimeout:f=defaultsExports.MIN_WS_TIMEOUT,timeout:d=defaultsExports.WS_TIMEOUT,reconnect:u=!1,reconnectionAttempts:c=1/0,lazy:v=!1,inactivityTimeout:h=0,wsOptionArguments:m=[],onMessage:g}=a||{};if(this.wsOnMessage=g,this.wsImpl=i||NativeWebSocket,!this.wsImpl)throw new Error("Unable to find native implementation, or alternative implementation for WebSocket!");this.wsProtocols=o||protocolExports.GRAPHQL_WS,this.connectionCallback=s,this.url=n,this.operations={},this.nextOperationId=0,this.minWsTimeout=f,this.wsTimeout=d,this.unsentMessagesQueue=[],this.reconnect=u,this.reconnecting=!1,this.reconnectionAttempts=c,this.lazy=!!v,this.inactivityTimeout=h,this.closedByUser=!1,this.backoff=new Backoff({jitter:.5}),this.eventEmitter=new eventemitter3Exports.EventEmitter,this.middlewares=[],this.client=null,this.maxConnectTimeGenerator=this.createMaxConnectTimeGenerator(),this.connectionParams=this.getConnectionParams(l),this.wsOptionArguments=m,this.lazy||this.connect()}get status(){return this.client===null?this.wsImpl.CLOSED:this.client.readyState}close(n=!0,a=!0){this.clearInactivityTimeout(),this.client!==null&&(this.closedByUser=a,n&&(this.clearCheckConnectionInterval(),this.clearMaxConnectTimeout(),this.clearTryReconnectTimeout(),this.unsubscribeAll(),this.sendMessage(void 0,MessageTypes.GQL_CONNECTION_TERMINATE,null)),this.client.close(),this.client.onopen=null,this.client.onclose=null,this.client.onerror=null,this.client.onmessage=null,this.client=null,this.eventEmitter.emit("disconnected"),n||this.tryReconnect())}request(n){const a=this.getObserver.bind(this),i=this.executeOperation.bind(this),o=this.unsubscribe.bind(this);let s=null;return this.clearInactivityTimeout(),{[result](){return this},subscribe(l,f,d){const u=a(l,f,d);return s=i(n,(c,v)=>{c===null&&v===null?u.complete&&u.complete():c?u.error&&u.error(c[0]):u.next&&u.next(v)}),{unsubscribe:()=>{s&&(o(s),s=null)}}}}}on(n,a,i){const o=this.eventEmitter.on(n,a,i);return()=>{o.off(n,a,i)}}onConnected(n,a){return this.on("connected",n,a)}onConnecting(n,a){return this.on("connecting",n,a)}onDisconnected(n,a){return this.on("disconnected",n,a)}onReconnected(n,a){return this.on("reconnected",n,a)}onReconnecting(n,a){return this.on("reconnecting",n,a)}onError(n,a){return this.on("error",n,a)}unsubscribeAll(){Object.keys(this.operations).forEach(n=>{this.unsubscribe(n)})}applyMiddlewares(n){return new Promise((a,i)=>{((s,l)=>{const f=d=>{if(d)i(d);else if(s.length>0){const u=s.shift();u&&u.applyMiddleware.apply(l,[n,f])}else a(n)};f()})([...this.middlewares],this)})}use(n){return n.forEach(a=>{if(isFunction(a.applyMiddleware))this.middlewares.push(a);else throw new Error("Middleware must implement the applyMiddleware function.")}),this}getConnectionParams(n){return()=>new Promise((a,i)=>{if(isFunction(n))try{return a(n.call(null))}catch(o){return i(o)}a(n)})}executeOperation(n,a){this.client===null&&this.connect();const i=this.generateOperationId();return this.operations[i]={options:n,handler:a},this.applyMiddlewares(n).then(o=>{this.checkOperationOptions(o,a),this.operations[i]&&(this.operations[i]={options:o,handler:a},this.sendMessage(i,MessageTypes.GQL_START,o))}).catch(o=>{this.unsubscribe(i),a(this.formatErrors(o))}),i}getObserver(n,a,i){return isFunction(n)?{next:o=>n(o),error:o=>a&&a(o),complete:()=>i&&i()}:n}createMaxConnectTimeGenerator(){const n=this.minWsTimeout,a=this.wsTimeout;return new Backoff({min:n,max:a,factor:1.2})}clearCheckConnectionInterval(){this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnectionIntervalId=null)}clearMaxConnectTimeout(){this.maxConnectTimeoutId&&(clearTimeout(this.maxConnectTimeoutId),this.maxConnectTimeoutId=null)}clearTryReconnectTimeout(){this.tryReconnectTimeoutId&&(clearTimeout(this.tryReconnectTimeoutId),this.tryReconnectTimeoutId=null)}clearInactivityTimeout(){this.inactivityTimeoutId&&(clearTimeout(this.inactivityTimeoutId),this.inactivityTimeoutId=null)}setInactivityTimeout(){this.inactivityTimeout>0&&Object.keys(this.operations).length===0&&(this.inactivityTimeoutId=setTimeout(()=>{Object.keys(this.operations).length===0&&this.close()},this.inactivityTimeout))}checkOperationOptions(n,a){const{query:i,variables:o,operationName:s}=n;if(!i)throw new Error("Must provide a query.");if(!a)throw new Error("Must provide an handler.");if(!isString(i)&&!getOperationAST(i,s)||s&&!isString(s)||o&&!isObject(o))throw new Error("Incorrect option types. query must be a string or a document,`operationName` must be a string, and `variables` must be an object.")}buildMessage(n,a,i){const o=i&&i.query?{...i,query:typeof i.query=="string"?i.query:print(i.query)}:i;return{id:n,type:a,payload:o}}formatErrors(n){return Array.isArray(n)?n:n&&n.errors?this.formatErrors(n.errors):n&&n.message?[n]:[{name:"FormattedError",message:"Unknown error",originalError:n}]}sendMessage(n,a,i){this.sendMessageRaw(this.buildMessage(n,a,i))}sendMessageRaw(n){switch(this.status){case this.wsImpl.OPEN:let a=JSON.stringify(n);try{JSON.parse(a)}catch{this.eventEmitter.emit("error",new Error(`Message must be JSON-serializable. Got: ${n}`))}this.client.send(a);break;case this.wsImpl.CONNECTING:this.unsentMessagesQueue.push(n);break;default:this.reconnecting||this.eventEmitter.emit("error",new Error("A message was not sent because socket is not connected, is closing or is already closed. Message was: "+JSON.stringify(n)))}}generateOperationId(){return String(++this.nextOperationId)}tryReconnect(){if(!this.reconnect||this.backoff.attempts>=this.reconnectionAttempts)return;this.reconnecting||(Object.keys(this.operations).forEach(a=>{this.unsentMessagesQueue.push(this.buildMessage(a,MessageTypes.GQL_START,this.operations[a].options))}),this.reconnecting=!0),this.clearTryReconnectTimeout();const n=this.backoff.duration();this.tryReconnectTimeoutId=setTimeout(()=>{this.connect()},n)}flushUnsentMessagesQueue(){this.unsentMessagesQueue.forEach(n=>{this.sendMessageRaw(n)}),this.unsentMessagesQueue=[]}checkConnection(){if(this.wasKeepAliveReceived){this.wasKeepAliveReceived=!1;return}this.reconnecting||this.close(!1,!0)}checkMaxConnectTimeout(){this.clearMaxConnectTimeout(),this.maxConnectTimeoutId=setTimeout(()=>{this.status!==this.wsImpl.OPEN&&(this.reconnecting=!0,this.close(!1,!0))},this.maxConnectTimeGenerator.duration())}connect(){this.client=new this.wsImpl(this.url,this.wsProtocols,...this.wsOptionArguments),this.checkMaxConnectTimeout(),this.client.onopen=async()=>{if(this.status===this.wsImpl.OPEN){this.clearMaxConnectTimeout(),this.closedByUser=!1,this.eventEmitter.emit(this.reconnecting?"reconnecting":"connecting");try{const n=await this.connectionParams();this.sendMessage(void 0,MessageTypes.GQL_CONNECTION_INIT,n),this.flushUnsentMessagesQueue()}catch(n){this.sendMessage(void 0,MessageTypes.GQL_CONNECTION_ERROR,n),this.flushUnsentMessagesQueue()}}},this.client.onclose=()=>{this.closedByUser||this.close(!1,!1)},this.client.onerror=n=>{this.eventEmitter.emit("error",n)},this.client.onmessage=({data:n})=>{this.wsOnMessage?.(n),this.processReceivedData(n)}}processReceivedData(n){let a,i;try{a=JSON.parse(n),i=a.id}catch{throw new Error(`Message must be JSON-parseable. Got: ${n}`)}if([MessageTypes.GQL_DATA,MessageTypes.GQL_COMPLETE,MessageTypes.GQL_ERROR].indexOf(a.type)!==-1&&!this.operations[i]){this.unsubscribe(i);return}switch(a.type){case MessageTypes.GQL_CONNECTION_ERROR:this.connectionCallback&&this.connectionCallback(a.payload);break;case MessageTypes.GQL_CONNECTION_ACK:this.eventEmitter.emit(this.reconnecting?"reconnected":"connected",a.payload),this.reconnecting=!1,this.backoff.reset(),this.maxConnectTimeGenerator.reset(),this.connectionCallback&&this.connectionCallback();break;case MessageTypes.GQL_COMPLETE:const o=this.operations[i].handler;delete this.operations[i],o.call(this,null,null);break;case MessageTypes.GQL_ERROR:this.operations[i].handler(this.formatErrors(a.payload),null),delete this.operations[i];break;case MessageTypes.GQL_DATA:const s=a.payload.errors?{...a.payload,errors:this.formatErrors(a.payload.errors)}:a.payload;this.operations[i].handler(null,s);break;case MessageTypes.GQL_CONNECTION_KEEP_ALIVE:const l=typeof this.wasKeepAliveReceived>"u";this.wasKeepAliveReceived=!0,l&&this.checkConnection(),this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnection()),this.checkConnectionIntervalId=setInterval(this.checkConnection.bind(this),this.wsTimeout);break;default:throw new Error("Invalid message type!")}}unsubscribe(n){this.operations[n]&&(delete this.operations[n],this.setInactivityTimeout(),this.sendMessage(n,MessageTypes.GQL_STOP,void 0))}}const INVALID_ENDPOINT_ERROR_MESSAGE="Invalid Schema Endpoint for more info double click on the failed Result.",INVALID_HTTP_HEADER_ERROR_MESSAGE="Invalid HTTP Header for more info double click on the failed Result.",EXECUTE_OPERATION_REQUEST_MESSAGE_TYPE="execute-operation";function runOperation({payload:{documentId:r,workspaceId:n,environmentId:a,operationIndex:i=0}},o){const s=new AbortController;enqueueTask({id:r,cancel:()=>s.abort(),execute:async()=>{const l=await getDocumentItemAndContent(r,s.signal);if(!l)return;const[f,d]=await Promise.all([getConnectionSettings(r,s.signal),getResolvedVariables(a)]),u=interpolateHttpConnectionSettings(f,d);if(!u)return;let c;function v(){c?.cancel(),s.signal.removeEventListener("abort",v)}s.signal.addEventListener("abort",v);const h=createId(),m=getGraphQLDocument(o,l,!0),g=getHttpHeaders(u),_=getGraphQLVariables(o,l,a,i,d);if(m&&(_||!l.variables?.length)){const[S,N]=getOperation(m,i),O=validateDocument(m);if(O.success||(console.warn(O.errorMessage),sendWarning(o,O.errorMessage,r)),isInvalidHttpHeader(g)){const k=S===OperationType.SUBSCRIPTION?{id:h,operationName:N,operationType:S,operationStatus:"failed",started:now(),payload:{errors:[{message:INVALID_HTTP_HEADER_ERROR_MESSAGE}]}}:{id:h,operationName:N,operationType:S,operationStatus:"failed",started:now(),data:{kind:GraphQLResponseKind.SIMPLE,parsedBody:{errors:[{message:INVALID_HTTP_HEADER_ERROR_MESSAGE}]}}};sendOperationResult(o,r,k),sendOperationRequestFailed(o,r,h,S),sendInvalidHttpHeaderError(o,r,g,createLogMessagePrefix(S,N),h);return}const M=!0,[F,L]=O.success&&M?splitOperation(m,l.body,i)(l,_):[l,_];if(S===OperationType.SUBSCRIPTION)c=createSubscriptionExecutor(o,n,h,F,S,N,i,L,u,g);else{const k=O.success&&(u.endpoint.length||u.sdlEndpoint?.length)?await getResolvedFiles(n,m,u,N,L):void 0;c=createDefaultExecutor(o,n,h,F,S,N,i,L,u,g,k,M)}}else{if(isInvalidHttpHeader(g)){const S=OperationType.QUERY;sendOperationResult(o,r,{id:h,operationType:S,operationStatus:"failed",started:now(),data:{kind:GraphQLResponseKind.SIMPLE,parsedBody:{errors:[{message:INVALID_HTTP_HEADER_ERROR_MESSAGE}]}}}),sendOperationRequestFailed(o,r,h,S),sendInvalidHttpHeaderError(o,r,g,createLogMessagePrefix(S),h);return}c=createDefaultExecutor(o,n,h,l,OperationType.QUERY,void 0,i,_,u,g)}s.signal.aborted||await c.execute()}})}function createLogMessagePrefix(r,n){const a=n?`"${n}" `:"";return`${createHumanReadableOperationType(r)} operation ${a}`}function createHumanReadableOperationType(r){switch(r){case OperationType.MUTATION:return"Mutation";case OperationType.SUBSCRIPTION:return"Subscription";default:return"Query"}}const createDefaultExecutor=(r,n,a,i,o,s,l,f,d,u,c,v=!1)=>{if(o===OperationType.SUBSCRIPTION)throw new Error("Subscription type is not allowed!");const h=new AbortController,{id:m,body:g}=i,_=()=>{sendOperationRequestSucceeded(r,m,a,o)};return{cancel:async()=>h.abort(),execute:()=>new Promise(async S=>{if(d?.endpoint.length){const N=now();sendOperationRequestStarted(r,m,a,o);const M={headers:u??new Headers,uri:d.endpoint,useGET:d.useGet,includeCookies:d.includeCookies};let F=!1;const L=await executeOperation(M,{operationName:v?void 0:s,query:g,variables:f,files:c},{onComplete:()=>{F||_(),S()},onError:(P,U)=>{F=!0,P instanceof ClientAbortError?sendOperationRequestCancelled(r,m,a,o):(sendOperationResultPatch(r,m,a,{payload:P,success:!1,received:now(),index:U}),sendOperationRequestFailed(r,m,a,o))},onNext:(P,U)=>{sendOperationResultPatch(r,m,a,{payload:P,success:!0,received:now(),index:U})}},{onComplete:()=>{F||_(),S()},onError:(P,U)=>{F=!0,P instanceof ClientAbortError?sendOperationRequestCancelled(r,m,a,o):(sendOperationVariableBatchingResult(r,m,a,{payload:P,success:!1,received:now(),index:U}),sendOperationRequestFailed(r,m,a,o))},onNext:(P,U)=>{sendOperationVariableBatchingResult(r,m,a,{payload:P,success:!0,received:now(),index:U})}},createHttpLogger(r,m,a,RequestKind.GRAPHQL_OPERATION,{name:s}),h.signal),k=L.error?.name==="ClientAbortError"?"cancelled":L.error||L.kind!==GraphQLResponseKind.VARIABLE_BATCHING&&L.parsedBody?.errors?.length?"failed":"succeeded";switch(n&&sendHistoryEntry(r,m,createDocumentId(),n,k,o,s,l),sendOperationResult(r,m,{id:a,operationName:s,operationStatus:k,operationType:o,started:N,data:L}),k){case"cancelled":sendOperationRequestCancelled(r,m,a,o),S();break;case"failed":sendOperationRequestFailed(r,m,a,o),S();break;default:L.kind===GraphQLResponseKind.SIMPLE&&(_(),S());break}}else sendOperationResult(r,m,{id:a,operationName:s,operationType:o,operationStatus:"failed",started:now(),data:{kind:GraphQLResponseKind.SIMPLE,parsedBody:{errors:[{message:INVALID_ENDPOINT_ERROR_MESSAGE}]}}}),sendOperationRequestFailed(r,m,a,o),sendInvalidEndpointWarning(r,m,createLogMessagePrefix(o,s),a),S()})}},createSubscriptionExecutor=(r,n,a,i,o,s,l,f,d,u)=>{if(o!==OperationType.SUBSCRIPTION)throw new Error("Only the Subscription type is allowed here!");const c=new AbortController,{id:v,body:h}=i;return{cancel:async()=>c.abort(),execute:async()=>{let m=!1;const g=getSSESubscriptionEndpoint(d),_=getWSSubscriptionEndpoint(d);if(g.length||_.length)return new Promise(async S=>{const N=createDocumentId(),O=u?Object.fromEntries(u.entries()):{},M=d.subscriptionProtocol??DEFAULT_SUBSCRIPTION_PROTOCOL,F=P=>P===GRAPHQL_SSE_SUBSCRIPTION_PROTOCOL?g:_;sendOperationRequestStarted(r,v,a,o),sendSubscriptionRequestStarted(r,v,a,RequestKind.GRAPHQL_OPERATION,now(),F(M),M,O);const L=P=>{if(m)return;m=!0;const U=mapToGraphQLErrors(P);sendSubscriptionRequestStopped(r,v,a,RequestKind.GRAPHQL_OPERATION,now(),"failed",U),sendOperationResult(r,v,{id:a,operationName:s,operationType:o,operationStatus:"failed",started:now(),payload:{errors:U}}),n&&sendHistoryEntry(r,v,N,n,"failed",o,s,l),sendOperationRequestFailed(r,v,a,o),S()},k=SUBSCRIPTION_PROVIDERS[M](F,O,{includeCookies:d.includeCookies,onConnected:P=>{if(P){L(P);return}sendOperationResult(r,v,{id:a,operationName:s,operationType:o,operationStatus:"succeeded",started:now()}),n&&sendHistoryEntry(r,v,N,n,"succeeded",o,s,l)}});try{let P=function(){k.close(),sendOperationRequestCancelled(r,v,a,o),sendSubscriptionRequestStopped(r,v,a,RequestKind.GRAPHQL_OPERATION,now(),"closed"),c.signal.removeEventListener("abort",P),S()};const U=await k.execute({query:h,operationName:s,variables:f},j=>sendSubscriptionRequestMessage(r,v,a,now(),typeof j=="string"?j:JSON.stringify(j)));k instanceof AutoSubscriptionProvider&&k.protocol&&sendSubscriptionRequestProtocol(r,v,a,RequestKind.GRAPHQL_OPERATION,k.protocol);let B=0;U.subscribe({next:j=>{sendOperationResultEvent(r,v,a,{payload:j,received:now(),success:!j?.errors?.length,index:B++})},error:L,complete:()=>{sendOperationRequestSucceeded(r,v,a,o),sendSubscriptionRequestStopped(r,v,a,RequestKind.GRAPHQL_OPERATION,now(),"completed"),S()}}),c.signal.aborted?P():c.signal.addEventListener("abort",P)}catch(P){L(P)}});sendOperationResult(r,v,{id:a,operationName:s,operationType:o,operationStatus:"failed",started:now(),payload:{errors:[{message:INVALID_ENDPOINT_ERROR_MESSAGE}]}}),sendOperationRequestFailed(r,v,a,o),sendInvalidEndpointWarning(r,v,createLogMessagePrefix(o,s),a)}}};function getSSESubscriptionEndpoint(r){return r?r.sseSubscriptionEndpoint||r.endpoint:""}function getWSSubscriptionEndpoint(r){return r?r.subscriptionEndpoint||r.endpoint.replace(/^http/i,"ws"):""}function mapToGraphQLErrors(r){return"type"in r?[r.type==="closed"&&"code"in r?{message:"Subscription closed",extensions:{code:r.code,reason:r.reason,wasClean:r.wasClean}}:{message:"Unknown subscription error"}]:isObjectArray(r)?r.every(n=>"message"in n)?r.map(({message:n})=>({message:n})):r.length<=1?[{message:"Unknown subscription error"}]:[{message:`${r.length} unknown subscription errors`}]:["message"in r?{message:r.message}:r]}const SUBSCRIPTION_PROVIDERS={[AUTO_SUBSCRIPTION_PROTOCOL]:(r,n,a)=>new AutoSubscriptionProvider(r,n,a),[GRAPHQL_WS_SUBSCRIPTION_PROTOCOL]:(r,n,a)=>new GraphQLWSSubscriptionProvider(r,n,a),[APOLLO_SUBSCRIPTION_PROTOCOL]:(r,n,a)=>new ApolloSubscriptionProvider(r,n,a),[GRAPHQL_SSE_SUBSCRIPTION_PROTOCOL]:(r,n,a)=>new GraphQLSSESubscriptionProvider(r,n,a)};class SubscriptionProvider{constructor(n,a,i){this.resolveSubscriptionUrl=n,this.connectionParams=a,this.extraOptions=i}}class AutoSubscriptionProvider extends SubscriptionProvider{provider;subscriptionProtocol;async execute(n,a){const i=this;if(!this.provider){const[o,s]=await new Promise(l=>{const f=i.resolveSubscriptionUrl(AUTO_SUBSCRIPTION_PROTOCOL);if(!f.length){l([new GraphQLSSESubscriptionProvider(i.resolveSubscriptionUrl,i.connectionParams,i.extraOptions),GRAPHQL_SSE_SUBSCRIPTION_PROTOCOL]);return}const d=new WebSocket(f,[GRAPHQL_WS_SUBSCRIPTION_PROTOCOL,APOLLO_SUBSCRIPTION_PROTOCOL]);d.onopen=function(){switch(d.protocol){case APOLLO_SUBSCRIPTION_PROTOCOL:l([new ApolloSubscriptionProvider(i.resolveSubscriptionUrl,i.connectionParams,i.extraOptions),APOLLO_SUBSCRIPTION_PROTOCOL]);break;default:l([new GraphQLWSSubscriptionProvider(i.resolveSubscriptionUrl,i.connectionParams,i.extraOptions),GRAPHQL_WS_SUBSCRIPTION_PROTOCOL]);break}d.close()},d.onerror=function(){l([new GraphQLSSESubscriptionProvider(i.resolveSubscriptionUrl,i.connectionParams,i.extraOptions),GRAPHQL_SSE_SUBSCRIPTION_PROTOCOL]),d.close()}});this.provider=o,this.subscriptionProtocol=s}return this.provider.execute(n,a)}get protocol(){return this.subscriptionProtocol}close(){this.provider?.close()}}class ApolloSubscriptionProvider extends SubscriptionProvider{closeFunc;observable;createClient(n){const a=new SubscriptionClient(this.resolveSubscriptionUrl(APOLLO_SUBSCRIPTION_PROTOCOL),{lazy:!1,reconnect:!1,connectionParams:this.connectionParams,connectionCallback:this.extraOptions?.onConnected,onMessage:n});return this.closeFunc=()=>{a.close(!0)},a}execute(n,a){return this.observable||(this.observable=createObservable(i=>{const o=this.createClient(a);return o.onError(s=>i.error(s)),o.request(n).subscribe(i).unsubscribe})),Promise.resolve(this.observable)}close(){this.closeFunc?.()}}class GraphQLWSSubscriptionProvider extends SubscriptionProvider{closeFunc;observable;createClient(n){let a,i;const o=createClient({url:this.resolveSubscriptionUrl(GRAPHQL_WS_SUBSCRIPTION_PROTOCOL),lazy:!0,retryAttempts:0,keepAlive:ONE_MINUTE,connectionParams:this.connectionParams,on:{connected:s=>{if(!(s instanceof WebSocket)){this.extraOptions?.onConnected?.({message:"Unknown socket"});return}a=s,this.extraOptions?.onConnected?.()},error:s=>{this.extraOptions?.onConnected?.(s)},ping:s=>{s||(i=self.setTimeout(()=>{a?.readyState===WebSocket.OPEN&&a.close(4408,"Request Timeout")},FIVE_SECONDS))},pong:s=>{s&&self.clearTimeout(i)},message:n}});return this.close=()=>{o.dispose()},o}execute(n,a){return this.observable||(this.observable=createObservable(i=>this.createClient(a).subscribe(n,{next:(...o)=>i.next(...o),error:o=>i.error(o),complete:()=>i.complete()}))),Promise.resolve(this.observable)}close(){this.closeFunc?.()}}class GraphQLSSESubscriptionProvider extends SubscriptionProvider{closeFunc;observable;createClient(n){const a=createClient$1({url:this.resolveSubscriptionUrl(GRAPHQL_SSE_SUBSCRIPTION_PROTOCOL),retryAttempts:0,credentials:this.extraOptions?.includeCookies?"include":"same-origin",referrerPolicy:IS_RUNNING_IN_ELECTRON?"no-referrer":"strict-origin-when-cross-origin",headers:{...this.connectionParams,"content-type":"application/json"},onMessage:n});return this.extraOptions?.onConnected?.(),this.close=()=>{a.dispose()},a}execute(n,a){return this.observable||(this.observable=createObservable(i=>this.createClient(a).subscribe(n,{next:(...o)=>i.next(...o),error:o=>i.error(o),complete:()=>i.complete()}))),Promise.resolve(this.observable)}close(){this.closeFunc?.()}}function createObservable(r){return{subscribe:r}}const node=function(){var r=[{defaultValue:null,kind:"LocalArgument",name:"stageId"}],n=[{kind:"Variable",name:"id",variableName:"stageId"}],a={alias:null,args:null,kind:"ScalarField",name:"downloadUrl",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"tag",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:r,kind:"Fragment",metadata:null,name:"schemaApiFetcherTaskQuery",selections:[{alias:null,args:n,concreteType:"Stage",kind:"LinkedField",name:"stageById",plural:!1,selections:[{alias:null,args:null,concreteType:"PublishedSchemaVersion",kind:"LinkedField",name:"publishedSchema",plural:!1,selections:[{alias:null,args:null,concreteType:"SchemaVersion",kind:"LinkedField",name:"version",plural:!1,selections:[a,i],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:r,kind:"Operation",name:"schemaApiFetcherTaskQuery",selections:[{alias:null,args:n,concreteType:"Stage",kind:"LinkedField",name:"stageById",plural:!1,selections:[{alias:null,args:null,concreteType:"PublishedSchemaVersion",kind:"LinkedField",name:"publishedSchema",plural:!1,selections:[{alias:null,args:null,concreteType:"SchemaVersion",kind:"LinkedField",name:"version",plural:!1,selections:[a,i,o],storageKey:null}],storageKey:null},o],storageKey:null}]},params:{id:"8cddc0556879bf1f147b06775d33b192",metadata:{},name:"schemaApiFetcherTaskQuery",operationKind:"query",text:null}}}();node.hash="1359c500cfecb2578c682124e7dad7ec";const DEFAULT_SCHEMA_INFO={endpoint:"",exists:!1,hash:"",indexed:!1,hasMutationType:!1,hasSubscriptionType:!1,hasUploadType:!1,supportsSemanticIntrospection:!1},CANCEL_OPERATION_REQUEST_MESSAGE_TYPE="cancel-request",SCHEMA_API_FETCHER_MESSAGE_TYPE="fetch-api-schema",apiIdOfRunningFetches=new Set;function fetchApiSchema({id:r,type:n,payload:{apiId:a,stageId:i}},o){const s=new AbortController;enqueueTask({id:r,cancel:()=>s.abort(),execute:async()=>{if(apiIdOfRunningFetches.has(a))throw new TaskFailedError("The schema fetch task cannot be executed concurrently on the same API","MULTIPLE_SCHEMA_FETCHES_DETECTED");try{apiIdOfRunningFetches.add(a);const f=(await fetchRelayQuery(node,{stageId:i},s.signal))?.stageById?.publishedSchema?.version;if(f){const d=await fetchSchemaCore$1(o,a,f.downloadUrl,createSchemaInfoApiUrl(i),s.signal);o.sendMessage(new Message(n,d,r));return}o.sendMessage(new Message(n,DEFAULT_SCHEMA_INFO,r))}finally{apiIdOfRunningFetches.delete(a)}}})}async function fetchSchemaCore$1(r,n,a,i,o){const s=createScopeId();sendScopeBegin(r,n,s,now(),"SDL Schema Fetch",{uri:a,kind:"introspection"});try{const l=await fetchSchemaByApiSdlEndpoint(r,n,s,a,o);if("schema"in l){const f=await setSchema(i,l.schema,l.sdlSchema,GraphQLSchemaKind.SDL_FETCH,l.supportsSemanticIntrospection);return{endpoint:f.endpoint,exists:!0,hash:f.hash,indexed:f.indexed,updatedAt:f.updatedAt,hasMutationType:!!f.mutationTypeName,hasSubscriptionType:!!f.subscriptionTypeName,hasUploadType:f.hasUploadType,supportsSemanticIntrospection:f.supportsSemanticIntrospection}}}finally{sendScopeEnd(r,n,s,now())}throw new TaskFailedError("Loading schema failed.","SCHEMA_FETCHING_FAILED")}const FETCH_SCHEMA_DIRECTIVE="fetch-directive";function fetchSchemaDirective({id:r,payload:{schemaEndpoint:n,coordinate:a},type:i},o){enqueueTask({id:r,cancel:noop,execute:async()=>{const s=(await getSchemaCacheItem(n))?.getDirective(a)??void 0;o.sendMessage(new Message(i,s,r))}})}const FETCH_SCHEMA_DIRECTIVES="fetch-directives";function fetchSchemaDirectives({id:r,payload:{schemaEndpoint:n},type:a},i){enqueueTask({id:r,cancel:noop,execute:async()=>{const o=(await getSchemaCacheItem(n))?.getDirectives()??void 0;i.sendMessage(new Message(a,o,r))}})}const SCHEMA_FETCHER_CACHED_MESSAGE_TYPE="get-cached-schema";function getCachedSchema({id:r,type:n,payload:{documentId:a,environmentId:i}},o){const s=new AbortController;enqueueTask({id:r,cancel:()=>s.abort(),execute:async()=>{const l=await getInterpolatedHttpConnection(a,i,s.signal);if(!l?.endpoint.length&&!l?.sdlEndpoint?.length){o.sendMessage(new Message(n,DEFAULT_SCHEMA_INFO,r));return}const f=getHttpHeaders(l,({name:u})=>!FUSION_OPERATION_PLAN_HEADER_NAME_PATTERN.test(u));if(isInvalidHttpHeader(f)){o.sendMessage(new Message(n,DEFAULT_SCHEMA_INFO,r)),sendInvalidHttpHeaderError(o,a,f,"Introspection Query");return}const d=await getSchemaFromCache(l);o.sendMessage(new Message(n,d??DEFAULT_SCHEMA_INFO,r))}})}async function getSchemaFromCache(r){const n=await getSchema(r);if(n)return{endpoint:n.endpoint,exists:!0,hash:n.hash,indexed:n.indexed,updatedAt:n.updatedAt,hasMutationType:!!n.mutationTypeName,hasSubscriptionType:!!n.subscriptionTypeName,hasUploadType:n.hasUploadType,supportsSemanticIntrospection:n.supportsSemanticIntrospection}}const SCHEMA_FETCHER_MESSAGE_TYPE="fetch-schema",documentIdOfRunningFetches=new Set;function fetchSchema({id:r,type:n,payload:{documentId:a,environmentId:i}},o){const s=new AbortController;enqueueTask({id:r,cancel:()=>s.abort(),execute:async()=>{if(documentIdOfRunningFetches.has(a))throw new TaskFailedError("The schema fetch task cannot be executed concurrently on the same document","MULTIPLE_SCHEMA_FETCHES_DETECTED");try{documentIdOfRunningFetches.add(a);const l=await getInterpolatedHttpConnection(a,i,s.signal);if(!l?.endpoint.length&&!l?.sdlEndpoint?.length){o.sendMessage(new Message(n,DEFAULT_SCHEMA_INFO,r));return}const f=getHttpHeaders(l,({name:c})=>!FUSION_OPERATION_PLAN_HEADER_NAME_PATTERN.test(c));if(isInvalidHttpHeader(f)){o.sendMessage(new Message(n,DEFAULT_SCHEMA_INFO,r)),sendInvalidHttpHeaderError(o,a,f,"Introspection Query");return}const d={headers:f,uri:l.endpoint,useGET:l.useGet,includeCookies:l.includeCookies};if(l.sdlEndpoint){const c=await fetchSchemaBySdlEndpointCore(o,a,{...d,uri:l.sdlEndpoint,useGET:!0},GraphQLSchemaKind.SDL_FETCH,l.sdlEndpoint,s.signal);o.sendMessage(new Message(n,c,r));return}try{const c=ensureEndsWithSlash(l.endpoint)+"schema.graphql",v=await fetchSchemaBySdlEndpointCore(o,a,{...d,uri:c,useGET:!0},GraphQLSchemaKind.SDL_PROBE,l.endpoint,s.signal);o.sendMessage(new Message(n,v,r));return}catch{}const u=await fetchSchemaCore(o,a,d,s.signal);o.sendMessage(new Message(n,u,r))}finally{documentIdOfRunningFetches.delete(a)}}})}function ensureEndsWithSlash(r){return r.endsWith("/")?r:r+"/"}async function fetchSchemaBySdlEndpointCore(r,n,a,i,o,s){const l=createScopeId(),f=a.useGET?"GET":"POST";sendScopeBegin(r,n,l,now(),i===GraphQLSchemaKind.SDL_FETCH?"SDL Schema Fetch":"SDL Schema Probe",{uri:a.uri,kind:"introspection",method:f});try{const d=await fetchSchemaBySdlEndpoint(r,n,l,a.uri,a,i,s);if("schema"in d){const u=await setSchema(o,d.schema,d.sdlSchema,i,d.supportsSemanticIntrospection);return{endpoint:u.endpoint,exists:!0,hash:u.hash,indexed:u.indexed,updatedAt:u.updatedAt,hasMutationType:!!u.mutationTypeName,hasSubscriptionType:!!u.subscriptionTypeName,hasUploadType:u.hasUploadType,supportsSemanticIntrospection:u.supportsSemanticIntrospection}}}finally{sendScopeEnd(r,n,l,now())}throw new TaskFailedError("Loading schema failed.","SCHEMA_FETCHING_FAILED")}async function fetchSchemaCore(r,n,a,i){const o=createScopeId(),s=a.useGET?"GET":"POST";sendScopeBegin(r,n,o,now(),"Introspection",{uri:a.uri,kind:"introspection",method:s});let l;try{const f=await fetchGraphQLSchema(a,(d,u)=>createHttpLogger(r,n,d,RequestKind.GRAPHQL_INTROSPECTION,{scopeId:o,name:u}),i);if("schema"in f){const d=await setSchema(a.uri,f.schema,printSchema(f.schema),GraphQLSchemaKind.INTROSPECTION,f.supportsSemanticIntrospection);return{endpoint:d.endpoint,exists:!0,hash:d.hash,indexed:d.indexed,updatedAt:d.updatedAt,hasMutationType:!!d.mutationTypeName,hasSubscriptionType:!!d.subscriptionTypeName,hasUploadType:d.hasUploadType,supportsSemanticIntrospection:d.supportsSemanticIntrospection}}l={itemId:n,scopeId:o}}finally{sendScopeEnd(r,n,o,now())}throw new TaskFailedError("Loading schema failed.","SCHEMA_FETCHING_FAILED",l)}const FETCH_SCHEMA_FIELD_TYPE="fetch-field";function fetchSchemaFieldType({id:r,payload:{schemaEndpoint:n,coordinate:a},type:i},o){enqueueTask({id:r,cancel:noop,execute:async()=>{const s=await getSchemaCacheItem(n);if(!s){o.sendMessage(new Message(i,void 0,r));return}const l=s.getField(a);o.sendMessage(new Message(i,l,r))}})}const FETCH_SCHEMA_FIELD_TYPES="fetch-fields";function fetchSchemaFieldTypes({id:r,payload:{schemaEndpoint:n,typeName:a,options:i},type:o},s){enqueueTask({id:r,cancel:noop,execute:async()=>{const l=(await getSchemaCacheItem(n))?.getFields(a,i);s.sendMessage(new Message(o,l,r))}})}const FETCH_SCHEMA_FIELDS_AND_TYPES="fetch-fields-and-types";function fetchSchemaFieldsAndTypes({id:r,payload:{schemaEndpoint:n,coordinate:a,options:i},type:o},s){enqueueTask({id:r,cancel:noop,execute:async()=>{const l=await getSchemaCacheItem(n);if(!l){s.sendMessage(new Message(o,void 0,r));return}const f={fields:l.getFields(a,i),interfaces:l.getInterfaces(a,i?.filter),possibleTypes:l.getPossibleTypes(a,i?.filter)};s.sendMessage(new Message(o,f,r))}})}const FETCH_SCHEMA_REFERENCE="fetch-schema-reference";function fetchSchemaReference({id:r,payload:{schemaEndpoint:n,typeCategory:a,filter:i},type:o},s){enqueueTask({id:r,cancel:noop,execute:async()=>{const l=await getSchemaReference(n,a,i);s.sendMessage(new Message(o,l,r))}})}const FETCH_SCHEMA_ROOT_TYPES="fetch-schema-root-types";function fetchSchemaRootTypes({id:r,payload:{schemaEndpoint:n,filter:a},type:i},o){enqueueTask({id:r,cancel:noop,execute:async()=>{const s=await fetchRootTypes(n,a);o.sendMessage(new Message(i,s,r))}})}const FETCH_SCHEMA_TYPE="fetch-type";function fetchSchemaType({id:r,payload:{schemaEndpoint:n,typeName:a},type:i},o){enqueueTask({id:r,cancel:noop,execute:async()=>{const s=(await getSchemaCacheItem(n))?.getType(a)??void 0;o.sendMessage(new Message(i,s,r))}})}const FETCH_SCHEMA_TYPES="fetch-types";function fetchSchemaTypes({id:r,payload:{schemaEndpoint:n,filter:a},type:i},o){enqueueTask({id:r,cancel:noop,execute:async()=>{const s=(await getSchemaCacheItem(n))?.getTypes(a);o.sendMessage(new Message(i,s,r))}})}class GraphQLEngineScheduler extends SchedulerBase{registerMessageReceiveHandlers(){this.registerReceiveMessageHandler(SCHEMA_FETCHER_MESSAGE_TYPE,fetchSchema),this.registerReceiveMessageHandler(SCHEMA_API_FETCHER_MESSAGE_TYPE,fetchApiSchema),this.registerReceiveMessageHandler(SCHEMA_FETCHER_CACHED_MESSAGE_TYPE,getCachedSchema),this.registerReceiveMessageHandler(FETCH_SCHEMA_DIRECTIVE,fetchSchemaDirective),this.registerReceiveMessageHandler(FETCH_SCHEMA_DIRECTIVES,fetchSchemaDirectives),this.registerReceiveMessageHandler(FETCH_SCHEMA_FIELD_TYPE,fetchSchemaFieldType),this.registerReceiveMessageHandler(FETCH_SCHEMA_FIELD_TYPES,fetchSchemaFieldTypes),this.registerReceiveMessageHandler(FETCH_SCHEMA_REFERENCE,fetchSchemaReference),this.registerReceiveMessageHandler(FETCH_SCHEMA_ROOT_TYPES,fetchSchemaRootTypes),this.registerReceiveMessageHandler(FETCH_SCHEMA_TYPE,fetchSchemaType),this.registerReceiveMessageHandler(FETCH_SCHEMA_TYPES,fetchSchemaTypes),this.registerReceiveMessageHandler(FETCH_SCHEMA_FIELDS_AND_TYPES,fetchSchemaFieldsAndTypes),this.registerReceiveMessageHandler(DOCUMENT_ANALYSIS_MESSAGE_TYPE,analyzeDocument),this.registerReceiveMessageHandler(DOCUMENT_OPERATIONS_ANALYSIS_MESSAGE_TYPE,analyzeDocumentOperations),this.registerReceiveMessageHandler(CANCEL_OPERATION_REQUEST_MESSAGE_TYPE,n=>cancelTask(n.payload.documentId)),this.registerReceiveMessageHandler(FILES_UPDATED_MESSAGE_TYPE,updatedFiles),this.registerReceiveMessageHandler(EXECUTE_OPERATION_REQUEST_MESSAGE_TYPE,runOperation)}}new GraphQLEngineScheduler});export default vr();
@@ -1,4 +1,4 @@
1
- import{p as process$1,B as Buffer}from"./monaco.af358442.e3J4IGMh.js";getOsName();isMacLike();const IS_RUNNING_IN_ELECTRON=navigator.userAgent.indexOf("Electron")>=0;function getOsName(){return navigator.userAgent.indexOf("Win")>=0?"Windows":navigator.userAgent.indexOf("Mac")>=0?"macOS":navigator.userAgent.indexOf("X11")>=0||navigator.userAgent.indexOf("Linux")>=0?"Linux":"Unknown"}function isMacLike(){const r=navigator.userAgent.toLowerCase();return r.includes("mac os")||r.includes("ipad")}const APP_NAME="Nitro",APP_VERSION="32.0.1",APP_GRAPHQL_CLIENT_ID="Q2xpZW50Cmc5ZjAwOTFmNTY5NmQ0NTZkOWUwZDQ0ZDMzYjJhZDJlOA==",cloudUriPattern=new RegExp("^https?:\\/\\/.*?\\.(bananacakepop\\.com|chillicream\\.com|chillicream\\.cloud)","i"),IS_RUNNING_IN_CLOUD=cloudUriPattern?.test(self.origin)??!1,APP_TYPE=IS_RUNNING_IN_CLOUD?"cloud":IS_RUNNING_IN_ELECTRON?"app":"middleware",APP_AGENT=`${APP_NAME}/${APP_VERSION} (${APP_TYPE})`,HEADER_CONTENT_TYPE="Content-Type",HTTP_SCHEME_PATTERN=/^https?:\/\//i,INTROSPECTION_PREFIX=/^_{2}(?!_)/i,ABORT_ERROR_NAME="AbortError",ABORT_ERROR=new DOMException("Action cancelled",ABORT_ERROR_NAME),TIMEOUT_ABORT_ERROR_MESSAGE="Action timed out",TIMEOUT_ABORT_ERROR=new DOMException(TIMEOUT_ABORT_ERROR_MESSAGE,ABORT_ERROR_NAME);class TimeoutAbortSignal{#e;#t;#r;constructor(t,n){this.#e=t,this.#t=n}get aborted(){return this.#e.aborted}get cancelled(){return this.#t()}get onabort(){return this.#e.onabort}get reason(){return this.#e.reason}dispatchEvent(t){return this.#e.dispatchEvent(t)}throwIfAborted(){this.#e.throwIfAborted()}toAbortSignal(){return this.#e}toPromise(){if(this.#r)return this.#r;const t=this;let n=!1;return this.#r=new Promise((i,s)=>{if(t.aborted){n=!0,s(TIMEOUT_ABORT_ERROR);return}if(t.cancelled){n=!0,i();return}function a(){t.removeEventListener("abort",a),t.removeEventListener("cancelled",f),n||(n=!0,s(TIMEOUT_ABORT_ERROR))}function f(){t.removeEventListener("abort",a),t.removeEventListener("cancelled",f),n||(n=!0,i())}t.addEventListener("abort",a),t.addEventListener("cancelled",f)}),this.#r}addEventListener(t,n,i){this.#e.addEventListener(t,n,i)}removeEventListener(t,n,i){this.#e.removeEventListener(t,n,i)}}class TimeoutAbortController{_controller=new AbortController;_signal=new TimeoutAbortSignal(this._controller.signal,()=>this._cancelled);_cancelled=!1;_timeoutHandle;constructor(t){this._timeoutHandle=self.setTimeout(()=>{this.abort(TIMEOUT_ABORT_ERROR_MESSAGE)},t)}get signal(){return this._signal}abort(t){this._controller.abort(t)}cancel(){this._cancelled=!0,self.clearTimeout(this._timeoutHandle),this._signal.dispatchEvent(new Event("cancelled"))}}function isAbortError(r){return r instanceof DOMException&&r.name===ABORT_ERROR_NAME}function isTimeoutAbortError(r){return isAbortError(r)&&r.message===TIMEOUT_ABORT_ERROR_MESSAGE}function createAbortScope(r,t,n){return n?n.aborted?Promise.reject(ABORT_ERROR):(n.addEventListener("abort",r),t().finally(()=>{n.removeEventListener("abort",r)})):t()}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getAugmentedNamespace(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var t=r.default;if(typeof t=="function"){var n=function i(){var s=!1;try{s=this instanceof i}catch{}return s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),n}var inherits_browser={exports:{}},hasRequiredInherits_browser;function requireInherits_browser(){return hasRequiredInherits_browser||(hasRequiredInherits_browser=1,typeof Object.create=="function"?inherits_browser.exports=function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(t,n){if(n){t.super_=n;var i=function(){};i.prototype=n.prototype,t.prototype=new i,t.prototype.constructor=t}}),inherits_browser.exports}var safeBuffer$1={exports:{}},dist={},hasRequiredDist;function requireDist(){return hasRequiredDist||(hasRequiredDist=1,function(r){Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var t={},n={};n.byteLength=u,n.toByteArray=c,n.fromByteArray=m;for(var i=[],s=[],a=typeof Uint8Array<"u"?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,d=f.length;l<d;++l)i[l]=f[l],s[f.charCodeAt(l)]=l;s[45]=62,s[95]=63;function o(D){var C=D.length;if(C%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var q=D.indexOf("=");q===-1&&(q=C);var M=q===C?0:4-q%4;return[q,M]}function u(D){var C=o(D),q=C[0],M=C[1];return(q+M)*3/4-M}function p(D,C,q){return(C+q)*3/4-q}function c(D){var C,q=o(D),M=q[0],F=q[1],k=new a(p(D,M,F)),$=0,L=F>0?M-4:M,G;for(G=0;G<L;G+=4)C=s[D.charCodeAt(G)]<<18|s[D.charCodeAt(G+1)]<<12|s[D.charCodeAt(G+2)]<<6|s[D.charCodeAt(G+3)],k[$++]=C>>16&255,k[$++]=C>>8&255,k[$++]=C&255;return F===2&&(C=s[D.charCodeAt(G)]<<2|s[D.charCodeAt(G+1)]>>4,k[$++]=C&255),F===1&&(C=s[D.charCodeAt(G)]<<10|s[D.charCodeAt(G+1)]<<4|s[D.charCodeAt(G+2)]>>2,k[$++]=C>>8&255,k[$++]=C&255),k}function v(D){return i[D>>18&63]+i[D>>12&63]+i[D>>6&63]+i[D&63]}function y(D,C,q){for(var M,F=[],k=C;k<q;k+=3)M=(D[k]<<16&16711680)+(D[k+1]<<8&65280)+(D[k+2]&255),F.push(v(M));return F.join("")}function m(D){for(var C,q=D.length,M=q%3,F=[],k=16383,$=0,L=q-M;$<L;$+=k)F.push(y(D,$,$+k>L?L:$+k));return M===1?(C=D[q-1],F.push(i[C>>2]+i[C<<4&63]+"==")):M===2&&(C=(D[q-2]<<8)+D[q-1],F.push(i[C>>10]+i[C>>4&63]+i[C<<2&63]+"=")),F.join("")}var R={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */R.read=function(D,C,q,M,F){var k,$,L=F*8-M-1,G=(1<<L)-1,B=G>>1,S=-7,_=q?F-1:0,h=q?-1:1,g=D[C+_];for(_+=h,k=g&(1<<-S)-1,g>>=-S,S+=L;S>0;k=k*256+D[C+_],_+=h,S-=8);for($=k&(1<<-S)-1,k>>=-S,S+=M;S>0;$=$*256+D[C+_],_+=h,S-=8);if(k===0)k=1-B;else{if(k===G)return $?NaN:(g?-1:1)*(1/0);$=$+Math.pow(2,M),k=k-B}return(g?-1:1)*$*Math.pow(2,k-M)},R.write=function(D,C,q,M,F,k){var $,L,G,B=k*8-F-1,S=(1<<B)-1,_=S>>1,h=F===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=M?0:k-1,I=M?1:-1,w=C<0||C===0&&1/C<0?1:0;for(C=Math.abs(C),isNaN(C)||C===1/0?(L=isNaN(C)?1:0,$=S):($=Math.floor(Math.log(C)/Math.LN2),C*(G=Math.pow(2,-$))<1&&($--,G*=2),$+_>=1?C+=h/G:C+=h*Math.pow(2,1-_),C*G>=2&&($++,G/=2),$+_>=S?(L=0,$=S):$+_>=1?(L=(C*G-1)*Math.pow(2,F),$=$+_):(L=C*Math.pow(2,_-1)*Math.pow(2,F),$=0));F>=8;D[q+g]=L&255,g+=I,L/=256,F-=8);for($=$<<F|L,B+=F;B>0;D[q+g]=$&255,g+=I,$/=256,B-=8);D[q+g-I]|=w*128};/*!
1
+ import{p as process$1,B as Buffer}from"./monaco.cbb9dd2a.D_5Blgsx.js";getOsName();isMacLike();const IS_RUNNING_IN_ELECTRON=navigator.userAgent.indexOf("Electron")>=0;function getOsName(){return navigator.userAgent.indexOf("Win")>=0?"Windows":navigator.userAgent.indexOf("Mac")>=0?"macOS":navigator.userAgent.indexOf("X11")>=0||navigator.userAgent.indexOf("Linux")>=0?"Linux":"Unknown"}function isMacLike(){const r=navigator.userAgent.toLowerCase();return r.includes("mac os")||r.includes("ipad")}const APP_NAME="Nitro",APP_VERSION="32.0.2",APP_GRAPHQL_CLIENT_ID="Q2xpZW50Cmc5ZjAwOTFmNTY5NmQ0NTZkOWUwZDQ0ZDMzYjJhZDJlOA==",cloudUriPattern=new RegExp("^https?:\\/\\/.*?\\.(bananacakepop\\.com|chillicream\\.com|chillicream\\.cloud)","i"),IS_RUNNING_IN_CLOUD=cloudUriPattern?.test(self.origin)??!1,APP_TYPE=IS_RUNNING_IN_CLOUD?"cloud":IS_RUNNING_IN_ELECTRON?"app":"middleware",APP_AGENT=`${APP_NAME}/${APP_VERSION} (${APP_TYPE})`,HEADER_CONTENT_TYPE="Content-Type",HTTP_SCHEME_PATTERN=/^https?:\/\//i,INTROSPECTION_PREFIX=/^_{2}(?!_)/i,ABORT_ERROR_NAME="AbortError",ABORT_ERROR=new DOMException("Action cancelled",ABORT_ERROR_NAME),TIMEOUT_ABORT_ERROR_MESSAGE="Action timed out",TIMEOUT_ABORT_ERROR=new DOMException(TIMEOUT_ABORT_ERROR_MESSAGE,ABORT_ERROR_NAME);class TimeoutAbortSignal{#e;#t;#r;constructor(t,n){this.#e=t,this.#t=n}get aborted(){return this.#e.aborted}get cancelled(){return this.#t()}get onabort(){return this.#e.onabort}get reason(){return this.#e.reason}dispatchEvent(t){return this.#e.dispatchEvent(t)}throwIfAborted(){this.#e.throwIfAborted()}toAbortSignal(){return this.#e}toPromise(){if(this.#r)return this.#r;const t=this;let n=!1;return this.#r=new Promise((i,s)=>{if(t.aborted){n=!0,s(TIMEOUT_ABORT_ERROR);return}if(t.cancelled){n=!0,i();return}function a(){t.removeEventListener("abort",a),t.removeEventListener("cancelled",f),n||(n=!0,s(TIMEOUT_ABORT_ERROR))}function f(){t.removeEventListener("abort",a),t.removeEventListener("cancelled",f),n||(n=!0,i())}t.addEventListener("abort",a),t.addEventListener("cancelled",f)}),this.#r}addEventListener(t,n,i){this.#e.addEventListener(t,n,i)}removeEventListener(t,n,i){this.#e.removeEventListener(t,n,i)}}class TimeoutAbortController{_controller=new AbortController;_signal=new TimeoutAbortSignal(this._controller.signal,()=>this._cancelled);_cancelled=!1;_timeoutHandle;constructor(t){this._timeoutHandle=self.setTimeout(()=>{this.abort(TIMEOUT_ABORT_ERROR_MESSAGE)},t)}get signal(){return this._signal}abort(t){this._controller.abort(t)}cancel(){this._cancelled=!0,self.clearTimeout(this._timeoutHandle),this._signal.dispatchEvent(new Event("cancelled"))}}function isAbortError(r){return r instanceof DOMException&&r.name===ABORT_ERROR_NAME}function isTimeoutAbortError(r){return isAbortError(r)&&r.message===TIMEOUT_ABORT_ERROR_MESSAGE}function createAbortScope(r,t,n){return n?n.aborted?Promise.reject(ABORT_ERROR):(n.addEventListener("abort",r),t().finally(()=>{n.removeEventListener("abort",r)})):t()}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getAugmentedNamespace(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var t=r.default;if(typeof t=="function"){var n=function i(){var s=!1;try{s=this instanceof i}catch{}return s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),n}var inherits_browser={exports:{}},hasRequiredInherits_browser;function requireInherits_browser(){return hasRequiredInherits_browser||(hasRequiredInherits_browser=1,typeof Object.create=="function"?inherits_browser.exports=function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(t,n){if(n){t.super_=n;var i=function(){};i.prototype=n.prototype,t.prototype=new i,t.prototype.constructor=t}}),inherits_browser.exports}var safeBuffer$1={exports:{}},dist={},hasRequiredDist;function requireDist(){return hasRequiredDist||(hasRequiredDist=1,function(r){Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var t={},n={};n.byteLength=u,n.toByteArray=c,n.fromByteArray=m;for(var i=[],s=[],a=typeof Uint8Array<"u"?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,d=f.length;l<d;++l)i[l]=f[l],s[f.charCodeAt(l)]=l;s[45]=62,s[95]=63;function o(D){var C=D.length;if(C%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var q=D.indexOf("=");q===-1&&(q=C);var M=q===C?0:4-q%4;return[q,M]}function u(D){var C=o(D),q=C[0],M=C[1];return(q+M)*3/4-M}function p(D,C,q){return(C+q)*3/4-q}function c(D){var C,q=o(D),M=q[0],F=q[1],k=new a(p(D,M,F)),$=0,L=F>0?M-4:M,G;for(G=0;G<L;G+=4)C=s[D.charCodeAt(G)]<<18|s[D.charCodeAt(G+1)]<<12|s[D.charCodeAt(G+2)]<<6|s[D.charCodeAt(G+3)],k[$++]=C>>16&255,k[$++]=C>>8&255,k[$++]=C&255;return F===2&&(C=s[D.charCodeAt(G)]<<2|s[D.charCodeAt(G+1)]>>4,k[$++]=C&255),F===1&&(C=s[D.charCodeAt(G)]<<10|s[D.charCodeAt(G+1)]<<4|s[D.charCodeAt(G+2)]>>2,k[$++]=C>>8&255,k[$++]=C&255),k}function v(D){return i[D>>18&63]+i[D>>12&63]+i[D>>6&63]+i[D&63]}function y(D,C,q){for(var M,F=[],k=C;k<q;k+=3)M=(D[k]<<16&16711680)+(D[k+1]<<8&65280)+(D[k+2]&255),F.push(v(M));return F.join("")}function m(D){for(var C,q=D.length,M=q%3,F=[],k=16383,$=0,L=q-M;$<L;$+=k)F.push(y(D,$,$+k>L?L:$+k));return M===1?(C=D[q-1],F.push(i[C>>2]+i[C<<4&63]+"==")):M===2&&(C=(D[q-2]<<8)+D[q-1],F.push(i[C>>10]+i[C>>4&63]+i[C<<2&63]+"=")),F.join("")}var R={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */R.read=function(D,C,q,M,F){var k,$,L=F*8-M-1,G=(1<<L)-1,B=G>>1,S=-7,_=q?F-1:0,h=q?-1:1,g=D[C+_];for(_+=h,k=g&(1<<-S)-1,g>>=-S,S+=L;S>0;k=k*256+D[C+_],_+=h,S-=8);for($=k&(1<<-S)-1,k>>=-S,S+=M;S>0;$=$*256+D[C+_],_+=h,S-=8);if(k===0)k=1-B;else{if(k===G)return $?NaN:(g?-1:1)*(1/0);$=$+Math.pow(2,M),k=k-B}return(g?-1:1)*$*Math.pow(2,k-M)},R.write=function(D,C,q,M,F,k){var $,L,G,B=k*8-F-1,S=(1<<B)-1,_=S>>1,h=F===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=M?0:k-1,I=M?1:-1,w=C<0||C===0&&1/C<0?1:0;for(C=Math.abs(C),isNaN(C)||C===1/0?(L=isNaN(C)?1:0,$=S):($=Math.floor(Math.log(C)/Math.LN2),C*(G=Math.pow(2,-$))<1&&($--,G*=2),$+_>=1?C+=h/G:C+=h*Math.pow(2,1-_),C*G>=2&&($++,G/=2),$+_>=S?(L=0,$=S):$+_>=1?(L=(C*G-1)*Math.pow(2,F),$=$+_):(L=C*Math.pow(2,_-1)*Math.pow(2,F),$=0));F>=8;D[q+g]=L&255,g+=I,L/=256,F-=8);for($=$<<F|L,B+=F;B>0;D[q+g]=$&255,g+=I,$/=256,B-=8);D[q+g-I]|=w*128};/*!
2
2
  * The buffer module from node.js, for the browser.
3
3
  *
4
4
  * @author Feross Aboukhadijeh <https://feross.org>
@@ -267,4 +267,4 @@ ${p}}`}return`
267
267
  }
268
268
  }
269
269
  }
270
- `,_gql_doc={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"IntrospectionQuery"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__type"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"StringValue",value:"__Type",block:!1}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"fields"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}}]}}]}}]}}],loc:{start:0,end:137,source:{name:"GraphQL request",locationOffset:{line:1,column:1},body:_gql_source}}};print(_gql_doc$4);print(_gql_doc$3);print(_gql_doc$2);print(_gql_doc$1);print(_gql_doc);class SchemaCache{#e=new LRUMap;get(t){return this.#e.get(t)??null}set(t,n){const i=new SchemaCacheItem(n);return this.#e.get(t)?.dispose(),this.#e.set(t,i),i}remove(t){this.#e.get(t)?.dispose(),this.#e.delete(t)}}class SchemaCacheItem{#e;#t;#r;#i;constructor(t){this.#e=new Map(t.directives),this.#t=new Map(t.fields),this.#r=new Map(t.types),this.#i=new Map(t.fields)}getDirective(t){return this.#e.get(t)??null}getDirectives(t){const n=[];if(t?.length){const i=t.toLocaleLowerCase();this.#e.forEach(s=>{!INTROSPECTION_PREFIX.test(s.name)&&s.name.toLocaleLowerCase().includes(i)&&n.push(s)})}else this.#e.forEach(i=>{INTROSPECTION_PREFIX.test(i.name)||n.push(i)});return n.sort(objectNameComparer)}getField(t){return this.#t.get(t)??null}getFields(t,n){const i=t+".",s=[];if(n?.includeIntrospectionFields&&this.addIntrospectionFields(t,s),n?.filter?.length){const a=n.filter.toLocaleLowerCase();this.#t.forEach(f=>{f.coordinate.startsWith(i)&&f.name.toLocaleLowerCase().includes(a)&&s.push(f)})}else this.#t.forEach(a=>{a.coordinate.startsWith(i)&&s.push(a)});return s.sort(objectNameComparer)}getType(t){return this.#r.get(t)??null}getTypes(t){const n=[];if(t?.length){const i=t.toLocaleLowerCase();this.#r.forEach(s=>{!INTROSPECTION_PREFIX.test(s.name)&&s.name.toLocaleLowerCase().includes(i)&&n.push(s)})}else this.#r.forEach(i=>{INTROSPECTION_PREFIX.test(i.name)||n.push(i)});return n.sort(objectNameComparer)}getInterfaces(t,n){const i=this.#r.get(t);if(!i?.interfaces?.length)return[];if(n?.length){const s=n.toLocaleLowerCase();return i.interfaces.filter(({name:a})=>a.toLocaleLowerCase().includes(s)).sort(objectNameComparer)}return i.interfaces.sort(objectNameComparer)}getPossibleTypes(t,n){const i=this.#r.get(t);if(!i?.types?.length)return[];if(n?.length){const s=n.toLocaleLowerCase();return i.types.map(getInnerType).filter(({name:a})=>a.toLocaleLowerCase().includes(s)).sort(objectNameComparer)}return i.types.map(getInnerType).sort(objectNameComparer)}getTypesByTypeKind(t,n){const i=[];if(n?.length){const s=n.toLocaleLowerCase();this.#r.forEach(a=>{a.typeKind===t&&!INTROSPECTION_PREFIX.test(a.name)&&a.name.toLocaleLowerCase().includes(s)&&i.push(a)})}else this.#r.forEach(s=>{s.typeKind===t&&!INTROSPECTION_PREFIX.test(s.name)&&i.push(s)});return i.sort(objectNameComparer)}dispose(){this.#e.clear(),this.#t.clear(),this.#r.clear()}addIntrospectionFields(t,n){const i=this.#r.get(t),s=i?.kind==="query-type",a=i?.kind==="subscription-type";if(s){const f=this.getIntrospectionSchemaField(i.name);f&&n.push(f);const l=this.getIntrospectionTypeField(i.name);l&&n.push(l)}if(!a&&i){const f=this.getIntrospectionTypenameField(i.name);f&&n.push(f)}}getIntrospectionSchemaField(t){const n=IntrospectionField.SCHEMA_FIELD;let i=this.#i.get(n);if(!i){const s=this.#r.get("__Schema");s&&(i={kind:"field",name:n,coordinate:createSchemaMemberCoordinate(t,n),valueType:{kind:"value-type",isList:!1,isOptional:!1,type:s}},this.#i.set(n,i))}return i}getIntrospectionTypeField(t){const n=IntrospectionField.TYPE_FIELD;let i=this.#i.get(n);if(!i){const s=this.#r.get("__Type"),a=this.#r.get("String");s&&a&&(i={kind:"field",name:n,coordinate:createSchemaMemberCoordinate(t,n),valueType:{kind:"value-type",isList:!1,isOptional:!0,type:s},arguments:[{kind:"argument",name:"name",coordinate:createSchemaMemberCoordinate(t,n,"name"),type:{kind:"value-type",isList:!1,isOptional:!1,type:a}}]},this.#i.set(n,i))}return i}getIntrospectionTypenameField(t){const n=IntrospectionField.TYPENAME_FIELD;let i=this.#i.get(n);if(i)i={...i,coordinate:createSchemaMemberCoordinate(t,IntrospectionField.TYPE_FIELD)};else{const s=this.#r.get("String");s&&(i={kind:"field",name:n,coordinate:createSchemaMemberCoordinate(t,n),valueType:{kind:"value-type",isList:!1,isOptional:!1,type:s}},this.#i.set(n,i))}return i}}const schemaCache=new SchemaCache;function setSchemaCacheItem(r,t){schemaCache.set(harmonizeSchemaUrl(r),t)}const LINE_BREAK="<br />",SPACE=" ";function printAsHTML(r){return visit(r,printDocASTReducer)}const printDocASTReducer={Name:{leave:r=>r.value},Argument:{leave:({name:r,value:t})=>wrapArgumentName(r)+wrapDelimiter(":")+SPACE+t},IntValue:{leave:({value:r})=>wrapNumberValue(r)},FloatValue:{leave:({value:r})=>wrapNumberValue(r)},StringValue:{leave:({value:r,block:t})=>wrapStringValue(t?printBlockString(r):printString(r))},BooleanValue:{leave:({value:r})=>wrapLiteral(r?"true":"false")},NullValue:{leave:()=>wrapLiteral("null")},EnumValue:{leave:({value:r})=>wrapEnumValue(r)},ListValue:{leave:({values:r})=>block(r,"[]")},ObjectValue:{leave:({fields:r})=>block(r,"{}")},ObjectField:{leave:({name:r,value:t})=>wrapKey(r)+wrapDelimiter(":")+SPACE+t},Directive:{leave:({name:r,arguments:t})=>r.startsWith("fusion__")?"":LINE_BREAK+indent(wrapDirectiveName("@"+r)+block(t,"()"))},NamedType:{leave:({name:r})=>wrapTypeName(r)},ListType:{leave:({type:r})=>wrapDelimiter("[")+r+wrapDelimiter("]")},NonNullType:{leave:({type:r})=>r+wrapDelimiter("!")},DirectiveDefinition:{leave:({name:r,arguments:t,directives:n})=>wrapKeyword("directive")+SPACE+wrapDirectiveName(r)+block(t,"()")+wrap(SPACE,join(n,SPACE))},ScalarTypeDefinition:{leave:({name:r,directives:t})=>join([wrapKeyword("scalar"),wrapTypeName(r),join(t,SPACE)],SPACE)},ObjectTypeDefinition:{leave:({name:r,interfaces:t,directives:n})=>join([wrapKeyword("type"),wrapTypeName(r),wrap(wrapKeyword("implements")+SPACE,join(t,LINE_BREAK+wrapDelimiter("&")+SPACE)),join(n,SPACE)],SPACE)},FieldDefinition:{leave:({name:r,arguments:t,type:n,directives:i})=>wrapFieldName(r)+block(t,"()")+wrapDelimiter(":")+SPACE+n+wrap(SPACE,join(i,SPACE))},InputValueDefinition:{leave:({name:r,type:t,defaultValue:n,directives:i})=>join([wrapArgumentName(r)+wrapDelimiter(":")+SPACE+t,wrap(wrapDelimiter("=")+SPACE,n),join(i,SPACE)],SPACE)},InterfaceTypeDefinition:{leave:({name:r,interfaces:t,directives:n})=>join([wrapKeyword("interface"),wrapTypeName(r),wrap(wrapKeyword("implements")+SPACE,join(t,`${LINE_BREAK}${wrapDelimiter("&")} `)),join(n,SPACE)],SPACE)},UnionTypeDefinition:{leave:({name:r,directives:t})=>join([wrapKeyword("union"),wrapTypeName(r),join(t,SPACE)],SPACE)},EnumTypeDefinition:{leave:({name:r,directives:t})=>join([wrapKeyword("enum"),wrapTypeName(r),join(t,SPACE)],SPACE)},EnumValueDefinition:{leave:({name:r,directives:t})=>join([wrapEnumValue(r),join(t,SPACE)],SPACE)},InputObjectTypeDefinition:{leave:({name:r,directives:t})=>join([wrapKeyword("input"),wrapTypeName(r),join(t,SPACE)],SPACE)}};function join(r,t=""){return r?.filter(n=>n).join(t)??""}function block(r,t){switch(t){case"{}":return wrap(wrapDelimiter("{")+LINE_BREAK,indent(join(r,LINE_BREAK)),LINE_BREAK+wrapDelimiter("}"));case"[]":return wrap(wrapDelimiter("[")+LINE_BREAK,indent(join(r,LINE_BREAK)),LINE_BREAK+wrapDelimiter("]"));case"()":return wrap(wrapDelimiter("(")+LINE_BREAK,indent(join(r,LINE_BREAK)),LINE_BREAK+wrapDelimiter(")"))}}function wrap(r,t,n=""){return t!=null&&t!==""?r+t+n:""}function indent(r){return wrap(SPACE+SPACE,r.replaceAll(LINE_BREAK,LINE_BREAK+SPACE+SPACE))}function wrapArgumentName(r){return`<span class="argument">${r}</span>`}function wrapDelimiter(r){return`<span class="delimiter">${r}</span>`}function wrapDirectiveName(r){return`<span class="directive">${r}</span>`}function wrapEnumValue(r){return`<span class="enum-value">${r}</span>`}function wrapFieldName(r){return`<span class="field">${r}</span>`}function wrapKey(r){return`<span class="key">${r}</span>`}function wrapKeyword(r){return`<span class="keyword">${r}</span>`}function wrapLiteral(r){return`<span class="literal">${r}</span>`}function wrapNumberValue(r){return`<span class="number">${r}</span>`}function wrapStringValue(r){return`<span class="string">${r}</span>`}function wrapTypeName(r){return`<span class="type">${r}</span>`}function buildSchemaInfosAndItems(r){const t=[],n=[],i=[],s=Object.values(r.getTypeMap()).filter(p=>!INTROSPECTION_PREFIX.test(p.name)&&!p.name.startsWith("fusion__")),a=r.getQueryType(),f=r.getMutationType(),l=r.getSubscriptionType(),d=(a?1:0)+(f?1:0)+(l?1:0),o=Object.values(r.getTypeMap()).find(p=>p.name==="fusion__Schema")?.getValues().reduce((p,c)=>{const v=c.astNode?.directives?.find(y=>y.name.value==="fusion__schema_metadata")?.arguments?.find(y=>y.name.value==="name")?.value;return p[c.name]=v?.kind===STRING?v.value:c.name,p},{});for(const p of s){const c=buildSchemaType(r,p,o);i.push([c.coordinate,c]);const v=buildSchemaFieldTypes(r,p,void 0,o);for(const y of v)n.push([y.coordinate,y])}for(const p of r.getDirectives()){if(p.name.startsWith("fusion__"))continue;const c=buildSchemaDirective(r,p);t.push([c.coordinate,c])}const u={queryCount:getCountForOperationType(a),mutationCount:getCountForOperationType(f),subscriptionCount:getCountForOperationType(l),directiveCount:t.length,enumCount:s.filter(p=>p instanceof GraphQLEnumType).length,fieldCount:n.length,inputObjectCount:s.filter(p=>p instanceof GraphQLInputObjectType).length,interfaceCount:s.filter(p=>p instanceof GraphQLInterfaceType).length,objectCount:s.filter(p=>p instanceof GraphQLObjectType).length,rootTypeCount:d,scalarCount:s.filter(p=>p instanceof GraphQLScalarType).length,typeCount:s.length,unionCount:s.filter(p=>p instanceof GraphQLUnionType).length};return{queryTypeName:a?.name,mutationTypeName:f?.name,subscriptionTypeName:l?.name,statistics:u,items:{directives:t,fields:n,types:i}}}function readSchemaDefaultValue(r){const t=r.default;if(t!==void 0)return t.literal?valueFromASTUntyped(t.literal):t.value}function getKind(r){return r instanceof GraphQLEnumType?"enum":r instanceof GraphQLInputObjectType?"input-object":r instanceof GraphQLInterfaceType?"interface":r instanceof GraphQLScalarType?"scalar":r instanceof GraphQLUnionType?"union":r instanceof GraphQLList||r instanceof GraphQLNonNull?getKind(r.ofType):"object"}function buildSchemaFieldType(r,t,n,i){if(t instanceof GraphQLInputObjectType){const s=t.getFields()[n];if(s)return{coordinate:createSchemaMemberCoordinate(t.name,s.name),name:s.name,kind:"field",description:s.description??void 0,valueType:buildSchemaValueType(r,s.type,i),defaultValue:readSchemaDefaultValue(s),isDeprecated:s.deprecationReason!=null,deprecationReason:s.deprecationReason??void 0,sdlAsHTML:s.astNode?printAsHTML(s.astNode):void 0,directives:buildConstDirective(s.astNode?.directives,i)}}else if(t instanceof GraphQLInterfaceType||t instanceof GraphQLObjectType){const s=t.getFields()[n];if(s){const a=s.args.length?s.args.map(f=>{const l=buildSchemaValueType(r,f.type,i);return{coordinate:createSchemaMemberCoordinate(t.name,s.name,f.name),name:f.name,kind:"argument",description:f.description??void 0,defaultValue:readSchemaDefaultValue(f),type:l,isDeprecated:f.deprecationReason!=null,deprecationReason:f.deprecationReason??void 0,sdlAsHTML:f.astNode?printAsHTML(f.astNode):void 0,directives:buildConstDirective(f.astNode?.directives,i)}}):void 0;return{coordinate:createSchemaMemberCoordinate(t.name,s.name),name:s.name,kind:"field",description:s.description??void 0,arguments:a,valueType:buildSchemaValueType(r,s.type,i),isDeprecated:s.deprecationReason!=null,deprecationReason:s.deprecationReason??void 0,sdlAsHTML:s.astNode?printAsHTML(s.astNode):void 0,directives:buildConstDirective(s.astNode?.directives,i)}}}}function buildSchemaFieldTypes(r,t,n,i){const s=[];if(t instanceof GraphQLInputObjectType){const a=t.getFields();for(const f in a){const l=a[f];s.push({coordinate:createSchemaMemberCoordinate(t.name,l.name),name:l.name,kind:"field",description:l.description??void 0,valueType:buildSchemaValueType(r,l.type,i),defaultValue:readSchemaDefaultValue(l),isDeprecated:l.deprecationReason!=null,deprecationReason:l.deprecationReason??void 0,sdlAsHTML:l.astNode?printAsHTML(l.astNode):void 0,directives:buildConstDirective(l.astNode?.directives,i)})}}else if(t instanceof GraphQLInterfaceType||t instanceof GraphQLObjectType){const a=t.getFields();for(const f in a){const l=a[f];{const d=l.args.length===0?void 0:l.args.map(o=>{const u=buildSchemaValueType(r,o.type,i);return{coordinate:createSchemaMemberCoordinate(t.name,l.name,o.name),name:o.name,kind:"argument",description:o.description??void 0,defaultValue:readSchemaDefaultValue(o),type:u,isDeprecated:o.deprecationReason!=null,deprecationReason:o.deprecationReason??void 0,sdlAsHTML:o.astNode?printAsHTML(o.astNode):void 0,directives:buildConstDirective(o.astNode?.directives,i)}});s.push({coordinate:createSchemaMemberCoordinate(t.name,l.name),name:l.name,kind:"field",description:l.description??void 0,arguments:d,valueType:buildSchemaValueType(r,l.type,i),isDeprecated:l.deprecationReason!=null,deprecationReason:l.deprecationReason??void 0,sdlAsHTML:l.astNode?printAsHTML(l.astNode):void 0,directives:buildConstDirective(l.astNode?.directives,i)})}}}return s.sort(objectNameComparer)}function buildSchemaDirective(r,t){const n=t.args.length?t.args.map(i=>{const s=buildSchemaValueType(r,i.type,void 0);return{coordinate:createSchemaDirectiveCoordinate(t.name,i.name),name:i.name,kind:"argument",description:i.description??void 0,defaultValue:readSchemaDefaultValue(i),type:s,isDeprecated:i.deprecationReason!=null,deprecationReason:i.deprecationReason??void 0,sdlAsHTML:i.astNode?printAsHTML(i.astNode):void 0}}):void 0;return{coordinate:createSchemaDirectiveCoordinate(t.name),name:t.name,kind:"directive",description:t.description??void 0,arguments:n,isDeprecated:t.deprecationReason!=null,deprecationReason:t.deprecationReason??void 0,sdlAsHTML:t.astNode?printAsHTML(t.astNode):void 0}}function buildSchemaType(r,t,n){let i,s,a,f=!1;return t instanceof GraphQLEnumType&&(i=t.getValues().map(l=>l).sort(objectNameComparer).map(l=>({coordinate:createSchemaMemberCoordinate(t.name,l.name),name:l.name,kind:"enum-value",description:l.description??void 0,value:l.value,isDeprecated:l.deprecationReason!=null,deprecationReason:l.deprecationReason??void 0,sdlAsHTML:l.astNode?printAsHTML(l.astNode):void 0,directives:buildConstDirective(l.astNode?.directives,n)}))),t instanceof GraphQLInterfaceType&&(f=isRelayInterface(r,t),a=r.getPossibleTypes(t).map(l=>l).sort(objectNameComparer).map(l=>buildSchemaValueType(r,l,n))),t instanceof GraphQLObjectType&&(f=isRelayObject(r,t),s=t.getInterfaces().map(l=>({coordinate:l.name,name:l.name,kind:"type",description:l.description??void 0,typeKind:"interface",isRelayType:isRelayObject(r,t),sdlAsHTML:l.astNode?printAsHTML(l.astNode):void 0,directives:buildConstDirective(l.astNode?.directives,n)}))),t instanceof GraphQLUnionType&&(a=t.getTypes().map(l=>l).sort(objectNameComparer).map(l=>buildSchemaValueType(r,l,n))),{coordinate:t.name,name:t.name,kind:t instanceof GraphQLObjectType?resolveObjectKind(r,t):"type",description:t.description??void 0,typeKind:getKind(t),enumValues:i,interfaces:s,isRelayType:f,types:a,sdlAsHTML:t.astNode?printAsHTML(t.astNode):void 0,directives:buildConstDirective(t.astNode?.directives,n)}}function buildConstDirective(r,t){return r?.map(({name:n,arguments:i})=>({name:n.value,arguments:i?.map(({name:s,value:a})=>({name:s.value,value:buildConstValue(a,t)}))}))}function buildConstValue(r,t){switch(r?.kind){case OBJECT:return r.fields.reduce((n,i)=>(n[i.name.value]=buildConstValue(i.value,t),n),{});case LIST:return r.values.map(n=>buildConstValue(n,t));case ENUM:return t?.[r.value]??r.value;case BOOLEAN:case FLOAT:case INT:case STRING:return r.value;default:return null}}function isRelayInterface(r,t){return t.name==="Node"&&!!buildSchemaFieldType(r,t,"id",void 0)}function isRelayObject(r,t){if(t.name.endsWith("Connection")){const n=buildSchemaFieldTypes(r,t,void 0,void 0).map(i=>i.name);return n.includes("edges")&&n.includes("pageInfo")}if(t.name.endsWith("Edge")){const n=buildSchemaFieldTypes(r,t,void 0,void 0).map(i=>i.name);return n.includes("cursor")&&n.includes("node")}if(t.name==="PageInfo"){const n=buildSchemaFieldTypes(r,t,void 0,void 0).map(i=>i.name);return n.includes("hasNextPage")&&n.includes("hasPreviousPage")&&n.includes("startCursor")&&n.includes("endCursor")}return!1}function buildSchemaValueType(r,t,n){let i,s=!1,a=!0,f;return t instanceof GraphQLNonNull?(a=!1,t.ofType instanceof GraphQLList?(i=t.ofType.ofType,s=!0):i=t.ofType):t instanceof GraphQLList?(i=t.ofType,s=!0):i=t,i instanceof GraphQLList||i instanceof GraphQLNonNull?f=buildSchemaValueType(r,i,n):f=buildSchemaType(r,i,n),{kind:"value-type",isList:s,isOptional:a,type:f}}function resolveObjectKind(r,t){switch(!0){case t===r.getQueryType():return"query-type";case t===r.getMutationType():return"mutation-type";case t===r.getSubscriptionType():return"subscription-type";default:return"type"}}function getCountForOperationType(r){return r?Object.keys(r.getFields()).length:0}const runningTasks=new Map;function cancelTask(r){runningTasks.get(r)?.cancel()}function enqueueTask(r){runningTasks.has(r.id)||(runningTasks.set(r.id,r),SCHEDULER_CONTEXT.sendMessage(new Message("scheduler-status-updated",{idling:!1,lastUpdated:now()})),deferWork(()=>{r.execute().catch(t=>{t instanceof TaskFailedError?failTask(SCHEDULER_CONTEXT,r.id,t.message,t.kind,t.details):t instanceof Error?failTask(SCHEDULER_CONTEXT,r.id,t.message,"UNEXPECTED_ERROR"):failTask(SCHEDULER_CONTEXT,r.id,"There was a unexpected error in the task","UNEXPECTED_ERROR")}).finally(()=>{runningTasks.delete(r.id),SCHEDULER_CONTEXT.sendMessage(new Message("scheduler-status-updated",{idling:runningTasks.size===0,lastUpdated:now()}))})}))}function deferWork(r){self.setTimeout(r,0)}const SCHEDULER_CONTEXT={sendMessage:r=>self.postMessage(r)};class SchedulerBase extends MessageObserver{#e={sendMessage:t=>self.postMessage(t)};constructor(){super(),this.initialize()}getContext(){return this.#e}initialize(){self.onmessage=({data:t})=>{this.handleMessage(this.#e,t)},this.registerReceiveMessageHandler(CANCEL_TASK_MESSAGE_TYPE,t=>{cancelTask(t.payload.taskId)}),this.registerReceiveMessageHandler(INITIALIZE_WORKER_MESSAGE_TYPE,t=>{self.appNamespace=t.payload.appNamespace}),this.registerMessageReceiveHandlers()}}const INDEX_SCHEMA_MESSAGE_TYPE="index-schema",SCHEMA_INDEXED_MESSAGE_TYPE="schema-indexed",runningIndexingJobs=new Map;function indexSchema({id:r,payload:{schemaEndpoint:t,schemaHash:n,schemaUpdatedAt:i}},s){const a=runningIndexingJobs.get(t);if(a){if(a.schemaHash===n||a.schemaUpdatedAt>i)return;cancelTask(a.taskId)}runningIndexingJobs.set(t,{taskId:r,schemaHash:n,schemaUpdatedAt:i});const f=new AbortController;enqueueTask({id:r,cancel:()=>f.abort(),execute:async()=>{const[l,d]=await Promise.all([getGraphQLSchemaEntity(t),getGraphQLSdlSchema(t)]);if(!l||!d||l.indexed||f.signal.aborted){s.sendMessage(new Message(SCHEMA_INDEXED_MESSAGE_TYPE,{schemaEndpoint:l?.endpoint??t,schemaHash:l?.hash??"",schemaIndexed:l?.indexed??!1}));return}let o=!1;try{const{statistics:u,items:p}=buildSchemaInfosAndItems(buildSchema(d));setSchemaCacheItem(l.endpoint,p),await setIndexedGraphQLSchemaEntity(l.endpoint,l.hash,p,u),o=!0}finally{s.sendMessage(new Message(SCHEMA_INDEXED_MESSAGE_TYPE,{schemaEndpoint:l.endpoint,schemaHash:l.hash,schemaIndexed:o}))}}})}class GraphQLIndexerScheduler extends SchedulerBase{registerMessageReceiveHandlers(){this.registerReceiveMessageHandler(INDEX_SCHEMA_MESSAGE_TYPE,indexSchema)}}new GraphQLIndexerScheduler;
270
+ `,_gql_doc={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"IntrospectionQuery"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"__type"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"StringValue",value:"__Type",block:!1}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"fields"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}}]}}]}}]}}],loc:{start:0,end:137,source:{name:"GraphQL request",locationOffset:{line:1,column:1},body:_gql_source}}};print(_gql_doc$4);print(_gql_doc$3);print(_gql_doc$2);print(_gql_doc$1);print(_gql_doc);class SchemaCache{#e=new LRUMap;get(t){return this.#e.get(t)??null}set(t,n){const i=new SchemaCacheItem(n);return this.#e.get(t)?.dispose(),this.#e.set(t,i),i}remove(t){this.#e.get(t)?.dispose(),this.#e.delete(t)}}class SchemaCacheItem{#e;#t;#r;#i;constructor(t){this.#e=new Map(t.directives),this.#t=new Map(t.fields),this.#r=new Map(t.types),this.#i=new Map(t.fields)}getDirective(t){return this.#e.get(t)??null}getDirectives(t){const n=[];if(t?.length){const i=t.toLocaleLowerCase();this.#e.forEach(s=>{!INTROSPECTION_PREFIX.test(s.name)&&s.name.toLocaleLowerCase().includes(i)&&n.push(s)})}else this.#e.forEach(i=>{INTROSPECTION_PREFIX.test(i.name)||n.push(i)});return n.sort(objectNameComparer)}getField(t){return this.#t.get(t)??null}getFields(t,n){const i=t+".",s=[];if(n?.includeIntrospectionFields&&this.addIntrospectionFields(t,s),n?.filter?.length){const a=n.filter.toLocaleLowerCase();this.#t.forEach(f=>{f.coordinate.startsWith(i)&&f.name.toLocaleLowerCase().includes(a)&&s.push(f)})}else this.#t.forEach(a=>{a.coordinate.startsWith(i)&&s.push(a)});return s.sort(objectNameComparer)}getType(t){return this.#r.get(t)??null}getTypes(t){const n=[];if(t?.length){const i=t.toLocaleLowerCase();this.#r.forEach(s=>{!INTROSPECTION_PREFIX.test(s.name)&&s.name.toLocaleLowerCase().includes(i)&&n.push(s)})}else this.#r.forEach(i=>{INTROSPECTION_PREFIX.test(i.name)||n.push(i)});return n.sort(objectNameComparer)}getInterfaces(t,n){const i=this.#r.get(t);if(!i?.interfaces?.length)return[];if(n?.length){const s=n.toLocaleLowerCase();return i.interfaces.filter(({name:a})=>a.toLocaleLowerCase().includes(s)).sort(objectNameComparer)}return i.interfaces.sort(objectNameComparer)}getPossibleTypes(t,n){const i=this.#r.get(t);if(!i?.types?.length)return[];if(n?.length){const s=n.toLocaleLowerCase();return i.types.map(getInnerType).filter(({name:a})=>a.toLocaleLowerCase().includes(s)).sort(objectNameComparer)}return i.types.map(getInnerType).sort(objectNameComparer)}getTypesByTypeKind(t,n){const i=[];if(n?.length){const s=n.toLocaleLowerCase();this.#r.forEach(a=>{a.typeKind===t&&!INTROSPECTION_PREFIX.test(a.name)&&a.name.toLocaleLowerCase().includes(s)&&i.push(a)})}else this.#r.forEach(s=>{s.typeKind===t&&!INTROSPECTION_PREFIX.test(s.name)&&i.push(s)});return i.sort(objectNameComparer)}dispose(){this.#e.clear(),this.#t.clear(),this.#r.clear()}addIntrospectionFields(t,n){const i=this.#r.get(t),s=i?.kind==="query-type",a=i?.kind==="subscription-type";if(s){const f=this.getIntrospectionSchemaField(i.name);f&&n.push(f);const l=this.getIntrospectionTypeField(i.name);l&&n.push(l)}if(!a&&i){const f=this.getIntrospectionTypenameField(i.name);f&&n.push(f)}}getIntrospectionSchemaField(t){const n=IntrospectionField.SCHEMA_FIELD;let i=this.#i.get(n);if(!i){const s=this.#r.get("__Schema");s&&(i={kind:"field",name:n,coordinate:createSchemaMemberCoordinate(t,n),valueType:{kind:"value-type",isList:!1,isOptional:!1,type:s}},this.#i.set(n,i))}return i}getIntrospectionTypeField(t){const n=IntrospectionField.TYPE_FIELD;let i=this.#i.get(n);if(!i){const s=this.#r.get("__Type"),a=this.#r.get("String");s&&a&&(i={kind:"field",name:n,coordinate:createSchemaMemberCoordinate(t,n),valueType:{kind:"value-type",isList:!1,isOptional:!0,type:s},arguments:[{kind:"argument",name:"name",coordinate:createSchemaMemberCoordinate(t,n,"name"),type:{kind:"value-type",isList:!1,isOptional:!1,type:a}}]},this.#i.set(n,i))}return i}getIntrospectionTypenameField(t){const n=IntrospectionField.TYPENAME_FIELD;let i=this.#i.get(n);if(i)i={...i,coordinate:createSchemaMemberCoordinate(t,IntrospectionField.TYPE_FIELD)};else{const s=this.#r.get("String");s&&(i={kind:"field",name:n,coordinate:createSchemaMemberCoordinate(t,n),valueType:{kind:"value-type",isList:!1,isOptional:!1,type:s}},this.#i.set(n,i))}return i}}const schemaCache=new SchemaCache;function setSchemaCacheItem(r,t){schemaCache.set(harmonizeSchemaUrl(r),t)}const LINE_BREAK="<br />",SPACE=" ";function printAsHTML(r){return visit(r,printDocASTReducer)}const printDocASTReducer={Name:{leave:r=>r.value},Argument:{leave:({name:r,value:t})=>wrapArgumentName(r)+wrapDelimiter(":")+SPACE+t},IntValue:{leave:({value:r})=>wrapNumberValue(r)},FloatValue:{leave:({value:r})=>wrapNumberValue(r)},StringValue:{leave:({value:r,block:t})=>wrapStringValue(t?printBlockString(r):printString(r))},BooleanValue:{leave:({value:r})=>wrapLiteral(r?"true":"false")},NullValue:{leave:()=>wrapLiteral("null")},EnumValue:{leave:({value:r})=>wrapEnumValue(r)},ListValue:{leave:({values:r})=>block(r,"[]")},ObjectValue:{leave:({fields:r})=>block(r,"{}")},ObjectField:{leave:({name:r,value:t})=>wrapKey(r)+wrapDelimiter(":")+SPACE+t},Directive:{leave:({name:r,arguments:t})=>r.startsWith("fusion__")?"":LINE_BREAK+indent(wrapDirectiveName("@"+r)+block(t,"()"))},NamedType:{leave:({name:r})=>wrapTypeName(r)},ListType:{leave:({type:r})=>wrapDelimiter("[")+r+wrapDelimiter("]")},NonNullType:{leave:({type:r})=>r+wrapDelimiter("!")},DirectiveDefinition:{leave:({name:r,arguments:t,directives:n,repeatable:i,locations:s})=>wrapKeyword("directive")+SPACE+wrapDirectiveName("@"+r)+block(t,"()")+wrap(SPACE,join(n,SPACE))+(i?SPACE+wrapKeyword("repeatable"):"")+SPACE+wrapKeyword("on")+SPACE+join(s.map(wrapEnumValue),SPACE+wrapDelimiter("|")+SPACE)},ScalarTypeDefinition:{leave:({name:r,directives:t})=>join([wrapKeyword("scalar"),wrapTypeName(r),join(t,SPACE)],SPACE)},ObjectTypeDefinition:{leave:({name:r,interfaces:t,directives:n})=>join([wrapKeyword("type"),wrapTypeName(r),wrap(wrapKeyword("implements")+SPACE,join(t,LINE_BREAK+wrapDelimiter("&")+SPACE)),join(n,SPACE)],SPACE)},FieldDefinition:{leave:({name:r,arguments:t,type:n,directives:i})=>wrapFieldName(r)+block(t,"()")+wrapDelimiter(":")+SPACE+n+wrap(SPACE,join(i,SPACE))},InputValueDefinition:{leave:({name:r,type:t,defaultValue:n,directives:i})=>join([wrapArgumentName(r)+wrapDelimiter(":")+SPACE+t,wrap(wrapDelimiter("=")+SPACE,n),join(i,SPACE)],SPACE)},InterfaceTypeDefinition:{leave:({name:r,interfaces:t,directives:n})=>join([wrapKeyword("interface"),wrapTypeName(r),wrap(wrapKeyword("implements")+SPACE,join(t,`${LINE_BREAK}${wrapDelimiter("&")} `)),join(n,SPACE)],SPACE)},UnionTypeDefinition:{leave:({name:r,directives:t})=>join([wrapKeyword("union"),wrapTypeName(r),join(t,SPACE)],SPACE)},EnumTypeDefinition:{leave:({name:r,directives:t})=>join([wrapKeyword("enum"),wrapTypeName(r),join(t,SPACE)],SPACE)},EnumValueDefinition:{leave:({name:r,directives:t})=>join([wrapEnumValue(r),join(t,SPACE)],SPACE)},InputObjectTypeDefinition:{leave:({name:r,directives:t})=>join([wrapKeyword("input"),wrapTypeName(r),join(t,SPACE)],SPACE)}};function join(r,t=""){return r?.filter(n=>n).join(t)??""}function block(r,t){switch(t){case"{}":return wrap(wrapDelimiter("{")+LINE_BREAK,indent(join(r,LINE_BREAK)),LINE_BREAK+wrapDelimiter("}"));case"[]":return wrap(wrapDelimiter("[")+LINE_BREAK,indent(join(r,LINE_BREAK)),LINE_BREAK+wrapDelimiter("]"));case"()":return wrap(wrapDelimiter("(")+LINE_BREAK,indent(join(r,LINE_BREAK)),LINE_BREAK+wrapDelimiter(")"))}}function wrap(r,t,n=""){return t!=null&&t!==""?r+t+n:""}function indent(r){return wrap(SPACE+SPACE,r.replaceAll(LINE_BREAK,LINE_BREAK+SPACE+SPACE))}function wrapArgumentName(r){return`<span class="argument">${r}</span>`}function wrapDelimiter(r){return`<span class="delimiter">${r}</span>`}function wrapDirectiveName(r){return`<span class="directive">${r}</span>`}function wrapEnumValue(r){return`<span class="enum-value">${r}</span>`}function wrapFieldName(r){return`<span class="field">${r}</span>`}function wrapKey(r){return`<span class="key">${r}</span>`}function wrapKeyword(r){return`<span class="keyword">${r}</span>`}function wrapLiteral(r){return`<span class="literal">${r}</span>`}function wrapNumberValue(r){return`<span class="number">${r}</span>`}function wrapStringValue(r){return`<span class="string">${r}</span>`}function wrapTypeName(r){return`<span class="type">${r}</span>`}function buildSchemaInfosAndItems(r){const t=[],n=[],i=[],s=Object.values(r.getTypeMap()).filter(p=>!INTROSPECTION_PREFIX.test(p.name)&&!p.name.startsWith("fusion__")),a=r.getQueryType(),f=r.getMutationType(),l=r.getSubscriptionType(),d=(a?1:0)+(f?1:0)+(l?1:0),o=Object.values(r.getTypeMap()).find(p=>p.name==="fusion__Schema")?.getValues().reduce((p,c)=>{const v=c.astNode?.directives?.find(y=>y.name.value==="fusion__schema_metadata")?.arguments?.find(y=>y.name.value==="name")?.value;return p[c.name]=v?.kind===STRING?v.value:c.name,p},{});for(const p of s){const c=buildSchemaType(r,p,o);i.push([c.coordinate,c]);const v=buildSchemaFieldTypes(r,p,void 0,o);for(const y of v)n.push([y.coordinate,y])}for(const p of r.getDirectives()){if(p.name.startsWith("fusion__"))continue;const c=buildSchemaDirective(r,p,o);t.push([c.coordinate,c])}const u={queryCount:getCountForOperationType(a),mutationCount:getCountForOperationType(f),subscriptionCount:getCountForOperationType(l),directiveCount:t.length,enumCount:s.filter(p=>p instanceof GraphQLEnumType).length,fieldCount:n.length,inputObjectCount:s.filter(p=>p instanceof GraphQLInputObjectType).length,interfaceCount:s.filter(p=>p instanceof GraphQLInterfaceType).length,objectCount:s.filter(p=>p instanceof GraphQLObjectType).length,rootTypeCount:d,scalarCount:s.filter(p=>p instanceof GraphQLScalarType).length,typeCount:s.length,unionCount:s.filter(p=>p instanceof GraphQLUnionType).length};return{queryTypeName:a?.name,mutationTypeName:f?.name,subscriptionTypeName:l?.name,statistics:u,items:{directives:t,fields:n,types:i}}}function readSchemaDefaultValue(r){const t=r.default;if(t!==void 0)return t.literal?valueFromASTUntyped(t.literal):t.value}function getKind(r){return r instanceof GraphQLEnumType?"enum":r instanceof GraphQLInputObjectType?"input-object":r instanceof GraphQLInterfaceType?"interface":r instanceof GraphQLScalarType?"scalar":r instanceof GraphQLUnionType?"union":r instanceof GraphQLList||r instanceof GraphQLNonNull?getKind(r.ofType):"object"}function buildSchemaFieldType(r,t,n,i){if(t instanceof GraphQLInputObjectType){const s=t.getFields()[n];if(s)return{coordinate:createSchemaMemberCoordinate(t.name,s.name),name:s.name,kind:"field",description:s.description??void 0,valueType:buildSchemaValueType(r,s.type,i),defaultValue:readSchemaDefaultValue(s),isDeprecated:s.deprecationReason!=null,deprecationReason:s.deprecationReason??void 0,sdlAsHTML:s.astNode?printAsHTML(s.astNode):void 0,directives:buildConstDirective(s.astNode?.directives,i)}}else if(t instanceof GraphQLInterfaceType||t instanceof GraphQLObjectType){const s=t.getFields()[n];if(s){const a=s.args.length?s.args.map(f=>{const l=buildSchemaValueType(r,f.type,i);return{coordinate:createSchemaMemberCoordinate(t.name,s.name,f.name),name:f.name,kind:"argument",description:f.description??void 0,defaultValue:readSchemaDefaultValue(f),type:l,isDeprecated:f.deprecationReason!=null,deprecationReason:f.deprecationReason??void 0,sdlAsHTML:f.astNode?printAsHTML(f.astNode):void 0,directives:buildConstDirective(f.astNode?.directives,i)}}):void 0;return{coordinate:createSchemaMemberCoordinate(t.name,s.name),name:s.name,kind:"field",description:s.description??void 0,arguments:a,valueType:buildSchemaValueType(r,s.type,i),isDeprecated:s.deprecationReason!=null,deprecationReason:s.deprecationReason??void 0,sdlAsHTML:s.astNode?printAsHTML(s.astNode):void 0,directives:buildConstDirective(s.astNode?.directives,i)}}}}function buildSchemaFieldTypes(r,t,n,i){const s=[];if(t instanceof GraphQLInputObjectType){const a=t.getFields();for(const f in a){const l=a[f];s.push({coordinate:createSchemaMemberCoordinate(t.name,l.name),name:l.name,kind:"field",description:l.description??void 0,valueType:buildSchemaValueType(r,l.type,i),defaultValue:readSchemaDefaultValue(l),isDeprecated:l.deprecationReason!=null,deprecationReason:l.deprecationReason??void 0,sdlAsHTML:l.astNode?printAsHTML(l.astNode):void 0,directives:buildConstDirective(l.astNode?.directives,i)})}}else if(t instanceof GraphQLInterfaceType||t instanceof GraphQLObjectType){const a=t.getFields();for(const f in a){const l=a[f];{const d=l.args.length===0?void 0:l.args.map(o=>{const u=buildSchemaValueType(r,o.type,i);return{coordinate:createSchemaMemberCoordinate(t.name,l.name,o.name),name:o.name,kind:"argument",description:o.description??void 0,defaultValue:readSchemaDefaultValue(o),type:u,isDeprecated:o.deprecationReason!=null,deprecationReason:o.deprecationReason??void 0,sdlAsHTML:o.astNode?printAsHTML(o.astNode):void 0,directives:buildConstDirective(o.astNode?.directives,i)}});s.push({coordinate:createSchemaMemberCoordinate(t.name,l.name),name:l.name,kind:"field",description:l.description??void 0,arguments:d,valueType:buildSchemaValueType(r,l.type,i),isDeprecated:l.deprecationReason!=null,deprecationReason:l.deprecationReason??void 0,sdlAsHTML:l.astNode?printAsHTML(l.astNode):void 0,directives:buildConstDirective(l.astNode?.directives,i)})}}}return s.sort(objectNameComparer)}function buildSchemaDirective(r,t,n){const i=t.args.length?t.args.map(s=>{const a=buildSchemaValueType(r,s.type,n);return{coordinate:createSchemaDirectiveCoordinate(t.name,s.name),name:s.name,kind:"argument",description:s.description??void 0,defaultValue:readSchemaDefaultValue(s),type:a,isDeprecated:s.deprecationReason!=null,deprecationReason:s.deprecationReason??void 0,sdlAsHTML:s.astNode?printAsHTML(s.astNode):void 0,directives:buildConstDirective(s.astNode?.directives,n)}}):void 0;return{coordinate:createSchemaDirectiveCoordinate(t.name),name:t.name,kind:"directive",description:t.description??void 0,arguments:i,isDeprecated:t.deprecationReason!=null,deprecationReason:t.deprecationReason??void 0,sdlAsHTML:t.astNode?printAsHTML(t.astNode):void 0,directives:buildConstDirective(t.astNode?.directives,n)}}function buildSchemaType(r,t,n){let i,s,a,f=!1;return t instanceof GraphQLEnumType&&(i=t.getValues().map(l=>l).sort(objectNameComparer).map(l=>({coordinate:createSchemaMemberCoordinate(t.name,l.name),name:l.name,kind:"enum-value",description:l.description??void 0,value:l.value,isDeprecated:l.deprecationReason!=null,deprecationReason:l.deprecationReason??void 0,sdlAsHTML:l.astNode?printAsHTML(l.astNode):void 0,directives:buildConstDirective(l.astNode?.directives,n)}))),t instanceof GraphQLInterfaceType&&(f=isRelayInterface(r,t),a=r.getPossibleTypes(t).map(l=>l).sort(objectNameComparer).map(l=>buildSchemaValueType(r,l,n))),t instanceof GraphQLObjectType&&(f=isRelayObject(r,t),s=t.getInterfaces().map(l=>({coordinate:l.name,name:l.name,kind:"type",description:l.description??void 0,typeKind:"interface",isRelayType:isRelayObject(r,t),sdlAsHTML:l.astNode?printAsHTML(l.astNode):void 0,directives:buildConstDirective(l.astNode?.directives,n)}))),t instanceof GraphQLUnionType&&(a=t.getTypes().map(l=>l).sort(objectNameComparer).map(l=>buildSchemaValueType(r,l,n))),{coordinate:t.name,name:t.name,kind:t instanceof GraphQLObjectType?resolveObjectKind(r,t):"type",description:t.description??void 0,typeKind:getKind(t),enumValues:i,interfaces:s,isRelayType:f,types:a,sdlAsHTML:t.astNode?printAsHTML(t.astNode):void 0,directives:buildConstDirective(t.astNode?.directives,n)}}function buildConstDirective(r,t){return r?.map(({name:n,arguments:i})=>({name:n.value,arguments:i?.map(({name:s,value:a})=>({name:s.value,value:buildConstValue(a,t)}))}))}function buildConstValue(r,t){switch(r?.kind){case OBJECT:return r.fields.reduce((n,i)=>(n[i.name.value]=buildConstValue(i.value,t),n),{});case LIST:return r.values.map(n=>buildConstValue(n,t));case ENUM:return t?.[r.value]??r.value;case BOOLEAN:case FLOAT:case INT:case STRING:return r.value;default:return null}}function isRelayInterface(r,t){return t.name==="Node"&&!!buildSchemaFieldType(r,t,"id",void 0)}function isRelayObject(r,t){if(t.name.endsWith("Connection")){const n=buildSchemaFieldTypes(r,t,void 0,void 0).map(i=>i.name);return n.includes("edges")&&n.includes("pageInfo")}if(t.name.endsWith("Edge")){const n=buildSchemaFieldTypes(r,t,void 0,void 0).map(i=>i.name);return n.includes("cursor")&&n.includes("node")}if(t.name==="PageInfo"){const n=buildSchemaFieldTypes(r,t,void 0,void 0).map(i=>i.name);return n.includes("hasNextPage")&&n.includes("hasPreviousPage")&&n.includes("startCursor")&&n.includes("endCursor")}return!1}function buildSchemaValueType(r,t,n){let i,s=!1,a=!0,f;return t instanceof GraphQLNonNull?(a=!1,t.ofType instanceof GraphQLList?(i=t.ofType.ofType,s=!0):i=t.ofType):t instanceof GraphQLList?(i=t.ofType,s=!0):i=t,i instanceof GraphQLList||i instanceof GraphQLNonNull?f=buildSchemaValueType(r,i,n):f=buildSchemaType(r,i,n),{kind:"value-type",isList:s,isOptional:a,type:f}}function resolveObjectKind(r,t){switch(!0){case t===r.getQueryType():return"query-type";case t===r.getMutationType():return"mutation-type";case t===r.getSubscriptionType():return"subscription-type";default:return"type"}}function getCountForOperationType(r){return r?Object.keys(r.getFields()).length:0}const runningTasks=new Map;function cancelTask(r){runningTasks.get(r)?.cancel()}function enqueueTask(r){runningTasks.has(r.id)||(runningTasks.set(r.id,r),SCHEDULER_CONTEXT.sendMessage(new Message("scheduler-status-updated",{idling:!1,lastUpdated:now()})),deferWork(()=>{r.execute().catch(t=>{t instanceof TaskFailedError?failTask(SCHEDULER_CONTEXT,r.id,t.message,t.kind,t.details):t instanceof Error?failTask(SCHEDULER_CONTEXT,r.id,t.message,"UNEXPECTED_ERROR"):failTask(SCHEDULER_CONTEXT,r.id,"There was a unexpected error in the task","UNEXPECTED_ERROR")}).finally(()=>{runningTasks.delete(r.id),SCHEDULER_CONTEXT.sendMessage(new Message("scheduler-status-updated",{idling:runningTasks.size===0,lastUpdated:now()}))})}))}function deferWork(r){self.setTimeout(r,0)}const SCHEDULER_CONTEXT={sendMessage:r=>self.postMessage(r)};class SchedulerBase extends MessageObserver{#e={sendMessage:t=>self.postMessage(t)};constructor(){super(),this.initialize()}getContext(){return this.#e}initialize(){self.onmessage=({data:t})=>{this.handleMessage(this.#e,t)},this.registerReceiveMessageHandler(CANCEL_TASK_MESSAGE_TYPE,t=>{cancelTask(t.payload.taskId)}),this.registerReceiveMessageHandler(INITIALIZE_WORKER_MESSAGE_TYPE,t=>{self.appNamespace=t.payload.appNamespace}),this.registerMessageReceiveHandlers()}}const INDEX_SCHEMA_MESSAGE_TYPE="index-schema",SCHEMA_INDEXED_MESSAGE_TYPE="schema-indexed",runningIndexingJobs=new Map;function indexSchema({id:r,payload:{schemaEndpoint:t,schemaHash:n,schemaUpdatedAt:i}},s){const a=runningIndexingJobs.get(t);if(a){if(a.schemaHash===n||a.schemaUpdatedAt>i)return;cancelTask(a.taskId)}runningIndexingJobs.set(t,{taskId:r,schemaHash:n,schemaUpdatedAt:i});const f=new AbortController;enqueueTask({id:r,cancel:()=>f.abort(),execute:async()=>{const[l,d]=await Promise.all([getGraphQLSchemaEntity(t),getGraphQLSdlSchema(t)]);if(!l||!d||l.indexed||f.signal.aborted){s.sendMessage(new Message(SCHEMA_INDEXED_MESSAGE_TYPE,{schemaEndpoint:l?.endpoint??t,schemaHash:l?.hash??"",schemaIndexed:l?.indexed??!1}));return}let o=!1;try{const{statistics:u,items:p}=buildSchemaInfosAndItems(buildSchema(d));setSchemaCacheItem(l.endpoint,p),await setIndexedGraphQLSchemaEntity(l.endpoint,l.hash,p,u),o=!0}finally{s.sendMessage(new Message(SCHEMA_INDEXED_MESSAGE_TYPE,{schemaEndpoint:l.endpoint,schemaHash:l.hash,schemaIndexed:o}))}}})}class GraphQLIndexerScheduler extends SchedulerBase{registerMessageReceiveHandlers(){this.registerReceiveMessageHandler(INDEX_SCHEMA_MESSAGE_TYPE,indexSchema)}}new GraphQLIndexerScheduler;