
;(function(){function q(a,b,c){n[n.length]=this;h||(h=a,h.event.special.typewriterDestroyed={remove:function(a){a.handler()}},r=document.createElement("textarea"));t="";this.layrs=[];a=(a=h.fn.revolution&&h.fn.revolution[b[0].id]?h.fn.revolution[b[0].id]:!1)&&a.hasOwnProperty("responsiveLevels")?a.responsiveLevels:"";this.levels=a.toString().split(",");this.slider=b.on("typewriterDestroyed",y);c.each(this.writeLayerData.bind(this));t&&(c=document.head||document.body)&&(a=document.createElement("style"),
a.type="text/css",a.innerHTML=t,c.appendChild(a));c=w.length;for(a=0;a<c;a++)b.on("revolution.slide."+w[a],this.eventCallback.bind(this))}function x(a,b,c,f){var d=JSON.parse(a.getAttribute("data-typewriter")),m=b.replace(/(_|\|)$/,""),n=a.className,l=d.lines,r=b,q=[];!l&&d.sequenced&&d.looped&&(l=b);for(e in d)d.hasOwnProperty(e)&&"string"===typeof d[e]&&-1!==d[e].search("ms")&&(d[e]=d[e].replace("ms",""));h(a).addClass("hide-typewriter-cursor");for(k in d)if(d.hasOwnProperty(k)){var e=d[k];var k=
k.replace(/_([a-z])/g,z);this[k]="on"===e||!0===e?1:"off"===e||!1===e?0:!1===isNaN(e)?parseInt(e,10):e}if(this.blinking&&(t+="#"+a.id+":after {"+'content: "[char]"; animation: tp-typewriter [speed]s steps(2, start) infinite'.replace("[char]","one"===this.cursorType?"_":"|").replace("[speed]",.001*parseInt(this.blinkingSpeed,10))+"}#"+a.id+'.hide-typewriter-cursor:after {content: ""}',this.background)){(k=a.getAttribute("data-dim"))||(k="w:auto;h:auto;");var p=k.split("w:")[1];p=p.split(";")[0];p=
p.replace(/[\[\]']+/g,"").split(",");if(c)for(k=p.length,e=0;e<k;e++){var u=c[e];if(u!==g){var g=p[e];g="auto"===g||"none"===g;0<e?(g=g?"static":"absolute",t+="@media screen and (max-width: "+u+"px) {rs-layer#"+a.id+"[data-typewriter]:after {position: "+g+"}#"+a.id+".rs-layer[data-typewriter]:after {position: "+g+"}}"):g&&a.setAttribute("data-typewriter-blinking","true");g=u}}else g=p[0],"none"!==g&&"auto"!==g||a.setAttribute("data-typewriter-blinking","true")}if(this.sequenced&&l){b=[v(unescape(b))];
l=l.split(",");k=l.length;for(e=0;e<k;e++)(c=h.trim(l[e]))&&(b[b.length]=v(unescape(c)));a.setAttribute("data-typewriter-sequenced","true")}else{this.sequenced=this.looped=!1;this.newlineDelay=this.linebreakDelay;l=v(b,!0).split(/\r?\n|\r/g);k=l.length;b=[];for(e=0;e<k;e++)b[b.length]=h.trim(l[e]),b[b.length]="";for(;""===b[0];)b.shift();for(;""===b[b.length-1];)b.pop()}if(this.wordDelay)if(d=d.delays){d=d.split(",");k=d.length;for(e=l=0;e<k;e++)g=unescape(d[e]).split("|"),c=g[0],g=g[1],!1===isNaN(c)&&
!1===isNaN(g)&&(c=parseInt(c),q[c+l-1]=parseInt(g),l+=c);this.spaces=q}else this.wordDelay=!1;this.el=a;this.txt=b;this.orig=r;this.clean=m;this.revapi=f;this.len=b.length;this.statc=-1!==n.search("rs-layer-static");h.data(a,"typewriter",this)}function z(a){return a[1].toUpperCase()}function v(a,b){a=a.replace(/<(?!br\s*\/?)[^>]+>/g,"").replace(/(_|\|)$/,"");a=b?a.replace(/\r?\n|\r/g," ").replace(/<br[^>]*>/gi,"\n"):a.replace(/\r?\n|\r/g,"\u00b1").replace(/<br[^>]*>/gi,"\u00b5").replace(/\u00b1\u00b5|\u00b5\u00b1/g,
"\u00b5").replace(/^\u00b1+|\u00b1+$/g,"").replace(/^\u00b5+|\u00b5+$/g,"");r.innerHTML=a;return r.value}function y(){for(var a=n.length,b;a--;)if(b=n[a],b[0]===this){for(var c=void 0,f=b.layrs,d=f.length;d--;)h.removeData(f[d].el,"typewriter");for(c in b)b.hasOwnProperty(c)&&delete b[c];n=n.splice(a,1);break}}var h,t,r,n=[],w=["onbeforeswap","layeraction","beforeredraw","afterdraw"];window.RsTypewriterAddOn=function(a,b){if(b){var c=b.find("rs-layer[data-typewriter], .rs-layer[data-typewriter]");
c.length&&new q(a,b,c)}};q.prototype={eventCallback:function(a,b){this[a.namespace.replace(".slide","")](b)},onbeforeswap:function(a){var b=this.layrs,c=b.length;if(a=a.currentslide[0])for(;c--;){var f=b[c];f.statc||(clearTimeout(f.timer),f.running=!1,f.active=!1,a.contains(f.el)||(f.el.innerHTML=f.orig,h(f.el).addClass("hide-typewriter-cursor")))}},layeraction:function(a){if("enterstage"===a.eventtype){var b=h.data(a.layer[0],"typewriter");a="html"===a.layertype||"text"===a.layertype;b&&a&&(b.active=
!0,b.start())}},beforeredraw:function(a){a=this.layrs;for(var b=a.length;b--;)a[b].onRedraw()},afterdraw:function(){for(var a=this.layrs,b=a.length;b--;)a[b].onRedraw(!0)},writeLayerData:function(a,b){var c=h.trim(b.innerHTML);c?(b.getAttribute("data-whiteboard")&&("undefined"!==typeof console&&console.log("Whiteboard is disabled for Layers with Typewriter Add-On effect enabled"),b.removeAttribute("data-whiteboard")),this.layrs[this.layrs.length]=new x(b,c,this.levels,this.slider)):b.removeAttribute("data-typewriter")}};
x.prototype={start:function(a,b){clearTimeout(this.timer);this.paused||(this.words=this.step=this.line=0,this.rpaused=this.paused=this.breaker=this.rstart=this.rewind=this.skip=!1,this.str=this.txt[this.line],this.len=this.str.length,b?(this.timer=setTimeout(this.onStart.bind(this),a),this.revapi.trigger("revolution.slide.typewriterlooped",[this.el])):(this.el.innerHTML="&nbsp;",h(this.el).removeClass("hide-typewriter-cursor"),this.timer=setTimeout(this.onStart.bind(this),this.startDelay)),this.running=
!0,this.revapi.trigger("revolution.slide.typewriterstarted",[this.el]),this.revapi.trigger("revolution.slide.typewriternewline",[this.el,this.line+1,this.txt[this.line]]))},onStart:function(){this.el.innerHTML="";this.animate()},animate:function(){var a=this.str;var b=this.txt,c=this.step,f=this.rewind,d=f?this.deletionSpeed:this.speed;if(c<this.len){if(f)this.str=a=a.slice(0,-1),this.el.innerHTML=a.replace(/\u00b5/g,"<br>")||"&nbsp";else if(this.breaker?(a="<br>",d=this.skip?this.linebreakDelay:
this.newlineDelay,this.skip=this.breaker=!1,this.words=0,this.step--):(a=a[c],"\u00b5"===a&&(this.breaker=this.skip=!0,d=this.linebreakDelay)),!this.breaker){var m=this.el.innerHTML;"&nbsp;"===m&&(m="");this.el.innerHTML=m+a;this.wordDelay&&" "===a&&(a=this.words,(m=this.spaces[a])?(d=m,this.words=a<this.spaces.length-1?a+1:0):this.words+=1)}this.step++;m=!0}else{if(this.rstart){this.paused?(this.rpaused=!0,this.lastSpeed=this.newlineDelay):this.start(this.newlineDelay,!0);return}this.line<b.length&&
(this.line++,this.step=0,this.skip=!1,this.str=a=b[this.line],""===a&&(this.line++,this.breaker=!0,d=this.newlineDelay),this.line<b.length?(this.sequenced?((f=!f)?(this.line--,this.str=b[this.line],d=this.deletionDelay):(this.str=b[this.line],this.len=this.str.length,d=this.newlineDelay),this.rewind=f):(this.str=b[this.line],this.len=this.str.length),m=!0,this.words=0,this.rewind||this.revapi.trigger("revolution.slide.typewriternewline",[this.el,this.line+1,b[this.line]])):this.looped&&(this.rstart=
this.rewind=!0,this.words=0,this.line--,this.str=b[this.line],m=!0,d=this.deletionDelay))}m?this.paused?this.lastSpeed=d:d?this.timer=setTimeout(this.animate.bind(this),d):this.animate():(this.running=!1,this.hideCursor&&h(this.el).addClass("hide-typewriter-cursor"),this.revapi.trigger("revolution.slide.typewriterended",[this.el]))},onRedraw:function(a){a?this.el.innerHTML=this.state:(a=window.getComputedStyle(this.el,":after").getPropertyValue("position"),this.state=this.el.innerHTML,this.el.innerHTML=
"absolute"===a?this.orig:this.clean)},pause:function(){this.active&&(clearTimeout(this.timer),this.paused=!0)},resume:function(){this.active&&(this.running?this.paused&&(this.rpaused?this.start(this.lastSpeed,!0):(this.paused=!1,this.lastSpeed?this.timer=setTimeout(this.animate.bind(this),this.lastSpeed):this.animate())):this.restart())},restart:function(){this.active&&(clearTimeout(this.timer),this.paused=this.rpaused=!1,this.start())},restore:function(a){this.active&&(clearTimeout(this.timer),this.el.innerHTML=
this.clean,a&&h(this.el).addClass("hide-typewriter-cursor"))}}})();