/* * * typed.js - A JavaScript Typing Animation Library * Author: Matt Boldt * Version: v2.0.11 * Url: https://github.com/mattboldt/typed.js * License(s): MIT * */ (function(b,a){"object"==typeof exports&&"object"==typeof module?module.exports=a():"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?exports.Typed=a():b.Typed=a()})(this,function(){return function(c){function a(e){if(b[e]){return b[e].exports}var d=b[e]={exports:{},id:e,loaded:!1};return c[e].call(d.exports,d,d.exports,a),d.loaded=!0,d.exports}var b={};return a.m=c,a.c=b,a.p="",a(0)}([function(k,c,j){function f(i,a){if(!(i instanceof a)){throw new TypeError("Cannot call a class as a function")}}Object.defineProperty(c,"__esModule",{value:!0});var d=function(){function a(o,i){for(var m=0;mq.length));){}var w=q.substring(0,l),s=q.substring(w.length+1,l+m),i=q.substring(l+m+1);q=w+s+i,m--}p.timeout=setTimeout(function(){p.toggleBlinking(!1),l>=q.length?p.doneTyping(q,l):p.keepTyping(q,l,m),p.temporaryPause&&(p.temporaryPause=!1,p.options.onTypingResumed(p.arrayPos,p))},t)},o))}},{key:"keepTyping",value:function(o,i,m){0===i&&(this.toggleBlinking(!1),this.options.preStringTyped(this.arrayPos,this)),i+=m;var l=o.substr(0,i);this.replaceText(l),this.typewrite(o,i)}},{key:"doneTyping",value:function(m,i){var l=this;this.options.onStringTyped(this.arrayPos,this),this.toggleBlinking(!0),this.arrayPos===this.strings.length-1&&(this.complete(),this.loop===!1||this.curLoop===this.loopCount)||(this.timeout=setTimeout(function(){l.backspace(m,i)},this.backDelay))}},{key:"backspace",value:function(o,i){var m=this;if(this.pause.status===!0){return void this.setPauseStatus(o,i,!0)}if(this.fadeOut){return this.initFadeOut()}this.toggleBlinking(!1);var l=this.humanizer(this.backSpeed);this.timeout=setTimeout(function(){i=g.htmlParser.backSpaceHtmlChars(o,i,m);var p=o.substr(0,i);if(m.replaceText(p),m.smartBackspace){var e=m.strings[m.arrayPos+1];e&&p===e.substr(0,i)?m.stopNum=i:m.stopNum=0}i>m.stopNum?(i--,m.backspace(o,i)):i<=m.stopNum&&(m.arrayPos++,m.arrayPos===m.strings.length?(m.arrayPos=0,m.options.onLastStringBackspaced(),m.shuffleStringsIfNeeded(),m.begin()):m.typewrite(m.strings[m.sequence[m.arrayPos]],i))},l)}},{key:"complete",value:function(){this.options.onComplete(this),this.loop?this.curLoop++:this.typingComplete=!0}},{key:"setPauseStatus",value:function(m,i,l){this.pause.typewrite=l,this.pause.curString=m,this.pause.curStrPos=i}},{key:"toggleBlinking",value:function(e){this.cursor&&(this.pause.status||this.cursorBlinking!==e&&(this.cursorBlinking=e,e?this.cursor.classList.add("typed-cursor--blink"):this.cursor.classList.remove("typed-cursor--blink")))}},{key:"humanizer",value:function(e){return Math.round(Math.random()*e/2)+e}},{key:"shuffleStringsIfNeeded",value:function(){this.shuffle&&(this.sequence=this.sequence.sort(function(){return Math.random()-0.5}))}},{key:"initFadeOut",value:function(){var e=this;return this.el.className+=" "+this.fadeOutClass,this.cursor&&(this.cursor.className+=" "+this.fadeOutClass),setTimeout(function(){e.arrayPos++,e.replaceText(""),e.strings.length>e.arrayPos?e.typewrite(e.strings[e.sequence[e.arrayPos]],0):(e.typewrite(e.strings[0],0),e.arrayPos=0)},this.fadeOutDelay)}},{key:"replaceText",value:function(e){this.attr?this.el.setAttribute(this.attr,e):this.isInput?this.el.value=e:"html"===this.contentType?this.el.innerHTML=e:this.el.textContent=e}},{key:"bindFocusEvents",value:function(){var e=this;this.isInput&&(this.el.addEventListener("focus",function(i){e.stop()}),this.el.addEventListener("blur",function(i){e.el.value&&0!==e.el.value.length||e.start()}))}},{key:"insertCursor",value:function(){this.showCursor&&(this.cursor||(this.cursor=document.createElement("span"),this.cursor.className="typed-cursor",this.cursor.innerHTML=this.cursorChar,this.el.parentNode&&this.el.parentNode.insertBefore(this.cursor,this.el.nextSibling)))}}]),a}();c["default"]=b,k.exports=c["default"]},function(q,f,p){function j(a){return a&&a.__esModule?a:{"default":a}}function g(c,a){if(!(c instanceof a)){throw new TypeError("Cannot call a class as a function")}}Object.defineProperty(f,"__esModule",{value:!0});var m=Object.assign||function(l){for(var a=1;a":";";m.substr(h+1).charAt(0)!==j&&(h++,!(h+1>m.length));){}h++}return h}},{key:"backSpaceHtmlChars",value:function(m,h,l){if("html"!==l.contentType){return h}var k=m.substr(h).charAt(0);if(">"===k||";"===k){var j="";for(j=">"===k?"<":"&";m.substr(h-1).charAt(0)!==j&&(h--,!(h<0));){}h--}return h}}]),e}();a["default"]=b;var d=new b;a.htmlParser=d}])});