import {
  init_cjs_shims
} from "./chunk-7GH3YGSC.js";

// ../../node_modules/@urql/core/dist/urql-core.mjs
init_cjs_shims();

// ../../node_modules/@0no-co/graphql.web/dist/graphql.web.mjs
init_cjs_shims();
var e = {
  NAME: "Name",
  DOCUMENT: "Document",
  OPERATION_DEFINITION: "OperationDefinition",
  VARIABLE_DEFINITION: "VariableDefinition",
  SELECTION_SET: "SelectionSet",
  FIELD: "Field",
  ARGUMENT: "Argument",
  FRAGMENT_SPREAD: "FragmentSpread",
  INLINE_FRAGMENT: "InlineFragment",
  FRAGMENT_DEFINITION: "FragmentDefinition",
  VARIABLE: "Variable",
  INT: "IntValue",
  FLOAT: "FloatValue",
  STRING: "StringValue",
  BOOLEAN: "BooleanValue",
  NULL: "NullValue",
  ENUM: "EnumValue",
  LIST: "ListValue",
  OBJECT: "ObjectValue",
  OBJECT_FIELD: "ObjectField",
  DIRECTIVE: "Directive",
  NAMED_TYPE: "NamedType",
  LIST_TYPE: "ListType",
  NON_NULL_TYPE: "NonNullType"
};
var GraphQLError = class extends Error {
  constructor(e2, r, i2, n2, a2, t2, o2) {
    super(e2);
    this.name = "GraphQLError";
    this.message = e2;
    if (a2) {
      this.path = a2;
    }
    if (r) {
      this.nodes = Array.isArray(r) ? r : [r];
    }
    if (i2) {
      this.source = i2;
    }
    if (n2) {
      this.positions = n2;
    }
    if (t2) {
      this.originalError = t2;
    }
    var l2 = o2;
    if (!l2 && t2) {
      var u3 = t2.extensions;
      if (u3 && "object" == typeof u3) {
        l2 = u3;
      }
    }
    this.extensions = l2 || {};
  }
  toJSON() {
    return {
      ...this,
      message: this.message
    };
  }
  toString() {
    return this.message;
  }
  get [Symbol.toStringTag]() {
    return "GraphQLError";
  }
};
var i;
var n;
function error(e2) {
  return new GraphQLError(`Syntax Error: Unexpected token at ${n} in ${e2}`);
}
function advance(e2) {
  e2.lastIndex = n;
  if (e2.test(i)) {
    return i.slice(n, n = e2.lastIndex);
  }
}
var a = / +(?=[^\s])/y;
function blockString(e2) {
  var r = e2.split("\n");
  var i2 = "";
  var n2 = 0;
  var t2 = 0;
  var o2 = r.length - 1;
  for (var l2 = 0; l2 < r.length; l2++) {
    a.lastIndex = 0;
    if (a.test(r[l2])) {
      if (l2 && (!n2 || a.lastIndex < n2)) {
        n2 = a.lastIndex;
      }
      t2 = t2 || l2;
      o2 = l2;
    }
  }
  for (var u3 = t2; u3 <= o2; u3++) {
    if (u3 !== t2) {
      i2 += "\n";
    }
    i2 += r[u3].slice(n2).replace(/\\"""/g, '"""');
  }
  return i2;
}
function ignored() {
  for (var e2 = 0 | i.charCodeAt(n++); 9 === e2 || 10 === e2 || 13 === e2 || 32 === e2 || 35 === e2 || 44 === e2 || 65279 === e2; e2 = 0 | i.charCodeAt(n++)) {
    if (35 === e2) {
      while (10 !== (e2 = i.charCodeAt(n++)) && 13 !== e2) {
      }
    }
  }
  n--;
}
var t = /[_A-Za-z]\w*/y;
function name() {
  var e2;
  if (e2 = advance(t)) {
    return {
      kind: "Name",
      value: e2
    };
  }
}
var o = /(?:null|true|false)/y;
var l = /\$[_A-Za-z]\w*/y;
var u = /-?\d+/y;
var v = /(?:\.\d+)?[eE][+-]?\d+|\.\d+/y;
var d = /\\/g;
var s = /"""(?:"""|(?:[\s\S]*?[^\\])""")/y;
var c = /"(?:"|[^\r\n]*?[^\\]")/y;
function value(e2) {
  var r;
  var a2;
  if (a2 = advance(o)) {
    r = "null" === a2 ? {
      kind: "NullValue"
    } : {
      kind: "BooleanValue",
      value: "true" === a2
    };
  } else if (!e2 && (a2 = advance(l))) {
    r = {
      kind: "Variable",
      name: {
        kind: "Name",
        value: a2.slice(1)
      }
    };
  } else if (a2 = advance(u)) {
    var f2 = a2;
    if (a2 = advance(v)) {
      r = {
        kind: "FloatValue",
        value: f2 + a2
      };
    } else {
      r = {
        kind: "IntValue",
        value: f2
      };
    }
  } else if (a2 = advance(t)) {
    r = {
      kind: "EnumValue",
      value: a2
    };
  } else if (a2 = advance(s)) {
    r = {
      kind: "StringValue",
      value: blockString(a2.slice(3, -3)),
      block: true
    };
  } else if (a2 = advance(c)) {
    r = {
      kind: "StringValue",
      value: d.test(a2) ? JSON.parse(a2) : a2.slice(1, -1),
      block: false
    };
  } else if (r = function list(e3) {
    var r2;
    if (91 === i.charCodeAt(n)) {
      n++;
      ignored();
      var a3 = [];
      while (r2 = value(e3)) {
        a3.push(r2);
      }
      if (93 !== i.charCodeAt(n++)) {
        throw error("ListValue");
      }
      ignored();
      return {
        kind: "ListValue",
        values: a3
      };
    }
  }(e2) || function object(e3) {
    if (123 === i.charCodeAt(n)) {
      n++;
      ignored();
      var r2 = [];
      var a3;
      while (a3 = name()) {
        ignored();
        if (58 !== i.charCodeAt(n++)) {
          throw error("ObjectField");
        }
        ignored();
        var t2 = value(e3);
        if (!t2) {
          throw error("ObjectField");
        }
        r2.push({
          kind: "ObjectField",
          name: a3,
          value: t2
        });
      }
      if (125 !== i.charCodeAt(n++)) {
        throw error("ObjectValue");
      }
      ignored();
      return {
        kind: "ObjectValue",
        fields: r2
      };
    }
  }(e2)) {
    return r;
  }
  ignored();
  return r;
}
function arguments_(e2) {
  var r = [];
  ignored();
  if (40 === i.charCodeAt(n)) {
    n++;
    ignored();
    var a2;
    while (a2 = name()) {
      ignored();
      if (58 !== i.charCodeAt(n++)) {
        throw error("Argument");
      }
      ignored();
      var t2 = value(e2);
      if (!t2) {
        throw error("Argument");
      }
      r.push({
        kind: "Argument",
        name: a2,
        value: t2
      });
    }
    if (!r.length || 41 !== i.charCodeAt(n++)) {
      throw error("Argument");
    }
    ignored();
  }
  return r;
}
function directives(e2) {
  var r = [];
  ignored();
  while (64 === i.charCodeAt(n)) {
    n++;
    var a2 = name();
    if (!a2) {
      throw error("Directive");
    }
    ignored();
    r.push({
      kind: "Directive",
      name: a2,
      arguments: arguments_(e2)
    });
  }
  return r;
}
function field() {
  var e2 = name();
  if (e2) {
    ignored();
    var r;
    if (58 === i.charCodeAt(n)) {
      n++;
      ignored();
      r = e2;
      if (!(e2 = name())) {
        throw error("Field");
      }
      ignored();
    }
    return {
      kind: "Field",
      alias: r,
      name: e2,
      arguments: arguments_(false),
      directives: directives(false),
      selectionSet: selectionSet()
    };
  }
}
function type() {
  var e2;
  ignored();
  if (91 === i.charCodeAt(n)) {
    n++;
    ignored();
    var r = type();
    if (!r || 93 !== i.charCodeAt(n++)) {
      throw error("ListType");
    }
    e2 = {
      kind: "ListType",
      type: r
    };
  } else if (e2 = name()) {
    e2 = {
      kind: "NamedType",
      name: e2
    };
  } else {
    throw error("NamedType");
  }
  ignored();
  if (33 === i.charCodeAt(n)) {
    n++;
    ignored();
    return {
      kind: "NonNullType",
      type: e2
    };
  } else {
    return e2;
  }
}
var f = /on/y;
function typeCondition() {
  if (advance(f)) {
    ignored();
    var e2 = name();
    if (!e2) {
      throw error("NamedType");
    }
    ignored();
    return {
      kind: "NamedType",
      name: e2
    };
  }
}
var p = /\.\.\./y;
function fragmentSpread() {
  if (advance(p)) {
    ignored();
    var e2 = n;
    var r;
    if ((r = name()) && "on" !== r.value) {
      return {
        kind: "FragmentSpread",
        name: r,
        directives: directives(false)
      };
    } else {
      n = e2;
      var i2 = typeCondition();
      var a2 = directives(false);
      var t2 = selectionSet();
      if (!t2) {
        throw error("InlineFragment");
      }
      return {
        kind: "InlineFragment",
        typeCondition: i2,
        directives: a2,
        selectionSet: t2
      };
    }
  }
}
function selectionSet() {
  var e2;
  ignored();
  if (123 === i.charCodeAt(n)) {
    n++;
    ignored();
    var r = [];
    while (e2 = fragmentSpread() || field()) {
      r.push(e2);
    }
    if (!r.length || 125 !== i.charCodeAt(n++)) {
      throw error("SelectionSet");
    }
    ignored();
    return {
      kind: "SelectionSet",
      selections: r
    };
  }
}
var m = /fragment/y;
function fragmentDefinition() {
  if (advance(m)) {
    ignored();
    var e2 = name();
    if (!e2) {
      throw error("FragmentDefinition");
    }
    ignored();
    var r = typeCondition();
    if (!r) {
      throw error("FragmentDefinition");
    }
    var i2 = directives(false);
    var n2 = selectionSet();
    if (!n2) {
      throw error("FragmentDefinition");
    }
    return {
      kind: "FragmentDefinition",
      name: e2,
      typeCondition: r,
      directives: i2,
      selectionSet: n2
    };
  }
}
var g = /(?:query|mutation|subscription)/y;
function operationDefinition() {
  var e2;
  var r;
  var a2 = [];
  var t2 = [];
  if (e2 = advance(g)) {
    ignored();
    r = name();
    a2 = function variableDefinitions() {
      var e3;
      var r2 = [];
      ignored();
      if (40 === i.charCodeAt(n)) {
        n++;
        ignored();
        while (e3 = advance(l)) {
          ignored();
          if (58 !== i.charCodeAt(n++)) {
            throw error("VariableDefinition");
          }
          var a3 = type();
          var t3 = void 0;
          if (61 === i.charCodeAt(n)) {
            n++;
            ignored();
            if (!(t3 = value(true))) {
              throw error("VariableDefinition");
            }
          }
          ignored();
          r2.push({
            kind: "VariableDefinition",
            variable: {
              kind: "Variable",
              name: {
                kind: "Name",
                value: e3.slice(1)
              }
            },
            type: a3,
            defaultValue: t3,
            directives: directives(true)
          });
        }
        if (41 !== i.charCodeAt(n++)) {
          throw error("VariableDefinition");
        }
        ignored();
      }
      return r2;
    }();
    t2 = directives(false);
  }
  var o2 = selectionSet();
  if (o2) {
    return {
      kind: "OperationDefinition",
      operation: e2 || "query",
      name: r,
      variableDefinitions: a2,
      directives: t2,
      selectionSet: o2
    };
  }
}
function parse(e2, r) {
  i = "string" == typeof e2.body ? e2.body : e2;
  n = 0;
  return function document() {
    var e3;
    ignored();
    var r2 = [];
    while (e3 = fragmentDefinition() || operationDefinition()) {
      r2.push(e3);
    }
    return {
      kind: "Document",
      definitions: r2
    };
  }();
}
function printString(e2) {
  return JSON.stringify(e2);
}
function printBlockString(e2) {
  return '"""\n' + e2.replace(/"""/g, '\\"""') + '\n"""';
}
var hasItems = (e2) => !(!e2 || !e2.length);
var y = {
  OperationDefinition(e2) {
    if ("query" === e2.operation && !e2.name && !hasItems(e2.variableDefinitions) && !hasItems(e2.directives)) {
      return y.SelectionSet(e2.selectionSet);
    }
    var r = e2.operation;
    if (e2.name) {
      r += " " + e2.name.value;
    }
    if (hasItems(e2.variableDefinitions)) {
      if (!e2.name) {
        r += " ";
      }
      r += "(" + e2.variableDefinitions.map(y.VariableDefinition).join(", ") + ")";
    }
    if (hasItems(e2.directives)) {
      r += " " + e2.directives.map(y.Directive).join(" ");
    }
    return r + " " + y.SelectionSet(e2.selectionSet);
  },
  VariableDefinition(e2) {
    var r = y.Variable(e2.variable) + ": " + print(e2.type);
    if (e2.defaultValue) {
      r += " = " + print(e2.defaultValue);
    }
    if (hasItems(e2.directives)) {
      r += " " + e2.directives.map(y.Directive).join(" ");
    }
    return r;
  },
  Field(e2) {
    var r = (e2.alias ? e2.alias.value + ": " : "") + e2.name.value;
    if (hasItems(e2.arguments)) {
      var i2 = e2.arguments.map(y.Argument);
      var n2 = r + "(" + i2.join(", ") + ")";
      r = n2.length > 80 ? r + "(\n  " + i2.join("\n").replace(/\n/g, "\n  ") + "\n)" : n2;
    }
    if (hasItems(e2.directives)) {
      r += " " + e2.directives.map(y.Directive).join(" ");
    }
    return e2.selectionSet ? r + " " + y.SelectionSet(e2.selectionSet) : r;
  },
  StringValue: (e2) => e2.block ? printBlockString(e2.value) : printString(e2.value),
  BooleanValue: (e2) => "" + e2.value,
  NullValue: (e2) => "null",
  IntValue: (e2) => e2.value,
  FloatValue: (e2) => e2.value,
  EnumValue: (e2) => e2.value,
  Name: (e2) => e2.value,
  Variable: (e2) => "$" + e2.name.value,
  ListValue: (e2) => "[" + e2.values.map(print).join(", ") + "]",
  ObjectValue: (e2) => "{" + e2.fields.map(y.ObjectField).join(", ") + "}",
  ObjectField: (e2) => e2.name.value + ": " + print(e2.value),
  Document: (e2) => hasItems(e2.definitions) ? e2.definitions.map(print).join("\n\n") : "",
  SelectionSet: (e2) => "{\n  " + e2.selections.map(print).join("\n").replace(/\n/g, "\n  ") + "\n}",
  Argument: (e2) => e2.name.value + ": " + print(e2.value),
  FragmentSpread(e2) {
    var r = "..." + e2.name.value;
    if (hasItems(e2.directives)) {
      r += " " + e2.directives.map(y.Directive).join(" ");
    }
    return r;
  },
  InlineFragment(e2) {
    var r = "...";
    if (e2.typeCondition) {
      r += " on " + e2.typeCondition.name.value;
    }
    if (hasItems(e2.directives)) {
      r += " " + e2.directives.map(y.Directive).join(" ");
    }
    return r + " " + print(e2.selectionSet);
  },
  FragmentDefinition(e2) {
    var r = "fragment " + e2.name.value;
    r += " on " + e2.typeCondition.name.value;
    if (hasItems(e2.directives)) {
      r += " " + e2.directives.map(y.Directive).join(" ");
    }
    return r + " " + print(e2.selectionSet);
  },
  Directive(e2) {
    var r = "@" + e2.name.value;
    if (hasItems(e2.arguments)) {
      r += "(" + e2.arguments.map(y.Argument).join(", ") + ")";
    }
    return r;
  },
  NamedType: (e2) => e2.name.value,
  ListType: (e2) => "[" + print(e2.type) + "]",
  NonNullType: (e2) => print(e2.type) + "!"
};
function print(e2) {
  return y[e2.kind] ? y[e2.kind](e2) : "";
}

