{"version":3,"sources":["jsdelivr-header.js","/npm/k8s-resource-parser@0.2.2/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,QAAU,QAAQ,WAElB,gBAAkB,QAAQ,QAAQ,aACtC,QAAQ,0BAGJ,gBAAkB,CACtB,EAAG,KACH,EAAG,IACH,EAAG,IACH,EAAG,KAAQ,EACX,EAAG,KAAQ,EACX,EAAG,KAAQ,EACX,EAAG,KAAQ,EACX,GAAI,KACJ,GAAI,QACJ,GAAI,MAAQ,EACZ,GAAI,MAAQ,EACZ,GAAI,MAAQ,EACZ,GAAI,MAAQ,GAGd,SAAS,cAAc,GACrB,IACE,MAAM,EAAS,IAAI,QAAQ,OAAO,iBAClC,EAAO,KAAK,GAEZ,OAAO,OAAE,EAAM,KAAE,IAAU,EAAO,QAClC,OAAO,EAAO,EAAS,gBAAgB,GAAQ,CACjD,CAAE,MAAO,GACP,MAAM,IAAI,YAAY,4BACxB,CACF,CAEA,OAAO,QAAU,CACf,4BACA,UAAW,cACX,aAAc","file":"/npm/k8s-resource-parser@0.2.2/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/k8s-resource-parser@0.2.2/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","const nearley = require(\"nearley\");\n\nconst quantityGrammar = nearley.Grammar.fromCompiled(\n  require(\"./quantity_grammar.js\"),\n);\n\nconst unitMultipliers = {\n  m: 0.001,\n  k: 1000,\n  M: 1000 ** 2,\n  G: 1000 ** 3,\n  T: 1000 ** 4,\n  P: 1000 ** 5,\n  E: 1000 ** 6,\n  Ki: 1024,\n  Mi: 1024 ** 2,\n  Gi: 1024 ** 3,\n  Ti: 1024 ** 4,\n  Pi: 1024 ** 5,\n  Ei: 1024 ** 6,\n};\n\nfunction parseQuantity(input) {\n  try {\n    const parser = new nearley.Parser(quantityGrammar);\n    parser.feed(input);\n\n    const [{ number, unit }] = parser.results;\n    return unit ? number * unitMultipliers[unit] : number;\n  } catch (e) {\n    throw new SyntaxError(\"Invalid quanity provided.\");\n  }\n}\n\nmodule.exports = {\n  parseQuantity,\n  cpuParser: parseQuantity,\n  memoryParser: parseQuantity,\n};\n"]}