"use strict";var v=Object.defineProperty;var m=(r,e)=>v(r,"name",{value:e,configurable:!0});const f=require("graphql"),D=require("./codemirror.cjs.js"),u=require("./SchemaReference.cjs.js");require("./info-addon.cjs.js");require("./codemirror.cjs2.js");require("./forEachState.cjs.js");D.CodeMirror.registerHelper("info","graphql",(r,e)=>{var c;if(!e.schema||!r.state)return;const{kind:n,step:a}=r.state,i=u.getTypeInfo(e.schema,r.state);if(n==="Field"&&a===0&&i.fieldDef||n==="AliasedField"&&a===2&&i.fieldDef||n==="ObjectField"&&a===0&&i.fieldDef){const d=document.createElement("div");d.className="CodeMirror-info-header",E(d,i,e);const t=document.createElement("div");return t.append(d),s(t,e,i.fieldDef),t}if(n==="Directive"&&a===1&&i.directiveDef){const d=document.createElement("div");d.className="CodeMirror-info-header",h(d,i,e);const t=document.createElement("div");return t.append(d),s(t,e,i.directiveDef),t}if(n==="Argument"&&a===0&&i.argDef){const d=document.createElement("div");d.className="CodeMirror-info-header",T(d,i,e);const t=document.createElement("div");return t.append(d),s(t,e,i.argDef),t}if(n==="EnumValue"&&(!((c=i.enumValue)===null||c===void 0)&&c.description)){const d=document.createElement("div");d.className="CodeMirror-info-header",g(d,i,e);const t=document.createElement("div");return t.append(d),s(t,e,i.enumValue),t}if(n==="NamedType"&&i.type&&i.type.description){const d=document.createElement("div");d.className="CodeMirror-info-header",o(d,i,e,i.type);const t=document.createElement("div");return t.append(d),s(t,e,i.type),t}});function E(r,e,c){N(r,e,c),p(r,e,c,e.type)}m(E,"renderField");function N(r,e,c){var n;const a=((n=e.fieldDef)===null||n===void 0?void 0:n.name)||"";l(r,a,"field-name",c,u.getFieldReference(e))}m(N,"renderQualifiedField");function h(r,e,c){var n;const a="@"+(((n=e.directiveDef)===null||n===void 0?void 0:n.name)||"");l(r,a,"directive-name",c,u.getDirectiveReference(e))}m(h,"renderDirective");function T(r,e,c){var n;const a=((n=e.argDef)===null||n===void 0?void 0:n.name)||"";l(r,a,"arg-name",c,u.getArgumentReference(e)),p(r,e,c,e.inputType)}m(T,"renderArg");function g(r,e,c){var n;const a=((n=e.enumValue)===null||n===void 0?void 0:n.name)||"";o(r,e,c,e.inputType),l(r,"."),l(r,a,"enum-value",c,u.getEnumValueReference(e))}m(g,"renderEnumValue");function p(r,e,c,n){const a=document.createElement("span");a.className="type-name-pill",n instanceof f.GraphQLNonNull?(o(a,e,c,n.ofType),l(a,"!")):n instanceof f.GraphQLList?(l(a,"["),o(a,e,c,n.ofType),l(a,"]")):l(a,(n==null?void 0:n.name)||"","type-name",c,u.getTypeReference(e,n)),r.append(a)}m(p,"renderTypeAnnotation");function o(r,e,c,n){n instanceof f.GraphQLNonNull?(o(r,e,c,n.ofType),l(r,"!")):n instanceof f.GraphQLList?(l(r,"["),o(r,e,c,n.ofType),l(r,"]")):l(r,(n==null?void 0:n.name)||"","type-name",c,u.getTypeReference(e,n))}m(o,"renderType");function s(r,e,c){const{description:n}=c;if(n){const a=document.createElement("div");a.className="info-description",e.renderDescription?a.innerHTML=e.renderDescription(n):a.append(document.createTextNode(n)),r.append(a)}L(r,e,c)}m(s,"renderDescription");function L(r,e,c){const n=c.deprecationReason;if(n){const a=document.createElement("div");a.className="info-deprecation",r.append(a);const i=document.createElement("span");i.className="info-deprecation-label",i.append(document.createTextNode("Deprecated")),a.append(i);const d=document.createElement("div");d.className="info-deprecation-reason",e.renderDescription?d.innerHTML=e.renderDescription(n):d.append(document.createTextNode(n)),a.append(d)}}m(L,"renderDeprecation");function l(r,e,c="",n={onClick:null},a=null){if(c){const{onClick:i}=n;let d;i?(d=document.createElement("a"),d.href="javascript:void 0",d.addEventListener("click",t=>{t.preventDefault(),i(a,t)})):d=document.createElement("span"),d.className=c,d.append(document.createTextNode(e)),r.append(d)}else r.append(document.createTextNode(e))}m(l,"text");
//# sourceMappingURL=info.cjs.js.map
