/*!
 * VERSION: 0.5.1
 * DATE: 2018-02-15
 * UPDATES AND DOCS AT: http://greensock.com
 *
 * @license Copyright (c) 2008-2018, GreenSock. All rights reserved.
 * ScrambleTextPlugin is a Club GreenSock membership benefit; You must have a valid membership to use
 * this code without violating the terms of use. Visit http://greensock.com/club/ to sign up or get more details.
 * This work is subject to the software agreement that was issued with your membership.
 * 
 * @author: Jack Doyle, jack@greensock.com
 */
var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";var a=function(b){var c=b.nodeType,d="";if(1===c||9===c||11===c){if("string"==typeof b.textContent)return b.textContent;for(b=b.firstChild;b;b=b.nextSibling)d+=a(b)}else if(3===c||4===c)return b.nodeValue;return d},b=function(a,b){for(var c=b.length,d="";--a>-1;)d+=b[Math.random()*c|0];return d},c=function(a){this.chars=g(a),this.sets=[],this.length=50;var c;for(c=0;20>c;c++)this.sets[c]=b(80,this.chars);this.grow=function(a){for(c=0;20>c;c++)this.sets[c]+=b(a-this.length,this.chars);this.length=a}},d="[-]|�[�-�]|�[�-�]|[⚔-⚗]|�[�-�]|[�-�][�-�]",e=new RegExp(d),f=new RegExp(d+"|.","g"),g=function(a,b){return""!==b&&b||!e.test(a)?a.split(b||""):a.match(f)},h="ABCDEFGHIJKLMNOPQRSTUVWXYZ",i=h.toLowerCase(),j={upperCase:new c(h),lowerCase:new c(i),upperAndLowerCase:new c(h+i)},k=_gsScope._gsDefine.plugin({propName:"scrambleText",version:"0.5.1",API:2,overwriteProps:["scrambleText","text"],init:function(b,d,f,h){if(this._prop="innerHTML"in b?"innerHTML":"textContent"in b?"textContent":0,!this._prop)return!1;"function"==typeof d&&(d=d(h,b)),this._target=b,"object"!=typeof d&&(d={text:d});var i,k,l,m;return this._delimiter=i=d.delimiter||"",this._original=g(a(b).replace(/\s+/g," ").split("&nbsp;").join(""),i),("{original}"===d.text||d.text===!0||null==d.text)&&(d.text=this._original.join(i)),this._text=g((d.text||d.value||"").replace(/\s+/g," "),i),this._hasClass=!1,"string"==typeof d.newClass&&(this._newClass=d.newClass,this._hasClass=!0),"string"==typeof d.oldClass&&(this._oldClass=d.oldClass,this._hasClass=!0),m=""===i,this._textHasEmoji=e.test(this._text.join(i))&&m,this._charsHaveEmoji=!!d.chars&&e.test(d.chars),this._length=m?this._original.length:this._original.join(i).length,this._lengthDif=(m?this._text.length:this._text.join(i).length)-this._length,this._fillChar=d.fillChar||d.chars&&-1!==d.chars.indexOf(" ")?"&nbsp;":"",this._charSet=l=j[d.chars||"upperCase"]||new c(d.chars),this._speed=.016/(d.speed||1),this._prevScrambleTime=0,this._setIndex=20*Math.random()|0,k=this._length+Math.max(this._lengthDif,0),k>l.length&&l.grow(k),this._chars=l.sets[this._setIndex],this._revealDelay=d.revealDelay||0,this._tweenLength=d.tweenLength!==!1,this._tween=f,this._rightToLeft=!!d.rightToLeft,!0},set:function(a){var b,c,d,e,f,h,i,j,k,l=this._text.length,m=this._delimiter,n=this._tween._time,o=n-this._prevScrambleTime;this._revealDelay&&(this._tween.vars.runBackwards&&(n=this._tween._duration-n),a=0===n?0:n<this._revealDelay?1e-6:n===this._tween._duration?1:this._tween._ease.getRatio((n-this._revealDelay)/(this._tween._duration-this._revealDelay))),0>a?a=0:a>1&&(a=1),this._rightToLeft&&(a=1-a),b=a*l+.5|0,a?((o>this._speed||o<-this._speed)&&(this._setIndex=(this._setIndex+(19*Math.random()|0))%20,this._chars=this._charSet.sets[this._setIndex],this._prevScrambleTime+=o),e=this._chars):e=this._original.join(m),this._rightToLeft?1!==a||!this._tween.vars.runBackwards&&"isFromStart"!==this._tween.data?(i=this._text.slice(b).join(m),d=this._charsHaveEmoji?g(e).slice(0,this._length+(this._tweenLength?1-a*a*a:1)*this._lengthDif-(this._textHasEmoji?g(i):i).length+.5|0).join(""):e.substr(0,this._length+(this._tweenLength?1-a*a*a:1)*this._lengthDif-(this._textHasEmoji?g(i):i).length+.5|0),e=i):(d="",e=this._original.join(m)):(d=this._text.slice(0,b).join(m),c=(this._textHasEmoji?g(d):d).length,e=this._charsHaveEmoji?g(e).slice(c,this._length+(this._tweenLength?1-(a=1-a)*a*a*a:1)*this._lengthDif+.5|0).join(""):e.substr(c,this._length+(this._tweenLength?1-(a=1-a)*a*a*a:1)*this._lengthDif-c+.5|0)),this._hasClass?(j=this._rightToLeft?this._oldClass:this._newClass,k=this._rightToLeft?this._newClass:this._oldClass,f=j&&0!==b,h=k&&b!==l,i=(f?"<span class='"+j+"'>":"")+d+(f?"</span>":"")+(h?"<span class='"+k+"'>":"")+m+e+(h?"</span>":"")):i=d+m+e,this._target[this._prop]="&nbsp;"===this._fillChar&&-1!==i.indexOf("  ")?i.split("  ").join("&nbsp;&nbsp;"):i}}),l=k.prototype;l._newClass=l._oldClass="";for(l in j)j[l.toLowerCase()]=j[l],j[l.toUpperCase()]=j[l]}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()(),function(a){"use strict";var b=function(){return(_gsScope.GreenSockGlobals||_gsScope)[a]};"undefined"!=typeof module&&module.exports?(require("../TweenLite.min.js"),module.exports=b()):"function"==typeof define&&define.amd&&define(["TweenLite"],b)}("ScrambleTextPlugin");