UNPKG

altair-static

Version:

Static package for altair graphql client

7 lines (4 loc) 19.8 kB
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="212f5285-7f40-5dad-a15c-6bb47e104882")}catch(e){}}(); import{i as ae,k as he}from"./chunk-RU5GXIYR.js";import{Fa as oe,Ha as Ae}from"./chunk-K6UUAPPR.js";import"./chunk-ZYOLZTH5.js";import{a as _,b as Q,j as ce}from"./chunk-B7YGBANW.js";function S(n){return Array.isArray?Array.isArray(n):Me(n)==="[object Array]"}var be=1/0;function we(n){if(typeof n=="string")return n;let e=n+"";return e=="0"&&1/n==-be?"-0":e}function Le(n){return n==null?"":we(n)}function E(n){return typeof n=="string"}function me(n){return typeof n=="number"}function Re(n){return n===!0||n===!1||Oe(n)&&Me(n)=="[object Boolean]"}function ye(n){return typeof n=="object"}function Oe(n){return ye(n)&&n!==null}function y(n){return n!=null}function H(n){return!n.trim().length}function Me(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}var ke="Incorrect 'index' type",$e=n=>`Invalid value for key ${n}`,Ne=n=>`Pattern length exceeds max of ${n}.`,Ce=n=>`Missing ${n} property in key`,Fe=n=>`Property 'weight' in key '${n}' must be a positive integer`,le=Object.prototype.hasOwnProperty,V=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(s=>{let r=Ie(s);t+=r.weight,this._keys.push(r),this._keyMap[r.id]=r,t+=r.weight}),this._keys.forEach(s=>{s.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function Ie(n){let e=null,t=null,s=null,r=1;if(E(n)||S(n))s=n,e=ue(n),t=z(n);else{if(!le.call(n,"name"))throw new Error(Ce("name"));let i=n.name;if(s=i,le.call(n,"weight")&&(r=n.weight,r<=0))throw new Error(Fe(i));e=ue(i),t=z(i)}return{path:e,id:t,weight:r,src:s}}function ue(n){return S(n)?n:n.split(".")}function z(n){return S(n)?n.join("."):n}function ve(n,e){let t=[],s=!1,r=(i,c,h)=>{if(y(i))if(!c[h])t.push(i);else{let a=c[h],o=i[a];if(!y(o))return;if(h===c.length-1&&(E(o)||me(o)||Re(o)))t.push(Le(o));else if(S(o)){s=!0;for(let l=0,u=o.length;l<u;l+=1)r(o[l],c,h+1)}else c.length&&r(o,c,h+1)}};return r(n,E(e)?e.split("."):e,0),s?t:t[0]}var je={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},De={isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(n,e)=>n.score===e.score?n.idx<e.idx?-1:1:n.score<e.score?-1:1},Pe={location:0,threshold:.6,distance:100},Be={useExtendedSearch:!1,getFn:ve,ignoreLocation:!1,ignoreFieldNorm:!1},d=_(_(_(_({},De),je),Pe),Be),Ke=/[^ ]+/g;function Qe(n=3){let e=new Map,t=Math.pow(10,n);return{get(s){let r=s.match(Ke).length;if(e.has(r))return e.get(r);let i=1/Math.sqrt(r),c=parseFloat(Math.round(i*t)/t);return e.set(r,c),c},clear(){e.clear()}}}var $=class{constructor({getFn:e=d.getFn}={}){this.norm=Qe(3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((t,s)=>{this._keysMap[t.id]=s})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,E(this.docs[0])?this.docs.forEach((e,t)=>{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){let t=this.size();E(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,s=this.size();t<s;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!y(e)||H(e))return;let s={v:e,i:t,n:this.norm.get(e)};this.records.push(s)}_addObject(e,t){let s={i:t,$:{}};this.keys.forEach((r,i)=>{let c=this.getFn(e,r.path);if(y(c)){if(S(c)){let h=[],a=[{nestedArrIndex:-1,value:c}];for(;a.length;){let{nestedArrIndex:o,value:l}=a.pop();if(y(l))if(E(l)&&!H(l)){let u={v:l,i:o,n:this.norm.get(l)};h.push(u)}else S(l)&&l.forEach((u,f)=>{a.push({nestedArrIndex:f,value:u})})}s.$[i]=h}else if(!H(c)){let h={v:c,n:this.norm.get(c)};s.$[i]=h}}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}};function fe(n,e,{getFn:t=d.getFn}={}){let s=new $({getFn:t});return s.setKeys(n.map(Ie)),s.setSources(e),s.create(),s}function He(n,{getFn:e=d.getFn}={}){let{keys:t,records:s}=n,r=new $({getFn:e});return r.setKeys(t),r.setIndexRecords(s),r}function v(n,{errors:e=0,currentLocation:t=0,expectedLocation:s=0,distance:r=d.distance,ignoreLocation:i=d.ignoreLocation}={}){let c=e/n.length;if(i)return c;let h=Math.abs(s-t);return r?c+h/r:h?1:c}function Ve(n=[],e=d.minMatchCharLength){let t=[],s=-1,r=-1,i=0;for(let c=n.length;i<c;i+=1){let h=n[i];h&&s===-1?s=i:!h&&s!==-1&&(r=i-1,r-s+1>=e&&t.push([s,r]),s=-1)}return n[i-1]&&i-s>=e&&t.push([s,i-1]),t}var R=32;function ze(n,e,t,{location:s=d.location,distance:r=d.distance,threshold:i=d.threshold,findAllMatches:c=d.findAllMatches,minMatchCharLength:h=d.minMatchCharLength,includeMatches:a=d.includeMatches,ignoreLocation:o=d.ignoreLocation}={}){if(e.length>R)throw new Error(Ne(R));let l=e.length,u=n.length,f=Math.max(0,Math.min(s,u)),g=i,p=f,m=h>1||a,w=m?Array(u):[],x;for(;(x=n.indexOf(e,p))>-1;){let M=v(e,{currentLocation:x,expectedLocation:f,distance:r,ignoreLocation:o});if(g=Math.min(M,g),p=x+l,m){let A=0;for(;A<l;)w[x+A]=1,A+=1}}p=-1;let O=[],L=1,C=l+u,Se=1<<l-1;for(let M=0;M<l;M+=1){let A=0,b=C;for(;A<b;)v(e,{errors:M,currentLocation:f+b,expectedLocation:f,distance:r,ignoreLocation:o})<=g?A=b:C=b,b=Math.floor((C-A)/2+A);C=b;let re=Math.max(1,f-b+1),K=c?u:Math.min(f+b,u)+l,k=Array(K+2);k[K+1]=(1<<M)-1;for(let I=K;I>=re;I-=1){let F=I-1,ie=t[n.charAt(F)];if(m&&(w[F]=+!!ie),k[I]=(k[I+1]<<1|1)&ie,M&&(k[I]|=(O[I+1]|O[I])<<1|1|O[I+1]),k[I]&Se&&(L=v(e,{errors:M,currentLocation:F,expectedLocation:f,distance:r,ignoreLocation:o}),L<=g)){if(g=L,p=F,p<=f)break;re=Math.max(1,2*f-p)}}if(v(e,{errors:M+1,currentLocation:f,expectedLocation:f,distance:r,ignoreLocation:o})>g)break;O=k}let B={isMatch:p>=0,score:Math.max(.001,L)};if(m){let M=Ve(w,h);M.length?a&&(B.indices=M):B.isMatch=!1}return B}function Ue(n){let e={};for(let t=0,s=n.length;t<s;t+=1){let r=n.charAt(t);e[r]=(e[r]||0)|1<<s-t-1}return e}var j=class{constructor(e,{location:t=d.location,threshold:s=d.threshold,distance:r=d.distance,includeMatches:i=d.includeMatches,findAllMatches:c=d.findAllMatches,minMatchCharLength:h=d.minMatchCharLength,isCaseSensitive:a=d.isCaseSensitive,ignoreLocation:o=d.ignoreLocation}={}){if(this.options={location:t,threshold:s,distance:r,includeMatches:i,findAllMatches:c,minMatchCharLength:h,isCaseSensitive:a,ignoreLocation:o},this.pattern=a?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;let l=(f,g)=>{this.chunks.push({pattern:f,alphabet:Ue(f),startIndex:g})},u=this.pattern.length;if(u>R){let f=0,g=u%R,p=u-g;for(;f<p;)l(this.pattern.substr(f,R),f),f+=R;if(g){let m=u-R;l(this.pattern.substr(m),m)}}else l(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,includeMatches:s}=this.options;if(t||(e=e.toLowerCase()),this.pattern===e){let p={isMatch:!0,score:0};return s&&(p.indices=[[0,e.length-1]]),p}let{location:r,distance:i,threshold:c,findAllMatches:h,minMatchCharLength:a,ignoreLocation:o}=this.options,l=[],u=0,f=!1;this.chunks.forEach(({pattern:p,alphabet:m,startIndex:w})=>{let{isMatch:x,score:O,indices:L}=ze(e,p,m,{location:r+w,distance:i,threshold:c,findAllMatches:h,minMatchCharLength:a,includeMatches:s,ignoreLocation:o});x&&(f=!0),u+=O,x&&L&&(l=[...l,...L])});let g={isMatch:f,score:f?u/this.chunks.length:1};return f&&s&&(g.indices=l),g}},T=class{constructor(e){this.pattern=e}static isMultiMatch(e){return de(e,this.multiRegex)}static isSingleMatch(e){return de(e,this.singleRegex)}search(){}};function de(n,e){let t=n.match(e);return t?t[1]:null}var U=class extends T{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){let t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},Y=class extends T{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){let s=e.indexOf(this.pattern)===-1;return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}},G=class extends T{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){let t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},W=class extends T{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){let t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},X=class extends T{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){let t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},J=class extends T{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){let t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},D=class extends T{constructor(e,{location:t=d.location,threshold:s=d.threshold,distance:r=d.distance,includeMatches:i=d.includeMatches,findAllMatches:c=d.findAllMatches,minMatchCharLength:h=d.minMatchCharLength,isCaseSensitive:a=d.isCaseSensitive,ignoreLocation:o=d.ignoreLocation}={}){super(e),this._bitapSearch=new j(e,{location:t,threshold:s,distance:r,includeMatches:i,findAllMatches:c,minMatchCharLength:h,isCaseSensitive:a,ignoreLocation:o})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}},P=class extends T{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t=0,s,r=[],i=this.pattern.length;for(;(s=e.indexOf(this.pattern,t))>-1;)t=s+i,r.push([s,t-1]);let c=!!r.length;return{isMatch:c,score:c?0:1,indices:r}}},Z=[U,P,G,W,J,X,Y,D],ge=Z.length,Ye=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/,Ge="|";function We(n,e={}){return n.split(Ge).map(t=>{let s=t.trim().split(Ye).filter(i=>i&&!!i.trim()),r=[];for(let i=0,c=s.length;i<c;i+=1){let h=s[i],a=!1,o=-1;for(;!a&&++o<ge;){let l=Z[o],u=l.isMultiMatch(h);u&&(r.push(new l(u,e)),a=!0)}if(!a)for(o=-1;++o<ge;){let l=Z[o],u=l.isSingleMatch(h);if(u){r.push(new l(u,e));break}}}return r})}var Xe=new Set([D.type,P.type]),q=class{constructor(e,{isCaseSensitive:t=d.isCaseSensitive,includeMatches:s=d.includeMatches,minMatchCharLength:r=d.minMatchCharLength,ignoreLocation:i=d.ignoreLocation,findAllMatches:c=d.findAllMatches,location:h=d.location,threshold:a=d.threshold,distance:o=d.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:s,minMatchCharLength:r,findAllMatches:c,ignoreLocation:i,location:h,threshold:a,distance:o},this.pattern=t?e:e.toLowerCase(),this.query=We(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:s,isCaseSensitive:r}=this.options;e=r?e:e.toLowerCase();let i=0,c=[],h=0;for(let a=0,o=t.length;a<o;a+=1){let l=t[a];c.length=0,i=0;for(let u=0,f=l.length;u<f;u+=1){let g=l[u],{isMatch:p,indices:m,score:w}=g.search(e);if(p){if(i+=1,h+=w,s){let x=g.constructor.type;Xe.has(x)?c=[...c,...m]:c.push(m)}}else{h=0,i=0,c.length=0;break}}if(i){let u={isMatch:!0,score:h/i};return s&&(u.indices=c),u}}return{isMatch:!1,score:1}}},ee=[];function Je(...n){ee.push(...n)}function te(n,e){for(let t=0,s=ee.length;t<s;t+=1){let r=ee[t];if(r.condition(n,e))return new r(n,e)}return new j(n,e)}var N={AND:"$and",OR:"$or"},se={PATH:"$path",PATTERN:"$val"},ne=n=>!!(n[N.AND]||n[N.OR]),Ze=n=>!!n[se.PATH],qe=n=>!S(n)&&ye(n)&&!ne(n),pe=n=>({[N.AND]:Object.keys(n).map(e=>({[e]:n[e]}))});function _e(n,e,{auto:t=!0}={}){let s=r=>{let i=Object.keys(r),c=Ze(r);if(!c&&i.length>1&&!ne(r))return s(pe(r));if(qe(r)){let a=c?r[se.PATH]:i[0],o=c?r[se.PATTERN]:r[a];if(!E(o))throw new Error($e(a));let l={keyId:z(a),pattern:o};return t&&(l.searcher=te(o,e)),l}let h={children:[],operator:i[0]};return i.forEach(a=>{let o=r[a];S(o)&&o.forEach(l=>{h.children.push(s(l))})}),h};return ne(n)||(n=pe(n)),s(n)}function et(n,{ignoreFieldNorm:e=d.ignoreFieldNorm}){n.forEach(t=>{let s=1;t.matches.forEach(({key:r,norm:i,score:c})=>{let h=r?r.weight:null;s*=Math.pow(c===0&&h?Number.EPSILON:c,(h||1)*(e?1:i))}),t.score=s})}function tt(n,e){let t=n.matches;e.matches=[],y(t)&&t.forEach(s=>{if(!y(s.indices)||!s.indices.length)return;let{indices:r,value:i}=s,c={indices:r,value:i};s.key&&(c.key=s.key.src),s.idx>-1&&(c.refIndex=s.idx),e.matches.push(c)})}function st(n,e){e.score=n.score}function nt(n,e,{includeMatches:t=d.includeMatches,includeScore:s=d.includeScore}={}){let r=[];return t&&r.push(tt),s&&r.push(st),n.map(i=>{let{idx:c}=i,h={item:e[c],refIndex:c};return r.length&&r.forEach(a=>{a(i,h)}),h})}var Te=(()=>{class n{constructor(t,s={},r){this.options=_(_({},d),s),this.options.useExtendedSearch,this._keyStore=new V(this.options.keys),this.setCollection(t,r)}setCollection(t,s){if(this._docs=t,s&&!(s instanceof $))throw new Error(ke);this._myIndex=s||fe(this.options.keys,this._docs,{getFn:this.options.getFn})}add(t){y(t)&&(this._docs.push(t),this._myIndex.add(t))}remove(t=()=>!1){let s=[];for(let r=0,i=this._docs.length;r<i;r+=1){let c=this._docs[r];t(c,r)&&(this.removeAt(r),r-=1,i-=1,s.push(c))}return s}removeAt(t){this._docs.splice(t,1),this._myIndex.removeAt(t)}getIndex(){return this._myIndex}search(t,{limit:s=-1}={}){let{includeMatches:r,includeScore:i,shouldSort:c,sortFn:h,ignoreFieldNorm:a}=this.options,o=E(t)?E(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t);return et(o,{ignoreFieldNorm:a}),c&&o.sort(h),me(s)&&s>-1&&(o=o.slice(0,s)),nt(o,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(t){let s=te(t,this.options),{records:r}=this._myIndex,i=[];return r.forEach(({v:c,i:h,n:a})=>{if(!y(c))return;let{isMatch:o,score:l,indices:u}=s.searchIn(c);o&&i.push({item:c,idx:h,matches:[{score:l,value:c,norm:a,indices:u}]})}),i}_searchLogical(t){let s=_e(t,this.options),r=(a,o,l)=>{if(!a.children){let{keyId:u,searcher:f}=a,g=this._findMatches({key:this._keyStore.get(u),value:this._myIndex.getValueForItemAtKeyId(o,u),searcher:f});return g&&g.length?[{idx:l,item:o,matches:g}]:[]}switch(a.operator){case N.AND:{let u=[];for(let f=0,g=a.children.length;f<g;f+=1){let p=a.children[f],m=r(p,o,l);if(m.length)u.push(...m);else return[]}return u}case N.OR:{let u=[];for(let f=0,g=a.children.length;f<g;f+=1){let p=a.children[f],m=r(p,o,l);if(m.length){u.push(...m);break}}return u}}},i=this._myIndex.records,c={},h=[];return i.forEach(({$:a,i:o})=>{if(y(a)){let l=r(s,a,o);l.length&&(c[o]||(c[o]={idx:o,item:a,matches:[]},h.push(c[o])),l.forEach(({matches:u})=>{c[o].matches.push(...u)}))}}),h}_searchObjectList(t){let s=te(t,this.options),{keys:r,records:i}=this._myIndex,c=[];return i.forEach(({$:h,i:a})=>{if(!y(h))return;let o=[];r.forEach((l,u)=>{o.push(...this._findMatches({key:l,value:h[u],searcher:s}))}),o.length&&c.push({idx:a,item:h,matches:o})}),c}_findMatches({key:t,value:s,searcher:r}){if(!y(s))return[];let i=[];if(S(s))s.forEach(({v:c,i:h,n:a})=>{if(!y(c))return;let{isMatch:o,score:l,indices:u}=r.searchIn(c);o&&i.push({score:l,key:t,value:c,idx:h,norm:a,indices:u})});else{let{v:c,n:h}=s,{isMatch:a,score:o,indices:l}=r.searchIn(c);a&&i.push({score:o,key:t,value:c,norm:h,indices:l})}return i}}return n.version="6.4.6",n.createIndex=fe,n.parseIndex=He,n.config=d,n})();Te.parseQuery=_e;Je(q);var xe=Te;Ae();var Ee=class{constructor(e){this.searchIndex=[],e&&this.updateSchema(e)}updateSchema(e){this.schema=oe(e)}generateSearchIndex(){if(!this.schema)return[];let e=[];he(this.schema).forEach(i=>{e=[...e,...this.getTypeIndices(i,!0,e)]});let s=this.schema.getTypeMap();Object.keys(s).forEach(i=>{/^__/.test(i)||(e=[...e,...this.getTypeIndices(s[i],!1,e)])});let r=this.schema.getDirectives();return e=[...e,...this.getDirectivesIndices(r)],this.searchIndex=e,e}getDirectivesIndices(e){let t=[];return e.forEach(s=>{let r={search:s.name,name:"@"+s.name,description:s.description||"",cat:"directive",highlight:"directive",locations:s.locations,args:s.args?.map(i=>({name:i.name,description:i.description??""}))};t=[...t,r],s.args&&s.args.length&&s.args.forEach(i=>{t=[...t,Q(_({},r),{search:i.name,highlight:"argument"})]})}),t}getFieldsIndices(e,t,s,r){let i=[];return Object.entries(e).forEach(([,c])=>{let h={search:c.name,name:c.name,description:c.description?c.description:"",args:c.args?.map(a=>({name:a.name,description:a.description??""})),cat:"field",type:t.name,isQuery:s,highlight:"field"};i=[...i,h],c.args&&c.args.length&&c.args.forEach(a=>{i=[...i,Q(_({},h),{search:a.name,highlight:"argument"})]}),c.type&&(i=[...i,...this.getTypeIndices(c.type,!1,[...r,...i]).filter(a=>!!a)])}),i}getTypeIndices(e,t,s){let r;if(!e.name)return[];if(s.some(c=>c.name===e.name&&c.cat==="type"))return[];e.getFields&&(r=e.getFields());let i=[{search:e.name,name:e.name,cat:"type",description:e.description?e.description:"",isRoot:t,highlight:"type"}];return r?[...i,...this.getFieldsIndices(r,e,t,[...s,...i]).filter(c=>!!c)]:i}searchDocs(e){return this.searchIndex.length?new xe(this.searchIndex,{keys:["search"],threshold:.4}).search(e).map(s=>s.item):[]}generateQueryV2(e,t,s){return ce(this,null,function*(){if(!this.schema)return;let r=yield ae(this.schema,e,t,{maxDepth:s.addQueryDepthLimit,tabSize:s.tabSize});return{query:r.generated,meta:r.metas.find(i=>i.hasArgs)||{}}})}cleanName(e){return e.replace(/[[\]!]/g,"")}isBuiltInScalarType(e){return["String","Int","Float","Boolean","ID"].includes(e)}getRelatedOperations(e){if(this.isBuiltInScalarType(e))return[];if(!this.schema||!this.searchIndex.length)return[];let t=[],s=new Set,r=this.schema.getQueryType(),i=this.schema.getMutationType(),c=this.schema.getSubscriptionType();return this.searchIndex.forEach(h=>{if(h.cat==="field"&&h.type){let a=h.type,o=null;if(r&&a===r.name?o="query":i&&a===i.name?o="mutation":c&&a===c.name&&(o="subscription"),o&&this.schema){let l=this.schema.getType(a);if(l&&"getFields"in l){let f=l.getFields()[h.name];if(f&&this.fieldUsesType(f,e)){let g=`${h.name}|${a}|${o}`;s.has(g)||(s.add(g),t.push({name:h.name,parentType:a,category:o,description:h.description||""}))}}}}}),t}getParentTypes(e){if(this.isBuiltInScalarType(e))return[];if(!this.schema||!this.searchIndex.length)return[];let t=new Map,s=this.schema.getQueryType(),r=this.schema.getMutationType(),i=this.schema.getSubscriptionType(),c=[s?.name,r?.name,i?.name].filter(Boolean);return this.searchIndex.forEach(h=>{if(h.cat==="field"&&h.type){let a=h.type;if(c.includes(a)||!this.schema)return;let o=this.schema.getType(a);if(o&&"getFields"in o){let u=o.getFields()[h.name];if(u&&this.fieldUsesType(u,e)){let f=t.get(a);if(f)f.fieldCount++;else{let g=this.searchIndex.find(p=>p.cat==="type"&&p.name===a);t.set(a,{name:a,description:g?.description||"",fieldCount:1})}}}}}),Array.from(t.values())}fieldUsesType(e,t){if(this.getBaseTypeName(e.type)===t)return!0;if(e.args){for(let s of e.args)if(this.getBaseTypeName(s.type)===t)return!0}return!1}getBaseTypeName(e){let t=e;for(;t.ofType;)t=t.ofType;return t.name||""}};export{Ee as DocUtils}; //# sourceMappingURL=chunk-WHXWUGJ5.js.map //# debugId=212f5285-7f40-5dad-a15c-6bb47e104882