{"version":3,"sources":["jsdelivr-header.js","/npm/@ide/backoff@1.0.0/src/backoff.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,sKCNA,MAAA,SAAA,gBAAA,QAAA,WAEA,SAAgB,2BACd,EACA,GACA,WACE,EAAa,IAAG,oBAChB,EAAsB,IAAI,WAC1B,EAAa,EAAc,WAC3B,EAAa,KACX,IAEJ,SAAA,QAAO,EAAiB,EAAG,iDAC3B,SAAA,QAAO,GAAsB,EAAG,iDAChC,SAAA,QAAO,GAAc,EAAG,6DACxB,SAAA,QACE,GAAK,GAAuB,GAAuB,EACnD,+DAEF,SAAA,QAAO,GAAc,EAAG,iDAExB,IAAI,EAAc,EAAiB,GAAc,EAE7C,EAAe,EAAI,EAAsB,EAAI,EAAsB,KAAK,SAC5E,OAAO,KAAK,IAAI,KAAK,IAAI,EAAc,EAAc,GAAa,EACpE,CAvBA,QAAA","file":"/npm/@ide/backoff@1.0.0/build/backoff.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@ide/backoff@1.0.0/build/backoff.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import assert from 'assert';\n\nexport function computeNextBackoffInterval(\n  initialBackoff: number,\n  previousRetryCount: number,\n  {\n    multiplier = 1.5,\n    randomizationFactor = 0.25,\n    minBackoff = initialBackoff,\n    maxBackoff = Infinity,\n  } = {},\n): number {\n  assert(initialBackoff > 0, `The initial backoff interval must be positive`);\n  assert(previousRetryCount >= 0, `The previous retry count must not be negative`);\n  assert(multiplier >= 1, `The backoff multiplier must be greater than or equal to 1`);\n  assert(\n    0 <= randomizationFactor && randomizationFactor <= 1,\n    `The randomization factor must be between 0 and 1, inclusive`,\n  );\n  assert(minBackoff >= 0, `The minimum backoff interval must be positive`);\n\n  let nextBackoff = initialBackoff * multiplier ** previousRetryCount;\n  // Apply jitter within the negative to positive range of the randomization factor\n  let jitterFactor = 1 - randomizationFactor + 2 * randomizationFactor * Math.random();\n  return Math.min(Math.max(nextBackoff * jitterFactor, minBackoff), maxBackoff);\n}\n"]}