"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const modeCtr$1 = require("../../_virtual/mode-ctr.js");
const core = require("./core.js");
const cipherCore = require("./cipher-core.js");
var modeCtr = modeCtr$1.__module.exports;
var hasRequiredModeCtr;
function requireModeCtr() {
  if (hasRequiredModeCtr) return modeCtr$1.__module.exports;
  hasRequiredModeCtr = 1;
  (function(module2, exports2) {
    (function(root, factory, undef) {
      {
        module2.exports = factory(core.__require(), cipherCore.__require());
      }
    })(modeCtr, function(CryptoJS) {
      CryptoJS.mode.CTR = function() {
        var CTR = CryptoJS.lib.BlockCipherMode.extend();
        var Encryptor = CTR.Encryptor = CTR.extend({
          processBlock: function(words, offset) {
            var cipher = this._cipher;
            var blockSize = cipher.blockSize;
            var iv = this._iv;
            var counter = this._counter;
            if (iv) {
              counter = this._counter = iv.slice(0);
              this._iv = void 0;
            }
            var keystream = counter.slice(0);
            cipher.encryptBlock(keystream, 0);
            counter[blockSize - 1] = counter[blockSize - 1] + 1 | 0;
            for (var i = 0; i < blockSize; i++) {
              words[offset + i] ^= keystream[i];
            }
          }
        });
        CTR.Decryptor = Encryptor;
        return CTR;
      }();
      return CryptoJS.mode.CTR;
    });
  })(modeCtr$1.__module);
  return modeCtr$1.__module.exports;
}
exports.__require = requireModeCtr;
