GenolveScroll=function(I){function oa(d,h){O="mouse";V=window.scrollY;ba=d.pageX;ka=d.pageY;W(d,h)}function pa(d,h){O="tilt";V=window.scrollY;X=d.gamma;X=d.accelerationIncludingGravity?d.accelerationIncludingGravity.x:0;ca=d.beta;d.data={};d.data.value=e;W(d,h)}function qa(d,h){O="scroll";V=window.scrollY;W(d,h)}function ra(d,h){O="music";if(d=gnlvSound.getAna())Y=d.data.freq,latestT=d.data.time,N=d.data.size,la=d.data.metro,d.data.value=e,W(d,h)}function W(d,h){da||(e=d.data.value,requestAnimationFrame(sa),
ea++);da=!0}var L=this;this.ver="2.0.0";var Z=[],y={},T={},n={},E={},Q,ba=0,ka=0,X=0,ca=0,Y=0,N=0,la=0,u=0,S,J,e,O,ea=0,fa=!1,ha,F="notset",ia=!1,ja=!0,U={};this.ani_start_timestamp=Date.now();this.muzlock="none";"object"!=typeof window.gnlv_start_time&&(window.gnlv_start_time={"default":L.ani_start_timestamp});null==$&&($=jQuery);if(I&&I.vpr)var a=I.vpr;var M=I&&I.usemode?I.usemode:"edit",R=I&&I.atime?I.atime:15;null==a&&(a={name:"scroll-vpr-stub",vprint:function(d,h){vv||"scrl"!=d&&"anmt"!=d&&console.log(h)},
dumpvar:function(d){return JSON.stringify(d)},d0:function(d){d=String(d).replace(/[^0-9\-\.]/g,"");return Math.round(parseFloat(d))},dd:function(d){return Math.round(100*parseFloat(d))/100},ddd:function(d){return Math.round(1E3*parseFloat(d))/1E3},d4:function(d){return Math.round(1E4*parseFloat(d))/1E4},keeptime:function(d){var h="default";d&&d.getAttribute("data-target")&&(h=d.getAttribute("data-target"));"object"!=typeof window.gnlv_start_time&&(window.gnlv_start_time={});window.gnlv_start_time[h]=
Date.now()},parsejson:function(d){try{return JSON.parse(d.replace(/'/g,'"'))}catch(h){alert("JSON parse error on["+d+"]:"+h)}},getBrowser:function(){let d=!1;var h=navigator.userAgent||navigator.vendor||window.opera;if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(h)||
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(h.substr(0,
4)))d=!0;return d},setValMode:{LOOP:"LOOP",LOOPz:"LOOPz",LOOPtoBOUND:"LOOPtoBOUND",LIMIT:"LIMIT",RANDOM:"RANDOM",MIDNORM:"MIDNORM",LOWNORM:"LOWNORM",HINORM:"HINORM"},setVal:function(d,h,b,m,f){if(isNaN(d)||!isFinite(d))return m;b=parseFloat(b);m=parseFloat(m);if(b>m){var k=m;m=b;b=k}k=m-b;k=f==this.setValMode.LOOPz?k+1:k;d=isNaN(d)?0:parseFloat(d);h=isNaN(h)?1:parseFloat(h);d+=h;if(d>m)if(f==this.setValMode.LIMIT)d=m;else if(f==this.setValMode.LOOPtoBOUND)d=b;else if(f==this.setValMode.LOOP||f==this.setValMode.LOOPz)for(;d>
m;)d-=k;else console.warn("GNLV_UTILS.setVal invalid setValMode:"+f+" must be LOOP/LIMIT/RANDOM");else if(d<b)if(f==this.setValMode.LIMIT)d=b;else if(f==this.setValMode.LOOPtoBOUND)d=m;else if(f==this.setValMode.LOOP||f==this.setValMode.LOOPz)for(;d<b;)d+=k;else console.warn("GNLV_UTILS.setVal invalid setValMode:"+f+" must be LOOP/LIMIT/RANDOM");return d}});a.vprint("scrl"," -  =  ");a.vprint("scrl"," -  =  CREATE gnlvScroll  = - usemode:"+M+" vpr:"+a.name+" eloop:"+eloop.version);"stub"==eloop.version&&
a.keeptime&&(eloop.keeptime=a.keeptime);"function"==typeof GNLV_3RDPARTY&&null==eloop.tpr&&(a.vprint("scrl"," -  =  CREATE 3rdparty"),eloop.tpr=new GNLV_3RDPARTY(a,{name:"vekstub"},$));var V=0,da=!1;this.changeDiv=function(d,h){if(null==d)return e;a.vprint("scrl",vv?"":" -  =  changeDiv   "+e+" -> "+d+" muz:"+h);null==U[e]?a.vprint("scrl",vv?"":" -  =  changeDiv  XXXX lookup fail"):(e=d,null!=h&&(L.muzlock="vol_on"==h?e:"none"))};var ta=function(d,h){a.vprint("scrl",vv?"":" -  =  onBeat  =  -  got event:"+
d.type+","+d.keyoff+" num ani:"+n[e].gnlvaniA.length);fa=!0;gnlvSound.volColor()};this.toggleMuzPlay=function(){ma("play")};this.toggleMuzPause=function(){ma("pause")};var ma=function(d){var h;a.vprint("scrl",vv?"":"- = toggleMuz("+d+") for num ani:"+n[e].gnlvaniA.length);for(h=0;h<n[e].gnlvaniA.length;h++){paramO=n[e].gnlvaniA[h];var b=paramO.myself;"pause"==d?(b.attr("repeatDur","indefinite"),b.node.setAttribute("fill","remove")):b.attr("repeatDur",1E-6)}},sa=function(d,h){a.vprint("anmt",vv?"":
"- - - - - - - - - - - - - aniOnScrollWrap event:"+O);for(J in U)if(0===String(y[J]).indexOf(O))if("none"!=L.muzlock&&L.muzlock!=J)a.vprint("anmt",vv?"":"- - - - - - - - - - - - - aniOnScrollWrap skip:"+J+" "+O+" for muzlock:"+L.muzlock);else{e=J;a.vprint("anmt",vv?"":"- - - - - - - - - - - - - aniOnScrollWrap on:"+J+" "+O);var b=void 0,m=void 0,f=void 0,k=void 0,A=void 0,B=void 0,G=void 0,C=void 0,t=d=void 0;h=void 0;var l=[];var z=[],v=[],K={},q=$.extend({},n[e].numAbyTarget),c={},x={};var g=0;
null==E[e]&&(E[e]={lastime:(new Date).getTime(),tiltG:0,tiltB:0,gpa:.5,num_group_mode:0});var w=V;if(null==y[e]||"scroll"==y[e]||"scroll_standard"==y[e]||"scroll_near_top"==y[e]){var r=$("#"+e.replace(/_svg$/,""));1>r.length&&a.vprint("warn",vv?"":"aniOnScroll did not find  div:"+e.replace(/_svg$/,""));C=parseInt(r.offset().top);G=parseInt(r.height());B=parseInt($(window).height());A=parseInt($(window).width());k=C-w;f=B-k}var p=(new Date).getTime();r=p-E[e].lastime;E[e].lastime=p;if(null==y[e]||
"scroll"==y[e])C<.5*B?(y[e]="scroll_near_top",g=0,T[e]=G>B?.1:.6):(y[e]="scroll_standard",g=.2*G,T[e]=G>B?.6:1);if("scroll_standard"==y[e])t=a.d4(Math.min(1,(f-g)/B*T[e]));else if("scroll_near_top"==y[e])t=a.d4(Math.min(1,w/(k+G*T[e])));else if("mouse"==y[e])t=a.d4((f-g)/B),1.5>t&&0<t&&(t=a.d4(Math.min(1,ba/A)));else if("tilt"==y[e])t=a.d4((f-g)/B),1.5>t&&0<t&&(window.matchMedia("only screen and (orientation:portrait)").matches?E[e].gpa=a.setVal(E[e].gpa,X*Math.PI/180,0,1,a.setValMode.LIMIT):E[e].gpa=
a.setVal(E[e].gpa,ca*Math.PI/180,0,1,a.setValMode.LIMIT),t=E[e].gpa);else if("music"==y[e]){var P=A=p=t=0,D=0,H=!1,na=0,ua=Math.max(15,E[e].num_group_mode);h=la;for(g=0;g<N;g++)255>Y[g]&&!H&&(H=!0,m=g),g>ua+m&&15>Y[g]&&na++,l[g]=a.setVal(Y[g]/255,0,0,1,a.setValMode.LIMIT),z[g]=a.setVal(latestT[g]/255,0,0,1,a.setValMode.LIMIT),H&&3>na&&v.push(l[g]),D=Math.max(D,l[g]),t+=l[g],g<N/3?P+=l[g]:g<N/3+N/3?A+=l[g]:p+=l[g];K.ave=t/=N;K.max=D;K.bass=P/(N/3);K.mid=A/(N/3);K.treb=p/(N/3);K["group mode"]=l}a.vprint("scrl",
vv?"":"aniOnScroll - - - - ");a.vprint("scrl",vv?"":"aniOnScroll - - - - START[ divid "+e+" ] event:"+O+" calc: "+y[e]+" talldiv:"+T[e]+" found svgA?"+typeof svgA+" svgH.id:"+typeof U[e]);if("undefined"!=typeof gnlvSound&&gnlvSound.muted&&"music"==y[e])a.vprint("scrl",vv?"":"aniOnScroll MUTE abort");else{cur_t=eloop.anielapsed?eloop.anielapsed():L.anielapsed();for(b in n[e].slot)isVis=!0,g=n[e].slot[b],g.transO&&g.transO.slide&&g.transO.slide.startDelay&&g.transO.slide.duration&&("none"!=g.transO.slide.animateIn||
10==g.transO.slide.addFade)?(a.vprint("scrl",vv?"":"aniOnScroll slot["+b+"]transO?"+g.transO),start_t=g.transO.slide.startDelay,gofor="none"!=g.transO.slide.animateOut?g.transO.slide.animateOutPause+2*g.transO.slide.duration:R-start_t,n[e].slot[b].isVis=cur_t>start_t&&cur_t<start_t+gofor?!0:!1,a.vprint("scrl",vv?"":"aniOnScroll slot["+b+"]vis?"+n[e].slot[b].isVis)):a.vprint("scrl",vv?"":"aniOnScroll["+e+"] slot["+b+"] no trasO or not faded");a.vprint("scrl",vv?"":"aniOnScroll - - - - START[ divid "+
e+" , "+y[e]+"] dt:"+r+" - - - divscroll:"+C+" h:"+G+" winscroll:"+w+" h:"+B+" x:"+ba+" y:"+ka+" g:"+X+" b:"+ca+"->"+k+" inverse:"+f+" %:"+t+" num ani:"+n[e].gnlvaniA.length);if(1>t&&0<t)for(g=C=0;g<n[e].gnlvaniA.length;g++){b=n[e].gnlvaniA[g];w=b.valsA.length;m=1;r=t;F="notsound";if("music"==y[e]&&b.music&&b.music.enable){if(b.music.keyoff&&K[b.music.keyoff]&&(r=K[b.music.keyoff],b.slot&&n[e].slot[b.slot]&&!1===n[e].slot[b.slot].isVis)){a.vprint("scrl",vv?"":"aniOnScroll skip ani:"+g);continue}F=
b.music.drivemode;1<b.music.beatMultiple?k=a.setVal(h*b.music.beatMultiple,0,0,1,a.setValMode.LOOP):-1>=b.music.beatMultiple?(k=h/Math.abs(b.music.beatMultiple),fa&&(b.gpb+=b.mpAlongPrev),k=b.gpb+k,1<k&&(k=b.gpb=0)):k=h;k<b.mpAlongPrev?(b.mpPulse=.002*9,a.vprint("scrl",vv?"":"aniOnScroll                     *  Pulse  *")):b.mpPulse*=.6;b.mpAlongPrev=k;f=r>b.threshold?1:0;b.threshold=r>b.threshold?b.threshold+.005:b.threshold-.005;d=1*Math.cos(k*Math.PI*2)+1.2;"freqbar"==F?k=r:"waveform"==F?k=z[0]:
"beat"!=F&&("beat with flow"==F?k=a.setVal(b.gpa,b.mpPulse+.002,0,1,a.setValMode.LOOP):"beat against flow"==F?k=a.setVal(b.gpa,b.mpPulse+-.002,0,1,a.setValMode.LOOP):"freqbar with easeback"==F?k=a.setVal(Math.max(r,b.gpa),-.002,0,1,a.setValMode.LIMIT):"advance jumpy"==F?k=a.setVal(b.gpa,.002*f,0,1,a.setValMode.LOOP):"advance"==F?k=a.setVal(b.gpa,.002*r,0,1,a.setValMode.LOOP):"advance with easeback"==F&&(k=a.setVal(b.gpa,.006*f-.002,0,1,a.setValMode.LOOP)));if("group mode"==b.music.keyoff){f="freqbar"==
F?v.length:N;B=E[e].num_group_mode<f?Math.round(f/E[e].num_group_mode):1;G=a.setVal(C*B,0,0,f,a.setValMode.LOOP);if("freqbar"==F)k=v[G];else if("waveform"==F)k=z[G];else{if(0==C){Z=[];for(r=E[e].num_group_mode-1;0<r;r--)n[e].gnlvaniA[g+r].twa=n[e].gnlvaniA[g+r-1].twa,Z[g+r]=n[e].gnlvaniA[g+r].twa;n[e].gnlvaniA[g].twa=a.d4(K.mid);n[e].gnlvaniA[g].twa=z[3];Z[g]=n[e].gnlvaniA[g].twa;a.vprint("scrl",vv?"":"aniOnScrol set    T T T at ii="+g+" beat/pulse val:"+n[e].gnlvaniA[g].twa+"   TWA "+a.dumpvar(Z))}k=
n[e].gnlvaniA[g].twa}r=k;a.vprint("scrl",vv?"":"aniOnScroll div:"+e+" GROUPMODE[ "+C+" of "+E[e].num_group_mode+" ] * binstep:"+B+" of max:"+f+"->dex"+G+" extracted gpA of:"+k);C++}a.vprint("scrl",vv?"":"aniOnScroll div:"+e+" MUSIC keyoff["+b.music.keyoff+"] % "+r+"  drivemode["+F+"] durm?"+b.durm+" beatM:"+b.music.beatMultiple+" %> "+k);r=b.gpa=k}for(r=a.setVal(r*b.durm,0,0,1,a.setValMode.LOOP);b.timsA[m]<r&&m<w;)m++;k=b.timsA[m]-b.timsA[m-1];f=r-b.timsA[m-1];G=a.d4(f/k);f=b.type;B=b.valsA[m-1];
k=b.valsA[m];p=B;A=k;P=G;D=[];if("number"==typeof p)p+=(A-p)*P;else if("object"==typeof p){p.length!=A.length&&a.vprint("scrl",vv?"":"X X X X X X X interpolate beg end LENGTH mismatch:"+p.join("|")+":"+A.join("|"));for(l=0;l<p.length;l++)"number"==typeof p[l]?D.push(p[l]+(A[l]-p[l])*P):(p[l]!=A[l]&&a.vprint("scrl",vv?"":"X X X X X X X interpolate beg end mismatch:"+p[l]+":"+A[l]),D.push(p[l]));p=D.join(",")}else a.vprint("warn","interpolate bad type:"+typeof p),p=void 0;l=b.mytargetid;a.vprint("scrl",
vv?"":"aniOnScroll["+g+"] [type: "+f+"  ][drive: "+F+" ] numvals:"+w+" aBYtran["+l+"]:"+(q[l]-1)+" "+n[e].gnlvaniA[g].attributeName+" gpAlongS:"+t+" gpAlong:"+r+" lpAlong:"+G+" times:"+b.timsA+" vals:"+b.valsA+" dex:"+m+",beg,end:"+B+"|"+k+" now:"+p);if(null!=b.keyPoints)point=Snap.path.getPointAtLength(b.pathd,p*b.zlen),"auto"!=b.rotate&&"auto-reverse"!=b.rotate||null==b.prevpoint?b.prevpoint=point:(theta=Math.atan2(point.y-b.prevpoint.y,point.x-b.prevpoint.x),x[l]=180*theta/Math.PI,"auto-reverse"==
b.rotate&&(x[l]+=180)),a.vprint("scrl",vv?"":"aniOnScroll["+g+"] for keyPoint:"+p+" got:"+point.x+","+point.y+" add2rotate:"+x[l]),p=point.x+","+point.y;else if(null!=x[l]&&"rotate"==f)a.vprint("scrl",vv?"":"aniOnScroll["+g+"] combine rotate:"+p+" and autorotate:"+x[l]),p+=x[l];else if("d"==b.attributeName)p=p.replace(/,?([a-zA-Z]),?/g," $1 "),a.vprint("scrl",vv?"":"aniOnScroll["+g+"] - - - -  CLEANED   - - - -   up d valstr:"+p);else if(!b.attributeName.match(/(stroke-|fill-)/))if(b.attributeName.match(/(stop-color|fill|stroke|flood-color)/)){valstrA=
p.split(/,/);for(hh=0;3>hh;hh++)w=Number(a.setVal(Math.round(valstrA[hh]),0,0,255,a.setValMode.LIMIT)).toString(16),valstrA[hh]=2==w.length?w:"0"+w;p="#"+valstrA.join("");a.vprint("scrl",vv?"":"aniOnScroll["+g+"] cleaned up color valstr:"+p)}else"string"==typeof p&&(p=p.replace(/,([%])/g,"$1"));if("transform"==b.attributeName)if(q[l]--,ha.transform(f+"("+p+")"),w=ha.transform().localMatrix,null==c[l]&&(c[l]=[]),0==q[l]){c[l].push(w);"sum"==b.additive&&c[l].push(b.lmatrix.clone());a.vprint("scrl",
vv?"":"aniOnScroll["+g+"] - APPLY - matrix["+l+"]: num"+c[l].length+" slot:"+b.slot+" kind:"+b.kind+" type:"+b.type);if("path"!=b.kind)if("slide"==b.kind)"scale"==b.type||"rotate"==b.type&&3>c[l].length||"rotate"==b.type&&3>=c[l].length&&b.slot.match(/^image/)?c[l]=c[l].reverse():2<c[l].length&&(first1=c[l].shift(),c[l]=c[l].reverse(),c[l].unshift(first1));else if("patternTransform"==b.realattributeName||"intrinsic"==b.kind&&"rotate"==b.type)c[l]=c[l].reverse();w=new Snap.Matrix;for(m=0;m<c[l].length;m++)w.add(c[l][m]);
b.mytarget.transform(w)}else c[l].push(w);else"currentTime"==b.attributeName?0==ea%5&&(a.vprint("scrl",vv?"":"aniOnScroll["+g+"]["+ea+"]   V I D E O   [  "+n[e].gnlvaniA[g].attributeName+"  ]-> "+p+" cpAlong:"+d),ja?b.mytarget.node.fastSeek?b.mytarget.node.fastSeek(p):(ja=!1,b.mytarget.node.play()):b.mytarget.node.playbackRate=d):"gradientTransform"==b.attributeName?(w=n[e].gnlvaniA[g].type+"("+p+")",b.mytarget.attr(w),a.vprint("scrl",vv?"":"aniOnScroll["+g+"] [  "+n[e].gnlvaniA[g].attributeName+
" type:"+n[e].gnlvaniA[g].type+" ]-> "+w)):(b.mytarget.attr(b.attributeName,p),a.vprint("scrl",vv?"":"aniOnScroll["+g+"] [  "+n[e].gnlvaniA[g].attributeName+"  ]-> "+p));"patternTransform"==b.realattributeName&&(a.vprint("scrl",vv?"":"aniOnScroll["+g+"] patternTransform updated id:"+b.realtarget.attr("id")+" with val:"+p),b.realtarget.transform(b.mytarget.transform().localMatrix))}fa=!1}}da=!1};this.anielapsed=function(d){var h="default";"undefined"!=typeof gnlvScroll&&(h=gnlvScroll.changeDiv());
var b=window.gnlv_start_time&&null!=window.gnlv_start_time[h]?window.gnlv_start_time[h]:L.ani_start_timestamp,m=(Date.now()-b)/1E3;if("absolute"==d)return m;d=a.setVal(m,0,0,R,a.setValMode.LOOP);a.vprint("scrl",vv?"":"anielapsed["+h+"] atime:"+R+" starttimestamp:"+b+" delta:"+m+" return:"+d);return d};this.resetTransforms=function(d){var h=0;null!=d&&L.changeDiv(d);a.vprint("scrl",vv?"":"resetTransforms start on["+e+"] "+(null!=n[e]));if(null==n[e])console.warn("scroll.resetTransforms start NO["+
e+"] of available:"+Object.keys(n));else{for(d=0;d<n[e].gnlvaniA.length;d++){var b=n[e].gnlvaniA[d];a.vprint("scrl",vv?"":"resetTransforms ["+d+"] id:"+b.id+" type:"+b.type+" have orig tran?"+b.origtransform+" target?"+(null!=b.mytarget));b.origtransform&&b.mytarget&&(h++,b.mytarget.transform(b.origtransform))}a.vprint("scrl",vv?"":"resetTransforms checking reset "+h+" of "+n[e].gnlvaniA.length)}};var aa=function(d,h){for(var b,m=d.split(h),f=0;f<m.length;f++)d=m[f].match(/(,\s*|\s+)/),h=m[f].match(/[a-zA-Z%]/),
b=m[f].match(/#/),d?m[f]=aa(m[f],d[0]):b?(diskula=m[f].replace(/#/,""),m[f]=[parseInt(diskula.substr(0,2),16),parseInt(diskula.substr(2,2),16),parseInt(diskula.substr(4,2),16)]):h||(m[f]=a.d4(m[f]));return m},va=function(d){a.vprint("scrl",vv?"":"parseSplines starting on:"+a.dumpvar(d));d.valsA=aa(d.values,/\s*;\s*/);var h=d.valsA.length;if(null!=d.keyTimes)var b=aa(d.keyTimes,/\s*;\s*/);else{var m=[0];for(b=1;b<h;b++)m[b]=Math.min(1,m[b-1]+1/(h-1));b=m}d.timsA=b;if(null!=d.keySplines)h=aa(d.keySplines,
/\s*;\s*/);else{m=[];var f=[0,0,1,1];for(b=1;b<h;b++)m.push(f);h=m}d.splsA=h;return d};this.doSetup=function(d){var h="FROMDIV .gnlv-scroll, FROMDIV .gnlv-mouse, FROMDIV .gnlv-music",b="id attributeName values type dur xlink:href calcMode repeatDur keyTimes keySplines keyPoints rotate additive".split(" "),m={};null==d&&(d={},y={},T={},n={},E={});M=d.usemode?d.usemode:M;h=null==d.fromdiv?h.replace(/FROMDIV/g,""):h.replace(/FROMDIV/g,"#"+d.fromdiv);var f=Snap.selectAll(h);var k;a.vprint("scrl",vv?"":
"scrollSetup - - - -doSetup - - - -");a.vprint("scrl",vv?"":"scrollSetup - - - -doSetup - - - - START usemode:"+M+" - - -fromdiv?"+d.fromdiv+" on num:"+f.length);for(u=0;u<f.length;u++){var A={};h=!1;var B,G;if("edit"==M)mydivid="default";else if(mydivid=f[u].attr("id"),null==mydivid||null!=U[mydivid])mydivid=null==d.fromdiv?"svg"+u:d.fromdiv+"_svg",a.vprint("scrl",vv?"":"scrollSetup - - - -id missing or not unique, newid >   "+mydivid+" <"),f[u].attr("id",mydivid);n[mydivid]={};n[mydivid].slot={};
n[mydivid].gnlvaniA=[];n[mydivid].numAbyTarget={};f[u].started=!1;f[u].hasClass("gnlv-scroll")?Q="scroll":f[u].hasClass("gnlv-mouse")?Q="mouse":f[u].hasClass("gnlv-music")&&(Q="music");a.vprint("scrl",vv?"":"scrollSetup - - - -doSetup - - - - START svgA["+u+"] divid[ "+mydivid+" ] ,anitype:"+Q);null==E[mydivid]&&(E[mydivid]={lastime:(new Date).getTime(),tiltG:0,tiltB:0,gpa:.5});E[mydivid].num_group_mode=0;var C=f[u].select(".gnlv-slot-template");if(C&&C.attr){var t=C.attr("gnlv-data");a.vprint("scrl",
vv?"":"TEMPLATE DATA:"+t);t=a.parsejson(t);t.music&&t.music.mp3?f[u].tlmusic=t.music.mp3:a.vprint("warn","scrollSetup found no mp3!");f[u].volume=t.music&&t.music.volume?t.music.volume:10;R!=t.atime&&(a.vprint("warn","scrollSetup found atime missmatch!"+R+"< going with:>"+t.atime+" if defined"),R=t.atime?t.atime:R)}var l=!1;f[u].hasClass("gnlv-music")&&(l=!0,"undefined"==typeof eloop&&(eloop={}),eloop.templatediv=f[u].parent().attr("id"),eloop.templatediv||(eloop.templatediv="tempid"+Math.floor(1E4*
Math.random()),a.vprint("scrl",vv?"":"scrollSetup no id on templatediv, setting now"),f[u].parent().attr("id",eloop.templatediv)),a.vprint("scrl",vv?"":"scrollSetup | | | | | | | | |  watching MUSIC | | | | | | | | |divid: "+mydivid+" templatediv:"+eloop.templatediv+" tlmusic:"+f[u].tlmusic),"undefined"==typeof gnlvSound&&"undefined"!=typeof GenolveSound?(a.vprint("scrl",vv?"":"scrollSetup X X X NO snd gnlvSound but had CLAS, instantiate now"),gnlvSound=new GenolveSound({vpr:a}),document.gnlvSound=
gnlvSound,volControl=document.gnlvSound.addVol(C)):I&&I.volel&&(a.vprint("scrl",vv?"":"scrollSetup registro vol:"+I.volel),volControl=gnlvSound.registerVol(I.volel)),y[mydivid]="music",eloop.autoResize=eloop.autoResizeSnd?eloop.autoResizeSnd:function(){console.log("gnlvScroll X  X  X  non eloop autoResizeSnd ")},eloop.autoResize());a.vprint("scrl",vv?"":"scrollSetup START with num SVG["+u+"] tag >"+mydivid+"< of "+f.length+" -------------------------------------------------vv--------------------");
var z=f[u].selectAll("g[id=hiddenslotsubnode]");1>z.length?a.vprint("warn","scrollSetup  did not find hiddenslotsubnode for:"+mydivid):ha=z[0];f[u].selectAll(".gnlv-slot-eloop").forEach(function(D,H){H=D.attr("id");t=D.attr("gnlv-data");if(H.match(/.*hidden.*/)||null==t)a.vprint("scrl",vv?"":"scrollSetup skip datagnlv for slot["+H+"] ");else{a.vprint("scrl",vv?"":"SLOT [ "+H+" ]  DATA:"+t);q=a.parsejson(t);if(null!=q.usetagID)for(J in q.usetagID)D=q.usetagID[J],"object"==typeof D&&(D=D.id),A[D]=H,
D.match(/\d$/)&&(A[D.replace(/\d+$/,"N")]=H),("imgcorner"==J||"imgmask"==J)&&(B=f[u].select("#"+D))&&B.parent()&&B.parent().parent()&&(G="imgcorner"==J?B.parent().parent().attr("id"):B.parent().attr("id"),a.vprint("scrl",vv?"":"["+J+"] tagged:"+G),A[G]=H);null==n[mydivid].slot[H]?n[mydivid].slot[H]=q:a.vprint("warn","scrollSetup slot["+H+"] not empty! mydata already logged??????")}});var v=f[u].select("#theoverlayVid");"undefined"!=typeof eloop&&eloop.rmVidTimer?eloop.rmVidTimer(C):v&&v.remove();
C=f[u].selectAll("animate,animateTransform,animateMotion");a.vprint("scrl",vv?"":"scrollSetup START looping animations["+mydivid+"]  -- - - -- "+C.length);for(var K in n[mydivid].slot){var q=n[mydivid].slot[K];if(q.transO&&q.transO.music&&q.transO.music.enable&&"video"==q.transO.music.whichani)for(videlA=f[u].selectAll("#"+K+" video"),a.vprint("scrl",vv?"":"scrollSetup    > videojog <     for slot["+K+"] numel:"+videlA.length),k=0;k<videlA.length;k++)videlA[k].attr("id","anivid"+Math.floor(1E4*Math.random())),
C.push(videlA[k])}for(S=0;S<C.length;S++){v=C[S];var c={};z=v.parent();k=v.attr("id");null==k&&(k="anmttemp"+Math.floor(1E4*Math.random()),v.attr("id",k));var x=k.match(/^aniusr/)?"slide":k.match(/^anipth/)?"path":k.match(/^anmt/)?"intrinsic":k.match(/^anifal/)?"fallingeffect":k.match(/^anivid/)?"video":"unknown";a.vprint("scrl",vv?"":"scrollSetup ======== start["+S+"]["+k+"]"+x);var g=z.attr("id")?z.attr("id"):"none",w=r,r=z,p=r.attr?r.attr("id"):"nada";if("vidtimer"!=k&&"marqSOani"!=k&&"timekeeperani"!=
k){for(;r.parent()&&r.parent().attr&&!r.hasClass("gnlv-slot-eloop")&&!r.hasClass("gnlv-svg");)w=r,r=r.parent(),p=r.attr("id")?r.attr("id"):"nada";if("hiddenslot"==p||r.hasClass("gnlv-svg"))a.vprint("scrl",vv?"":"scrollSetup found hidden, SKIP:"+k+":");else{if("hiddenslotdefs"==p){w=w.attr("id");if(A[w])p=A[w];else if(A[w.replace(/\d+$/,"N")])p=A[w.replace(/\d+$/,"N")];else{a.vprint("scrl",vv?"":"X SKIP X  hiddenslot lookup fail on key:"+w+" for hsd2slot hash:"+a.dumpvar(A));continue}q=n[mydivid].slot[p];
a.vprint("scrl",vv?"":"scrollSetup hiddenslotdefs translate for["+w+"]->"+p)}else n[mydivid].slot[p]?q=n[mydivid].slot[p]:a.vprint("scrl",vv?"":"scrollSetup X X X X X X no slot data/mydata for "+p);w=q&&q.transO&&q.transO.music&&q.transO.music.whichani?q.transO.music.whichani:"all";var P=q&&q.transO&&q.transO.music&&q.transO.music.enable?q.transO.music.enable:!1;a.vprint("scrl",vv?"":"scrollSetup ======== start["+S+"]["+k+"]["+p+"] enabled?"+P+"  have parent?"+(null!=z)+" id:"+g+" type:"+z.node.localName+
" > "+v.node.tagName);if(null!=v.attr("begin")&&!v.attr("begin").match(/theoverlayVid/))a.vprint("warn","scrollSetup skip element with begin, id:"+v.attr("id")+" attr:"+v.attr("attributeName"));else if(null!=v.attr("from")&&null==v.attr("values"))a.vprint("warn","scrollSetup skip element with from to, id:"+v.attr("id")+" attr:"+v.attr("attributeName"));else if("handwave"!=g&&"helpinghand"!=g)if(z.attr("xlink:href")&&z.attr("xlink:href").match(/^#bird/))a.vprint("scrl",vv?"":"scrollSetup SKIP this xlink:"+
z.attr("xlink:href"));else if(l&&("slide"==w&&"slide"!=x||"path"==w&&"path"!=x||"intrinsic"==w&&"intrinsic"!=x||"fallingeffect"==w&&"fallingeffect"!=x||"video"==w&&"video"!=x))a.vprint("scrl",vv?"":"scrollSetup SKIP, bad match with whichani:"+w+" me:"+x);else if(l&&!P)a.vprint("scrl",vv?"":"scrollSetup SKIP, music not enabled");else if(!l&&q.transO&&q.transO.sound&&0==q.transO.sound.enable&&"scroll"!=Q)a.vprint("scrl",vv?"":"scrollSetup SKIP, sound not enabled");else if(l&&P&&"slide"==x&&q.transO.music.drivemode.match(/(freqbar|waveform)/)&&
"group mode"==q.transO.music.keyoff&&"opacity"==v.attr("attributeName"))a.vprint("scrl",vv?"":"scrollSetup SKIP, opacity for slide freqbar group mode");else{c.slot=p;c.kind=x;l&&q.transO&&q.transO.music&&(c.music=$.extend({},q.transO.music),c.sound=$.extend({},q.transO.sound),c.gpa=0,c.twa=0,c.gpb=0,c.threshold=.5,c.mpPulse=0,c.order=-1);q.transO&&q.transO.group&&(c.apply2group=q.transO.group.apply2group);for(k=0;k<b.length;k++)c[b[k]]=v.attr(b[k]);"video"==c.kind&&(c.values=v.attr("data-vbeg")+";"+
v.attr("data-vend"),c.dur=v.attr("data-vend")-v.attr("data-vbeg"),c.repeatDur="indefinite",c.kind="video",c.attributeName="currentTime",ja&&(v.attr("data-vres","never"),v.node.pause()),a.vprint("scrl",vv?"":"scrollSetup videojog params now:"+a.dumpvar(c)));if(v.attr("origid")||z.attr("origid"))h=!0,c.order=v.attr("origid")||z.attr("origid");"feColorMatrix"==z.node.localName&&(c.type="feColorMatrix");if("rotate"==c.type||"d"==c.attributeName||"feColorMatrix"==c.type)c.values=c.values.replace(/\s*;\s*/g,
";").replace(/\s+$/,"").replace(/([a-yA-Y])/g,"$1 ").replace(/\s+/g,",").replace(/,,/g,",").replace(/[,;]$/,""),a.vprint("scrl",vv?"":"scrollSetup CLEANED UP rotate/d values:"+c.values);"feColorMatrix"==c.type&&(c.values=c.values.replace(/\r\n/g,""));c.attributeName&&c.attributeName.match(/(stop-color|fill|stroke|flood-color|d)/)||!c.values||(c.values=c.values.replace(/([a-zA-Z%])/g,",$1"));null!=c.keyPoints&&(c.values=c.keyPoints,thepathid=v.select("mpath").attr("xlink:href"),pathd=f[u].select(thepathid),
a.vprint("scrl",vv?"":"aniOnScroll aniMo pathid:"+thepathid+" found it?"+pathd),null!=pathd&&(c.pathd=pathd.attr("d"),c.zlen=Snap.path.getTotalLength(c.pathd),c.attributeName="transform",c.type="translate",c.kind="path"));c=va(c);c.durm=R/parseFloat(c.dur);l&&(c.durm=1,q.transO&&q.transO.music&&q.transO.music.enable&&("slide"==x&&q.transO.music.drivemode.match(/(freqbar|waveform)/)&&"group mode"==q.transO.music.keyoff&&(c.skipPause=!0,junk=c.timsA.shift(),junk=c.valsA.shift(),1<c.timsA.length&&(junk=
c.timsA.pop(),junk=c.valsA.pop()),c.timsA[0]=0,c.timsA[c.timsA.length-1]=1,a.vprint("scrl",vv?"":" drivemode freqbarmod valsA  now:"+c.valsA+" timsA:"+c.timsA)),a.vprint("scrl",vv?"":" drivemode:"+F+","+q.transO.music.drivemode),q.transO.music.drivemode.match(/^beat/)&&(ia=!0),"group mode"==q.transO.music.keyoff&&E[mydivid].num_group_mode++,null==n[mydivid].slot[c.slot].started?(f[u].tlmusic?a.vprint("scrl",vv?"":"scrollSetup  have tlmusic SKIP paramO file ["+c.sound.snd+"]!!!!!"):(a.vprint("scrl",
vv?"":"scrollSetup  START paramO music["+c.sound.snd+"]  !!!!!"),gnlvSound.start(c.sound)),a.vprint("scrl",vv?"":"scrollSetup  TODO  beat or headless per sound"),n[mydivid].slot[c.slot].started=!0):a.vprint("scrl",vv?"":"scrollSetup  sound["+c.sound.snd+"] already started")));a.vprint("scrl",vv?"":"scrollSetup paramO [ "+S+" ]  : "+a.dumpvar(c));a.vprint("scrl",vv?"":"scrollSetup paramO------------------------------");c.mytarget=c["xlink:href"]?f[u].select(c["xlink:href"]):"video"==c.kind?v:z;x=c.mytargetid=
c.mytarget.attr("id");null==x&&(x=c.mytargetid="temp"+Math.floor(1E4*Math.random()),a.vprint("scrl",vv?"":"scrollSetup no id for animate target! setting now:"+x),c.mytarget.attr?c.mytarget.attr("id",x):a.vprint("warn","scrollSetup failed to set id"));"transform"==c.attributeName&&(c.mytarget&&"function"==typeof c.mytarget.transform&&"symbol"!=z.node.localName?c.lmatrix=c.mytarget.transform().localMatrix:(a.vprint("scrl",vv?"":"scrollSetup X X X no transform off["+c.id+"]:target:"+c.mytarget+" fake it"),
c.lmatrix=new Snap.Matrix),null!=c.keyPoints&&"matrix(1,0,0,1,0,0)"!=c.lmatrix.toString()&&(a.vprint("scrl",vv?"":"scrollSetup X X X aniMo initial transform NOT OK:"+c.lmatrix.toString()),c.mytarget.transform("matrix(1,0,0,1,0,0)")),n[mydivid].numAbyTarget[x]=null==n[mydivid].numAbyTarget[x]?1:n[mydivid].numAbyTarget[x]+1);"patternTransform"==c.attributeName&&(k=c.mytarget.attr("patternTransform"),a.vprint("scrl",vv?"":"scrollSetup patternTransform attr:"+c.mytarget.attr("patternTransform")+" parentid:"+
g+" lmat:"+k+" type:"+c.type),c.realtarget=c.mytarget,z=f[u].selectAll("g[id=hiddenslotdefssubnode]"),1>z.length?a.vprint("error","X X X X scrollSetup patternTransform did not find hiddenslotdefssubnode"):(c.mytarget=z[0],c.mytarget.transform(k),c.lmatrix=c.mytarget.transform().localMatrix.clone(),a.vprint("scrl",vv?"":"scrollSetup patternTransform proxy setup with transform:"+c.lmatrix),c.realattributeName=c.attributeName,c.attributeName="transform",x=g,n[mydivid].numAbyTarget[x]=null==n[mydivid].numAbyTarget[x]?
1:n[mydivid].numAbyTarget[x]+1));null==m[x]&&(m[x]={});g=c.realattributeName?c.realattributeName:c.attributeName;"currentTime"!=g&&(m[x][g]=1,v.node.setAttribute("fill","remove"),"idle2play"==M?(v.attr("repeatDur","indefinite"),v.node.setAttribute("fill","remove")):v.attr("repeatDur",1E-6),c.lmatrix&&c.mytarget&&(c.origtransform=c.lmatrix.toString()+"",c.mytarget.attr("data-transform",c.origtransform)));c.myself=v;n[mydivid].gnlvaniA.push(c)}}}}1==h&&(a.vprint("scrl",vv?"":"scrollSetup SPECIAL SORT!"),
n[mydivid].gnlvaniA.sort((D,H)=>parseFloat(D.order)-parseFloat(H.order)));a.vprint("scrl",vv?"":"scrollSetup ======== vv =============["+u+"]================ vv");a.vprint("scrl",vv?"":"scrollSetup ======== setup scroll for num animations:"+n[mydivid].gnlvaniA.length+" ID:"+mydivid);a.vprint("scrl",vv?"":"scrollSetup ======== last drivemode:"+F+" found_beat?"+ia);a.vprint("scrl",vv?"":"scrollSetup ======== willchange list:"+a.dumpvar(m));myvol=f[u].select("#vol_on_off");f[u].tlmusic&&0==f[u].started?
(gnlvSound.doplots=!1,F.match(/^beat/)||ia?gnlvSound.ana("onbeat"):gnlvSound.ana("headless"),h={enable:!0,snd:"tlmusic",pl:mydivid,playmode:"continuous",do3d:!1,file:f[u].tlmusic,volume:f[u].volume,usemode:M},a.vprint("scrl",vv?"":"scrollSetup =======   M U S I C  ======= PRELOAD top level music usemode:"+M+"  vol["+typeof myvol+"] file:"+a.dumpvar(h)+" ======== !!!!!"),myvol&&myvol.attr&&(volver=myvol.attr("data-ver"),myvol.attr("data-target",mydivid),h.volel=myvol,myvol.parent()&&myvol.parent().select("#timekeeperani")&&
myvol.parent().select("#timekeeperani").attr("data-target",mydivid)),"idle2play"==M?gnlvSound.preload(h):gnlvSound.start(h),f[u].started=!0,gnlvSound.muteTrans=L.resetTransforms):a.vprint("scrl",vv?"":"scrollSetup ======== NO top level music defined");for(J in m)if(h=Object.keys(m[J]).join(","),l=f[u].select("#"+J))l.node.style.willChange=h;"scroll"==Q?(a.vprint("scrl",vv?"":"scrollSetup | | | | | | | | |  watching SCROLL | | | | | | | | | "+mydivid+" vol?"+typeof myvol+" music?"+t.music),myvol&&
myvol.attr&&t.music&&t.music.mp3&&myvol.removeClass("gnlv-gone"),y[mydivid]="scroll",$(window).off("scroll.genolve"),$(window).on("scroll.genolve",{value:mydivid},qa),a.vprint("scrl",vv?"":"scrollSetup | | now")):"mouse"==Q?a.getBrowser("isMobile")?(a.vprint("scrl",vv?"":"scrollSetup | | | | | | | | |  watching TILT | | | | | | | | | "+mydivid),y[mydivid]="tilt",e=mydivid,window.addEventListener("devicemotion",pa,!1)):(a.vprint("scrl",vv?"":"scrollSetup | | | | | | | | |  watching MOUSE | | | | | | | | | "+
mydivid),y[mydivid]="mouse",$(window).off("mousemove.genolve"),$(window).on("mousemove.genolve",{value:mydivid},oa)):"music"==Q?(a.vprint("scrl",vv?"":"scrollSetup | | | | | | | | |  watching MUSIC | | | | | | | | | ID:"+mydivid+" interval->20"),y[mydivid]="music",e=mydivid,"idle2play"==M&&(gnlvSound.muteExtra&&a.vprint("warn",vv?"":"scrollSetup setting muteExtra toggleMuzPause but not null:"+gnlvSound.muteExtra),gnlvSound.muteExtra=L.toggleMuzPause,gnlvSound.playExtra&&a.vprint("warn",vv?"":"scrollSetup setting playExtra toggleMuzPlay but not null:"+
gnlvSound.playExtra),gnlvSound.playExtra=L.toggleMuzPlay),document.gnlv_ana_interval=window.setInterval(ra,20),$(window).off("beat"),$(window).on("beat",ta)):a.vprint("scrl",vv?"":"scrollSetup NO ANITYPE no scroll flages detected");U[mydivid]=f[u]}a.vprint("scrl",vv?"":"scrollSetup | | | | | | | | | setup done");a.vprint("scrl",vv?"":"scrollSetup | | | | |");"undefined"!=typeof eloop&&eloop.mkVidtimer&&"edit"==M&&(a.vprint("scrl",vv?"":"scrollSetup | | mkVidtimer"),eloop.mkVidtimer())};I&&"minimal"==
I.usemode||L.doSetup();"stub"==eloop.version&&null==eloop.anielapsed&&(eloop.anielapsed=this.anielapsed)};
