diff --git a/composition-go/index.global.js b/composition-go/index.global.js index 4d17361817..09b2e48171 100644 --- a/composition-go/index.global.js +++ b/composition-go/index.global.js @@ -453,7 +453,7 @@ Although "${e}" is declared "@external", it is part of a "@key" directive on an `}function QD({entityAncestorData:e,rootFieldData:t,unresolvableFieldData:n}){let{fieldName:r,typeName:i,subgraphNames:a}=n,o=[t.message,`The field "${i}.${r}" is defined in the following subgraph`+(a.size>1?"s":"")+`: "${[...a].join(Za.QUOTATION_JOIN)}".`];if(e){let c=!1;for(let[l,d]of e.fieldSetsByTargetSubgraphName)if(a.has(l)){c=!0;for(let p of d)o.push(`The entity ancestor "${e.typeName}" in subgraph "${e.subgraphName}" does not satisfy the key field set "${p}" to access subgraph "${l}".`)}c||o.push(`The entity ancestor "${e.typeName}" in subgraph "${e.subgraphName}" has no accessible target entities (resolvable @key directives) in the subgraphs where "${i}.${r}" is defined.`),o.push(`The type "${i}" is not a descendant of any other entity ancestors that can provide a shared route to access "${r}".`)}else t.subgraphNames.size>1&&o.push(`None of the subgraphs that shares the same root type field "${t.coords}" can provide a route to access "${r}".`),o.push(`The type "${i}" is not a descendant of an entity ancestor that can provide a shared route to access "${r}".`);return i!==(e==null?void 0:e.typeName)&&o.push(`The type "${i}" has no accessible target entities (resolvable @key directives) in any other subgraph, so accessing other subgraphs is not possible.`),o}function eV({entityAncestors:e,rootFieldData:t,unresolvableFieldData:n}){let{fieldName:r,typeName:i,subgraphNames:a}=n,o=[t.message,`The field "${i}.${r}" is defined in the following subgraph`+(a.size>1?"s":"")+`: "${[...a].join(Za.QUOTATION_JOIN)}".`],c=!1;for(let[l,d]of e.fieldSetsByTargetSubgraphName){if(!a.has(l))continue;let p=e.subgraphNames.filter(I=>I!==l),E=p.length>1;c=!0;for(let I of d)o.push(`The entity ancestor "${e.typeName}" in subgraph${E?"s":""} "${p.join(Za.QUOTATION_JOIN)}" do${E?"":"es"} not satisfy the key field set "${I}" to access subgraph "${l}".`)}if(!c){let l=e.subgraphNames.length>1;o.push(`The entity ancestor "${e.typeName}" in subgraph${l?"s":""} "${e.subgraphNames.join(Za.QUOTATION_JOIN)}" ha${l?"ve":"s"} no accessible target entities (resolvable @key directives) in the subgraphs where "${i}.${r}" is defined.`)}return o.push(`The type "${i}" is not a descendant of any other entity ancestors that can provide a shared route to access "${r}".`),i!==e.typeName&&o.push(`The type "${i}" has no accessible target entities (resolvable @key directives) in any other subgraph, so accessing other subgraphs is not possible.`),o}function LE(e){let t=e.split(new RegExp("(?<=\\w)\\.")),n="",r="";for(let i=0;i{"use strict";m();T();N();Object.defineProperty(BE,"__esModule",{value:!0});BE.NodeResolutionData=void 0;var Jde=qi(),Fc,HD=class HD{constructor({fieldDataByName:t,isResolved:n=!1,resolvedDescendantNames:r,resolvedFieldNames:i,typeName:a}){Yu(this,Fc,!1);_(this,"fieldDataByName");_(this,"resolvedDescendantNames");_(this,"resolvedFieldNames");_(this,"typeName");Ky(this,Fc,n),this.fieldDataByName=t,this.resolvedDescendantNames=new Set(r),this.resolvedFieldNames=new Set(i),this.typeName=a}addData(t){for(let n of t.resolvedFieldNames)this.addResolvedFieldName(n);for(let n of t.resolvedDescendantNames)this.resolvedDescendantNames.add(n)}addResolvedFieldName(t){if(!this.fieldDataByName.has(t))throw(0,Jde.unexpectedEdgeFatalError)(this.typeName,[t]);this.resolvedFieldNames.add(t)}copy(){return new HD({fieldDataByName:this.fieldDataByName,isResolved:jy(this,Fc),resolvedDescendantNames:this.resolvedDescendantNames,resolvedFieldNames:this.resolvedFieldNames,typeName:this.typeName})}areDescendantsResolved(){return this.fieldDataByName.size===this.resolvedDescendantNames.size}isResolved(){if(jy(this,Fc))return!0;if(this.fieldDataByName.size!==this.resolvedFieldNames.size)return!1;for(let t of this.fieldDataByName.keys())if(!this.resolvedFieldNames.has(t))return!1;return Ky(this,Fc,!0),!0}};Fc=new WeakMap;var JD=HD;BE.NodeResolutionData=JD});var nV=w(kE=>{"use strict";m();T();N();Object.defineProperty(kE,"__esModule",{value:!0});kE.EntityWalker=void 0;var Hde=UE(),es=Rr(),zD=class{constructor({encounteredEntityNodeNames:t,index:n,relativeOriginPaths:r,resDataByNodeName:i,resDataByRelativeOriginPath:a,subgraphNameByUnresolvablePath:o,visitedEntities:c}){_(this,"encounteredEntityNodeNames");_(this,"index");_(this,"resDataByNodeName");_(this,"resDataByRelativeOriginPath");_(this,"selectionPathByEntityNodeName",new Map);_(this,"subgraphNameByUnresolvablePath");_(this,"visitedEntities");_(this,"relativeOriginPaths");this.encounteredEntityNodeNames=t,this.index=n,this.relativeOriginPaths=r,this.resDataByNodeName=i,this.resDataByRelativeOriginPath=a,this.visitedEntities=c,this.subgraphNameByUnresolvablePath=o}getNodeResolutionData({node:{fieldDataByName:t,nodeName:n,typeName:r},selectionPath:i}){let a=(0,es.getValueOrDefault)(this.resDataByNodeName,n,()=>new Hde.NodeResolutionData({fieldDataByName:t,typeName:r}));if(!this.relativeOriginPaths||this.relativeOriginPaths.size<1)return(0,es.getValueOrDefault)(this.resDataByRelativeOriginPath,i,()=>a.copy());let o;for(let c of this.relativeOriginPaths){let l=(0,es.getValueOrDefault)(this.resDataByRelativeOriginPath,`${c}${i}`,()=>a.copy());o!=null||(o=l)}return o}visitEntityDescendantEdge({edge:t,selectionPath:n}){return t.isInaccessible||t.node.isInaccessible?{visited:!1,areDescendantsResolved:!1}:t.node.isLeaf?{visited:!0,areDescendantsResolved:!0}:(0,es.add)(t.visitedIndices,this.index)?t.node.hasEntitySiblings?this.visitedEntities.has(t.node.nodeName)||this.encounteredEntityNodeNames.has(t.node.nodeName)?{visited:!0,areDescendantsResolved:!0}:(this.encounteredEntityNodeNames.add(t.node.nodeName),(0,es.getValueOrDefault)(this.selectionPathByEntityNodeName,t.node.nodeName,()=>`${n}.${t.edgeName}`),{visited:!0,areDescendantsResolved:!1}):t.node.isAbstract?this.visitEntityDescendantAbstractNode({node:t.node,selectionPath:`${n}.${t.edgeName}`}):this.visitEntityDescendantConcreteNode({node:t.node,selectionPath:`${n}.${t.edgeName}`}):(this.removeUnresolvablePaths({selectionPath:`${n}.${t.edgeName}`,removeDescendantPaths:!0}),{visited:!0,areDescendantsResolved:!0,isRevisitedNode:!0})}visitEntityDescendantConcreteNode({node:t,selectionPath:n}){if(t.headToTailEdges.size<1)return t.isLeaf=!0,{visited:!0,areDescendantsResolved:!0};let r=this.getNodeResolutionData({node:t,selectionPath:n});if(r.isResolved()&&r.areDescendantsResolved())return{visited:!0,areDescendantsResolved:!0};let i;for(let[a,o]of t.headToTailEdges){let{visited:c,areDescendantsResolved:l,isRevisitedNode:d}=this.visitEntityDescendantEdge({edge:o,selectionPath:n});i!=null||(i=d),this.propagateVisitedField({areDescendantsResolved:l,fieldName:a,data:r,nodeName:t.nodeName,selectionPath:n,visited:c})}return r.isResolved()?this.removeUnresolvablePaths({removeDescendantPaths:i,selectionPath:n}):this.addUnresolvablePaths({selectionPath:n,subgraphName:t.subgraphName}),{visited:!0,areDescendantsResolved:r.areDescendantsResolved()}}visitEntityDescendantAbstractNode({node:t,selectionPath:n}){if(t.headToTailEdges.size<1)return{visited:!0,areDescendantsResolved:!0};let r=0;for(let i of t.headToTailEdges.values())this.visitEntityDescendantEdge({edge:i,selectionPath:n}).areDescendantsResolved&&(r+=1);return{visited:!0,areDescendantsResolved:r===t.headToTailEdges.size}}propagateVisitedField({areDescendantsResolved:t,data:n,fieldName:r,nodeName:i,selectionPath:a,visited:o}){if(!o)return;let c=(0,es.getValueOrDefault)(this.resDataByNodeName,i,()=>n.copy());if(n.addResolvedFieldName(r),c.addResolvedFieldName(r),t&&n.resolvedDescendantNames.add(r),this.relativeOriginPaths){for(let d of this.relativeOriginPaths){let p=(0,es.getValueOrDefault)(this.resDataByRelativeOriginPath,`${d}${a}`,()=>n.copy());p.addResolvedFieldName(r),t&&p.resolvedDescendantNames.add(r)}return}let l=(0,es.getValueOrDefault)(this.resDataByRelativeOriginPath,a,()=>n.copy());l.addResolvedFieldName(r),t&&l.resolvedDescendantNames.add(r)}addUnresolvablePaths({selectionPath:t,subgraphName:n}){if(!this.relativeOriginPaths){(0,es.getValueOrDefault)(this.subgraphNameByUnresolvablePath,t,()=>n);return}for(let r of this.relativeOriginPaths)(0,es.getValueOrDefault)(this.subgraphNameByUnresolvablePath,`${r}${t}`,()=>n)}removeUnresolvablePaths({selectionPath:t,removeDescendantPaths:n}){if(!this.relativeOriginPaths){if(this.subgraphNameByUnresolvablePath.delete(t),n)for(let r of this.subgraphNameByUnresolvablePath.keys())r.startsWith(t)&&this.subgraphNameByUnresolvablePath.delete(r);return}for(let r of this.relativeOriginPaths){let i=`${r}${t}`;if(this.subgraphNameByUnresolvablePath.delete(i),n)for(let a of this.subgraphNameByUnresolvablePath.keys())a.startsWith(i)&&this.subgraphNameByUnresolvablePath.delete(a)}}};kE.EntityWalker=zD});var rV=w(xE=>{"use strict";m();T();N();Object.defineProperty(xE,"__esModule",{value:!0});xE.RootFieldWalker=void 0;var ts=Rr(),ME=UE(),WD=class{constructor({index:t,nodeResolutionDataByNodeName:n}){_(this,"index");_(this,"resDataByNodeName");_(this,"resDataByPath",new Map);_(this,"entityNodeNamesByPath",new Map);_(this,"pathsByEntityNodeName",new Map);_(this,"unresolvablePaths",new Set);this.index=t,this.resDataByNodeName=n}visitEdge({edge:t,selectionPath:n}){return t.isInaccessible||t.node.isInaccessible?{visited:!1,areDescendantsResolved:!0}:t.node.isLeaf?{visited:!0,areDescendantsResolved:!0}:(0,ts.add)(t.visitedIndices,this.index)?t.node.hasEntitySiblings?this.resDataByNodeName.has(t.node.nodeName)?{visited:!0,areDescendantsResolved:!0}:((0,ts.getValueOrDefault)(this.pathsByEntityNodeName,t.node.nodeName,()=>new Set).add(`${n}.${t.edgeName}`),{visited:!0,areDescendantsResolved:!1}):t.node.isAbstract?this.visitAbstractNode({node:t.node,selectionPath:`${n}.${t.edgeName}`}):this.visitConcreteNode({node:t.node,selectionPath:`${n}.${t.edgeName}`}):{visited:!0,areDescendantsResolved:!0}}visitAbstractNode({node:t,selectionPath:n}){if(t.headToTailEdges.size<1)return{visited:!0,areDescendantsResolved:!0};let r=0;for(let i of t.headToTailEdges.values())this.visitEdge({edge:i,selectionPath:n}).areDescendantsResolved&&(r+=1);return{visited:!0,areDescendantsResolved:r===t.headToTailEdges.size}}visitConcreteNode({node:t,selectionPath:n}){if(t.headToTailEdges.size<1)return t.isLeaf=!0,{visited:!0,areDescendantsResolved:!0};let r=this.resDataByNodeName.get(t.nodeName);if(r)return{visited:!0,areDescendantsResolved:r.areDescendantsResolved()};let i=this.getNodeResolutionData({node:t,selectionPath:n});if(i.isResolved()&&i.areDescendantsResolved())return{visited:!0,areDescendantsResolved:!0};for(let[a,o]of t.headToTailEdges){let{visited:c,areDescendantsResolved:l}=this.visitEdge({edge:o,selectionPath:n});this.propagateVisitedField({areDescendantsResolved:l,fieldName:a,data:i,node:t,selectionPath:n,visited:c})}return i.isResolved()?this.unresolvablePaths.delete(n):this.unresolvablePaths.add(n),{visited:!0,areDescendantsResolved:i.areDescendantsResolved()}}visitSharedEdge({edge:t,selectionPath:n}){return t.isInaccessible||t.node.isInaccessible?{visited:!1,areDescendantsResolved:!0}:t.node.isLeaf?{visited:!0,areDescendantsResolved:!0}:(0,ts.add)(t.visitedIndices,this.index)?(t.node.hasEntitySiblings&&(0,ts.getValueOrDefault)(this.entityNodeNamesByPath,`${n}.${t.edgeName}`,()=>new Set).add(t.node.nodeName),t.node.isAbstract?this.visitSharedAbstractNode({node:t.node,selectionPath:`${n}.${t.edgeName}`}):this.visitSharedConcreteNode({node:t.node,selectionPath:`${n}.${t.edgeName}`})):{visited:!0,areDescendantsResolved:!0}}visitSharedAbstractNode({node:t,selectionPath:n}){if(t.headToTailEdges.size<1)return{visited:!0,areDescendantsResolved:!0};let r=0;for(let i of t.headToTailEdges.values())this.visitSharedEdge({edge:i,selectionPath:n}).areDescendantsResolved&&(r+=1);return{visited:!0,areDescendantsResolved:r===t.headToTailEdges.size}}visitSharedConcreteNode({node:t,selectionPath:n}){if(t.headToTailEdges.size<1)return t.isLeaf=!0,{visited:!0,areDescendantsResolved:!0};let r=this.getSharedNodeResolutionData({node:t,selectionPath:n});if(r.isResolved()&&r.areDescendantsResolved())return{visited:!0,areDescendantsResolved:!0};for(let[i,a]of t.headToTailEdges){let{visited:o,areDescendantsResolved:c}=this.visitSharedEdge({edge:a,selectionPath:n});this.propagateSharedVisitedField({areDescendantsResolved:c,data:r,fieldName:i,node:t,visited:o})}return r.isResolved()?this.unresolvablePaths.delete(n):this.unresolvablePaths.add(n),{visited:!0,areDescendantsResolved:r.areDescendantsResolved()}}getNodeResolutionData({node:t,selectionPath:n}){let r=(0,ts.getValueOrDefault)(this.resDataByNodeName,t.nodeName,()=>new ME.NodeResolutionData({fieldDataByName:t.fieldDataByName,typeName:t.typeName}));return(0,ts.getValueOrDefault)(this.resDataByPath,n,()=>r.copy()),r}getSharedNodeResolutionData({node:t,selectionPath:n}){let r=(0,ts.getValueOrDefault)(this.resDataByNodeName,t.nodeName,()=>new ME.NodeResolutionData({fieldDataByName:t.fieldDataByName,typeName:t.typeName}));return(0,ts.getValueOrDefault)(this.resDataByPath,n,()=>r.copy())}propagateVisitedField({areDescendantsResolved:t,data:n,fieldName:r,node:i,selectionPath:a,visited:o}){if(!o)return;n.addResolvedFieldName(r);let c=(0,ts.getValueOrDefault)(this.resDataByPath,a,()=>new ME.NodeResolutionData({fieldDataByName:i.fieldDataByName,typeName:i.typeName}));c.addResolvedFieldName(r),t&&(n.resolvedDescendantNames.add(r),c.resolvedDescendantNames.add(r))}propagateSharedVisitedField({areDescendantsResolved:t,data:n,fieldName:r,node:i,visited:a}){if(!a)return;n.addResolvedFieldName(r);let o=(0,ts.getValueOrDefault)(this.resDataByNodeName,i.nodeName,()=>new ME.NodeResolutionData({fieldDataByName:i.fieldDataByName,typeName:i.typeName}));o.addResolvedFieldName(r),t&&(n.resolvedDescendantNames.add(r),o.resolvedDescendantNames.add(r))}visitRootFieldEdges({edges:t,rootTypeName:n}){let r=t.length>1;for(let i of t){if(i.isInaccessible)return{visited:!1,areDescendantsResolved:!1};let a=r?this.visitSharedEdge({edge:i,selectionPath:n}):this.visitEdge({edge:i,selectionPath:n});if(a.areDescendantsResolved)return a}return{visited:!0,areDescendantsResolved:!1}}};xE.RootFieldWalker=WD});var ZD=w(VE=>{"use strict";m();T();N();Object.defineProperty(VE,"__esModule",{value:!0});VE.Graph=void 0;var od=jD(),wc=YD(),ea=Rr(),qE=KD(),zde=nV(),Wde=rV(),XD=class{constructor(){_(this,"edgeId",-1);_(this,"entityDataNodeByTypeName",new Map);_(this,"nodeByNodeName",new Map);_(this,"nodesByTypeName",new Map);_(this,"resolvedRootFieldNodeNames",new Set);_(this,"rootNodeByTypeName",new Map);_(this,"subgraphName",qE.NOT_APPLICABLE);_(this,"resDataByNodeName",new Map);_(this,"resDataByRelativePathByEntity",new Map);_(this,"visitedEntitiesByOriginEntity",new Map);_(this,"walkerIndex",-1)}getRootNode(t){return(0,ea.getValueOrDefault)(this.rootNodeByTypeName,t,()=>new od.RootNode(t))}addOrUpdateNode(t,n){let r=`${this.subgraphName}.${t}`,i=this.nodeByNodeName.get(r);if(i)return i.isAbstract||(i.isAbstract=!!(n!=null&&n.isAbstract)),!i.isLeaf&&(n!=null&&n.isLeaf)&&(i.isLeaf=!0),i;let a=new od.GraphNode(this.subgraphName,t,n);return this.nodeByNodeName.set(r,a),(0,ea.getValueOrDefault)(this.nodesByTypeName,t,()=>[]).push(a),a}addEdge(t,n,r,i=!1){if(t.isRootNode){let c=new od.Edge(this.getNextEdgeId(),n,r);return(0,ea.getValueOrDefault)(t.headToSharedTailEdges,r,()=>[]).push(c),c}let a=t,o=new od.Edge(this.getNextEdgeId(),n,i?n.typeName:r,i);return a.headToTailEdges.set(r,o),o}addEntityDataNode(t){let n=this.entityDataNodeByTypeName.get(t);if(n)return n;let r=new od.EntityDataNode(t);return this.entityDataNodeByTypeName.set(t,r),r}getNextEdgeId(){return this.edgeId+=1}getNextWalkerIndex(){return this.walkerIndex+=1}setNodeInaccessible(t){let n=this.nodesByTypeName.get(t);if(n)for(let r of n)r.isInaccessible=!0}initializeNode(t,n){let r=this.entityDataNodeByTypeName.get(t);if(qE.ROOT_TYPE_NAMES.has(t)){let a=this.getRootNode(t);a.removeInaccessibleEdges(n),a.fieldDataByName=n;return}let i=this.nodesByTypeName.get(t);if(i){for(let a of i)if(a.fieldDataByName=n,a.handleInaccessibleEdges(),a.isLeaf=!1,!!r){a.hasEntitySiblings=!0;for(let o of a.satisfiedFieldSets){let c=r.targetSubgraphNamesByFieldSet.get(o);for(let l of c!=null?c:[]){if(l===a.subgraphName)continue;let d=this.nodeByNodeName.get(`${l}.${a.typeName}`);d&&a.entityEdges.push(new od.Edge(this.getNextEdgeId(),d,""))}}}}}setSubgraphName(t){this.subgraphName=t}visitEntity({encounteredEntityNodeNames:t,entityNodeName:n,relativeOriginPaths:r,resDataByRelativeOriginPath:i,subgraphNameByUnresolvablePath:a,visitedEntities:o}){let c=this.nodeByNodeName.get(n);if(!c)throw new Error(`Fatal: Could not find entity node for "${n}".`);o.add(n);let l=this.nodesByTypeName.get(c.typeName);if(!(l!=null&&l.length))throw new Error(`Fatal: Could not find any nodes for "${n}".`);let d=new zde.EntityWalker({encounteredEntityNodeNames:t,index:this.getNextWalkerIndex(),relativeOriginPaths:r,resDataByNodeName:this.resDataByNodeName,resDataByRelativeOriginPath:i,subgraphNameByUnresolvablePath:a,visitedEntities:o}),p=c.getAllAccessibleEntityNodeNames();for(let E of l){if(E.nodeName!==c.nodeName&&!p.has(E.nodeName))continue;let{areDescendantsResolved:I}=d.visitEntityDescendantConcreteNode({node:E,selectionPath:""});if(I)return}for(let[E,I]of d.selectionPathByEntityNodeName)this.visitEntity({encounteredEntityNodeNames:t,entityNodeName:E,relativeOriginPaths:(0,wc.getMultipliedRelativeOriginPaths)({relativeOriginPaths:r,selectionPath:I}),resDataByRelativeOriginPath:i,subgraphNameByUnresolvablePath:a,visitedEntities:o})}validate(){for(let t of this.rootNodeByTypeName.values())for(let[n,r]of t.headToSharedTailEdges){let i=r.length>1;if(!i){let p=r[0].node.nodeName;if(this.resolvedRootFieldNodeNames.has(p))continue;this.resolvedRootFieldNodeNames.add(p)}let a=new Wde.RootFieldWalker({index:this.getNextWalkerIndex(),nodeResolutionDataByNodeName:this.resDataByNodeName});if(a.visitRootFieldEdges({edges:r,rootTypeName:t.typeName.toLowerCase()}).areDescendantsResolved)continue;let o=i?a.entityNodeNamesByPath.size>0:a.pathsByEntityNodeName.size>0;if(a.unresolvablePaths.size<1&&!o)continue;let c=(0,ea.getOrThrowError)(t.fieldDataByName,n,"fieldDataByName"),l=(0,wc.newRootFieldData)(t.typeName,n,c.subgraphNames);if(!o)return{errors:(0,wc.generateRootResolvabilityErrors)({unresolvablePaths:a.unresolvablePaths,resDataByPath:a.resDataByPath,rootFieldData:l}),success:!1};let d=this.validateEntities({isSharedRootField:i,rootFieldData:l,walker:a});if(!d.success)return d}return{success:!0}}consolidateUnresolvableRootWithEntityPaths({pathFromRoot:t,resDataByRelativeOriginPath:n,subgraphNameByUnresolvablePath:r,walker:i}){for(let a of i.unresolvablePaths){if(!a.startsWith(t))continue;let o=a.slice(t.length),c=(0,ea.getOrThrowError)(i.resDataByPath,a,"rootFieldWalker.unresolvablePaths"),l=n.get(o);if(l){if(c.addData(l),l.addData(c),!c.isResolved()){i.unresolvablePaths.delete(a);continue}i.unresolvablePaths.delete(a),r.delete(o)}}}consolidateUnresolvableEntityWithRootPaths({pathFromRoot:t,resDataByRelativeOriginPath:n,subgraphNameByUnresolvablePath:r,walker:i}){for(let a of r.keys()){let o=(0,ea.getOrThrowError)(n,a,"resDataByRelativeOriginPath"),c=`${t}${a}`,l=i.resDataByPath.get(c);l&&(o.addData(l),l.addData(o)),o.isResolved()&&r.delete(a)}}validateSharedRootFieldEntities({rootFieldData:t,walker:n}){for(let[r,i]of n.entityNodeNamesByPath){let a=new Map,o=new Map;for(let l of i)this.visitEntity({encounteredEntityNodeNames:new Set,entityNodeName:l,resDataByRelativeOriginPath:o,subgraphNameByUnresolvablePath:a,visitedEntities:new Set});if(this.consolidateUnresolvableRootWithEntityPaths({pathFromRoot:r,resDataByRelativeOriginPath:o,subgraphNameByUnresolvablePath:a,walker:n}),a.size<1)continue;this.consolidateUnresolvableEntityWithRootPaths({pathFromRoot:r,resDataByRelativeOriginPath:o,subgraphNameByUnresolvablePath:a,walker:n});let c=new Array;if(a.size>0&&c.push(...this.getSharedEntityResolvabilityErrors({entityNodeNames:i,resDataByPath:o,pathFromRoot:r,rootFieldData:t,subgraphNameByUnresolvablePath:a})),n.unresolvablePaths.size>0&&c.push(...(0,wc.generateRootResolvabilityErrors)({unresolvablePaths:n.unresolvablePaths,resDataByPath:n.resDataByPath,rootFieldData:t})),!(c.length<1))return{errors:c,success:!1}}return n.unresolvablePaths.size>0?{errors:(0,wc.generateRootResolvabilityErrors)({resDataByPath:n.resDataByPath,rootFieldData:t,unresolvablePaths:n.unresolvablePaths}),success:!1}:{success:!0}}validateRootFieldEntities({rootFieldData:t,walker:n}){var r;for(let[i,a]of n.pathsByEntityNodeName){let o=new Map;if(this.resDataByNodeName.has(i))continue;let c=(0,ea.getValueOrDefault)(this.resDataByRelativePathByEntity,i,()=>new Map);if(this.visitEntity({encounteredEntityNodeNames:new Set,entityNodeName:i,resDataByRelativeOriginPath:c,subgraphNameByUnresolvablePath:o,visitedEntities:(0,ea.getValueOrDefault)(this.visitedEntitiesByOriginEntity,i,()=>new Set)}),!(o.size<1))return{errors:this.getEntityResolvabilityErrors({entityNodeName:i,pathFromRoot:(r=(0,ea.getFirstEntry)(a))!=null?r:"",rootFieldData:t,subgraphNameByUnresolvablePath:o}),success:!1}}return{success:!0}}validateEntities(t){return t.isSharedRootField?this.validateSharedRootFieldEntities(t):this.validateRootFieldEntities(t)}getEntityResolvabilityErrors({entityNodeName:t,pathFromRoot:n,rootFieldData:r,subgraphNameByUnresolvablePath:i}){let a=(0,ea.getOrThrowError)(this.resDataByRelativePathByEntity,t,"resDataByRelativePathByEntity"),o=t.split(qE.LITERAL_PERIOD)[1],{fieldSetsByTargetSubgraphName:c}=(0,ea.getOrThrowError)(this.entityDataNodeByTypeName,o,"entityDataNodeByTypeName");return(0,wc.generateEntityResolvabilityErrors)({entityAncestorData:{fieldSetsByTargetSubgraphName:c,subgraphName:"",typeName:o},pathFromRoot:n,resDataByPath:a,rootFieldData:r,subgraphNameByUnresolvablePath:i})}getSharedEntityResolvabilityErrors({entityNodeNames:t,pathFromRoot:n,rootFieldData:r,resDataByPath:i,subgraphNameByUnresolvablePath:a}){let o,c=new Array;for(let d of t){let p=d.split(qE.LITERAL_PERIOD);o!=null||(o=p[1]),c.push(p[0])}let{fieldSetsByTargetSubgraphName:l}=(0,ea.getOrThrowError)(this.entityDataNodeByTypeName,o,"entityDataNodeByTypeName");return(0,wc.generateSharedEntityResolvabilityErrors)({entityAncestors:{fieldSetsByTargetSubgraphName:l,subgraphNames:c,typeName:o},pathFromRoot:n,resDataByPath:i,rootFieldData:r,subgraphNameByUnresolvablePath:a})}};VE.Graph=XD});var eb=w(jE=>{"use strict";m();T();N();Object.defineProperty(jE,"__esModule",{value:!0});jE.newFieldSetConditionData=Xde;jE.newConfigurationData=Zde;function Xde({fieldCoordinatesPath:e,fieldPath:t}){return{fieldCoordinatesPath:e,fieldPath:t}}function Zde(e,t){return{fieldNames:new Set,isRootNode:e,typeName:t}}});var nb=w(Lc=>{"use strict";m();T();N();Object.defineProperty(Lc,"__esModule",{value:!0});Lc.NormalizationFactory=void 0;Lc.normalizeSubgraphFromString=rfe;Lc.normalizeSubgraph=sV;Lc.batchNormalize=ife;var X=Oe(),gn=Ar(),ai=dp(),jr=Iu(),Zn=lp(),oe=qi(),mp=nd(),efe=Cv(),yi=rE(),tfe=FD(),rs=fp(),iV=kD(),ns=Uf(),nn=Bl(),cr=yu(),tb=ZD(),KE=sE(),W=sr(),nfe=Fl(),je=Rr(),Np=eb(),aV=oE();function rfe(e,t=!0){let{error:n,documentNode:r}=(0,gn.safeParse)(e,t);return n||!r?{errors:[(0,oe.subgraphInvalidSyntaxError)(n)],success:!1,warnings:[]}:new Tp(new tb.Graph).normalize(r)}function sV(e,t,n){return new Tp(n||new tb.Graph,t).normalize(e)}var GE,oV,$E,uV,Tp=class{constructor(t,n){Yu(this,GE);Yu(this,$E);_(this,"argumentName","");_(this,"authorizationDataByParentTypeName",new Map);_(this,"concreteTypeNamesByAbstractTypeName",new Map);_(this,"conditionalFieldDataByCoords",new Map);_(this,"configurationDataByTypeName",new Map);_(this,"customDirectiveDefinitionByName",new Map);_(this,"definedDirectiveNames",new Set);_(this,"directiveDefinitionByName",new Map);_(this,"directiveDefinitionDataByName",(0,ai.initializeDirectiveDefinitionDatas)());_(this,"doesParentRequireFetchReasons",!1);_(this,"edfsDirectiveReferences",new Set);_(this,"errors",new Array);_(this,"entityDataByTypeName",new Map);_(this,"entityInterfaceDataByTypeName",new Map);_(this,"eventsConfigurations",new Map);_(this,"fieldSetDataByTypeName",new Map);_(this,"internalGraph");_(this,"invalidConfigureDescriptionNodeDatas",[]);_(this,"invalidORScopesCoords",new Set);_(this,"invalidRepeatedDirectiveNameByCoords",new Map);_(this,"isParentObjectExternal",!1);_(this,"isParentObjectShareable",!1);_(this,"isSubgraphEventDrivenGraph",!1);_(this,"isSubgraphVersionTwo",!1);_(this,"keyFieldSetDatasByTypeName",new Map);_(this,"lastParentNodeKind",X.Kind.NULL);_(this,"lastChildNodeKind",X.Kind.NULL);_(this,"parentTypeNamesWithAuthDirectives",new Set);_(this,"keyFieldSetsByEntityTypeNameByFieldCoords",new Map);_(this,"keyFieldNamesByParentTypeName",new Map);_(this,"fieldCoordsByNamedTypeName",new Map);_(this,"operationTypeNodeByTypeName",new Map);_(this,"originalParentTypeName","");_(this,"originalTypeNameByRenamedTypeName",new Map);_(this,"overridesByTargetSubgraphName",new Map);_(this,"parentDefinitionDataByTypeName",new Map);_(this,"schemaData");_(this,"referencedDirectiveNames",new Set);_(this,"referencedTypeNames",new Set);_(this,"renamedParentTypeName","");_(this,"subgraphName");_(this,"unvalidatedExternalFieldCoords",new Set);_(this,"usesEdfsNatsStreamConfiguration",!1);_(this,"warnings",[]);this.subgraphName=n||W.NOT_APPLICABLE,this.internalGraph=t,this.internalGraph.setSubgraphName(this.subgraphName),this.schemaData={directivesByDirectiveName:new Map,kind:X.Kind.SCHEMA_DEFINITION,name:W.SCHEMA,operationTypes:new Map}}validateArguments(t,n){for(let r of t.argumentDataByName.values()){let i=(0,cr.getTypeNodeNamedTypeName)(r.type);if(jr.BASE_SCALARS.has(i)){r.namedTypeKind=X.Kind.SCALAR_TYPE_DEFINITION;continue}let a=this.parentDefinitionDataByTypeName.get(i);if(a){if((0,nn.isInputNodeKind)(a.kind)){r.namedTypeKind=a.kind;continue}this.errors.push((0,oe.invalidNamedTypeError)({data:r,namedTypeData:a,nodeType:`${(0,je.kindToNodeType)(n)} field argument`}))}}}isTypeNameRootType(t){return W.ROOT_TYPE_NAMES.has(t)||this.operationTypeNodeByTypeName.has(t)}isArgumentValueValid(t,n){if(n.kind===X.Kind.NULL)return t.kind!==X.Kind.NON_NULL_TYPE;switch(t.kind){case X.Kind.LIST_TYPE:{if(n.kind!==X.Kind.LIST)return this.isArgumentValueValid((0,cr.getNamedTypeNode)(t.type),n);for(let r of n.values)if(!this.isArgumentValueValid(t.type,r))return!1;return!0}case X.Kind.NAMED_TYPE:switch(t.name.value){case W.BOOLEAN_SCALAR:return n.kind===X.Kind.BOOLEAN;case W.FLOAT_SCALAR:return n.kind===X.Kind.FLOAT||n.kind===X.Kind.INT;case W.ID_SCALAR:return n.kind===X.Kind.STRING||n.kind===X.Kind.INT;case W.INT_SCALAR:return n.kind===X.Kind.INT;case W.FIELD_SET_SCALAR:case W.SCOPE_SCALAR:case W.STRING_SCALAR:return n.kind===X.Kind.STRING;case W.LINK_IMPORT:return!0;case W.LINK_PURPOSE:return n.kind!==X.Kind.ENUM?!1:n.value===W.SECURITY||n.value===W.EXECUTION;case W.SUBSCRIPTION_FIELD_CONDITION:case W.SUBSCRIPTION_FILTER_CONDITION:return n.kind===X.Kind.OBJECT;default:{let r=this.parentDefinitionDataByTypeName.get(t.name.value);if(!r)return!1;if(r.kind===X.Kind.SCALAR_TYPE_DEFINITION)return!0;if(r.kind===X.Kind.ENUM_TYPE_DEFINITION){if(n.kind!==X.Kind.ENUM)return!1;let i=r.enumValueDataByName.get(n.value);return i?!i.directivesByDirectiveName.has(W.INACCESSIBLE):!1}return r.kind!==X.Kind.INPUT_OBJECT_TYPE_DEFINITION?!1:n.kind===X.Kind.OBJECT}}default:return this.isArgumentValueValid(t.type,n)}}handleFieldInheritableDirectives({directivesByDirectiveName:t,fieldName:n,inheritedDirectiveNames:r,parentData:i}){this.doesParentRequireFetchReasons&&!t.has(W.REQUIRE_FETCH_REASONS)&&(t.set(W.REQUIRE_FETCH_REASONS,[(0,je.generateSimpleDirective)(W.REQUIRE_FETCH_REASONS)]),r.add(W.REQUIRE_FETCH_REASONS)),(this.doesParentRequireFetchReasons||t.has(W.REQUIRE_FETCH_REASONS))&&i.requireFetchReasonsFieldNames.add(n),(0,Zn.isObjectDefinitionData)(i)&&(this.isParentObjectExternal&&!t.has(W.EXTERNAL)&&(t.set(W.EXTERNAL,[(0,je.generateSimpleDirective)(W.EXTERNAL)]),r.add(W.EXTERNAL)),t.has(W.EXTERNAL)&&this.unvalidatedExternalFieldCoords.add(`${i.name}.${n}`),this.isParentObjectShareable&&!t.has(W.SHAREABLE)&&(t.set(W.SHAREABLE,[(0,je.generateSimpleDirective)(W.SHAREABLE)]),r.add(W.SHAREABLE)))}extractDirectives(t,n){if(!t.directives)return n;let r=(0,Zn.isCompositeOutputNodeKind)(t.kind),i=(0,Zn.isObjectNodeKind)(t.kind);for(let a of t.directives){let o=a.name.value;o===W.SHAREABLE?(0,je.getValueOrDefault)(n,o,()=>[a]):(0,je.getValueOrDefault)(n,o,()=>[]).push(a),r&&(this.doesParentRequireFetchReasons||(this.doesParentRequireFetchReasons=o===W.REQUIRE_FETCH_REASONS),i&&(this.isParentObjectExternal||(this.isParentObjectExternal=o===W.EXTERNAL),this.isParentObjectShareable||(this.isParentObjectShareable=o===W.SHAREABLE)))}return n}validateDirective({data:t,definitionData:n,directiveCoords:r,directiveNode:i,errorMessages:a,requiredArgumentNames:o}){let c=i.name.value,l=t.kind===X.Kind.FIELD_DEFINITION?t.renamedParentTypeName||t.originalParentTypeName:t.name,d=c===W.AUTHENTICATED,p=(0,nn.isFieldData)(t),E=c===W.OVERRIDE,I=c===W.REQUIRES_SCOPES,v=c===W.SEMANTIC_NON_NULL;if(!i.arguments||i.arguments.length<1)return n.requiredArgumentNames.size>0&&a.push((0,oe.undefinedRequiredArgumentsErrorMessage)(c,o,[])),d&&this.handleAuthenticatedDirective(t,l),v&&p&&((0,nn.isTypeRequired)(t.type)?a.push((0,oe.semanticNonNullLevelsNonNullErrorMessage)({typeString:(0,yi.printTypeNode)(t.type),value:"0"})):t.nullLevelsBySubgraphName.set(this.subgraphName,new Set([0]))),a;let A=new Set,U=new Set,j=new Set,$=[];for(let me of i.arguments){let ue=me.name.value;if(A.has(ue)){U.add(ue);continue}A.add(ue);let Ae=n.argumentTypeNodeByName.get(ue);if(!Ae){j.add(ue);continue}if(!this.isArgumentValueValid(Ae.typeNode,me.value)){a.push((0,oe.invalidArgumentValueErrorMessage)((0,X.print)(me.value),`@${c}`,ue,(0,yi.printTypeNode)(Ae.typeNode)));continue}if(E&&p){this.handleOverrideDirective({data:t,directiveCoords:r,errorMessages:a,targetSubgraphName:me.value.value});continue}if(v&&p){this.handleSemanticNonNullDirective({data:t,directiveNode:i,errorMessages:a});continue}!I||ue!==W.SCOPES||this.extractRequiredScopes({directiveCoords:r,orScopes:me.value.values,requiredScopes:$})}U.size>0&&a.push((0,oe.duplicateDirectiveArgumentDefinitionsErrorMessage)([...U])),j.size>0&&a.push((0,oe.unexpectedDirectiveArgumentErrorMessage)(c,[...j]));let re=(0,je.getEntriesNotInHashSet)(o,A);if(re.length>0&&a.push((0,oe.undefinedRequiredArgumentsErrorMessage)(c,o,re)),a.length>0||!I)return a;let te=(0,je.getValueOrDefault)(this.authorizationDataByParentTypeName,l,()=>(0,Zn.newAuthorizationData)(l));if(t.kind!==X.Kind.FIELD_DEFINITION)this.parentTypeNamesWithAuthDirectives.add(l),te.requiredScopes.push(...$);else{let me=(0,je.getValueOrDefault)(te.fieldAuthDataByFieldName,t.name,()=>(0,Zn.newFieldAuthorizationData)(t.name));me.inheritedData.requiredScopes.push(...$),me.originalData.requiredScopes.push(...$)}return a}validateDirectives(t,n){let r=new Set;for(let[i,a]of t.directivesByDirectiveName){let o=this.directiveDefinitionDataByName.get(i);if(!o){r.has(i)||(this.errors.push((0,oe.undefinedDirectiveError)(i,n)),r.add(i));continue}let c=[],l=(0,gn.nodeKindToDirectiveLocation)(t.kind);if(o.locations.has(l)||c.push((0,oe.invalidDirectiveLocationErrorMessage)(i,l)),a.length>1&&!o.isRepeatable){let p=(0,je.getValueOrDefault)(this.invalidRepeatedDirectiveNameByCoords,n,()=>new Set);p.has(i)||(p.add(i),c.push((0,oe.invalidRepeatedDirectiveErrorMessage)(i)))}let d=[...o.requiredArgumentNames];for(let p=0;p0&&this.errors.push((0,oe.invalidDirectiveError)(i,n,(0,je.numberToOrdinal)(p+1),E))}}switch(t.kind){case X.Kind.ENUM_TYPE_DEFINITION:{for(let[i,a]of t.enumValueDataByName)this.validateDirectives(a,`${t.name}.${i}`);return}case X.Kind.FIELD_DEFINITION:{for(let[i,a]of t.argumentDataByName)this.validateDirectives(a,`${t.originalParentTypeName}.${t.name}(${i}: ...)`);return}case X.Kind.INPUT_OBJECT_TYPE_DEFINITION:{for(let[i,a]of t.inputValueDataByName)this.validateDirectives(a,`${t.name}.${i}`);return}case X.Kind.INTERFACE_TYPE_DEFINITION:case X.Kind.OBJECT_TYPE_DEFINITION:{for(let[i,a]of t.fieldDataByName)this.validateDirectives(a,`${t.name}.${i}`);return}default:return}}getNodeExtensionType(t,n,r=!1){return t?ns.ExtensionType.REAL:r||!n.has(W.EXTENDS)?ns.ExtensionType.NONE:ns.ExtensionType.EXTENDS}setParentDataExtensionType(t,n){switch(t.extensionType){case ns.ExtensionType.EXTENDS:case ns.ExtensionType.NONE:{if(n===ns.ExtensionType.REAL)return;this.errors.push((0,oe.duplicateTypeDefinitionError)((0,je.kindToNodeType)(t.kind),t.name));return}default:t.extensionType=n}}extractConfigureDescriptionData(t,n){var i,a;if(!n.arguments||n.arguments.length<1){t.description||this.invalidConfigureDescriptionNodeDatas.push(t),t.configureDescriptionDataBySubgraphName.set(this.subgraphName,{propagate:!0,description:((i=t.description)==null?void 0:i.value)||""});return}let r={propagate:!0,description:((a=t.description)==null?void 0:a.value)||""};for(let o of n.arguments)switch(o.name.value){case W.PROPAGATE:{if(o.value.kind!=X.Kind.BOOLEAN)return;r.propagate=o.value.value;break}case W.DESCRIPTION_OVERRIDE:{if(o.value.kind!=X.Kind.STRING)return;r.description=o.value.value;break}default:return}!t.description&&!r.description&&this.invalidConfigureDescriptionNodeDatas.push(t),t.configureDescriptionDataBySubgraphName.set(this.subgraphName,r)}extractConfigureDescriptionsData(t){let n=t.directivesByDirectiveName.get(W.CONFIGURE_DESCRIPTION);n&&n.length==1&&this.extractConfigureDescriptionData(t,n[0])}extractImplementedInterfaceTypeNames(t,n){if(!t.interfaces)return n;let r=t.name.value;for(let i of t.interfaces){let a=i.name.value;if(n.has(a)){this.errors.push((0,oe.duplicateImplementedInterfaceError)((0,Zn.kindToConvertedTypeString)(t.kind),r,a));continue}n.add(a)}return n}updateCompositeOutputDataByNode(t,n,r){this.setParentDataExtensionType(n,r),this.extractImplementedInterfaceTypeNames(t,n.implementedInterfaceTypeNames),n.description||(n.description=(0,gn.formatDescription)("description"in t?t.description:void 0)),this.extractConfigureDescriptionsData(n),n.isEntity||(n.isEntity=n.directivesByDirectiveName.has(W.KEY)),n.isInaccessible||(n.isInaccessible=n.directivesByDirectiveName.has(W.INACCESSIBLE)),n.subgraphNames.add(this.subgraphName)}addConcreteTypeNamesForImplementedInterfaces(t,n){for(let r of t)(0,je.getValueOrDefault)(this.concreteTypeNamesByAbstractTypeName,r,()=>new Set).add(n),this.internalGraph.addEdge(this.internalGraph.addOrUpdateNode(r,{isAbstract:!0}),this.internalGraph.addOrUpdateNode(n),n,!0)}extractArguments(t,n){var o;if(!((o=n.arguments)!=null&&o.length))return t;let r=n.name.value,i=`${this.originalParentTypeName}.${r}`,a=new Set;for(let c of n.arguments){let l=c.name.value;if(t.has(l)){a.add(l);continue}this.addInputValueDataByNode({fieldName:r,inputValueDataByName:t,isArgument:!0,node:c,originalParentTypeName:this.originalParentTypeName,renamedParentTypeName:this.renamedParentTypeName})}return a.size>0&&this.errors.push((0,oe.duplicateArgumentsError)(i,[...a])),t}addPersistedDirectiveDefinitionDataByNode(t,n,r){let i=n.name.value,a=`@${i}`,o=new Map;for(let c of n.arguments||[])this.addInputValueDataByNode({inputValueDataByName:o,isArgument:!0,node:c,originalParentTypeName:a});t.set(i,{argumentDataByName:o,executableLocations:r,name:i,repeatable:n.repeatable,subgraphNames:new Set([this.subgraphName]),description:(0,gn.formatDescription)(n.description)})}extractDirectiveLocations(t,n){let r=new Set,i=new Set;for(let a of t.locations){let o=a.value;if(!i.has(o)){if(!W.EXECUTABLE_DIRECTIVE_LOCATIONS.has(o)&&!mp.TYPE_SYSTEM_DIRECTIVE_LOCATIONS.has(o)){n.push((0,oe.invalidDirectiveDefinitionLocationErrorMessage)(o)),i.add(o);continue}if(r.has(o)){n.push((0,oe.duplicateDirectiveDefinitionLocationErrorMessage)(o)),i.add(o);continue}r.add(o)}}return r}extractArgumentData(t,n){let r=new Map,i=new Set,a=new Set,o={argumentTypeNodeByName:r,optionalArgumentNames:i,requiredArgumentNames:a};if(!t)return o;let c=new Set;for(let l of t){let d=l.name.value;if(r.has(d)){c.add(d);continue}l.defaultValue&&i.add(d),(0,nn.isTypeRequired)(l.type)&&!l.defaultValue&&a.add(d),r.set(d,{name:d,typeNode:l.type,defaultValue:l.defaultValue})}return c.size>0&&n.push((0,oe.duplicateDirectiveDefinitionArgumentErrorMessage)([...c])),o}addDirectiveDefinitionDataByNode(t){let n=t.name.value;if(this.definedDirectiveNames.has(n))return this.errors.push((0,oe.duplicateDirectiveDefinitionError)(n)),!1;this.definedDirectiveNames.add(n);let r=jr.V2_DIRECTIVE_DEFINITION_BY_DIRECTIVE_NAME.get(n);if(r)return this.directiveDefinitionByName.set(n,r),this.isSubgraphVersionTwo=!0,!1;if(jr.DIRECTIVE_DEFINITION_BY_NAME.has(n))return!1;this.directiveDefinitionByName.set(n,t);let i=[],{argumentTypeNodeByName:a,optionalArgumentNames:o,requiredArgumentNames:c}=this.extractArgumentData(t.arguments,i);return this.directiveDefinitionDataByName.set(n,{argumentTypeNodeByName:a,isRepeatable:t.repeatable,locations:this.extractDirectiveLocations(t,i),name:n,node:t,optionalArgumentNames:o,requiredArgumentNames:c}),i.length>0&&this.errors.push((0,oe.invalidDirectiveDefinitionError)(n,i)),!0}addFieldDataByNode(t,n,r,i,a=new Set){let o=n.name.value,c=this.renamedParentTypeName||this.originalParentTypeName,l=`${this.originalParentTypeName}.${o}`,{isExternal:d,isShareable:p}=(0,nn.isNodeExternalOrShareable)(n,!this.isSubgraphVersionTwo,i),E=(0,cr.getTypeNodeNamedTypeName)(n.type),I={argumentDataByName:r,configureDescriptionDataBySubgraphName:new Map,externalFieldDataBySubgraphName:new Map([[this.subgraphName,(0,nn.newExternalFieldData)(d)]]),federatedCoords:`${c}.${o}`,inheritedDirectiveNames:a,isInaccessible:i.has(W.INACCESSIBLE),isShareableBySubgraphName:new Map([[this.subgraphName,p]]),kind:X.Kind.FIELD_DEFINITION,name:o,namedTypeKind:jr.BASE_SCALARS.has(E)?X.Kind.SCALAR_TYPE_DEFINITION:X.Kind.NULL,namedTypeName:E,node:(0,cr.getMutableFieldNode)(n,l,this.errors),nullLevelsBySubgraphName:new Map,originalParentTypeName:this.originalParentTypeName,persistedDirectivesData:(0,nn.newPersistedDirectivesData)(),renamedParentTypeName:c,subgraphNames:new Set([this.subgraphName]),type:(0,cr.getMutableTypeNode)(n.type,l,this.errors),directivesByDirectiveName:i,description:(0,gn.formatDescription)(n.description)};return jr.BASE_SCALARS.has(I.namedTypeName)||this.referencedTypeNames.add(I.namedTypeName),this.extractConfigureDescriptionsData(I),t.set(o,I),I}addInputValueDataByNode({fieldName:t,inputValueDataByName:n,isArgument:r,node:i,originalParentTypeName:a,renamedParentTypeName:o}){let c=o||a,l=i.name.value,d=r?`${a}${t?`.${t}`:""}(${l}: ...)`:`${a}.${l}`;i.defaultValue&&!(0,nn.areDefaultValuesCompatible)(i.type,i.defaultValue)&&this.errors.push((0,oe.incompatibleInputValueDefaultValueTypeError)((r?W.ARGUMENT:W.INPUT_FIELD)+` "${l}"`,d,(0,yi.printTypeNode)(i.type),(0,X.print)(i.defaultValue)));let p=r?`${c}${t?`.${t}`:""}(${l}: ...)`:`${c}.${l}`,E=(0,cr.getTypeNodeNamedTypeName)(i.type),I={configureDescriptionDataBySubgraphName:new Map,directivesByDirectiveName:this.extractDirectives(i,new Map),federatedCoords:p,fieldName:t,includeDefaultValue:!!i.defaultValue,isArgument:r,kind:r?X.Kind.ARGUMENT:X.Kind.INPUT_VALUE_DEFINITION,name:l,namedTypeKind:jr.BASE_SCALARS.has(E)?X.Kind.SCALAR_TYPE_DEFINITION:X.Kind.NULL,namedTypeName:E,node:(0,cr.getMutableInputValueNode)(i,a,this.errors),originalCoords:d,originalParentTypeName:a,persistedDirectivesData:(0,nn.newPersistedDirectivesData)(),renamedParentTypeName:c,requiredSubgraphNames:new Set((0,nn.isTypeRequired)(i.type)?[this.subgraphName]:[]),subgraphNames:new Set([this.subgraphName]),type:(0,cr.getMutableTypeNode)(i.type,a,this.errors),defaultValue:i.defaultValue,description:(0,gn.formatDescription)(i.description)};this.extractConfigureDescriptionsData(I),n.set(l,I)}upsertInterfaceDataByNode(t,n=!1){let r=t.name.value,i=this.parentDefinitionDataByTypeName.get(r),a=this.extractDirectives(t,(i==null?void 0:i.directivesByDirectiveName)||new Map),o=this.getNodeExtensionType(n,a),c=this.entityInterfaceDataByTypeName.get(r);if(c&&t.fields)for(let d of t.fields)c.interfaceFieldNames.add(d.name.value);if(i){if(i.kind!==X.Kind.INTERFACE_TYPE_DEFINITION){this.errors.push((0,oe.multipleNamedTypeDefinitionError)(r,(0,je.kindToNodeType)(i.kind),(0,Zn.kindToConvertedTypeString)(t.kind)));return}this.updateCompositeOutputDataByNode(t,i,o);return}let l={configureDescriptionDataBySubgraphName:new Map,directivesByDirectiveName:a,extensionType:o,fieldDataByName:new Map,implementedInterfaceTypeNames:this.extractImplementedInterfaceTypeNames(t,new Set),isEntity:a.has(W.KEY),isInaccessible:a.has(W.INACCESSIBLE),kind:X.Kind.INTERFACE_TYPE_DEFINITION,name:r,node:(0,cr.getMutableInterfaceNode)(t.name),persistedDirectivesData:(0,nn.newPersistedDirectivesData)(),requireFetchReasonsFieldNames:new Set,subgraphNames:new Set([this.subgraphName]),description:(0,gn.formatDescription)("description"in t?t.description:void 0)};this.extractConfigureDescriptionsData(l),this.parentDefinitionDataByTypeName.set(r,l)}getRenamedRootTypeName(t){let n=this.operationTypeNodeByTypeName.get(t);if(!n)return t;switch(n){case X.OperationTypeNode.MUTATION:return W.MUTATION;case X.OperationTypeNode.SUBSCRIPTION:return W.SUBSCRIPTION;default:return W.QUERY}}addInterfaceObjectFieldsByNode(t){let n=t.name.value,r=this.entityInterfaceDataByTypeName.get(n);if(!(!r||!r.isInterfaceObject||!t.fields))for(let i of t.fields)r.interfaceObjectFieldNames.add(i.name.value)}upsertObjectDataByNode(t,n=!1){var p;let r=t.name.value,i=this.parentDefinitionDataByTypeName.get(r),a=this.extractDirectives(t,(p=i==null?void 0:i.directivesByDirectiveName)!=null?p:new Map),o=this.isTypeNameRootType(r),c=this.getNodeExtensionType(n,a,o);if(this.addInterfaceObjectFieldsByNode(t),i){if(i.kind!==X.Kind.OBJECT_TYPE_DEFINITION){this.errors.push((0,oe.multipleNamedTypeDefinitionError)(r,(0,je.kindToNodeType)(i.kind),(0,Zn.kindToConvertedTypeString)(t.kind)));return}this.updateCompositeOutputDataByNode(t,i,c),a.has(W.INTERFACE_OBJECT)||this.addConcreteTypeNamesForImplementedInterfaces(i.implementedInterfaceTypeNames,r);return}let l=this.extractImplementedInterfaceTypeNames(t,new Set);a.has(W.INTERFACE_OBJECT)||this.addConcreteTypeNamesForImplementedInterfaces(l,r);let d={configureDescriptionDataBySubgraphName:new Map,directivesByDirectiveName:a,extensionType:c,fieldDataByName:new Map,implementedInterfaceTypeNames:l,isEntity:a.has(W.KEY),isInaccessible:a.has(W.INACCESSIBLE),isRootType:o,kind:X.Kind.OBJECT_TYPE_DEFINITION,name:r,node:(0,cr.getMutableObjectNode)(t.name),persistedDirectivesData:(0,nn.newPersistedDirectivesData)(),requireFetchReasonsFieldNames:new Set,renamedTypeName:this.getRenamedRootTypeName(r),subgraphNames:new Set([this.subgraphName]),description:(0,gn.formatDescription)("description"in t?t.description:void 0)};this.extractConfigureDescriptionsData(d),this.parentDefinitionDataByTypeName.set(r,d)}upsertEnumDataByNode(t,n=!1){let r=t.name.value;this.internalGraph.addOrUpdateNode(r,{isLeaf:!0});let i=this.parentDefinitionDataByTypeName.get(r),a=this.extractDirectives(t,(i==null?void 0:i.directivesByDirectiveName)||new Map),o=this.getNodeExtensionType(n,a);if(i){if(i.kind!==X.Kind.ENUM_TYPE_DEFINITION){this.errors.push((0,oe.multipleNamedTypeDefinitionError)(r,(0,je.kindToNodeType)(i.kind),(0,Zn.kindToConvertedTypeString)(t.kind)));return}this.setParentDataExtensionType(i,o),i.isInaccessible||(i.isInaccessible=a.has(W.INACCESSIBLE)),i.subgraphNames.add(this.subgraphName),i.description||(i.description=(0,gn.formatDescription)("description"in t?t.description:void 0)),this.extractConfigureDescriptionsData(i);return}let c={appearances:1,configureDescriptionDataBySubgraphName:new Map,directivesByDirectiveName:a,extensionType:o,enumValueDataByName:new Map,isInaccessible:a.has(W.INACCESSIBLE),kind:X.Kind.ENUM_TYPE_DEFINITION,name:r,node:(0,cr.getMutableEnumNode)(t.name),persistedDirectivesData:(0,nn.newPersistedDirectivesData)(),subgraphNames:new Set([this.subgraphName]),description:(0,gn.formatDescription)("description"in t?t.description:void 0)};this.extractConfigureDescriptionsData(c),this.parentDefinitionDataByTypeName.set(r,c)}upsertInputObjectByNode(t,n=!1){let r=t.name.value,i=this.parentDefinitionDataByTypeName.get(r),a=this.extractDirectives(t,(i==null?void 0:i.directivesByDirectiveName)||new Map),o=this.getNodeExtensionType(n,a);if(i)return i.kind!==X.Kind.INPUT_OBJECT_TYPE_DEFINITION?(this.errors.push((0,oe.multipleNamedTypeDefinitionError)(r,(0,je.kindToNodeType)(i.kind),(0,Zn.kindToConvertedTypeString)(t.kind))),{success:!1}):(this.setParentDataExtensionType(i,o),i.isInaccessible||(i.isInaccessible=a.has(W.INACCESSIBLE)),i.subgraphNames.add(this.subgraphName),i.description||(i.description=(0,gn.formatDescription)("description"in t?t.description:void 0)),this.extractConfigureDescriptionsData(i),{success:!0,data:i});let c={configureDescriptionDataBySubgraphName:new Map,directivesByDirectiveName:a,extensionType:o,inputValueDataByName:new Map,isInaccessible:a.has(W.INACCESSIBLE),kind:X.Kind.INPUT_OBJECT_TYPE_DEFINITION,name:r,node:(0,cr.getMutableInputObjectNode)(t.name),persistedDirectivesData:(0,nn.newPersistedDirectivesData)(),subgraphNames:new Set([this.subgraphName]),description:(0,gn.formatDescription)("description"in t?t.description:void 0)};return this.extractConfigureDescriptionsData(c),this.parentDefinitionDataByTypeName.set(r,c),{success:!0,data:c}}upsertScalarByNode(t,n=!1){let r=t.name.value;this.internalGraph.addOrUpdateNode(r,{isLeaf:!0});let i=this.parentDefinitionDataByTypeName.get(r),a=this.extractDirectives(t,(i==null?void 0:i.directivesByDirectiveName)||new Map),o=this.getNodeExtensionType(n,a);if(i){if(i.kind!==X.Kind.SCALAR_TYPE_DEFINITION){this.errors.push((0,oe.multipleNamedTypeDefinitionError)(r,(0,je.kindToNodeType)(i.kind),(0,Zn.kindToConvertedTypeString)(t.kind)));return}this.setParentDataExtensionType(i,o),i.description||(i.description=(0,gn.formatDescription)("description"in t?t.description:void 0)),i.subgraphNames.add(this.subgraphName),this.extractConfigureDescriptionsData(i);return}let c={configureDescriptionDataBySubgraphName:new Map,directivesByDirectiveName:a,extensionType:o,kind:X.Kind.SCALAR_TYPE_DEFINITION,name:r,node:(0,cr.getMutableScalarNode)(t.name),persistedDirectivesData:(0,nn.newPersistedDirectivesData)(),subgraphNames:new Set([this.subgraphName]),description:(0,gn.formatDescription)("description"in t?t.description:void 0)};this.extractConfigureDescriptionsData(c),this.parentDefinitionDataByTypeName.set(r,c)}extractUnionMembers(t,n){if(!t.types)return n;let r=t.name.value;for(let i of t.types){let a=i.name.value;if(n.has(a)){this.errors.push((0,oe.duplicateUnionMemberDefinitionError)(r,a));continue}(0,je.getValueOrDefault)(this.concreteTypeNamesByAbstractTypeName,r,()=>new Set).add(a),jr.BASE_SCALARS.has(a)||this.referencedTypeNames.add(a),n.set(a,i)}return n}upsertUnionByNode(t,n=!1){let r=t.name.value,i=this.parentDefinitionDataByTypeName.get(r),a=this.extractDirectives(t,(i==null?void 0:i.directivesByDirectiveName)||new Map),o=this.getNodeExtensionType(n,a);if(this.addConcreteTypeNamesForUnion(t),i){if(i.kind!==X.Kind.UNION_TYPE_DEFINITION){this.errors.push((0,oe.multipleNamedTypeDefinitionError)(r,(0,je.kindToNodeType)(i.kind),(0,Zn.kindToConvertedTypeString)(t.kind)));return}this.setParentDataExtensionType(i,o),this.extractUnionMembers(t,i.memberByMemberTypeName),i.description||(i.description=(0,gn.formatDescription)("description"in t?t.description:void 0)),i.subgraphNames.add(this.subgraphName),this.extractConfigureDescriptionsData(i);return}let c={configureDescriptionDataBySubgraphName:new Map,directivesByDirectiveName:a,extensionType:o,kind:X.Kind.UNION_TYPE_DEFINITION,memberByMemberTypeName:this.extractUnionMembers(t,new Map),name:r,node:(0,cr.getMutableUnionNode)(t.name),persistedDirectivesData:(0,nn.newPersistedDirectivesData)(),subgraphNames:new Set([this.subgraphName]),description:(0,gn.formatDescription)("description"in t?t.description:void 0)};this.extractConfigureDescriptionsData(c),this.parentDefinitionDataByTypeName.set(r,c)}extractKeyFieldSets(t,n){var a;let r=t.name.value;if(!((a=t.directives)!=null&&a.length)){this.errors.push((0,oe.expectedEntityError)(r));return}let i=0;for(let o of t.directives){if(o.name.value!==W.KEY||(i+=1,!o.arguments||o.arguments.length<1))continue;let c,l=!1;for(let v of o.arguments){if(v.name.value===W.RESOLVABLE){v.value.kind===X.Kind.BOOLEAN&&!v.value.value&&(l=!0);continue}if(v.name.value!==W.FIELDS){c=void 0;break}if(v.value.kind!==X.Kind.STRING){c=void 0;break}c=v.value.value}if(c===void 0)continue;let{error:d,documentNode:p}=(0,gn.safeParse)("{"+c+"}");if(d||!p){this.errors.push((0,oe.invalidDirectiveError)(W.KEY,r,(0,je.numberToOrdinal)(i),[(0,oe.unparsableFieldSetErrorMessage)(c,d)]));continue}let E=(0,ai.getNormalizedFieldSet)(p),I=n.get(E);I?I.isUnresolvable||(I.isUnresolvable=l):n.set(E,{documentNode:p,isUnresolvable:l,normalizedFieldSet:E,rawFieldSet:c})}}getFieldSetParent(t,n,r,i){if(!t)return{fieldSetParentData:n};let a=(0,je.getOrThrowError)(n.fieldDataByName,r,`${i}.fieldDataByFieldName`),o=(0,cr.getTypeNodeNamedTypeName)(a.node.type),c=this.parentDefinitionDataByTypeName.get(o);return c?c.kind!==X.Kind.INTERFACE_TYPE_DEFINITION&&c.kind!==X.Kind.OBJECT_TYPE_DEFINITION?{errorString:(0,oe.incompatibleTypeWithProvidesErrorMessage)(`${i}.${r}`,o)}:{fieldSetParentData:c}:{errorString:(0,oe.unknownNamedTypeErrorMessage)(`${i}.${r}`,o)}}validateConditionalFieldSet(t,n,r,i,a){let{error:o,documentNode:c}=(0,gn.safeParse)("{"+n+"}");if(o||!c)return{errorMessages:[(0,oe.unparsableFieldSetErrorMessage)(n,o)]};let l=this,d=[t],p=(0,ai.getConditionalFieldSetDirectiveName)(i),E=[],I=`${a}.${r}`,v=(0,ai.getInitialFieldCoordsPath)(i,I),A=[r],U=new Set,j=[],$=-1,re=!0,te=r,me=!1;return(0,X.visit)(c,{Argument:{enter(){return!1}},Field:{enter(ue){let Ae=d[$],xe=Ae.name;if(Ae.kind===X.Kind.UNION_TYPE_DEFINITION)return j.push((0,oe.invalidSelectionOnUnionErrorMessage)(n,v,xe)),X.BREAK;let rt=ue.name.value,Z=`${xe}.${rt}`;if(l.unvalidatedExternalFieldCoords.delete(Z),re)return j.push((0,oe.invalidSelectionSetErrorMessage)(n,v,xe,(0,je.kindToNodeType)(Ae.kind))),X.BREAK;v.push(Z),A.push(rt),te=rt;let _e=Ae.fieldDataByName.get(rt);if(!_e)return j.push((0,oe.undefinedFieldInFieldSetErrorMessage)(n,xe,rt)),X.BREAK;if(E[$].has(rt))return j.push((0,oe.duplicateFieldInFieldSetErrorMessage)(n,Z)),X.BREAK;E[$].add(rt);let{isDefinedExternal:_t,isUnconditionallyProvided:rn}=(0,je.getOrThrowError)(_e.externalFieldDataBySubgraphName,l.subgraphName,`${Z}.externalFieldDataBySubgraphName`),an=_t&&!rn;rn||(me=!0);let Fn=(0,cr.getTypeNodeNamedTypeName)(_e.node.type),$t=l.parentDefinitionDataByTypeName.get(Fn);if(jr.BASE_SCALARS.has(Fn)||($t==null?void 0:$t.kind)===X.Kind.SCALAR_TYPE_DEFINITION||($t==null?void 0:$t.kind)===X.Kind.ENUM_TYPE_DEFINITION){if(U.size<1&&!_t){if(l.isSubgraphVersionTwo){l.errors.push((0,oe.nonExternalConditionalFieldError)(I,l.subgraphName,Z,n,p));return}l.warnings.push((0,rs.nonExternalConditionalFieldWarning)(I,l.subgraphName,Z,n,p));return}if(U.size<1&&rn){l.isSubgraphVersionTwo?j.push((0,oe.fieldAlreadyProvidedErrorMessage)(Z,l.subgraphName,p)):l.warnings.push((0,rs.fieldAlreadyProvidedWarning)(Z,p,I,l.subgraphName));return}if(!an&&!i)return;let Tn=(0,je.getValueOrDefault)(l.conditionalFieldDataByCoords,Z,nn.newConditionalFieldData),Cr=(0,Np.newFieldSetConditionData)({fieldCoordinatesPath:[...v],fieldPath:[...A]});i?Tn.providedBy.push(Cr):Tn.requiredBy.push(Cr);return}if(!$t)return j.push((0,oe.unknownTypeInFieldSetErrorMessage)(n,Z,Fn)),X.BREAK;if(_t&&(i&&(0,je.getValueOrDefault)(l.conditionalFieldDataByCoords,Z,nn.newConditionalFieldData).providedBy.push((0,Np.newFieldSetConditionData)({fieldCoordinatesPath:[...v],fieldPath:[...A]})),U.add(Z)),$t.kind===X.Kind.OBJECT_TYPE_DEFINITION||$t.kind===X.Kind.INTERFACE_TYPE_DEFINITION||$t.kind===X.Kind.UNION_TYPE_DEFINITION){re=!0,d.push($t);return}},leave(){U.delete(v.pop()||""),A.pop()}},InlineFragment:{enter(ue){let Ae=d[$],xe=Ae.name,rt=v.length<1?t.name:v[v.length-1];if(!ue.typeCondition)return j.push((0,oe.inlineFragmentWithoutTypeConditionErrorMessage)(n,rt)),X.BREAK;let Z=ue.typeCondition.name.value;if(Z===xe){d.push(Ae),re=!0;return}if(!(0,gn.isKindAbstract)(Ae.kind))return j.push((0,oe.invalidInlineFragmentTypeErrorMessage)(n,v,Z,xe)),X.BREAK;let _e=l.parentDefinitionDataByTypeName.get(Z);if(!_e)return j.push((0,oe.unknownInlineFragmentTypeConditionErrorMessage)(n,v,xe,Z)),X.BREAK;switch(re=!0,_e.kind){case X.Kind.INTERFACE_TYPE_DEFINITION:{if(!_e.implementedInterfaceTypeNames.has(xe))break;d.push(_e);return}case X.Kind.OBJECT_TYPE_DEFINITION:{let _t=l.concreteTypeNamesByAbstractTypeName.get(xe);if(!_t||!_t.has(Z))break;d.push(_e);return}case X.Kind.UNION_TYPE_DEFINITION:{d.push(_e);return}default:return j.push((0,oe.invalidInlineFragmentTypeConditionTypeErrorMessage)(n,v,xe,Z,(0,je.kindToNodeType)(_e.kind))),X.BREAK}return j.push((0,oe.invalidInlineFragmentTypeConditionErrorMessage)(n,v,Z,(0,je.kindToNodeType)(Ae.kind),xe)),X.BREAK}},SelectionSet:{enter(){if(!re){let ue=d[$];if(ue.kind===X.Kind.UNION_TYPE_DEFINITION)return j.push((0,oe.unparsableFieldSetSelectionErrorMessage)(n,te)),X.BREAK;let Ae=ue.fieldDataByName.get(te);if(!Ae)return j.push((0,oe.undefinedFieldInFieldSetErrorMessage)(n,ue.name,te)),X.BREAK;let xe=(0,cr.getTypeNodeNamedTypeName)(Ae.node.type),rt=l.parentDefinitionDataByTypeName.get(xe),Z=rt?rt.kind:X.Kind.SCALAR_TYPE_DEFINITION;return j.push((0,oe.invalidSelectionSetDefinitionErrorMessage)(n,v,xe,(0,je.kindToNodeType)(Z))),X.BREAK}if($+=1,re=!1,$<0||$>=d.length)return j.push((0,oe.unparsableFieldSetSelectionErrorMessage)(n,te)),X.BREAK;E.push(new Set)},leave(){if(re){let ue=d[$+1];j.push((0,oe.invalidSelectionSetErrorMessage)(n,v,ue.name,(0,je.kindToNodeType)(ue.kind))),re=!1}$-=1,d.pop(),E.pop()}}}),j.length>0||!me?{errorMessages:j}:{configuration:{fieldName:r,selectionSet:(0,ai.getNormalizedFieldSet)(c)},errorMessages:j}}validateProvidesOrRequires(t,n,r){let i=[],a=[],o=(0,nn.getParentTypeName)(t);for(let[c,l]of n){let{fieldSetParentData:d,errorString:p}=this.getFieldSetParent(r,t,c,o),E=`${o}.${c}`;if(p){i.push(p);continue}if(!d)continue;let{errorMessages:I,configuration:v}=this.validateConditionalFieldSet(d,l,c,r,o);if(I.length>0){i.push(` On field "${E}": - -`+I.join(W.HYPHEN_JOIN));continue}v&&a.push(v)}if(i.length>0){this.errors.push((0,oe.invalidProvidesOrRequiresDirectivesError)((0,ai.getConditionalFieldSetDirectiveName)(r),i));return}if(a.length>0)return a}validateInterfaceImplementations(t){if(t.implementedInterfaceTypeNames.size<1)return;let n=t.directivesByDirectiveName.has(W.INACCESSIBLE),r=new Map,i=new Map,a=!1;for(let o of t.implementedInterfaceTypeNames){let c=this.parentDefinitionDataByTypeName.get(o);if(jr.BASE_SCALARS.has(o)&&this.referencedTypeNames.add(o),!c)continue;if(c.kind!==X.Kind.INTERFACE_TYPE_DEFINITION){i.set(c.name,(0,je.kindToNodeType)(c.kind));continue}if(t.name===c.name){a=!0;continue}let l={invalidFieldImplementations:new Map,unimplementedFields:[]},d=!1;for(let[p,E]of c.fieldDataByName){this.unvalidatedExternalFieldCoords.delete(`${t.name}.${p}`);let I=!1,v=t.fieldDataByName.get(p);if(!v){d=!0,l.unimplementedFields.push(p);continue}let A={invalidAdditionalArguments:new Set,invalidImplementedArguments:[],isInaccessible:!1,originalResponseType:(0,yi.printTypeNode)(E.node.type),unimplementedArguments:new Set};(0,nn.isTypeValidImplementation)(E.node.type,v.node.type,this.concreteTypeNamesByAbstractTypeName)||(d=!0,I=!0,A.implementedResponseType=(0,yi.printTypeNode)(v.node.type));let U=new Set;for(let[j,$]of E.argumentDataByName){U.add(j);let re=v.argumentDataByName.get(j);if(!re){d=!0,I=!0,A.unimplementedArguments.add(j);continue}let te=(0,yi.printTypeNode)(re.type),me=(0,yi.printTypeNode)($.type);me!==te&&(d=!0,I=!0,A.invalidImplementedArguments.push({actualType:te,argumentName:j,expectedType:me}))}for(let[j,$]of v.argumentDataByName)U.has(j)||$.type.kind===X.Kind.NON_NULL_TYPE&&(d=!0,I=!0,A.invalidAdditionalArguments.add(j));!n&&v.isInaccessible&&!E.isInaccessible&&(d=!0,I=!0,A.isInaccessible=!0),I&&l.invalidFieldImplementations.set(p,A)}d&&r.set(o,l)}i.size>0&&this.errors.push((0,oe.invalidImplementedTypeError)(t.name,i)),a&&this.errors.push((0,oe.selfImplementationError)(t.name)),r.size>0&&this.errors.push((0,oe.invalidInterfaceImplementationError)(t.name,(0,je.kindToNodeType)(t.kind),r))}handleAuthenticatedDirective(t,n){let r=(0,je.getValueOrDefault)(this.authorizationDataByParentTypeName,n,()=>(0,Zn.newAuthorizationData)(n));if(t.kind===X.Kind.FIELD_DEFINITION){let i=(0,je.getValueOrDefault)(r.fieldAuthDataByFieldName,t.name,()=>(0,Zn.newFieldAuthorizationData)(t.name));i.inheritedData.requiresAuthentication=!0,i.originalData.requiresAuthentication=!0}else r.requiresAuthentication=!0,this.parentTypeNamesWithAuthDirectives.add(n)}handleOverrideDirective({data:t,directiveCoords:n,errorMessages:r,targetSubgraphName:i}){if(i===this.subgraphName){r.push((0,oe.equivalentSourceAndTargetOverrideErrorMessage)(i,n));return}let a=(0,je.getValueOrDefault)(this.overridesByTargetSubgraphName,i,()=>new Map);(0,je.getValueOrDefault)(a,t.renamedParentTypeName,()=>new Set).add(t.name)}handleSemanticNonNullDirective({data:t,directiveNode:n,errorMessages:r}){var E;let i=new Set,a=t.node.type,o=0;for(;a;)switch(a.kind){case X.Kind.LIST_TYPE:{o+=1,a=a.type;break}case X.Kind.NON_NULL_TYPE:{i.add(o),a=a.type;break}default:{a=null;break}}let c=(E=n.arguments)==null?void 0:E.find(I=>I.name.value===W.LEVELS);if(!c||c.value.kind!==X.Kind.LIST){r.push(oe.semanticNonNullArgumentErrorMessage);return}let l=c.value.values,d=(0,yi.printTypeNode)(t.type),p=new Set;for(let{value:I}of l){let v=parseInt(I,10);if(Number.isNaN(v)){r.push((0,oe.semanticNonNullLevelsNaNIndexErrorMessage)(I));continue}if(v<0||v>o){r.push((0,oe.semanticNonNullLevelsIndexOutOfBoundsErrorMessage)({maxIndex:o,typeString:d,value:I}));continue}if(!i.has(v)){p.add(v);continue}r.push((0,oe.semanticNonNullLevelsNonNullErrorMessage)({typeString:d,value:I}))}t.nullLevelsBySubgraphName.set(this.subgraphName,p)}extractRequiredScopes({directiveCoords:t,orScopes:n,requiredScopes:r}){if(n.length>jr.MAX_OR_SCOPES){this.invalidORScopesCoords.add(t);return}for(let i of n){let a=new Set;for(let o of i.values)a.add(o.value);a.size<1||(0,Zn.addScopes)(r,a)}}getKafkaPublishConfiguration(t,n,r,i){let a=[],o=W.DEFAULT_EDFS_PROVIDER_ID;for(let c of t.arguments||[])switch(c.name.value){case W.TOPIC:{if(c.value.kind!==X.Kind.STRING||c.value.value.length<1){i.push((0,oe.invalidEventSubjectErrorMessage)(W.TOPIC));continue}(0,ai.validateArgumentTemplateReferences)(c.value.value,n,i),a.push(c.value.value);break}case W.PROVIDER_ID:{if(c.value.kind!==X.Kind.STRING||c.value.value.length<1){i.push(oe.invalidEventProviderIdErrorMessage);continue}o=c.value.value;break}}if(!(i.length>0))return{fieldName:r,providerId:o,providerType:W.PROVIDER_TYPE_KAFKA,topics:a,type:W.PUBLISH}}getKafkaSubscribeConfiguration(t,n,r,i){let a=[],o=W.DEFAULT_EDFS_PROVIDER_ID;for(let c of t.arguments||[])switch(c.name.value){case W.TOPICS:{if(c.value.kind!==X.Kind.LIST){i.push((0,oe.invalidEventSubjectsErrorMessage)(W.TOPICS));continue}for(let l of c.value.values){if(l.kind!==X.Kind.STRING||l.value.length<1){i.push((0,oe.invalidEventSubjectsItemErrorMessage)(W.TOPICS));break}(0,ai.validateArgumentTemplateReferences)(l.value,n,i),a.push(l.value)}break}case W.PROVIDER_ID:{if(c.value.kind!==X.Kind.STRING||c.value.value.length<1){i.push(oe.invalidEventProviderIdErrorMessage);continue}o=c.value.value;break}}if(!(i.length>0))return{fieldName:r,providerId:o,providerType:W.PROVIDER_TYPE_KAFKA,topics:a,type:W.SUBSCRIBE}}getNatsPublishAndRequestConfiguration(t,n,r,i,a){let o=[],c=W.DEFAULT_EDFS_PROVIDER_ID;for(let l of n.arguments||[])switch(l.name.value){case W.SUBJECT:{if(l.value.kind!==X.Kind.STRING||l.value.value.length<1){a.push((0,oe.invalidEventSubjectErrorMessage)(W.SUBJECT));continue}(0,ai.validateArgumentTemplateReferences)(l.value.value,r,a),o.push(l.value.value);break}case W.PROVIDER_ID:{if(l.value.kind!==X.Kind.STRING||l.value.value.length<1){a.push(oe.invalidEventProviderIdErrorMessage);continue}c=l.value.value;break}}if(!(a.length>0))return{fieldName:i,providerId:c,providerType:W.PROVIDER_TYPE_NATS,subjects:o,type:t}}getNatsSubscribeConfiguration(t,n,r,i){let a=[],o=W.DEFAULT_EDFS_PROVIDER_ID,c=KE.DEFAULT_CONSUMER_INACTIVE_THRESHOLD,l="",d="";for(let p of t.arguments||[])switch(p.name.value){case W.SUBJECTS:{if(p.value.kind!==X.Kind.LIST){i.push((0,oe.invalidEventSubjectsErrorMessage)(W.SUBJECTS));continue}for(let E of p.value.values){if(E.kind!==X.Kind.STRING||E.value.length<1){i.push((0,oe.invalidEventSubjectsItemErrorMessage)(W.SUBJECTS));break}(0,ai.validateArgumentTemplateReferences)(E.value,n,i),a.push(E.value)}break}case W.PROVIDER_ID:{if(p.value.kind!==X.Kind.STRING||p.value.value.length<1){i.push(oe.invalidEventProviderIdErrorMessage);continue}o=p.value.value;break}case W.STREAM_CONFIGURATION:{if(this.usesEdfsNatsStreamConfiguration=!0,p.value.kind!==X.Kind.OBJECT||p.value.fields.length<1){i.push(oe.invalidNatsStreamInputErrorMessage);continue}let E=!0,I=new Set,v=new Set(mp.STREAM_CONFIGURATION_FIELD_NAMES),A=new Set([W.CONSUMER_NAME,W.STREAM_NAME]),U=new Set,j=new Set;for(let $ of p.value.fields){let re=$.name.value;if(!mp.STREAM_CONFIGURATION_FIELD_NAMES.has(re)){I.add(re),E=!1;continue}if(v.has(re))v.delete(re);else{U.add(re),E=!1;continue}switch(A.has(re)&&A.delete(re),re){case W.CONSUMER_NAME:if($.value.kind!=X.Kind.STRING||$.value.value.length<1){j.add(re),E=!1;continue}l=$.value.value;break;case W.STREAM_NAME:if($.value.kind!=X.Kind.STRING||$.value.value.length<1){j.add(re),E=!1;continue}d=$.value.value;break;case W.CONSUMER_INACTIVE_THRESHOLD:if($.value.kind!=X.Kind.INT){i.push((0,oe.invalidArgumentValueErrorMessage)((0,X.print)($.value),"edfs__NatsStreamConfiguration","consumerInactiveThreshold",W.INT_SCALAR)),E=!1;continue}try{c=parseInt($.value.value,10)}catch(te){i.push((0,oe.invalidArgumentValueErrorMessage)((0,X.print)($.value),"edfs__NatsStreamConfiguration","consumerInactiveThreshold",W.INT_SCALAR)),E=!1}break}}(!E||A.size>0)&&i.push((0,oe.invalidNatsStreamInputFieldsErrorMessage)([...A],[...U],[...j],[...I]))}}if(!(i.length>0))return c<0?(c=KE.DEFAULT_CONSUMER_INACTIVE_THRESHOLD,this.warnings.push((0,rs.consumerInactiveThresholdInvalidValueWarning)(this.subgraphName,`The value has been set to ${KE.DEFAULT_CONSUMER_INACTIVE_THRESHOLD}.`))):c>nfe.MAX_INT32&&(c=0,this.warnings.push((0,rs.consumerInactiveThresholdInvalidValueWarning)(this.subgraphName,"The value has been set to 0. This means the consumer will remain indefinitely active until its manual deletion."))),M({fieldName:r,providerId:o,providerType:W.PROVIDER_TYPE_NATS,subjects:a,type:W.SUBSCRIBE},l&&d?{streamConfiguration:{consumerInactiveThreshold:c,consumerName:l,streamName:d}}:{})}getRedisPublishConfiguration(t,n,r,i){let a=[],o=W.DEFAULT_EDFS_PROVIDER_ID;for(let c of t.arguments||[])switch(c.name.value){case W.CHANNEL:{if(c.value.kind!==X.Kind.STRING||c.value.value.length<1){i.push((0,oe.invalidEventSubjectErrorMessage)(W.CHANNEL));continue}(0,ai.validateArgumentTemplateReferences)(c.value.value,n,i),a.push(c.value.value);break}case W.PROVIDER_ID:{if(c.value.kind!==X.Kind.STRING||c.value.value.length<1){i.push(oe.invalidEventProviderIdErrorMessage);continue}o=c.value.value;break}}if(!(i.length>0))return{fieldName:r,providerId:o,providerType:W.PROVIDER_TYPE_REDIS,channels:a,type:W.PUBLISH}}getRedisSubscribeConfiguration(t,n,r,i){let a=[],o=W.DEFAULT_EDFS_PROVIDER_ID;for(let c of t.arguments||[])switch(c.name.value){case W.CHANNELS:{if(c.value.kind!==X.Kind.LIST){i.push((0,oe.invalidEventSubjectsErrorMessage)(W.CHANNELS));continue}for(let l of c.value.values){if(l.kind!==X.Kind.STRING||l.value.length<1){i.push((0,oe.invalidEventSubjectsItemErrorMessage)(W.CHANNELS));break}(0,ai.validateArgumentTemplateReferences)(l.value,n,i),a.push(l.value)}break}case W.PROVIDER_ID:{if(c.value.kind!==X.Kind.STRING||c.value.value.length<1){i.push(oe.invalidEventProviderIdErrorMessage);continue}o=c.value.value;break}}if(!(i.length>0))return{fieldName:r,providerId:o,providerType:W.PROVIDER_TYPE_REDIS,channels:a,type:W.SUBSCRIBE}}validateSubscriptionFilterDirectiveLocation(t){if(!t.directives)return;let n=this.renamedParentTypeName||this.originalParentTypeName,r=`${n}.${t.name.value}`,i=this.getOperationTypeNodeForRootTypeName(n)===X.OperationTypeNode.SUBSCRIPTION;for(let a of t.directives)if(a.name.value===W.SUBSCRIPTION_FILTER&&!i){this.errors.push((0,oe.invalidSubscriptionFilterLocationError)(r));return}}extractEventDirectivesToConfiguration(t,n){if(!t.directives)return;let r=t.name.value,i=`${this.renamedParentTypeName||this.originalParentTypeName}.${r}`;for(let a of t.directives){let o=[],c;switch(a.name.value){case W.EDFS_KAFKA_PUBLISH:c=this.getKafkaPublishConfiguration(a,n,r,o);break;case W.EDFS_KAFKA_SUBSCRIBE:c=this.getKafkaSubscribeConfiguration(a,n,r,o);break;case W.EDFS_NATS_PUBLISH:{c=this.getNatsPublishAndRequestConfiguration(W.PUBLISH,a,n,r,o);break}case W.EDFS_NATS_REQUEST:{c=this.getNatsPublishAndRequestConfiguration(W.REQUEST,a,n,r,o);break}case W.EDFS_NATS_SUBSCRIBE:{c=this.getNatsSubscribeConfiguration(a,n,r,o);break}case W.EDFS_REDIS_PUBLISH:{c=this.getRedisPublishConfiguration(a,n,r,o);break}case W.EDFS_REDIS_SUBSCRIBE:{c=this.getRedisSubscribeConfiguration(a,n,r,o);break}default:continue}if(o.length>0){this.errors.push((0,oe.invalidEventDirectiveError)(a.name.value,i,o));continue}c&&(0,je.getValueOrDefault)(this.eventsConfigurations,this.renamedParentTypeName||this.originalParentTypeName,()=>[]).push(c)}}getValidEventsDirectiveNamesForOperationTypeNode(t){switch(t){case X.OperationTypeNode.MUTATION:return new Set([W.EDFS_KAFKA_PUBLISH,W.EDFS_NATS_PUBLISH,W.EDFS_NATS_REQUEST,W.EDFS_REDIS_PUBLISH]);case X.OperationTypeNode.QUERY:return new Set([W.EDFS_NATS_REQUEST]);case X.OperationTypeNode.SUBSCRIPTION:return new Set([W.EDFS_KAFKA_SUBSCRIBE,W.EDFS_NATS_SUBSCRIBE,W.EDFS_REDIS_SUBSCRIBE])}}getOperationTypeNodeForRootTypeName(t){let n=this.operationTypeNodeByTypeName.get(t);if(n)return n;switch(t){case W.MUTATION:return X.OperationTypeNode.MUTATION;case W.QUERY:return X.OperationTypeNode.QUERY;case W.SUBSCRIPTION:return X.OperationTypeNode.SUBSCRIPTION;default:return}}validateEventDrivenRootType(t,n,r,i){let a=this.getOperationTypeNodeForRootTypeName(t.name);if(!a){this.errors.push((0,oe.invalidRootTypeError)(t.name));return}let o=this.getValidEventsDirectiveNamesForOperationTypeNode(a);for(let[c,l]of t.fieldDataByName){let d=`${l.originalParentTypeName}.${c}`,p=new Set;for(let j of mp.EVENT_DIRECTIVE_NAMES)l.directivesByDirectiveName.has(j)&&p.add(j);let E=new Set;for(let j of p)o.has(j)||E.add(j);if((p.size<1||E.size>0)&&n.set(d,{definesDirectives:p.size>0,invalidDirectiveNames:[...E]}),a===X.OperationTypeNode.MUTATION){let j=(0,yi.printTypeNode)(l.type);j!==W.NON_NULLABLE_EDFS_PUBLISH_EVENT_RESULT&&i.set(d,j);continue}let I=(0,yi.printTypeNode)(l.type),v=l.namedTypeName+"!",A=!1,U=this.concreteTypeNamesByAbstractTypeName.get(l.namedTypeName)||new Set([l.namedTypeName]);for(let j of U)if(A||(A=this.entityDataByTypeName.has(j)),A)break;(!A||I!==v)&&r.set(d,I)}}validateEventDrivenKeyDefinition(t,n){let r=this.keyFieldSetDatasByTypeName.get(t);if(r)for(let[i,{isUnresolvable:a}]of r)a||(0,je.getValueOrDefault)(n,t,()=>[]).push(i)}validateEventDrivenObjectFields(t,n,r,i){var a;for(let[o,c]of t){let l=`${c.originalParentTypeName}.${o}`;if(n.has(o)){(a=c.externalFieldDataBySubgraphName.get(this.subgraphName))!=null&&a.isDefinedExternal||r.set(l,o);continue}i.set(l,o)}}isEdfsPublishResultValid(){let t=this.parentDefinitionDataByTypeName.get(W.EDFS_PUBLISH_RESULT);if(!t)return!0;if(t.kind!==X.Kind.OBJECT_TYPE_DEFINITION||t.fieldDataByName.size!=1)return!1;for(let[n,r]of t.fieldDataByName)if(r.argumentDataByName.size>0||n!==W.SUCCESS||(0,yi.printTypeNode)(r.type)!==W.NON_NULLABLE_BOOLEAN)return!1;return!0}isNatsStreamConfigurationInputObjectValid(t){if(!(0,nn.isInputObjectDefinitionData)(t)||t.inputValueDataByName.size!=3)return!1;for(let[n,r]of t.inputValueDataByName)switch(n){case W.CONSUMER_INACTIVE_THRESHOLD:{if((0,yi.printTypeNode)(r.type)!==W.NON_NULLABLE_INT||!r.defaultValue||r.defaultValue.kind!==X.Kind.INT||r.defaultValue.value!==`${KE.DEFAULT_CONSUMER_INACTIVE_THRESHOLD}`)return!1;break}case W.CONSUMER_NAME:case W.STREAM_NAME:{if((0,yi.printTypeNode)(r.type)!==W.NON_NULLABLE_STRING)return!1;break}default:return!1}return!0}validateEventDrivenSubgraph(){let t=[],n=new Map,r=new Map,i=new Map,a=new Map,o=new Map,c=new Map,l=new Set,d=new Set;for(let[p,E]of this.parentDefinitionDataByTypeName){if(p===W.EDFS_PUBLISH_RESULT||p===W.EDFS_NATS_STREAM_CONFIGURATION||E.kind!==X.Kind.OBJECT_TYPE_DEFINITION)continue;if(E.isRootType){this.validateEventDrivenRootType(E,n,r,i);continue}let I=this.keyFieldNamesByParentTypeName.get(p);if(!I){d.add(p);continue}this.validateEventDrivenKeyDefinition(p,a),this.validateEventDrivenObjectFields(E.fieldDataByName,I,o,c)}if(this.isEdfsPublishResultValid()||t.push(oe.invalidEdfsPublishResultObjectErrorMessage),this.edfsDirectiveReferences.has(W.EDFS_NATS_SUBSCRIBE)){let p=this.parentDefinitionDataByTypeName.get(W.EDFS_NATS_STREAM_CONFIGURATION);p&&this.usesEdfsNatsStreamConfiguration&&!this.isNatsStreamConfigurationInputObjectValid(p)&&t.push(oe.invalidNatsStreamConfigurationDefinitionErrorMessage),this.parentDefinitionDataByTypeName.delete(W.EDFS_NATS_STREAM_CONFIGURATION);let E=this.upsertInputObjectByNode(aV.EDFS_NATS_STREAM_CONFIGURATION_DEFINITION);if(E.success)for(let I of aV.EDFS_NATS_STREAM_CONFIGURATION_DEFINITION.fields)this.addInputValueDataByNode({fieldName:I.name.value,isArgument:!1,inputValueDataByName:E.data.inputValueDataByName,node:I,originalParentTypeName:W.EDFS_NATS_STREAM_CONFIGURATION});else return}n.size>0&&t.push((0,oe.invalidRootTypeFieldEventsDirectivesErrorMessage)(n)),i.size>0&&t.push((0,oe.invalidEventDrivenMutationResponseTypeErrorMessage)(i)),r.size>0&&t.push((0,oe.invalidRootTypeFieldResponseTypesEventDrivenErrorMessage)(r)),a.size>0&&t.push((0,oe.invalidKeyFieldSetsEventDrivenErrorMessage)(a)),o.size>0&&t.push((0,oe.nonExternalKeyFieldNamesEventDrivenErrorMessage)(o)),c.size>0&&t.push((0,oe.nonKeyFieldNamesEventDrivenErrorMessage)(c)),l.size>0&&t.push((0,oe.nonEntityObjectExtensionsEventDrivenErrorMessage)([...l])),d.size>0&&t.push((0,oe.nonKeyComposingObjectTypeNamesEventDrivenErrorMessage)([...d])),t.length>0&&this.errors.push((0,oe.invalidEventDrivenGraphError)(t))}validateUnionMembers(t){if(t.memberByMemberTypeName.size<1){this.errors.push((0,oe.noDefinedUnionMembersError)(t.name));return}let n=[];for(let r of t.memberByMemberTypeName.keys()){let i=this.parentDefinitionDataByTypeName.get(r);i&&i.kind!==X.Kind.OBJECT_TYPE_DEFINITION&&n.push(`"${r}", which is type "${(0,je.kindToNodeType)(i.kind)}"`)}n.length>0&&this.errors.push((0,oe.invalidUnionMemberTypeError)(t.name,n))}addConcreteTypeNamesForUnion(t){if(!t.types||t.types.length<1)return;let n=t.name.value;for(let r of t.types){let i=r.name.value;(0,je.getValueOrDefault)(this.concreteTypeNamesByAbstractTypeName,n,()=>new Set).add(i),this.internalGraph.addEdge(this.internalGraph.addOrUpdateNode(n,{isAbstract:!0}),this.internalGraph.addOrUpdateNode(i),i,!0)}}addValidKeyFieldSetConfigurations(){for(let[t,n]of this.keyFieldSetDatasByTypeName){let r=this.parentDefinitionDataByTypeName.get(t);if(!r||r.kind!==X.Kind.OBJECT_TYPE_DEFINITION&&r.kind!==X.Kind.INTERFACE_TYPE_DEFINITION){this.errors.push((0,oe.undefinedCompositeOutputTypeError)(t));continue}let i=(0,nn.getParentTypeName)(r),a=(0,je.getValueOrDefault)(this.configurationDataByTypeName,i,()=>(0,Np.newConfigurationData)(!0,i)),o=(0,ai.validateKeyFieldSets)(this,r,n);o&&(a.keys=o)}}getValidFlattenedDirectiveArray(t,n,r=!1){let i=[];for(let[a,o]of t){if(r&&W.INHERITABLE_DIRECTIVE_NAMES.has(a))continue;let c=this.directiveDefinitionDataByName.get(a);if(!c)continue;if(!c.isRepeatable&&o.length>1){let p=(0,je.getValueOrDefault)(this.invalidRepeatedDirectiveNameByCoords,n,()=>new Set);p.has(a)||(p.add(a),this.errors.push((0,oe.invalidDirectiveError)(a,n,"1st",[(0,oe.invalidRepeatedDirectiveErrorMessage)(a)])));continue}if(a!==W.KEY){i.push(...o);continue}let l=[],d=new Set;for(let p=0;pnew Set).add(U)),(0,je.getValueOrDefault)(a.keyFieldNamesByParentTypeName,v,()=>new Set).add(A);let re=(0,cr.getTypeNodeNamedTypeName)(j.node.type);if(jr.BASE_SCALARS.has(re))return;let te=a.parentDefinitionDataByTypeName.get(re);if(!te)return X.BREAK;if(te.kind===X.Kind.OBJECT_TYPE_DEFINITION){p=!0,c.push(te);return}if((0,gn.isKindAbstract)(te.kind))return X.BREAK}},InlineFragment:{enter(){return X.BREAK}},SelectionSet:{enter(){if(!p||(d+=1,p=!1,d<0||d>=c.length))return X.BREAK},leave(){p&&(p=!1),d-=1,c.pop()}}}),!(l.size<1))for(let[E,I]of l)this.warnings.push((0,rs.externalEntityExtensionKeyFieldWarning)(i.name,E,[...I],this.subgraphName))}}for(let n of t)this.keyFieldSetDatasByTypeName.delete(n)}addValidConditionalFieldSetConfigurations(){for(let[t,n]of this.fieldSetDataByTypeName){let r=this.parentDefinitionDataByTypeName.get(t);if(!r||r.kind!==X.Kind.OBJECT_TYPE_DEFINITION&&r.kind!==X.Kind.INTERFACE_TYPE_DEFINITION){this.errors.push((0,oe.undefinedCompositeOutputTypeError)(t));continue}let i=(0,nn.getParentTypeName)(r),a=(0,je.getValueOrDefault)(this.configurationDataByTypeName,i,()=>(0,Np.newConfigurationData)(!1,i)),o=this.validateProvidesOrRequires(r,n.provides,!0);o&&(a.provides=o);let c=this.validateProvidesOrRequires(r,n.requires,!1);c&&(a.requires=c)}}addFieldNamesToConfigurationData(t,n){let r=new Set;for(let[i,a]of t){let o=a.externalFieldDataBySubgraphName.get(this.subgraphName);if(!o||o.isUnconditionallyProvided){n.fieldNames.add(i);continue}r.add(i),this.edfsDirectiveReferences.size>0&&n.fieldNames.add(i)}r.size>0&&(n.externalFieldNames=r)}validateOneOfDirective({data:t,requiredFieldNames:n}){var r,i;return t.directivesByDirectiveName.has(W.ONE_OF)?n.size>0?(this.errors.push((0,oe.oneOfRequiredFieldsError)({requiredFieldNames:Array.from(n),typeName:t.name})),!1):(t.inputValueDataByName.size===1&&this.warnings.push((0,rs.singleSubgraphInputFieldOneOfWarning)({fieldName:(i=(r=(0,je.getFirstEntry)(t.inputValueDataByName))==null?void 0:r.name)!=null?i:"unknown",subgraphName:this.subgraphName,typeName:t.name})),!0):!0}normalize(t){var o;(0,iV.upsertDirectiveSchemaAndEntityDefinitions)(this,t),(0,iV.upsertParentsAndChildren)(this,t);let n=[];Ud(this,GE,oV).call(this,n),this.validateDirectives(this.schemaData,W.SCHEMA);let r=Ud(this,$E,uV).call(this,n);for(let[c,l]of this.parentDefinitionDataByTypeName)this.validateDirectives(l,c);this.invalidORScopesCoords.size>0&&this.errors.push((0,oe.orScopesLimitError)(jr.MAX_OR_SCOPES,[...this.invalidORScopesCoords]));for(let c of this.invalidConfigureDescriptionNodeDatas)c.description||this.errors.push((0,oe.configureDescriptionNoDescriptionError)((0,je.kindToNodeType)(c.kind),c.name));this.evaluateExternalKeyFields();for(let[c,l]of this.parentDefinitionDataByTypeName)switch(l.kind){case X.Kind.ENUM_TYPE_DEFINITION:{if(l.enumValueDataByName.size<1){this.errors.push((0,oe.noDefinedEnumValuesError)(c));break}n.push(this.getEnumNodeByData(l));break}case X.Kind.INPUT_OBJECT_TYPE_DEFINITION:{if(l.inputValueDataByName.size<1){this.errors.push((0,oe.noInputValueDefinitionsError)(c));break}let d=new Set;for(let p of l.inputValueDataByName.values()){if((0,nn.isTypeRequired)(p.type)&&d.add(p.name),p.namedTypeKind!==X.Kind.NULL)continue;let E=this.parentDefinitionDataByTypeName.get(p.namedTypeName);if(E){if(!(0,nn.isInputNodeKind)(E.kind)){this.errors.push((0,oe.invalidNamedTypeError)({data:p,namedTypeData:E,nodeType:`${(0,je.kindToNodeType)(l.kind)} field`}));continue}p.namedTypeKind=E.kind}}if(!this.validateOneOfDirective({data:l,requiredFieldNames:d}))break;c!==W.EDFS_NATS_STREAM_CONFIGURATION&&n.push(this.getInputObjectNodeByData(l));break}case X.Kind.INTERFACE_TYPE_DEFINITION:case X.Kind.OBJECT_TYPE_DEFINITION:{let d=this.entityDataByTypeName.has(c),p=this.operationTypeNodeByTypeName.get(c),E=l.kind===X.Kind.OBJECT_TYPE_DEFINITION;this.isSubgraphVersionTwo&&l.extensionType===ns.ExtensionType.EXTENDS&&(l.extensionType=ns.ExtensionType.NONE),p&&(l.fieldDataByName.delete(W.SERVICE_FIELD),l.fieldDataByName.delete(W.ENTITIES_FIELD));let I=[];for(let[$,re]of l.fieldDataByName){if(!E&&((o=re.externalFieldDataBySubgraphName.get(this.subgraphName))!=null&&o.isDefinedExternal)&&I.push($),this.validateArguments(re,l.kind),re.namedTypeKind!==X.Kind.NULL)continue;let te=this.parentDefinitionDataByTypeName.get(re.namedTypeName);if(te){if(!(0,nn.isOutputNodeKind)(te.kind)){this.errors.push((0,oe.invalidNamedTypeError)({data:re,namedTypeData:te,nodeType:`${(0,je.kindToNodeType)(l.kind)} field`}));continue}re.namedTypeKind=this.entityInterfaceDataByTypeName.get(te.name)?X.Kind.INTERFACE_TYPE_DEFINITION:te.kind}}I.length>0&&(this.isSubgraphVersionTwo?this.errors.push((0,oe.externalInterfaceFieldsError)(c,I)):this.warnings.push((0,rs.externalInterfaceFieldsWarning)(this.subgraphName,c,I)));let v=(0,nn.getParentTypeName)(l),A=(0,je.getValueOrDefault)(this.configurationDataByTypeName,v,()=>(0,Np.newConfigurationData)(d,c)),U=this.entityInterfaceDataByTypeName.get(c);if(U){U.fieldDatas=(0,Zn.fieldDatasToSimpleFieldDatas)(l.fieldDataByName.values());let $=this.concreteTypeNamesByAbstractTypeName.get(c);$&&(0,je.addIterableToSet)({source:$,target:U.concreteTypeNames}),A.isInterfaceObject=U.isInterfaceObject,A.entityInterfaceConcreteTypeNames=U.concreteTypeNames}let j=this.eventsConfigurations.get(v);j&&(A.events=j),this.addFieldNamesToConfigurationData(l.fieldDataByName,A),this.validateInterfaceImplementations(l),n.push(this.getCompositeOutputNodeByData(l)),l.fieldDataByName.size<1&&!(0,ai.isNodeQuery)(c,p)&&this.errors.push((0,oe.noFieldDefinitionsError)((0,je.kindToNodeType)(l.kind),c)),l.requireFetchReasonsFieldNames.size>0&&(A.requireFetchReasonsFieldNames=[...l.requireFetchReasonsFieldNames]);break}case X.Kind.SCALAR_TYPE_DEFINITION:{if(l.extensionType===ns.ExtensionType.REAL){this.errors.push((0,oe.noBaseScalarDefinitionError)(c));break}n.push(this.getScalarNodeByData(l));break}case X.Kind.UNION_TYPE_DEFINITION:{n.push(this.getUnionNodeByData(l)),this.validateUnionMembers(l);break}default:throw(0,oe.unexpectedKindFatalError)(c)}this.addValidConditionalFieldSetConfigurations(),this.addValidKeyFieldSetConfigurations();for(let c of Object.values(X.OperationTypeNode)){let l=this.schemaData.operationTypes.get(c),d=(0,je.getOrThrowError)(gn.operationTypeNodeToDefaultType,c,W.OPERATION_TO_DEFAULT),p=l?(0,cr.getTypeNodeNamedTypeName)(l.type):d;if(jr.BASE_SCALARS.has(p)&&this.referencedTypeNames.add(p),p!==d&&this.parentDefinitionDataByTypeName.has(d)){this.errors.push((0,oe.invalidRootTypeDefinitionError)(c,p,d));continue}let E=this.parentDefinitionDataByTypeName.get(p);if(l){if(!E)continue;this.operationTypeNodeByTypeName.set(p,c)}if(!E)continue;let I=this.configurationDataByTypeName.get(d);I&&(I.isRootNode=!0,I.typeName=d),E.kind!==X.Kind.OBJECT_TYPE_DEFINITION&&this.errors.push((0,oe.operationDefinitionError)(p,c,E.kind))}for(let c of this.referencedTypeNames){let l=this.parentDefinitionDataByTypeName.get(c);if(!l){this.errors.push((0,oe.undefinedTypeError)(c));continue}if(l.kind!==X.Kind.INTERFACE_TYPE_DEFINITION)continue;let d=this.concreteTypeNamesByAbstractTypeName.get(c);(!d||d.size<1)&&this.warnings.push((0,rs.unimplementedInterfaceOutputTypeWarning)(this.subgraphName,c))}let i=new Map;for(let c of this.directiveDefinitionByName.values()){let l=(0,gn.extractExecutableDirectiveLocations)(c.locations,new Set);l.size<1||this.addPersistedDirectiveDefinitionDataByNode(i,c,l)}this.isSubgraphEventDrivenGraph=this.edfsDirectiveReferences.size>0,this.isSubgraphEventDrivenGraph&&this.validateEventDrivenSubgraph();for(let c of this.unvalidatedExternalFieldCoords)this.isSubgraphVersionTwo?this.errors.push((0,oe.invalidExternalDirectiveError)(c)):this.warnings.push((0,rs.invalidExternalFieldWarning)(c,this.subgraphName));if(this.errors.length>0)return{success:!1,errors:this.errors,warnings:this.warnings};let a={kind:X.Kind.DOCUMENT,definitions:n};return{authorizationDataByParentTypeName:this.authorizationDataByParentTypeName,concreteTypeNamesByAbstractTypeName:this.concreteTypeNamesByAbstractTypeName,conditionalFieldDataByCoordinates:this.conditionalFieldDataByCoords,configurationDataByTypeName:this.configurationDataByTypeName,directiveDefinitionByName:this.directiveDefinitionByName,entityDataByTypeName:this.entityDataByTypeName,entityInterfaces:this.entityInterfaceDataByTypeName,fieldCoordsByNamedTypeName:this.fieldCoordsByNamedTypeName,isEventDrivenGraph:this.isSubgraphEventDrivenGraph,isVersionTwo:this.isSubgraphVersionTwo,keyFieldNamesByParentTypeName:this.keyFieldNamesByParentTypeName,keyFieldSetsByEntityTypeNameByKeyFieldCoords:this.keyFieldSetsByEntityTypeNameByFieldCoords,operationTypes:this.operationTypeNodeByTypeName,originalTypeNameByRenamedTypeName:this.originalTypeNameByRenamedTypeName,overridesByTargetSubgraphName:this.overridesByTargetSubgraphName,parentDefinitionDataByTypeName:this.parentDefinitionDataByTypeName,persistedDirectiveDefinitionDataByDirectiveName:i,schemaNode:r,subgraphAST:a,subgraphString:(0,X.print)(a),schema:(0,efe.buildASTSchema)(a,{addInvalidExtensionOrphans:!0,assumeValid:!0,assumeValidSDL:!0}),success:!0,warnings:this.warnings}}};GE=new WeakSet,oV=function(t){let n=new Set;for(let r of this.referencedDirectiveNames){let i=jr.DIRECTIVE_DEFINITION_BY_NAME.get(r);i&&(this.directiveDefinitionByName.set(r,i),(0,je.addOptionalIterableToSet)({source:mp.DEPENDENCIES_BY_DIRECTIVE_NAME.get(r),target:n}),t.push(i))}for(let r of this.customDirectiveDefinitionByName.values())t.push(r);t.push(...n)},$E=new WeakSet,uV=function(t){var r;let n=this.getSchemaNodeByData(this.schemaData);if(n.operationTypes.length>0)return t.push(n),n;if((r=n.directives)!=null&&r.length)return{directives:n.directives,kind:X.Kind.SCHEMA_EXTENSION}};Lc.NormalizationFactory=Tp;function ife(e){let t=new Map,n=new Map,r=new Map,i=new Map,a=new Map,o=new Map,c=new Set,l=new Map,d=new Set,p=new Set,E=[],I=new Set,v=new Map,A=[],U=[];for(let re of e)re.name&&(0,tfe.recordSubgraphName)(re.name,d,p);let j=new tb.Graph;for(let re=0;re0&&A.push(...ue.warnings),!ue.success){U.push((0,oe.subgraphValidationError)(me,ue.errors));continue}if(!ue){U.push((0,oe.subgraphValidationError)(me,[oe.subgraphValidationFailureError]));continue}l.set(me,ue.parentDefinitionDataByTypeName);for(let Ae of ue.authorizationDataByParentTypeName.values())(0,Zn.upsertAuthorizationData)(t,Ae,I);for(let[Ae,xe]of ue.fieldCoordsByNamedTypeName)(0,je.addIterableToSet)({source:xe,target:(0,je.getValueOrDefault)(v,Ae,()=>new Set)});for(let[Ae,xe]of ue.concreteTypeNamesByAbstractTypeName){let rt=n.get(Ae);if(!rt){n.set(Ae,new Set(xe));continue}(0,je.addIterableToSet)({source:xe,target:rt})}for(let[Ae,xe]of ue.entityDataByTypeName){let rt=xe.keyFieldSetDatasBySubgraphName.get(me);rt&&(0,Zn.upsertEntityData)({entityDataByTypeName:r,keyFieldSetDataByFieldSet:rt,typeName:Ae,subgraphName:me})}if(te.name&&i.set(me,{conditionalFieldDataByCoordinates:ue.conditionalFieldDataByCoordinates,configurationDataByTypeName:ue.configurationDataByTypeName,definitions:ue.subgraphAST,directiveDefinitionByName:ue.directiveDefinitionByName,entityInterfaces:ue.entityInterfaces,isVersionTwo:ue.isVersionTwo,keyFieldNamesByParentTypeName:ue.keyFieldNamesByParentTypeName,name:me,operationTypes:ue.operationTypes,overriddenFieldNamesByParentTypeName:new Map,parentDefinitionDataByTypeName:ue.parentDefinitionDataByTypeName,persistedDirectiveDefinitionDataByDirectiveName:ue.persistedDirectiveDefinitionDataByDirectiveName,schema:ue.schema,url:te.url}),!(ue.overridesByTargetSubgraphName.size<1))for(let[Ae,xe]of ue.overridesByTargetSubgraphName){let rt=d.has(Ae);for(let[Z,_e]of xe){let _t=ue.originalTypeNameByRenamedTypeName.get(Z)||Z;if(!rt)A.push((0,rs.invalidOverrideTargetSubgraphNameWarning)(Ae,_t,[..._e],te.name));else{let rn=(0,je.getValueOrDefault)(a,Ae,()=>new Map),an=(0,je.getValueOrDefault)(rn,Z,()=>new Set(_e));(0,je.addIterableToSet)({source:_e,target:an})}for(let rn of _e){let an=`${_t}.${rn}`,Fn=o.get(an);if(!Fn){o.set(an,[me]);continue}Fn.push(me),c.add(an)}}}}let $=[];if(I.size>0&&$.push((0,oe.orScopesLimitError)(jr.MAX_OR_SCOPES,[...I])),(E.length>0||p.size>0)&&$.push((0,oe.invalidSubgraphNamesError)([...p],E)),c.size>0){let re=[];for(let te of c){let me=(0,je.getOrThrowError)(o,te,"overrideSourceSubgraphNamesByFieldPath");re.push((0,oe.duplicateOverriddenFieldErrorMessage)(te,me))}$.push((0,oe.duplicateOverriddenFieldsError)(re))}if($.push(...U),$.length>0)return{errors:$,success:!1,warnings:A};for(let[re,te]of a){let me=(0,je.getOrThrowError)(i,re,"internalSubgraphBySubgraphName");me.overriddenFieldNamesByParentTypeName=te;for(let[ue,Ae]of te){let xe=me.configurationDataByTypeName.get(ue);xe&&((0,Zn.subtractSet)(Ae,xe.fieldNames),xe.fieldNames.size<1&&me.configurationDataByTypeName.delete(ue))}}return{authorizationDataByParentTypeName:t,concreteTypeNamesByAbstractTypeName:n,entityDataByTypeName:r,fieldCoordsByNamedTypeName:v,internalSubgraphBySubgraphName:i,internalGraph:j,success:!0,warnings:A}}});var QE=w(Uc=>{"use strict";m();T();N();Object.defineProperty(Uc,"__esModule",{value:!0});Uc.DivergentType=void 0;Uc.getLeastRestrictiveMergedTypeNode=sfe;Uc.getMostRestrictiveMergedTypeNode=ofe;Uc.renameNamedTypeName=ufe;var Cc=Oe(),lV=qi(),afe=yu(),cV=Ar(),dV=Fl(),Bc;(function(e){e[e.NONE=0]="NONE",e[e.CURRENT=1]="CURRENT",e[e.OTHER=2]="OTHER"})(Bc||(Uc.DivergentType=Bc={}));function fV(e,t,n,r,i){t=(0,afe.getMutableTypeNode)(t,n,i);let a={kind:e.kind},o=Bc.NONE,c=a;for(let l=0;l{"use strict";m();T();N();Object.defineProperty(ib,"__esModule",{value:!0});ib.renameRootTypes=dfe;var cfe=Oe(),rb=Ar(),lfe=QE(),Pu=sr(),kc=Rr();function dfe(e,t){let n,r=!1,i;(0,cfe.visit)(t.definitions,{FieldDefinition:{enter(a){let o=a.name.value;if(r&&(o===Pu.SERVICE_FIELD||o===Pu.ENTITIES_FIELD))return n.fieldDataByName.delete(o),!1;let c=n.name,l=(0,kc.getOrThrowError)(n.fieldDataByName,o,`${c}.fieldDataByFieldName`),d=t.operationTypes.get(l.namedTypeName);if(d){let p=(0,kc.getOrThrowError)(rb.operationTypeNodeToDefaultType,d,Pu.OPERATION_TO_DEFAULT);l.namedTypeName!==p&&(0,lfe.renameNamedTypeName)(l,p,e.errors)}return i!=null&&i.has(o)&&l.isShareableBySubgraphName.delete(t.name),!1}},InterfaceTypeDefinition:{enter(a){let o=a.name.value;if(!e.entityInterfaceFederationDataByTypeName.get(o))return!1;n=(0,kc.getOrThrowError)(t.parentDefinitionDataByTypeName,o,Pu.PARENT_DEFINITION_DATA)},leave(){n=void 0}},ObjectTypeDefinition:{enter(a){let o=a.name.value,c=t.operationTypes.get(o),l=c?(0,kc.getOrThrowError)(rb.operationTypeNodeToDefaultType,c,Pu.OPERATION_TO_DEFAULT):o;n=(0,kc.getOrThrowError)(t.parentDefinitionDataByTypeName,o,Pu.PARENT_DEFINITION_DATA),r=n.isRootType,!e.entityInterfaceFederationDataByTypeName.get(o)&&(e.addValidPrimaryKeyTargetsToEntityData(o),i=t.overriddenFieldNamesByParentTypeName.get(l),o!==l&&(n.name=l,t.parentDefinitionDataByTypeName.set(l,n),t.parentDefinitionDataByTypeName.delete(o)))},leave(){n=void 0,r=!1,i=void 0}},ObjectTypeExtension:{enter(a){let o=a.name.value,c=t.operationTypes.get(o),l=c?(0,kc.getOrThrowError)(rb.operationTypeNodeToDefaultType,c,Pu.OPERATION_TO_DEFAULT):o;n=(0,kc.getOrThrowError)(t.parentDefinitionDataByTypeName,o,Pu.PARENT_DEFINITION_DATA),r=n.isRootType,e.addValidPrimaryKeyTargetsToEntityData(o),i=t.overriddenFieldNamesByParentTypeName.get(o),o!==l&&(n.name=l,t.parentDefinitionDataByTypeName.set(l,n),t.parentDefinitionDataByTypeName.delete(o))},leave(){n=void 0,r=!1,i=void 0}}})}});var pV=w((ud,Ep)=>{"use strict";m();T();N();(function(){var e,t="4.17.21",n=200,r="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",a="Invalid `variable` option passed into `_.template`",o="__lodash_hash_undefined__",c=500,l="__lodash_placeholder__",d=1,p=2,E=4,I=1,v=2,A=1,U=2,j=4,$=8,re=16,te=32,me=64,ue=128,Ae=256,xe=512,rt=30,Z="...",_e=800,_t=16,rn=1,an=2,Fn=3,$t=1/0,Tn=9007199254740991,Cr=17976931348623157e292,Br=NaN,xn=4294967295,Ht=xn-1,wn=xn>>>1,ae=[["ary",ue],["bind",A],["bindKey",U],["curry",$],["curryRight",re],["flip",xe],["partial",te],["partialRight",me],["rearg",Ae]],De="[object Arguments]",Ie="[object Array]",Ce="[object AsyncFunction]",Ot="[object Boolean]",Y="[object Date]",ie="[object DOMException]",qe="[object Error]",Je="[object Function]",Bt="[object GeneratorFunction]",it="[object Map]",Pt="[object Number]",us="[object Null]",Qr="[object Object]",cs="[object Promise]",Hc="[object Proxy]",Pa="[object RegExp]",hr="[object Set]",si="[object String]",xt="[object Symbol]",yr="[object Undefined]",Bu="[object WeakMap]",Fa="[object WeakSet]",Uu="[object ArrayBuffer]",P="[object DataView]",y="[object Float32Array]",g="[object Float64Array]",B="[object Int8Array]",K="[object Int16Array]",ee="[object Int32Array]",ce="[object Uint8Array]",Tt="[object Uint8ClampedArray]",En="[object Uint16Array]",un="[object Uint32Array]",_n=/\b__p \+= '';/g,sn=/\b(__p \+=) '' \+/g,Jj=/(__e\(.*?\)|\b__t\)) \+\n'';/g,s0=/&(?:amp|lt|gt|quot|#39);/g,o0=/[&<>"']/g,Hj=RegExp(s0.source),zj=RegExp(o0.source),Wj=/<%-([\s\S]+?)%>/g,Xj=/<%([\s\S]+?)%>/g,u0=/<%=([\s\S]+?)%>/g,Zj=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,eK=/^\w*$/,tK=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bh=/[\\^$.*+?()[\]{}|]/g,nK=RegExp(bh.source),Ah=/^\s+/,rK=/\s/,iK=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,aK=/\{\n\/\* \[wrapped with (.+)\] \*/,sK=/,? & /,oK=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,uK=/[()=,{}\[\]\/\s]/,cK=/\\(\\)?/g,lK=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,c0=/\w*$/,dK=/^[-+]0x[0-9a-f]+$/i,fK=/^0b[01]+$/i,pK=/^\[object .+?Constructor\]$/,mK=/^0o[0-7]+$/i,NK=/^(?:0|[1-9]\d*)$/,TK=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,jp=/($^)/,EK=/['\n\r\u2028\u2029\\]/g,Kp="\\ud800-\\udfff",hK="\\u0300-\\u036f",yK="\\ufe20-\\ufe2f",IK="\\u20d0-\\u20ff",l0=hK+yK+IK,d0="\\u2700-\\u27bf",f0="a-z\\xdf-\\xf6\\xf8-\\xff",gK="\\xac\\xb1\\xd7\\xf7",_K="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",vK="\\u2000-\\u206f",OK=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",p0="A-Z\\xc0-\\xd6\\xd8-\\xde",m0="\\ufe0e\\ufe0f",N0=gK+_K+vK+OK,Rh="['\u2019]",SK="["+Kp+"]",T0="["+N0+"]",Gp="["+l0+"]",E0="\\d+",DK="["+d0+"]",h0="["+f0+"]",y0="[^"+Kp+N0+E0+d0+f0+p0+"]",Ph="\\ud83c[\\udffb-\\udfff]",bK="(?:"+Gp+"|"+Ph+")",I0="[^"+Kp+"]",Fh="(?:\\ud83c[\\udde6-\\uddff]){2}",wh="[\\ud800-\\udbff][\\udc00-\\udfff]",zc="["+p0+"]",g0="\\u200d",_0="(?:"+h0+"|"+y0+")",AK="(?:"+zc+"|"+y0+")",v0="(?:"+Rh+"(?:d|ll|m|re|s|t|ve))?",O0="(?:"+Rh+"(?:D|LL|M|RE|S|T|VE))?",S0=bK+"?",D0="["+m0+"]?",RK="(?:"+g0+"(?:"+[I0,Fh,wh].join("|")+")"+D0+S0+")*",PK="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",FK="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",b0=D0+S0+RK,wK="(?:"+[DK,Fh,wh].join("|")+")"+b0,LK="(?:"+[I0+Gp+"?",Gp,Fh,wh,SK].join("|")+")",CK=RegExp(Rh,"g"),BK=RegExp(Gp,"g"),Lh=RegExp(Ph+"(?="+Ph+")|"+LK+b0,"g"),UK=RegExp([zc+"?"+h0+"+"+v0+"(?="+[T0,zc,"$"].join("|")+")",AK+"+"+O0+"(?="+[T0,zc+_0,"$"].join("|")+")",zc+"?"+_0+"+"+v0,zc+"+"+O0,FK,PK,E0,wK].join("|"),"g"),kK=RegExp("["+g0+Kp+l0+m0+"]"),MK=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xK=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],qK=-1,yn={};yn[y]=yn[g]=yn[B]=yn[K]=yn[ee]=yn[ce]=yn[Tt]=yn[En]=yn[un]=!0,yn[De]=yn[Ie]=yn[Uu]=yn[Ot]=yn[P]=yn[Y]=yn[qe]=yn[Je]=yn[it]=yn[Pt]=yn[Qr]=yn[Pa]=yn[hr]=yn[si]=yn[Bu]=!1;var hn={};hn[De]=hn[Ie]=hn[Uu]=hn[P]=hn[Ot]=hn[Y]=hn[y]=hn[g]=hn[B]=hn[K]=hn[ee]=hn[it]=hn[Pt]=hn[Qr]=hn[Pa]=hn[hr]=hn[si]=hn[xt]=hn[ce]=hn[Tt]=hn[En]=hn[un]=!0,hn[qe]=hn[Je]=hn[Bu]=!1;var VK={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},jK={"&":"&","<":"<",">":">",'"':""","'":"'"},KK={"&":"&","<":"<",">":">",""":'"',"'":"'"},GK={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$K=parseFloat,QK=parseInt,A0=typeof global=="object"&&global&&global.Object===Object&&global,YK=typeof self=="object"&&self&&self.Object===Object&&self,lr=A0||YK||Function("return this")(),Ch=typeof ud=="object"&&ud&&!ud.nodeType&&ud,ku=Ch&&typeof Ep=="object"&&Ep&&!Ep.nodeType&&Ep,R0=ku&&ku.exports===Ch,Bh=R0&&A0.process,Ii=function(){try{var G=ku&&ku.require&&ku.require("util").types;return G||Bh&&Bh.binding&&Bh.binding("util")}catch(se){}}(),P0=Ii&&Ii.isArrayBuffer,F0=Ii&&Ii.isDate,w0=Ii&&Ii.isMap,L0=Ii&&Ii.isRegExp,C0=Ii&&Ii.isSet,B0=Ii&&Ii.isTypedArray;function oi(G,se,ne){switch(ne.length){case 0:return G.call(se);case 1:return G.call(se,ne[0]);case 2:return G.call(se,ne[0],ne[1]);case 3:return G.call(se,ne[0],ne[1],ne[2])}return G.apply(se,ne)}function JK(G,se,ne,Be){for(var dt=-1,Qt=G==null?0:G.length;++dt-1}function Uh(G,se,ne){for(var Be=-1,dt=G==null?0:G.length;++Be-1;);return ne}function K0(G,se){for(var ne=G.length;ne--&&Wc(se,G[ne],0)>-1;);return ne}function rG(G,se){for(var ne=G.length,Be=0;ne--;)G[ne]===se&&++Be;return Be}var iG=qh(VK),aG=qh(jK);function sG(G){return"\\"+GK[G]}function oG(G,se){return G==null?e:G[se]}function Xc(G){return kK.test(G)}function uG(G){return MK.test(G)}function cG(G){for(var se,ne=[];!(se=G.next()).done;)ne.push(se.value);return ne}function Gh(G){var se=-1,ne=Array(G.size);return G.forEach(function(Be,dt){ne[++se]=[dt,Be]}),ne}function G0(G,se){return function(ne){return G(se(ne))}}function Xo(G,se){for(var ne=-1,Be=G.length,dt=0,Qt=[];++ne-1}function zG(s,u){var f=this.__data__,h=um(f,s);return h<0?(++this.size,f.push([s,u])):f[h][1]=u,this}ls.prototype.clear=QG,ls.prototype.delete=YG,ls.prototype.get=JG,ls.prototype.has=HG,ls.prototype.set=zG;function ds(s){var u=-1,f=s==null?0:s.length;for(this.clear();++u=u?s:u)),s}function Oi(s,u,f,h,O,L){var k,V=u&d,J=u&p,le=u&E;if(f&&(k=O?f(s,h,O,L):f(s)),k!==e)return k;if(!Dn(s))return s;var de=ft(s);if(de){if(k=eQ(s),!V)return Yr(s,k)}else{var Te=vr(s),be=Te==Je||Te==Bt;if(au(s))return DA(s,V);if(Te==Qr||Te==De||be&&!O){if(k=J||be?{}:$A(s),!V)return J?K$(s,f$(k,s)):j$(s,nA(k,s))}else{if(!hn[Te])return O?s:{};k=tQ(s,Te,V)}}L||(L=new ra);var $e=L.get(s);if($e)return $e;L.set(s,k),IR(s)?s.forEach(function(et){k.add(Oi(et,u,f,et,s,L))}):hR(s)&&s.forEach(function(et,St){k.set(St,Oi(et,u,f,St,s,L))});var Ze=le?J?Ty:Ny:J?Hr:dr,yt=de?e:Ze(s);return gi(yt||s,function(et,St){yt&&(St=et,et=s[St]),Dd(k,St,Oi(et,u,f,St,s,L))}),k}function p$(s){var u=dr(s);return function(f){return rA(f,s,u)}}function rA(s,u,f){var h=f.length;if(s==null)return!h;for(s=mn(s);h--;){var O=f[h],L=u[O],k=s[O];if(k===e&&!(O in s)||!L(k))return!1}return!0}function iA(s,u,f){if(typeof s!="function")throw new _i(i);return Ld(function(){s.apply(e,f)},u)}function bd(s,u,f,h){var O=-1,L=$p,k=!0,V=s.length,J=[],le=u.length;if(!V)return J;f&&(u=vn(u,ui(f))),h?(L=Uh,k=!1):u.length>=n&&(L=Id,k=!1,u=new qu(u));e:for(;++OO?0:O+f),h=h===e||h>O?O:Et(h),h<0&&(h+=O),h=f>h?0:_R(h);f0&&f(V)?u>1?Ir(V,u-1,f,h,O):Wo(O,V):h||(O[O.length]=V)}return O}var Wh=wA(),oA=wA(!0);function wa(s,u){return s&&Wh(s,u,dr)}function Xh(s,u){return s&&oA(s,u,dr)}function lm(s,u){return zo(u,function(f){return Ts(s[f])})}function ju(s,u){u=ru(u,s);for(var f=0,h=u.length;s!=null&&fu}function T$(s,u){return s!=null&&on.call(s,u)}function E$(s,u){return s!=null&&u in mn(s)}function h$(s,u,f){return s>=_r(u,f)&&s=120&&de.length>=120)?new qu(k&&de):e}de=s[0];var Te=-1,be=V[0];e:for(;++Te-1;)V!==s&&tm.call(V,J,1),tm.call(s,J,1);return s}function hA(s,u){for(var f=s?u.length:0,h=f-1;f--;){var O=u[f];if(f==h||O!==L){var L=O;Ns(O)?tm.call(s,O,1):uy(s,O)}}return s}function ay(s,u){return s+im(X0()*(u-s+1))}function F$(s,u,f,h){for(var O=-1,L=tr(rm((u-s)/(f||1)),0),k=ne(L);L--;)k[h?L:++O]=s,s+=f;return k}function sy(s,u){var f="";if(!s||u<1||u>Tn)return f;do u%2&&(f+=s),u=im(u/2),u&&(s+=s);while(u);return f}function It(s,u){return vy(JA(s,u,zr),s+"")}function w$(s){return tA(ul(s))}function L$(s,u){var f=ul(s);return gm(f,Vu(u,0,f.length))}function Pd(s,u,f,h){if(!Dn(s))return s;u=ru(u,s);for(var O=-1,L=u.length,k=L-1,V=s;V!=null&&++OO?0:O+u),f=f>O?O:f,f<0&&(f+=O),O=u>f?0:f-u>>>0,u>>>=0;for(var L=ne(O);++h>>1,k=s[L];k!==null&&!li(k)&&(f?k<=u:k=n){var le=u?null:Y$(s);if(le)return Yp(le);k=!1,O=Id,J=new qu}else J=u?[]:V;e:for(;++h=h?s:Si(s,u,f)}var SA=OG||function(s){return lr.clearTimeout(s)};function DA(s,u){if(u)return s.slice();var f=s.length,h=Y0?Y0(f):new s.constructor(f);return s.copy(h),h}function fy(s){var u=new s.constructor(s.byteLength);return new Zp(u).set(new Zp(s)),u}function M$(s,u){var f=u?fy(s.buffer):s.buffer;return new s.constructor(f,s.byteOffset,s.byteLength)}function x$(s){var u=new s.constructor(s.source,c0.exec(s));return u.lastIndex=s.lastIndex,u}function q$(s){return Sd?mn(Sd.call(s)):{}}function bA(s,u){var f=u?fy(s.buffer):s.buffer;return new s.constructor(f,s.byteOffset,s.length)}function AA(s,u){if(s!==u){var f=s!==e,h=s===null,O=s===s,L=li(s),k=u!==e,V=u===null,J=u===u,le=li(u);if(!V&&!le&&!L&&s>u||L&&k&&J&&!V&&!le||h&&k&&J||!f&&J||!O)return 1;if(!h&&!L&&!le&&s=V)return J;var le=f[h];return J*(le=="desc"?-1:1)}}return s.index-u.index}function RA(s,u,f,h){for(var O=-1,L=s.length,k=f.length,V=-1,J=u.length,le=tr(L-k,0),de=ne(J+le),Te=!h;++V1?f[O-1]:e,k=O>2?f[2]:e;for(L=s.length>3&&typeof L=="function"?(O--,L):e,k&&kr(f[0],f[1],k)&&(L=O<3?e:L,O=1),u=mn(u);++h-1?O[L?u[k]:k]:e}}function BA(s){return ms(function(u){var f=u.length,h=f,O=vi.prototype.thru;for(s&&u.reverse();h--;){var L=u[h];if(typeof L!="function")throw new _i(i);if(O&&!k&&ym(L)=="wrapper")var k=new vi([],!0)}for(h=k?h:f;++h1&&Ft.reverse(),de&&JV))return!1;var le=L.get(s),de=L.get(u);if(le&&de)return le==u&&de==s;var Te=-1,be=!0,$e=f&v?new qu:e;for(L.set(s,u),L.set(u,s);++Te1?"& ":"")+u[h],u=u.join(f>2?", ":" "),s.replace(iK,`{ + -`+I.join(W.HYPHEN_JOIN));continue}v&&a.push(v)}if(i.length>0){this.errors.push((0,oe.invalidProvidesOrRequiresDirectivesError)((0,ai.getConditionalFieldSetDirectiveName)(r),i));return}if(a.length>0)return a}validateInterfaceImplementations(t){if(t.implementedInterfaceTypeNames.size<1)return;let n=t.directivesByDirectiveName.has(W.INACCESSIBLE),r=new Map,i=new Map,a=!1;for(let o of t.implementedInterfaceTypeNames){let c=this.parentDefinitionDataByTypeName.get(o);if(jr.BASE_SCALARS.has(o)&&this.referencedTypeNames.add(o),!c)continue;if(c.kind!==X.Kind.INTERFACE_TYPE_DEFINITION){i.set(c.name,(0,je.kindToNodeType)(c.kind));continue}if(t.name===c.name){a=!0;continue}let l={invalidFieldImplementations:new Map,unimplementedFields:[]},d=!1;for(let[p,E]of c.fieldDataByName){this.unvalidatedExternalFieldCoords.delete(`${t.name}.${p}`);let I=!1,v=t.fieldDataByName.get(p);if(!v){d=!0,l.unimplementedFields.push(p);continue}let A={invalidAdditionalArguments:new Set,invalidImplementedArguments:[],isInaccessible:!1,originalResponseType:(0,yi.printTypeNode)(E.node.type),unimplementedArguments:new Set};(0,nn.isTypeValidImplementation)(E.node.type,v.node.type,this.concreteTypeNamesByAbstractTypeName)||(d=!0,I=!0,A.implementedResponseType=(0,yi.printTypeNode)(v.node.type));let U=new Set;for(let[j,$]of E.argumentDataByName){U.add(j);let re=v.argumentDataByName.get(j);if(!re){d=!0,I=!0,A.unimplementedArguments.add(j);continue}let te=(0,yi.printTypeNode)(re.type),me=(0,yi.printTypeNode)($.type);me!==te&&(d=!0,I=!0,A.invalidImplementedArguments.push({actualType:te,argumentName:j,expectedType:me}))}for(let[j,$]of v.argumentDataByName)U.has(j)||$.type.kind===X.Kind.NON_NULL_TYPE&&(d=!0,I=!0,A.invalidAdditionalArguments.add(j));!n&&v.isInaccessible&&!E.isInaccessible&&(d=!0,I=!0,A.isInaccessible=!0),I&&l.invalidFieldImplementations.set(p,A)}d&&r.set(o,l)}i.size>0&&this.errors.push((0,oe.invalidImplementedTypeError)(t.name,i)),a&&this.errors.push((0,oe.selfImplementationError)(t.name)),r.size>0&&this.errors.push((0,oe.invalidInterfaceImplementationError)(t.name,(0,je.kindToNodeType)(t.kind),r))}handleAuthenticatedDirective(t,n){let r=(0,je.getValueOrDefault)(this.authorizationDataByParentTypeName,n,()=>(0,Zn.newAuthorizationData)(n));if(t.kind===X.Kind.FIELD_DEFINITION){let i=(0,je.getValueOrDefault)(r.fieldAuthDataByFieldName,t.name,()=>(0,Zn.newFieldAuthorizationData)(t.name));i.inheritedData.requiresAuthentication=!0,i.originalData.requiresAuthentication=!0}else r.requiresAuthentication=!0,this.parentTypeNamesWithAuthDirectives.add(n)}handleOverrideDirective({data:t,directiveCoords:n,errorMessages:r,targetSubgraphName:i}){if(i===this.subgraphName){r.push((0,oe.equivalentSourceAndTargetOverrideErrorMessage)(i,n));return}let a=(0,je.getValueOrDefault)(this.overridesByTargetSubgraphName,i,()=>new Map);(0,je.getValueOrDefault)(a,t.renamedParentTypeName,()=>new Set).add(t.name)}handleSemanticNonNullDirective({data:t,directiveNode:n,errorMessages:r}){var E;let i=new Set,a=t.node.type,o=0;for(;a;)switch(a.kind){case X.Kind.LIST_TYPE:{o+=1,a=a.type;break}case X.Kind.NON_NULL_TYPE:{i.add(o),a=a.type;break}default:{a=null;break}}let c=(E=n.arguments)==null?void 0:E.find(I=>I.name.value===W.LEVELS);if(!c||c.value.kind!==X.Kind.LIST){r.push(oe.semanticNonNullArgumentErrorMessage);return}let l=c.value.values,d=(0,yi.printTypeNode)(t.type),p=new Set;for(let{value:I}of l){let v=parseInt(I,10);if(Number.isNaN(v)){r.push((0,oe.semanticNonNullLevelsNaNIndexErrorMessage)(I));continue}if(v<0||v>o){r.push((0,oe.semanticNonNullLevelsIndexOutOfBoundsErrorMessage)({maxIndex:o,typeString:d,value:I}));continue}if(!i.has(v)){p.add(v);continue}r.push((0,oe.semanticNonNullLevelsNonNullErrorMessage)({typeString:d,value:I}))}t.nullLevelsBySubgraphName.set(this.subgraphName,p)}extractRequiredScopes({directiveCoords:t,orScopes:n,requiredScopes:r}){if(n.length>jr.MAX_OR_SCOPES){this.invalidORScopesCoords.add(t);return}for(let i of n){let a=new Set;for(let o of i.values)a.add(o.value);a.size<1||(0,Zn.addScopes)(r,a)}}getKafkaPublishConfiguration(t,n,r,i){let a=[],o=W.DEFAULT_EDFS_PROVIDER_ID;for(let c of t.arguments||[])switch(c.name.value){case W.TOPIC:{if(c.value.kind!==X.Kind.STRING||c.value.value.length<1){i.push((0,oe.invalidEventSubjectErrorMessage)(W.TOPIC));continue}(0,ai.validateArgumentTemplateReferences)(c.value.value,n,i),a.push(c.value.value);break}case W.PROVIDER_ID:{if(c.value.kind!==X.Kind.STRING||c.value.value.length<1){i.push(oe.invalidEventProviderIdErrorMessage);continue}o=c.value.value;break}}if(!(i.length>0))return{fieldName:r,providerId:o,providerType:W.PROVIDER_TYPE_KAFKA,topics:a,type:W.PUBLISH}}getKafkaSubscribeConfiguration(t,n,r,i){let a=[],o=W.DEFAULT_EDFS_PROVIDER_ID;for(let c of t.arguments||[])switch(c.name.value){case W.TOPICS:{if(c.value.kind!==X.Kind.LIST){i.push((0,oe.invalidEventSubjectsErrorMessage)(W.TOPICS));continue}for(let l of c.value.values){if(l.kind!==X.Kind.STRING||l.value.length<1){i.push((0,oe.invalidEventSubjectsItemErrorMessage)(W.TOPICS));break}(0,ai.validateArgumentTemplateReferences)(l.value,n,i),a.push(l.value)}break}case W.PROVIDER_ID:{if(c.value.kind!==X.Kind.STRING||c.value.value.length<1){i.push(oe.invalidEventProviderIdErrorMessage);continue}o=c.value.value;break}}if(!(i.length>0))return{fieldName:r,providerId:o,providerType:W.PROVIDER_TYPE_KAFKA,topics:a,type:W.SUBSCRIBE}}getNatsPublishAndRequestConfiguration(t,n,r,i,a){let o=[],c=W.DEFAULT_EDFS_PROVIDER_ID;for(let l of n.arguments||[])switch(l.name.value){case W.SUBJECT:{if(l.value.kind!==X.Kind.STRING||l.value.value.length<1){a.push((0,oe.invalidEventSubjectErrorMessage)(W.SUBJECT));continue}(0,ai.validateArgumentTemplateReferences)(l.value.value,r,a),o.push(l.value.value);break}case W.PROVIDER_ID:{if(l.value.kind!==X.Kind.STRING||l.value.value.length<1){a.push(oe.invalidEventProviderIdErrorMessage);continue}c=l.value.value;break}}if(!(a.length>0))return{fieldName:i,providerId:c,providerType:W.PROVIDER_TYPE_NATS,subjects:o,type:t}}getNatsSubscribeConfiguration(t,n,r,i){let a=[],o=W.DEFAULT_EDFS_PROVIDER_ID,c=KE.DEFAULT_CONSUMER_INACTIVE_THRESHOLD,l="",d="";for(let p of t.arguments||[])switch(p.name.value){case W.SUBJECTS:{if(p.value.kind!==X.Kind.LIST){i.push((0,oe.invalidEventSubjectsErrorMessage)(W.SUBJECTS));continue}for(let E of p.value.values){if(E.kind!==X.Kind.STRING||E.value.length<1){i.push((0,oe.invalidEventSubjectsItemErrorMessage)(W.SUBJECTS));break}(0,ai.validateArgumentTemplateReferences)(E.value,n,i),a.push(E.value)}break}case W.PROVIDER_ID:{if(p.value.kind!==X.Kind.STRING||p.value.value.length<1){i.push(oe.invalidEventProviderIdErrorMessage);continue}o=p.value.value;break}case W.STREAM_CONFIGURATION:{if(this.usesEdfsNatsStreamConfiguration=!0,p.value.kind!==X.Kind.OBJECT||p.value.fields.length<1){i.push(oe.invalidNatsStreamInputErrorMessage);continue}let E=!0,I=new Set,v=new Set(mp.STREAM_CONFIGURATION_FIELD_NAMES),A=new Set([W.CONSUMER_NAME,W.STREAM_NAME]),U=new Set,j=new Set;for(let $ of p.value.fields){let re=$.name.value;if(!mp.STREAM_CONFIGURATION_FIELD_NAMES.has(re)){I.add(re),E=!1;continue}if(v.has(re))v.delete(re);else{U.add(re),E=!1;continue}switch(A.has(re)&&A.delete(re),re){case W.CONSUMER_NAME:if($.value.kind!=X.Kind.STRING||$.value.value.length<1){j.add(re),E=!1;continue}l=$.value.value;break;case W.STREAM_NAME:if($.value.kind!=X.Kind.STRING||$.value.value.length<1){j.add(re),E=!1;continue}d=$.value.value;break;case W.CONSUMER_INACTIVE_THRESHOLD:if($.value.kind!=X.Kind.INT){i.push((0,oe.invalidArgumentValueErrorMessage)((0,X.print)($.value),"edfs__NatsStreamConfiguration","consumerInactiveThreshold",W.INT_SCALAR)),E=!1;continue}try{c=parseInt($.value.value,10)}catch(te){i.push((0,oe.invalidArgumentValueErrorMessage)((0,X.print)($.value),"edfs__NatsStreamConfiguration","consumerInactiveThreshold",W.INT_SCALAR)),E=!1}break}}(!E||A.size>0)&&i.push((0,oe.invalidNatsStreamInputFieldsErrorMessage)([...A],[...U],[...j],[...I]))}}if(!(i.length>0))return c<0?(c=KE.DEFAULT_CONSUMER_INACTIVE_THRESHOLD,this.warnings.push((0,rs.consumerInactiveThresholdInvalidValueWarning)(this.subgraphName,`The value has been set to ${KE.DEFAULT_CONSUMER_INACTIVE_THRESHOLD}.`))):c>nfe.MAX_INT32&&(c=0,this.warnings.push((0,rs.consumerInactiveThresholdInvalidValueWarning)(this.subgraphName,"The value has been set to 0. This means the consumer will remain indefinitely active until its manual deletion."))),M({fieldName:r,providerId:o,providerType:W.PROVIDER_TYPE_NATS,subjects:a,type:W.SUBSCRIBE},l&&d?{streamConfiguration:{consumerInactiveThreshold:c,consumerName:l,streamName:d}}:{})}getRedisPublishConfiguration(t,n,r,i){let a=[],o=W.DEFAULT_EDFS_PROVIDER_ID;for(let c of t.arguments||[])switch(c.name.value){case W.CHANNEL:{if(c.value.kind!==X.Kind.STRING||c.value.value.length<1){i.push((0,oe.invalidEventSubjectErrorMessage)(W.CHANNEL));continue}(0,ai.validateArgumentTemplateReferences)(c.value.value,n,i),a.push(c.value.value);break}case W.PROVIDER_ID:{if(c.value.kind!==X.Kind.STRING||c.value.value.length<1){i.push(oe.invalidEventProviderIdErrorMessage);continue}o=c.value.value;break}}if(!(i.length>0))return{fieldName:r,providerId:o,providerType:W.PROVIDER_TYPE_REDIS,channels:a,type:W.PUBLISH}}getRedisSubscribeConfiguration(t,n,r,i){let a=[],o=W.DEFAULT_EDFS_PROVIDER_ID;for(let c of t.arguments||[])switch(c.name.value){case W.CHANNELS:{if(c.value.kind!==X.Kind.LIST){i.push((0,oe.invalidEventSubjectsErrorMessage)(W.CHANNELS));continue}for(let l of c.value.values){if(l.kind!==X.Kind.STRING||l.value.length<1){i.push((0,oe.invalidEventSubjectsItemErrorMessage)(W.CHANNELS));break}(0,ai.validateArgumentTemplateReferences)(l.value,n,i),a.push(l.value)}break}case W.PROVIDER_ID:{if(c.value.kind!==X.Kind.STRING||c.value.value.length<1){i.push(oe.invalidEventProviderIdErrorMessage);continue}o=c.value.value;break}}if(!(i.length>0))return{fieldName:r,providerId:o,providerType:W.PROVIDER_TYPE_REDIS,channels:a,type:W.SUBSCRIBE}}validateSubscriptionFilterDirectiveLocation(t){if(!t.directives)return;let n=this.renamedParentTypeName||this.originalParentTypeName,r=`${n}.${t.name.value}`,i=this.getOperationTypeNodeForRootTypeName(n)===X.OperationTypeNode.SUBSCRIPTION;for(let a of t.directives)if(a.name.value===W.SUBSCRIPTION_FILTER&&!i){this.errors.push((0,oe.invalidSubscriptionFilterLocationError)(r));return}}extractEventDirectivesToConfiguration(t,n){if(!t.directives)return;let r=t.name.value,i=`${this.renamedParentTypeName||this.originalParentTypeName}.${r}`;for(let a of t.directives){let o=[],c;switch(a.name.value){case W.EDFS_KAFKA_PUBLISH:c=this.getKafkaPublishConfiguration(a,n,r,o);break;case W.EDFS_KAFKA_SUBSCRIBE:c=this.getKafkaSubscribeConfiguration(a,n,r,o);break;case W.EDFS_NATS_PUBLISH:{c=this.getNatsPublishAndRequestConfiguration(W.PUBLISH,a,n,r,o);break}case W.EDFS_NATS_REQUEST:{c=this.getNatsPublishAndRequestConfiguration(W.REQUEST,a,n,r,o);break}case W.EDFS_NATS_SUBSCRIBE:{c=this.getNatsSubscribeConfiguration(a,n,r,o);break}case W.EDFS_REDIS_PUBLISH:{c=this.getRedisPublishConfiguration(a,n,r,o);break}case W.EDFS_REDIS_SUBSCRIBE:{c=this.getRedisSubscribeConfiguration(a,n,r,o);break}default:continue}if(o.length>0){this.errors.push((0,oe.invalidEventDirectiveError)(a.name.value,i,o));continue}c&&(0,je.getValueOrDefault)(this.eventsConfigurations,this.renamedParentTypeName||this.originalParentTypeName,()=>[]).push(c)}}getValidEventsDirectiveNamesForOperationTypeNode(t){switch(t){case X.OperationTypeNode.MUTATION:return new Set([W.EDFS_KAFKA_PUBLISH,W.EDFS_NATS_PUBLISH,W.EDFS_NATS_REQUEST,W.EDFS_REDIS_PUBLISH]);case X.OperationTypeNode.QUERY:return new Set([W.EDFS_NATS_REQUEST]);case X.OperationTypeNode.SUBSCRIPTION:return new Set([W.EDFS_KAFKA_SUBSCRIBE,W.EDFS_NATS_SUBSCRIBE,W.EDFS_REDIS_SUBSCRIBE])}}getOperationTypeNodeForRootTypeName(t){let n=this.operationTypeNodeByTypeName.get(t);if(n)return n;switch(t){case W.MUTATION:return X.OperationTypeNode.MUTATION;case W.QUERY:return X.OperationTypeNode.QUERY;case W.SUBSCRIPTION:return X.OperationTypeNode.SUBSCRIPTION;default:return}}validateEventDrivenRootType(t,n,r,i){let a=this.getOperationTypeNodeForRootTypeName(t.name);if(!a){this.errors.push((0,oe.invalidRootTypeError)(t.name));return}let o=this.getValidEventsDirectiveNamesForOperationTypeNode(a);for(let[c,l]of t.fieldDataByName){let d=`${l.originalParentTypeName}.${c}`,p=new Set;for(let j of mp.EVENT_DIRECTIVE_NAMES)l.directivesByDirectiveName.has(j)&&p.add(j);let E=new Set;for(let j of p)o.has(j)||E.add(j);if((p.size<1||E.size>0)&&n.set(d,{definesDirectives:p.size>0,invalidDirectiveNames:[...E]}),a===X.OperationTypeNode.MUTATION){let j=(0,yi.printTypeNode)(l.type);j!==W.NON_NULLABLE_EDFS_PUBLISH_EVENT_RESULT&&i.set(d,j);continue}let I=(0,yi.printTypeNode)(l.type),v=l.namedTypeName+"!",A=!1,U=this.concreteTypeNamesByAbstractTypeName.get(l.namedTypeName)||new Set([l.namedTypeName]);for(let j of U)if(A||(A=this.entityDataByTypeName.has(j)),A)break;(!A||I!==v)&&r.set(d,I)}}validateEventDrivenKeyDefinition(t,n){let r=this.keyFieldSetDatasByTypeName.get(t);if(r)for(let[i,{isUnresolvable:a}]of r)a||(0,je.getValueOrDefault)(n,t,()=>[]).push(i)}validateEventDrivenObjectFields(t,n,r,i){var a;for(let[o,c]of t){let l=`${c.originalParentTypeName}.${o}`;if(n.has(o)){(a=c.externalFieldDataBySubgraphName.get(this.subgraphName))!=null&&a.isDefinedExternal||r.set(l,o);continue}i.set(l,o)}}isEdfsPublishResultValid(){let t=this.parentDefinitionDataByTypeName.get(W.EDFS_PUBLISH_RESULT);if(!t)return!0;if(t.kind!==X.Kind.OBJECT_TYPE_DEFINITION||t.fieldDataByName.size!=1)return!1;for(let[n,r]of t.fieldDataByName)if(r.argumentDataByName.size>0||n!==W.SUCCESS||(0,yi.printTypeNode)(r.type)!==W.NON_NULLABLE_BOOLEAN)return!1;return!0}isNatsStreamConfigurationInputObjectValid(t){if(!(0,nn.isInputObjectDefinitionData)(t)||t.inputValueDataByName.size!=3)return!1;for(let[n,r]of t.inputValueDataByName)switch(n){case W.CONSUMER_INACTIVE_THRESHOLD:{if((0,yi.printTypeNode)(r.type)!==W.NON_NULLABLE_INT||!r.defaultValue||r.defaultValue.kind!==X.Kind.INT||r.defaultValue.value!==`${KE.DEFAULT_CONSUMER_INACTIVE_THRESHOLD}`)return!1;break}case W.CONSUMER_NAME:case W.STREAM_NAME:{if((0,yi.printTypeNode)(r.type)!==W.NON_NULLABLE_STRING)return!1;break}default:return!1}return!0}validateEventDrivenSubgraph(){let t=[],n=new Map,r=new Map,i=new Map,a=new Map,o=new Map,c=new Map,l=new Set,d=new Set;for(let[p,E]of this.parentDefinitionDataByTypeName){if(p===W.EDFS_PUBLISH_RESULT||p===W.EDFS_NATS_STREAM_CONFIGURATION||E.kind!==X.Kind.OBJECT_TYPE_DEFINITION)continue;if(E.isRootType){this.validateEventDrivenRootType(E,n,r,i);continue}let I=this.keyFieldNamesByParentTypeName.get(p);if(!I){d.add(p);continue}this.validateEventDrivenKeyDefinition(p,a),this.validateEventDrivenObjectFields(E.fieldDataByName,I,o,c)}if(this.isEdfsPublishResultValid()||t.push(oe.invalidEdfsPublishResultObjectErrorMessage),this.edfsDirectiveReferences.has(W.EDFS_NATS_SUBSCRIBE)){let p=this.parentDefinitionDataByTypeName.get(W.EDFS_NATS_STREAM_CONFIGURATION);p&&this.usesEdfsNatsStreamConfiguration&&!this.isNatsStreamConfigurationInputObjectValid(p)&&t.push(oe.invalidNatsStreamConfigurationDefinitionErrorMessage),this.parentDefinitionDataByTypeName.delete(W.EDFS_NATS_STREAM_CONFIGURATION);let E=this.upsertInputObjectByNode(aV.EDFS_NATS_STREAM_CONFIGURATION_DEFINITION);if(E.success)for(let I of aV.EDFS_NATS_STREAM_CONFIGURATION_DEFINITION.fields)this.addInputValueDataByNode({fieldName:I.name.value,isArgument:!1,inputValueDataByName:E.data.inputValueDataByName,node:I,originalParentTypeName:W.EDFS_NATS_STREAM_CONFIGURATION});else return}n.size>0&&t.push((0,oe.invalidRootTypeFieldEventsDirectivesErrorMessage)(n)),i.size>0&&t.push((0,oe.invalidEventDrivenMutationResponseTypeErrorMessage)(i)),r.size>0&&t.push((0,oe.invalidRootTypeFieldResponseTypesEventDrivenErrorMessage)(r)),a.size>0&&t.push((0,oe.invalidKeyFieldSetsEventDrivenErrorMessage)(a)),o.size>0&&t.push((0,oe.nonExternalKeyFieldNamesEventDrivenErrorMessage)(o)),c.size>0&&t.push((0,oe.nonKeyFieldNamesEventDrivenErrorMessage)(c)),l.size>0&&t.push((0,oe.nonEntityObjectExtensionsEventDrivenErrorMessage)([...l])),d.size>0&&t.push((0,oe.nonKeyComposingObjectTypeNamesEventDrivenErrorMessage)([...d])),t.length>0&&this.errors.push((0,oe.invalidEventDrivenGraphError)(t))}validateUnionMembers(t){if(t.memberByMemberTypeName.size<1){this.errors.push((0,oe.noDefinedUnionMembersError)(t.name));return}let n=[];for(let r of t.memberByMemberTypeName.keys()){let i=this.parentDefinitionDataByTypeName.get(r);i&&i.kind!==X.Kind.OBJECT_TYPE_DEFINITION&&n.push(`"${r}", which is type "${(0,je.kindToNodeType)(i.kind)}"`)}n.length>0&&this.errors.push((0,oe.invalidUnionMemberTypeError)(t.name,n))}addConcreteTypeNamesForUnion(t){if(!t.types||t.types.length<1)return;let n=t.name.value;for(let r of t.types){let i=r.name.value;(0,je.getValueOrDefault)(this.concreteTypeNamesByAbstractTypeName,n,()=>new Set).add(i),this.internalGraph.addEdge(this.internalGraph.addOrUpdateNode(n,{isAbstract:!0}),this.internalGraph.addOrUpdateNode(i),i,!0)}}addValidKeyFieldSetConfigurations(){for(let[t,n]of this.keyFieldSetDatasByTypeName){let r=this.parentDefinitionDataByTypeName.get(t);if(!r||r.kind!==X.Kind.OBJECT_TYPE_DEFINITION&&r.kind!==X.Kind.INTERFACE_TYPE_DEFINITION){this.errors.push((0,oe.undefinedCompositeOutputTypeError)(t));continue}let i=(0,nn.getParentTypeName)(r),a=(0,je.getValueOrDefault)(this.configurationDataByTypeName,i,()=>(0,Np.newConfigurationData)(!0,i)),o=(0,ai.validateKeyFieldSets)(this,r,n);o&&(a.keys=o)}}getValidFlattenedDirectiveArray(t,n,r=!1){let i=[];for(let[a,o]of t){if(r&&W.INHERITABLE_DIRECTIVE_NAMES.has(a))continue;let c=this.directiveDefinitionDataByName.get(a);if(!c)continue;if(!c.isRepeatable&&o.length>1){let p=(0,je.getValueOrDefault)(this.invalidRepeatedDirectiveNameByCoords,n,()=>new Set);p.has(a)||(p.add(a),this.errors.push((0,oe.invalidDirectiveError)(a,n,"1st",[(0,oe.invalidRepeatedDirectiveErrorMessage)(a)])));continue}if(a!==W.KEY){i.push(...o);continue}let l=[],d=new Set;for(let p=0;pnew Set).add(U)),(0,je.getValueOrDefault)(a.keyFieldNamesByParentTypeName,v,()=>new Set).add(A);let re=(0,cr.getTypeNodeNamedTypeName)(j.node.type);if(jr.BASE_SCALARS.has(re))return;let te=a.parentDefinitionDataByTypeName.get(re);if(!te)return X.BREAK;if(te.kind===X.Kind.OBJECT_TYPE_DEFINITION){p=!0,c.push(te);return}if((0,gn.isKindAbstract)(te.kind))return X.BREAK}},InlineFragment:{enter(){return X.BREAK}},SelectionSet:{enter(){if(!p||(d+=1,p=!1,d<0||d>=c.length))return X.BREAK},leave(){p&&(p=!1),d-=1,c.pop()}}}),!(l.size<1))for(let[E,I]of l)this.warnings.push((0,rs.externalEntityExtensionKeyFieldWarning)(i.name,E,[...I],this.subgraphName))}}for(let n of t)this.keyFieldSetDatasByTypeName.delete(n)}addValidConditionalFieldSetConfigurations(){for(let[t,n]of this.fieldSetDataByTypeName){let r=this.parentDefinitionDataByTypeName.get(t);if(!r||r.kind!==X.Kind.OBJECT_TYPE_DEFINITION&&r.kind!==X.Kind.INTERFACE_TYPE_DEFINITION){this.errors.push((0,oe.undefinedCompositeOutputTypeError)(t));continue}let i=(0,nn.getParentTypeName)(r),a=(0,je.getValueOrDefault)(this.configurationDataByTypeName,i,()=>(0,Np.newConfigurationData)(!1,i)),o=this.validateProvidesOrRequires(r,n.provides,!0);o&&(a.provides=o);let c=this.validateProvidesOrRequires(r,n.requires,!1);c&&(a.requires=c)}}addFieldNamesToConfigurationData(t,n){let r=new Set;for(let[i,a]of t){let o=a.externalFieldDataBySubgraphName.get(this.subgraphName);if(!o||o.isUnconditionallyProvided){n.fieldNames.add(i);continue}r.add(i),this.edfsDirectiveReferences.size>0&&n.fieldNames.add(i)}r.size>0&&(n.externalFieldNames=r)}validateOneOfDirective({data:t,requiredFieldNames:n}){var r,i;return t.directivesByDirectiveName.has(W.ONE_OF)?n.size>0?(this.errors.push((0,oe.oneOfRequiredFieldsError)({requiredFieldNames:Array.from(n),typeName:t.name})),!1):(t.inputValueDataByName.size===1&&this.warnings.push((0,rs.singleSubgraphInputFieldOneOfWarning)({fieldName:(i=(r=(0,je.getFirstEntry)(t.inputValueDataByName))==null?void 0:r.name)!=null?i:"unknown",subgraphName:this.subgraphName,typeName:t.name})),!0):!0}normalize(t){var o;(0,iV.upsertDirectiveSchemaAndEntityDefinitions)(this,t),(0,iV.upsertParentsAndChildren)(this,t);let n=[];Ud(this,GE,oV).call(this,n),this.validateDirectives(this.schemaData,W.SCHEMA);let r=Ud(this,$E,uV).call(this,n);for(let[c,l]of this.parentDefinitionDataByTypeName)this.validateDirectives(l,c);this.invalidORScopesCoords.size>0&&this.errors.push((0,oe.orScopesLimitError)(jr.MAX_OR_SCOPES,[...this.invalidORScopesCoords]));for(let c of this.invalidConfigureDescriptionNodeDatas)c.description||this.errors.push((0,oe.configureDescriptionNoDescriptionError)((0,je.kindToNodeType)(c.kind),c.name));this.evaluateExternalKeyFields();for(let[c,l]of this.parentDefinitionDataByTypeName)switch(l.kind){case X.Kind.ENUM_TYPE_DEFINITION:{if(l.enumValueDataByName.size<1){this.errors.push((0,oe.noDefinedEnumValuesError)(c));break}n.push(this.getEnumNodeByData(l));break}case X.Kind.INPUT_OBJECT_TYPE_DEFINITION:{if(l.inputValueDataByName.size<1){this.errors.push((0,oe.noInputValueDefinitionsError)(c));break}let d=new Set;for(let p of l.inputValueDataByName.values()){if((0,nn.isTypeRequired)(p.type)&&d.add(p.name),p.namedTypeKind!==X.Kind.NULL)continue;let E=this.parentDefinitionDataByTypeName.get(p.namedTypeName);if(E){if(!(0,nn.isInputNodeKind)(E.kind)){this.errors.push((0,oe.invalidNamedTypeError)({data:p,namedTypeData:E,nodeType:`${(0,je.kindToNodeType)(l.kind)} field`}));continue}p.namedTypeKind=E.kind}}if(!this.validateOneOfDirective({data:l,requiredFieldNames:d}))break;c!==W.EDFS_NATS_STREAM_CONFIGURATION&&n.push(this.getInputObjectNodeByData(l));break}case X.Kind.INTERFACE_TYPE_DEFINITION:case X.Kind.OBJECT_TYPE_DEFINITION:{let d=this.entityDataByTypeName.has(c),p=this.operationTypeNodeByTypeName.get(c),E=l.kind===X.Kind.OBJECT_TYPE_DEFINITION;this.isSubgraphVersionTwo&&l.extensionType===ns.ExtensionType.EXTENDS&&(l.extensionType=ns.ExtensionType.NONE),p&&(l.fieldDataByName.delete(W.SERVICE_FIELD),l.fieldDataByName.delete(W.ENTITIES_FIELD));let I=[];for(let[$,re]of l.fieldDataByName){if(!E&&((o=re.externalFieldDataBySubgraphName.get(this.subgraphName))!=null&&o.isDefinedExternal)&&I.push($),this.validateArguments(re,l.kind),re.namedTypeKind!==X.Kind.NULL)continue;let te=this.parentDefinitionDataByTypeName.get(re.namedTypeName);if(te){if(!(0,nn.isOutputNodeKind)(te.kind)){this.errors.push((0,oe.invalidNamedTypeError)({data:re,namedTypeData:te,nodeType:`${(0,je.kindToNodeType)(l.kind)} field`}));continue}re.namedTypeKind=this.entityInterfaceDataByTypeName.get(te.name)?X.Kind.INTERFACE_TYPE_DEFINITION:te.kind}}I.length>0&&(this.isSubgraphVersionTwo?this.errors.push((0,oe.externalInterfaceFieldsError)(c,I)):this.warnings.push((0,rs.externalInterfaceFieldsWarning)(this.subgraphName,c,I)));let v=(0,nn.getParentTypeName)(l),A=(0,je.getValueOrDefault)(this.configurationDataByTypeName,v,()=>(0,Np.newConfigurationData)(d,c)),U=this.entityInterfaceDataByTypeName.get(c);if(U){U.fieldDatas=(0,Zn.fieldDatasToSimpleFieldDatas)(l.fieldDataByName.values());let $=this.concreteTypeNamesByAbstractTypeName.get(c);$&&(0,je.addIterableToSet)({source:$,target:U.concreteTypeNames}),A.isInterfaceObject=U.isInterfaceObject,A.entityInterfaceConcreteTypeNames=U.concreteTypeNames}let j=this.eventsConfigurations.get(v);j&&(A.events=j),this.addFieldNamesToConfigurationData(l.fieldDataByName,A),this.validateInterfaceImplementations(l),n.push(this.getCompositeOutputNodeByData(l)),l.fieldDataByName.size<1&&!(0,ai.isNodeQuery)(c,p)&&this.errors.push((0,oe.noFieldDefinitionsError)((0,je.kindToNodeType)(l.kind),c)),l.requireFetchReasonsFieldNames.size>0&&(A.requireFetchReasonsFieldNames=[...l.requireFetchReasonsFieldNames]);break}case X.Kind.SCALAR_TYPE_DEFINITION:{if(l.extensionType===ns.ExtensionType.REAL){this.errors.push((0,oe.noBaseScalarDefinitionError)(c));break}n.push(this.getScalarNodeByData(l));break}case X.Kind.UNION_TYPE_DEFINITION:{n.push(this.getUnionNodeByData(l)),this.validateUnionMembers(l);break}default:throw(0,oe.unexpectedKindFatalError)(c)}this.addValidConditionalFieldSetConfigurations(),this.addValidKeyFieldSetConfigurations();for(let c of Object.values(X.OperationTypeNode)){let l=this.schemaData.operationTypes.get(c),d=(0,je.getOrThrowError)(gn.operationTypeNodeToDefaultType,c,W.OPERATION_TO_DEFAULT),p=l?(0,cr.getTypeNodeNamedTypeName)(l.type):d;if(jr.BASE_SCALARS.has(p)&&this.referencedTypeNames.add(p),p!==d&&this.parentDefinitionDataByTypeName.has(d)){this.errors.push((0,oe.invalidRootTypeDefinitionError)(c,p,d));continue}let E=this.parentDefinitionDataByTypeName.get(p);if(l){if(!E)continue;this.operationTypeNodeByTypeName.set(p,c)}if(!E)continue;let I=this.configurationDataByTypeName.get(d);I&&(I.isRootNode=!0,I.typeName=d),E.kind!==X.Kind.OBJECT_TYPE_DEFINITION&&this.errors.push((0,oe.operationDefinitionError)(p,c,E.kind))}for(let c of this.referencedTypeNames){let l=this.parentDefinitionDataByTypeName.get(c);if(!l){this.errors.push((0,oe.undefinedTypeError)(c));continue}if(l.kind!==X.Kind.INTERFACE_TYPE_DEFINITION)continue;let d=this.concreteTypeNamesByAbstractTypeName.get(c);(!d||d.size<1)&&this.warnings.push((0,rs.unimplementedInterfaceOutputTypeWarning)(this.subgraphName,c))}let i=new Map;for(let c of this.directiveDefinitionByName.values()){let l=(0,gn.extractExecutableDirectiveLocations)(c.locations,new Set);l.size<1||this.addPersistedDirectiveDefinitionDataByNode(i,c,l)}this.isSubgraphEventDrivenGraph=this.edfsDirectiveReferences.size>0,this.isSubgraphEventDrivenGraph&&this.validateEventDrivenSubgraph();for(let c of this.unvalidatedExternalFieldCoords)this.isSubgraphVersionTwo?this.errors.push((0,oe.invalidExternalDirectiveError)(c)):this.warnings.push((0,rs.invalidExternalFieldWarning)(c,this.subgraphName));if(this.errors.length>0)return{success:!1,errors:this.errors,warnings:this.warnings};let a={kind:X.Kind.DOCUMENT,definitions:n};return{authorizationDataByParentTypeName:this.authorizationDataByParentTypeName,concreteTypeNamesByAbstractTypeName:this.concreteTypeNamesByAbstractTypeName,conditionalFieldDataByCoordinates:this.conditionalFieldDataByCoords,configurationDataByTypeName:this.configurationDataByTypeName,directiveDefinitionByName:this.directiveDefinitionByName,entityDataByTypeName:this.entityDataByTypeName,entityInterfaces:this.entityInterfaceDataByTypeName,fieldCoordsByNamedTypeName:this.fieldCoordsByNamedTypeName,isEventDrivenGraph:this.isSubgraphEventDrivenGraph,isVersionTwo:this.isSubgraphVersionTwo,keyFieldNamesByParentTypeName:this.keyFieldNamesByParentTypeName,keyFieldSetsByEntityTypeNameByKeyFieldCoords:this.keyFieldSetsByEntityTypeNameByFieldCoords,operationTypes:this.operationTypeNodeByTypeName,originalTypeNameByRenamedTypeName:this.originalTypeNameByRenamedTypeName,overridesByTargetSubgraphName:this.overridesByTargetSubgraphName,parentDefinitionDataByTypeName:this.parentDefinitionDataByTypeName,persistedDirectiveDefinitionDataByDirectiveName:i,schemaNode:r,subgraphAST:a,subgraphString:(0,X.print)(a),schema:(0,efe.buildASTSchema)(a,{addInvalidExtensionOrphans:!0,assumeValid:!0,assumeValidSDL:!0}),success:!0,warnings:this.warnings}}};GE=new WeakSet,oV=function(t){let n=new Set;for(let r of this.referencedDirectiveNames){let i=jr.DIRECTIVE_DEFINITION_BY_NAME.get(r);i&&(this.directiveDefinitionByName.set(r,i),(0,je.addOptionalIterableToSet)({source:mp.DEPENDENCIES_BY_DIRECTIVE_NAME.get(r),target:n}),t.push(i))}for(let r of this.customDirectiveDefinitionByName.values())t.push(r);t.push(...n)},$E=new WeakSet,uV=function(t){var r;let n=this.getSchemaNodeByData(this.schemaData);if(n.operationTypes.length>0)return t.push(n),n;if((r=n.directives)!=null&&r.length)return{directives:n.directives,kind:X.Kind.SCHEMA_EXTENSION}};Lc.NormalizationFactory=Tp;function ife(e){let t=new Map,n=new Map,r=new Map,i=new Map,a=new Map,o=new Map,c=new Set,l=new Map,d=new Set,p=new Set,E=[],I=new Set,v=new Map,A=[],U=[];for(let re of e)re.name&&(0,tfe.recordSubgraphName)(re.name,d,p);let j=new tb.Graph;for(let re=0;re0&&A.push(...ue.warnings),!ue.success){U.push((0,oe.subgraphValidationError)(me,ue.errors));continue}if(!ue){U.push((0,oe.subgraphValidationError)(me,[oe.subgraphValidationFailureError]));continue}l.set(me,ue.parentDefinitionDataByTypeName);for(let Ae of ue.authorizationDataByParentTypeName.values())(0,Zn.upsertAuthorizationData)(t,Ae,I);for(let[Ae,xe]of ue.fieldCoordsByNamedTypeName)(0,je.addIterableToSet)({source:xe,target:(0,je.getValueOrDefault)(v,Ae,()=>new Set)});for(let[Ae,xe]of ue.concreteTypeNamesByAbstractTypeName){let rt=n.get(Ae);if(!rt){n.set(Ae,new Set(xe));continue}(0,je.addIterableToSet)({source:xe,target:rt})}for(let[Ae,xe]of ue.entityDataByTypeName){let rt=xe.keyFieldSetDatasBySubgraphName.get(me);rt&&(0,Zn.upsertEntityData)({entityDataByTypeName:r,keyFieldSetDataByFieldSet:rt,typeName:Ae,subgraphName:me})}if(te.name&&i.set(me,{conditionalFieldDataByCoordinates:ue.conditionalFieldDataByCoordinates,configurationDataByTypeName:ue.configurationDataByTypeName,definitions:ue.subgraphAST,directiveDefinitionByName:ue.directiveDefinitionByName,entityInterfaces:ue.entityInterfaces,isVersionTwo:ue.isVersionTwo,keyFieldNamesByParentTypeName:ue.keyFieldNamesByParentTypeName,name:me,operationTypes:ue.operationTypes,overriddenFieldNamesByParentTypeName:new Map,parentDefinitionDataByTypeName:ue.parentDefinitionDataByTypeName,persistedDirectiveDefinitionDataByDirectiveName:ue.persistedDirectiveDefinitionDataByDirectiveName,schema:ue.schema,schemaNode:ue.schemaNode,url:te.url}),!(ue.overridesByTargetSubgraphName.size<1))for(let[Ae,xe]of ue.overridesByTargetSubgraphName){let rt=d.has(Ae);for(let[Z,_e]of xe){let _t=ue.originalTypeNameByRenamedTypeName.get(Z)||Z;if(!rt)A.push((0,rs.invalidOverrideTargetSubgraphNameWarning)(Ae,_t,[..._e],te.name));else{let rn=(0,je.getValueOrDefault)(a,Ae,()=>new Map),an=(0,je.getValueOrDefault)(rn,Z,()=>new Set(_e));(0,je.addIterableToSet)({source:_e,target:an})}for(let rn of _e){let an=`${_t}.${rn}`,Fn=o.get(an);if(!Fn){o.set(an,[me]);continue}Fn.push(me),c.add(an)}}}}let $=[];if(I.size>0&&$.push((0,oe.orScopesLimitError)(jr.MAX_OR_SCOPES,[...I])),(E.length>0||p.size>0)&&$.push((0,oe.invalidSubgraphNamesError)([...p],E)),c.size>0){let re=[];for(let te of c){let me=(0,je.getOrThrowError)(o,te,"overrideSourceSubgraphNamesByFieldPath");re.push((0,oe.duplicateOverriddenFieldErrorMessage)(te,me))}$.push((0,oe.duplicateOverriddenFieldsError)(re))}if($.push(...U),$.length>0)return{errors:$,success:!1,warnings:A};for(let[re,te]of a){let me=(0,je.getOrThrowError)(i,re,"internalSubgraphBySubgraphName");me.overriddenFieldNamesByParentTypeName=te;for(let[ue,Ae]of te){let xe=me.configurationDataByTypeName.get(ue);xe&&((0,Zn.subtractSet)(Ae,xe.fieldNames),xe.fieldNames.size<1&&me.configurationDataByTypeName.delete(ue))}}return{authorizationDataByParentTypeName:t,concreteTypeNamesByAbstractTypeName:n,entityDataByTypeName:r,fieldCoordsByNamedTypeName:v,internalSubgraphBySubgraphName:i,internalGraph:j,success:!0,warnings:A}}});var QE=w(Uc=>{"use strict";m();T();N();Object.defineProperty(Uc,"__esModule",{value:!0});Uc.DivergentType=void 0;Uc.getLeastRestrictiveMergedTypeNode=sfe;Uc.getMostRestrictiveMergedTypeNode=ofe;Uc.renameNamedTypeName=ufe;var Cc=Oe(),lV=qi(),afe=yu(),cV=Ar(),dV=Fl(),Bc;(function(e){e[e.NONE=0]="NONE",e[e.CURRENT=1]="CURRENT",e[e.OTHER=2]="OTHER"})(Bc||(Uc.DivergentType=Bc={}));function fV(e,t,n,r,i){t=(0,afe.getMutableTypeNode)(t,n,i);let a={kind:e.kind},o=Bc.NONE,c=a;for(let l=0;l{"use strict";m();T();N();Object.defineProperty(ib,"__esModule",{value:!0});ib.renameRootTypes=dfe;var cfe=Oe(),rb=Ar(),lfe=QE(),Pu=sr(),kc=Rr();function dfe(e,t){let n,r=!1,i;(0,cfe.visit)(t.definitions,{FieldDefinition:{enter(a){let o=a.name.value;if(r&&(o===Pu.SERVICE_FIELD||o===Pu.ENTITIES_FIELD))return n.fieldDataByName.delete(o),!1;let c=n.name,l=(0,kc.getOrThrowError)(n.fieldDataByName,o,`${c}.fieldDataByFieldName`),d=t.operationTypes.get(l.namedTypeName);if(d){let p=(0,kc.getOrThrowError)(rb.operationTypeNodeToDefaultType,d,Pu.OPERATION_TO_DEFAULT);l.namedTypeName!==p&&(0,lfe.renameNamedTypeName)(l,p,e.errors)}return i!=null&&i.has(o)&&l.isShareableBySubgraphName.delete(t.name),!1}},InterfaceTypeDefinition:{enter(a){let o=a.name.value;if(!e.entityInterfaceFederationDataByTypeName.get(o))return!1;n=(0,kc.getOrThrowError)(t.parentDefinitionDataByTypeName,o,Pu.PARENT_DEFINITION_DATA)},leave(){n=void 0}},ObjectTypeDefinition:{enter(a){let o=a.name.value,c=t.operationTypes.get(o),l=c?(0,kc.getOrThrowError)(rb.operationTypeNodeToDefaultType,c,Pu.OPERATION_TO_DEFAULT):o;n=(0,kc.getOrThrowError)(t.parentDefinitionDataByTypeName,o,Pu.PARENT_DEFINITION_DATA),r=n.isRootType,!e.entityInterfaceFederationDataByTypeName.get(o)&&(e.addValidPrimaryKeyTargetsToEntityData(o),i=t.overriddenFieldNamesByParentTypeName.get(l),o!==l&&(n.name=l,t.parentDefinitionDataByTypeName.set(l,n),t.parentDefinitionDataByTypeName.delete(o)))},leave(){n=void 0,r=!1,i=void 0}},ObjectTypeExtension:{enter(a){let o=a.name.value,c=t.operationTypes.get(o),l=c?(0,kc.getOrThrowError)(rb.operationTypeNodeToDefaultType,c,Pu.OPERATION_TO_DEFAULT):o;n=(0,kc.getOrThrowError)(t.parentDefinitionDataByTypeName,o,Pu.PARENT_DEFINITION_DATA),r=n.isRootType,e.addValidPrimaryKeyTargetsToEntityData(o),i=t.overriddenFieldNamesByParentTypeName.get(o),o!==l&&(n.name=l,t.parentDefinitionDataByTypeName.set(l,n),t.parentDefinitionDataByTypeName.delete(o))},leave(){n=void 0,r=!1,i=void 0}}})}});var pV=w((ud,Ep)=>{"use strict";m();T();N();(function(){var e,t="4.17.21",n=200,r="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",a="Invalid `variable` option passed into `_.template`",o="__lodash_hash_undefined__",c=500,l="__lodash_placeholder__",d=1,p=2,E=4,I=1,v=2,A=1,U=2,j=4,$=8,re=16,te=32,me=64,ue=128,Ae=256,xe=512,rt=30,Z="...",_e=800,_t=16,rn=1,an=2,Fn=3,$t=1/0,Tn=9007199254740991,Cr=17976931348623157e292,Br=NaN,xn=4294967295,Ht=xn-1,wn=xn>>>1,ae=[["ary",ue],["bind",A],["bindKey",U],["curry",$],["curryRight",re],["flip",xe],["partial",te],["partialRight",me],["rearg",Ae]],De="[object Arguments]",Ie="[object Array]",Ce="[object AsyncFunction]",Ot="[object Boolean]",Y="[object Date]",ie="[object DOMException]",qe="[object Error]",Je="[object Function]",Bt="[object GeneratorFunction]",it="[object Map]",Pt="[object Number]",us="[object Null]",Qr="[object Object]",cs="[object Promise]",Hc="[object Proxy]",Pa="[object RegExp]",hr="[object Set]",si="[object String]",xt="[object Symbol]",yr="[object Undefined]",Bu="[object WeakMap]",Fa="[object WeakSet]",Uu="[object ArrayBuffer]",P="[object DataView]",y="[object Float32Array]",g="[object Float64Array]",B="[object Int8Array]",K="[object Int16Array]",ee="[object Int32Array]",ce="[object Uint8Array]",Tt="[object Uint8ClampedArray]",En="[object Uint16Array]",un="[object Uint32Array]",_n=/\b__p \+= '';/g,sn=/\b(__p \+=) '' \+/g,Jj=/(__e\(.*?\)|\b__t\)) \+\n'';/g,s0=/&(?:amp|lt|gt|quot|#39);/g,o0=/[&<>"']/g,Hj=RegExp(s0.source),zj=RegExp(o0.source),Wj=/<%-([\s\S]+?)%>/g,Xj=/<%([\s\S]+?)%>/g,u0=/<%=([\s\S]+?)%>/g,Zj=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,eK=/^\w*$/,tK=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bh=/[\\^$.*+?()[\]{}|]/g,nK=RegExp(bh.source),Ah=/^\s+/,rK=/\s/,iK=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,aK=/\{\n\/\* \[wrapped with (.+)\] \*/,sK=/,? & /,oK=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,uK=/[()=,{}\[\]\/\s]/,cK=/\\(\\)?/g,lK=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,c0=/\w*$/,dK=/^[-+]0x[0-9a-f]+$/i,fK=/^0b[01]+$/i,pK=/^\[object .+?Constructor\]$/,mK=/^0o[0-7]+$/i,NK=/^(?:0|[1-9]\d*)$/,TK=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,jp=/($^)/,EK=/['\n\r\u2028\u2029\\]/g,Kp="\\ud800-\\udfff",hK="\\u0300-\\u036f",yK="\\ufe20-\\ufe2f",IK="\\u20d0-\\u20ff",l0=hK+yK+IK,d0="\\u2700-\\u27bf",f0="a-z\\xdf-\\xf6\\xf8-\\xff",gK="\\xac\\xb1\\xd7\\xf7",_K="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",vK="\\u2000-\\u206f",OK=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",p0="A-Z\\xc0-\\xd6\\xd8-\\xde",m0="\\ufe0e\\ufe0f",N0=gK+_K+vK+OK,Rh="['\u2019]",SK="["+Kp+"]",T0="["+N0+"]",Gp="["+l0+"]",E0="\\d+",DK="["+d0+"]",h0="["+f0+"]",y0="[^"+Kp+N0+E0+d0+f0+p0+"]",Ph="\\ud83c[\\udffb-\\udfff]",bK="(?:"+Gp+"|"+Ph+")",I0="[^"+Kp+"]",Fh="(?:\\ud83c[\\udde6-\\uddff]){2}",wh="[\\ud800-\\udbff][\\udc00-\\udfff]",zc="["+p0+"]",g0="\\u200d",_0="(?:"+h0+"|"+y0+")",AK="(?:"+zc+"|"+y0+")",v0="(?:"+Rh+"(?:d|ll|m|re|s|t|ve))?",O0="(?:"+Rh+"(?:D|LL|M|RE|S|T|VE))?",S0=bK+"?",D0="["+m0+"]?",RK="(?:"+g0+"(?:"+[I0,Fh,wh].join("|")+")"+D0+S0+")*",PK="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",FK="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",b0=D0+S0+RK,wK="(?:"+[DK,Fh,wh].join("|")+")"+b0,LK="(?:"+[I0+Gp+"?",Gp,Fh,wh,SK].join("|")+")",CK=RegExp(Rh,"g"),BK=RegExp(Gp,"g"),Lh=RegExp(Ph+"(?="+Ph+")|"+LK+b0,"g"),UK=RegExp([zc+"?"+h0+"+"+v0+"(?="+[T0,zc,"$"].join("|")+")",AK+"+"+O0+"(?="+[T0,zc+_0,"$"].join("|")+")",zc+"?"+_0+"+"+v0,zc+"+"+O0,FK,PK,E0,wK].join("|"),"g"),kK=RegExp("["+g0+Kp+l0+m0+"]"),MK=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xK=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],qK=-1,yn={};yn[y]=yn[g]=yn[B]=yn[K]=yn[ee]=yn[ce]=yn[Tt]=yn[En]=yn[un]=!0,yn[De]=yn[Ie]=yn[Uu]=yn[Ot]=yn[P]=yn[Y]=yn[qe]=yn[Je]=yn[it]=yn[Pt]=yn[Qr]=yn[Pa]=yn[hr]=yn[si]=yn[Bu]=!1;var hn={};hn[De]=hn[Ie]=hn[Uu]=hn[P]=hn[Ot]=hn[Y]=hn[y]=hn[g]=hn[B]=hn[K]=hn[ee]=hn[it]=hn[Pt]=hn[Qr]=hn[Pa]=hn[hr]=hn[si]=hn[xt]=hn[ce]=hn[Tt]=hn[En]=hn[un]=!0,hn[qe]=hn[Je]=hn[Bu]=!1;var VK={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},jK={"&":"&","<":"<",">":">",'"':""","'":"'"},KK={"&":"&","<":"<",">":">",""":'"',"'":"'"},GK={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},$K=parseFloat,QK=parseInt,A0=typeof global=="object"&&global&&global.Object===Object&&global,YK=typeof self=="object"&&self&&self.Object===Object&&self,lr=A0||YK||Function("return this")(),Ch=typeof ud=="object"&&ud&&!ud.nodeType&&ud,ku=Ch&&typeof Ep=="object"&&Ep&&!Ep.nodeType&&Ep,R0=ku&&ku.exports===Ch,Bh=R0&&A0.process,Ii=function(){try{var G=ku&&ku.require&&ku.require("util").types;return G||Bh&&Bh.binding&&Bh.binding("util")}catch(se){}}(),P0=Ii&&Ii.isArrayBuffer,F0=Ii&&Ii.isDate,w0=Ii&&Ii.isMap,L0=Ii&&Ii.isRegExp,C0=Ii&&Ii.isSet,B0=Ii&&Ii.isTypedArray;function oi(G,se,ne){switch(ne.length){case 0:return G.call(se);case 1:return G.call(se,ne[0]);case 2:return G.call(se,ne[0],ne[1]);case 3:return G.call(se,ne[0],ne[1],ne[2])}return G.apply(se,ne)}function JK(G,se,ne,Be){for(var dt=-1,Qt=G==null?0:G.length;++dt-1}function Uh(G,se,ne){for(var Be=-1,dt=G==null?0:G.length;++Be-1;);return ne}function K0(G,se){for(var ne=G.length;ne--&&Wc(se,G[ne],0)>-1;);return ne}function rG(G,se){for(var ne=G.length,Be=0;ne--;)G[ne]===se&&++Be;return Be}var iG=qh(VK),aG=qh(jK);function sG(G){return"\\"+GK[G]}function oG(G,se){return G==null?e:G[se]}function Xc(G){return kK.test(G)}function uG(G){return MK.test(G)}function cG(G){for(var se,ne=[];!(se=G.next()).done;)ne.push(se.value);return ne}function Gh(G){var se=-1,ne=Array(G.size);return G.forEach(function(Be,dt){ne[++se]=[dt,Be]}),ne}function G0(G,se){return function(ne){return G(se(ne))}}function Xo(G,se){for(var ne=-1,Be=G.length,dt=0,Qt=[];++ne-1}function zG(s,u){var f=this.__data__,h=um(f,s);return h<0?(++this.size,f.push([s,u])):f[h][1]=u,this}ls.prototype.clear=QG,ls.prototype.delete=YG,ls.prototype.get=JG,ls.prototype.has=HG,ls.prototype.set=zG;function ds(s){var u=-1,f=s==null?0:s.length;for(this.clear();++u=u?s:u)),s}function Oi(s,u,f,h,O,L){var k,V=u&d,J=u&p,le=u&E;if(f&&(k=O?f(s,h,O,L):f(s)),k!==e)return k;if(!Dn(s))return s;var de=ft(s);if(de){if(k=eQ(s),!V)return Yr(s,k)}else{var Te=vr(s),be=Te==Je||Te==Bt;if(au(s))return DA(s,V);if(Te==Qr||Te==De||be&&!O){if(k=J||be?{}:$A(s),!V)return J?K$(s,f$(k,s)):j$(s,nA(k,s))}else{if(!hn[Te])return O?s:{};k=tQ(s,Te,V)}}L||(L=new ra);var $e=L.get(s);if($e)return $e;L.set(s,k),IR(s)?s.forEach(function(et){k.add(Oi(et,u,f,et,s,L))}):hR(s)&&s.forEach(function(et,St){k.set(St,Oi(et,u,f,St,s,L))});var Ze=le?J?Ty:Ny:J?Hr:dr,yt=de?e:Ze(s);return gi(yt||s,function(et,St){yt&&(St=et,et=s[St]),Dd(k,St,Oi(et,u,f,St,s,L))}),k}function p$(s){var u=dr(s);return function(f){return rA(f,s,u)}}function rA(s,u,f){var h=f.length;if(s==null)return!h;for(s=mn(s);h--;){var O=f[h],L=u[O],k=s[O];if(k===e&&!(O in s)||!L(k))return!1}return!0}function iA(s,u,f){if(typeof s!="function")throw new _i(i);return Ld(function(){s.apply(e,f)},u)}function bd(s,u,f,h){var O=-1,L=$p,k=!0,V=s.length,J=[],le=u.length;if(!V)return J;f&&(u=vn(u,ui(f))),h?(L=Uh,k=!1):u.length>=n&&(L=Id,k=!1,u=new qu(u));e:for(;++OO?0:O+f),h=h===e||h>O?O:Et(h),h<0&&(h+=O),h=f>h?0:_R(h);f0&&f(V)?u>1?Ir(V,u-1,f,h,O):Wo(O,V):h||(O[O.length]=V)}return O}var Wh=wA(),oA=wA(!0);function wa(s,u){return s&&Wh(s,u,dr)}function Xh(s,u){return s&&oA(s,u,dr)}function lm(s,u){return zo(u,function(f){return Ts(s[f])})}function ju(s,u){u=ru(u,s);for(var f=0,h=u.length;s!=null&&fu}function T$(s,u){return s!=null&&on.call(s,u)}function E$(s,u){return s!=null&&u in mn(s)}function h$(s,u,f){return s>=_r(u,f)&&s=120&&de.length>=120)?new qu(k&&de):e}de=s[0];var Te=-1,be=V[0];e:for(;++Te-1;)V!==s&&tm.call(V,J,1),tm.call(s,J,1);return s}function hA(s,u){for(var f=s?u.length:0,h=f-1;f--;){var O=u[f];if(f==h||O!==L){var L=O;Ns(O)?tm.call(s,O,1):uy(s,O)}}return s}function ay(s,u){return s+im(X0()*(u-s+1))}function F$(s,u,f,h){for(var O=-1,L=tr(rm((u-s)/(f||1)),0),k=ne(L);L--;)k[h?L:++O]=s,s+=f;return k}function sy(s,u){var f="";if(!s||u<1||u>Tn)return f;do u%2&&(f+=s),u=im(u/2),u&&(s+=s);while(u);return f}function It(s,u){return vy(JA(s,u,zr),s+"")}function w$(s){return tA(ul(s))}function L$(s,u){var f=ul(s);return gm(f,Vu(u,0,f.length))}function Pd(s,u,f,h){if(!Dn(s))return s;u=ru(u,s);for(var O=-1,L=u.length,k=L-1,V=s;V!=null&&++OO?0:O+u),f=f>O?O:f,f<0&&(f+=O),O=u>f?0:f-u>>>0,u>>>=0;for(var L=ne(O);++h>>1,k=s[L];k!==null&&!li(k)&&(f?k<=u:k=n){var le=u?null:Y$(s);if(le)return Yp(le);k=!1,O=Id,J=new qu}else J=u?[]:V;e:for(;++h=h?s:Si(s,u,f)}var SA=OG||function(s){return lr.clearTimeout(s)};function DA(s,u){if(u)return s.slice();var f=s.length,h=Y0?Y0(f):new s.constructor(f);return s.copy(h),h}function fy(s){var u=new s.constructor(s.byteLength);return new Zp(u).set(new Zp(s)),u}function M$(s,u){var f=u?fy(s.buffer):s.buffer;return new s.constructor(f,s.byteOffset,s.byteLength)}function x$(s){var u=new s.constructor(s.source,c0.exec(s));return u.lastIndex=s.lastIndex,u}function q$(s){return Sd?mn(Sd.call(s)):{}}function bA(s,u){var f=u?fy(s.buffer):s.buffer;return new s.constructor(f,s.byteOffset,s.length)}function AA(s,u){if(s!==u){var f=s!==e,h=s===null,O=s===s,L=li(s),k=u!==e,V=u===null,J=u===u,le=li(u);if(!V&&!le&&!L&&s>u||L&&k&&J&&!V&&!le||h&&k&&J||!f&&J||!O)return 1;if(!h&&!L&&!le&&s=V)return J;var le=f[h];return J*(le=="desc"?-1:1)}}return s.index-u.index}function RA(s,u,f,h){for(var O=-1,L=s.length,k=f.length,V=-1,J=u.length,le=tr(L-k,0),de=ne(J+le),Te=!h;++V1?f[O-1]:e,k=O>2?f[2]:e;for(L=s.length>3&&typeof L=="function"?(O--,L):e,k&&kr(f[0],f[1],k)&&(L=O<3?e:L,O=1),u=mn(u);++h-1?O[L?u[k]:k]:e}}function BA(s){return ms(function(u){var f=u.length,h=f,O=vi.prototype.thru;for(s&&u.reverse();h--;){var L=u[h];if(typeof L!="function")throw new _i(i);if(O&&!k&&ym(L)=="wrapper")var k=new vi([],!0)}for(h=k?h:f;++h1&&Ft.reverse(),de&&JV))return!1;var le=L.get(s),de=L.get(u);if(le&&de)return le==u&&de==s;var Te=-1,be=!0,$e=f&v?new qu:e;for(L.set(s,u),L.set(u,s);++Te1?"& ":"")+u[h],u=u.join(f>2?", ":" "),s.replace(iK,`{ /* [wrapped with `+u+`] */ `)}function rQ(s){return ft(s)||$u(s)||!!(z0&&s&&s[z0])}function Ns(s,u){var f=typeof s;return u=u==null?Tn:u,!!u&&(f=="number"||f!="symbol"&&NK.test(s))&&s>-1&&s%1==0&&s0){if(++u>=_e)return arguments[0]}else u=0;return s.apply(e,arguments)}}function gm(s,u){var f=-1,h=s.length,O=h-1;for(u=u===e?h:u;++f1?s[u-1]:e;return f=typeof f=="function"?(s.pop(),f):e,sR(s,f)});function oR(s){var u=F(s);return u.__chain__=!0,u}function m2(s,u){return u(s),s}function _m(s,u){return u(s)}var N2=ms(function(s){var u=s.length,f=u?s[0]:0,h=this.__wrapped__,O=function(L){return zh(L,s)};return u>1||this.__actions__.length||!(h instanceof bt)||!Ns(f)?this.thru(O):(h=h.slice(f,+f+(u?1:0)),h.__actions__.push({func:_m,args:[O],thisArg:e}),new vi(h,this.__chain__).thru(function(L){return u&&!L.length&&L.push(e),L}))});function T2(){return oR(this)}function E2(){return new vi(this.value(),this.__chain__)}function h2(){this.__values__===e&&(this.__values__=gR(this.value()));var s=this.__index__>=this.__values__.length,u=s?e:this.__values__[this.__index__++];return{done:s,value:u}}function y2(){return this}function I2(s){for(var u,f=this;f instanceof om;){var h=eR(f);h.__index__=0,h.__values__=e,u?O.__wrapped__=h:u=h;var O=h;f=f.__wrapped__}return O.__wrapped__=s,u}function g2(){var s=this.__wrapped__;if(s instanceof bt){var u=s;return this.__actions__.length&&(u=new bt(this)),u=u.reverse(),u.__actions__.push({func:_m,args:[Oy],thisArg:e}),new vi(u,this.__chain__)}return this.thru(Oy)}function _2(){return vA(this.__wrapped__,this.__actions__)}var v2=mm(function(s,u,f){on.call(s,f)?++s[f]:fs(s,f,1)});function O2(s,u,f){var h=ft(s)?U0:m$;return f&&kr(s,u,f)&&(u=e),h(s,We(u,3))}function S2(s,u){var f=ft(s)?zo:sA;return f(s,We(u,3))}var D2=CA(tR),b2=CA(nR);function A2(s,u){return Ir(vm(s,u),1)}function R2(s,u){return Ir(vm(s,u),$t)}function P2(s,u,f){return f=f===e?1:Et(f),Ir(vm(s,u),f)}function uR(s,u){var f=ft(s)?gi:tu;return f(s,We(u,3))}function cR(s,u){var f=ft(s)?HK:aA;return f(s,We(u,3))}var F2=mm(function(s,u,f){on.call(s,f)?s[f].push(u):fs(s,f,[u])});function w2(s,u,f,h){s=Jr(s)?s:ul(s),f=f&&!h?Et(f):0;var O=s.length;return f<0&&(f=tr(O+f,0)),Am(s)?f<=O&&s.indexOf(u,f)>-1:!!O&&Wc(s,u,f)>-1}var L2=It(function(s,u,f){var h=-1,O=typeof u=="function",L=Jr(s)?ne(s.length):[];return tu(s,function(k){L[++h]=O?oi(u,k,f):Ad(k,u,f)}),L}),C2=mm(function(s,u,f){fs(s,f,u)});function vm(s,u){var f=ft(s)?vn:fA;return f(s,We(u,3))}function B2(s,u,f,h){return s==null?[]:(ft(u)||(u=u==null?[]:[u]),f=h?e:f,ft(f)||(f=f==null?[]:[f]),TA(s,u,f))}var U2=mm(function(s,u,f){s[f?0:1].push(u)},function(){return[[],[]]});function k2(s,u,f){var h=ft(s)?kh:q0,O=arguments.length<3;return h(s,We(u,4),f,O,tu)}function M2(s,u,f){var h=ft(s)?zK:q0,O=arguments.length<3;return h(s,We(u,4),f,O,aA)}function x2(s,u){var f=ft(s)?zo:sA;return f(s,Dm(We(u,3)))}function q2(s){var u=ft(s)?tA:w$;return u(s)}function V2(s,u,f){(f?kr(s,u,f):u===e)?u=1:u=Et(u);var h=ft(s)?c$:L$;return h(s,u)}function j2(s){var u=ft(s)?l$:B$;return u(s)}function K2(s){if(s==null)return 0;if(Jr(s))return Am(s)?Zc(s):s.length;var u=vr(s);return u==it||u==hr?s.size:ny(s).length}function G2(s,u,f){var h=ft(s)?Mh:U$;return f&&kr(s,u,f)&&(u=e),h(s,We(u,3))}var $2=It(function(s,u){if(s==null)return[];var f=u.length;return f>1&&kr(s,u[0],u[1])?u=[]:f>2&&kr(u[0],u[1],u[2])&&(u=[u[0]]),TA(s,Ir(u,1),[])}),Om=SG||function(){return lr.Date.now()};function Q2(s,u){if(typeof u!="function")throw new _i(i);return s=Et(s),function(){if(--s<1)return u.apply(this,arguments)}}function lR(s,u,f){return u=f?e:u,u=s&&u==null?s.length:u,ps(s,ue,e,e,e,e,u)}function dR(s,u){var f;if(typeof u!="function")throw new _i(i);return s=Et(s),function(){return--s>0&&(f=u.apply(this,arguments)),s<=1&&(u=e),f}}var Dy=It(function(s,u,f){var h=A;if(f.length){var O=Xo(f,sl(Dy));h|=te}return ps(s,h,u,f,O)}),fR=It(function(s,u,f){var h=A|U;if(f.length){var O=Xo(f,sl(fR));h|=te}return ps(u,h,s,f,O)});function pR(s,u,f){u=f?e:u;var h=ps(s,$,e,e,e,e,e,u);return h.placeholder=pR.placeholder,h}function mR(s,u,f){u=f?e:u;var h=ps(s,re,e,e,e,e,e,u);return h.placeholder=mR.placeholder,h}function NR(s,u,f){var h,O,L,k,V,J,le=0,de=!1,Te=!1,be=!0;if(typeof s!="function")throw new _i(i);u=bi(u)||0,Dn(f)&&(de=!!f.leading,Te="maxWait"in f,L=Te?tr(bi(f.maxWait)||0,u):L,be="trailing"in f?!!f.trailing:be);function $e(Vn){var aa=h,hs=O;return h=O=e,le=Vn,k=s.apply(hs,aa),k}function Ze(Vn){return le=Vn,V=Ld(St,u),de?$e(Vn):k}function yt(Vn){var aa=Vn-J,hs=Vn-le,CR=u-aa;return Te?_r(CR,L-hs):CR}function et(Vn){var aa=Vn-J,hs=Vn-le;return J===e||aa>=u||aa<0||Te&&hs>=L}function St(){var Vn=Om();if(et(Vn))return Ft(Vn);V=Ld(St,yt(Vn))}function Ft(Vn){return V=e,be&&h?$e(Vn):(h=O=e,k)}function di(){V!==e&&SA(V),le=0,h=J=O=V=e}function Mr(){return V===e?k:Ft(Om())}function fi(){var Vn=Om(),aa=et(Vn);if(h=arguments,O=this,J=Vn,aa){if(V===e)return Ze(J);if(Te)return SA(V),V=Ld(St,u),$e(J)}return V===e&&(V=Ld(St,u)),k}return fi.cancel=di,fi.flush=Mr,fi}var Y2=It(function(s,u){return iA(s,1,u)}),J2=It(function(s,u,f){return iA(s,bi(u)||0,f)});function H2(s){return ps(s,xe)}function Sm(s,u){if(typeof s!="function"||u!=null&&typeof u!="function")throw new _i(i);var f=function(){var h=arguments,O=u?u.apply(this,h):h[0],L=f.cache;if(L.has(O))return L.get(O);var k=s.apply(this,h);return f.cache=L.set(O,k)||L,k};return f.cache=new(Sm.Cache||ds),f}Sm.Cache=ds;function Dm(s){if(typeof s!="function")throw new _i(i);return function(){var u=arguments;switch(u.length){case 0:return!s.call(this);case 1:return!s.call(this,u[0]);case 2:return!s.call(this,u[0],u[1]);case 3:return!s.call(this,u[0],u[1],u[2])}return!s.apply(this,u)}}function z2(s){return dR(2,s)}var W2=k$(function(s,u){u=u.length==1&&ft(u[0])?vn(u[0],ui(We())):vn(Ir(u,1),ui(We()));var f=u.length;return It(function(h){for(var O=-1,L=_r(h.length,f);++O=u}),$u=cA(function(){return arguments}())?cA:function(s){return Ln(s)&&on.call(s,"callee")&&!H0.call(s,"callee")},ft=ne.isArray,fY=P0?ui(P0):I$;function Jr(s){return s!=null&&bm(s.length)&&!Ts(s)}function qn(s){return Ln(s)&&Jr(s)}function pY(s){return s===!0||s===!1||Ln(s)&&Ur(s)==Ot}var au=bG||My,mY=F0?ui(F0):g$;function NY(s){return Ln(s)&&s.nodeType===1&&!Cd(s)}function TY(s){if(s==null)return!0;if(Jr(s)&&(ft(s)||typeof s=="string"||typeof s.splice=="function"||au(s)||ol(s)||$u(s)))return!s.length;var u=vr(s);if(u==it||u==hr)return!s.size;if(wd(s))return!ny(s).length;for(var f in s)if(on.call(s,f))return!1;return!0}function EY(s,u){return Rd(s,u)}function hY(s,u,f){f=typeof f=="function"?f:e;var h=f?f(s,u):e;return h===e?Rd(s,u,e,f):!!h}function Ay(s){if(!Ln(s))return!1;var u=Ur(s);return u==qe||u==ie||typeof s.message=="string"&&typeof s.name=="string"&&!Cd(s)}function yY(s){return typeof s=="number"&&W0(s)}function Ts(s){if(!Dn(s))return!1;var u=Ur(s);return u==Je||u==Bt||u==Ce||u==Hc}function ER(s){return typeof s=="number"&&s==Et(s)}function bm(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=Tn}function Dn(s){var u=typeof s;return s!=null&&(u=="object"||u=="function")}function Ln(s){return s!=null&&typeof s=="object"}var hR=w0?ui(w0):v$;function IY(s,u){return s===u||ty(s,u,hy(u))}function gY(s,u,f){return f=typeof f=="function"?f:e,ty(s,u,hy(u),f)}function _Y(s){return yR(s)&&s!=+s}function vY(s){if(sQ(s))throw new dt(r);return lA(s)}function OY(s){return s===null}function SY(s){return s==null}function yR(s){return typeof s=="number"||Ln(s)&&Ur(s)==Pt}function Cd(s){if(!Ln(s)||Ur(s)!=Qr)return!1;var u=em(s);if(u===null)return!0;var f=on.call(u,"constructor")&&u.constructor;return typeof f=="function"&&f instanceof f&&zp.call(f)==gG}var Ry=L0?ui(L0):O$;function DY(s){return ER(s)&&s>=-Tn&&s<=Tn}var IR=C0?ui(C0):S$;function Am(s){return typeof s=="string"||!ft(s)&&Ln(s)&&Ur(s)==si}function li(s){return typeof s=="symbol"||Ln(s)&&Ur(s)==xt}var ol=B0?ui(B0):D$;function bY(s){return s===e}function AY(s){return Ln(s)&&vr(s)==Bu}function RY(s){return Ln(s)&&Ur(s)==Fa}var PY=hm(ry),FY=hm(function(s,u){return s<=u});function gR(s){if(!s)return[];if(Jr(s))return Am(s)?na(s):Yr(s);if(gd&&s[gd])return cG(s[gd]());var u=vr(s),f=u==it?Gh:u==hr?Yp:ul;return f(s)}function Es(s){if(!s)return s===0?s:0;if(s=bi(s),s===$t||s===-$t){var u=s<0?-1:1;return u*Cr}return s===s?s:0}function Et(s){var u=Es(s),f=u%1;return u===u?f?u-f:u:0}function _R(s){return s?Vu(Et(s),0,xn):0}function bi(s){if(typeof s=="number")return s;if(li(s))return Br;if(Dn(s)){var u=typeof s.valueOf=="function"?s.valueOf():s;s=Dn(u)?u+"":u}if(typeof s!="string")return s===0?s:+s;s=V0(s);var f=fK.test(s);return f||mK.test(s)?QK(s.slice(2),f?2:8):dK.test(s)?Br:+s}function vR(s){return La(s,Hr(s))}function wY(s){return s?Vu(Et(s),-Tn,Tn):s===0?s:0}function zt(s){return s==null?"":ci(s)}var LY=il(function(s,u){if(wd(u)||Jr(u)){La(u,dr(u),s);return}for(var f in u)on.call(u,f)&&Dd(s,f,u[f])}),OR=il(function(s,u){La(u,Hr(u),s)}),Rm=il(function(s,u,f,h){La(u,Hr(u),s,h)}),CY=il(function(s,u,f,h){La(u,dr(u),s,h)}),BY=ms(zh);function UY(s,u){var f=rl(s);return u==null?f:nA(f,u)}var kY=It(function(s,u){s=mn(s);var f=-1,h=u.length,O=h>2?u[2]:e;for(O&&kr(u[0],u[1],O)&&(h=1);++f1),L}),La(s,Ty(s),f),h&&(f=Oi(f,d|p|E,J$));for(var O=u.length;O--;)uy(f,u[O]);return f});function tJ(s,u){return DR(s,Dm(We(u)))}var nJ=ms(function(s,u){return s==null?{}:R$(s,u)});function DR(s,u){if(s==null)return{};var f=vn(Ty(s),function(h){return[h]});return u=We(u),EA(s,f,function(h,O){return u(h,O[0])})}function rJ(s,u,f){u=ru(u,s);var h=-1,O=u.length;for(O||(O=1,s=e);++hu){var h=s;s=u,u=h}if(f||s%1||u%1){var O=X0();return _r(s+O*(u-s+$K("1e-"+((O+"").length-1))),u)}return ay(s,u)}var mJ=al(function(s,u,f){return u=u.toLowerCase(),s+(f?RR(u):u)});function RR(s){return wy(zt(s).toLowerCase())}function PR(s){return s=zt(s),s&&s.replace(TK,iG).replace(BK,"")}function NJ(s,u,f){s=zt(s),u=ci(u);var h=s.length;f=f===e?h:Vu(Et(f),0,h);var O=f;return f-=u.length,f>=0&&s.slice(f,O)==u}function TJ(s){return s=zt(s),s&&zj.test(s)?s.replace(o0,aG):s}function EJ(s){return s=zt(s),s&&nK.test(s)?s.replace(bh,"\\$&"):s}var hJ=al(function(s,u,f){return s+(f?"-":"")+u.toLowerCase()}),yJ=al(function(s,u,f){return s+(f?" ":"")+u.toLowerCase()}),IJ=LA("toLowerCase");function gJ(s,u,f){s=zt(s),u=Et(u);var h=u?Zc(s):0;if(!u||h>=u)return s;var O=(u-h)/2;return Em(im(O),f)+s+Em(rm(O),f)}function _J(s,u,f){s=zt(s),u=Et(u);var h=u?Zc(s):0;return u&&h>>0,f?(s=zt(s),s&&(typeof u=="string"||u!=null&&!Ry(u))&&(u=ci(u),!u&&Xc(s))?iu(na(s),0,f):s.split(u,f)):[]}var RJ=al(function(s,u,f){return s+(f?" ":"")+wy(u)});function PJ(s,u,f){return s=zt(s),f=f==null?0:Vu(Et(f),0,s.length),u=ci(u),s.slice(f,f+u.length)==u}function FJ(s,u,f){var h=F.templateSettings;f&&kr(s,u,f)&&(u=e),s=zt(s),u=Rm({},u,h,qA);var O=Rm({},u.imports,h.imports,qA),L=dr(O),k=Kh(O,L),V,J,le=0,de=u.interpolate||jp,Te="__p += '",be=$h((u.escape||jp).source+"|"+de.source+"|"+(de===u0?lK:jp).source+"|"+(u.evaluate||jp).source+"|$","g"),$e="//# sourceURL="+(on.call(u,"sourceURL")?(u.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++qK+"]")+` `;s.replace(be,function(et,St,Ft,di,Mr,fi){return Ft||(Ft=di),Te+=s.slice(le,fi).replace(EK,sG),St&&(V=!0,Te+=`' + @@ -472,7 +472,7 @@ __p += '`),Ft&&(Te+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Te+`return __p -}`;var yt=wR(function(){return Qt(L,$e+"return "+Te).apply(e,k)});if(yt.source=Te,Ay(yt))throw yt;return yt}function wJ(s){return zt(s).toLowerCase()}function LJ(s){return zt(s).toUpperCase()}function CJ(s,u,f){if(s=zt(s),s&&(f||u===e))return V0(s);if(!s||!(u=ci(u)))return s;var h=na(s),O=na(u),L=j0(h,O),k=K0(h,O)+1;return iu(h,L,k).join("")}function BJ(s,u,f){if(s=zt(s),s&&(f||u===e))return s.slice(0,$0(s)+1);if(!s||!(u=ci(u)))return s;var h=na(s),O=K0(h,na(u))+1;return iu(h,0,O).join("")}function UJ(s,u,f){if(s=zt(s),s&&(f||u===e))return s.replace(Ah,"");if(!s||!(u=ci(u)))return s;var h=na(s),O=j0(h,na(u));return iu(h,O).join("")}function kJ(s,u){var f=rt,h=Z;if(Dn(u)){var O="separator"in u?u.separator:O;f="length"in u?Et(u.length):f,h="omission"in u?ci(u.omission):h}s=zt(s);var L=s.length;if(Xc(s)){var k=na(s);L=k.length}if(f>=L)return s;var V=f-Zc(h);if(V<1)return h;var J=k?iu(k,0,V).join(""):s.slice(0,V);if(O===e)return J+h;if(k&&(V+=J.length-V),Ry(O)){if(s.slice(V).search(O)){var le,de=J;for(O.global||(O=$h(O.source,zt(c0.exec(O))+"g")),O.lastIndex=0;le=O.exec(de);)var Te=le.index;J=J.slice(0,Te===e?V:Te)}}else if(s.indexOf(ci(O),V)!=V){var be=J.lastIndexOf(O);be>-1&&(J=J.slice(0,be))}return J+h}function MJ(s){return s=zt(s),s&&Hj.test(s)?s.replace(s0,pG):s}var xJ=al(function(s,u,f){return s+(f?" ":"")+u.toUpperCase()}),wy=LA("toUpperCase");function FR(s,u,f){return s=zt(s),u=f?e:u,u===e?uG(s)?TG(s):ZK(s):s.match(u)||[]}var wR=It(function(s,u){try{return oi(s,e,u)}catch(f){return Ay(f)?f:new dt(f)}}),qJ=ms(function(s,u){return gi(u,function(f){f=Ca(f),fs(s,f,Dy(s[f],s))}),s});function VJ(s){var u=s==null?0:s.length,f=We();return s=u?vn(s,function(h){if(typeof h[1]!="function")throw new _i(i);return[f(h[0]),h[1]]}):[],It(function(h){for(var O=-1;++OTn)return[];var f=xn,h=_r(s,xn);u=We(u),s-=xn;for(var O=jh(h,u);++f0||u<0)?new bt(f):(s<0?f=f.takeRight(-s):s&&(f=f.drop(s)),u!==e&&(u=Et(u),f=u<0?f.dropRight(-u):f.take(u-s)),f)},bt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},bt.prototype.toArray=function(){return this.take(xn)},wa(bt.prototype,function(s,u){var f=/^(?:filter|find|map|reject)|While$/.test(u),h=/^(?:head|last)$/.test(u),O=F[h?"take"+(u=="last"?"Right":""):u],L=h||/^find/.test(u);O&&(F.prototype[u]=function(){var k=this.__wrapped__,V=h?[1]:arguments,J=k instanceof bt,le=V[0],de=J||ft(k),Te=function(St){var Ft=O.apply(F,Wo([St],V));return h&&be?Ft[0]:Ft};de&&f&&typeof le=="function"&&le.length!=1&&(J=de=!1);var be=this.__chain__,$e=!!this.__actions__.length,Ze=L&&!be,yt=J&&!$e;if(!L&&de){k=yt?k:new bt(this);var et=s.apply(k,V);return et.__actions__.push({func:_m,args:[Te],thisArg:e}),new vi(et,be)}return Ze&&yt?s.apply(this,V):(et=this.thru(Te),Ze?h?et.value()[0]:et.value():et)})}),gi(["pop","push","shift","sort","splice","unshift"],function(s){var u=Jp[s],f=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",h=/^(?:pop|shift)$/.test(s);F.prototype[s]=function(){var O=arguments;if(h&&!this.__chain__){var L=this.value();return u.apply(ft(L)?L:[],O)}return this[f](function(k){return u.apply(ft(k)?k:[],O)})}}),wa(bt.prototype,function(s,u){var f=F[u];if(f){var h=f.name+"";on.call(nl,h)||(nl[h]=[]),nl[h].push({name:u,func:f})}}),nl[Nm(e,U).name]=[{name:"wrapper",func:e}],bt.prototype.clone=MG,bt.prototype.reverse=xG,bt.prototype.value=qG,F.prototype.at=N2,F.prototype.chain=T2,F.prototype.commit=E2,F.prototype.next=h2,F.prototype.plant=I2,F.prototype.reverse=g2,F.prototype.toJSON=F.prototype.valueOf=F.prototype.value=_2,F.prototype.first=F.prototype.head,gd&&(F.prototype[gd]=y2),F},Zo=EG();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(lr._=Zo,define(function(){return Zo})):ku?((ku.exports=Zo)._=Zo,Ch._=Zo):lr._=Zo}).call(ud)});var hV=w(qc=>{"use strict";m();T();N();Object.defineProperty(qc,"__esModule",{value:!0});qc.FederationFactory=void 0;qc.federateSubgraphs=Tfe;qc.federateSubgraphsWithContracts=Efe;qc.federateSubgraphsContract=hfe;var Re=Oe(),mV=yu(),Kr=Ar(),Pe=qi(),Mc=sT(),xc=nd(),Gr=lp(),YE=rE(),hp=Iu(),ffe=nb(),pfe=dp(),NV=Uf(),ge=Bl(),mfe=ab(),TV=pV(),cd=QE(),ve=sr(),JE=Fl(),Ne=Rr(),Nfe=fp(),Fu=kf(),zE,EV,HE=class{constructor({authorizationDataByParentTypeName:t,concreteTypeNamesByAbstractTypeName:n,disableResolvabilityValidation:r,entityDataByTypeName:i,entityInterfaceFederationDataByTypeName:a,fieldCoordsByNamedTypeName:o,internalGraph:c,internalSubgraphBySubgraphName:l,warnings:d}){Yu(this,zE);_(this,"authorizationDataByParentTypeName");_(this,"coordsByNamedTypeName",new Map);_(this,"disableResolvabilityValidation",!1);_(this,"directiveDefinitionByName",new Map);_(this,"clientDefinitions",[]);_(this,"currentSubgraphName","");_(this,"concreteTypeNamesByAbstractTypeName");_(this,"subgraphNamesByNamedTypeNameByFieldCoords",new Map);_(this,"entityDataByTypeName");_(this,"entityInterfaceFederationDataByTypeName");_(this,"errors",[]);_(this,"fieldConfigurationByFieldCoords",new Map);_(this,"fieldCoordsByNamedTypeName");_(this,"inaccessibleCoords",new Set);_(this,"inaccessibleRequiredInputValueErrorByCoords",new Map);_(this,"internalGraph");_(this,"internalSubgraphBySubgraphName");_(this,"invalidORScopesCoords",new Set);_(this,"isMaxDepth",!1);_(this,"isVersionTwo",!1);_(this,"namedInputValueTypeNames",new Set);_(this,"namedOutputTypeNames",new Set);_(this,"parentDefinitionDataByTypeName",new Map);_(this,"parentTagDataByTypeName",new Map);_(this,"persistedDirectiveDefinitionByDirectiveName",new Map([[ve.AUTHENTICATED,Fu.AUTHENTICATED_DEFINITION],[ve.DEPRECATED,Fu.DEPRECATED_DEFINITION],[ve.INACCESSIBLE,Fu.INACCESSIBLE_DEFINITION],[ve.ONE_OF,Fu.ONE_OF_DEFINITION],[ve.REQUIRES_SCOPES,Fu.REQUIRES_SCOPES_DEFINITION],[ve.SEMANTIC_NON_NULL,Fu.SEMANTIC_NON_NULL_DEFINITION],[ve.TAG,Fu.TAG_DEFINITION]]));_(this,"potentialPersistedDirectiveDefinitionDataByDirectiveName",new Map);_(this,"referencedPersistedDirectiveNames",new Set);_(this,"routerDefinitions",[]);_(this,"subscriptionFilterDataByFieldPath",new Map);_(this,"tagNamesByCoords",new Map);_(this,"warnings");this.authorizationDataByParentTypeName=t,this.concreteTypeNamesByAbstractTypeName=n,this.disableResolvabilityValidation=r!=null?r:!1,this.entityDataByTypeName=i,this.entityInterfaceFederationDataByTypeName=a,this.fieldCoordsByNamedTypeName=o,this.internalGraph=c,this.internalSubgraphBySubgraphName=l,this.warnings=d}extractPersistedDirectives({data:t,directivesByName:n}){for(let[r,i]of n)if(this.persistedDirectiveDefinitionByDirectiveName.get(r)&&(this.referencedPersistedDirectiveNames.add(r),!(ve.AUTHORIZATION_DIRECTIVES.has(r)||i.length<1)))switch(r){case ve.DEPRECATED:{t.isDeprecated=!0,(0,ge.upsertDeprecatedDirective)(t,i[0]);break}case ve.TAG:{(0,ge.upsertTagDirectives)(t,i);break}default:{let o=t.directivesByDirectiveName.get(r);if(!o){t.directivesByDirectiveName.set(r,[...i]);break}if(ve.NON_REPEATABLE_PERSISTED_DIRECTIVES.has(r))break;o.push(...i)}}return t}getValidImplementedInterfaces(t){var o;let n=[];if(t.implementedInterfaceTypeNames.size<1)return n;let r=(0,ge.isNodeDataInaccessible)(t),i=new Map,a=new Map;for(let c of t.implementedInterfaceTypeNames){n.push((0,Kr.stringToNamedTypeNode)(c));let l=(0,Ne.getOrThrowError)(this.parentDefinitionDataByTypeName,c,ve.PARENT_DEFINITION_DATA);if(l.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION){a.set(l.name,(0,Ne.kindToNodeType)(l.kind));continue}let d={invalidFieldImplementations:new Map,unimplementedFields:[]},p=!1;for(let[E,I]of l.fieldDataByName){let v=!1,A=t.fieldDataByName.get(E);if(!A){p=!0,d.unimplementedFields.push(E);continue}let U={invalidAdditionalArguments:new Set,invalidImplementedArguments:[],isInaccessible:!1,originalResponseType:(0,YE.printTypeNode)(I.node.type),unimplementedArguments:new Set};(0,ge.isTypeValidImplementation)(I.node.type,A.node.type,this.concreteTypeNamesByAbstractTypeName)||(p=!0,v=!0,U.implementedResponseType=(0,YE.printTypeNode)(A.node.type));let j=new Set;for(let[$,re]of I.argumentDataByName){let te=re.node;j.add($);let me=(o=A.argumentDataByName.get($))==null?void 0:o.node;if(!me){p=!0,v=!0,U.unimplementedArguments.add($);continue}let ue=(0,YE.printTypeNode)(me.type),Ae=(0,YE.printTypeNode)(te.type);Ae!==ue&&(p=!0,v=!0,U.invalidImplementedArguments.push({actualType:ue,argumentName:$,expectedType:Ae}))}for(let[$,re]of A.argumentDataByName){let te=re.node;j.has($)||te.type.kind===Re.Kind.NON_NULL_TYPE&&(p=!0,v=!0,U.invalidAdditionalArguments.add($))}!r&&A.isInaccessible&&!I.isInaccessible&&(p=!0,v=!0,U.isInaccessible=!0),v&&d.invalidFieldImplementations.set(E,U)}p&&i.set(c,d)}return a.size>0&&this.errors.push((0,Pe.invalidImplementedTypeError)(t.name,a)),i.size>0&&this.errors.push((0,Pe.invalidInterfaceImplementationError)(t.node.name.value,(0,Ne.kindToNodeType)(t.kind),i)),n}addValidPrimaryKeyTargetsToEntityData(t){var p;let n=this.entityDataByTypeName.get(t);if(!n)return;let r=(0,Ne.getOrThrowError)(this.internalSubgraphBySubgraphName,this.currentSubgraphName,"internalSubgraphBySubgraphName"),i=r.parentDefinitionDataByTypeName,a=i.get(n.typeName);if(!a||a.kind!==Re.Kind.OBJECT_TYPE_DEFINITION)throw(0,Pe.incompatibleParentKindFatalError)(n.typeName,Re.Kind.OBJECT_TYPE_DEFINITION,(a==null?void 0:a.kind)||Re.Kind.NULL);let o=r.configurationDataByTypeName.get(n.typeName);if(!o)return;let c=[],l=this.internalGraph.nodeByNodeName.get(`${this.currentSubgraphName}.${n.typeName}`);(0,Mc.validateImplicitFieldSets)({conditionalFieldDataByCoords:r.conditionalFieldDataByCoordinates,currentSubgraphName:this.currentSubgraphName,entityData:n,implicitKeys:c,objectData:a,parentDefinitionDataByTypeName:i,graphNode:l});for(let[E,I]of this.entityInterfaceFederationDataByTypeName){if(!((p=I.concreteTypeNames)!=null&&p.has(n.typeName)))continue;let v=this.entityDataByTypeName.get(E);v&&(0,Mc.validateImplicitFieldSets)({conditionalFieldDataByCoords:r.conditionalFieldDataByCoordinates,currentSubgraphName:this.currentSubgraphName,entityData:v,implicitKeys:c,objectData:a,parentDefinitionDataByTypeName:i,graphNode:l})}if(c.length<1)return;if(!o.keys||o.keys.length<1){o.isRootNode=!0,o.keys=c;return}let d=new Set(o.keys.map(E=>E.selectionSet));for(let E of c)d.has(E.selectionSet)||(o.keys.push(E),d.add(E.selectionSet))}addValidPrimaryKeyTargetsFromInterfaceObject(t,n,r,i){let a=t.parentDefinitionDataByTypeName,o=a.get(n);if(!o||!(0,ge.isParentDataCompositeOutputType)(o))throw(0,Pe.incompatibleParentKindFatalError)(n,Re.Kind.INTERFACE_TYPE_DEFINITION,(o==null?void 0:o.kind)||Re.Kind.NULL);let c=(0,Ne.getOrThrowError)(t.configurationDataByTypeName,r.typeName,"internalSubgraph.configurationDataByTypeName"),l=[];if((0,Mc.validateImplicitFieldSets)({conditionalFieldDataByCoords:t.conditionalFieldDataByCoordinates,currentSubgraphName:t.name,entityData:r,implicitKeys:l,objectData:o,parentDefinitionDataByTypeName:a,graphNode:i}),l.length<1)return;if(!c.keys||c.keys.length<1){c.isRootNode=!0,c.keys=l;return}let d=new Set(c.keys.map(p=>p.selectionSet));for(let p of l)d.has(p.selectionSet)||(c.keys.push(p),d.add(p.selectionSet))}getEnumValueMergeMethod(t){return this.namedInputValueTypeNames.has(t)?this.namedOutputTypeNames.has(t)?ge.MergeMethod.CONSISTENT:ge.MergeMethod.INTERSECTION:ge.MergeMethod.UNION}generateTagData(){for(let[t,n]of this.tagNamesByCoords){let r=t.split(ve.PERIOD);if(r.length<1)continue;let i=(0,Ne.getValueOrDefault)(this.parentTagDataByTypeName,r[0],()=>(0,Mc.newParentTagData)(r[0]));switch(r.length){case 1:for(let l of n)i.tagNames.add(l);break;case 2:let a=(0,Ne.getValueOrDefault)(i.childTagDataByChildName,r[1],()=>(0,Mc.newChildTagData)(r[1]));for(let l of n)a.tagNames.add(l);break;case 3:let o=(0,Ne.getValueOrDefault)(i.childTagDataByChildName,r[1],()=>(0,Mc.newChildTagData)(r[1])),c=(0,Ne.getValueOrDefault)(o.tagNamesByArgumentName,r[2],()=>new Set);for(let l of n)c.add(l);break;default:break}}}upsertEnumValueData(t,n,r){let i=t.get(n.name),a=i||this.copyEnumValueData(n);this.extractPersistedDirectives({data:a.persistedDirectivesData,directivesByName:n.directivesByDirectiveName});let o=(0,ge.isNodeDataInaccessible)(n);if((r||o)&&this.inaccessibleCoords.add(a.federatedCoords),this.recordTagNamesByCoords(a,a.federatedCoords),!i){t.set(a.name,a);return}a.appearances+=1,(0,Ne.addNewObjectValueMapEntries)(n.configureDescriptionDataBySubgraphName,a.configureDescriptionDataBySubgraphName),(0,ge.setLongestDescription)(a,n),(0,Ne.addIterableToSet)({source:n.subgraphNames,target:a.subgraphNames})}upsertInputValueData(t,n,r,i){let a=t.get(n.name),o=a||this.copyInputValueData(n);if(this.extractPersistedDirectives({data:o.persistedDirectivesData,directivesByName:n.directivesByDirectiveName}),this.recordTagNamesByCoords(o,`${r}.${o.name}`),this.namedInputValueTypeNames.add(o.namedTypeName),(0,Ne.getValueOrDefault)(this.coordsByNamedTypeName,o.namedTypeName,()=>new Set).add(o.federatedCoords),!a){t.set(o.name,o);return}(0,Ne.addNewObjectValueMapEntries)(n.configureDescriptionDataBySubgraphName,o.configureDescriptionDataBySubgraphName),(0,ge.setLongestDescription)(o,n),(0,Ne.addIterableToSet)({source:n.requiredSubgraphNames,target:o.requiredSubgraphNames}),(0,Ne.addIterableToSet)({source:n.subgraphNames,target:o.subgraphNames}),this.handleInputValueInaccessibility(i,o,r);let c=(0,cd.getMostRestrictiveMergedTypeNode)(o.type,n.type,o.originalCoords,this.errors);c.success?o.type=c.typeNode:this.errors.push((0,Pe.incompatibleMergedTypesError)({actualType:c.actualType,isArgument:a.isArgument,coords:a.federatedCoords,expectedType:c.expectedType})),(0,ge.compareAndValidateInputValueDefaultValues)(o,n,this.errors)}handleInputValueInaccessibility(t,n,r){if(t){this.inaccessibleRequiredInputValueErrorByCoords.delete(n.federatedCoords),this.inaccessibleCoords.add(n.federatedCoords);return}if((0,ge.isNodeDataInaccessible)(n)){if((0,ge.isTypeRequired)(n.type)){this.inaccessibleRequiredInputValueErrorByCoords.set(n.federatedCoords,(0,Pe.inaccessibleRequiredInputValueError)(n,r));return}this.inaccessibleCoords.add(n.federatedCoords)}}handleSubscriptionFilterDirective(t,n){let r=t.directivesByDirectiveName.get(ve.SUBSCRIPTION_FILTER);if(!r)return;let i=(0,Ne.getFirstEntry)(t.subgraphNames);if(i===void 0){this.errors.push((0,Pe.unknownFieldSubgraphNameError)(t.federatedCoords));return}this.subscriptionFilterDataByFieldPath.set(t.federatedCoords,{directive:r[0],fieldData:n||t,directiveSubgraphName:i})}federateOutputType({current:t,other:n,coords:r,mostRestrictive:i}){n=(0,mV.getMutableTypeNode)(n,r,this.errors);let a={kind:t.kind},o=cd.DivergentType.NONE,c=a;for(let l=0;lnew Set)})}upsertFieldData(t,n,r){let i=t.get(n.name),a=i||this.copyFieldData(n,r||(0,ge.isNodeDataInaccessible)(n));(0,Ne.getValueOrDefault)(this.coordsByNamedTypeName,n.namedTypeName,()=>new Set).add(a.federatedCoords),this.namedOutputTypeNames.add(n.namedTypeName),this.handleSubscriptionFilterDirective(n,a),this.extractPersistedDirectives({data:a.persistedDirectivesData,directivesByName:n.directivesByDirectiveName});let o=r||(0,ge.isNodeDataInaccessible)(a);if(o&&this.inaccessibleCoords.add(a.federatedCoords),this.recordTagNamesByCoords(a,a.federatedCoords),!i){t.set(a.name,a);return}let c=this.federateOutputType({current:a.type,other:n.type,coords:a.federatedCoords,mostRestrictive:!1});if(c.success)if(a.type=c.typeNode,a.namedTypeName!==n.namedTypeName){let l=(0,Ne.getValueOrDefault)(this.subgraphNamesByNamedTypeNameByFieldCoords,a.federatedCoords,()=>new Map),d=(0,Ne.getValueOrDefault)(l,a.namedTypeName,()=>new Set);if(d.size<1)for(let p of a.subgraphNames)n.subgraphNames.has(p)||d.add(p);(0,Ne.addIterableToSet)({source:n.subgraphNames,target:(0,Ne.getValueOrDefault)(l,n.namedTypeName,()=>new Set)})}else this.addSubgraphNameToExistingFieldNamedTypeDisparity(n);for(let l of n.argumentDataByName.values())this.upsertInputValueData(a.argumentDataByName,l,a.federatedCoords,o);(0,Ne.addNewObjectValueMapEntries)(n.configureDescriptionDataBySubgraphName,i.configureDescriptionDataBySubgraphName),(0,ge.setLongestDescription)(a,n),a.isInaccessible||(a.isInaccessible=n.isInaccessible),(0,Ne.addNewObjectValueMapEntries)(n.externalFieldDataBySubgraphName,a.externalFieldDataBySubgraphName),(0,Ne.addMapEntries)({source:n.isShareableBySubgraphName,target:a.isShareableBySubgraphName}),(0,Ne.addMapEntries)({source:n.nullLevelsBySubgraphName,target:a.nullLevelsBySubgraphName}),(0,Ne.addIterableToSet)({source:n.subgraphNames,target:a.subgraphNames})}getClientSchemaUnionMembers(t){let n=[];for(let[r,i]of t.memberByMemberTypeName)this.inaccessibleCoords.has(r)||n.push(i);return n}recordTagNamesByCoords(t,n){let r=n||t.name;if(t.persistedDirectivesData.tagDirectiveByName.size<1)return;let i=(0,Ne.getValueOrDefault)(this.tagNamesByCoords,r,()=>new Set);for(let a of t.persistedDirectivesData.tagDirectiveByName.keys())i.add(a)}copyMutualParentDefinitionData(t){return{configureDescriptionDataBySubgraphName:(0,Ne.copyObjectValueMap)(t.configureDescriptionDataBySubgraphName),directivesByDirectiveName:(0,Ne.copyArrayValueMap)(t.directivesByDirectiveName),extensionType:t.extensionType,name:t.name,persistedDirectivesData:this.extractPersistedDirectives({data:(0,ge.newPersistedDirectivesData)(),directivesByName:t.directivesByDirectiveName}),description:(0,ge.getInitialFederatedDescription)(t)}}copyEnumValueData(t){return{appearances:t.appearances,configureDescriptionDataBySubgraphName:(0,Ne.copyObjectValueMap)(t.configureDescriptionDataBySubgraphName),federatedCoords:t.federatedCoords,directivesByDirectiveName:(0,Ne.copyArrayValueMap)(t.directivesByDirectiveName),kind:t.kind,name:t.name,node:{directives:[],kind:t.kind,name:(0,Kr.stringToNameNode)(t.name)},parentTypeName:t.parentTypeName,persistedDirectivesData:this.extractPersistedDirectives({data:(0,ge.newPersistedDirectivesData)(),directivesByName:t.directivesByDirectiveName}),subgraphNames:new Set(t.subgraphNames),description:(0,ge.getInitialFederatedDescription)(t)}}copyInputValueData(t){return{configureDescriptionDataBySubgraphName:(0,Ne.copyObjectValueMap)(t.configureDescriptionDataBySubgraphName),directivesByDirectiveName:(0,Ne.copyArrayValueMap)(t.directivesByDirectiveName),federatedCoords:t.federatedCoords,fieldName:t.fieldName,includeDefaultValue:t.includeDefaultValue,isArgument:t.isArgument,kind:t.kind,name:t.name,namedTypeKind:t.namedTypeKind,namedTypeName:t.namedTypeName,node:{directives:[],kind:Re.Kind.INPUT_VALUE_DEFINITION,name:(0,Kr.stringToNameNode)(t.name),type:t.type},originalCoords:t.originalCoords,originalParentTypeName:t.originalParentTypeName,persistedDirectivesData:this.extractPersistedDirectives({data:(0,ge.newPersistedDirectivesData)(),directivesByName:t.directivesByDirectiveName}),renamedParentTypeName:t.renamedParentTypeName,requiredSubgraphNames:new Set(t.requiredSubgraphNames),subgraphNames:new Set(t.subgraphNames),type:t.type,defaultValue:t.defaultValue,description:(0,ge.getInitialFederatedDescription)(t)}}copyInputValueDataByValueName(t,n,r){let i=new Map;for(let[a,o]of t){let c=this.copyInputValueData(o);this.handleInputValueInaccessibility(n,c,r),(0,Ne.getValueOrDefault)(this.coordsByNamedTypeName,c.namedTypeName,()=>new Set).add(c.federatedCoords),this.namedInputValueTypeNames.add(c.namedTypeName),this.recordTagNamesByCoords(c,`${r}.${o.name}`),i.set(a,c)}return i}copyFieldData(t,n){return{argumentDataByName:this.copyInputValueDataByValueName(t.argumentDataByName,n,t.federatedCoords),configureDescriptionDataBySubgraphName:(0,Ne.copyObjectValueMap)(t.configureDescriptionDataBySubgraphName),directivesByDirectiveName:(0,Ne.copyArrayValueMap)(t.directivesByDirectiveName),externalFieldDataBySubgraphName:(0,Ne.copyObjectValueMap)(t.externalFieldDataBySubgraphName),federatedCoords:t.federatedCoords,inheritedDirectiveNames:new Set,isInaccessible:t.isInaccessible,isShareableBySubgraphName:new Map(t.isShareableBySubgraphName),kind:t.kind,name:t.name,namedTypeKind:t.namedTypeKind,namedTypeName:t.namedTypeName,node:{arguments:[],directives:[],kind:t.kind,name:(0,Kr.stringToNameNode)(t.name),type:t.type},nullLevelsBySubgraphName:t.nullLevelsBySubgraphName,originalParentTypeName:t.originalParentTypeName,persistedDirectivesData:this.extractPersistedDirectives({data:(0,ge.newPersistedDirectivesData)(),directivesByName:t.directivesByDirectiveName}),renamedParentTypeName:t.renamedParentTypeName,subgraphNames:new Set(t.subgraphNames),type:t.type,description:(0,ge.getInitialFederatedDescription)(t)}}copyEnumValueDataByName(t,n){let r=new Map;for(let[i,a]of t){let o=this.copyEnumValueData(a);this.recordTagNamesByCoords(o,o.federatedCoords),(n||(0,ge.isNodeDataInaccessible)(o))&&this.inaccessibleCoords.add(o.federatedCoords),r.set(i,o)}return r}copyFieldDataByName(t,n){let r=new Map;for(let[i,a]of t){let o=n||(0,ge.isNodeDataInaccessible)(a),c=this.copyFieldData(a,o);this.handleSubscriptionFilterDirective(c),(0,Ne.getValueOrDefault)(this.coordsByNamedTypeName,c.namedTypeName,()=>new Set).add(c.federatedCoords),this.namedOutputTypeNames.add(c.namedTypeName),this.recordTagNamesByCoords(c,c.federatedCoords),o&&this.inaccessibleCoords.add(c.federatedCoords),r.set(i,c)}return r}copyParentDefinitionData(t){let n=this.copyMutualParentDefinitionData(t);switch(t.kind){case Re.Kind.ENUM_TYPE_DEFINITION:return Q(M({},n),{appearances:t.appearances,enumValueDataByName:this.copyEnumValueDataByName(t.enumValueDataByName,t.isInaccessible),isInaccessible:t.isInaccessible,kind:t.kind,node:{kind:t.kind,name:(0,Kr.stringToNameNode)(t.name)},subgraphNames:new Set(t.subgraphNames)});case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:return Q(M({},n),{inputValueDataByName:this.copyInputValueDataByValueName(t.inputValueDataByName,t.isInaccessible,t.name),isInaccessible:t.isInaccessible,kind:t.kind,node:{kind:t.kind,name:(0,Kr.stringToNameNode)(t.name)},subgraphNames:new Set(t.subgraphNames)});case Re.Kind.INTERFACE_TYPE_DEFINITION:return Q(M({},n),{fieldDataByName:this.copyFieldDataByName(t.fieldDataByName,t.isInaccessible),implementedInterfaceTypeNames:new Set(t.implementedInterfaceTypeNames),isEntity:t.isEntity,isInaccessible:t.isInaccessible,kind:t.kind,node:{kind:t.kind,name:(0,Kr.stringToNameNode)(t.name)},requireFetchReasonsFieldNames:new Set,subgraphNames:new Set(t.subgraphNames)});case Re.Kind.OBJECT_TYPE_DEFINITION:return Q(M({},n),{fieldDataByName:this.copyFieldDataByName(t.fieldDataByName,t.isInaccessible),implementedInterfaceTypeNames:new Set(t.implementedInterfaceTypeNames),isEntity:t.isEntity,isInaccessible:t.isInaccessible,isRootType:t.isRootType,kind:t.kind,node:{kind:t.kind,name:(0,Kr.stringToNameNode)(t.renamedTypeName||t.name)},requireFetchReasonsFieldNames:new Set,renamedTypeName:t.renamedTypeName,subgraphNames:new Set(t.subgraphNames)});case Re.Kind.SCALAR_TYPE_DEFINITION:return Q(M({},n),{kind:t.kind,node:{kind:t.kind,name:(0,Kr.stringToNameNode)(t.name)},subgraphNames:new Set(t.subgraphNames)});case Re.Kind.UNION_TYPE_DEFINITION:return Q(M({},n),{kind:t.kind,node:{kind:t.kind,name:(0,Kr.stringToNameNode)(t.name)},memberByMemberTypeName:new Map(t.memberByMemberTypeName),subgraphNames:new Set(t.subgraphNames)})}}getParentTargetData({existingData:t,incomingData:n}){if(!t){let r=this.copyParentDefinitionData(n);return(0,ge.isParentDataRootType)(r)&&(r.extensionType=NV.ExtensionType.NONE),r}return this.extractPersistedDirectives({data:t.persistedDirectivesData,directivesByName:n.directivesByDirectiveName}),t}upsertParentDefinitionData(t,n){let r=this.entityInterfaceFederationDataByTypeName.get(t.name),i=this.parentDefinitionDataByTypeName.get(t.name),a=this.getParentTargetData({existingData:i,incomingData:t});this.recordTagNamesByCoords(a);let o=(0,ge.isNodeDataInaccessible)(a);if(o&&this.inaccessibleCoords.add(a.name),r&&r.interfaceObjectSubgraphNames.has(n)){if(i&&i.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION){this.errors.push((0,Pe.incompatibleParentTypeMergeError)({existingData:i,incomingSubgraphName:n}));return}a.kind=Re.Kind.INTERFACE_TYPE_DEFINITION,a.node.kind=Re.Kind.INTERFACE_TYPE_DEFINITION}if(!i){this.parentDefinitionDataByTypeName.set(a.name,a);return}if(a.kind!==t.kind&&(!r||!r.interfaceObjectSubgraphNames.has(n)||a.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION||t.kind!==Re.Kind.OBJECT_TYPE_DEFINITION)){this.errors.push((0,Pe.incompatibleParentTypeMergeError)({existingData:a,incomingNodeType:(0,Ne.kindToNodeType)(t.kind),incomingSubgraphName:n}));return}switch((0,Ne.addNewObjectValueMapEntries)(t.configureDescriptionDataBySubgraphName,a.configureDescriptionDataBySubgraphName),(0,ge.setLongestDescription)(a,t),(0,ge.setParentDataExtensionType)(a,t),a.kind){case Re.Kind.ENUM_TYPE_DEFINITION:if(!(0,ge.areKindsEqual)(a,t))return;a.appearances+=1,a.isInaccessible||(a.isInaccessible=o),(0,Ne.addIterableToSet)({source:t.subgraphNames,target:a.subgraphNames});for(let l of t.enumValueDataByName.values())this.upsertEnumValueData(a.enumValueDataByName,l,o);return;case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:if(!(0,ge.areKindsEqual)(a,t))return;o&&!a.isInaccessible&&this.propagateInaccessibilityToExistingChildren(a),a.isInaccessible||(a.isInaccessible=o),(0,Ne.addIterableToSet)({source:t.subgraphNames,target:a.subgraphNames});for(let l of t.inputValueDataByName.values())this.upsertInputValueData(a.inputValueDataByName,l,a.name,a.isInaccessible);return;case Re.Kind.INTERFACE_TYPE_DEFINITION:case Re.Kind.OBJECT_TYPE_DEFINITION:let c=t;o&&!a.isInaccessible&&this.propagateInaccessibilityToExistingChildren(a),a.isInaccessible||(a.isInaccessible=o),(0,Ne.addIterableToSet)({source:c.implementedInterfaceTypeNames,target:a.implementedInterfaceTypeNames}),(0,Ne.addIterableToSet)({source:c.subgraphNames,target:a.subgraphNames});for(let l of c.fieldDataByName.values())this.upsertFieldData(a.fieldDataByName,l,a.isInaccessible);return;case Re.Kind.UNION_TYPE_DEFINITION:if(!(0,ge.areKindsEqual)(a,t))return;(0,Ne.addMapEntries)({source:t.memberByMemberTypeName,target:a.memberByMemberTypeName}),(0,Ne.addIterableToSet)({source:t.subgraphNames,target:a.subgraphNames});return;default:(0,Ne.addIterableToSet)({source:t.subgraphNames,target:a.subgraphNames});return}}propagateInaccessibilityToExistingChildren(t){switch(t.kind){case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:for(let n of t.inputValueDataByName.values())this.inaccessibleCoords.add(n.federatedCoords);break;default:for(let n of t.fieldDataByName.values()){this.inaccessibleCoords.add(n.federatedCoords);for(let r of n.argumentDataByName.values())this.inaccessibleCoords.add(r.federatedCoords)}}}upsertPersistedDirectiveDefinitionData(t,n){let r=t.name,i=this.potentialPersistedDirectiveDefinitionDataByDirectiveName.get(r);if(!i){if(n>1)return;let a=new Map;for(let o of t.argumentDataByName.values())this.namedInputValueTypeNames.add(o.namedTypeName),this.upsertInputValueData(a,o,`@${t.name}`,!1);this.potentialPersistedDirectiveDefinitionDataByDirectiveName.set(r,{argumentDataByName:a,executableLocations:new Set(t.executableLocations),name:r,repeatable:t.repeatable,subgraphNames:new Set(t.subgraphNames),description:t.description});return}if(i.subgraphNames.size+1!==n){this.potentialPersistedDirectiveDefinitionDataByDirectiveName.delete(r);return}if((0,ge.setMutualExecutableLocations)(i,t.executableLocations),i.executableLocations.size<1){this.potentialPersistedDirectiveDefinitionDataByDirectiveName.delete(r);return}for(let a of t.argumentDataByName.values())this.namedInputValueTypeNames.add((0,mV.getTypeNodeNamedTypeName)(a.type)),this.upsertInputValueData(i.argumentDataByName,a,`@${i.name}`,!1);(0,ge.setLongestDescription)(i,t),i.repeatable&&(i.repeatable=t.repeatable),(0,Ne.addIterableToSet)({source:t.subgraphNames,target:i.subgraphNames})}shouldUpdateFederatedFieldAbstractNamedType(t,n){if(!t)return!1;let r=this.concreteTypeNamesByAbstractTypeName.get(t);if(!r||r.size<1)return!1;for(let i of n)if(!r.has(i))return!1;return!0}updateTypeNodeNamedType(t,n){let r=t;for(let i=0;i1){this.errors.push((0,Pe.incompatibleFederatedFieldNamedTypeError)(t,n));continue}break}case Re.Kind.UNION_TYPE_DEFINITION:{if(l){this.errors.push((0,Pe.incompatibleFederatedFieldNamedTypeError)(t,n));continue}l=p;break}default:{this.errors.push((0,Pe.incompatibleFederatedFieldNamedTypeError)(t,n));break}}}if(o.size<1&&!l){this.errors.push((0,Pe.incompatibleFederatedFieldNamedTypeError)(t,n));continue}let d=l;if(o.size>0){if(l){this.errors.push((0,Pe.incompatibleFederatedFieldNamedTypeError)(t,n));continue}for(let p of o.keys()){d=p;for(let[E,I]of o)if(p!==E&&!I.implementedInterfaceTypeNames.has(p)){d="";break}if(d)break}}if(!this.shouldUpdateFederatedFieldAbstractNamedType(d,c)){this.errors.push((0,Pe.incompatibleFederatedFieldNamedTypeError)(t,n));continue}a.namedTypeName=d,this.updateTypeNodeNamedType(a.type,d)}}federateInternalSubgraphData(){let t=0,n=!1;for(let r of this.internalSubgraphBySubgraphName.values()){t+=1,this.currentSubgraphName=r.name,this.isVersionTwo||(this.isVersionTwo=r.isVersionTwo),(0,mfe.renameRootTypes)(this,r);for(let i of r.parentDefinitionDataByTypeName.values())this.upsertParentDefinitionData(i,r.name);if(!n){if(!r.persistedDirectiveDefinitionDataByDirectiveName.size){n=!0;continue}for(let i of r.persistedDirectiveDefinitionDataByDirectiveName.values())this.upsertPersistedDirectiveDefinitionData(i,t);this.potentialPersistedDirectiveDefinitionDataByDirectiveName.size<1&&(n=!0)}}this.handleDisparateFieldNamedTypes()}handleInterfaceObjectForInternalGraph({entityData:t,internalSubgraph:n,interfaceObjectData:r,interfaceObjectNode:i,resolvableKeyFieldSets:a,subgraphName:o}){let c=this.internalGraph.addOrUpdateNode(t.typeName),l=this.internalGraph.addEntityDataNode(t.typeName);for(let p of i.satisfiedFieldSets)c.satisfiedFieldSets.add(p),a.has(p)&&l.addTargetSubgraphByFieldSet(p,o);let d=r.fieldDatasBySubgraphName.get(o);for(let{name:p,namedTypeName:E}of d||[])this.internalGraph.addEdge(c,this.internalGraph.addOrUpdateNode(E),p);this.internalGraph.addEdge(i,c,t.typeName,!0),this.addValidPrimaryKeyTargetsFromInterfaceObject(n,i.typeName,t,c)}handleEntityInterfaces(){var t;for(let[n,r]of this.entityInterfaceFederationDataByTypeName){let i=(0,Ne.getOrThrowError)(this.parentDefinitionDataByTypeName,n,ve.PARENT_DEFINITION_DATA);if(i.kind===Re.Kind.INTERFACE_TYPE_DEFINITION)for(let a of r.interfaceObjectSubgraphNames){let o=(0,Ne.getOrThrowError)(this.internalSubgraphBySubgraphName,a,"internalSubgraphBySubgraphName"),c=o.configurationDataByTypeName,l=this.concreteTypeNamesByAbstractTypeName.get(n);if(!l)continue;let d=(0,Ne.getOrThrowError)(c,n,"configurationDataByTypeName"),p=d.keys;if(!p)continue;d.entityInterfaceConcreteTypeNames=new Set(r.concreteTypeNames),this.internalGraph.setSubgraphName(a);let E=this.internalGraph.addOrUpdateNode(n,{isAbstract:!0});for(let I of l){let v=(0,Ne.getOrThrowError)(this.parentDefinitionDataByTypeName,I,ve.PARENT_DEFINITION_DATA);if(!(0,Gr.isObjectDefinitionData)(v))continue;let A=(0,Ne.getOrThrowError)(this.entityDataByTypeName,I,"entityDataByTypeName");A.subgraphNames.add(a);let U=c.get(I);if(U)if((0,Ne.addIterableToSet)({source:d.fieldNames,target:U.fieldNames}),!U.keys)U.keys=[...p];else e:for(let te of p){for(let{selectionSet:me}of U.keys)if(te.selectionSet===me)continue e;U.keys.push(te)}else c.set(I,{fieldNames:new Set(d.fieldNames),isRootNode:!0,keys:[...p],typeName:I});let j=new Set;for(let te of p.filter(me=>!me.disableEntityResolver))j.add(te.selectionSet);let $=this.authorizationDataByParentTypeName.get(n),re=(0,Ne.getOrThrowError)(o.parentDefinitionDataByTypeName,n,"internalSubgraph.parentDefinitionDataByTypeName");if((0,Gr.isObjectDefinitionData)(re)){for(let[te,me]of re.fieldDataByName){let ue=`${I}.${te}`;(0,Ne.getValueOrDefault)(this.fieldCoordsByNamedTypeName,me.namedTypeName,()=>new Set).add(ue);let Ae=$==null?void 0:$.fieldAuthDataByFieldName.get(te);if(Ae){let Z=(0,Ne.getValueOrDefault)(this.authorizationDataByParentTypeName,I,()=>(0,Gr.newAuthorizationData)(I));(0,Gr.upsertFieldAuthorizationData)(Z.fieldAuthDataByFieldName,Ae)||this.invalidORScopesCoords.add(ue)}let xe=v.fieldDataByName.get(te);if(xe){let Z=(t=me.isShareableBySubgraphName.get(a))!=null?t:!1;xe.isShareableBySubgraphName.set(a,Z),xe.subgraphNames.add(a);let _e=me.externalFieldDataBySubgraphName.get(a);if(!_e)continue;xe.externalFieldDataBySubgraphName.set(a,M({},_e));continue}let rt=i.isInaccessible||v.isInaccessible||me.isInaccessible;v.fieldDataByName.set(te,this.copyFieldData(me,rt))}this.handleInterfaceObjectForInternalGraph({internalSubgraph:o,subgraphName:a,interfaceObjectData:r,interfaceObjectNode:E,resolvableKeyFieldSets:j,entityData:A})}}}}}fieldDataToGraphFieldData(t){var n;return{name:t.name,namedTypeName:t.namedTypeName,isLeaf:(0,Gr.isNodeLeaf)((n=this.parentDefinitionDataByTypeName.get(t.namedTypeName))==null?void 0:n.kind),subgraphNames:t.subgraphNames}}getValidFlattenedPersistedDirectiveNodeArray(t){var i;let n=(0,Gr.getNodeCoords)(t),r=[];for(let[a,o]of t.persistedDirectivesData.directivesByDirectiveName){if(a===ve.SEMANTIC_NON_NULL&&(0,ge.isFieldData)(t)){r.push((0,Ne.generateSemanticNonNullDirective)((i=(0,Ne.getFirstEntry)(t.nullLevelsBySubgraphName))!=null?i:new Set([0])));continue}let c=this.persistedDirectiveDefinitionByDirectiveName.get(a);if(c){if(o.length<2){r.push(...o);continue}if(!c.repeatable){this.errors.push((0,Pe.invalidRepeatedFederatedDirectiveErrorMessage)(a,n));continue}r.push(...o)}}return r}getRouterPersistedDirectiveNodes(t){let n=[...t.persistedDirectivesData.tagDirectiveByName.values()];return t.persistedDirectivesData.isDeprecated&&n.push((0,ge.generateDeprecatedDirective)(t.persistedDirectivesData.deprecatedReason)),n.push(...this.getValidFlattenedPersistedDirectiveNodeArray(t)),n}getFederatedGraphNodeDescription(t){if(t.configureDescriptionDataBySubgraphName.size<1)return t.description;let n=[],r="";for(let[i,{propagate:a,description:o}]of t.configureDescriptionDataBySubgraphName)a&&(n.push(i),r=o);if(n.length===1)return(0,Mc.getDescriptionFromString)(r);if(n.length<1)return t.description;this.errors.push((0,Pe.configureDescriptionPropagationError)((0,ge.getDefinitionDataCoords)(t,!0),n))}getNodeForRouterSchemaByData(t){return t.node.name=(0,Kr.stringToNameNode)(t.name),t.node.description=this.getFederatedGraphNodeDescription(t),t.node.directives=this.getRouterPersistedDirectiveNodes(t),t.node}getNodeWithPersistedDirectivesByInputValueData(t){return t.node.name=(0,Kr.stringToNameNode)(t.name),t.node.type=t.type,t.node.description=this.getFederatedGraphNodeDescription(t),t.node.directives=this.getRouterPersistedDirectiveNodes(t),t.includeDefaultValue&&(t.node.defaultValue=t.defaultValue),t.node}getValidFieldArgumentNodes(t){let n=[],r=[],i=[],a=`${t.renamedParentTypeName}.${t.name}`;for(let[o,c]of t.argumentDataByName)t.subgraphNames.size===c.subgraphNames.size?(r.push(o),n.push(this.getNodeWithPersistedDirectivesByInputValueData(c))):(0,ge.isTypeRequired)(c.type)&&i.push({inputValueName:o,missingSubgraphs:(0,Ne.getEntriesNotInHashSet)(t.subgraphNames,c.subgraphNames),requiredSubgraphs:[...c.requiredSubgraphNames]});return i.length>0?this.errors.push((0,Pe.invalidRequiredInputValueError)(ve.FIELD,a,i)):r.length>0&&((0,Ne.getValueOrDefault)(this.fieldConfigurationByFieldCoords,a,()=>({argumentNames:r,fieldName:t.name,typeName:t.renamedParentTypeName})).argumentNames=r),n}getNodeWithPersistedDirectivesByFieldData(t,n){return t.node.arguments=n,t.node.name=(0,Kr.stringToNameNode)(t.name),t.node.type=t.type,t.node.description=this.getFederatedGraphNodeDescription(t),t.node.directives=this.getRouterPersistedDirectiveNodes(t),t.node}validateSemanticNonNull(t){let n;for(let r of t.nullLevelsBySubgraphName.values()){if(!n){n=r;continue}if(n.size!==r.size){this.errors.push((0,Pe.semanticNonNullInconsistentLevelsError)(t));return}for(let i of r)if(!n.has(i)){this.errors.push((0,Pe.semanticNonNullInconsistentLevelsError)(t));return}}}validateOneOfDirective({data:t,inputValueNodes:n,requiredFieldNames:r}){return t.directivesByDirectiveName.has(ve.ONE_OF)?r.size>0?(this.errors.push((0,Pe.oneOfRequiredFieldsError)({requiredFieldNames:Array.from(r),typeName:t.name})),!1):(n.length===1&&this.warnings.push((0,Nfe.singleFederatedInputFieldOneOfWarning)({fieldName:n[0].name.value,typeName:t.name})),!0):!0}pushParentDefinitionDataToDocumentDefinitions(t){for(let[n,r]of this.parentDefinitionDataByTypeName)switch(r.extensionType!==NV.ExtensionType.NONE&&this.errors.push((0,Pe.noBaseDefinitionForExtensionError)((0,Ne.kindToNodeType)(r.kind),n)),r.kind){case Re.Kind.ENUM_TYPE_DEFINITION:{if(xc.IGNORED_FEDERATED_TYPE_NAMES.has(n))break;let i=[],a=[],o=this.getEnumValueMergeMethod(n);(0,ge.propagateAuthDirectives)(r,this.authorizationDataByParentTypeName.get(n));for(let c of r.enumValueDataByName.values()){let l=this.getNodeForRouterSchemaByData(c),d=(0,ge.isNodeDataInaccessible)(c),p=Q(M({},c.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(c)});switch(o){case ge.MergeMethod.CONSISTENT:!d&&r.appearances>c.appearances&&this.errors.push((0,Pe.incompatibleSharedEnumError)(n)),i.push(l),d||a.push(p);break;case ge.MergeMethod.INTERSECTION:r.appearances===c.appearances&&(i.push(l),d||a.push(p));break;default:i.push(l),d||a.push(p);break}}if(r.node.values=i,this.routerDefinitions.push(this.getNodeForRouterSchemaByData(r)),(0,ge.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}if(a.length<1){this.errors.push((0,Pe.allChildDefinitionsAreInaccessibleError)((0,Ne.kindToNodeType)(r.kind),n,ve.ENUM_VALUE));break}this.clientDefinitions.push(Q(M({},r.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(r),values:a}));break}case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:{if(xc.IGNORED_FEDERATED_TYPE_NAMES.has(n))break;let i=new Array,a=new Array,o=new Array,c=new Set;for(let[l,d]of r.inputValueDataByName)if((0,ge.isTypeRequired)(d.type)&&c.add(l),r.subgraphNames.size===d.subgraphNames.size){if(a.push(this.getNodeWithPersistedDirectivesByInputValueData(d)),(0,ge.isNodeDataInaccessible)(d))continue;o.push(Q(M({},d.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(d)}))}else(0,ge.isTypeRequired)(d.type)&&i.push({inputValueName:l,missingSubgraphs:(0,Ne.getEntriesNotInHashSet)(r.subgraphNames,d.subgraphNames),requiredSubgraphs:[...d.requiredSubgraphNames]});if(i.length>0){this.errors.push((0,Pe.invalidRequiredInputValueError)(ve.INPUT_OBJECT,n,i,!1));break}if(!this.validateOneOfDirective({data:r,inputValueNodes:a,requiredFieldNames:c}))break;if(r.node.fields=a,this.routerDefinitions.push(this.getNodeForRouterSchemaByData(r)),(0,ge.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r);break}if(o.length<1){this.errors.push((0,Pe.allChildDefinitionsAreInaccessibleError)((0,Ne.kindToNodeType)(r.kind),n,"Input field"));break}this.clientDefinitions.push(Q(M({},r.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(r),fields:o}));break}case Re.Kind.INTERFACE_TYPE_DEFINITION:case Re.Kind.OBJECT_TYPE_DEFINITION:{let i=[],a=[],o=new Map,c=(0,ge.newInvalidFieldNames)(),l=r.kind===Re.Kind.OBJECT_TYPE_DEFINITION,d=this.authorizationDataByParentTypeName.get(n);(0,ge.propagateAuthDirectives)(r,d);for(let[E,I]of r.fieldDataByName){(0,ge.propagateFieldAuthDirectives)(I,d);let v=this.getValidFieldArgumentNodes(I);l&&(0,ge.validateExternalAndShareable)(I,c),this.validateSemanticNonNull(I),i.push(this.getNodeWithPersistedDirectivesByFieldData(I,v)),!(0,ge.isNodeDataInaccessible)(I)&&(a.push((0,ge.getClientSchemaFieldNodeByFieldData)(I)),o.set(E,this.fieldDataToGraphFieldData(I)))}if(l&&(c.byShareable.size>0&&this.errors.push((0,Pe.invalidFieldShareabilityError)(r,c.byShareable)),c.subgraphNamesByExternalFieldName.size>0&&this.errors.push((0,Pe.allExternalFieldInstancesError)(n,c.subgraphNamesByExternalFieldName))),r.node.fields=i,this.internalGraph.initializeNode(n,o),r.implementedInterfaceTypeNames.size>0){t.push({data:r,clientSchemaFieldNodes:a});break}this.routerDefinitions.push(this.getNodeForRouterSchemaByData(r));let p=(0,pfe.isNodeQuery)(n);if((0,ge.isNodeDataInaccessible)(r)){if(p){this.errors.push(Pe.inaccessibleQueryRootTypeError);break}this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}if(a.length<1){let E=p?(0,Pe.noQueryRootTypeError)(!1):(0,Pe.allChildDefinitionsAreInaccessibleError)((0,Ne.kindToNodeType)(r.kind),n,ve.FIELD);this.errors.push(E);break}this.clientDefinitions.push(Q(M({},r.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(r),fields:a}));break}case Re.Kind.SCALAR_TYPE_DEFINITION:{if(xc.IGNORED_FEDERATED_TYPE_NAMES.has(n))break;if((0,ge.propagateAuthDirectives)(r,this.authorizationDataByParentTypeName.get(n)),this.routerDefinitions.push(this.getNodeForRouterSchemaByData(r)),(0,ge.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}this.clientDefinitions.push(Q(M({},r.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(r)}));break}case Re.Kind.UNION_TYPE_DEFINITION:{if(r.node.types=(0,Gr.mapToArrayOfValues)(r.memberByMemberTypeName),this.routerDefinitions.push(this.getNodeForRouterSchemaByData(r)),(0,ge.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}let i=this.getClientSchemaUnionMembers(r);if(i.length<1){this.errors.push((0,Pe.allChildDefinitionsAreInaccessibleError)(ve.UNION,n,"union member type"));break}this.clientDefinitions.push(Q(M({},r.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(r),types:i}));break}}}pushNamedTypeAuthDataToFields(){var t;for(let[n,r]of this.authorizationDataByParentTypeName){if(!r.requiresAuthentication&&r.requiredScopes.length<1)continue;let i=this.fieldCoordsByNamedTypeName.get(n);if(i)for(let a of i){let o=a.split(ve.PERIOD);switch(o.length){case 2:{let c=(0,Ne.getValueOrDefault)(this.authorizationDataByParentTypeName,o[0],()=>(0,Gr.newAuthorizationData)(o[0])),l=(0,Ne.getValueOrDefault)(c.fieldAuthDataByFieldName,o[1],()=>(0,Gr.newFieldAuthorizationData)(o[1]));(t=l.inheritedData).requiresAuthentication||(t.requiresAuthentication=r.requiresAuthentication),l.inheritedData.requiredScopes.length*r.requiredScopes.length>hp.MAX_OR_SCOPES?this.invalidORScopesCoords.add(a):(l.inheritedData.requiredScopesByOR=(0,Gr.mergeRequiredScopesByAND)(l.inheritedData.requiredScopesByOR,r.requiredScopesByOR),l.inheritedData.requiredScopes=(0,Gr.mergeRequiredScopesByAND)(l.inheritedData.requiredScopes,r.requiredScopes));break}default:break}}}}federateSubgraphData(){this.federateInternalSubgraphData(),this.handleEntityInterfaces(),this.generateTagData(),Ud(this,zE,EV).call(this),this.pushNamedTypeAuthDataToFields()}validateInterfaceImplementationsAndPushToDocumentDefinitions(t){for(let{data:n,clientSchemaFieldNodes:r}of t){if(n.node.interfaces=this.getValidImplementedInterfaces(n),this.routerDefinitions.push(this.getNodeForRouterSchemaByData(n)),(0,ge.isNodeDataInaccessible)(n)){this.validateReferencesOfInaccessibleType(n),this.internalGraph.setNodeInaccessible(n.name);continue}let i=[];for(let a of n.implementedInterfaceTypeNames)this.inaccessibleCoords.has(a)||i.push((0,Kr.stringToNamedTypeNode)(a));this.clientDefinitions.push(Q(M({},n.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(n),fields:r,interfaces:i}))}}validatePathSegmentInaccessibility(t){if(!t)return!1;let r=t.split(ve.LEFT_PARENTHESIS)[0].split(ve.PERIOD),i=r[0];for(let a=0;a0&&this.errors.push((0,Pe.invalidReferencesOfInaccessibleTypeError)((0,Ne.kindToNodeType)(t.kind),t.name,r))}validateQueryRootType(){let t=this.parentDefinitionDataByTypeName.get(ve.QUERY);if(!t||t.kind!==Re.Kind.OBJECT_TYPE_DEFINITION||t.fieldDataByName.size<1){this.errors.push((0,Pe.noQueryRootTypeError)());return}for(let n of t.fieldDataByName.values())if(!(0,ge.isNodeDataInaccessible)(n))return;this.errors.push((0,Pe.noQueryRootTypeError)())}validateSubscriptionFieldConditionFieldPath(t,n,r,i,a){let o=t.split(ve.PERIOD);if(o.length<1)return a.push((0,Pe.invalidSubscriptionFieldConditionFieldPathErrorMessage)(r,t)),[];let c=n;if(this.inaccessibleCoords.has(c.renamedTypeName))return a.push((0,Pe.inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,o[0],c.renamedTypeName)),[];let l="";for(let d=0;d0?`.${p}`:p,c.kind!==Re.Kind.OBJECT_TYPE_DEFINITION)return a.push((0,Pe.invalidSubscriptionFieldConditionFieldPathParentErrorMessage)(r,t,l)),[];let E=c.fieldDataByName.get(p);if(!E)return a.push((0,Pe.undefinedSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,l,p,c.renamedTypeName)),[];let I=`${c.renamedTypeName}.${p}`;if(!E.subgraphNames.has(i))return a.push((0,Pe.invalidSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,l,I,i)),[];if(this.inaccessibleCoords.has(I))return a.push((0,Pe.inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,l,I)),[];if(hp.BASE_SCALARS.has(E.namedTypeName)){c={kind:Re.Kind.SCALAR_TYPE_DEFINITION,name:E.namedTypeName};continue}c=(0,Ne.getOrThrowError)(this.parentDefinitionDataByTypeName,E.namedTypeName,ve.PARENT_DEFINITION_DATA)}return(0,ge.isLeafKind)(c.kind)?o:(a.push((0,Pe.nonLeafSubscriptionFieldConditionFieldPathFinalFieldErrorMessage)(r,t,o[o.length-1],(0,Ne.kindToNodeType)(c.kind),c.name)),[])}validateSubscriptionFieldCondition(t,n,r,i,a,o,c){if(i>JE.MAX_SUBSCRIPTION_FILTER_DEPTH||this.isMaxDepth)return c.push((0,Pe.subscriptionFilterConditionDepthExceededErrorMessage)(a)),this.isMaxDepth=!0,!1;let l=!1,d=new Set([ve.FIELD_PATH,ve.VALUES]),p=new Set,E=new Set,I=[];for(let v of t.fields){let A=v.name.value,U=a+`.${A}`;switch(A){case ve.FIELD_PATH:{if(d.has(ve.FIELD_PATH))d.delete(ve.FIELD_PATH);else{l=!0,p.add(ve.FIELD_PATH);break}if(v.value.kind!==Re.Kind.STRING){I.push((0,Pe.invalidInputFieldTypeErrorMessage)(U,ve.STRING,(0,Ne.kindToNodeType)(v.value.kind))),l=!0;break}let j=this.validateSubscriptionFieldConditionFieldPath(v.value.value,r,U,o,I);if(j.length<1){l=!0;break}n.fieldPath=j;break}case ve.VALUES:{if(d.has(ve.VALUES))d.delete(ve.VALUES);else{l=!0,p.add(ve.VALUES);break}let j=v.value.kind;if(j==Re.Kind.NULL||j==Re.Kind.OBJECT){I.push((0,Pe.invalidInputFieldTypeErrorMessage)(U,ve.LIST,(0,Ne.kindToNodeType)(v.value.kind))),l=!0;break}if(j!==Re.Kind.LIST){n.values=[(0,ge.getSubscriptionFilterValue)(v.value)];break}let $=new Set,re=[];for(let te=0;te0){I.push((0,Pe.subscriptionFieldConditionInvalidValuesArrayErrorMessage)(U,re));continue}if($.size<1){l=!0,I.push((0,Pe.subscriptionFieldConditionEmptyValuesArrayErrorMessage)(U));continue}n.values=[...$];break}default:l=!0,E.add(A)}}return l?(c.push((0,Pe.subscriptionFieldConditionInvalidInputFieldErrorMessage)(a,[...d],[...p],[...E],I)),!1):!0}validateSubscriptionFilterCondition(t,n,r,i,a,o,c){if(i>JE.MAX_SUBSCRIPTION_FILTER_DEPTH||this.isMaxDepth)return c.push((0,Pe.subscriptionFilterConditionDepthExceededErrorMessage)(a)),this.isMaxDepth=!0,!1;if(i+=1,t.fields.length!==1)return c.push((0,Pe.subscriptionFilterConditionInvalidInputFieldNumberErrorMessage)(a,t.fields.length)),!1;let l=t.fields[0],d=l.name.value;if(!xc.SUBSCRIPTION_FILTER_INPUT_NAMES.has(d))return c.push((0,Pe.subscriptionFilterConditionInvalidInputFieldErrorMessage)(a,d)),!1;let p=a+`.${d}`;switch(l.value.kind){case Re.Kind.OBJECT:switch(d){case ve.IN_UPPER:return n.in={fieldPath:[],values:[]},this.validateSubscriptionFieldCondition(l.value,n.in,r,i,a+".IN",o,c);case ve.NOT_UPPER:return n.not={},this.validateSubscriptionFilterCondition(l.value,n.not,r,i,a+".NOT",o,c);default:return c.push((0,Pe.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(p,ve.LIST,ve.OBJECT)),!1}case Re.Kind.LIST:{let E=[];switch(d){case ve.AND_UPPER:{n.and=E;break}case ve.OR_UPPER:{n.or=E;break}default:return c.push((0,Pe.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(p,ve.OBJECT,ve.LIST)),!1}let I=l.value.values.length;if(I<1||I>5)return c.push((0,Pe.subscriptionFilterArrayConditionInvalidLengthErrorMessage)(p,I)),!1;let v=!0,A=[];for(let U=0;U0?(c.push((0,Pe.subscriptionFilterArrayConditionInvalidItemTypeErrorMessage)(p,A)),!1):v}default:{let E=xc.SUBSCRIPTION_FILTER_LIST_INPUT_NAMES.has(d)?ve.LIST:ve.OBJECT;return c.push((0,Pe.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(p,E,(0,Ne.kindToNodeType)(l.value.kind))),!1}}}validateSubscriptionFilterAndGenerateConfiguration(t,n,r,i,a,o){if(!t.arguments||t.arguments.length!==1)return;let c=t.arguments[0];if(c.value.kind!==Re.Kind.OBJECT){this.errors.push((0,Pe.invalidSubscriptionFilterDirectiveError)(r,[(0,Pe.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(ve.CONDITION,ve.OBJECT,(0,Ne.kindToNodeType)(c.value.kind))]));return}let l={},d=[];if(!this.validateSubscriptionFilterCondition(c.value,l,n,0,ve.CONDITION,o,d)){this.errors.push((0,Pe.invalidSubscriptionFilterDirectiveError)(r,d)),this.isMaxDepth=!1;return}(0,Ne.getValueOrDefault)(this.fieldConfigurationByFieldCoords,r,()=>({argumentNames:[],fieldName:i,typeName:a})).subscriptionFilterCondition=l}validateSubscriptionFiltersAndGenerateConfiguration(){for(let[t,n]of this.subscriptionFilterDataByFieldPath){if(this.inaccessibleCoords.has(t))continue;let r=this.parentDefinitionDataByTypeName.get(n.fieldData.namedTypeName);if(!r){this.errors.push((0,Pe.invalidSubscriptionFilterDirectiveError)(t,[(0,Pe.subscriptionFilterNamedTypeErrorMessage)(n.fieldData.namedTypeName)]));continue}(0,ge.isNodeDataInaccessible)(r)||r.kind===Re.Kind.OBJECT_TYPE_DEFINITION&&this.validateSubscriptionFilterAndGenerateConfiguration(n.directive,r,t,n.fieldData.name,n.fieldData.renamedParentTypeName,n.directiveSubgraphName)}}buildFederationResult(){this.subscriptionFilterDataByFieldPath.size>0&&this.validateSubscriptionFiltersAndGenerateConfiguration(),this.invalidORScopesCoords.size>0&&this.errors.push((0,Pe.orScopesLimitError)(hp.MAX_OR_SCOPES,[...this.invalidORScopesCoords]));for(let a of this.potentialPersistedDirectiveDefinitionDataByDirectiveName.values())(0,ge.addValidPersistedDirectiveDefinitionNodeByData)(this.routerDefinitions,a,this.persistedDirectiveDefinitionByDirectiveName,this.errors);let t=[];this.pushParentDefinitionDataToDocumentDefinitions(t),this.validateInterfaceImplementationsAndPushToDocumentDefinitions(t),this.validateQueryRootType();for(let a of this.inaccessibleRequiredInputValueErrorByCoords.values())this.errors.push(a);if(this.errors.length>0)return{errors:this.errors,success:!1,warnings:this.warnings};if(!this.disableResolvabilityValidation&&this.internalSubgraphBySubgraphName.size>1){let a=this.internalGraph.validate();if(!a.success)return{errors:a.errors,success:!1,warnings:this.warnings}}let n={kind:Re.Kind.DOCUMENT,definitions:this.routerDefinitions},r=(0,Re.buildASTSchema)({kind:Re.Kind.DOCUMENT,definitions:this.clientDefinitions},{assumeValid:!0,assumeValidSDL:!0}),i=new Map;for(let a of this.internalSubgraphBySubgraphName.values())i.set(a.name,{configurationDataByTypeName:a.configurationDataByTypeName,directiveDefinitionByName:a.directiveDefinitionByName,isVersionTwo:a.isVersionTwo,parentDefinitionDataByTypeName:a.parentDefinitionDataByTypeName,schema:a.schema});for(let a of this.authorizationDataByParentTypeName.values())(0,Gr.upsertAuthorizationConfiguration)(this.fieldConfigurationByFieldCoords,a);return M({directiveDefinitionByName:this.directiveDefinitionByName,fieldConfigurations:Array.from(this.fieldConfigurationByFieldCoords.values()),federatedGraphAST:n,federatedGraphSchema:(0,Re.buildASTSchema)(n,{assumeValid:!0,assumeValidSDL:!0}),federatedGraphClientSchema:r,parentDefinitionDataByTypeName:this.parentDefinitionDataByTypeName,subgraphConfigBySubgraphName:i,success:!0,warnings:this.warnings},this.getClientSchemaObjectBoolean())}getClientSchemaObjectBoolean(){return this.inaccessibleCoords.size<1&&this.tagNamesByCoords.size<1?{}:{shouldIncludeClientSchema:!0}}handleChildTagExclusions(t,n,r,i){let a=n.size;for(let[o,c]of r){let l=(0,Ne.getOrThrowError)(n,o,`${t.name}.childDataByChildName`);if((0,ge.isNodeDataInaccessible)(l)){a-=1;continue}i.isDisjointFrom(c.tagNames)||((0,Ne.getValueOrDefault)(l.persistedDirectivesData.directivesByDirectiveName,ve.INACCESSIBLE,()=>[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(`${t.name}.${o}`),a-=1)}a<1&&(t.persistedDirectivesData.directivesByDirectiveName.set(ve.INACCESSIBLE,[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(t.name))}handleChildTagInclusions(t,n,r,i){let a=n.size;for(let[o,c]of n){if((0,ge.isNodeDataInaccessible)(c)){a-=1;continue}let l=r.get(o);(!l||i.isDisjointFrom(l.tagNames))&&((0,Ne.getValueOrDefault)(c.persistedDirectivesData.directivesByDirectiveName,ve.INACCESSIBLE,()=>[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(`${t.name}.${o}`),a-=1)}a<1&&(t.persistedDirectivesData.directivesByDirectiveName.set(ve.INACCESSIBLE,[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(t.name))}buildFederationContractResult(t){if(this.isVersionTwo||this.routerDefinitions.push(Fu.INACCESSIBLE_DEFINITION),t.tagNamesToExclude.size>0)for(let[o,c]of this.parentTagDataByTypeName){let l=(0,Ne.getOrThrowError)(this.parentDefinitionDataByTypeName,o,ve.PARENT_DEFINITION_DATA);if(!(0,ge.isNodeDataInaccessible)(l)){if(!t.tagNamesToExclude.isDisjointFrom(c.tagNames)){l.persistedDirectivesData.directivesByDirectiveName.set(ve.INACCESSIBLE,[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(o);continue}if(!(c.childTagDataByChildName.size<1))switch(l.kind){case Re.Kind.SCALAR_TYPE_DEFINITION:case Re.Kind.UNION_TYPE_DEFINITION:break;case Re.Kind.ENUM_TYPE_DEFINITION:{this.handleChildTagExclusions(l,l.enumValueDataByName,c.childTagDataByChildName,t.tagNamesToExclude);break}case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:{this.handleChildTagExclusions(l,l.inputValueDataByName,c.childTagDataByChildName,t.tagNamesToExclude);break}default:{let d=l.fieldDataByName.size;for(let[p,E]of c.childTagDataByChildName){let I=(0,Ne.getOrThrowError)(l.fieldDataByName,p,`${o}.fieldDataByFieldName`);if((0,ge.isNodeDataInaccessible)(I)){d-=1;continue}if(!t.tagNamesToExclude.isDisjointFrom(E.tagNames)){(0,Ne.getValueOrDefault)(I.persistedDirectivesData.directivesByDirectiveName,ve.INACCESSIBLE,()=>[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(I.federatedCoords),d-=1;continue}for(let[v,A]of E.tagNamesByArgumentName){let U=(0,Ne.getOrThrowError)(I.argumentDataByName,v,`${p}.argumentDataByArgumentName`);(0,ge.isNodeDataInaccessible)(U)||t.tagNamesToExclude.isDisjointFrom(A)||((0,Ne.getValueOrDefault)(U.persistedDirectivesData.directivesByDirectiveName,ve.INACCESSIBLE,()=>[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(U.federatedCoords))}}d<1&&(l.persistedDirectivesData.directivesByDirectiveName.set(ve.INACCESSIBLE,[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(o))}}}}else if(t.tagNamesToInclude.size>0)for(let[o,c]of this.parentDefinitionDataByTypeName){if((0,ge.isNodeDataInaccessible)(c))continue;let l=this.parentTagDataByTypeName.get(o);if(!l){c.persistedDirectivesData.directivesByDirectiveName.set(ve.INACCESSIBLE,[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(o);continue}if(t.tagNamesToInclude.isDisjointFrom(l.tagNames)){if(l.childTagDataByChildName.size<1){c.persistedDirectivesData.directivesByDirectiveName.set(ve.INACCESSIBLE,[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(o);continue}switch(c.kind){case Re.Kind.SCALAR_TYPE_DEFINITION:case Re.Kind.UNION_TYPE_DEFINITION:continue;case Re.Kind.ENUM_TYPE_DEFINITION:this.handleChildTagInclusions(c,c.enumValueDataByName,l.childTagDataByChildName,t.tagNamesToInclude);break;case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:this.handleChildTagInclusions(c,c.inputValueDataByName,l.childTagDataByChildName,t.tagNamesToInclude);break;default:let d=c.fieldDataByName.size;for(let[p,E]of c.fieldDataByName){if((0,ge.isNodeDataInaccessible)(E)){d-=1;continue}let I=l.childTagDataByChildName.get(p);(!I||t.tagNamesToInclude.isDisjointFrom(I.tagNames))&&((0,Ne.getValueOrDefault)(E.persistedDirectivesData.directivesByDirectiveName,ve.INACCESSIBLE,()=>[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(E.federatedCoords),d-=1)}d<1&&(c.persistedDirectivesData.directivesByDirectiveName.set(ve.INACCESSIBLE,[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(o))}}}this.subscriptionFilterDataByFieldPath.size>0&&this.validateSubscriptionFiltersAndGenerateConfiguration();for(let o of this.potentialPersistedDirectiveDefinitionDataByDirectiveName.values())(0,ge.addValidPersistedDirectiveDefinitionNodeByData)(this.routerDefinitions,o,this.persistedDirectiveDefinitionByDirectiveName,this.errors);let n=[];if(this.pushParentDefinitionDataToDocumentDefinitions(n),this.validateInterfaceImplementationsAndPushToDocumentDefinitions(n),this.validateQueryRootType(),this.errors.length>0)return{errors:this.errors,success:!1,warnings:this.warnings};let r={kind:Re.Kind.DOCUMENT,definitions:this.routerDefinitions},i=(0,Re.buildASTSchema)({kind:Re.Kind.DOCUMENT,definitions:this.clientDefinitions},{assumeValid:!0,assumeValidSDL:!0}),a=new Map;for(let o of this.internalSubgraphBySubgraphName.values())a.set(o.name,{configurationDataByTypeName:o.configurationDataByTypeName,directiveDefinitionByName:o.directiveDefinitionByName,isVersionTwo:o.isVersionTwo,parentDefinitionDataByTypeName:o.parentDefinitionDataByTypeName,schema:o.schema});for(let o of this.authorizationDataByParentTypeName.values())(0,Gr.upsertAuthorizationConfiguration)(this.fieldConfigurationByFieldCoords,o);return M({directiveDefinitionByName:this.directiveDefinitionByName,fieldConfigurations:Array.from(this.fieldConfigurationByFieldCoords.values()),federatedGraphAST:r,federatedGraphSchema:(0,Re.buildASTSchema)(r,{assumeValid:!0,assumeValidSDL:!0}),federatedGraphClientSchema:i,parentDefinitionDataByTypeName:this.parentDefinitionDataByTypeName,subgraphConfigBySubgraphName:a,success:!0,warnings:this.warnings},this.getClientSchemaObjectBoolean())}federateSubgraphsInternal(){return this.federateSubgraphData(),this.buildFederationResult()}};zE=new WeakSet,EV=function(){var r;let t=new Set,n=new Set;for(let i of this.referencedPersistedDirectiveNames){let a=hp.DIRECTIVE_DEFINITION_BY_NAME.get(i);if(!a)continue;let o=(r=xc.DEPENDENCIES_BY_DIRECTIVE_NAME.get(i))!=null?r:[];this.directiveDefinitionByName.set(i,a),xc.CLIENT_PERSISTED_DIRECTIVE_NAMES.has(i)&&(this.clientDefinitions.push(a),(0,Ne.addIterableToSet)({source:o,target:t})),this.routerDefinitions.push(a),(0,Ne.addIterableToSet)({source:o,target:n})}this.clientDefinitions.push(...t),this.routerDefinitions.push(...n)};qc.FederationFactory=HE;function sb({disableResolvabilityValidation:e,subgraphs:t}){if(t.length<1)return{errors:[Pe.minimumSubgraphRequirementError],success:!1,warnings:[]};let n=(0,ffe.batchNormalize)(t);if(!n.success)return{errors:n.errors,success:!1,warnings:n.warnings};let r=new Map,i=new Map;for(let[c,l]of n.internalSubgraphBySubgraphName)for(let[d,p]of l.entityInterfaces){let E=r.get(d);if(!E){r.set(d,(0,Gr.newEntityInterfaceFederationData)(p,c));continue}(0,Gr.upsertEntityInterfaceFederationData)(E,p,c)}let a=new Array,o=new Map;for(let[c,l]of r){let d=l.concreteTypeNames.size;for(let[p,E]of l.subgraphDataByTypeName){let I=(0,Ne.getValueOrDefault)(o,p,()=>new Set);if((0,Ne.addIterableToSet)({source:E.concreteTypeNames,target:I}),!E.isInterfaceObject){E.resolvable&&E.concreteTypeNames.size!==d&&(0,Ne.getValueOrDefault)(i,c,()=>new Array).push({subgraphName:p,definedConcreteTypeNames:new Set(E.concreteTypeNames),requiredConcreteTypeNames:new Set(l.concreteTypeNames)});continue}(0,Ne.addIterableToSet)({source:l.concreteTypeNames,target:I});let{parentDefinitionDataByTypeName:v}=(0,Ne.getOrThrowError)(n.internalSubgraphBySubgraphName,p,"internalSubgraphBySubgraphName"),A=[];for(let U of l.concreteTypeNames)v.has(U)&&A.push(U);A.length>0&&a.push((0,Pe.invalidInterfaceObjectImplementationDefinitionsError)(c,p,A))}}for(let[c,l]of i){let d=new Array;for(let p of l){let E=o.get(p.subgraphName);if(!E){d.push(p);continue}let I=p.requiredConcreteTypeNames.intersection(E);p.requiredConcreteTypeNames.size!==I.size&&(p.definedConcreteTypeNames=I,d.push(p))}if(d.length>0){i.set(c,d);continue}i.delete(c)}return i.size>0&&a.push((0,Pe.undefinedEntityInterfaceImplementationsError)(i,r)),a.length>0?{errors:a,success:!1,warnings:n.warnings}:{federationFactory:new HE({authorizationDataByParentTypeName:n.authorizationDataByParentTypeName,concreteTypeNamesByAbstractTypeName:n.concreteTypeNamesByAbstractTypeName,disableResolvabilityValidation:e,entityDataByTypeName:n.entityDataByTypeName,entityInterfaceFederationDataByTypeName:r,fieldCoordsByNamedTypeName:n.fieldCoordsByNamedTypeName,internalSubgraphBySubgraphName:n.internalSubgraphBySubgraphName,internalGraph:n.internalGraph,warnings:n.warnings}),success:!0,warnings:n.warnings}}function Tfe({disableResolvabilityValidation:e,subgraphs:t}){let n=sb({subgraphs:t,disableResolvabilityValidation:e});return n.success?n.federationFactory.federateSubgraphsInternal():{errors:n.errors,success:!1,warnings:n.warnings}}function Efe({subgraphs:e,tagOptionsByContractName:t,disableResolvabilityValidation:n}){let r=sb({subgraphs:e,disableResolvabilityValidation:n});if(!r.success)return{errors:r.errors,success:!1,warnings:r.warnings};r.federationFactory.federateSubgraphData();let i=[(0,TV.cloneDeep)(r.federationFactory)],a=r.federationFactory.buildFederationResult();if(!a.success)return{errors:a.errors,success:!1,warnings:a.warnings};let o=t.size-1,c=new Map,l=0;for(let[d,p]of t){l!==o&&i.push((0,TV.cloneDeep)(i[l]));let E=i[l].buildFederationContractResult(p);c.set(d,E),l++}return Q(M({},a),{federationResultByContractName:c})}function hfe({contractTagOptions:e,disableResolvabilityValidation:t,subgraphs:n}){let r=sb({subgraphs:n,disableResolvabilityValidation:t});return r.success?(r.federationFactory.federateSubgraphData(),r.federationFactory.buildFederationContractResult(e)):{errors:r.errors,success:!1,warnings:r.warnings}}});var WE=w(Cs=>{"use strict";m();T();N();Object.defineProperty(Cs,"__esModule",{value:!0});Cs.LATEST_ROUTER_COMPATIBILITY_VERSION=Cs.ROUTER_COMPATIBILITY_VERSIONS=Cs.ROUTER_COMPATIBILITY_VERSION_ONE=void 0;Cs.ROUTER_COMPATIBILITY_VERSION_ONE="1";Cs.ROUTER_COMPATIBILITY_VERSIONS=new Set([Cs.ROUTER_COMPATIBILITY_VERSION_ONE]);Cs.LATEST_ROUTER_COMPATIBILITY_VERSION="1"});var yV=w(yp=>{"use strict";m();T();N();Object.defineProperty(yp,"__esModule",{value:!0});yp.federateSubgraphs=yfe;yp.federateSubgraphsWithContracts=Ife;yp.federateSubgraphsContract=gfe;var ob=hV(),ub=WE();function yfe({disableResolvabilityValidation:e,subgraphs:t,version:n=ub.ROUTER_COMPATIBILITY_VERSION_ONE}){switch(n){default:return(0,ob.federateSubgraphs)({disableResolvabilityValidation:e,subgraphs:t})}}function Ife({disableResolvabilityValidation:e,subgraphs:t,tagOptionsByContractName:n,version:r=ub.ROUTER_COMPATIBILITY_VERSION_ONE}){switch(r){default:return(0,ob.federateSubgraphsWithContracts)({disableResolvabilityValidation:e,subgraphs:t,tagOptionsByContractName:n})}}function gfe({contractTagOptions:e,disableResolvabilityValidation:t,subgraphs:n,version:r=ub.ROUTER_COMPATIBILITY_VERSION_ONE}){switch(r){default:return(0,ob.federateSubgraphsContract)({disableResolvabilityValidation:t,subgraphs:n,contractTagOptions:e})}}});var gV=w(IV=>{"use strict";m();T();N();Object.defineProperty(IV,"__esModule",{value:!0})});var _V=w(Ip=>{"use strict";m();T();N();Object.defineProperty(Ip,"__esModule",{value:!0});Ip.normalizeSubgraphFromString=_fe;Ip.normalizeSubgraph=vfe;Ip.batchNormalize=Ofe;var cb=nb(),lb=WE();function _fe(e,t=!0,n=lb.ROUTER_COMPATIBILITY_VERSION_ONE){switch(n){default:return(0,cb.normalizeSubgraphFromString)(e,t)}}function vfe(e,t,n,r=lb.ROUTER_COMPATIBILITY_VERSION_ONE){switch(r){default:return(0,cb.normalizeSubgraph)(e,t,n)}}function Ofe(e,t=lb.ROUTER_COMPATIBILITY_VERSION_ONE){switch(t){default:return(0,cb.batchNormalize)(e)}}});var OV=w(vV=>{"use strict";m();T();N();Object.defineProperty(vV,"__esModule",{value:!0})});var DV=w(SV=>{"use strict";m();T();N();Object.defineProperty(SV,"__esModule",{value:!0})});var AV=w(bV=>{"use strict";m();T();N();Object.defineProperty(bV,"__esModule",{value:!0})});var PV=w(RV=>{"use strict";m();T();N();Object.defineProperty(RV,"__esModule",{value:!0})});var wV=w(FV=>{"use strict";m();T();N();Object.defineProperty(FV,"__esModule",{value:!0})});var CV=w(LV=>{"use strict";m();T();N();Object.defineProperty(LV,"__esModule",{value:!0})});var BV=w(XE=>{"use strict";m();T();N();Object.defineProperty(XE,"__esModule",{value:!0});XE.COMPOSITION_VERSION=void 0;XE.COMPOSITION_VERSION="{{$COMPOSITION__VERSION}}"});var kV=w(UV=>{"use strict";m();T();N();Object.defineProperty(UV,"__esModule",{value:!0})});var xV=w(MV=>{"use strict";m();T();N();Object.defineProperty(MV,"__esModule",{value:!0})});var VV=w(qV=>{"use strict";m();T();N();Object.defineProperty(qV,"__esModule",{value:!0})});var KV=w(jV=>{"use strict";m();T();N();Object.defineProperty(jV,"__esModule",{value:!0})});var ZE=w(Xe=>{"use strict";m();T();N();var Sfe=Xe&&Xe.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),lt=Xe&&Xe.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Sfe(t,e,n)};Object.defineProperty(Xe,"__esModule",{value:!0});lt(Ar(),Xe);lt(Cv(),Xe);lt(qi(),Xe);lt($M(),Xe);lt(yV(),Xe);lt(gV(),Xe);lt(_V(),Xe);lt(OV(),Xe);lt(ZD(),Xe);lt(jD(),Xe);lt(UE(),Xe);lt(DV(),Xe);lt(AV(),Xe);lt(YD(),Xe);lt(WE(),Xe);lt(PV(),Xe);lt(eb(),Xe);lt(yu(),Xe);lt(Uf(),Xe);lt(Bl(),Xe);lt(wV(),Xe);lt(CV(),Xe);lt(BV(),Xe);lt(kV(),Xe);lt(sr(),Xe);lt(xV(),Xe);lt(Rr(),Xe);lt(LD(),Xe);lt(Iu(),Xe);lt(kf(),Xe);lt(sE(),Xe);lt(oE(),Xe);lt(nd(),Xe);lt(aT(),Xe);lt(sT(),Xe);lt(ab(),Xe);lt(VV(),Xe);lt(AD(),Xe);lt(dp(),Xe);lt(KV(),Xe);lt(kD(),Xe);lt(QE(),Xe);lt(FD(),Xe);lt(lp(),Xe);lt(fp(),Xe)});var hpe={};Fm(hpe,{buildRouterConfiguration:()=>Epe,federateSubgraphs:()=>Tpe});m();T();N();var Yc=ys(ZE());m();T();N();m();T();N();function db(e){if(!e)return e;if(!URL.canParse(e))throw new Error("Invalid URL");let t=e.indexOf("?"),n=e.indexOf("#"),r=e;return t>0?r=r.slice(0,n>0?Math.min(t,n):t):n>0&&(r=r.slice(0,n)),r}m();T();N();m();T();N();var GV={};m();T();N();function $V(e){return e!=null}m();T();N();m();T();N();var zV=ys(Oe(),1);m();T();N();var QV;if(typeof AggregateError=="undefined"){class e extends Error{constructor(n,r=""){super(r),this.errors=n,this.name="AggregateError",Error.captureStackTrace(this,e)}}QV=function(t,n){return new e(t,n)}}else QV=AggregateError;function YV(e){return"errors"in e&&Array.isArray(e.errors)}var WV=3;function XV(e){return eh(e,[])}function eh(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return Dfe(e,t);default:return String(e)}}function JV(e){return e instanceof zV.GraphQLError?e.toString():`${e.name}: ${e.message}; +}`;var yt=wR(function(){return Qt(L,$e+"return "+Te).apply(e,k)});if(yt.source=Te,Ay(yt))throw yt;return yt}function wJ(s){return zt(s).toLowerCase()}function LJ(s){return zt(s).toUpperCase()}function CJ(s,u,f){if(s=zt(s),s&&(f||u===e))return V0(s);if(!s||!(u=ci(u)))return s;var h=na(s),O=na(u),L=j0(h,O),k=K0(h,O)+1;return iu(h,L,k).join("")}function BJ(s,u,f){if(s=zt(s),s&&(f||u===e))return s.slice(0,$0(s)+1);if(!s||!(u=ci(u)))return s;var h=na(s),O=K0(h,na(u))+1;return iu(h,0,O).join("")}function UJ(s,u,f){if(s=zt(s),s&&(f||u===e))return s.replace(Ah,"");if(!s||!(u=ci(u)))return s;var h=na(s),O=j0(h,na(u));return iu(h,O).join("")}function kJ(s,u){var f=rt,h=Z;if(Dn(u)){var O="separator"in u?u.separator:O;f="length"in u?Et(u.length):f,h="omission"in u?ci(u.omission):h}s=zt(s);var L=s.length;if(Xc(s)){var k=na(s);L=k.length}if(f>=L)return s;var V=f-Zc(h);if(V<1)return h;var J=k?iu(k,0,V).join(""):s.slice(0,V);if(O===e)return J+h;if(k&&(V+=J.length-V),Ry(O)){if(s.slice(V).search(O)){var le,de=J;for(O.global||(O=$h(O.source,zt(c0.exec(O))+"g")),O.lastIndex=0;le=O.exec(de);)var Te=le.index;J=J.slice(0,Te===e?V:Te)}}else if(s.indexOf(ci(O),V)!=V){var be=J.lastIndexOf(O);be>-1&&(J=J.slice(0,be))}return J+h}function MJ(s){return s=zt(s),s&&Hj.test(s)?s.replace(s0,pG):s}var xJ=al(function(s,u,f){return s+(f?" ":"")+u.toUpperCase()}),wy=LA("toUpperCase");function FR(s,u,f){return s=zt(s),u=f?e:u,u===e?uG(s)?TG(s):ZK(s):s.match(u)||[]}var wR=It(function(s,u){try{return oi(s,e,u)}catch(f){return Ay(f)?f:new dt(f)}}),qJ=ms(function(s,u){return gi(u,function(f){f=Ca(f),fs(s,f,Dy(s[f],s))}),s});function VJ(s){var u=s==null?0:s.length,f=We();return s=u?vn(s,function(h){if(typeof h[1]!="function")throw new _i(i);return[f(h[0]),h[1]]}):[],It(function(h){for(var O=-1;++OTn)return[];var f=xn,h=_r(s,xn);u=We(u),s-=xn;for(var O=jh(h,u);++f0||u<0)?new bt(f):(s<0?f=f.takeRight(-s):s&&(f=f.drop(s)),u!==e&&(u=Et(u),f=u<0?f.dropRight(-u):f.take(u-s)),f)},bt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},bt.prototype.toArray=function(){return this.take(xn)},wa(bt.prototype,function(s,u){var f=/^(?:filter|find|map|reject)|While$/.test(u),h=/^(?:head|last)$/.test(u),O=F[h?"take"+(u=="last"?"Right":""):u],L=h||/^find/.test(u);O&&(F.prototype[u]=function(){var k=this.__wrapped__,V=h?[1]:arguments,J=k instanceof bt,le=V[0],de=J||ft(k),Te=function(St){var Ft=O.apply(F,Wo([St],V));return h&&be?Ft[0]:Ft};de&&f&&typeof le=="function"&&le.length!=1&&(J=de=!1);var be=this.__chain__,$e=!!this.__actions__.length,Ze=L&&!be,yt=J&&!$e;if(!L&&de){k=yt?k:new bt(this);var et=s.apply(k,V);return et.__actions__.push({func:_m,args:[Te],thisArg:e}),new vi(et,be)}return Ze&&yt?s.apply(this,V):(et=this.thru(Te),Ze?h?et.value()[0]:et.value():et)})}),gi(["pop","push","shift","sort","splice","unshift"],function(s){var u=Jp[s],f=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",h=/^(?:pop|shift)$/.test(s);F.prototype[s]=function(){var O=arguments;if(h&&!this.__chain__){var L=this.value();return u.apply(ft(L)?L:[],O)}return this[f](function(k){return u.apply(ft(k)?k:[],O)})}}),wa(bt.prototype,function(s,u){var f=F[u];if(f){var h=f.name+"";on.call(nl,h)||(nl[h]=[]),nl[h].push({name:u,func:f})}}),nl[Nm(e,U).name]=[{name:"wrapper",func:e}],bt.prototype.clone=MG,bt.prototype.reverse=xG,bt.prototype.value=qG,F.prototype.at=N2,F.prototype.chain=T2,F.prototype.commit=E2,F.prototype.next=h2,F.prototype.plant=I2,F.prototype.reverse=g2,F.prototype.toJSON=F.prototype.valueOf=F.prototype.value=_2,F.prototype.first=F.prototype.head,gd&&(F.prototype[gd]=y2),F},Zo=EG();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(lr._=Zo,define(function(){return Zo})):ku?((ku.exports=Zo)._=Zo,Ch._=Zo):lr._=Zo}).call(ud)});var hV=w(qc=>{"use strict";m();T();N();Object.defineProperty(qc,"__esModule",{value:!0});qc.FederationFactory=void 0;qc.federateSubgraphs=Tfe;qc.federateSubgraphsWithContracts=Efe;qc.federateSubgraphsContract=hfe;var Re=Oe(),mV=yu(),Kr=Ar(),Pe=qi(),Mc=sT(),xc=nd(),Gr=lp(),YE=rE(),hp=Iu(),ffe=nb(),pfe=dp(),NV=Uf(),ge=Bl(),mfe=ab(),TV=pV(),cd=QE(),ve=sr(),JE=Fl(),Ne=Rr(),Nfe=fp(),Fu=kf(),zE,EV,HE=class{constructor({authorizationDataByParentTypeName:t,concreteTypeNamesByAbstractTypeName:n,disableResolvabilityValidation:r,entityDataByTypeName:i,entityInterfaceFederationDataByTypeName:a,fieldCoordsByNamedTypeName:o,internalGraph:c,internalSubgraphBySubgraphName:l,warnings:d}){Yu(this,zE);_(this,"authorizationDataByParentTypeName");_(this,"coordsByNamedTypeName",new Map);_(this,"disableResolvabilityValidation",!1);_(this,"directiveDefinitionByName",new Map);_(this,"clientDefinitions",[]);_(this,"currentSubgraphName","");_(this,"concreteTypeNamesByAbstractTypeName");_(this,"subgraphNamesByNamedTypeNameByFieldCoords",new Map);_(this,"entityDataByTypeName");_(this,"entityInterfaceFederationDataByTypeName");_(this,"errors",[]);_(this,"fieldConfigurationByFieldCoords",new Map);_(this,"fieldCoordsByNamedTypeName");_(this,"inaccessibleCoords",new Set);_(this,"inaccessibleRequiredInputValueErrorByCoords",new Map);_(this,"internalGraph");_(this,"internalSubgraphBySubgraphName");_(this,"invalidORScopesCoords",new Set);_(this,"isMaxDepth",!1);_(this,"isVersionTwo",!1);_(this,"namedInputValueTypeNames",new Set);_(this,"namedOutputTypeNames",new Set);_(this,"parentDefinitionDataByTypeName",new Map);_(this,"parentTagDataByTypeName",new Map);_(this,"persistedDirectiveDefinitionByDirectiveName",new Map([[ve.AUTHENTICATED,Fu.AUTHENTICATED_DEFINITION],[ve.DEPRECATED,Fu.DEPRECATED_DEFINITION],[ve.INACCESSIBLE,Fu.INACCESSIBLE_DEFINITION],[ve.ONE_OF,Fu.ONE_OF_DEFINITION],[ve.REQUIRES_SCOPES,Fu.REQUIRES_SCOPES_DEFINITION],[ve.SEMANTIC_NON_NULL,Fu.SEMANTIC_NON_NULL_DEFINITION],[ve.TAG,Fu.TAG_DEFINITION]]));_(this,"potentialPersistedDirectiveDefinitionDataByDirectiveName",new Map);_(this,"referencedPersistedDirectiveNames",new Set);_(this,"routerDefinitions",[]);_(this,"subscriptionFilterDataByFieldPath",new Map);_(this,"tagNamesByCoords",new Map);_(this,"warnings");this.authorizationDataByParentTypeName=t,this.concreteTypeNamesByAbstractTypeName=n,this.disableResolvabilityValidation=r!=null?r:!1,this.entityDataByTypeName=i,this.entityInterfaceFederationDataByTypeName=a,this.fieldCoordsByNamedTypeName=o,this.internalGraph=c,this.internalSubgraphBySubgraphName=l,this.warnings=d}extractPersistedDirectives({data:t,directivesByName:n}){for(let[r,i]of n)if(this.persistedDirectiveDefinitionByDirectiveName.get(r)&&(this.referencedPersistedDirectiveNames.add(r),!(ve.AUTHORIZATION_DIRECTIVES.has(r)||i.length<1)))switch(r){case ve.DEPRECATED:{t.isDeprecated=!0,(0,ge.upsertDeprecatedDirective)(t,i[0]);break}case ve.TAG:{(0,ge.upsertTagDirectives)(t,i);break}default:{let o=t.directivesByDirectiveName.get(r);if(!o){t.directivesByDirectiveName.set(r,[...i]);break}if(ve.NON_REPEATABLE_PERSISTED_DIRECTIVES.has(r))break;o.push(...i)}}return t}getValidImplementedInterfaces(t){var o;let n=[];if(t.implementedInterfaceTypeNames.size<1)return n;let r=(0,ge.isNodeDataInaccessible)(t),i=new Map,a=new Map;for(let c of t.implementedInterfaceTypeNames){n.push((0,Kr.stringToNamedTypeNode)(c));let l=(0,Ne.getOrThrowError)(this.parentDefinitionDataByTypeName,c,ve.PARENT_DEFINITION_DATA);if(l.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION){a.set(l.name,(0,Ne.kindToNodeType)(l.kind));continue}let d={invalidFieldImplementations:new Map,unimplementedFields:[]},p=!1;for(let[E,I]of l.fieldDataByName){let v=!1,A=t.fieldDataByName.get(E);if(!A){p=!0,d.unimplementedFields.push(E);continue}let U={invalidAdditionalArguments:new Set,invalidImplementedArguments:[],isInaccessible:!1,originalResponseType:(0,YE.printTypeNode)(I.node.type),unimplementedArguments:new Set};(0,ge.isTypeValidImplementation)(I.node.type,A.node.type,this.concreteTypeNamesByAbstractTypeName)||(p=!0,v=!0,U.implementedResponseType=(0,YE.printTypeNode)(A.node.type));let j=new Set;for(let[$,re]of I.argumentDataByName){let te=re.node;j.add($);let me=(o=A.argumentDataByName.get($))==null?void 0:o.node;if(!me){p=!0,v=!0,U.unimplementedArguments.add($);continue}let ue=(0,YE.printTypeNode)(me.type),Ae=(0,YE.printTypeNode)(te.type);Ae!==ue&&(p=!0,v=!0,U.invalidImplementedArguments.push({actualType:ue,argumentName:$,expectedType:Ae}))}for(let[$,re]of A.argumentDataByName){let te=re.node;j.has($)||te.type.kind===Re.Kind.NON_NULL_TYPE&&(p=!0,v=!0,U.invalidAdditionalArguments.add($))}!r&&A.isInaccessible&&!I.isInaccessible&&(p=!0,v=!0,U.isInaccessible=!0),v&&d.invalidFieldImplementations.set(E,U)}p&&i.set(c,d)}return a.size>0&&this.errors.push((0,Pe.invalidImplementedTypeError)(t.name,a)),i.size>0&&this.errors.push((0,Pe.invalidInterfaceImplementationError)(t.node.name.value,(0,Ne.kindToNodeType)(t.kind),i)),n}addValidPrimaryKeyTargetsToEntityData(t){var p;let n=this.entityDataByTypeName.get(t);if(!n)return;let r=(0,Ne.getOrThrowError)(this.internalSubgraphBySubgraphName,this.currentSubgraphName,"internalSubgraphBySubgraphName"),i=r.parentDefinitionDataByTypeName,a=i.get(n.typeName);if(!a||a.kind!==Re.Kind.OBJECT_TYPE_DEFINITION)throw(0,Pe.incompatibleParentKindFatalError)(n.typeName,Re.Kind.OBJECT_TYPE_DEFINITION,(a==null?void 0:a.kind)||Re.Kind.NULL);let o=r.configurationDataByTypeName.get(n.typeName);if(!o)return;let c=[],l=this.internalGraph.nodeByNodeName.get(`${this.currentSubgraphName}.${n.typeName}`);(0,Mc.validateImplicitFieldSets)({conditionalFieldDataByCoords:r.conditionalFieldDataByCoordinates,currentSubgraphName:this.currentSubgraphName,entityData:n,implicitKeys:c,objectData:a,parentDefinitionDataByTypeName:i,graphNode:l});for(let[E,I]of this.entityInterfaceFederationDataByTypeName){if(!((p=I.concreteTypeNames)!=null&&p.has(n.typeName)))continue;let v=this.entityDataByTypeName.get(E);v&&(0,Mc.validateImplicitFieldSets)({conditionalFieldDataByCoords:r.conditionalFieldDataByCoordinates,currentSubgraphName:this.currentSubgraphName,entityData:v,implicitKeys:c,objectData:a,parentDefinitionDataByTypeName:i,graphNode:l})}if(c.length<1)return;if(!o.keys||o.keys.length<1){o.isRootNode=!0,o.keys=c;return}let d=new Set(o.keys.map(E=>E.selectionSet));for(let E of c)d.has(E.selectionSet)||(o.keys.push(E),d.add(E.selectionSet))}addValidPrimaryKeyTargetsFromInterfaceObject(t,n,r,i){let a=t.parentDefinitionDataByTypeName,o=a.get(n);if(!o||!(0,ge.isParentDataCompositeOutputType)(o))throw(0,Pe.incompatibleParentKindFatalError)(n,Re.Kind.INTERFACE_TYPE_DEFINITION,(o==null?void 0:o.kind)||Re.Kind.NULL);let c=(0,Ne.getOrThrowError)(t.configurationDataByTypeName,r.typeName,"internalSubgraph.configurationDataByTypeName"),l=[];if((0,Mc.validateImplicitFieldSets)({conditionalFieldDataByCoords:t.conditionalFieldDataByCoordinates,currentSubgraphName:t.name,entityData:r,implicitKeys:l,objectData:o,parentDefinitionDataByTypeName:a,graphNode:i}),l.length<1)return;if(!c.keys||c.keys.length<1){c.isRootNode=!0,c.keys=l;return}let d=new Set(c.keys.map(p=>p.selectionSet));for(let p of l)d.has(p.selectionSet)||(c.keys.push(p),d.add(p.selectionSet))}getEnumValueMergeMethod(t){return this.namedInputValueTypeNames.has(t)?this.namedOutputTypeNames.has(t)?ge.MergeMethod.CONSISTENT:ge.MergeMethod.INTERSECTION:ge.MergeMethod.UNION}generateTagData(){for(let[t,n]of this.tagNamesByCoords){let r=t.split(ve.PERIOD);if(r.length<1)continue;let i=(0,Ne.getValueOrDefault)(this.parentTagDataByTypeName,r[0],()=>(0,Mc.newParentTagData)(r[0]));switch(r.length){case 1:for(let l of n)i.tagNames.add(l);break;case 2:let a=(0,Ne.getValueOrDefault)(i.childTagDataByChildName,r[1],()=>(0,Mc.newChildTagData)(r[1]));for(let l of n)a.tagNames.add(l);break;case 3:let o=(0,Ne.getValueOrDefault)(i.childTagDataByChildName,r[1],()=>(0,Mc.newChildTagData)(r[1])),c=(0,Ne.getValueOrDefault)(o.tagNamesByArgumentName,r[2],()=>new Set);for(let l of n)c.add(l);break;default:break}}}upsertEnumValueData(t,n,r){let i=t.get(n.name),a=i||this.copyEnumValueData(n);this.extractPersistedDirectives({data:a.persistedDirectivesData,directivesByName:n.directivesByDirectiveName});let o=(0,ge.isNodeDataInaccessible)(n);if((r||o)&&this.inaccessibleCoords.add(a.federatedCoords),this.recordTagNamesByCoords(a,a.federatedCoords),!i){t.set(a.name,a);return}a.appearances+=1,(0,Ne.addNewObjectValueMapEntries)(n.configureDescriptionDataBySubgraphName,a.configureDescriptionDataBySubgraphName),(0,ge.setLongestDescription)(a,n),(0,Ne.addIterableToSet)({source:n.subgraphNames,target:a.subgraphNames})}upsertInputValueData(t,n,r,i){let a=t.get(n.name),o=a||this.copyInputValueData(n);if(this.extractPersistedDirectives({data:o.persistedDirectivesData,directivesByName:n.directivesByDirectiveName}),this.recordTagNamesByCoords(o,`${r}.${o.name}`),this.namedInputValueTypeNames.add(o.namedTypeName),(0,Ne.getValueOrDefault)(this.coordsByNamedTypeName,o.namedTypeName,()=>new Set).add(o.federatedCoords),!a){t.set(o.name,o);return}(0,Ne.addNewObjectValueMapEntries)(n.configureDescriptionDataBySubgraphName,o.configureDescriptionDataBySubgraphName),(0,ge.setLongestDescription)(o,n),(0,Ne.addIterableToSet)({source:n.requiredSubgraphNames,target:o.requiredSubgraphNames}),(0,Ne.addIterableToSet)({source:n.subgraphNames,target:o.subgraphNames}),this.handleInputValueInaccessibility(i,o,r);let c=(0,cd.getMostRestrictiveMergedTypeNode)(o.type,n.type,o.originalCoords,this.errors);c.success?o.type=c.typeNode:this.errors.push((0,Pe.incompatibleMergedTypesError)({actualType:c.actualType,isArgument:a.isArgument,coords:a.federatedCoords,expectedType:c.expectedType})),(0,ge.compareAndValidateInputValueDefaultValues)(o,n,this.errors)}handleInputValueInaccessibility(t,n,r){if(t){this.inaccessibleRequiredInputValueErrorByCoords.delete(n.federatedCoords),this.inaccessibleCoords.add(n.federatedCoords);return}if((0,ge.isNodeDataInaccessible)(n)){if((0,ge.isTypeRequired)(n.type)){this.inaccessibleRequiredInputValueErrorByCoords.set(n.federatedCoords,(0,Pe.inaccessibleRequiredInputValueError)(n,r));return}this.inaccessibleCoords.add(n.federatedCoords)}}handleSubscriptionFilterDirective(t,n){let r=t.directivesByDirectiveName.get(ve.SUBSCRIPTION_FILTER);if(!r)return;let i=(0,Ne.getFirstEntry)(t.subgraphNames);if(i===void 0){this.errors.push((0,Pe.unknownFieldSubgraphNameError)(t.federatedCoords));return}this.subscriptionFilterDataByFieldPath.set(t.federatedCoords,{directive:r[0],fieldData:n||t,directiveSubgraphName:i})}federateOutputType({current:t,other:n,coords:r,mostRestrictive:i}){n=(0,mV.getMutableTypeNode)(n,r,this.errors);let a={kind:t.kind},o=cd.DivergentType.NONE,c=a;for(let l=0;lnew Set)})}upsertFieldData(t,n,r){let i=t.get(n.name),a=i||this.copyFieldData(n,r||(0,ge.isNodeDataInaccessible)(n));(0,Ne.getValueOrDefault)(this.coordsByNamedTypeName,n.namedTypeName,()=>new Set).add(a.federatedCoords),this.namedOutputTypeNames.add(n.namedTypeName),this.handleSubscriptionFilterDirective(n,a),this.extractPersistedDirectives({data:a.persistedDirectivesData,directivesByName:n.directivesByDirectiveName});let o=r||(0,ge.isNodeDataInaccessible)(a);if(o&&this.inaccessibleCoords.add(a.federatedCoords),this.recordTagNamesByCoords(a,a.federatedCoords),!i){t.set(a.name,a);return}let c=this.federateOutputType({current:a.type,other:n.type,coords:a.federatedCoords,mostRestrictive:!1});if(c.success)if(a.type=c.typeNode,a.namedTypeName!==n.namedTypeName){let l=(0,Ne.getValueOrDefault)(this.subgraphNamesByNamedTypeNameByFieldCoords,a.federatedCoords,()=>new Map),d=(0,Ne.getValueOrDefault)(l,a.namedTypeName,()=>new Set);if(d.size<1)for(let p of a.subgraphNames)n.subgraphNames.has(p)||d.add(p);(0,Ne.addIterableToSet)({source:n.subgraphNames,target:(0,Ne.getValueOrDefault)(l,n.namedTypeName,()=>new Set)})}else this.addSubgraphNameToExistingFieldNamedTypeDisparity(n);for(let l of n.argumentDataByName.values())this.upsertInputValueData(a.argumentDataByName,l,a.federatedCoords,o);(0,Ne.addNewObjectValueMapEntries)(n.configureDescriptionDataBySubgraphName,i.configureDescriptionDataBySubgraphName),(0,ge.setLongestDescription)(a,n),a.isInaccessible||(a.isInaccessible=n.isInaccessible),(0,Ne.addNewObjectValueMapEntries)(n.externalFieldDataBySubgraphName,a.externalFieldDataBySubgraphName),(0,Ne.addMapEntries)({source:n.isShareableBySubgraphName,target:a.isShareableBySubgraphName}),(0,Ne.addMapEntries)({source:n.nullLevelsBySubgraphName,target:a.nullLevelsBySubgraphName}),(0,Ne.addIterableToSet)({source:n.subgraphNames,target:a.subgraphNames})}getClientSchemaUnionMembers(t){let n=[];for(let[r,i]of t.memberByMemberTypeName)this.inaccessibleCoords.has(r)||n.push(i);return n}recordTagNamesByCoords(t,n){let r=n||t.name;if(t.persistedDirectivesData.tagDirectiveByName.size<1)return;let i=(0,Ne.getValueOrDefault)(this.tagNamesByCoords,r,()=>new Set);for(let a of t.persistedDirectivesData.tagDirectiveByName.keys())i.add(a)}copyMutualParentDefinitionData(t){return{configureDescriptionDataBySubgraphName:(0,Ne.copyObjectValueMap)(t.configureDescriptionDataBySubgraphName),directivesByDirectiveName:(0,Ne.copyArrayValueMap)(t.directivesByDirectiveName),extensionType:t.extensionType,name:t.name,persistedDirectivesData:this.extractPersistedDirectives({data:(0,ge.newPersistedDirectivesData)(),directivesByName:t.directivesByDirectiveName}),description:(0,ge.getInitialFederatedDescription)(t)}}copyEnumValueData(t){return{appearances:t.appearances,configureDescriptionDataBySubgraphName:(0,Ne.copyObjectValueMap)(t.configureDescriptionDataBySubgraphName),federatedCoords:t.federatedCoords,directivesByDirectiveName:(0,Ne.copyArrayValueMap)(t.directivesByDirectiveName),kind:t.kind,name:t.name,node:{directives:[],kind:t.kind,name:(0,Kr.stringToNameNode)(t.name)},parentTypeName:t.parentTypeName,persistedDirectivesData:this.extractPersistedDirectives({data:(0,ge.newPersistedDirectivesData)(),directivesByName:t.directivesByDirectiveName}),subgraphNames:new Set(t.subgraphNames),description:(0,ge.getInitialFederatedDescription)(t)}}copyInputValueData(t){return{configureDescriptionDataBySubgraphName:(0,Ne.copyObjectValueMap)(t.configureDescriptionDataBySubgraphName),directivesByDirectiveName:(0,Ne.copyArrayValueMap)(t.directivesByDirectiveName),federatedCoords:t.federatedCoords,fieldName:t.fieldName,includeDefaultValue:t.includeDefaultValue,isArgument:t.isArgument,kind:t.kind,name:t.name,namedTypeKind:t.namedTypeKind,namedTypeName:t.namedTypeName,node:{directives:[],kind:Re.Kind.INPUT_VALUE_DEFINITION,name:(0,Kr.stringToNameNode)(t.name),type:t.type},originalCoords:t.originalCoords,originalParentTypeName:t.originalParentTypeName,persistedDirectivesData:this.extractPersistedDirectives({data:(0,ge.newPersistedDirectivesData)(),directivesByName:t.directivesByDirectiveName}),renamedParentTypeName:t.renamedParentTypeName,requiredSubgraphNames:new Set(t.requiredSubgraphNames),subgraphNames:new Set(t.subgraphNames),type:t.type,defaultValue:t.defaultValue,description:(0,ge.getInitialFederatedDescription)(t)}}copyInputValueDataByValueName(t,n,r){let i=new Map;for(let[a,o]of t){let c=this.copyInputValueData(o);this.handleInputValueInaccessibility(n,c,r),(0,Ne.getValueOrDefault)(this.coordsByNamedTypeName,c.namedTypeName,()=>new Set).add(c.federatedCoords),this.namedInputValueTypeNames.add(c.namedTypeName),this.recordTagNamesByCoords(c,`${r}.${o.name}`),i.set(a,c)}return i}copyFieldData(t,n){return{argumentDataByName:this.copyInputValueDataByValueName(t.argumentDataByName,n,t.federatedCoords),configureDescriptionDataBySubgraphName:(0,Ne.copyObjectValueMap)(t.configureDescriptionDataBySubgraphName),directivesByDirectiveName:(0,Ne.copyArrayValueMap)(t.directivesByDirectiveName),externalFieldDataBySubgraphName:(0,Ne.copyObjectValueMap)(t.externalFieldDataBySubgraphName),federatedCoords:t.federatedCoords,inheritedDirectiveNames:new Set,isInaccessible:t.isInaccessible,isShareableBySubgraphName:new Map(t.isShareableBySubgraphName),kind:t.kind,name:t.name,namedTypeKind:t.namedTypeKind,namedTypeName:t.namedTypeName,node:{arguments:[],directives:[],kind:t.kind,name:(0,Kr.stringToNameNode)(t.name),type:t.type},nullLevelsBySubgraphName:t.nullLevelsBySubgraphName,originalParentTypeName:t.originalParentTypeName,persistedDirectivesData:this.extractPersistedDirectives({data:(0,ge.newPersistedDirectivesData)(),directivesByName:t.directivesByDirectiveName}),renamedParentTypeName:t.renamedParentTypeName,subgraphNames:new Set(t.subgraphNames),type:t.type,description:(0,ge.getInitialFederatedDescription)(t)}}copyEnumValueDataByName(t,n){let r=new Map;for(let[i,a]of t){let o=this.copyEnumValueData(a);this.recordTagNamesByCoords(o,o.federatedCoords),(n||(0,ge.isNodeDataInaccessible)(o))&&this.inaccessibleCoords.add(o.federatedCoords),r.set(i,o)}return r}copyFieldDataByName(t,n){let r=new Map;for(let[i,a]of t){let o=n||(0,ge.isNodeDataInaccessible)(a),c=this.copyFieldData(a,o);this.handleSubscriptionFilterDirective(c),(0,Ne.getValueOrDefault)(this.coordsByNamedTypeName,c.namedTypeName,()=>new Set).add(c.federatedCoords),this.namedOutputTypeNames.add(c.namedTypeName),this.recordTagNamesByCoords(c,c.federatedCoords),o&&this.inaccessibleCoords.add(c.federatedCoords),r.set(i,c)}return r}copyParentDefinitionData(t){let n=this.copyMutualParentDefinitionData(t);switch(t.kind){case Re.Kind.ENUM_TYPE_DEFINITION:return Q(M({},n),{appearances:t.appearances,enumValueDataByName:this.copyEnumValueDataByName(t.enumValueDataByName,t.isInaccessible),isInaccessible:t.isInaccessible,kind:t.kind,node:{kind:t.kind,name:(0,Kr.stringToNameNode)(t.name)},subgraphNames:new Set(t.subgraphNames)});case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:return Q(M({},n),{inputValueDataByName:this.copyInputValueDataByValueName(t.inputValueDataByName,t.isInaccessible,t.name),isInaccessible:t.isInaccessible,kind:t.kind,node:{kind:t.kind,name:(0,Kr.stringToNameNode)(t.name)},subgraphNames:new Set(t.subgraphNames)});case Re.Kind.INTERFACE_TYPE_DEFINITION:return Q(M({},n),{fieldDataByName:this.copyFieldDataByName(t.fieldDataByName,t.isInaccessible),implementedInterfaceTypeNames:new Set(t.implementedInterfaceTypeNames),isEntity:t.isEntity,isInaccessible:t.isInaccessible,kind:t.kind,node:{kind:t.kind,name:(0,Kr.stringToNameNode)(t.name)},requireFetchReasonsFieldNames:new Set,subgraphNames:new Set(t.subgraphNames)});case Re.Kind.OBJECT_TYPE_DEFINITION:return Q(M({},n),{fieldDataByName:this.copyFieldDataByName(t.fieldDataByName,t.isInaccessible),implementedInterfaceTypeNames:new Set(t.implementedInterfaceTypeNames),isEntity:t.isEntity,isInaccessible:t.isInaccessible,isRootType:t.isRootType,kind:t.kind,node:{kind:t.kind,name:(0,Kr.stringToNameNode)(t.renamedTypeName||t.name)},requireFetchReasonsFieldNames:new Set,renamedTypeName:t.renamedTypeName,subgraphNames:new Set(t.subgraphNames)});case Re.Kind.SCALAR_TYPE_DEFINITION:return Q(M({},n),{kind:t.kind,node:{kind:t.kind,name:(0,Kr.stringToNameNode)(t.name)},subgraphNames:new Set(t.subgraphNames)});case Re.Kind.UNION_TYPE_DEFINITION:return Q(M({},n),{kind:t.kind,node:{kind:t.kind,name:(0,Kr.stringToNameNode)(t.name)},memberByMemberTypeName:new Map(t.memberByMemberTypeName),subgraphNames:new Set(t.subgraphNames)})}}getParentTargetData({existingData:t,incomingData:n}){if(!t){let r=this.copyParentDefinitionData(n);return(0,ge.isParentDataRootType)(r)&&(r.extensionType=NV.ExtensionType.NONE),r}return this.extractPersistedDirectives({data:t.persistedDirectivesData,directivesByName:n.directivesByDirectiveName}),t}upsertParentDefinitionData(t,n){let r=this.entityInterfaceFederationDataByTypeName.get(t.name),i=this.parentDefinitionDataByTypeName.get(t.name),a=this.getParentTargetData({existingData:i,incomingData:t});this.recordTagNamesByCoords(a);let o=(0,ge.isNodeDataInaccessible)(a);if(o&&this.inaccessibleCoords.add(a.name),r&&r.interfaceObjectSubgraphNames.has(n)){if(i&&i.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION){this.errors.push((0,Pe.incompatibleParentTypeMergeError)({existingData:i,incomingSubgraphName:n}));return}a.kind=Re.Kind.INTERFACE_TYPE_DEFINITION,a.node.kind=Re.Kind.INTERFACE_TYPE_DEFINITION}if(!i){this.parentDefinitionDataByTypeName.set(a.name,a);return}if(a.kind!==t.kind&&(!r||!r.interfaceObjectSubgraphNames.has(n)||a.kind!==Re.Kind.INTERFACE_TYPE_DEFINITION||t.kind!==Re.Kind.OBJECT_TYPE_DEFINITION)){this.errors.push((0,Pe.incompatibleParentTypeMergeError)({existingData:a,incomingNodeType:(0,Ne.kindToNodeType)(t.kind),incomingSubgraphName:n}));return}switch((0,Ne.addNewObjectValueMapEntries)(t.configureDescriptionDataBySubgraphName,a.configureDescriptionDataBySubgraphName),(0,ge.setLongestDescription)(a,t),(0,ge.setParentDataExtensionType)(a,t),a.kind){case Re.Kind.ENUM_TYPE_DEFINITION:if(!(0,ge.areKindsEqual)(a,t))return;a.appearances+=1,a.isInaccessible||(a.isInaccessible=o),(0,Ne.addIterableToSet)({source:t.subgraphNames,target:a.subgraphNames});for(let l of t.enumValueDataByName.values())this.upsertEnumValueData(a.enumValueDataByName,l,o);return;case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:if(!(0,ge.areKindsEqual)(a,t))return;o&&!a.isInaccessible&&this.propagateInaccessibilityToExistingChildren(a),a.isInaccessible||(a.isInaccessible=o),(0,Ne.addIterableToSet)({source:t.subgraphNames,target:a.subgraphNames});for(let l of t.inputValueDataByName.values())this.upsertInputValueData(a.inputValueDataByName,l,a.name,a.isInaccessible);return;case Re.Kind.INTERFACE_TYPE_DEFINITION:case Re.Kind.OBJECT_TYPE_DEFINITION:let c=t;o&&!a.isInaccessible&&this.propagateInaccessibilityToExistingChildren(a),a.isInaccessible||(a.isInaccessible=o),(0,Ne.addIterableToSet)({source:c.implementedInterfaceTypeNames,target:a.implementedInterfaceTypeNames}),(0,Ne.addIterableToSet)({source:c.subgraphNames,target:a.subgraphNames});for(let l of c.fieldDataByName.values())this.upsertFieldData(a.fieldDataByName,l,a.isInaccessible);return;case Re.Kind.UNION_TYPE_DEFINITION:if(!(0,ge.areKindsEqual)(a,t))return;(0,Ne.addMapEntries)({source:t.memberByMemberTypeName,target:a.memberByMemberTypeName}),(0,Ne.addIterableToSet)({source:t.subgraphNames,target:a.subgraphNames});return;default:(0,Ne.addIterableToSet)({source:t.subgraphNames,target:a.subgraphNames});return}}propagateInaccessibilityToExistingChildren(t){switch(t.kind){case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:for(let n of t.inputValueDataByName.values())this.inaccessibleCoords.add(n.federatedCoords);break;default:for(let n of t.fieldDataByName.values()){this.inaccessibleCoords.add(n.federatedCoords);for(let r of n.argumentDataByName.values())this.inaccessibleCoords.add(r.federatedCoords)}}}upsertPersistedDirectiveDefinitionData(t,n){let r=t.name,i=this.potentialPersistedDirectiveDefinitionDataByDirectiveName.get(r);if(!i){if(n>1)return;let a=new Map;for(let o of t.argumentDataByName.values())this.namedInputValueTypeNames.add(o.namedTypeName),this.upsertInputValueData(a,o,`@${t.name}`,!1);this.potentialPersistedDirectiveDefinitionDataByDirectiveName.set(r,{argumentDataByName:a,executableLocations:new Set(t.executableLocations),name:r,repeatable:t.repeatable,subgraphNames:new Set(t.subgraphNames),description:t.description});return}if(i.subgraphNames.size+1!==n){this.potentialPersistedDirectiveDefinitionDataByDirectiveName.delete(r);return}if((0,ge.setMutualExecutableLocations)(i,t.executableLocations),i.executableLocations.size<1){this.potentialPersistedDirectiveDefinitionDataByDirectiveName.delete(r);return}for(let a of t.argumentDataByName.values())this.namedInputValueTypeNames.add((0,mV.getTypeNodeNamedTypeName)(a.type)),this.upsertInputValueData(i.argumentDataByName,a,`@${i.name}`,!1);(0,ge.setLongestDescription)(i,t),i.repeatable&&(i.repeatable=t.repeatable),(0,Ne.addIterableToSet)({source:t.subgraphNames,target:i.subgraphNames})}shouldUpdateFederatedFieldAbstractNamedType(t,n){if(!t)return!1;let r=this.concreteTypeNamesByAbstractTypeName.get(t);if(!r||r.size<1)return!1;for(let i of n)if(!r.has(i))return!1;return!0}updateTypeNodeNamedType(t,n){let r=t;for(let i=0;i1){this.errors.push((0,Pe.incompatibleFederatedFieldNamedTypeError)(t,n));continue}break}case Re.Kind.UNION_TYPE_DEFINITION:{if(l){this.errors.push((0,Pe.incompatibleFederatedFieldNamedTypeError)(t,n));continue}l=p;break}default:{this.errors.push((0,Pe.incompatibleFederatedFieldNamedTypeError)(t,n));break}}}if(o.size<1&&!l){this.errors.push((0,Pe.incompatibleFederatedFieldNamedTypeError)(t,n));continue}let d=l;if(o.size>0){if(l){this.errors.push((0,Pe.incompatibleFederatedFieldNamedTypeError)(t,n));continue}for(let p of o.keys()){d=p;for(let[E,I]of o)if(p!==E&&!I.implementedInterfaceTypeNames.has(p)){d="";break}if(d)break}}if(!this.shouldUpdateFederatedFieldAbstractNamedType(d,c)){this.errors.push((0,Pe.incompatibleFederatedFieldNamedTypeError)(t,n));continue}a.namedTypeName=d,this.updateTypeNodeNamedType(a.type,d)}}federateInternalSubgraphData(){let t=0,n=!1;for(let r of this.internalSubgraphBySubgraphName.values()){t+=1,this.currentSubgraphName=r.name,this.isVersionTwo||(this.isVersionTwo=r.isVersionTwo),(0,mfe.renameRootTypes)(this,r);for(let i of r.parentDefinitionDataByTypeName.values())this.upsertParentDefinitionData(i,r.name);if(!n){if(!r.persistedDirectiveDefinitionDataByDirectiveName.size){n=!0;continue}for(let i of r.persistedDirectiveDefinitionDataByDirectiveName.values())this.upsertPersistedDirectiveDefinitionData(i,t);this.potentialPersistedDirectiveDefinitionDataByDirectiveName.size<1&&(n=!0)}}this.handleDisparateFieldNamedTypes()}handleInterfaceObjectForInternalGraph({entityData:t,internalSubgraph:n,interfaceObjectData:r,interfaceObjectNode:i,resolvableKeyFieldSets:a,subgraphName:o}){let c=this.internalGraph.addOrUpdateNode(t.typeName),l=this.internalGraph.addEntityDataNode(t.typeName);for(let p of i.satisfiedFieldSets)c.satisfiedFieldSets.add(p),a.has(p)&&l.addTargetSubgraphByFieldSet(p,o);let d=r.fieldDatasBySubgraphName.get(o);for(let{name:p,namedTypeName:E}of d||[])this.internalGraph.addEdge(c,this.internalGraph.addOrUpdateNode(E),p);this.internalGraph.addEdge(i,c,t.typeName,!0),this.addValidPrimaryKeyTargetsFromInterfaceObject(n,i.typeName,t,c)}handleEntityInterfaces(){var t;for(let[n,r]of this.entityInterfaceFederationDataByTypeName){let i=(0,Ne.getOrThrowError)(this.parentDefinitionDataByTypeName,n,ve.PARENT_DEFINITION_DATA);if(i.kind===Re.Kind.INTERFACE_TYPE_DEFINITION)for(let a of r.interfaceObjectSubgraphNames){let o=(0,Ne.getOrThrowError)(this.internalSubgraphBySubgraphName,a,"internalSubgraphBySubgraphName"),c=o.configurationDataByTypeName,l=this.concreteTypeNamesByAbstractTypeName.get(n);if(!l)continue;let d=(0,Ne.getOrThrowError)(c,n,"configurationDataByTypeName"),p=d.keys;if(!p)continue;d.entityInterfaceConcreteTypeNames=new Set(r.concreteTypeNames),this.internalGraph.setSubgraphName(a);let E=this.internalGraph.addOrUpdateNode(n,{isAbstract:!0});for(let I of l){let v=(0,Ne.getOrThrowError)(this.parentDefinitionDataByTypeName,I,ve.PARENT_DEFINITION_DATA);if(!(0,Gr.isObjectDefinitionData)(v))continue;let A=(0,Ne.getOrThrowError)(this.entityDataByTypeName,I,"entityDataByTypeName");A.subgraphNames.add(a);let U=c.get(I);if(U)if((0,Ne.addIterableToSet)({source:d.fieldNames,target:U.fieldNames}),!U.keys)U.keys=[...p];else e:for(let te of p){for(let{selectionSet:me}of U.keys)if(te.selectionSet===me)continue e;U.keys.push(te)}else c.set(I,{fieldNames:new Set(d.fieldNames),isRootNode:!0,keys:[...p],typeName:I});let j=new Set;for(let te of p.filter(me=>!me.disableEntityResolver))j.add(te.selectionSet);let $=this.authorizationDataByParentTypeName.get(n),re=(0,Ne.getOrThrowError)(o.parentDefinitionDataByTypeName,n,"internalSubgraph.parentDefinitionDataByTypeName");if((0,Gr.isObjectDefinitionData)(re)){for(let[te,me]of re.fieldDataByName){let ue=`${I}.${te}`;(0,Ne.getValueOrDefault)(this.fieldCoordsByNamedTypeName,me.namedTypeName,()=>new Set).add(ue);let Ae=$==null?void 0:$.fieldAuthDataByFieldName.get(te);if(Ae){let Z=(0,Ne.getValueOrDefault)(this.authorizationDataByParentTypeName,I,()=>(0,Gr.newAuthorizationData)(I));(0,Gr.upsertFieldAuthorizationData)(Z.fieldAuthDataByFieldName,Ae)||this.invalidORScopesCoords.add(ue)}let xe=v.fieldDataByName.get(te);if(xe){let Z=(t=me.isShareableBySubgraphName.get(a))!=null?t:!1;xe.isShareableBySubgraphName.set(a,Z),xe.subgraphNames.add(a);let _e=me.externalFieldDataBySubgraphName.get(a);if(!_e)continue;xe.externalFieldDataBySubgraphName.set(a,M({},_e));continue}let rt=i.isInaccessible||v.isInaccessible||me.isInaccessible;v.fieldDataByName.set(te,this.copyFieldData(me,rt))}this.handleInterfaceObjectForInternalGraph({internalSubgraph:o,subgraphName:a,interfaceObjectData:r,interfaceObjectNode:E,resolvableKeyFieldSets:j,entityData:A})}}}}}fieldDataToGraphFieldData(t){var n;return{name:t.name,namedTypeName:t.namedTypeName,isLeaf:(0,Gr.isNodeLeaf)((n=this.parentDefinitionDataByTypeName.get(t.namedTypeName))==null?void 0:n.kind),subgraphNames:t.subgraphNames}}getValidFlattenedPersistedDirectiveNodeArray(t){var i;let n=(0,Gr.getNodeCoords)(t),r=[];for(let[a,o]of t.persistedDirectivesData.directivesByDirectiveName){if(a===ve.SEMANTIC_NON_NULL&&(0,ge.isFieldData)(t)){r.push((0,Ne.generateSemanticNonNullDirective)((i=(0,Ne.getFirstEntry)(t.nullLevelsBySubgraphName))!=null?i:new Set([0])));continue}let c=this.persistedDirectiveDefinitionByDirectiveName.get(a);if(c){if(o.length<2){r.push(...o);continue}if(!c.repeatable){this.errors.push((0,Pe.invalidRepeatedFederatedDirectiveErrorMessage)(a,n));continue}r.push(...o)}}return r}getRouterPersistedDirectiveNodes(t){let n=[...t.persistedDirectivesData.tagDirectiveByName.values()];return t.persistedDirectivesData.isDeprecated&&n.push((0,ge.generateDeprecatedDirective)(t.persistedDirectivesData.deprecatedReason)),n.push(...this.getValidFlattenedPersistedDirectiveNodeArray(t)),n}getFederatedGraphNodeDescription(t){if(t.configureDescriptionDataBySubgraphName.size<1)return t.description;let n=[],r="";for(let[i,{propagate:a,description:o}]of t.configureDescriptionDataBySubgraphName)a&&(n.push(i),r=o);if(n.length===1)return(0,Mc.getDescriptionFromString)(r);if(n.length<1)return t.description;this.errors.push((0,Pe.configureDescriptionPropagationError)((0,ge.getDefinitionDataCoords)(t,!0),n))}getNodeForRouterSchemaByData(t){return t.node.name=(0,Kr.stringToNameNode)(t.name),t.node.description=this.getFederatedGraphNodeDescription(t),t.node.directives=this.getRouterPersistedDirectiveNodes(t),t.node}getNodeWithPersistedDirectivesByInputValueData(t){return t.node.name=(0,Kr.stringToNameNode)(t.name),t.node.type=t.type,t.node.description=this.getFederatedGraphNodeDescription(t),t.node.directives=this.getRouterPersistedDirectiveNodes(t),t.includeDefaultValue&&(t.node.defaultValue=t.defaultValue),t.node}getValidFieldArgumentNodes(t){let n=[],r=[],i=[],a=`${t.renamedParentTypeName}.${t.name}`;for(let[o,c]of t.argumentDataByName)t.subgraphNames.size===c.subgraphNames.size?(r.push(o),n.push(this.getNodeWithPersistedDirectivesByInputValueData(c))):(0,ge.isTypeRequired)(c.type)&&i.push({inputValueName:o,missingSubgraphs:(0,Ne.getEntriesNotInHashSet)(t.subgraphNames,c.subgraphNames),requiredSubgraphs:[...c.requiredSubgraphNames]});return i.length>0?this.errors.push((0,Pe.invalidRequiredInputValueError)(ve.FIELD,a,i)):r.length>0&&((0,Ne.getValueOrDefault)(this.fieldConfigurationByFieldCoords,a,()=>({argumentNames:r,fieldName:t.name,typeName:t.renamedParentTypeName})).argumentNames=r),n}getNodeWithPersistedDirectivesByFieldData(t,n){return t.node.arguments=n,t.node.name=(0,Kr.stringToNameNode)(t.name),t.node.type=t.type,t.node.description=this.getFederatedGraphNodeDescription(t),t.node.directives=this.getRouterPersistedDirectiveNodes(t),t.node}validateSemanticNonNull(t){let n;for(let r of t.nullLevelsBySubgraphName.values()){if(!n){n=r;continue}if(n.size!==r.size){this.errors.push((0,Pe.semanticNonNullInconsistentLevelsError)(t));return}for(let i of r)if(!n.has(i)){this.errors.push((0,Pe.semanticNonNullInconsistentLevelsError)(t));return}}}validateOneOfDirective({data:t,inputValueNodes:n,requiredFieldNames:r}){return t.directivesByDirectiveName.has(ve.ONE_OF)?r.size>0?(this.errors.push((0,Pe.oneOfRequiredFieldsError)({requiredFieldNames:Array.from(r),typeName:t.name})),!1):(n.length===1&&this.warnings.push((0,Nfe.singleFederatedInputFieldOneOfWarning)({fieldName:n[0].name.value,typeName:t.name})),!0):!0}pushParentDefinitionDataToDocumentDefinitions(t){for(let[n,r]of this.parentDefinitionDataByTypeName)switch(r.extensionType!==NV.ExtensionType.NONE&&this.errors.push((0,Pe.noBaseDefinitionForExtensionError)((0,Ne.kindToNodeType)(r.kind),n)),r.kind){case Re.Kind.ENUM_TYPE_DEFINITION:{if(xc.IGNORED_FEDERATED_TYPE_NAMES.has(n))break;let i=[],a=[],o=this.getEnumValueMergeMethod(n);(0,ge.propagateAuthDirectives)(r,this.authorizationDataByParentTypeName.get(n));for(let c of r.enumValueDataByName.values()){let l=this.getNodeForRouterSchemaByData(c),d=(0,ge.isNodeDataInaccessible)(c),p=Q(M({},c.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(c)});switch(o){case ge.MergeMethod.CONSISTENT:!d&&r.appearances>c.appearances&&this.errors.push((0,Pe.incompatibleSharedEnumError)(n)),i.push(l),d||a.push(p);break;case ge.MergeMethod.INTERSECTION:r.appearances===c.appearances&&(i.push(l),d||a.push(p));break;default:i.push(l),d||a.push(p);break}}if(r.node.values=i,this.routerDefinitions.push(this.getNodeForRouterSchemaByData(r)),(0,ge.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}if(a.length<1){this.errors.push((0,Pe.allChildDefinitionsAreInaccessibleError)((0,Ne.kindToNodeType)(r.kind),n,ve.ENUM_VALUE));break}this.clientDefinitions.push(Q(M({},r.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(r),values:a}));break}case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:{if(xc.IGNORED_FEDERATED_TYPE_NAMES.has(n))break;let i=new Array,a=new Array,o=new Array,c=new Set;for(let[l,d]of r.inputValueDataByName)if((0,ge.isTypeRequired)(d.type)&&c.add(l),r.subgraphNames.size===d.subgraphNames.size){if(a.push(this.getNodeWithPersistedDirectivesByInputValueData(d)),(0,ge.isNodeDataInaccessible)(d))continue;o.push(Q(M({},d.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(d)}))}else(0,ge.isTypeRequired)(d.type)&&i.push({inputValueName:l,missingSubgraphs:(0,Ne.getEntriesNotInHashSet)(r.subgraphNames,d.subgraphNames),requiredSubgraphs:[...d.requiredSubgraphNames]});if(i.length>0){this.errors.push((0,Pe.invalidRequiredInputValueError)(ve.INPUT_OBJECT,n,i,!1));break}if(!this.validateOneOfDirective({data:r,inputValueNodes:a,requiredFieldNames:c}))break;if(r.node.fields=a,this.routerDefinitions.push(this.getNodeForRouterSchemaByData(r)),(0,ge.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r);break}if(o.length<1){this.errors.push((0,Pe.allChildDefinitionsAreInaccessibleError)((0,Ne.kindToNodeType)(r.kind),n,"Input field"));break}this.clientDefinitions.push(Q(M({},r.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(r),fields:o}));break}case Re.Kind.INTERFACE_TYPE_DEFINITION:case Re.Kind.OBJECT_TYPE_DEFINITION:{let i=[],a=[],o=new Map,c=(0,ge.newInvalidFieldNames)(),l=r.kind===Re.Kind.OBJECT_TYPE_DEFINITION,d=this.authorizationDataByParentTypeName.get(n);(0,ge.propagateAuthDirectives)(r,d);for(let[E,I]of r.fieldDataByName){(0,ge.propagateFieldAuthDirectives)(I,d);let v=this.getValidFieldArgumentNodes(I);l&&(0,ge.validateExternalAndShareable)(I,c),this.validateSemanticNonNull(I),i.push(this.getNodeWithPersistedDirectivesByFieldData(I,v)),!(0,ge.isNodeDataInaccessible)(I)&&(a.push((0,ge.getClientSchemaFieldNodeByFieldData)(I)),o.set(E,this.fieldDataToGraphFieldData(I)))}if(l&&(c.byShareable.size>0&&this.errors.push((0,Pe.invalidFieldShareabilityError)(r,c.byShareable)),c.subgraphNamesByExternalFieldName.size>0&&this.errors.push((0,Pe.allExternalFieldInstancesError)(n,c.subgraphNamesByExternalFieldName))),r.node.fields=i,this.internalGraph.initializeNode(n,o),r.implementedInterfaceTypeNames.size>0){t.push({data:r,clientSchemaFieldNodes:a});break}this.routerDefinitions.push(this.getNodeForRouterSchemaByData(r));let p=(0,pfe.isNodeQuery)(n);if((0,ge.isNodeDataInaccessible)(r)){if(p){this.errors.push(Pe.inaccessibleQueryRootTypeError);break}this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}if(a.length<1){let E=p?(0,Pe.noQueryRootTypeError)(!1):(0,Pe.allChildDefinitionsAreInaccessibleError)((0,Ne.kindToNodeType)(r.kind),n,ve.FIELD);this.errors.push(E);break}this.clientDefinitions.push(Q(M({},r.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(r),fields:a}));break}case Re.Kind.SCALAR_TYPE_DEFINITION:{if(xc.IGNORED_FEDERATED_TYPE_NAMES.has(n))break;if((0,ge.propagateAuthDirectives)(r,this.authorizationDataByParentTypeName.get(n)),this.routerDefinitions.push(this.getNodeForRouterSchemaByData(r)),(0,ge.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}this.clientDefinitions.push(Q(M({},r.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(r)}));break}case Re.Kind.UNION_TYPE_DEFINITION:{if(r.node.types=(0,Gr.mapToArrayOfValues)(r.memberByMemberTypeName),this.routerDefinitions.push(this.getNodeForRouterSchemaByData(r)),(0,ge.isNodeDataInaccessible)(r)){this.validateReferencesOfInaccessibleType(r),this.internalGraph.setNodeInaccessible(r.name);break}let i=this.getClientSchemaUnionMembers(r);if(i.length<1){this.errors.push((0,Pe.allChildDefinitionsAreInaccessibleError)(ve.UNION,n,"union member type"));break}this.clientDefinitions.push(Q(M({},r.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(r),types:i}));break}}}pushNamedTypeAuthDataToFields(){var t;for(let[n,r]of this.authorizationDataByParentTypeName){if(!r.requiresAuthentication&&r.requiredScopes.length<1)continue;let i=this.fieldCoordsByNamedTypeName.get(n);if(i)for(let a of i){let o=a.split(ve.PERIOD);switch(o.length){case 2:{let c=(0,Ne.getValueOrDefault)(this.authorizationDataByParentTypeName,o[0],()=>(0,Gr.newAuthorizationData)(o[0])),l=(0,Ne.getValueOrDefault)(c.fieldAuthDataByFieldName,o[1],()=>(0,Gr.newFieldAuthorizationData)(o[1]));(t=l.inheritedData).requiresAuthentication||(t.requiresAuthentication=r.requiresAuthentication),l.inheritedData.requiredScopes.length*r.requiredScopes.length>hp.MAX_OR_SCOPES?this.invalidORScopesCoords.add(a):(l.inheritedData.requiredScopesByOR=(0,Gr.mergeRequiredScopesByAND)(l.inheritedData.requiredScopesByOR,r.requiredScopesByOR),l.inheritedData.requiredScopes=(0,Gr.mergeRequiredScopesByAND)(l.inheritedData.requiredScopes,r.requiredScopes));break}default:break}}}}federateSubgraphData(){this.federateInternalSubgraphData(),this.handleEntityInterfaces(),this.generateTagData(),Ud(this,zE,EV).call(this),this.pushNamedTypeAuthDataToFields()}validateInterfaceImplementationsAndPushToDocumentDefinitions(t){for(let{data:n,clientSchemaFieldNodes:r}of t){if(n.node.interfaces=this.getValidImplementedInterfaces(n),this.routerDefinitions.push(this.getNodeForRouterSchemaByData(n)),(0,ge.isNodeDataInaccessible)(n)){this.validateReferencesOfInaccessibleType(n),this.internalGraph.setNodeInaccessible(n.name);continue}let i=[];for(let a of n.implementedInterfaceTypeNames)this.inaccessibleCoords.has(a)||i.push((0,Kr.stringToNamedTypeNode)(a));this.clientDefinitions.push(Q(M({},n.node),{directives:(0,ge.getClientPersistedDirectiveNodes)(n),fields:r,interfaces:i}))}}validatePathSegmentInaccessibility(t){if(!t)return!1;let r=t.split(ve.LEFT_PARENTHESIS)[0].split(ve.PERIOD),i=r[0];for(let a=0;a0&&this.errors.push((0,Pe.invalidReferencesOfInaccessibleTypeError)((0,Ne.kindToNodeType)(t.kind),t.name,r))}validateQueryRootType(){let t=this.parentDefinitionDataByTypeName.get(ve.QUERY);if(!t||t.kind!==Re.Kind.OBJECT_TYPE_DEFINITION||t.fieldDataByName.size<1){this.errors.push((0,Pe.noQueryRootTypeError)());return}for(let n of t.fieldDataByName.values())if(!(0,ge.isNodeDataInaccessible)(n))return;this.errors.push((0,Pe.noQueryRootTypeError)())}validateSubscriptionFieldConditionFieldPath(t,n,r,i,a){let o=t.split(ve.PERIOD);if(o.length<1)return a.push((0,Pe.invalidSubscriptionFieldConditionFieldPathErrorMessage)(r,t)),[];let c=n;if(this.inaccessibleCoords.has(c.renamedTypeName))return a.push((0,Pe.inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,o[0],c.renamedTypeName)),[];let l="";for(let d=0;d0?`.${p}`:p,c.kind!==Re.Kind.OBJECT_TYPE_DEFINITION)return a.push((0,Pe.invalidSubscriptionFieldConditionFieldPathParentErrorMessage)(r,t,l)),[];let E=c.fieldDataByName.get(p);if(!E)return a.push((0,Pe.undefinedSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,l,p,c.renamedTypeName)),[];let I=`${c.renamedTypeName}.${p}`;if(!E.subgraphNames.has(i))return a.push((0,Pe.invalidSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,l,I,i)),[];if(this.inaccessibleCoords.has(I))return a.push((0,Pe.inaccessibleSubscriptionFieldConditionFieldPathFieldErrorMessage)(r,t,l,I)),[];if(hp.BASE_SCALARS.has(E.namedTypeName)){c={kind:Re.Kind.SCALAR_TYPE_DEFINITION,name:E.namedTypeName};continue}c=(0,Ne.getOrThrowError)(this.parentDefinitionDataByTypeName,E.namedTypeName,ve.PARENT_DEFINITION_DATA)}return(0,ge.isLeafKind)(c.kind)?o:(a.push((0,Pe.nonLeafSubscriptionFieldConditionFieldPathFinalFieldErrorMessage)(r,t,o[o.length-1],(0,Ne.kindToNodeType)(c.kind),c.name)),[])}validateSubscriptionFieldCondition(t,n,r,i,a,o,c){if(i>JE.MAX_SUBSCRIPTION_FILTER_DEPTH||this.isMaxDepth)return c.push((0,Pe.subscriptionFilterConditionDepthExceededErrorMessage)(a)),this.isMaxDepth=!0,!1;let l=!1,d=new Set([ve.FIELD_PATH,ve.VALUES]),p=new Set,E=new Set,I=[];for(let v of t.fields){let A=v.name.value,U=a+`.${A}`;switch(A){case ve.FIELD_PATH:{if(d.has(ve.FIELD_PATH))d.delete(ve.FIELD_PATH);else{l=!0,p.add(ve.FIELD_PATH);break}if(v.value.kind!==Re.Kind.STRING){I.push((0,Pe.invalidInputFieldTypeErrorMessage)(U,ve.STRING,(0,Ne.kindToNodeType)(v.value.kind))),l=!0;break}let j=this.validateSubscriptionFieldConditionFieldPath(v.value.value,r,U,o,I);if(j.length<1){l=!0;break}n.fieldPath=j;break}case ve.VALUES:{if(d.has(ve.VALUES))d.delete(ve.VALUES);else{l=!0,p.add(ve.VALUES);break}let j=v.value.kind;if(j==Re.Kind.NULL||j==Re.Kind.OBJECT){I.push((0,Pe.invalidInputFieldTypeErrorMessage)(U,ve.LIST,(0,Ne.kindToNodeType)(v.value.kind))),l=!0;break}if(j!==Re.Kind.LIST){n.values=[(0,ge.getSubscriptionFilterValue)(v.value)];break}let $=new Set,re=[];for(let te=0;te0){I.push((0,Pe.subscriptionFieldConditionInvalidValuesArrayErrorMessage)(U,re));continue}if($.size<1){l=!0,I.push((0,Pe.subscriptionFieldConditionEmptyValuesArrayErrorMessage)(U));continue}n.values=[...$];break}default:l=!0,E.add(A)}}return l?(c.push((0,Pe.subscriptionFieldConditionInvalidInputFieldErrorMessage)(a,[...d],[...p],[...E],I)),!1):!0}validateSubscriptionFilterCondition(t,n,r,i,a,o,c){if(i>JE.MAX_SUBSCRIPTION_FILTER_DEPTH||this.isMaxDepth)return c.push((0,Pe.subscriptionFilterConditionDepthExceededErrorMessage)(a)),this.isMaxDepth=!0,!1;if(i+=1,t.fields.length!==1)return c.push((0,Pe.subscriptionFilterConditionInvalidInputFieldNumberErrorMessage)(a,t.fields.length)),!1;let l=t.fields[0],d=l.name.value;if(!xc.SUBSCRIPTION_FILTER_INPUT_NAMES.has(d))return c.push((0,Pe.subscriptionFilterConditionInvalidInputFieldErrorMessage)(a,d)),!1;let p=a+`.${d}`;switch(l.value.kind){case Re.Kind.OBJECT:switch(d){case ve.IN_UPPER:return n.in={fieldPath:[],values:[]},this.validateSubscriptionFieldCondition(l.value,n.in,r,i,a+".IN",o,c);case ve.NOT_UPPER:return n.not={},this.validateSubscriptionFilterCondition(l.value,n.not,r,i,a+".NOT",o,c);default:return c.push((0,Pe.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(p,ve.LIST,ve.OBJECT)),!1}case Re.Kind.LIST:{let E=[];switch(d){case ve.AND_UPPER:{n.and=E;break}case ve.OR_UPPER:{n.or=E;break}default:return c.push((0,Pe.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(p,ve.OBJECT,ve.LIST)),!1}let I=l.value.values.length;if(I<1||I>5)return c.push((0,Pe.subscriptionFilterArrayConditionInvalidLengthErrorMessage)(p,I)),!1;let v=!0,A=[];for(let U=0;U0?(c.push((0,Pe.subscriptionFilterArrayConditionInvalidItemTypeErrorMessage)(p,A)),!1):v}default:{let E=xc.SUBSCRIPTION_FILTER_LIST_INPUT_NAMES.has(d)?ve.LIST:ve.OBJECT;return c.push((0,Pe.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(p,E,(0,Ne.kindToNodeType)(l.value.kind))),!1}}}validateSubscriptionFilterAndGenerateConfiguration(t,n,r,i,a,o){if(!t.arguments||t.arguments.length!==1)return;let c=t.arguments[0];if(c.value.kind!==Re.Kind.OBJECT){this.errors.push((0,Pe.invalidSubscriptionFilterDirectiveError)(r,[(0,Pe.subscriptionFilterConditionInvalidInputFieldTypeErrorMessage)(ve.CONDITION,ve.OBJECT,(0,Ne.kindToNodeType)(c.value.kind))]));return}let l={},d=[];if(!this.validateSubscriptionFilterCondition(c.value,l,n,0,ve.CONDITION,o,d)){this.errors.push((0,Pe.invalidSubscriptionFilterDirectiveError)(r,d)),this.isMaxDepth=!1;return}(0,Ne.getValueOrDefault)(this.fieldConfigurationByFieldCoords,r,()=>({argumentNames:[],fieldName:i,typeName:a})).subscriptionFilterCondition=l}validateSubscriptionFiltersAndGenerateConfiguration(){for(let[t,n]of this.subscriptionFilterDataByFieldPath){if(this.inaccessibleCoords.has(t))continue;let r=this.parentDefinitionDataByTypeName.get(n.fieldData.namedTypeName);if(!r){this.errors.push((0,Pe.invalidSubscriptionFilterDirectiveError)(t,[(0,Pe.subscriptionFilterNamedTypeErrorMessage)(n.fieldData.namedTypeName)]));continue}(0,ge.isNodeDataInaccessible)(r)||r.kind===Re.Kind.OBJECT_TYPE_DEFINITION&&this.validateSubscriptionFilterAndGenerateConfiguration(n.directive,r,t,n.fieldData.name,n.fieldData.renamedParentTypeName,n.directiveSubgraphName)}}buildFederationResult(){this.subscriptionFilterDataByFieldPath.size>0&&this.validateSubscriptionFiltersAndGenerateConfiguration(),this.invalidORScopesCoords.size>0&&this.errors.push((0,Pe.orScopesLimitError)(hp.MAX_OR_SCOPES,[...this.invalidORScopesCoords]));for(let a of this.potentialPersistedDirectiveDefinitionDataByDirectiveName.values())(0,ge.addValidPersistedDirectiveDefinitionNodeByData)(this.routerDefinitions,a,this.persistedDirectiveDefinitionByDirectiveName,this.errors);let t=[];this.pushParentDefinitionDataToDocumentDefinitions(t),this.validateInterfaceImplementationsAndPushToDocumentDefinitions(t),this.validateQueryRootType();for(let a of this.inaccessibleRequiredInputValueErrorByCoords.values())this.errors.push(a);if(this.errors.length>0)return{errors:this.errors,success:!1,warnings:this.warnings};if(!this.disableResolvabilityValidation&&this.internalSubgraphBySubgraphName.size>1){let a=this.internalGraph.validate();if(!a.success)return{errors:a.errors,success:!1,warnings:this.warnings}}let n={kind:Re.Kind.DOCUMENT,definitions:this.routerDefinitions},r=(0,Re.buildASTSchema)({kind:Re.Kind.DOCUMENT,definitions:this.clientDefinitions},{assumeValid:!0,assumeValidSDL:!0}),i=new Map;for(let{configurationDataByTypeName:a,directiveDefinitionByName:o,isVersionTwo:c,name:l,parentDefinitionDataByTypeName:d,schema:p,schemaNode:E}of this.internalSubgraphBySubgraphName.values())i.set(l,{configurationDataByTypeName:a,directiveDefinitionByName:o,isVersionTwo:c,parentDefinitionDataByTypeName:d,schema:p,schemaNode:E});for(let a of this.authorizationDataByParentTypeName.values())(0,Gr.upsertAuthorizationConfiguration)(this.fieldConfigurationByFieldCoords,a);return M({directiveDefinitionByName:this.directiveDefinitionByName,fieldConfigurations:Array.from(this.fieldConfigurationByFieldCoords.values()),federatedGraphAST:n,federatedGraphSchema:(0,Re.buildASTSchema)(n,{assumeValid:!0,assumeValidSDL:!0}),federatedGraphClientSchema:r,parentDefinitionDataByTypeName:this.parentDefinitionDataByTypeName,subgraphConfigBySubgraphName:i,success:!0,warnings:this.warnings},this.getClientSchemaObjectBoolean())}getClientSchemaObjectBoolean(){return this.inaccessibleCoords.size<1&&this.tagNamesByCoords.size<1?{}:{shouldIncludeClientSchema:!0}}handleChildTagExclusions(t,n,r,i){let a=n.size;for(let[o,c]of r){let l=(0,Ne.getOrThrowError)(n,o,`${t.name}.childDataByChildName`);if((0,ge.isNodeDataInaccessible)(l)){a-=1;continue}i.isDisjointFrom(c.tagNames)||((0,Ne.getValueOrDefault)(l.persistedDirectivesData.directivesByDirectiveName,ve.INACCESSIBLE,()=>[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(`${t.name}.${o}`),a-=1)}a<1&&(t.persistedDirectivesData.directivesByDirectiveName.set(ve.INACCESSIBLE,[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(t.name))}handleChildTagInclusions(t,n,r,i){let a=n.size;for(let[o,c]of n){if((0,ge.isNodeDataInaccessible)(c)){a-=1;continue}let l=r.get(o);(!l||i.isDisjointFrom(l.tagNames))&&((0,Ne.getValueOrDefault)(c.persistedDirectivesData.directivesByDirectiveName,ve.INACCESSIBLE,()=>[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(`${t.name}.${o}`),a-=1)}a<1&&(t.persistedDirectivesData.directivesByDirectiveName.set(ve.INACCESSIBLE,[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(t.name))}buildFederationContractResult(t){if(this.isVersionTwo||this.routerDefinitions.push(Fu.INACCESSIBLE_DEFINITION),t.tagNamesToExclude.size>0)for(let[o,c]of this.parentTagDataByTypeName){let l=(0,Ne.getOrThrowError)(this.parentDefinitionDataByTypeName,o,ve.PARENT_DEFINITION_DATA);if(!(0,ge.isNodeDataInaccessible)(l)){if(!t.tagNamesToExclude.isDisjointFrom(c.tagNames)){l.persistedDirectivesData.directivesByDirectiveName.set(ve.INACCESSIBLE,[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(o);continue}if(!(c.childTagDataByChildName.size<1))switch(l.kind){case Re.Kind.SCALAR_TYPE_DEFINITION:case Re.Kind.UNION_TYPE_DEFINITION:break;case Re.Kind.ENUM_TYPE_DEFINITION:{this.handleChildTagExclusions(l,l.enumValueDataByName,c.childTagDataByChildName,t.tagNamesToExclude);break}case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:{this.handleChildTagExclusions(l,l.inputValueDataByName,c.childTagDataByChildName,t.tagNamesToExclude);break}default:{let d=l.fieldDataByName.size;for(let[p,E]of c.childTagDataByChildName){let I=(0,Ne.getOrThrowError)(l.fieldDataByName,p,`${o}.fieldDataByFieldName`);if((0,ge.isNodeDataInaccessible)(I)){d-=1;continue}if(!t.tagNamesToExclude.isDisjointFrom(E.tagNames)){(0,Ne.getValueOrDefault)(I.persistedDirectivesData.directivesByDirectiveName,ve.INACCESSIBLE,()=>[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(I.federatedCoords),d-=1;continue}for(let[v,A]of E.tagNamesByArgumentName){let U=(0,Ne.getOrThrowError)(I.argumentDataByName,v,`${p}.argumentDataByArgumentName`);(0,ge.isNodeDataInaccessible)(U)||t.tagNamesToExclude.isDisjointFrom(A)||((0,Ne.getValueOrDefault)(U.persistedDirectivesData.directivesByDirectiveName,ve.INACCESSIBLE,()=>[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(U.federatedCoords))}}d<1&&(l.persistedDirectivesData.directivesByDirectiveName.set(ve.INACCESSIBLE,[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(o))}}}}else if(t.tagNamesToInclude.size>0)for(let[o,c]of this.parentDefinitionDataByTypeName){if((0,ge.isNodeDataInaccessible)(c))continue;let l=this.parentTagDataByTypeName.get(o);if(!l){c.persistedDirectivesData.directivesByDirectiveName.set(ve.INACCESSIBLE,[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(o);continue}if(t.tagNamesToInclude.isDisjointFrom(l.tagNames)){if(l.childTagDataByChildName.size<1){c.persistedDirectivesData.directivesByDirectiveName.set(ve.INACCESSIBLE,[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(o);continue}switch(c.kind){case Re.Kind.SCALAR_TYPE_DEFINITION:case Re.Kind.UNION_TYPE_DEFINITION:continue;case Re.Kind.ENUM_TYPE_DEFINITION:this.handleChildTagInclusions(c,c.enumValueDataByName,l.childTagDataByChildName,t.tagNamesToInclude);break;case Re.Kind.INPUT_OBJECT_TYPE_DEFINITION:this.handleChildTagInclusions(c,c.inputValueDataByName,l.childTagDataByChildName,t.tagNamesToInclude);break;default:let d=c.fieldDataByName.size;for(let[p,E]of c.fieldDataByName){if((0,ge.isNodeDataInaccessible)(E)){d-=1;continue}let I=l.childTagDataByChildName.get(p);(!I||t.tagNamesToInclude.isDisjointFrom(I.tagNames))&&((0,Ne.getValueOrDefault)(E.persistedDirectivesData.directivesByDirectiveName,ve.INACCESSIBLE,()=>[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(E.federatedCoords),d-=1)}d<1&&(c.persistedDirectivesData.directivesByDirectiveName.set(ve.INACCESSIBLE,[(0,Ne.generateSimpleDirective)(ve.INACCESSIBLE)]),this.inaccessibleCoords.add(o))}}}this.subscriptionFilterDataByFieldPath.size>0&&this.validateSubscriptionFiltersAndGenerateConfiguration();for(let o of this.potentialPersistedDirectiveDefinitionDataByDirectiveName.values())(0,ge.addValidPersistedDirectiveDefinitionNodeByData)(this.routerDefinitions,o,this.persistedDirectiveDefinitionByDirectiveName,this.errors);let n=[];if(this.pushParentDefinitionDataToDocumentDefinitions(n),this.validateInterfaceImplementationsAndPushToDocumentDefinitions(n),this.validateQueryRootType(),this.errors.length>0)return{errors:this.errors,success:!1,warnings:this.warnings};let r={kind:Re.Kind.DOCUMENT,definitions:this.routerDefinitions},i=(0,Re.buildASTSchema)({kind:Re.Kind.DOCUMENT,definitions:this.clientDefinitions},{assumeValid:!0,assumeValidSDL:!0}),a=new Map;for(let{configurationDataByTypeName:o,directiveDefinitionByName:c,isVersionTwo:l,name:d,parentDefinitionDataByTypeName:p,schema:E,schemaNode:I}of this.internalSubgraphBySubgraphName.values())a.set(d,{configurationDataByTypeName:o,directiveDefinitionByName:c,isVersionTwo:l,parentDefinitionDataByTypeName:p,schema:E,schemaNode:I});for(let o of this.authorizationDataByParentTypeName.values())(0,Gr.upsertAuthorizationConfiguration)(this.fieldConfigurationByFieldCoords,o);return M({directiveDefinitionByName:this.directiveDefinitionByName,fieldConfigurations:Array.from(this.fieldConfigurationByFieldCoords.values()),federatedGraphAST:r,federatedGraphSchema:(0,Re.buildASTSchema)(r,{assumeValid:!0,assumeValidSDL:!0}),federatedGraphClientSchema:i,parentDefinitionDataByTypeName:this.parentDefinitionDataByTypeName,subgraphConfigBySubgraphName:a,success:!0,warnings:this.warnings},this.getClientSchemaObjectBoolean())}federateSubgraphsInternal(){return this.federateSubgraphData(),this.buildFederationResult()}};zE=new WeakSet,EV=function(){var r;let t=new Set,n=new Set;for(let i of this.referencedPersistedDirectiveNames){let a=hp.DIRECTIVE_DEFINITION_BY_NAME.get(i);if(!a)continue;let o=(r=xc.DEPENDENCIES_BY_DIRECTIVE_NAME.get(i))!=null?r:[];this.directiveDefinitionByName.set(i,a),xc.CLIENT_PERSISTED_DIRECTIVE_NAMES.has(i)&&(this.clientDefinitions.push(a),(0,Ne.addIterableToSet)({source:o,target:t})),this.routerDefinitions.push(a),(0,Ne.addIterableToSet)({source:o,target:n})}this.clientDefinitions.push(...t),this.routerDefinitions.push(...n)};qc.FederationFactory=HE;function sb({disableResolvabilityValidation:e,subgraphs:t}){if(t.length<1)return{errors:[Pe.minimumSubgraphRequirementError],success:!1,warnings:[]};let n=(0,ffe.batchNormalize)(t);if(!n.success)return{errors:n.errors,success:!1,warnings:n.warnings};let r=new Map,i=new Map;for(let[c,l]of n.internalSubgraphBySubgraphName)for(let[d,p]of l.entityInterfaces){let E=r.get(d);if(!E){r.set(d,(0,Gr.newEntityInterfaceFederationData)(p,c));continue}(0,Gr.upsertEntityInterfaceFederationData)(E,p,c)}let a=new Array,o=new Map;for(let[c,l]of r){let d=l.concreteTypeNames.size;for(let[p,E]of l.subgraphDataByTypeName){let I=(0,Ne.getValueOrDefault)(o,p,()=>new Set);if((0,Ne.addIterableToSet)({source:E.concreteTypeNames,target:I}),!E.isInterfaceObject){E.resolvable&&E.concreteTypeNames.size!==d&&(0,Ne.getValueOrDefault)(i,c,()=>new Array).push({subgraphName:p,definedConcreteTypeNames:new Set(E.concreteTypeNames),requiredConcreteTypeNames:new Set(l.concreteTypeNames)});continue}(0,Ne.addIterableToSet)({source:l.concreteTypeNames,target:I});let{parentDefinitionDataByTypeName:v}=(0,Ne.getOrThrowError)(n.internalSubgraphBySubgraphName,p,"internalSubgraphBySubgraphName"),A=[];for(let U of l.concreteTypeNames)v.has(U)&&A.push(U);A.length>0&&a.push((0,Pe.invalidInterfaceObjectImplementationDefinitionsError)(c,p,A))}}for(let[c,l]of i){let d=new Array;for(let p of l){let E=o.get(p.subgraphName);if(!E){d.push(p);continue}let I=p.requiredConcreteTypeNames.intersection(E);p.requiredConcreteTypeNames.size!==I.size&&(p.definedConcreteTypeNames=I,d.push(p))}if(d.length>0){i.set(c,d);continue}i.delete(c)}return i.size>0&&a.push((0,Pe.undefinedEntityInterfaceImplementationsError)(i,r)),a.length>0?{errors:a,success:!1,warnings:n.warnings}:{federationFactory:new HE({authorizationDataByParentTypeName:n.authorizationDataByParentTypeName,concreteTypeNamesByAbstractTypeName:n.concreteTypeNamesByAbstractTypeName,disableResolvabilityValidation:e,entityDataByTypeName:n.entityDataByTypeName,entityInterfaceFederationDataByTypeName:r,fieldCoordsByNamedTypeName:n.fieldCoordsByNamedTypeName,internalSubgraphBySubgraphName:n.internalSubgraphBySubgraphName,internalGraph:n.internalGraph,warnings:n.warnings}),success:!0,warnings:n.warnings}}function Tfe({disableResolvabilityValidation:e,subgraphs:t}){let n=sb({subgraphs:t,disableResolvabilityValidation:e});return n.success?n.federationFactory.federateSubgraphsInternal():{errors:n.errors,success:!1,warnings:n.warnings}}function Efe({subgraphs:e,tagOptionsByContractName:t,disableResolvabilityValidation:n}){let r=sb({subgraphs:e,disableResolvabilityValidation:n});if(!r.success)return{errors:r.errors,success:!1,warnings:r.warnings};r.federationFactory.federateSubgraphData();let i=[(0,TV.cloneDeep)(r.federationFactory)],a=r.federationFactory.buildFederationResult();if(!a.success)return{errors:a.errors,success:!1,warnings:a.warnings};let o=t.size-1,c=new Map,l=0;for(let[d,p]of t){l!==o&&i.push((0,TV.cloneDeep)(i[l]));let E=i[l].buildFederationContractResult(p);c.set(d,E),l++}return Q(M({},a),{federationResultByContractName:c})}function hfe({contractTagOptions:e,disableResolvabilityValidation:t,subgraphs:n}){let r=sb({subgraphs:n,disableResolvabilityValidation:t});return r.success?(r.federationFactory.federateSubgraphData(),r.federationFactory.buildFederationContractResult(e)):{errors:r.errors,success:!1,warnings:r.warnings}}});var WE=w(Cs=>{"use strict";m();T();N();Object.defineProperty(Cs,"__esModule",{value:!0});Cs.LATEST_ROUTER_COMPATIBILITY_VERSION=Cs.ROUTER_COMPATIBILITY_VERSIONS=Cs.ROUTER_COMPATIBILITY_VERSION_ONE=void 0;Cs.ROUTER_COMPATIBILITY_VERSION_ONE="1";Cs.ROUTER_COMPATIBILITY_VERSIONS=new Set([Cs.ROUTER_COMPATIBILITY_VERSION_ONE]);Cs.LATEST_ROUTER_COMPATIBILITY_VERSION="1"});var yV=w(yp=>{"use strict";m();T();N();Object.defineProperty(yp,"__esModule",{value:!0});yp.federateSubgraphs=yfe;yp.federateSubgraphsWithContracts=Ife;yp.federateSubgraphsContract=gfe;var ob=hV(),ub=WE();function yfe({disableResolvabilityValidation:e,subgraphs:t,version:n=ub.ROUTER_COMPATIBILITY_VERSION_ONE}){switch(n){default:return(0,ob.federateSubgraphs)({disableResolvabilityValidation:e,subgraphs:t})}}function Ife({disableResolvabilityValidation:e,subgraphs:t,tagOptionsByContractName:n,version:r=ub.ROUTER_COMPATIBILITY_VERSION_ONE}){switch(r){default:return(0,ob.federateSubgraphsWithContracts)({disableResolvabilityValidation:e,subgraphs:t,tagOptionsByContractName:n})}}function gfe({contractTagOptions:e,disableResolvabilityValidation:t,subgraphs:n,version:r=ub.ROUTER_COMPATIBILITY_VERSION_ONE}){switch(r){default:return(0,ob.federateSubgraphsContract)({disableResolvabilityValidation:t,subgraphs:n,contractTagOptions:e})}}});var gV=w(IV=>{"use strict";m();T();N();Object.defineProperty(IV,"__esModule",{value:!0})});var _V=w(Ip=>{"use strict";m();T();N();Object.defineProperty(Ip,"__esModule",{value:!0});Ip.normalizeSubgraphFromString=_fe;Ip.normalizeSubgraph=vfe;Ip.batchNormalize=Ofe;var cb=nb(),lb=WE();function _fe(e,t=!0,n=lb.ROUTER_COMPATIBILITY_VERSION_ONE){switch(n){default:return(0,cb.normalizeSubgraphFromString)(e,t)}}function vfe(e,t,n,r=lb.ROUTER_COMPATIBILITY_VERSION_ONE){switch(r){default:return(0,cb.normalizeSubgraph)(e,t,n)}}function Ofe(e,t=lb.ROUTER_COMPATIBILITY_VERSION_ONE){switch(t){default:return(0,cb.batchNormalize)(e)}}});var OV=w(vV=>{"use strict";m();T();N();Object.defineProperty(vV,"__esModule",{value:!0})});var DV=w(SV=>{"use strict";m();T();N();Object.defineProperty(SV,"__esModule",{value:!0})});var AV=w(bV=>{"use strict";m();T();N();Object.defineProperty(bV,"__esModule",{value:!0})});var PV=w(RV=>{"use strict";m();T();N();Object.defineProperty(RV,"__esModule",{value:!0})});var wV=w(FV=>{"use strict";m();T();N();Object.defineProperty(FV,"__esModule",{value:!0})});var CV=w(LV=>{"use strict";m();T();N();Object.defineProperty(LV,"__esModule",{value:!0})});var BV=w(XE=>{"use strict";m();T();N();Object.defineProperty(XE,"__esModule",{value:!0});XE.COMPOSITION_VERSION=void 0;XE.COMPOSITION_VERSION="{{$COMPOSITION__VERSION}}"});var kV=w(UV=>{"use strict";m();T();N();Object.defineProperty(UV,"__esModule",{value:!0})});var xV=w(MV=>{"use strict";m();T();N();Object.defineProperty(MV,"__esModule",{value:!0})});var VV=w(qV=>{"use strict";m();T();N();Object.defineProperty(qV,"__esModule",{value:!0})});var KV=w(jV=>{"use strict";m();T();N();Object.defineProperty(jV,"__esModule",{value:!0})});var ZE=w(Xe=>{"use strict";m();T();N();var Sfe=Xe&&Xe.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),lt=Xe&&Xe.__exportStar||function(e,t){for(var n in e)n!=="default"&&!Object.prototype.hasOwnProperty.call(t,n)&&Sfe(t,e,n)};Object.defineProperty(Xe,"__esModule",{value:!0});lt(Ar(),Xe);lt(Cv(),Xe);lt(qi(),Xe);lt($M(),Xe);lt(yV(),Xe);lt(gV(),Xe);lt(_V(),Xe);lt(OV(),Xe);lt(ZD(),Xe);lt(jD(),Xe);lt(UE(),Xe);lt(DV(),Xe);lt(AV(),Xe);lt(YD(),Xe);lt(WE(),Xe);lt(PV(),Xe);lt(eb(),Xe);lt(yu(),Xe);lt(Uf(),Xe);lt(Bl(),Xe);lt(wV(),Xe);lt(CV(),Xe);lt(BV(),Xe);lt(kV(),Xe);lt(sr(),Xe);lt(xV(),Xe);lt(Rr(),Xe);lt(LD(),Xe);lt(Iu(),Xe);lt(kf(),Xe);lt(sE(),Xe);lt(oE(),Xe);lt(nd(),Xe);lt(aT(),Xe);lt(sT(),Xe);lt(ab(),Xe);lt(VV(),Xe);lt(AD(),Xe);lt(dp(),Xe);lt(KV(),Xe);lt(kD(),Xe);lt(QE(),Xe);lt(FD(),Xe);lt(lp(),Xe);lt(fp(),Xe)});var hpe={};Fm(hpe,{buildRouterConfiguration:()=>Epe,federateSubgraphs:()=>Tpe});m();T();N();var Yc=ys(ZE());m();T();N();m();T();N();function db(e){if(!e)return e;if(!URL.canParse(e))throw new Error("Invalid URL");let t=e.indexOf("?"),n=e.indexOf("#"),r=e;return t>0?r=r.slice(0,n>0?Math.min(t,n):t):n>0&&(r=r.slice(0,n)),r}m();T();N();m();T();N();var GV={};m();T();N();function $V(e){return e!=null}m();T();N();m();T();N();var zV=ys(Oe(),1);m();T();N();var QV;if(typeof AggregateError=="undefined"){class e extends Error{constructor(n,r=""){super(r),this.errors=n,this.name="AggregateError",Error.captureStackTrace(this,e)}}QV=function(t,n){return new e(t,n)}}else QV=AggregateError;function YV(e){return"errors"in e&&Array.isArray(e.errors)}var WV=3;function XV(e){return eh(e,[])}function eh(e,t){switch(typeof e){case"string":return JSON.stringify(e);case"function":return e.name?`[function ${e.name}]`:"[function]";case"object":return Dfe(e,t);default:return String(e)}}function JV(e){return e instanceof zV.GraphQLError?e.toString():`${e.name}: ${e.message}; ${e.stack}`}function Dfe(e,t){if(e===null)return"null";if(e instanceof Error)return YV(e)?JV(e)+` `+HV(e.errors,t):JV(e);if(t.includes(e))return"[Circular]";let n=[...t,e];if(bfe(e)){let r=e.toJSON();if(r!==e)return typeof r=="string"?r:eh(r,n)}else if(Array.isArray(e))return HV(e,n);return Afe(e,n)}function bfe(e){return typeof e.toJSON=="function"}function Afe(e,t){let n=Object.entries(e);return n.length===0?"{}":t.length>WV?"["+Rfe(e)+"]":"{ "+n.map(([i,a])=>i+": "+eh(a,t)).join(", ")+" }"}function HV(e,t){if(e.length===0)return"[]";if(t.length>WV)return"[Array]";let n=e.length,r=[];for(let i=0;in==null?n:n[r],e==null?void 0:e.extensions)}m();T();N();var Fe=ys(Oe(),1);m();T();N();var is=ys(Oe(),1);function as(e){if((0,is.isNonNullType)(e)){let t=as(e.ofType);if(t.kind===is.Kind.NON_NULL_TYPE)throw new Error(`Invalid type node ${XV(e)}. Inner type of non-null type cannot be a non-null type.`);return{kind:is.Kind.NON_NULL_TYPE,type:t}}else if((0,is.isListType)(e))return{kind:is.Kind.LIST_TYPE,type:as(e.ofType)};return{kind:is.Kind.NAMED_TYPE,name:{kind:is.Kind.NAME,value:e.name}}}m();T();N();var ss=ys(Oe(),1);function nh(e){if(e===null)return{kind:ss.Kind.NULL};if(e===void 0)return null;if(Array.isArray(e)){let t=[];for(let n of e){let r=nh(n);r!=null&&t.push(r)}return{kind:ss.Kind.LIST,values:t}}if(typeof e=="object"){let t=[];for(let n in e){let r=e[n],i=nh(r);i&&t.push({kind:ss.Kind.OBJECT_FIELD,name:{kind:ss.Kind.NAME,value:n},value:i})}return{kind:ss.Kind.OBJECT,fields:t}}if(typeof e=="boolean")return{kind:ss.Kind.BOOLEAN,value:e};if(typeof e=="number"&&isFinite(e)){let t=String(e);return Pfe.test(t)?{kind:ss.Kind.INT,value:t}:{kind:ss.Kind.FLOAT,value:t}}if(typeof e=="string")return{kind:ss.Kind.STRING,value:e};throw new TypeError(`Cannot convert value to AST: ${e}.`)}var Pfe=/^-?(?:0|[1-9][0-9]*)$/;m();T();N();m();T();N();function rh(e){let t=new WeakMap;return function(r){let i=t.get(r);if(i===void 0){let a=e(r);return t.set(r,a),a}return i}}var jxe=rh(function(t){let n=Ffe(t);return new Set([...n].map(r=>r.name))}),Ffe=rh(function(t){let n=fb(t);return new Set(n.values())}),fb=rh(function(t){let n=new Map,r=t.getQueryType();r&&n.set("query",r);let i=t.getMutationType();i&&n.set("mutation",i);let a=t.getSubscriptionType();return a&&n.set("subscription",a),n});function wfe(e,t={}){let n=t.pathToDirectivesInExtensions,r=e.getTypeMap(),i=Lfe(e,n),a=i!=null?[i]:[],o=e.getDirectives();for(let c of o)(0,Fe.isSpecifiedDirective)(c)||a.push(Cfe(c,e,n));for(let c in r){let l=r[c],d=(0,Fe.isSpecifiedScalarType)(l),p=(0,Fe.isIntrospectionType)(l);if(!(d||p))if((0,Fe.isObjectType)(l))a.push(Bfe(l,e,n));else if((0,Fe.isInterfaceType)(l))a.push(Ufe(l,e,n));else if((0,Fe.isUnionType)(l))a.push(kfe(l,e,n));else if((0,Fe.isInputObjectType)(l))a.push(Mfe(l,e,n));else if((0,Fe.isEnumType)(l))a.push(xfe(l,e,n));else if((0,Fe.isScalarType)(l))a.push(qfe(l,e,n));else throw new Error(`Unknown type ${l}.`)}return{kind:Fe.Kind.DOCUMENT,definitions:a}}function ZV(e,t={}){let n=wfe(e,t);return(0,Fe.print)(n)}function Lfe(e,t){var n,r;let i=new Map([["query",void 0],["mutation",void 0],["subscription",void 0]]),a=[];if(e.astNode!=null&&a.push(e.astNode),e.extensionASTNodes!=null)for(let p of e.extensionASTNodes)a.push(p);for(let p of a)if(p.operationTypes)for(let E of p.operationTypes)i.set(E.operation,E);let o=fb(e);for(let[p,E]of i){let I=o.get(p);if(I!=null){let v=as(I);E!=null?E.type=v:i.set(p,{kind:Fe.Kind.OPERATION_TYPE_DEFINITION,operation:p,type:v})}}let c=[...i.values()].filter($V),l=ld(e,e,t);if(!c.length&&!l.length)return null;let d={kind:c!=null?Fe.Kind.SCHEMA_DEFINITION:Fe.Kind.SCHEMA_EXTENSION,operationTypes:c,directives:l};return d.description=((r=(n=e.astNode)===null||n===void 0?void 0:n.description)!==null&&r!==void 0?r:e.description!=null)?{kind:Fe.Kind.STRING,value:e.description,block:!0}:void 0,d}function Cfe(e,t,n){var r,i,a,o;return{kind:Fe.Kind.DIRECTIVE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:Fe.Kind.STRING,value:e.description}:void 0,name:{kind:Fe.Kind.NAME,value:e.name},arguments:(a=e.args)===null||a===void 0?void 0:a.map(c=>ej(c,t,n)),repeatable:e.isRepeatable,locations:((o=e.locations)===null||o===void 0?void 0:o.map(c=>({kind:Fe.Kind.NAME,value:c})))||[]}}function ld(e,t,n){let r=th(e,n),i=[];e.astNode!=null&&i.push(e.astNode),"extensionASTNodes"in e&&e.extensionASTNodes!=null&&(i=i.concat(e.extensionASTNodes));let a;if(r!=null)a=pb(t,r);else{a=[];for(let o of i)o.directives&&a.push(...o.directives)}return a}function ah(e,t,n){var r,i;let a=[],o=null,c=th(e,n),l;return c!=null?l=pb(t,c):l=(r=e.astNode)===null||r===void 0?void 0:r.directives,l!=null&&(a=l.filter(d=>d.name.value!=="deprecated"),e.deprecationReason!=null&&(o=(i=l.filter(d=>d.name.value==="deprecated"))===null||i===void 0?void 0:i[0])),e.deprecationReason!=null&&o==null&&(o=Kfe(e.deprecationReason)),o==null?a:[o].concat(a)}function ej(e,t,n){var r,i,a;return{kind:Fe.Kind.INPUT_VALUE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:Fe.Kind.STRING,value:e.description,block:!0}:void 0,name:{kind:Fe.Kind.NAME,value:e.name},type:as(e.type),defaultValue:e.defaultValue!==void 0&&(a=(0,Fe.astFromValue)(e.defaultValue,e.type))!==null&&a!==void 0?a:void 0,directives:ah(e,t,n)}}function Bfe(e,t,n){var r,i;return{kind:Fe.Kind.OBJECT_TYPE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:Fe.Kind.STRING,value:e.description,block:!0}:void 0,name:{kind:Fe.Kind.NAME,value:e.name},fields:Object.values(e.getFields()).map(a=>tj(a,t,n)),interfaces:Object.values(e.getInterfaces()).map(a=>as(a)),directives:ld(e,t,n)}}function Ufe(e,t,n){var r,i;let a={kind:Fe.Kind.INTERFACE_TYPE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:Fe.Kind.STRING,value:e.description,block:!0}:void 0,name:{kind:Fe.Kind.NAME,value:e.name},fields:Object.values(e.getFields()).map(o=>tj(o,t,n)),directives:ld(e,t,n)};return"getInterfaces"in e&&(a.interfaces=Object.values(e.getInterfaces()).map(o=>as(o))),a}function kfe(e,t,n){var r,i;return{kind:Fe.Kind.UNION_TYPE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:Fe.Kind.STRING,value:e.description,block:!0}:void 0,name:{kind:Fe.Kind.NAME,value:e.name},directives:ld(e,t,n),types:e.getTypes().map(a=>as(a))}}function Mfe(e,t,n){var r,i;return{kind:Fe.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:Fe.Kind.STRING,value:e.description,block:!0}:void 0,name:{kind:Fe.Kind.NAME,value:e.name},fields:Object.values(e.getFields()).map(a=>Vfe(a,t,n)),directives:ld(e,t,n)}}function xfe(e,t,n){var r,i;return{kind:Fe.Kind.ENUM_TYPE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:Fe.Kind.STRING,value:e.description,block:!0}:void 0,name:{kind:Fe.Kind.NAME,value:e.name},values:Object.values(e.getValues()).map(a=>jfe(a,t,n)),directives:ld(e,t,n)}}function qfe(e,t,n){var r,i,a;let o=th(e,n),c=o?pb(t,o):((r=e.astNode)===null||r===void 0?void 0:r.directives)||[],l=e.specifiedByUrl||e.specifiedByURL;if(l&&!c.some(d=>d.name.value==="specifiedBy")){let d={url:l};c.push(ih("specifiedBy",d))}return{kind:Fe.Kind.SCALAR_TYPE_DEFINITION,description:(a=(i=e.astNode)===null||i===void 0?void 0:i.description)!==null&&a!==void 0?a:e.description?{kind:Fe.Kind.STRING,value:e.description,block:!0}:void 0,name:{kind:Fe.Kind.NAME,value:e.name},directives:c}}function tj(e,t,n){var r,i;return{kind:Fe.Kind.FIELD_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:Fe.Kind.STRING,value:e.description,block:!0}:void 0,name:{kind:Fe.Kind.NAME,value:e.name},arguments:e.args.map(a=>ej(a,t,n)),type:as(e.type),directives:ah(e,t,n)}}function Vfe(e,t,n){var r,i,a;return{kind:Fe.Kind.INPUT_VALUE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:Fe.Kind.STRING,value:e.description,block:!0}:void 0,name:{kind:Fe.Kind.NAME,value:e.name},type:as(e.type),directives:ah(e,t,n),defaultValue:(a=(0,Fe.astFromValue)(e.defaultValue,e.type))!==null&&a!==void 0?a:void 0}}function jfe(e,t,n){var r,i;return{kind:Fe.Kind.ENUM_VALUE_DEFINITION,description:(i=(r=e.astNode)===null||r===void 0?void 0:r.description)!==null&&i!==void 0?i:e.description?{kind:Fe.Kind.STRING,value:e.description,block:!0}:void 0,name:{kind:Fe.Kind.NAME,value:e.name},directives:ah(e,t,n)}}function Kfe(e){return ih("deprecated",{reason:e},Fe.GraphQLDeprecatedDirective)}function ih(e,t,n){let r=[];if(n!=null)for(let i of n.args){let a=i.name,o=t[a];if(o!==void 0){let c=(0,Fe.astFromValue)(o,i.type);c&&r.push({kind:Fe.Kind.ARGUMENT,name:{kind:Fe.Kind.NAME,value:a},value:c})}}else for(let i in t){let a=t[i],o=nh(a);o&&r.push({kind:Fe.Kind.ARGUMENT,name:{kind:Fe.Kind.NAME,value:i},value:o})}return{kind:Fe.Kind.DIRECTIVE,name:{kind:Fe.Kind.NAME,value:e},arguments:r}}function pb(e,t){let n=[];for(let r in t){let i=t[r],a=e==null?void 0:e.getDirective(r);if(Array.isArray(i))for(let o of i)n.push(ih(r,o,a));else n.push(ih(r,i,a))}return n}var yd=ys(ZE(),1);m();T();N();m();T();N();m();T();N();m();T();N();m();T();N();m();T();N();function pn(e,t){if(!e)throw new Error(t)}var Gfe=34028234663852886e22,$fe=-34028234663852886e22,Qfe=4294967295,Yfe=2147483647,Jfe=-2147483648;function dd(e){if(typeof e!="number")throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>Yfe||eQfe||e<0)throw new Error("invalid uint 32: "+e)}function sh(e){if(typeof e!="number")throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>Gfe||e<$fe))throw new Error("invalid float 32: "+e)}var nj=Symbol("@bufbuild/protobuf/enum-type");function rj(e){let t=e[nj];return pn(t,"missing enum type on enum object"),t}function mb(e,t,n,r){e[nj]=Nb(t,n.map(i=>({no:i.no,name:i.name,localName:e[i.no]})),r)}function Nb(e,t,n){let r=Object.create(null),i=Object.create(null),a=[];for(let o of t){let c=aj(o);a.push(c),r[o.name]=c,i[o.no]=c}return{typeName:e,values:a,findName(o){return r[o]},findNumber(o){return i[o]}}}function ij(e,t,n){let r={};for(let i of t){let a=aj(i);r[a.localName]=a.no,r[a.no]=a.localName}return mb(r,e,t,n),r}function aj(e){return"localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}m();T();N();m();T();N();var we=class{equals(t){return this.getType().runtime.util.equals(this.getType(),this,t)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(t,n){let r=this.getType(),i=r.runtime.bin,a=i.makeReadOptions(n);return i.readMessage(this,a.readerFactory(t),t.byteLength,a),this}fromJson(t,n){let r=this.getType(),i=r.runtime.json,a=i.makeReadOptions(n);return i.readMessage(r,t,a,this),this}fromJsonString(t,n){let r;try{r=JSON.parse(t)}catch(i){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${i instanceof Error?i.message:String(i)}`)}return this.fromJson(r,n)}toBinary(t){let n=this.getType(),r=n.runtime.bin,i=r.makeWriteOptions(t),a=i.writerFactory();return r.writeMessage(this,a,i),a.finish()}toJson(t){let n=this.getType(),r=n.runtime.json,i=r.makeWriteOptions(t);return r.writeMessage(this,i)}toJsonString(t){var n;let r=this.toJson(t);return JSON.stringify(r,null,(n=t==null?void 0:t.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}};function sj(e,t,n,r){var i;let a=(i=r==null?void 0:r.localName)!==null&&i!==void 0?i:t.substring(t.lastIndexOf(".")+1),o={[a]:function(c){e.util.initFields(this),e.util.initPartial(c,this)}}[a];return Object.setPrototypeOf(o.prototype,new we),Object.assign(o,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary(c,l){return new o().fromBinary(c,l)},fromJson(c,l){return new o().fromJson(c,l)},fromJsonString(c,l){return new o().fromJsonString(c,l)},equals(c,l){return e.util.equals(o,c,l)}}),o}m();T();N();m();T();N();m();T();N();m();T();N();function uj(){let e=0,t=0;for(let r=0;r<28;r+=7){let i=this.buf[this.pos++];if(e|=(i&127)<>4,!(n&128))return this.assertBounds(),[e,t];for(let r=3;r<=31;r+=7){let i=this.buf[this.pos++];if(t|=(i&127)<>>a,c=!(!(o>>>7)&&t==0),l=(c?o|128:o)&255;if(n.push(l),!c)return}let r=e>>>28&15|(t&7)<<4,i=!!(t>>3);if(n.push((i?r|128:r)&255),!!i){for(let a=3;a<31;a=a+7){let o=t>>>a,c=!!(o>>>7),l=(c?o|128:o)&255;if(n.push(l),!c)return}n.push(t>>>31&1)}}var oh=4294967296;function Tb(e){let t=e[0]==="-";t&&(e=e.slice(1));let n=1e6,r=0,i=0;function a(o,c){let l=Number(e.slice(o,c));i*=n,r=r*n+l,r>=oh&&(i=i+(r/oh|0),r=r%oh)}return a(-24,-18),a(-18,-12),a(-12,-6),a(-6),t?lj(r,i):hb(r,i)}function cj(e,t){let n=hb(e,t),r=n.hi&2147483648;r&&(n=lj(n.lo,n.hi));let i=Eb(n.lo,n.hi);return r?"-"+i:i}function Eb(e,t){if({lo:e,hi:t}=Hfe(e,t),t<=2097151)return String(oh*t+e);let n=e&16777215,r=(e>>>24|t<<8)&16777215,i=t>>16&65535,a=n+r*6777216+i*6710656,o=r+i*8147497,c=i*2,l=1e7;return a>=l&&(o+=Math.floor(a/l),a%=l),o>=l&&(c+=Math.floor(o/l),o%=l),c.toString()+oj(o)+oj(a)}function Hfe(e,t){return{lo:e>>>0,hi:t>>>0}}function hb(e,t){return{lo:e|0,hi:t|0}}function lj(e,t){return t=~t,e?e=~e+1:t+=1,hb(e,t)}var oj=e=>{let t=String(e);return"0000000".slice(t.length)+t};function yb(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e=e>>>7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e=e>>7;t.push(1)}}function dj(){let e=this.buf[this.pos++],t=e&127;if(!(e&128))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let n=5;e&128&&n<10;n++)e=this.buf[this.pos++];if(e&128)throw new Error("invalid varint");return this.assertBounds(),t>>>0}function zfe(){let e=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof e.getBigInt64=="function"&&typeof e.getBigUint64=="function"&&typeof e.setBigInt64=="function"&&typeof e.setBigUint64=="function"&&(typeof S!="object"||typeof S.env!="object"||S.env.BUF_BIGINT_DISABLE!=="1")){let i=BigInt("-9223372036854775808"),a=BigInt("9223372036854775807"),o=BigInt("0"),c=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(l){let d=typeof l=="bigint"?l:BigInt(l);if(d>a||dc||dpn(/^-?[0-9]+$/.test(i),`int64 invalid: ${i}`),r=i=>pn(/^[0-9]+$/.test(i),`uint64 invalid: ${i}`);return{zero:"0",supported:!1,parse(i){return typeof i!="string"&&(i=i.toString()),n(i),i},uParse(i){return typeof i!="string"&&(i=i.toString()),r(i),i},enc(i){return typeof i!="string"&&(i=i.toString()),n(i),Tb(i)},uEnc(i){return typeof i!="string"&&(i=i.toString()),r(i),Tb(i)},dec(i,a){return cj(i,a)},uDec(i,a){return Eb(i,a)}}}var Qn=zfe();m();T();N();var fe;(function(e){e[e.DOUBLE=1]="DOUBLE",e[e.FLOAT=2]="FLOAT",e[e.INT64=3]="INT64",e[e.UINT64=4]="UINT64",e[e.INT32=5]="INT32",e[e.FIXED64=6]="FIXED64",e[e.FIXED32=7]="FIXED32",e[e.BOOL=8]="BOOL",e[e.STRING=9]="STRING",e[e.BYTES=12]="BYTES",e[e.UINT32=13]="UINT32",e[e.SFIXED32=15]="SFIXED32",e[e.SFIXED64=16]="SFIXED64",e[e.SINT32=17]="SINT32",e[e.SINT64=18]="SINT64"})(fe||(fe={}));var ba;(function(e){e[e.BIGINT=0]="BIGINT",e[e.STRING=1]="STRING"})(ba||(ba={}));function Bs(e,t,n){if(t===n)return!0;if(e==fe.BYTES){if(!(t instanceof Uint8Array)||!(n instanceof Uint8Array)||t.length!==n.length)return!1;for(let r=0;r>>0)}raw(t){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(t),this}uint32(t){for(gp(t);t>127;)this.buf.push(t&127|128),t=t>>>7;return this.buf.push(t),this}int32(t){return dd(t),yb(t,this.buf),this}bool(t){return this.buf.push(t?1:0),this}bytes(t){return this.uint32(t.byteLength),this.raw(t)}string(t){let n=this.textEncoder.encode(t);return this.uint32(n.byteLength),this.raw(n)}float(t){sh(t);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,t,!0),this.raw(n)}double(t){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,t,!0),this.raw(n)}fixed32(t){gp(t);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,t,!0),this.raw(n)}sfixed32(t){dd(t);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,t,!0),this.raw(n)}sint32(t){return dd(t),t=(t<<1^t>>31)>>>0,yb(t,this.buf),this}sfixed64(t){let n=new Uint8Array(8),r=new DataView(n.buffer),i=Qn.enc(t);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}fixed64(t){let n=new Uint8Array(8),r=new DataView(n.buffer),i=Qn.uEnc(t);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}int64(t){let n=Qn.enc(t);return uh(n.lo,n.hi,this.buf),this}sint64(t){let n=Qn.enc(t),r=n.hi>>31,i=n.lo<<1^r,a=(n.hi<<1|n.lo>>>31)^r;return uh(i,a,this.buf),this}uint64(t){let n=Qn.uEnc(t);return uh(n.lo,n.hi,this.buf),this}},dh=class{constructor(t,n){this.varint64=uj,this.uint32=dj,this.buf=t,this.len=t.length,this.pos=0,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.textDecoder=n!=null?n:new TextDecoder}tag(){let t=this.uint32(),n=t>>>3,r=t&7;if(n<=0||r<0||r>5)throw new Error("illegal tag: field no "+n+" wire type "+r);return[n,r]}skip(t){let n=this.pos;switch(t){case Mn.Varint:for(;this.buf[this.pos++]&128;);break;case Mn.Bit64:this.pos+=4;case Mn.Bit32:this.pos+=4;break;case Mn.LengthDelimited:let r=this.uint32();this.pos+=r;break;case Mn.StartGroup:let i;for(;(i=this.tag()[1])!==Mn.EndGroup;)this.skip(i);break;default:throw new Error("cant skip wire type "+t)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let t=this.uint32();return t>>>1^-(t&1)}int64(){return Qn.dec(...this.varint64())}uint64(){return Qn.uDec(...this.varint64())}sint64(){let[t,n]=this.varint64(),r=-(t&1);return t=(t>>>1|(n&1)<<31)^r,n=n>>>1^r,Qn.dec(t,n)}bool(){let[t,n]=this.varint64();return t!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Qn.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Qn.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let t=this.uint32(),n=this.pos;return this.pos+=t,this.assertBounds(),this.buf.subarray(n,n+t)}string(){return this.textDecoder.decode(this.bytes())}};function fj(e,t,n,r){let i;return{typeName:t,extendee:n,get field(){if(!i){let a=typeof r=="function"?r():r;a.name=t.split(".").pop(),a.jsonName=`[${t}]`,i=e.util.newFieldList([a]).list()[0]}return i},runtime:e}}function fh(e){let t=e.field.localName,n=Object.create(null);return n[t]=Wfe(e),[n,()=>n[t]]}function Wfe(e){let t=e.field;if(t.repeated)return[];if(t.default!==void 0)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return Aa(t.T,t.L);case"message":let n=t.T,r=new n;return n.fieldWrapper?n.fieldWrapper.unwrapField(r):r;case"map":throw"map fields are not allowed to be extensions"}}function pj(e,t){if(!t.repeated&&(t.kind=="enum"||t.kind=="scalar")){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter(n=>n.no===t.no)}m();T();N();m();T();N();var Us="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),ph=[];for(let e=0;e>4,o=a,i=2;break;case 2:n[r++]=(o&15)<<4|(a&60)>>2,o=a,i=3;break;case 3:n[r++]=(o&3)<<6|a,i=0;break}}if(i==1)throw Error("invalid base64 string.");return n.subarray(0,r)},enc(e){let t="",n=0,r,i=0;for(let a=0;a>2],i=(r&3)<<4,n=1;break;case 1:t+=Us[i|r>>4],i=(r&15)<<2,n=2;break;case 2:t+=Us[i|r>>6],t+=Us[r&63],n=0;break}return n&&(t+=Us[i],t+="=",n==1&&(t+="=")),t}};m();T();N();function mj(e,t,n){Tj(t,e);let r=t.runtime.bin.makeReadOptions(n),i=pj(e.getType().runtime.bin.listUnknownFields(e),t.field),[a,o]=fh(t);for(let c of i)t.runtime.bin.readField(a,r.readerFactory(c.data),t.field,c.wireType,r);return o()}function Nj(e,t,n,r){Tj(t,e);let i=t.runtime.bin.makeReadOptions(r),a=t.runtime.bin.makeWriteOptions(r);if(gb(e,t)){let d=e.getType().runtime.bin.listUnknownFields(e).filter(p=>p.no!=t.field.no);e.getType().runtime.bin.discardUnknownFields(e);for(let p of d)e.getType().runtime.bin.onUnknownField(e,p.no,p.wireType,p.data)}let o=a.writerFactory(),c=t.field;!c.opt&&!c.repeated&&(c.kind=="enum"||c.kind=="scalar")&&(c=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(c,n,o,a);let l=i.readerFactory(o.finish());for(;l.posr.no==t.field.no)}function Tj(e,t){pn(e.extendee.typeName==t.getType().typeName,`extension ${e.typeName} can only be applied to message ${e.extendee.typeName}`)}m();T();N();function mh(e,t){let n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?t[n]!==void 0:e.kind=="enum"?t[n]!==e.T.values[0].no:!ch(e.T,t[n]);case"message":return t[n]!==void 0;case"map":return Object.keys(t[n]).length>0}}function _b(e,t){let n=e.localName,r=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[n]={};break;case"enum":t[n]=r?e.T.values[0].no:void 0;break;case"scalar":t[n]=r?Aa(e.T,e.L):void 0;break;case"message":t[n]=void 0;break}}m();T();N();m();T();N();function Ra(e,t){if(e===null||typeof e!="object"||!Object.getOwnPropertyNames(we.prototype).every(r=>r in e&&typeof e[r]=="function"))return!1;let n=e.getType();return n===null||typeof n!="function"||!("typeName"in n)||typeof n.typeName!="string"?!1:t===void 0?!0:n.typeName==t.typeName}function Nh(e,t){return Ra(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}var g1e={"google.protobuf.DoubleValue":fe.DOUBLE,"google.protobuf.FloatValue":fe.FLOAT,"google.protobuf.Int64Value":fe.INT64,"google.protobuf.UInt64Value":fe.UINT64,"google.protobuf.Int32Value":fe.INT32,"google.protobuf.UInt32Value":fe.UINT32,"google.protobuf.BoolValue":fe.BOOL,"google.protobuf.StringValue":fe.STRING,"google.protobuf.BytesValue":fe.BYTES};var Ej={ignoreUnknownFields:!1},hj={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function Xfe(e){return e?Object.assign(Object.assign({},Ej),e):Ej}function Zfe(e){return e?Object.assign(Object.assign({},hj),e):hj}var hh=Symbol(),Th=Symbol();function gj(){return{makeReadOptions:Xfe,makeWriteOptions:Zfe,readMessage(e,t,n,r){if(t==null||Array.isArray(t)||typeof t!="object")throw new Error(`cannot decode message ${e.typeName} from JSON: ${os(t)}`);r=r!=null?r:new e;let i=new Map,a=n.typeRegistry;for(let[o,c]of Object.entries(t)){let l=e.fields.findJsonName(o);if(l){if(l.oneof){if(c===null&&l.kind=="scalar")continue;let d=i.get(l.oneof);if(d!==void 0)throw new Error(`cannot decode message ${e.typeName} from JSON: multiple keys for oneof "${l.oneof.name}" present: "${d}", "${o}"`);i.set(l.oneof,o)}yj(r,c,l,n,e)}else{let d=!1;if(a!=null&&a.findExtension&&o.startsWith("[")&&o.endsWith("]")){let p=a.findExtension(o.substring(1,o.length-1));if(p&&p.extendee.typeName==e.typeName){d=!0;let[E,I]=fh(p);yj(E,c,p.field,n,p),Nj(r,p,I(),n)}}if(!d&&!n.ignoreUnknownFields)throw new Error(`cannot decode message ${e.typeName} from JSON: key "${o}" is unknown`)}}return r},writeMessage(e,t){let n=e.getType(),r={},i;try{for(i of n.fields.byNumber()){if(!mh(i,e)){if(i.req)throw"required field not set";if(!t.emitDefaultValues||!tpe(i))continue}let o=i.oneof?e[i.oneof.localName].value:e[i.localName],c=Ij(i,o,t);c!==void 0&&(r[t.useProtoFieldName?i.name:i.jsonName]=c)}let a=t.typeRegistry;if(a!=null&&a.findExtensionFor)for(let o of n.runtime.bin.listUnknownFields(e)){let c=a.findExtensionFor(n.typeName,o.no);if(c&&gb(e,c)){let l=mj(e,c,t),d=Ij(c.field,l,t);d!==void 0&&(r[c.field.jsonName]=d)}}}catch(a){let o=i?`cannot encode field ${n.typeName}.${i.name} to JSON`:`cannot encode message ${n.typeName} to JSON`,c=a instanceof Error?a.message:String(a);throw new Error(o+(c.length>0?`: ${c}`:""))}return r},readScalar(e,t,n){return _p(e,t,n!=null?n:ba.BIGINT,!0)},writeScalar(e,t,n){if(t!==void 0&&(n||ch(e,t)))return Eh(e,t)},debug:os}}function os(e){if(e===null)return"null";switch(typeof e){case"object":return Array.isArray(e)?"array":"object";case"string":return e.length>100?"string":`"${e.split('"').join('\\"')}"`;default:return String(e)}}function yj(e,t,n,r,i){let a=n.localName;if(n.repeated){if(pn(n.kind!="map"),t===null)return;if(!Array.isArray(t))throw new Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${os(t)}`);let o=e[a];for(let c of t){if(c===null)throw new Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${os(c)}`);switch(n.kind){case"message":o.push(n.T.fromJson(c,r));break;case"enum":let l=vb(n.T,c,r.ignoreUnknownFields,!0);l!==Th&&o.push(l);break;case"scalar":try{o.push(_p(n.T,c,n.L,!0))}catch(d){let p=`cannot decode field ${i.typeName}.${n.name} from JSON: ${os(c)}`;throw d instanceof Error&&d.message.length>0&&(p+=`: ${d.message}`),new Error(p)}break}}}else if(n.kind=="map"){if(t===null)return;if(typeof t!="object"||Array.isArray(t))throw new Error(`cannot decode field ${i.typeName}.${n.name} from JSON: ${os(t)}`);let o=e[a];for(let[c,l]of Object.entries(t)){if(l===null)throw new Error(`cannot decode field ${i.typeName}.${n.name} from JSON: map value null`);let d;try{d=epe(n.K,c)}catch(p){let E=`cannot decode map key for field ${i.typeName}.${n.name} from JSON: ${os(t)}`;throw p instanceof Error&&p.message.length>0&&(E+=`: ${p.message}`),new Error(E)}switch(n.V.kind){case"message":o[d]=n.V.T.fromJson(l,r);break;case"enum":let p=vb(n.V.T,l,r.ignoreUnknownFields,!0);p!==Th&&(o[d]=p);break;case"scalar":try{o[d]=_p(n.V.T,l,ba.BIGINT,!0)}catch(E){let I=`cannot decode map value for field ${i.typeName}.${n.name} from JSON: ${os(t)}`;throw E instanceof Error&&E.message.length>0&&(I+=`: ${E.message}`),new Error(I)}break}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:a},a="value"),n.kind){case"message":let o=n.T;if(t===null&&o.typeName!="google.protobuf.Value")return;let c=e[a];Ra(c)?c.fromJson(t,r):(e[a]=c=o.fromJson(t,r),o.fieldWrapper&&!n.oneof&&(e[a]=o.fieldWrapper.unwrapField(c)));break;case"enum":let l=vb(n.T,t,r.ignoreUnknownFields,!1);switch(l){case hh:_b(n,e);break;case Th:break;default:e[a]=l;break}break;case"scalar":try{let d=_p(n.T,t,n.L,!1);switch(d){case hh:_b(n,e);break;default:e[a]=d;break}}catch(d){let p=`cannot decode field ${i.typeName}.${n.name} from JSON: ${os(t)}`;throw d instanceof Error&&d.message.length>0&&(p+=`: ${d.message}`),new Error(p)}break}}function epe(e,t){if(e===fe.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1;break}return _p(e,t,ba.BIGINT,!0).toString()}function _p(e,t,n,r){if(t===null)return r?Aa(e,n):hh;switch(e){case fe.DOUBLE:case fe.FLOAT:if(t==="NaN")return Number.NaN;if(t==="Infinity")return Number.POSITIVE_INFINITY;if(t==="-Infinity")return Number.NEGATIVE_INFINITY;if(t===""||typeof t=="string"&&t.trim().length!==t.length||typeof t!="string"&&typeof t!="number")break;let i=Number(t);if(Number.isNaN(i)||!Number.isFinite(i))break;return e==fe.FLOAT&&sh(i),i;case fe.INT32:case fe.FIXED32:case fe.SFIXED32:case fe.SINT32:case fe.UINT32:let a;if(typeof t=="number"?a=t:typeof t=="string"&&t.length>0&&t.trim().length===t.length&&(a=Number(t)),a===void 0)break;return e==fe.UINT32||e==fe.FIXED32?gp(a):dd(a),a;case fe.INT64:case fe.SFIXED64:case fe.SINT64:if(typeof t!="number"&&typeof t!="string")break;let o=Qn.parse(t);return n?o.toString():o;case fe.FIXED64:case fe.UINT64:if(typeof t!="number"&&typeof t!="string")break;let c=Qn.uParse(t);return n?c.toString():c;case fe.BOOL:if(typeof t!="boolean")break;return t;case fe.STRING:if(typeof t!="string")break;try{encodeURIComponent(t)}catch(l){throw new Error("invalid UTF8")}return t;case fe.BYTES:if(t==="")return new Uint8Array(0);if(typeof t!="string")break;return Ib.dec(t)}throw new Error}function vb(e,t,n,r){if(t===null)return e.typeName=="google.protobuf.NullValue"?0:r?e.values[0].no:hh;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":let i=e.findName(t);if(i!==void 0)return i.no;if(n)return Th;break}throw new Error(`cannot decode enum ${e.typeName} from JSON: ${os(t)}`)}function tpe(e){return e.repeated||e.kind=="map"?!0:!(e.oneof||e.kind=="message"||e.opt||e.req)}function Ij(e,t,n){if(e.kind=="map"){pn(typeof t=="object"&&t!=null);let r={},i=Object.entries(t);switch(e.V.kind){case"scalar":for(let[o,c]of i)r[o.toString()]=Eh(e.V.T,c);break;case"message":for(let[o,c]of i)r[o.toString()]=c.toJson(n);break;case"enum":let a=e.V.T;for(let[o,c]of i)r[o.toString()]=Ob(a,c,n.enumAsInteger);break}return n.emitDefaultValues||i.length>0?r:void 0}if(e.repeated){pn(Array.isArray(t));let r=[];switch(e.kind){case"scalar":for(let i=0;i0?r:void 0}switch(e.kind){case"scalar":return Eh(e.T,t);case"enum":return Ob(e.T,t,n.enumAsInteger);case"message":return Nh(e.T,t).toJson(n)}}function Ob(e,t,n){var r;if(pn(typeof t=="number"),e.typeName=="google.protobuf.NullValue")return null;if(n)return t;let i=e.findNumber(t);return(r=i==null?void 0:i.name)!==null&&r!==void 0?r:t}function Eh(e,t){switch(e){case fe.INT32:case fe.SFIXED32:case fe.SINT32:case fe.FIXED32:case fe.UINT32:return pn(typeof t=="number"),t;case fe.FLOAT:case fe.DOUBLE:return pn(typeof t=="number"),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case fe.STRING:return pn(typeof t=="string"),t;case fe.BOOL:return pn(typeof t=="boolean"),t;case fe.UINT64:case fe.FIXED64:case fe.INT64:case fe.SFIXED64:case fe.SINT64:return pn(typeof t=="bigint"||typeof t=="string"||typeof t=="number"),t.toString();case fe.BYTES:return pn(t instanceof Uint8Array),Ib.enc(t)}}m();T();N();var fd=Symbol("@bufbuild/protobuf/unknown-fields"),_j={readUnknownFields:!0,readerFactory:e=>new dh(e)},vj={writeUnknownFields:!0,writerFactory:()=>new lh};function npe(e){return e?Object.assign(Object.assign({},_j),e):_j}function rpe(e){return e?Object.assign(Object.assign({},vj),e):vj}function bj(){return{makeReadOptions:npe,makeWriteOptions:rpe,listUnknownFields(e){var t;return(t=e[fd])!==null&&t!==void 0?t:[]},discardUnknownFields(e){delete e[fd]},writeUnknownFields(e,t){let r=e[fd];if(r)for(let i of r)t.tag(i.no,i.wireType).raw(i.data)},onUnknownField(e,t,n,r){let i=e;Array.isArray(i[fd])||(i[fd]=[]),i[fd].push({no:t,wireType:n,data:r})},readMessage(e,t,n,r,i){let a=e.getType(),o=i?t.len:t.pos+n,c,l;for(;t.pos0&&(l=ape),a){let I=e[o];if(r==Mn.LengthDelimited&&c!=fe.STRING&&c!=fe.BYTES){let A=t.uint32()+t.pos;for(;t.posRa(I,E)?I:new E(I));else{let I=o[i];E.fieldWrapper?E.typeName==="google.protobuf.BytesValue"?a[i]=Op(I):a[i]=I:a[i]=Ra(I,E)?I:new E(I)}break}}},equals(e,t,n){return t===n?!0:!t||!n?!1:e.fields.byMember().every(r=>{let i=t[r.localName],a=n[r.localName];if(r.repeated){if(i.length!==a.length)return!1;switch(r.kind){case"message":return i.every((o,c)=>r.T.equals(o,a[c]));case"scalar":return i.every((o,c)=>Bs(r.T,o,a[c]));case"enum":return i.every((o,c)=>Bs(fe.INT32,o,a[c]))}throw new Error(`repeated cannot contain ${r.kind}`)}switch(r.kind){case"message":return r.T.equals(i,a);case"enum":return Bs(fe.INT32,i,a);case"scalar":return Bs(r.T,i,a);case"oneof":if(i.case!==a.case)return!1;let o=r.findField(i.case);if(o===void 0)return!0;switch(o.kind){case"message":return o.T.equals(i.value,a.value);case"enum":return Bs(fe.INT32,i.value,a.value);case"scalar":return Bs(o.T,i.value,a.value)}throw new Error(`oneof cannot contain ${o.kind}`);case"map":let c=Object.keys(i).concat(Object.keys(a));switch(r.V.kind){case"message":let l=r.V.T;return c.every(p=>l.equals(i[p],a[p]));case"enum":return c.every(p=>Bs(fe.INT32,i[p],a[p]));case"scalar":let d=r.V.T;return c.every(p=>Bs(d,i[p],a[p]))}break}})},clone(e){let t=e.getType(),n=new t,r=n;for(let i of t.fields.byMember()){let a=e[i.localName],o;if(i.repeated)o=a.map(gh);else if(i.kind=="map"){o=r[i.localName];for(let[c,l]of Object.entries(a))o[c]=gh(l)}else i.kind=="oneof"?o=i.findField(a.case)?{case:a.case,value:gh(a.value)}:{case:void 0}:o=gh(a);r[i.localName]=o}for(let i of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(r,i.no,i.wireType,i.data);return n}}}function gh(e){if(e===void 0)return e;if(Ra(e))return e.clone();if(e instanceof Uint8Array){let t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function Op(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Pj(e,t,n){return{syntax:e,json:gj(),bin:bj(),util:Object.assign(Object.assign({},Rj()),{newFieldList:t,initFields:n}),makeMessageType(r,i,a){return sj(this,r,i,a)},makeEnum:ij,makeEnumType:Nb,getEnumType:rj,makeExtension(r,i,a){return fj(this,r,i,a)}}}m();T();N();var _h=class{constructor(t,n){this._fields=t,this._normalizer=n}findJsonName(t){if(!this.jsonNames){let n={};for(let r of this.list())n[r.jsonName]=n[r.name]=r;this.jsonNames=n}return this.jsonNames[t]}find(t){if(!this.numbers){let n={};for(let r of this.list())n[r.no]=r;this.numbers=n}return this.numbers[t]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((t,n)=>t.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];let t=this.members,n;for(let r of this.list())r.oneof?r.oneof!==n&&(n=r.oneof,t.push(n)):t.push(r)}return this.members}};m();T();N();m();T();N();m();T();N();function Sb(e,t){let n=Lj(e);return t?n:dpe(lpe(n))}function Fj(e){return Sb(e,!1)}var wj=Lj;function Lj(e){let t=!1,n=[];for(let r=0;r`${e}$`,lpe=e=>cpe.has(e)?Cj(e):e,dpe=e=>upe.has(e)?Cj(e):e;var vh=class{constructor(t){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=t,this.localName=Fj(t)}addField(t){pn(t.oneof===this,`field ${t.name} not one of ${this.name}`),this.fields.push(t)}findField(t){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;nnew _h(e,t=>Bj(t,!0)),e=>{for(let t of e.getType().fields.byMember()){if(t.opt)continue;let n=t.localName,r=e;if(t.repeated){r[n]=[];continue}switch(t.kind){case"oneof":r[n]={case:void 0};break;case"enum":r[n]=0;break;case"map":r[n]={};break;case"scalar":r[n]=Aa(t.T,t.L);break;case"message":break}}});var pd;(function(e){e[e.OK=0]="OK",e[e.ERR=1]="ERR",e[e.ERR_NOT_FOUND=2]="ERR_NOT_FOUND",e[e.ERR_ALREADY_EXISTS=3]="ERR_ALREADY_EXISTS",e[e.ERR_INVALID_SUBGRAPH_SCHEMA=4]="ERR_INVALID_SUBGRAPH_SCHEMA",e[e.ERR_SUBGRAPH_COMPOSITION_FAILED=5]="ERR_SUBGRAPH_COMPOSITION_FAILED",e[e.ERR_SUBGRAPH_CHECK_FAILED=6]="ERR_SUBGRAPH_CHECK_FAILED",e[e.ERR_INVALID_LABELS=7]="ERR_INVALID_LABELS",e[e.ERR_ANALYTICS_DISABLED=8]="ERR_ANALYTICS_DISABLED",e[e.ERROR_NOT_AUTHENTICATED=9]="ERROR_NOT_AUTHENTICATED",e[e.ERR_OPENAI_DISABLED=10]="ERR_OPENAI_DISABLED",e[e.ERR_FREE_TRIAL_EXPIRED=11]="ERR_FREE_TRIAL_EXPIRED",e[e.ERROR_NOT_AUTHORIZED=12]="ERROR_NOT_AUTHORIZED",e[e.ERR_LIMIT_REACHED=13]="ERR_LIMIT_REACHED",e[e.ERR_DEPLOYMENT_FAILED=14]="ERR_DEPLOYMENT_FAILED",e[e.ERR_INVALID_NAME=15]="ERR_INVALID_NAME",e[e.ERR_UPGRADE_PLAN=16]="ERR_UPGRADE_PLAN",e[e.ERR_BAD_REQUEST=17]="ERR_BAD_REQUEST",e[e.ERR_SCHEMA_MISMATCH_WITH_APPROVED_PROPOSAL=18]="ERR_SCHEMA_MISMATCH_WITH_APPROVED_PROPOSAL"})(pd||(pd={}));C.util.setEnumType(pd,"wg.cosmo.common.EnumStatusCode",[{no:0,name:"OK"},{no:1,name:"ERR"},{no:2,name:"ERR_NOT_FOUND"},{no:3,name:"ERR_ALREADY_EXISTS"},{no:4,name:"ERR_INVALID_SUBGRAPH_SCHEMA"},{no:5,name:"ERR_SUBGRAPH_COMPOSITION_FAILED"},{no:6,name:"ERR_SUBGRAPH_CHECK_FAILED"},{no:7,name:"ERR_INVALID_LABELS"},{no:8,name:"ERR_ANALYTICS_DISABLED"},{no:9,name:"ERROR_NOT_AUTHENTICATED"},{no:10,name:"ERR_OPENAI_DISABLED"},{no:11,name:"ERR_FREE_TRIAL_EXPIRED"},{no:12,name:"ERROR_NOT_AUTHORIZED"},{no:13,name:"ERR_LIMIT_REACHED"},{no:14,name:"ERR_DEPLOYMENT_FAILED"},{no:15,name:"ERR_INVALID_NAME"},{no:16,name:"ERR_UPGRADE_PLAN"},{no:17,name:"ERR_BAD_REQUEST"},{no:18,name:"ERR_SCHEMA_MISMATCH_WITH_APPROVED_PROPOSAL"}]);var ks;(function(e){e[e.GRAPHQL_SUBSCRIPTION_PROTOCOL_WS=0]="GRAPHQL_SUBSCRIPTION_PROTOCOL_WS",e[e.GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE=1]="GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE",e[e.GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE_POST=2]="GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE_POST"})(ks||(ks={}));C.util.setEnumType(ks,"wg.cosmo.common.GraphQLSubscriptionProtocol",[{no:0,name:"GRAPHQL_SUBSCRIPTION_PROTOCOL_WS"},{no:1,name:"GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE"},{no:2,name:"GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE_POST"}]);var Ms;(function(e){e[e.GRAPHQL_WEBSOCKET_SUBPROTOCOL_AUTO=0]="GRAPHQL_WEBSOCKET_SUBPROTOCOL_AUTO",e[e.GRAPHQL_WEBSOCKET_SUBPROTOCOL_WS=1]="GRAPHQL_WEBSOCKET_SUBPROTOCOL_WS",e[e.GRAPHQL_WEBSOCKET_SUBPROTOCOL_TRANSPORT_WS=2]="GRAPHQL_WEBSOCKET_SUBPROTOCOL_TRANSPORT_WS"})(Ms||(Ms={}));C.util.setEnumType(Ms,"wg.cosmo.common.GraphQLWebsocketSubprotocol",[{no:0,name:"GRAPHQL_WEBSOCKET_SUBPROTOCOL_AUTO"},{no:1,name:"GRAPHQL_WEBSOCKET_SUBPROTOCOL_WS"},{no:2,name:"GRAPHQL_WEBSOCKET_SUBPROTOCOL_TRANSPORT_WS"}]);var $j=ys(Oe(),1);m();T();N();var Db;(function(e){e[e.RENDER_ARGUMENT_DEFAULT=0]="RENDER_ARGUMENT_DEFAULT",e[e.RENDER_ARGUMENT_AS_GRAPHQL_VALUE=1]="RENDER_ARGUMENT_AS_GRAPHQL_VALUE",e[e.RENDER_ARGUMENT_AS_ARRAY_CSV=2]="RENDER_ARGUMENT_AS_ARRAY_CSV"})(Db||(Db={}));C.util.setEnumType(Db,"wg.cosmo.node.v1.ArgumentRenderConfiguration",[{no:0,name:"RENDER_ARGUMENT_DEFAULT"},{no:1,name:"RENDER_ARGUMENT_AS_GRAPHQL_VALUE"},{no:2,name:"RENDER_ARGUMENT_AS_ARRAY_CSV"}]);var jc;(function(e){e[e.OBJECT_FIELD=0]="OBJECT_FIELD",e[e.FIELD_ARGUMENT=1]="FIELD_ARGUMENT"})(jc||(jc={}));C.util.setEnumType(jc,"wg.cosmo.node.v1.ArgumentSource",[{no:0,name:"OBJECT_FIELD"},{no:1,name:"FIELD_ARGUMENT"}]);var wu;(function(e){e[e.STATIC=0]="STATIC",e[e.GRAPHQL=1]="GRAPHQL",e[e.PUBSUB=2]="PUBSUB"})(wu||(wu={}));C.util.setEnumType(wu,"wg.cosmo.node.v1.DataSourceKind",[{no:0,name:"STATIC"},{no:1,name:"GRAPHQL"},{no:2,name:"PUBSUB"}]);var Sp;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.RESOLVE=1]="RESOLVE",e[e.REQUIRES=2]="REQUIRES"})(Sp||(Sp={}));C.util.setEnumType(Sp,"wg.cosmo.node.v1.LookupType",[{no:0,name:"LOOKUP_TYPE_UNSPECIFIED"},{no:1,name:"LOOKUP_TYPE_RESOLVE"},{no:2,name:"LOOKUP_TYPE_REQUIRES"}]);var Dp;(function(e){e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.QUERY=1]="QUERY",e[e.MUTATION=2]="MUTATION",e[e.SUBSCRIPTION=3]="SUBSCRIPTION"})(Dp||(Dp={}));C.util.setEnumType(Dp,"wg.cosmo.node.v1.OperationType",[{no:0,name:"OPERATION_TYPE_UNSPECIFIED"},{no:1,name:"OPERATION_TYPE_QUERY"},{no:2,name:"OPERATION_TYPE_MUTATION"},{no:3,name:"OPERATION_TYPE_SUBSCRIPTION"}]);var Jo;(function(e){e[e.PUBLISH=0]="PUBLISH",e[e.REQUEST=1]="REQUEST",e[e.SUBSCRIBE=2]="SUBSCRIBE"})(Jo||(Jo={}));C.util.setEnumType(Jo,"wg.cosmo.node.v1.EventType",[{no:0,name:"PUBLISH"},{no:1,name:"REQUEST"},{no:2,name:"SUBSCRIBE"}]);var Lu;(function(e){e[e.STATIC_CONFIGURATION_VARIABLE=0]="STATIC_CONFIGURATION_VARIABLE",e[e.ENV_CONFIGURATION_VARIABLE=1]="ENV_CONFIGURATION_VARIABLE",e[e.PLACEHOLDER_CONFIGURATION_VARIABLE=2]="PLACEHOLDER_CONFIGURATION_VARIABLE"})(Lu||(Lu={}));C.util.setEnumType(Lu,"wg.cosmo.node.v1.ConfigurationVariableKind",[{no:0,name:"STATIC_CONFIGURATION_VARIABLE"},{no:1,name:"ENV_CONFIGURATION_VARIABLE"},{no:2,name:"PLACEHOLDER_CONFIGURATION_VARIABLE"}]);var Kc;(function(e){e[e.GET=0]="GET",e[e.POST=1]="POST",e[e.PUT=2]="PUT",e[e.DELETE=3]="DELETE",e[e.OPTIONS=4]="OPTIONS"})(Kc||(Kc={}));C.util.setEnumType(Kc,"wg.cosmo.node.v1.HTTPMethod",[{no:0,name:"GET"},{no:1,name:"POST"},{no:2,name:"PUT"},{no:3,name:"DELETE"},{no:4,name:"OPTIONS"}]);var xs=class xs extends we{constructor(n){super();_(this,"id","");_(this,"name","");_(this,"routingUrl","");C.util.initPartial(n,this)}static fromBinary(n,r){return new xs().fromBinary(n,r)}static fromJson(n,r){return new xs().fromJson(n,r)}static fromJsonString(n,r){return new xs().fromJsonString(n,r)}static equals(n,r){return C.util.equals(xs,n,r)}};_(xs,"runtime",C),_(xs,"typeName","wg.cosmo.node.v1.Subgraph"),_(xs,"fields",C.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"routing_url",kind:"scalar",T:9}]));var Oh=xs,qs=class qs extends we{constructor(n){super();_(this,"configByFeatureFlagName",{});C.util.initPartial(n,this)}static fromBinary(n,r){return new qs().fromBinary(n,r)}static fromJson(n,r){return new qs().fromJson(n,r)}static fromJsonString(n,r){return new qs().fromJsonString(n,r)}static equals(n,r){return C.util.equals(qs,n,r)}};_(qs,"runtime",C),_(qs,"typeName","wg.cosmo.node.v1.FeatureFlagRouterExecutionConfigs"),_(qs,"fields",C.util.newFieldList(()=>[{no:1,name:"config_by_feature_flag_name",kind:"map",K:9,V:{kind:"message",T:Ab}}]));var bb=qs,Vs=class Vs extends we{constructor(n){super();_(this,"engineConfig");_(this,"version","");_(this,"subgraphs",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new Vs().fromBinary(n,r)}static fromJson(n,r){return new Vs().fromJson(n,r)}static fromJsonString(n,r){return new Vs().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Vs,n,r)}};_(Vs,"runtime",C),_(Vs,"typeName","wg.cosmo.node.v1.FeatureFlagRouterExecutionConfig"),_(Vs,"fields",C.util.newFieldList(()=>[{no:1,name:"engine_config",kind:"message",T:md},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"subgraphs",kind:"message",T:Oh,repeated:!0}]));var Ab=Vs,js=class js extends we{constructor(n){super();_(this,"engineConfig");_(this,"version","");_(this,"subgraphs",[]);_(this,"featureFlagConfigs");_(this,"compatibilityVersion","");C.util.initPartial(n,this)}static fromBinary(n,r){return new js().fromBinary(n,r)}static fromJson(n,r){return new js().fromJson(n,r)}static fromJsonString(n,r){return new js().fromJsonString(n,r)}static equals(n,r){return C.util.equals(js,n,r)}};_(js,"runtime",C),_(js,"typeName","wg.cosmo.node.v1.RouterConfig"),_(js,"fields",C.util.newFieldList(()=>[{no:1,name:"engine_config",kind:"message",T:md},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"subgraphs",kind:"message",T:Oh,repeated:!0},{no:4,name:"feature_flag_configs",kind:"message",T:bb,opt:!0},{no:5,name:"compatibility_version",kind:"scalar",T:9}]));var bp=js,Ks=class Ks extends we{constructor(n){super();_(this,"code",pd.OK);_(this,"details");C.util.initPartial(n,this)}static fromBinary(n,r){return new Ks().fromBinary(n,r)}static fromJson(n,r){return new Ks().fromJson(n,r)}static fromJsonString(n,r){return new Ks().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Ks,n,r)}};_(Ks,"runtime",C),_(Ks,"typeName","wg.cosmo.node.v1.Response"),_(Ks,"fields",C.util.newFieldList(()=>[{no:1,name:"code",kind:"enum",T:C.getEnumType(pd)},{no:2,name:"details",kind:"scalar",T:9,opt:!0}]));var Rb=Ks,Gs=class Gs extends we{constructor(n){super();_(this,"code",0);_(this,"message","");C.util.initPartial(n,this)}static fromBinary(n,r){return new Gs().fromBinary(n,r)}static fromJson(n,r){return new Gs().fromJson(n,r)}static fromJsonString(n,r){return new Gs().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Gs,n,r)}};_(Gs,"runtime",C),_(Gs,"typeName","wg.cosmo.node.v1.ResponseStatus"),_(Gs,"fields",C.util.newFieldList(()=>[{no:1,name:"code",kind:"scalar",T:5},{no:2,name:"message",kind:"scalar",T:9}]));var Uj=Gs,$s=class $s extends we{constructor(n){super();_(this,"accountLimits");_(this,"graphPublicKey","");C.util.initPartial(n,this)}static fromBinary(n,r){return new $s().fromBinary(n,r)}static fromJson(n,r){return new $s().fromJson(n,r)}static fromJsonString(n,r){return new $s().fromJsonString(n,r)}static equals(n,r){return C.util.equals($s,n,r)}};_($s,"runtime",C),_($s,"typeName","wg.cosmo.node.v1.RegistrationInfo"),_($s,"fields",C.util.newFieldList(()=>[{no:1,name:"account_limits",kind:"message",T:Fb},{no:2,name:"graph_public_key",kind:"scalar",T:9}]));var Pb=$s,Qs=class Qs extends we{constructor(n){super();_(this,"traceSamplingRate",0);C.util.initPartial(n,this)}static fromBinary(n,r){return new Qs().fromBinary(n,r)}static fromJson(n,r){return new Qs().fromJson(n,r)}static fromJsonString(n,r){return new Qs().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Qs,n,r)}};_(Qs,"runtime",C),_(Qs,"typeName","wg.cosmo.node.v1.AccountLimits"),_(Qs,"fields",C.util.newFieldList(()=>[{no:1,name:"trace_sampling_rate",kind:"scalar",T:2}]));var Fb=Qs,Ys=class Ys extends we{constructor(t){super(),C.util.initPartial(t,this)}static fromBinary(t,n){return new Ys().fromBinary(t,n)}static fromJson(t,n){return new Ys().fromJson(t,n)}static fromJsonString(t,n){return new Ys().fromJsonString(t,n)}static equals(t,n){return C.util.equals(Ys,t,n)}};_(Ys,"runtime",C),_(Ys,"typeName","wg.cosmo.node.v1.SelfRegisterRequest"),_(Ys,"fields",C.util.newFieldList(()=>[]));var kj=Ys,Js=class Js extends we{constructor(n){super();_(this,"response");_(this,"registrationInfo");C.util.initPartial(n,this)}static fromBinary(n,r){return new Js().fromBinary(n,r)}static fromJson(n,r){return new Js().fromJson(n,r)}static fromJsonString(n,r){return new Js().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Js,n,r)}};_(Js,"runtime",C),_(Js,"typeName","wg.cosmo.node.v1.SelfRegisterResponse"),_(Js,"fields",C.util.newFieldList(()=>[{no:1,name:"response",kind:"message",T:Rb},{no:2,name:"registrationInfo",kind:"message",T:Pb,opt:!0}]));var Mj=Js,Hs=class Hs extends we{constructor(n){super();_(this,"defaultFlushInterval",Qn.zero);_(this,"datasourceConfigurations",[]);_(this,"fieldConfigurations",[]);_(this,"graphqlSchema","");_(this,"typeConfigurations",[]);_(this,"stringStorage",{});_(this,"graphqlClientSchema");C.util.initPartial(n,this)}static fromBinary(n,r){return new Hs().fromBinary(n,r)}static fromJson(n,r){return new Hs().fromJson(n,r)}static fromJsonString(n,r){return new Hs().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Hs,n,r)}};_(Hs,"runtime",C),_(Hs,"typeName","wg.cosmo.node.v1.EngineConfiguration"),_(Hs,"fields",C.util.newFieldList(()=>[{no:1,name:"defaultFlushInterval",kind:"scalar",T:3},{no:2,name:"datasource_configurations",kind:"message",T:Ap,repeated:!0},{no:3,name:"field_configurations",kind:"message",T:Fp,repeated:!0},{no:4,name:"graphqlSchema",kind:"scalar",T:9},{no:5,name:"type_configurations",kind:"message",T:wb,repeated:!0},{no:6,name:"string_storage",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:7,name:"graphql_client_schema",kind:"scalar",T:9,opt:!0}]));var md=Hs,zs=class zs extends we{constructor(n){super();_(this,"kind",wu.STATIC);_(this,"rootNodes",[]);_(this,"childNodes",[]);_(this,"overrideFieldPathFromAlias",!1);_(this,"customGraphql");_(this,"customStatic");_(this,"directives",[]);_(this,"requestTimeoutSeconds",Qn.zero);_(this,"id","");_(this,"keys",[]);_(this,"provides",[]);_(this,"requires",[]);_(this,"customEvents");_(this,"entityInterfaces",[]);_(this,"interfaceObjects",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new zs().fromBinary(n,r)}static fromJson(n,r){return new zs().fromJson(n,r)}static fromJsonString(n,r){return new zs().fromJsonString(n,r)}static equals(n,r){return C.util.equals(zs,n,r)}};_(zs,"runtime",C),_(zs,"typeName","wg.cosmo.node.v1.DataSourceConfiguration"),_(zs,"fields",C.util.newFieldList(()=>[{no:1,name:"kind",kind:"enum",T:C.getEnumType(wu)},{no:2,name:"root_nodes",kind:"message",T:Nd,repeated:!0},{no:3,name:"child_nodes",kind:"message",T:Nd,repeated:!0},{no:4,name:"override_field_path_from_alias",kind:"scalar",T:8},{no:5,name:"custom_graphql",kind:"message",T:Cp},{no:6,name:"custom_static",kind:"message",T:Gb},{no:7,name:"directives",kind:"message",T:$b,repeated:!0},{no:8,name:"request_timeout_seconds",kind:"scalar",T:3},{no:9,name:"id",kind:"scalar",T:9},{no:10,name:"keys",kind:"message",T:Vc,repeated:!0},{no:11,name:"provides",kind:"message",T:Vc,repeated:!0},{no:12,name:"requires",kind:"message",T:Vc,repeated:!0},{no:13,name:"custom_events",kind:"message",T:$c},{no:14,name:"entity_interfaces",kind:"message",T:Td,repeated:!0},{no:15,name:"interface_objects",kind:"message",T:Td,repeated:!0}]));var Ap=zs,Ws=class Ws extends we{constructor(n){super();_(this,"name","");_(this,"sourceType",jc.OBJECT_FIELD);C.util.initPartial(n,this)}static fromBinary(n,r){return new Ws().fromBinary(n,r)}static fromJson(n,r){return new Ws().fromJson(n,r)}static fromJsonString(n,r){return new Ws().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Ws,n,r)}};_(Ws,"runtime",C),_(Ws,"typeName","wg.cosmo.node.v1.ArgumentConfiguration"),_(Ws,"fields",C.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"source_type",kind:"enum",T:C.getEnumType(jc)}]));var Rp=Ws,Xs=class Xs extends we{constructor(n){super();_(this,"requiredAndScopes",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new Xs().fromBinary(n,r)}static fromJson(n,r){return new Xs().fromJson(n,r)}static fromJsonString(n,r){return new Xs().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Xs,n,r)}};_(Xs,"runtime",C),_(Xs,"typeName","wg.cosmo.node.v1.Scopes"),_(Xs,"fields",C.util.newFieldList(()=>[{no:1,name:"required_and_scopes",kind:"scalar",T:9,repeated:!0}]));var Gc=Xs,Zs=class Zs extends we{constructor(n){super();_(this,"requiresAuthentication",!1);_(this,"requiredOrScopes",[]);_(this,"requiredOrScopesByOr",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new Zs().fromBinary(n,r)}static fromJson(n,r){return new Zs().fromJson(n,r)}static fromJsonString(n,r){return new Zs().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Zs,n,r)}};_(Zs,"runtime",C),_(Zs,"typeName","wg.cosmo.node.v1.AuthorizationConfiguration"),_(Zs,"fields",C.util.newFieldList(()=>[{no:1,name:"requires_authentication",kind:"scalar",T:8},{no:2,name:"required_or_scopes",kind:"message",T:Gc,repeated:!0},{no:3,name:"required_or_scopes_by_or",kind:"message",T:Gc,repeated:!0}]));var Pp=Zs,eo=class eo extends we{constructor(n){super();_(this,"typeName","");_(this,"fieldName","");_(this,"argumentsConfiguration",[]);_(this,"authorizationConfiguration");_(this,"subscriptionFilterCondition");C.util.initPartial(n,this)}static fromBinary(n,r){return new eo().fromBinary(n,r)}static fromJson(n,r){return new eo().fromJson(n,r)}static fromJsonString(n,r){return new eo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(eo,n,r)}};_(eo,"runtime",C),_(eo,"typeName","wg.cosmo.node.v1.FieldConfiguration"),_(eo,"fields",C.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"field_name",kind:"scalar",T:9},{no:3,name:"arguments_configuration",kind:"message",T:Rp,repeated:!0},{no:4,name:"authorization_configuration",kind:"message",T:Pp},{no:5,name:"subscription_filter_condition",kind:"message",T:Cu,opt:!0}]));var Fp=eo,to=class to extends we{constructor(n){super();_(this,"typeName","");_(this,"renameTo","");C.util.initPartial(n,this)}static fromBinary(n,r){return new to().fromBinary(n,r)}static fromJson(n,r){return new to().fromJson(n,r)}static fromJsonString(n,r){return new to().fromJsonString(n,r)}static equals(n,r){return C.util.equals(to,n,r)}};_(to,"runtime",C),_(to,"typeName","wg.cosmo.node.v1.TypeConfiguration"),_(to,"fields",C.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"rename_to",kind:"scalar",T:9}]));var wb=to,no=class no extends we{constructor(n){super();_(this,"typeName","");_(this,"fieldNames",[]);_(this,"externalFieldNames",[]);_(this,"requireFetchReasonsFieldNames",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new no().fromBinary(n,r)}static fromJson(n,r){return new no().fromJson(n,r)}static fromJsonString(n,r){return new no().fromJsonString(n,r)}static equals(n,r){return C.util.equals(no,n,r)}};_(no,"runtime",C),_(no,"typeName","wg.cosmo.node.v1.TypeField"),_(no,"fields",C.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"field_names",kind:"scalar",T:9,repeated:!0},{no:3,name:"external_field_names",kind:"scalar",T:9,repeated:!0},{no:4,name:"require_fetch_reasons_field_names",kind:"scalar",T:9,repeated:!0}]));var Nd=no,ro=class ro extends we{constructor(n){super();_(this,"fieldName","");_(this,"typeName","");C.util.initPartial(n,this)}static fromBinary(n,r){return new ro().fromBinary(n,r)}static fromJson(n,r){return new ro().fromJson(n,r)}static fromJsonString(n,r){return new ro().fromJsonString(n,r)}static equals(n,r){return C.util.equals(ro,n,r)}};_(ro,"runtime",C),_(ro,"typeName","wg.cosmo.node.v1.FieldCoordinates"),_(ro,"fields",C.util.newFieldList(()=>[{no:1,name:"field_name",kind:"scalar",T:9},{no:2,name:"type_name",kind:"scalar",T:9}]));var wp=ro,io=class io extends we{constructor(n){super();_(this,"fieldCoordinatesPath",[]);_(this,"fieldPath",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new io().fromBinary(n,r)}static fromJson(n,r){return new io().fromJson(n,r)}static fromJsonString(n,r){return new io().fromJsonString(n,r)}static equals(n,r){return C.util.equals(io,n,r)}};_(io,"runtime",C),_(io,"typeName","wg.cosmo.node.v1.FieldSetCondition"),_(io,"fields",C.util.newFieldList(()=>[{no:1,name:"field_coordinates_path",kind:"message",T:wp,repeated:!0},{no:2,name:"field_path",kind:"scalar",T:9,repeated:!0}]));var Lp=io,ao=class ao extends we{constructor(n){super();_(this,"typeName","");_(this,"fieldName","");_(this,"selectionSet","");_(this,"disableEntityResolver",!1);_(this,"conditions",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new ao().fromBinary(n,r)}static fromJson(n,r){return new ao().fromJson(n,r)}static fromJsonString(n,r){return new ao().fromJsonString(n,r)}static equals(n,r){return C.util.equals(ao,n,r)}};_(ao,"runtime",C),_(ao,"typeName","wg.cosmo.node.v1.RequiredField"),_(ao,"fields",C.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"field_name",kind:"scalar",T:9},{no:3,name:"selection_set",kind:"scalar",T:9},{no:4,name:"disable_entity_resolver",kind:"scalar",T:8},{no:5,name:"conditions",kind:"message",T:Lp,repeated:!0}]));var Vc=ao,so=class so extends we{constructor(n){super();_(this,"interfaceTypeName","");_(this,"concreteTypeNames",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new so().fromBinary(n,r)}static fromJson(n,r){return new so().fromJson(n,r)}static fromJsonString(n,r){return new so().fromJsonString(n,r)}static equals(n,r){return C.util.equals(so,n,r)}};_(so,"runtime",C),_(so,"typeName","wg.cosmo.node.v1.EntityInterfaceConfiguration"),_(so,"fields",C.util.newFieldList(()=>[{no:1,name:"interface_type_name",kind:"scalar",T:9},{no:2,name:"concrete_type_names",kind:"scalar",T:9,repeated:!0}]));var Td=so,oo=class oo extends we{constructor(n){super();_(this,"url");_(this,"method",Kc.GET);_(this,"header",{});_(this,"body");_(this,"query",[]);_(this,"urlEncodeBody",!1);_(this,"mtls");_(this,"baseUrl");_(this,"path");_(this,"httpProxyUrl");C.util.initPartial(n,this)}static fromBinary(n,r){return new oo().fromBinary(n,r)}static fromJson(n,r){return new oo().fromJson(n,r)}static fromJsonString(n,r){return new oo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(oo,n,r)}};_(oo,"runtime",C),_(oo,"typeName","wg.cosmo.node.v1.FetchConfiguration"),_(oo,"fields",C.util.newFieldList(()=>[{no:1,name:"url",kind:"message",T:$r},{no:2,name:"method",kind:"enum",T:C.getEnumType(Kc)},{no:3,name:"header",kind:"map",K:9,V:{kind:"message",T:Yb}},{no:4,name:"body",kind:"message",T:$r},{no:5,name:"query",kind:"message",T:Qb,repeated:!0},{no:7,name:"url_encode_body",kind:"scalar",T:8},{no:8,name:"mtls",kind:"message",T:Jb},{no:9,name:"base_url",kind:"message",T:$r},{no:10,name:"path",kind:"message",T:$r},{no:11,name:"http_proxy_url",kind:"message",T:$r,opt:!0}]));var Lb=oo,uo=class uo extends we{constructor(n){super();_(this,"statusCode",Qn.zero);_(this,"typeName","");_(this,"injectStatusCodeIntoBody",!1);C.util.initPartial(n,this)}static fromBinary(n,r){return new uo().fromBinary(n,r)}static fromJson(n,r){return new uo().fromJson(n,r)}static fromJsonString(n,r){return new uo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(uo,n,r)}};_(uo,"runtime",C),_(uo,"typeName","wg.cosmo.node.v1.StatusCodeTypeMapping"),_(uo,"fields",C.util.newFieldList(()=>[{no:1,name:"status_code",kind:"scalar",T:3},{no:2,name:"type_name",kind:"scalar",T:9},{no:3,name:"inject_status_code_into_body",kind:"scalar",T:8}]));var xj=uo,co=class co extends we{constructor(n){super();_(this,"fetch");_(this,"subscription");_(this,"federation");_(this,"upstreamSchema");_(this,"customScalarTypeFields",[]);_(this,"grpc");C.util.initPartial(n,this)}static fromBinary(n,r){return new co().fromBinary(n,r)}static fromJson(n,r){return new co().fromJson(n,r)}static fromJsonString(n,r){return new co().fromJsonString(n,r)}static equals(n,r){return C.util.equals(co,n,r)}};_(co,"runtime",C),_(co,"typeName","wg.cosmo.node.v1.DataSourceCustom_GraphQL"),_(co,"fields",C.util.newFieldList(()=>[{no:1,name:"fetch",kind:"message",T:Lb},{no:2,name:"subscription",kind:"message",T:Hb},{no:3,name:"federation",kind:"message",T:zb},{no:4,name:"upstream_schema",kind:"message",T:qp},{no:6,name:"custom_scalar_type_fields",kind:"message",T:Wb,repeated:!0},{no:7,name:"grpc",kind:"message",T:Ed}]));var Cp=co,lo=class lo extends we{constructor(n){super();_(this,"mapping");_(this,"protoSchema","");_(this,"plugin");C.util.initPartial(n,this)}static fromBinary(n,r){return new lo().fromBinary(n,r)}static fromJson(n,r){return new lo().fromJson(n,r)}static fromJsonString(n,r){return new lo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(lo,n,r)}};_(lo,"runtime",C),_(lo,"typeName","wg.cosmo.node.v1.GRPCConfiguration"),_(lo,"fields",C.util.newFieldList(()=>[{no:1,name:"mapping",kind:"message",T:Bb},{no:2,name:"proto_schema",kind:"scalar",T:9},{no:3,name:"plugin",kind:"message",T:Bp}]));var Ed=lo,fo=class fo extends we{constructor(n){super();_(this,"repository","");_(this,"reference","");C.util.initPartial(n,this)}static fromBinary(n,r){return new fo().fromBinary(n,r)}static fromJson(n,r){return new fo().fromJson(n,r)}static fromJsonString(n,r){return new fo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(fo,n,r)}};_(fo,"runtime",C),_(fo,"typeName","wg.cosmo.node.v1.ImageReference"),_(fo,"fields",C.util.newFieldList(()=>[{no:1,name:"repository",kind:"scalar",T:9},{no:2,name:"reference",kind:"scalar",T:9}]));var Cb=fo,po=class po extends we{constructor(n){super();_(this,"name","");_(this,"version","");_(this,"imageReference");C.util.initPartial(n,this)}static fromBinary(n,r){return new po().fromBinary(n,r)}static fromJson(n,r){return new po().fromJson(n,r)}static fromJsonString(n,r){return new po().fromJsonString(n,r)}static equals(n,r){return C.util.equals(po,n,r)}};_(po,"runtime",C),_(po,"typeName","wg.cosmo.node.v1.PluginConfiguration"),_(po,"fields",C.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"image_reference",kind:"message",T:Cb,opt:!0}]));var Bp=po,mo=class mo extends we{constructor(n){super();_(this,"enabled",!1);C.util.initPartial(n,this)}static fromBinary(n,r){return new mo().fromBinary(n,r)}static fromJson(n,r){return new mo().fromJson(n,r)}static fromJsonString(n,r){return new mo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(mo,n,r)}};_(mo,"runtime",C),_(mo,"typeName","wg.cosmo.node.v1.SSLConfiguration"),_(mo,"fields",C.util.newFieldList(()=>[{no:1,name:"enabled",kind:"scalar",T:8}]));var qj=mo,No=class No extends we{constructor(n){super();_(this,"version",0);_(this,"service","");_(this,"operationMappings",[]);_(this,"entityMappings",[]);_(this,"typeFieldMappings",[]);_(this,"enumMappings",[]);_(this,"resolveMappings",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new No().fromBinary(n,r)}static fromJson(n,r){return new No().fromJson(n,r)}static fromJsonString(n,r){return new No().fromJsonString(n,r)}static equals(n,r){return C.util.equals(No,n,r)}};_(No,"runtime",C),_(No,"typeName","wg.cosmo.node.v1.GRPCMapping"),_(No,"fields",C.util.newFieldList(()=>[{no:1,name:"version",kind:"scalar",T:5},{no:2,name:"service",kind:"scalar",T:9},{no:3,name:"operation_mappings",kind:"message",T:Mb,repeated:!0},{no:4,name:"entity_mappings",kind:"message",T:xb,repeated:!0},{no:5,name:"type_field_mappings",kind:"message",T:qb,repeated:!0},{no:6,name:"enum_mappings",kind:"message",T:jb,repeated:!0},{no:7,name:"resolve_mappings",kind:"message",T:Ub,repeated:!0}]));var Bb=No,To=class To extends we{constructor(n){super();_(this,"type",Sp.UNSPECIFIED);_(this,"lookupMapping");_(this,"rpc","");_(this,"request","");_(this,"response","");C.util.initPartial(n,this)}static fromBinary(n,r){return new To().fromBinary(n,r)}static fromJson(n,r){return new To().fromJson(n,r)}static fromJsonString(n,r){return new To().fromJsonString(n,r)}static equals(n,r){return C.util.equals(To,n,r)}};_(To,"runtime",C),_(To,"typeName","wg.cosmo.node.v1.LookupMapping"),_(To,"fields",C.util.newFieldList(()=>[{no:1,name:"type",kind:"enum",T:C.getEnumType(Sp)},{no:2,name:"lookup_mapping",kind:"message",T:kb},{no:3,name:"rpc",kind:"scalar",T:9},{no:4,name:"request",kind:"scalar",T:9},{no:5,name:"response",kind:"scalar",T:9}]));var Ub=To,Eo=class Eo extends we{constructor(n){super();_(this,"type","");_(this,"fieldMapping");C.util.initPartial(n,this)}static fromBinary(n,r){return new Eo().fromBinary(n,r)}static fromJson(n,r){return new Eo().fromJson(n,r)}static fromJsonString(n,r){return new Eo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Eo,n,r)}};_(Eo,"runtime",C),_(Eo,"typeName","wg.cosmo.node.v1.LookupFieldMapping"),_(Eo,"fields",C.util.newFieldList(()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"field_mapping",kind:"message",T:Sh}]));var kb=Eo,ho=class ho extends we{constructor(n){super();_(this,"type",Dp.UNSPECIFIED);_(this,"original","");_(this,"mapped","");_(this,"request","");_(this,"response","");C.util.initPartial(n,this)}static fromBinary(n,r){return new ho().fromBinary(n,r)}static fromJson(n,r){return new ho().fromJson(n,r)}static fromJsonString(n,r){return new ho().fromJsonString(n,r)}static equals(n,r){return C.util.equals(ho,n,r)}};_(ho,"runtime",C),_(ho,"typeName","wg.cosmo.node.v1.OperationMapping"),_(ho,"fields",C.util.newFieldList(()=>[{no:1,name:"type",kind:"enum",T:C.getEnumType(Dp)},{no:2,name:"original",kind:"scalar",T:9},{no:3,name:"mapped",kind:"scalar",T:9},{no:4,name:"request",kind:"scalar",T:9},{no:5,name:"response",kind:"scalar",T:9}]));var Mb=ho,yo=class yo extends we{constructor(n){super();_(this,"typeName","");_(this,"kind","");_(this,"key","");_(this,"rpc","");_(this,"request","");_(this,"response","");C.util.initPartial(n,this)}static fromBinary(n,r){return new yo().fromBinary(n,r)}static fromJson(n,r){return new yo().fromJson(n,r)}static fromJsonString(n,r){return new yo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(yo,n,r)}};_(yo,"runtime",C),_(yo,"typeName","wg.cosmo.node.v1.EntityMapping"),_(yo,"fields",C.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"kind",kind:"scalar",T:9},{no:3,name:"key",kind:"scalar",T:9},{no:4,name:"rpc",kind:"scalar",T:9},{no:5,name:"request",kind:"scalar",T:9},{no:6,name:"response",kind:"scalar",T:9}]));var xb=yo,Io=class Io extends we{constructor(n){super();_(this,"type","");_(this,"fieldMappings",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new Io().fromBinary(n,r)}static fromJson(n,r){return new Io().fromJson(n,r)}static fromJsonString(n,r){return new Io().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Io,n,r)}};_(Io,"runtime",C),_(Io,"typeName","wg.cosmo.node.v1.TypeFieldMapping"),_(Io,"fields",C.util.newFieldList(()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"field_mappings",kind:"message",T:Sh,repeated:!0}]));var qb=Io,go=class go extends we{constructor(n){super();_(this,"original","");_(this,"mapped","");_(this,"argumentMappings",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new go().fromBinary(n,r)}static fromJson(n,r){return new go().fromJson(n,r)}static fromJsonString(n,r){return new go().fromJsonString(n,r)}static equals(n,r){return C.util.equals(go,n,r)}};_(go,"runtime",C),_(go,"typeName","wg.cosmo.node.v1.FieldMapping"),_(go,"fields",C.util.newFieldList(()=>[{no:1,name:"original",kind:"scalar",T:9},{no:2,name:"mapped",kind:"scalar",T:9},{no:3,name:"argument_mappings",kind:"message",T:Vb,repeated:!0}]));var Sh=go,_o=class _o extends we{constructor(n){super();_(this,"original","");_(this,"mapped","");C.util.initPartial(n,this)}static fromBinary(n,r){return new _o().fromBinary(n,r)}static fromJson(n,r){return new _o().fromJson(n,r)}static fromJsonString(n,r){return new _o().fromJsonString(n,r)}static equals(n,r){return C.util.equals(_o,n,r)}};_(_o,"runtime",C),_(_o,"typeName","wg.cosmo.node.v1.ArgumentMapping"),_(_o,"fields",C.util.newFieldList(()=>[{no:1,name:"original",kind:"scalar",T:9},{no:2,name:"mapped",kind:"scalar",T:9}]));var Vb=_o,vo=class vo extends we{constructor(n){super();_(this,"type","");_(this,"values",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new vo().fromBinary(n,r)}static fromJson(n,r){return new vo().fromJson(n,r)}static fromJsonString(n,r){return new vo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(vo,n,r)}};_(vo,"runtime",C),_(vo,"typeName","wg.cosmo.node.v1.EnumMapping"),_(vo,"fields",C.util.newFieldList(()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"values",kind:"message",T:Kb,repeated:!0}]));var jb=vo,Oo=class Oo extends we{constructor(n){super();_(this,"original","");_(this,"mapped","");C.util.initPartial(n,this)}static fromBinary(n,r){return new Oo().fromBinary(n,r)}static fromJson(n,r){return new Oo().fromJson(n,r)}static fromJsonString(n,r){return new Oo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Oo,n,r)}};_(Oo,"runtime",C),_(Oo,"typeName","wg.cosmo.node.v1.EnumValueMapping"),_(Oo,"fields",C.util.newFieldList(()=>[{no:1,name:"original",kind:"scalar",T:9},{no:2,name:"mapped",kind:"scalar",T:9}]));var Kb=Oo,So=class So extends we{constructor(n){super();_(this,"consumerName","");_(this,"streamName","");_(this,"consumerInactiveThreshold",0);C.util.initPartial(n,this)}static fromBinary(n,r){return new So().fromBinary(n,r)}static fromJson(n,r){return new So().fromJson(n,r)}static fromJsonString(n,r){return new So().fromJsonString(n,r)}static equals(n,r){return C.util.equals(So,n,r)}};_(So,"runtime",C),_(So,"typeName","wg.cosmo.node.v1.NatsStreamConfiguration"),_(So,"fields",C.util.newFieldList(()=>[{no:1,name:"consumer_name",kind:"scalar",T:9},{no:2,name:"stream_name",kind:"scalar",T:9},{no:3,name:"consumer_inactive_threshold",kind:"scalar",T:5}]));var Up=So,Do=class Do extends we{constructor(n){super();_(this,"engineEventConfiguration");_(this,"subjects",[]);_(this,"streamConfiguration");C.util.initPartial(n,this)}static fromBinary(n,r){return new Do().fromBinary(n,r)}static fromJson(n,r){return new Do().fromJson(n,r)}static fromJsonString(n,r){return new Do().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Do,n,r)}};_(Do,"runtime",C),_(Do,"typeName","wg.cosmo.node.v1.NatsEventConfiguration"),_(Do,"fields",C.util.newFieldList(()=>[{no:1,name:"engine_event_configuration",kind:"message",T:Ho},{no:2,name:"subjects",kind:"scalar",T:9,repeated:!0},{no:3,name:"stream_configuration",kind:"message",T:Up}]));var kp=Do,bo=class bo extends we{constructor(n){super();_(this,"engineEventConfiguration");_(this,"topics",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new bo().fromBinary(n,r)}static fromJson(n,r){return new bo().fromJson(n,r)}static fromJsonString(n,r){return new bo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(bo,n,r)}};_(bo,"runtime",C),_(bo,"typeName","wg.cosmo.node.v1.KafkaEventConfiguration"),_(bo,"fields",C.util.newFieldList(()=>[{no:1,name:"engine_event_configuration",kind:"message",T:Ho},{no:2,name:"topics",kind:"scalar",T:9,repeated:!0}]));var Mp=bo,Ao=class Ao extends we{constructor(n){super();_(this,"engineEventConfiguration");_(this,"channels",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new Ao().fromBinary(n,r)}static fromJson(n,r){return new Ao().fromJson(n,r)}static fromJsonString(n,r){return new Ao().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Ao,n,r)}};_(Ao,"runtime",C),_(Ao,"typeName","wg.cosmo.node.v1.RedisEventConfiguration"),_(Ao,"fields",C.util.newFieldList(()=>[{no:1,name:"engine_event_configuration",kind:"message",T:Ho},{no:2,name:"channels",kind:"scalar",T:9,repeated:!0}]));var xp=Ao,Ro=class Ro extends we{constructor(n){super();_(this,"providerId","");_(this,"type",Jo.PUBLISH);_(this,"typeName","");_(this,"fieldName","");C.util.initPartial(n,this)}static fromBinary(n,r){return new Ro().fromBinary(n,r)}static fromJson(n,r){return new Ro().fromJson(n,r)}static fromJsonString(n,r){return new Ro().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Ro,n,r)}};_(Ro,"runtime",C),_(Ro,"typeName","wg.cosmo.node.v1.EngineEventConfiguration"),_(Ro,"fields",C.util.newFieldList(()=>[{no:1,name:"provider_id",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:C.getEnumType(Jo)},{no:3,name:"type_name",kind:"scalar",T:9},{no:4,name:"field_name",kind:"scalar",T:9}]));var Ho=Ro,Po=class Po extends we{constructor(n){super();_(this,"nats",[]);_(this,"kafka",[]);_(this,"redis",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new Po().fromBinary(n,r)}static fromJson(n,r){return new Po().fromJson(n,r)}static fromJsonString(n,r){return new Po().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Po,n,r)}};_(Po,"runtime",C),_(Po,"typeName","wg.cosmo.node.v1.DataSourceCustomEvents"),_(Po,"fields",C.util.newFieldList(()=>[{no:1,name:"nats",kind:"message",T:kp,repeated:!0},{no:2,name:"kafka",kind:"message",T:Mp,repeated:!0},{no:3,name:"redis",kind:"message",T:xp,repeated:!0}]));var $c=Po,Fo=class Fo extends we{constructor(n){super();_(this,"data");C.util.initPartial(n,this)}static fromBinary(n,r){return new Fo().fromBinary(n,r)}static fromJson(n,r){return new Fo().fromJson(n,r)}static fromJsonString(n,r){return new Fo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Fo,n,r)}};_(Fo,"runtime",C),_(Fo,"typeName","wg.cosmo.node.v1.DataSourceCustom_Static"),_(Fo,"fields",C.util.newFieldList(()=>[{no:1,name:"data",kind:"message",T:$r}]));var Gb=Fo,wo=class wo extends we{constructor(n){super();_(this,"kind",Lu.STATIC_CONFIGURATION_VARIABLE);_(this,"staticVariableContent","");_(this,"environmentVariableName","");_(this,"environmentVariableDefaultValue","");_(this,"placeholderVariableName","");C.util.initPartial(n,this)}static fromBinary(n,r){return new wo().fromBinary(n,r)}static fromJson(n,r){return new wo().fromJson(n,r)}static fromJsonString(n,r){return new wo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(wo,n,r)}};_(wo,"runtime",C),_(wo,"typeName","wg.cosmo.node.v1.ConfigurationVariable"),_(wo,"fields",C.util.newFieldList(()=>[{no:1,name:"kind",kind:"enum",T:C.getEnumType(Lu)},{no:2,name:"static_variable_content",kind:"scalar",T:9},{no:3,name:"environment_variable_name",kind:"scalar",T:9},{no:4,name:"environment_variable_default_value",kind:"scalar",T:9},{no:5,name:"placeholder_variable_name",kind:"scalar",T:9}]));var $r=wo,Lo=class Lo extends we{constructor(n){super();_(this,"directiveName","");_(this,"renameTo","");C.util.initPartial(n,this)}static fromBinary(n,r){return new Lo().fromBinary(n,r)}static fromJson(n,r){return new Lo().fromJson(n,r)}static fromJsonString(n,r){return new Lo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Lo,n,r)}};_(Lo,"runtime",C),_(Lo,"typeName","wg.cosmo.node.v1.DirectiveConfiguration"),_(Lo,"fields",C.util.newFieldList(()=>[{no:1,name:"directive_name",kind:"scalar",T:9},{no:2,name:"rename_to",kind:"scalar",T:9}]));var $b=Lo,Co=class Co extends we{constructor(n){super();_(this,"name","");_(this,"value","");C.util.initPartial(n,this)}static fromBinary(n,r){return new Co().fromBinary(n,r)}static fromJson(n,r){return new Co().fromJson(n,r)}static fromJsonString(n,r){return new Co().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Co,n,r)}};_(Co,"runtime",C),_(Co,"typeName","wg.cosmo.node.v1.URLQueryConfiguration"),_(Co,"fields",C.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"value",kind:"scalar",T:9}]));var Qb=Co,Bo=class Bo extends we{constructor(n){super();_(this,"values",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new Bo().fromBinary(n,r)}static fromJson(n,r){return new Bo().fromJson(n,r)}static fromJsonString(n,r){return new Bo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Bo,n,r)}};_(Bo,"runtime",C),_(Bo,"typeName","wg.cosmo.node.v1.HTTPHeader"),_(Bo,"fields",C.util.newFieldList(()=>[{no:1,name:"values",kind:"message",T:$r,repeated:!0}]));var Yb=Bo,Uo=class Uo extends we{constructor(n){super();_(this,"key");_(this,"cert");_(this,"insecureSkipVerify",!1);C.util.initPartial(n,this)}static fromBinary(n,r){return new Uo().fromBinary(n,r)}static fromJson(n,r){return new Uo().fromJson(n,r)}static fromJsonString(n,r){return new Uo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Uo,n,r)}};_(Uo,"runtime",C),_(Uo,"typeName","wg.cosmo.node.v1.MTLSConfiguration"),_(Uo,"fields",C.util.newFieldList(()=>[{no:1,name:"key",kind:"message",T:$r},{no:2,name:"cert",kind:"message",T:$r},{no:3,name:"insecureSkipVerify",kind:"scalar",T:8}]));var Jb=Uo,ko=class ko extends we{constructor(n){super();_(this,"enabled",!1);_(this,"url");_(this,"useSSE");_(this,"protocol");_(this,"websocketSubprotocol");C.util.initPartial(n,this)}static fromBinary(n,r){return new ko().fromBinary(n,r)}static fromJson(n,r){return new ko().fromJson(n,r)}static fromJsonString(n,r){return new ko().fromJsonString(n,r)}static equals(n,r){return C.util.equals(ko,n,r)}};_(ko,"runtime",C),_(ko,"typeName","wg.cosmo.node.v1.GraphQLSubscriptionConfiguration"),_(ko,"fields",C.util.newFieldList(()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"url",kind:"message",T:$r},{no:3,name:"useSSE",kind:"scalar",T:8,opt:!0},{no:4,name:"protocol",kind:"enum",T:C.getEnumType(ks),opt:!0},{no:5,name:"websocketSubprotocol",kind:"enum",T:C.getEnumType(Ms),opt:!0}]));var Hb=ko,Mo=class Mo extends we{constructor(n){super();_(this,"enabled",!1);_(this,"serviceSdl","");C.util.initPartial(n,this)}static fromBinary(n,r){return new Mo().fromBinary(n,r)}static fromJson(n,r){return new Mo().fromJson(n,r)}static fromJsonString(n,r){return new Mo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Mo,n,r)}};_(Mo,"runtime",C),_(Mo,"typeName","wg.cosmo.node.v1.GraphQLFederationConfiguration"),_(Mo,"fields",C.util.newFieldList(()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"serviceSdl",kind:"scalar",T:9}]));var zb=Mo,xo=class xo extends we{constructor(n){super();_(this,"key","");C.util.initPartial(n,this)}static fromBinary(n,r){return new xo().fromBinary(n,r)}static fromJson(n,r){return new xo().fromJson(n,r)}static fromJsonString(n,r){return new xo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(xo,n,r)}};_(xo,"runtime",C),_(xo,"typeName","wg.cosmo.node.v1.InternedString"),_(xo,"fields",C.util.newFieldList(()=>[{no:1,name:"key",kind:"scalar",T:9}]));var qp=xo,qo=class qo extends we{constructor(n){super();_(this,"typeName","");_(this,"fieldName","");C.util.initPartial(n,this)}static fromBinary(n,r){return new qo().fromBinary(n,r)}static fromJson(n,r){return new qo().fromJson(n,r)}static fromJsonString(n,r){return new qo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(qo,n,r)}};_(qo,"runtime",C),_(qo,"typeName","wg.cosmo.node.v1.SingleTypeField"),_(qo,"fields",C.util.newFieldList(()=>[{no:1,name:"type_name",kind:"scalar",T:9},{no:2,name:"field_name",kind:"scalar",T:9}]));var Wb=qo,Vo=class Vo extends we{constructor(n){super();_(this,"fieldPath",[]);_(this,"json","");C.util.initPartial(n,this)}static fromBinary(n,r){return new Vo().fromBinary(n,r)}static fromJson(n,r){return new Vo().fromJson(n,r)}static fromJsonString(n,r){return new Vo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Vo,n,r)}};_(Vo,"runtime",C),_(Vo,"typeName","wg.cosmo.node.v1.SubscriptionFieldCondition"),_(Vo,"fields",C.util.newFieldList(()=>[{no:1,name:"field_path",kind:"scalar",T:9,repeated:!0},{no:2,name:"json",kind:"scalar",T:9}]));var Vp=Vo,ta=class ta extends we{constructor(n){super();_(this,"and",[]);_(this,"in");_(this,"not");_(this,"or",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new ta().fromBinary(n,r)}static fromJson(n,r){return new ta().fromJson(n,r)}static fromJsonString(n,r){return new ta().fromJsonString(n,r)}static equals(n,r){return C.util.equals(ta,n,r)}};_(ta,"runtime",C),_(ta,"typeName","wg.cosmo.node.v1.SubscriptionFilterCondition"),_(ta,"fields",C.util.newFieldList(()=>[{no:1,name:"and",kind:"message",T:ta,repeated:!0},{no:2,name:"in",kind:"message",T:Vp,opt:!0},{no:3,name:"not",kind:"message",T:ta,opt:!0},{no:4,name:"or",kind:"message",T:ta,repeated:!0}]));var Cu=ta,jo=class jo extends we{constructor(n){super();_(this,"operations",[]);C.util.initPartial(n,this)}static fromBinary(n,r){return new jo().fromBinary(n,r)}static fromJson(n,r){return new jo().fromJson(n,r)}static fromJsonString(n,r){return new jo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(jo,n,r)}};_(jo,"runtime",C),_(jo,"typeName","wg.cosmo.node.v1.CacheWarmerOperations"),_(jo,"fields",C.util.newFieldList(()=>[{no:1,name:"operations",kind:"message",T:Xb,repeated:!0}]));var Vj=jo,Ko=class Ko extends we{constructor(n){super();_(this,"request");_(this,"client");C.util.initPartial(n,this)}static fromBinary(n,r){return new Ko().fromBinary(n,r)}static fromJson(n,r){return new Ko().fromJson(n,r)}static fromJsonString(n,r){return new Ko().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Ko,n,r)}};_(Ko,"runtime",C),_(Ko,"typeName","wg.cosmo.node.v1.Operation"),_(Ko,"fields",C.util.newFieldList(()=>[{no:1,name:"request",kind:"message",T:Zb},{no:2,name:"client",kind:"message",T:n0}]));var Xb=Ko,Go=class Go extends we{constructor(n){super();_(this,"operationName","");_(this,"query","");_(this,"extensions");C.util.initPartial(n,this)}static fromBinary(n,r){return new Go().fromBinary(n,r)}static fromJson(n,r){return new Go().fromJson(n,r)}static fromJsonString(n,r){return new Go().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Go,n,r)}};_(Go,"runtime",C),_(Go,"typeName","wg.cosmo.node.v1.OperationRequest"),_(Go,"fields",C.util.newFieldList(()=>[{no:1,name:"operation_name",kind:"scalar",T:9},{no:2,name:"query",kind:"scalar",T:9},{no:3,name:"extensions",kind:"message",T:e0}]));var Zb=Go,$o=class $o extends we{constructor(n){super();_(this,"persistedQuery");C.util.initPartial(n,this)}static fromBinary(n,r){return new $o().fromBinary(n,r)}static fromJson(n,r){return new $o().fromJson(n,r)}static fromJsonString(n,r){return new $o().fromJsonString(n,r)}static equals(n,r){return C.util.equals($o,n,r)}};_($o,"runtime",C),_($o,"typeName","wg.cosmo.node.v1.Extension"),_($o,"fields",C.util.newFieldList(()=>[{no:1,name:"persisted_query",kind:"message",T:t0}]));var e0=$o,Qo=class Qo extends we{constructor(n){super();_(this,"sha256Hash","");_(this,"version",0);C.util.initPartial(n,this)}static fromBinary(n,r){return new Qo().fromBinary(n,r)}static fromJson(n,r){return new Qo().fromJson(n,r)}static fromJsonString(n,r){return new Qo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Qo,n,r)}};_(Qo,"runtime",C),_(Qo,"typeName","wg.cosmo.node.v1.PersistedQuery"),_(Qo,"fields",C.util.newFieldList(()=>[{no:1,name:"sha256_hash",kind:"scalar",T:9},{no:2,name:"version",kind:"scalar",T:5}]));var t0=Qo,Yo=class Yo extends we{constructor(n){super();_(this,"name","");_(this,"version","");C.util.initPartial(n,this)}static fromBinary(n,r){return new Yo().fromBinary(n,r)}static fromJson(n,r){return new Yo().fromJson(n,r)}static fromJsonString(n,r){return new Yo().fromJsonString(n,r)}static equals(n,r){return C.util.equals(Yo,n,r)}};_(Yo,"runtime",C),_(Yo,"typeName","wg.cosmo.node.v1.ClientInfo"),_(Yo,"fields",C.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"version",kind:"scalar",T:9}]));var n0=Yo;m();T();N();function r0(e){return new Error(`Normalization failed to return a ${e}.`)}function jj(e){return new Error(`Invalid router compatibility version "${e}".`)}m();T();N();var hd=ys(ZE(),1);function fpe(e){if(!e.conditions)return;let t=[];for(let n of e.conditions){let r=[];for(let i of n.fieldCoordinatesPath){let a=i.split(".");if(a.length!==2)throw new Error(`fatal: malformed conditional field coordinates "${i}" for field set "${e.selectionSet}".`);r.push(new wp({fieldName:a[1],typeName:a[0]}))}t.push(new Lp({fieldCoordinatesPath:r,fieldPath:n.fieldPath}))}return t}function i0(e,t,n){if(e)for(let r of e){let i=fpe(r);t.push(new Vc(M(M({typeName:n,fieldName:r.fieldName,selectionSet:r.selectionSet},r.disableEntityResolver?{disableEntityResolver:!0}:{}),i?{conditions:i}:{})))}}function a0(e){switch(e){case"publish":return Jo.PUBLISH;case"request":return Jo.REQUEST;case"subscribe":return Jo.SUBSCRIBE}}function Kj(e){var n;let t={rootNodes:[],childNodes:[],keys:[],provides:[],events:new $c({nats:[],kafka:[],redis:[]}),requires:[],entityInterfaces:[],interfaceObjects:[]};for(let r of e.values()){let i=r.typeName,a=[...r.fieldNames],o=new Nd({fieldNames:a,typeName:i});if(r.externalFieldNames&&r.externalFieldNames.size>0&&(o.externalFieldNames=[...r.externalFieldNames]),r.requireFetchReasonsFieldNames&&r.requireFetchReasonsFieldNames.length>0&&(o.requireFetchReasonsFieldNames=[...r.requireFetchReasonsFieldNames]),r.isRootNode?t.rootNodes.push(o):t.childNodes.push(o),r.entityInterfaceConcreteTypeNames){let p=new Td({interfaceTypeName:i,concreteTypeNames:[...r.entityInterfaceConcreteTypeNames]});r.isInterfaceObject?t.interfaceObjects.push(p):t.entityInterfaces.push(p)}i0(r.keys,t.keys,i),i0(r.provides,t.provides,i),i0(r.requires,t.requires,i);let c=[],l=[],d=[];for(let p of(n=r.events)!=null?n:[])switch(p.providerType){case hd.PROVIDER_TYPE_KAFKA:{l.push(new Mp({engineEventConfiguration:new Ho({fieldName:p.fieldName,providerId:p.providerId,type:a0(p.type),typeName:i}),topics:p.topics}));break}case hd.PROVIDER_TYPE_NATS:{c.push(new kp(M({engineEventConfiguration:new Ho({fieldName:p.fieldName,providerId:p.providerId,type:a0(p.type),typeName:i}),subjects:p.subjects},p.streamConfiguration?{streamConfiguration:new Up({consumerInactiveThreshold:p.streamConfiguration.consumerInactiveThreshold,consumerName:p.streamConfiguration.consumerName,streamName:p.streamConfiguration.streamName})}:{})));break}case hd.PROVIDER_TYPE_REDIS:{d.push(new xp({engineEventConfiguration:new Ho({fieldName:p.fieldName,providerId:p.providerId,type:a0(p.type),typeName:i}),channels:p.channels}));break}default:throw new Error("Fatal: Unknown event provider.")}t.events.nats.push(...c),t.events.kafka.push(...l),t.events.redis.push(...d)}return t}function Gj(e){var n,r;let t=[];for(let i of e){let a=i.argumentNames.map(p=>new Rp({name:p,sourceType:jc.FIELD_ARGUMENT})),o=new Fp({argumentsConfiguration:a,fieldName:i.fieldName,typeName:i.typeName}),c=((n=i.requiredScopes)==null?void 0:n.map(p=>new Gc({requiredAndScopes:p})))||[],l=((r=i.requiredScopesByOR)==null?void 0:r.map(p=>new Gc({requiredAndScopes:p})))||[],d=c.length>0;if((i.requiresAuthentication||d)&&(o.authorizationConfiguration=new Pp({requiresAuthentication:i.requiresAuthentication||d,requiredOrScopes:c,requiredOrScopesByOr:l})),i.subscriptionFilterCondition){let p=new Cu;Dh(p,i.subscriptionFilterCondition),o.subscriptionFilterCondition=p}t.push(o)}return t}function Dh(e,t){if(t.and!==void 0){let n=[];for(let r of t.and){let i=new Cu;Dh(i,r),n.push(i)}e.and=n;return}if(t.in!==void 0){e.in=new Vp({fieldPath:t.in.fieldPath,json:JSON.stringify(t.in.values)});return}if(t.not!==void 0){e.not=new Cu,Dh(e.not,t.not);return}if(t.or!==void 0){let n=[];for(let r of t.or){let i=new Cu;Dh(i,r),n.push(i)}e.or=n;return}throw new Error("Fatal: Incoming SubscriptionCondition object was malformed.")}var Qc;(function(e){e[e.Plugin=0]="Plugin",e[e.Standard=1]="Standard",e[e.GRPC=2]="GRPC"})(Qc||(Qc={}));var ppe=(e,t)=>{let n=stringHash(t);return e.stringStorage[n]=t,new qp({key:n})},mpe=e=>{switch(e){case"ws":return ks.GRAPHQL_SUBSCRIPTION_PROTOCOL_WS;case"sse":return ks.GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE;case"sse_post":return ks.GRAPHQL_SUBSCRIPTION_PROTOCOL_SSE_POST}},Npe=e=>{switch(e){case"auto":return Ms.GRAPHQL_WEBSOCKET_SUBPROTOCOL_AUTO;case"graphql-ws":return Ms.GRAPHQL_WEBSOCKET_SUBPROTOCOL_WS;case"graphql-transport-ws":return Ms.GRAPHQL_WEBSOCKET_SUBPROTOCOL_TRANSPORT_WS}},Qj=function(e){if(!yd.ROUTER_COMPATIBILITY_VERSIONS.has(e.routerCompatibilityVersion))throw jj(e.routerCompatibilityVersion);let t=new md({defaultFlushInterval:BigInt(500),datasourceConfigurations:[],fieldConfigurations:[],graphqlSchema:"",stringStorage:{},typeConfigurations:[]});for(let n of e.subgraphs){if(!n.configurationDataByTypeName)throw r0("ConfigurationDataByTypeName");if(!n.schema)throw r0("GraphQLSchema");let r={enabled:!0},i=ppe(t,ZV((0,$j.lexicographicSortSchema)(n.schema))),{childNodes:a,entityInterfaces:o,events:c,interfaceObjects:l,keys:d,provides:p,requires:E,rootNodes:I}=Kj(n.configurationDataByTypeName),v;switch(n.kind){case Qc.Standard:{r.enabled=!0,r.protocol=mpe(n.subscriptionProtocol||"ws"),r.websocketSubprotocol=Npe(n.websocketSubprotocol||"auto"),r.url=new $r({kind:Lu.STATIC_CONFIGURATION_VARIABLE,staticVariableContent:n.subscriptionUrl||n.url});break}case Qc.Plugin:{v=new Ed({mapping:n.mapping,protoSchema:n.protoSchema,plugin:new Bp({name:n.name,version:n.version,imageReference:n.imageReference})});break}case Qc.GRPC:{v=new Ed({mapping:n.mapping,protoSchema:n.protoSchema});break}}let A,U,j;if(c.kafka.length>0||c.nats.length>0||c.redis.length>0){A=wu.PUBSUB,j=new $c({kafka:c.kafka,nats:c.nats,redis:c.redis});let re=ue=>yd.ROOT_TYPE_NAMES.has(ue.typeName),te=0,me=0;for(;te({id:n.id,name:n.name,routingUrl:n.url})),compatibilityVersion:`${e.routerCompatibilityVersion}:${yd.COMPOSITION_VERSION}`})};m();T();N();var Jc=ys(Oe());function Yj(e){let t;try{t=(0,Jc.parse)(e.schema)}catch(n){throw new Error(`could not parse schema for Graph ${e.name}: ${n}`)}return{definitions:t,name:e.name,url:e.url}}function Tpe(e){let t=(0,Yc.federateSubgraphs)({subgraphs:e.map(Yj),version:Yc.LATEST_ROUTER_COMPATIBILITY_VERSION});if(!t.success)throw new Error(`could not federate schema: ${t.errors.map(n=>n.message).join(", ")}`);return{fieldConfigurations:t.fieldConfigurations,sdl:(0,Jc.print)(t.federatedGraphAST)}}function Epe(e){let t=(0,Yc.federateSubgraphs)({subgraphs:e.map(Yj),version:Yc.LATEST_ROUTER_COMPATIBILITY_VERSION});if(!t.success)throw new Error(`could not federate schema: ${t.errors.map(r=>r.message).join(", ")}`);return Qj({federatedClientSDL:(0,Jc.printSchema)(t.federatedGraphClientSchema),federatedSDL:(0,Jc.printSchema)(t.federatedGraphSchema),fieldConfigurations:t.fieldConfigurations,routerCompatibilityVersion:Yc.LATEST_ROUTER_COMPATIBILITY_VERSION,schemaVersionId:"",subgraphs:e.map((r,i)=>{var l,d;let a=t.subgraphConfigBySubgraphName.get(r.name),o=a==null?void 0:a.schema,c=a==null?void 0:a.configurationDataByTypeName;return{kind:Qc.Standard,id:`${i}`,name:r.name,url:db(r.url),sdl:r.schema,subscriptionUrl:db((l=r.subscription_url)!=null?l:r.url),subscriptionProtocol:(d=r.subscription_protocol)!=null?d:"ws",websocketSubprotocol:r.subscription_protocol==="ws"?r.websocketSubprotocol||"auto":void 0,schema:o,configurationDataByTypeName:c}})}).toJsonString()}return wm(hpe);})(); diff --git a/composition/src/subgraph/types.ts b/composition/src/subgraph/types.ts index 500b723d9c..c1635da23d 100644 --- a/composition/src/subgraph/types.ts +++ b/composition/src/subgraph/types.ts @@ -6,11 +6,12 @@ import { ParentDefinitionData, PersistedDirectiveDefinitionData, } from '../schema-building/types'; -import { DirectiveName, TypeName } from '../types/types'; +import { DirectiveName, FieldName, SubgraphName, TypeName } from '../types/types'; +import { SchemaDefinitionNode, SchemaExtensionNode } from 'graphql/index'; export type Subgraph = { definitions: DocumentNode; - name: string; + name: SubgraphName; url: string; }; @@ -20,6 +21,7 @@ export type SubgraphConfig = { isVersionTwo: boolean; parentDefinitionDataByTypeName: Map; schema: GraphQLSchema; + schemaNode?: SchemaDefinitionNode | SchemaExtensionNode; }; export type InternalSubgraph = { @@ -29,12 +31,13 @@ export type InternalSubgraph = { directiveDefinitionByName: Map; entityInterfaces: Map; isVersionTwo: boolean; - keyFieldNamesByParentTypeName: Map>; + keyFieldNamesByParentTypeName: Map>; name: string; operationTypes: Map; - overriddenFieldNamesByParentTypeName: Map>; + overriddenFieldNamesByParentTypeName: Map>; parentDefinitionDataByTypeName: Map; persistedDirectiveDefinitionDataByDirectiveName: Map; schema: GraphQLSchema; + schemaNode?: SchemaDefinitionNode | SchemaExtensionNode; url: string; }; diff --git a/composition/src/v1/federation/federation-factory.ts b/composition/src/v1/federation/federation-factory.ts index ce45789c71..3982bdbefe 100644 --- a/composition/src/v1/federation/federation-factory.ts +++ b/composition/src/v1/federation/federation-factory.ts @@ -268,7 +268,7 @@ export class FederationFactory { inaccessibleCoords = new Set(); inaccessibleRequiredInputValueErrorByCoords = new Map(); internalGraph: Graph; - internalSubgraphBySubgraphName: Map; + internalSubgraphBySubgraphName: Map; invalidORScopesCoords = new Set(); isMaxDepth = false; isVersionTwo = false; @@ -2884,14 +2884,23 @@ export class FederationFactory { }, { assumeValid: true, assumeValidSDL: true }, ); - const subgraphConfigBySubgraphName = new Map(); - for (const subgraph of this.internalSubgraphBySubgraphName.values()) { - subgraphConfigBySubgraphName.set(subgraph.name, { - configurationDataByTypeName: subgraph.configurationDataByTypeName, - directiveDefinitionByName: subgraph.directiveDefinitionByName, - isVersionTwo: subgraph.isVersionTwo, - parentDefinitionDataByTypeName: subgraph.parentDefinitionDataByTypeName, - schema: subgraph.schema, + const subgraphConfigBySubgraphName = new Map(); + for (const { + configurationDataByTypeName, + directiveDefinitionByName, + isVersionTwo, + name, + parentDefinitionDataByTypeName, + schema, + schemaNode, + } of this.internalSubgraphBySubgraphName.values()) { + subgraphConfigBySubgraphName.set(name, { + configurationDataByTypeName: configurationDataByTypeName, + directiveDefinitionByName: directiveDefinitionByName, + isVersionTwo: isVersionTwo, + parentDefinitionDataByTypeName: parentDefinitionDataByTypeName, + schema: schema, + schemaNode, }); } for (const authorizationData of this.authorizationDataByParentTypeName.values()) { @@ -3177,14 +3186,23 @@ export class FederationFactory { }, { assumeValid: true, assumeValidSDL: true }, ); - const subgraphConfigBySubgraphName = new Map(); - for (const subgraph of this.internalSubgraphBySubgraphName.values()) { - subgraphConfigBySubgraphName.set(subgraph.name, { - configurationDataByTypeName: subgraph.configurationDataByTypeName, - directiveDefinitionByName: subgraph.directiveDefinitionByName, - isVersionTwo: subgraph.isVersionTwo, - parentDefinitionDataByTypeName: subgraph.parentDefinitionDataByTypeName, - schema: subgraph.schema, + const subgraphConfigBySubgraphName = new Map(); + for (const { + configurationDataByTypeName, + directiveDefinitionByName, + isVersionTwo, + name, + parentDefinitionDataByTypeName, + schema, + schemaNode, + } of this.internalSubgraphBySubgraphName.values()) { + subgraphConfigBySubgraphName.set(name, { + configurationDataByTypeName, + directiveDefinitionByName, + isVersionTwo, + parentDefinitionDataByTypeName, + schema, + schemaNode, }); } for (const authorizationData of this.authorizationDataByParentTypeName.values()) { diff --git a/composition/src/v1/normalization/normalization-factory.ts b/composition/src/v1/normalization/normalization-factory.ts index 7bceb35f53..7c10c00c43 100644 --- a/composition/src/v1/normalization/normalization-factory.ts +++ b/composition/src/v1/normalization/normalization-factory.ts @@ -3804,19 +3804,19 @@ export class NormalizationFactory { } export function batchNormalize(subgraphs: Subgraph[]): BatchNormalizationResult { - const authorizationDataByParentTypeName = new Map(); - const concreteTypeNamesByAbstractTypeName = new Map>(); - const entityDataByTypeName = new Map(); - const internalSubgraphBySubgraphName = new Map(); + const authorizationDataByParentTypeName = new Map(); + const concreteTypeNamesByAbstractTypeName = new Map>(); + const entityDataByTypeName = new Map(); + const internalSubgraphBySubgraphName = new Map(); const allOverridesByTargetSubgraphName = new Map>>(); const overrideSourceSubgraphNamesByFieldPath = new Map(); const duplicateOverriddenFieldPaths = new Set(); - const parentDefinitionDataMapsBySubgraphName = new Map>(); - const subgraphNames = new Set(); - const nonUniqueSubgraphNames = new Set(); - const invalidNameErrorMessages: string[] = []; + const parentDefinitionDataMapsBySubgraphName = new Map>(); + const subgraphNames = new Set(); + const nonUniqueSubgraphNames = new Set(); + const invalidNameErrorMessages: Array = []; const invalidORScopesCoords = new Set(); - const fieldCoordsByNamedTypeName = new Map>(); + const fieldCoordsByNamedTypeName = new Map>(); const warnings: Array = []; const validationErrors: Array = []; // Record the subgraph names first, so that subgraph references can be validated @@ -3893,11 +3893,12 @@ export function batchNormalize(subgraphs: Subgraph[]): BatchNormalizationResult keyFieldNamesByParentTypeName: normalizationResult.keyFieldNamesByParentTypeName, name: subgraphName, operationTypes: normalizationResult.operationTypes, - overriddenFieldNamesByParentTypeName: new Map>(), + overriddenFieldNamesByParentTypeName: new Map>(), parentDefinitionDataByTypeName: normalizationResult.parentDefinitionDataByTypeName, persistedDirectiveDefinitionDataByDirectiveName: normalizationResult.persistedDirectiveDefinitionDataByDirectiveName, schema: normalizationResult.schema, + schemaNode: normalizationResult.schemaNode, url: subgraph.url, }); } diff --git a/composition/tests/v1/federation-factory.test.ts b/composition/tests/v1/federation-factory.test.ts index fddc49c6ed..16a8af5bc2 100644 --- a/composition/tests/v1/federation-factory.test.ts +++ b/composition/tests/v1/federation-factory.test.ts @@ -13,6 +13,8 @@ import { SCALAR, ScalarDefinitionData, SHAREABLE, + stringToNamedTypeNode, + stringToNameNode, Subgraph, SubgraphName, } from '../../src'; @@ -1023,7 +1025,10 @@ describe('FederationFactory tests', () => { }); test('that renaming a root type also renames field return types of the same type #2.1', () => { - const { federatedGraphSchema } = federateSubgraphsSuccess([subgraphV, subgraphX], ROUTER_COMPATIBILITY_VERSION_ONE); + const { federatedGraphSchema, subgraphConfigBySubgraphName } = federateSubgraphsSuccess( + [subgraphV, subgraphX], + ROUTER_COMPATIBILITY_VERSION_ONE, + ); expect(schemaToSortedNormalizedString(federatedGraphSchema)).toStrictEqual( normalizeString( SCHEMA_QUERY_DEFINITION + @@ -1047,6 +1052,20 @@ describe('FederationFactory tests', () => { `, ), ); + const xConfig = subgraphConfigBySubgraphName.get(subgraphX.name); + expect(xConfig).toBeDefined(); + expect(xConfig!.schemaNode).toStrictEqual({ + description: undefined, + directives: [], + kind: Kind.SCHEMA_DEFINITION, + operationTypes: [ + { + kind: Kind.OPERATION_TYPE_DEFINITION, + operation: 'query', + type: stringToNamedTypeNode('Queries'), + }, + ], + }); }); test('that renaming a root type also renames field return types of the same type #2.2', () => {