// ../../node_modules/@urql/core/dist/urql-core-chunk.mjs
init_cjs_shims();
var phash = (r, e2) => {
  var t2 = 0 | (e2 || 5381);
  for (var a2 = 0, o2 = 0 | r.length; a2 < o2; a2++) {
    t2 = (t2 << 5) + t2 + r.charCodeAt(a2);
  }
  return t2;
};
var c2 = /("{3}[\s\S]*"{3}|"(?:\\.|[^"])*")/g;
var p2 = /(?:#[^\n\r]+)?(?:[\r\n]+|$)/g;
var replaceOutsideStrings = (r, e2) => e2 % 2 == 0 ? r.replace(p2, "\n") : r;
var sanitizeDocument = (r) => r.split(c2).map(replaceOutsideStrings).join("").trim();
var d2 = /* @__PURE__ */ new Map();
var u2 = /* @__PURE__ */ new Map();
var stringifyDocument = (r) => {
  var t2;
  if ("string" == typeof r) {
    t2 = sanitizeDocument(r);
  } else if (r.loc && u2.get(r.__key) === r) {
    t2 = r.loc.source.body;
  } else {
    t2 = d2.get(r) || sanitizeDocument(print(r));
    d2.set(r, t2);
  }
  if ("string" != typeof r && !r.loc) {
    r.loc = {
      start: 0,
      end: t2.length,
      source: {
        body: t2,
        name: "gql",
        locationOffset: {
          line: 1,
          column: 1
        }
      }
    };
  }
  return t2;
};
var hashDocument = (r) => {
  var e2 = phash(stringifyDocument(r));
  if (r.definitions) {
    var t2 = getOperationName(r);
    if (t2) {
      e2 = phash(`
# ${t2}`, e2);
    }
  }
  return e2;
};
var keyDocument = (r) => {
  var e2;
  var a2;
  if ("string" == typeof r) {
    e2 = hashDocument(r);
    a2 = u2.get(e2) || parse(r, {
      noLocation: true
    });
  } else {
    e2 = r.__key || hashDocument(r);
    a2 = u2.get(e2) || r;
  }
  if (!a2.loc) {
    stringifyDocument(a2);
  }
  a2.__key = e2;
  u2.set(e2, a2);
  return a2;
};
var getOperationName = (r) => {
  for (var e2 of r.definitions) {
    if (e2.kind === e.OPERATION_DEFINITION) {
      return e2.name ? e2.name.value : void 0;
    }
  }
};
var y2 = "undefined" != typeof TextDecoder ? new TextDecoder() : null;

// ../../node_modules/@urql/core/dist/urql-core.mjs
function gql(n2) {
  var a2 = /* @__PURE__ */ new Map();
  var o2 = [];
  var i2 = [];
  var s2 = Array.isArray(n2) ? n2[0] : n2 || "";
  for (var c3 = 1; c3 < arguments.length; c3++) {
    var u3 = arguments[c3];
    if (u3 && u3.definitions) {
      i2.push(u3);
    } else {
      s2 += u3;
    }
    s2 += arguments[0][c3];
  }
  i2.unshift(keyDocument(s2));
  for (var p3 of i2) {
    for (var d3 of p3.definitions) {
      if (d3.kind === e.FRAGMENT_DEFINITION) {
        var v2 = d3.name.value;
        var f2 = stringifyDocument(d3);
        if (!a2.has(v2)) {
          a2.set(v2, f2);
          o2.push(d3);
        } else if ("production" !== process.env.NODE_ENV && a2.get(v2) !== f2) {
          console.warn("[WARNING: Duplicate Fragment] A fragment with name `" + v2 + "` already exists in this document.\nWhile fragment names may not be unique across your source, each name must be unique per document.");
        }
      } else {
        o2.push(d3);
      }
    }
  }
  return keyDocument({
    kind: e.DOCUMENT,
    definitions: o2
  });
}

export {
  gql
};
