"use strict";(globalThis.webpackChunkwp_graphql=globalThis.webpackChunkwp_graphql||[]).push([[385],{8385:(e,n,r)=>{r.r(n);var t=r(3338),a=r(5549),i=(r(166),r(1609),r(5795),Object.defineProperty),s=(e,n)=>i(e,"name",{value:n,configurable:!0});function o(e){c=e,u=e.length,l=d=f=-1,O(),x();const n=b();return g("EOF"),n}let c,u,l,d,f,p,h;function b(){const e=l,n=[];if(g("{"),!E("}")){do{n.push(m())}while(E(","));g("}")}return{kind:"Object",start:e,end:f,members:n}}function m(){const e=l,n="String"===h?y():null;g("String"),g(":");const r=v();return{kind:"Member",start:e,end:f,key:n,value:r}}function k(){const e=l,n=[];if(g("["),!E("]")){do{n.push(v())}while(E(","));g("]")}return{kind:"Array",start:e,end:f,values:n}}function v(){switch(h){case"[":return k();case"{":return b();case"String":case"Number":case"Boolean":case"Null":const e=y();return x(),e}g("Value")}function y(){return{kind:h,start:l,end:d,value:JSON.parse(c.slice(l,d))}}function g(e){if(h===e)return void x();let n;if("EOF"===h)n="[end of file]";else if(d-l>1)n="`"+c.slice(l,d)+"`";else{const e=c.slice(l).match(/^.+?\b/);n="`"+(e?e[0]:c[l])+"`"}throw w(`Expected ${e} but found ${n}.`)}s(o,"jsonParse"),s(b,"parseObj"),s(m,"parseMember"),s(k,"parseArr"),s(v,"parseVal"),s(y,"curToken"),s(g,"expect");class N extends Error{constructor(e,n){super(e),this.position=n}}function w(e){return new N(e,{start:l,end:d})}function E(e){if(h===e)return x(),!0}function O(){return d<u&&(d++,p=d===u?0:c.charCodeAt(d)),p}function x(){for(f=d;9===p||10===p||13===p||32===p;)O();if(0!==p){switch(l=d,p){case 34:return h="String",S();case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return h="Number",$();case 102:if("false"!==c.slice(l,l+5))break;return d+=4,O(),void(h="Boolean");case 110:if("null"!==c.slice(l,l+4))break;return d+=3,O(),void(h="Null");case 116:if("true"!==c.slice(l,l+4))break;return d+=3,O(),void(h="Boolean")}h=c[l],O()}else h="EOF"}function S(){for(O();34!==p&&p>31;)if(92===p)switch(p=O(),p){case 34:case 47:case 92:case 98:case 102:case 110:case 114:case 116:O();break;case 117:O(),T(),T(),T(),T();break;default:throw w("Bad character escape sequence.")}else{if(d===u)throw w("Unterminated string.");O()}if(34!==p)throw w("Unterminated string.");O()}function T(){if(p>=48&&p<=57||p>=65&&p<=70||p>=97&&p<=102)return O();throw w("Expected hexadecimal digit.")}function $(){45===p&&O(),48===p?O():j(),46===p&&(O(),j()),69!==p&&101!==p||(p=O(),43!==p&&45!==p||O(),j())}function j(){if(p<48||p>57)throw w("Expected decimal digit.");do{O()}while(p>=48&&p<=57)}function F(e,n,r){const t=[];return r.members.forEach((r=>{var a;if(r){const i=null===(a=r.key)||void 0===a?void 0:a.value,s=n[i];s?L(s,r.value).forEach((([n,r])=>{t.push(B(e,n,r))})):t.push(B(e,r.key,`Variable "$${i}" does not appear in any GraphQL query.`))}})),t}function L(e,n){if(!e||!n)return[];if(e instanceof a.GraphQLNonNull)return"Null"===n.kind?[[n,`Type "${e}" is non-nullable and cannot be null.`]]:L(e.ofType,n);if("Null"===n.kind)return[];if(e instanceof a.GraphQLList){const r=e.ofType;return"Array"===n.kind?Q(n.values||[],(e=>L(r,e))):L(r,n)}if(e instanceof a.GraphQLInputObjectType){if("Object"!==n.kind)return[[n,`Type "${e}" must be an Object.`]];const r=Object.create(null),t=Q(n.members,(n=>{var t;const a=null===(t=null==n?void 0:n.key)||void 0===t?void 0:t.value;r[a]=!0;const i=e.getFields()[a];return i?L(i?i.type:void 0,n.value):[[n.key,`Type "${e}" does not have a field "${a}".`]]}));return Object.keys(e.getFields()).forEach((i=>{r[i]||e.getFields()[i].type instanceof a.GraphQLNonNull&&t.push([n,`Object of type "${e}" is missing required field "${i}".`])})),t}return"Boolean"===e.name&&"Boolean"!==n.kind||"String"===e.name&&"String"!==n.kind||"ID"===e.name&&"Number"!==n.kind&&"String"!==n.kind||"Float"===e.name&&"Number"!==n.kind||"Int"===e.name&&("Number"!==n.kind||(0|n.value)!==n.value)||(e instanceof a.GraphQLEnumType||e instanceof a.GraphQLScalarType)&&("String"!==n.kind&&"Number"!==n.kind&&"Boolean"!==n.kind&&"Null"!==n.kind||G(e.parseValue(n.value)))?[[n,`Expected value of type "${e}".`]]:[]}function B(e,n,r){return{message:r,severity:"error",type:"validation",from:e.posFromIndex(n.start),to:e.posFromIndex(n.end)}}function G(e){return null==e||e!=e}function Q(e,n){return Array.prototype.concat.apply([],e.map(n))}s(N,"JSONSyntaxError"),s(w,"syntaxError"),s(E,"skip"),s(O,"ch"),s(x,"lex"),s(S,"readString"),s(T,"readHex"),s($,"readNumber"),s(j,"readDigits"),t.C.registerHelper("lint","graphql-variables",((e,n,r)=>{if(!e)return[];let t;try{t=o(e)}catch(e){if(e instanceof N)return[B(r,e.position,e.message)];throw e}const a=n.variableToType;return a?F(r,a,t):[]})),s(F,"validateVariables"),s(L,"validateValue"),s(B,"lintError"),s(G,"isNullish"),s(Q,"mapCat")}}]);