{"version":3,"sources":["jsdelivr-header.js","/npm/graphql-firepad-text-operation@1.1.1/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,IAAI,UAAY,QAAQ,cACpB,kBAAoB,QAAQ,WAAW,kBACvC,aAAe,QAAQ,iBAAiB,aACxC,KAAO,QAAQ,oBAAoB,KACnC,sBAAwB,QAAQ,mCAEpC,OAAO,QAAU,IAAI,kBAAkB,CACrC,KAAM,gBAMN,UAAW,SAAU,GAKnB,OAJA,EAAK,EAAG,OACJ,EAAG,SACH,EACJ,sBAAsB,GACf,CACT,EAMA,WAAY,SAAU,GACpB,OAAO,CACT,EAMA,aAAc,SAAU,GAYtB,OAXA,UAAU,EAAI,OAAS,KAAK,KAC1B,aAAc,4EAA8E,EAAI,KAAM,CAAC,IAChG,EAAI,OAAO,KAAI,SAAU,GAChC,GAAI,EAAQ,OAAS,KAAK,IACxB,OAAO,SAAS,EAAQ,OACnB,GAAI,EAAQ,OAAS,KAAK,OAC/B,OAAO,EAAQ,MAEf,MAAM,IAAI,aAAa,mFAAqF,EAAQ,KAAM,CAAC,GAE/H,GAEF","file":"/npm/graphql-firepad-text-operation@1.1.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/graphql-firepad-text-operation@1.1.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var assertErr = require('assert-err')\nvar GraphQLScalarType = require('graphql').GraphQLScalarType\nvar GraphQLError = require('graphql/error').GraphQLError\nvar Kind = require('graphql/language').Kind\nvar validateTextOperation = require('validate-firepad-text-operation')\n\nmodule.exports = new GraphQLScalarType({\n  name: 'TextOperation',\n  /**\n   * Serialize text-operation into json and validate\n   * @param  {Object} op\n   * @return {Object} op validated\n   */\n  serialize: function (op) {\n    op = op.toJSON\n      ? op.toJSON()\n      : op\n    validateTextOperation(op)\n    return op\n  },\n  /**\n   * Parse text-operation just returns the json value as-is\n   * @param  {Object} op\n   * @return {Object} op\n   */\n  parseValue: function (op) {\n    return op\n  },\n  /**\n   * Parse ast literal to to text-operation json\n   * @param  {Object} ast graphql ast\n   * @return {Object} op\n   */\n  parseLiteral: function (ast) {\n    assertErr(ast.kind === Kind.LIST,\n      GraphQLError, 'Query error: Can only parse lists (arrays) to text-operations but got a: ' + ast.kind, [ast])\n    var op = ast.values.map(function (itemAst) {\n      if (itemAst.kind === Kind.INT) {\n        return parseInt(itemAst.value)\n      } else if (itemAst.kind === Kind.STRING) {\n        return itemAst.value\n      } else {\n        throw new GraphQLError('Query error: Can only parse ints and strings to text-operation items but got a: ' + itemAst.kind, [ast])\n      }\n    })\n    return op\n  }\n})\n"]}