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B,EACpB,KAAK,cAAgB,aAAY,WAC/B,EAAO,oBAAoB,EAAQ,EACrC,GAAG,KAAK,mBACR,IAAI,EAA4B,aAAY,WAC1C,EAAO,GAAG,UAAY,EAAK,GAC3B,GAAiB,EACjB,EAAO,QAEe,IAAlB,EAAO,SACT,cAAc,EAAO,eACrB,cAAc,GAElB,GAAG,KAAK,eACV,KAGK,CACT,CA1HgC,GA4H5B,SAAW,aACf,QAAiB,QAAI","file":"/npm/@twistezo/text-scramble@1.0.5/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@twistezo/text-scramble@1.0.5/lib/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","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports[\"default\"] = void 0;\n\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\n * Text scramble effect\n *\n * @param {string} domClass - DOM class to inject\n * @param {String[]} sentences - Array of sentences\n * @param {number} symbolChangeTime - Time to switch next random symbol [ms]\n * @param {number} oneLetterTime - Time to finish letter [ms]\n * @param {number} nextDelay - Delay beofre start new sentence [ms]\n */\nvar TextScramble = /*#__PURE__*/function () {\n  function TextScramble(domClass, sentences, symbolChangeTime, oneLetterTime, nextDelay) {\n    var _this = this;\n\n    _classCallCheck(this, TextScramble);\n\n    _defineProperty(this, \"_fillSpanWithSymbol\", function (childs) {\n      if (childs.length > 0) _this._randomArrayItem(childs).innerText = _this._randomArrayItem(_this._symbols);\n    });\n\n    _defineProperty(this, \"_randomArrayItem\", function (array) {\n      return array[Math.floor(Math.random() * array.length)];\n    });\n\n    _defineProperty(this, \"_nextArrayElementInLoop\", function (array, currentIndex) {\n      var bound = array.length;\n      var nextIndex = (currentIndex + bound + bound + 1) % bound;\n      return array[nextIndex];\n    });\n\n    _defineProperty(this, \"_delay\", function (ms) {\n      return new Promise(function (res) {\n        return setTimeout(res, ms);\n      });\n    });\n\n    this._symbols = '!<>-_\\\\/[]{}—=+*^?#';\n    this._domClass = domClass;\n    this._sentences = sentences;\n    this._symbolChangeTime = symbolChangeTime;\n    this._oneLetterTime = oneLetterTime;\n    this._nextDelay = nextDelay;\n\n    this._infiniteIterOverTexts();\n  }\n\n  _createClass(TextScramble, [{\n    key: \"_infiniteIterOverTexts\",\n    value: function () {\n      var _infiniteIterOverTexts2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {\n        var el, currentTextIndex, text, childs;\n        return regeneratorRuntime.wrap(function _callee$(_context) {\n          while (1) {\n            switch (_context.prev = _context.next) {\n              case 0:\n                el = document.querySelector('.' + this._domClass);\n                currentTextIndex = 0; // eslint-disable-next-line no-constant-condition\n\n              case 2:\n                if (!true) {\n                  _context.next = 13;\n                  break;\n                }\n\n                text = this._nextArrayElementInLoop(this._sentences, currentTextIndex);\n                currentTextIndex = this._sentences.indexOf(text);\n                text.split('').forEach(function () {\n                  var child = document.createElement('span');\n                  el.appendChild(child);\n                });\n                childs = _toConsumableArray(document.querySelectorAll('.' + this._domClass + ' > span'));\n\n                this._drawSentence(text, childs, this._symbolChangeTime, this._oneLetterTime);\n\n                _context.next = 10;\n                return this._delay(childs.length * this._oneLetterTime + this._nextDelay);\n\n              case 10:\n                while (el.firstChild) {\n                  el.removeChild(el.firstChild);\n                }\n\n                _context.next = 2;\n                break;\n\n              case 13:\n              case \"end\":\n                return _context.stop();\n            }\n          }\n        }, _callee, this);\n      }));\n\n      function _infiniteIterOverTexts() {\n        return _infiniteIterOverTexts2.apply(this, arguments);\n      }\n\n      return _infiniteIterOverTexts;\n    }()\n    /**\n     * Get all previously generated spans as `childs`. Every child is a one letter.\n     * Run `drawInterval` which fills every child with a random symbol.\n     * After some time interval first letter is replaced by finish letter and removed from `childs`.\n     * If all letters are replaced and `childs` array is empty, all intervals are stoped.\n     *\n     * @param {string} text\n     * @param {Array} childs\n     */\n\n  }, {\n    key: \"_drawSentence\",\n    value: function _drawSentence(text, childs) {\n      var _this2 = this;\n\n      var currentLetter = 0;\n      this._drawInterval = setInterval(function () {\n        _this2._fillSpanWithSymbol(childs, text);\n      }, this._symbolChangeTime);\n      var removeFirstLetterInterval = setInterval(function () {\n        childs[0].innerHTML = text[currentLetter];\n        currentLetter += 1;\n        childs.shift();\n\n        if (childs.length === 0) {\n          clearInterval(_this2._drawInterval);\n          clearInterval(removeFirstLetterInterval);\n        }\n      }, this._oneLetterTime);\n    }\n  }]);\n\n  return TextScramble;\n}();\n\nvar _default = TextScramble;\nexports[\"default\"] = _default;"]}