!function(){"use strict";var t,i,e;function s(t,i){this.slider=t,this.carousel=i,t.one("revolution.slide.onloaded",this.onLoaded.bind(this)).one("rsBubbleMorphDestroyed",this.destroy.bind(this))}function r(){var i=t(this),e=i.data("bubbleaddon");e&&(e.destroy(),i.removeData("bubbleaddon"))}function h(t,i){if(!t)return!1;if(0===i)return t[i];for(var e=i,s=t[i];"inherit"===s;)s=--e>-1?t[e]:t[0];return s}function n(t){var e,s,r,h=t.levels,n=h.length,a=i.width(),l=0;if(h)for(var o=0;o<n;o++)s!==(r=h[o])&&(a<r&&(l=o),s=r);var d=t.layerW[l],u=t.layerH[l],b="100%"===u||"full"===u;if("100%"===d||"full"===d){var p=!t.carousel||t.isStatic?t.slider:t.slotholder;t.fullAlign?(d=p.width(),t.wrapper[0].style.left=0):(e=Math.min(t.slider.width()/t.grids[l],1),d=t.grids[l]*e)}else d=parseInt(t.layr.css("width"),10);return b?(u=t.isStatic?t.slider.height():t.slotholder.height(),t.wrapper[0].style.top=0):u=parseInt(t.layr.css("height"),10),{width:d,height:u,level:l}}function a(){var i=t(this),s=i.data("bubbleObj"),a=!1,o=i.data("bubbleaddon");if(s&&(9999===s.slideIndex&&parseInt(i.data("bubbleIndex"),0)>=parseInt(i.data("startslide"),0)&&parseInt(i.data("bubbleIndex"),0)<=parseInt(i.data("endslide"),0)&&(a=!0),i.data("bubbleIndex")==s.slideIndex||!0===a)){o&&r.call(this);var d=n(s),u=d.level,p=h(s.blurStrength,u),c=h(s.borderSize,u),f=h(s.borderColor,u),g=h(s.blurColor,u),v=h(s.blurX,u),w=h(s.blurY,u),y=h(s.bufferX,u),m=h(s.bufferY,u),x=h(s.numBubbles,u),S=h(s.velX,u),I=h(s.velY,u),M=function(t,i,s,r,h,n,a,l,o,d,u,p,c,f,g,v,w){var y,m={screen:{elem:null,callback:null,ctx:null,width:0,height:0,left:0,top:0,init:function(t,i){return this.elem=r,this.callback=t||null,"CANVAS"==this.elem.tagName&&(this.ctx=this.elem.getContext("2d")),this.elem.onselectstart=function(){return!1},this.elem.ondrag=function(){return!1},i&&this.resize(),this},resize:function(){var e=this.elem;for(this.width=t,this.height=i,this.left=0,this.top=0;null!=e;e=e.offsetParent)this.left+=e.offsetLeft,this.top+=e.offsetTop;this.ctx&&(this.elem.width=this.width,this.elem.height=this.height),y&&(y.width=this.width,y.height=this.height),this.callback&&this.callback()},destroy:function(){for(var t in this)this.hasOwnProperty(t)&&delete this[t]}}},x=function(t,i){this.x=t,this.y=i,this.magnitude=t*t+i*i,this.computed=0,this.force=0};x.prototype.add=function(t){return new x(this.x+t.x,this.y+t.y)};var S=function(t){var i=.1,e=1.5;this.vel=new x((Math.random()>.5?1:-1)*(.2+Math.random()*g),(Math.random()>.5?1:-1)*(.2+Math.random()*v)),this.pos=new x(.2*t.width+Math.random()*t.width*.6,.2*t.height+Math.random()*t.height*.6),this.size=t.wh/Math.min(30,15/w)+(Math.random()*(e-i)+i)*(t.wh/Math.min(30,15/w)),this.width=t.width,this.height=t.height};S.prototype.move=function(){this.pos.x>=this.width-this.size-c?(this.vel.x>0&&(this.vel.x=-this.vel.x),this.pos.x=this.width-this.size-c):this.pos.x<=this.size+c&&(this.vel.x<0&&(this.vel.x=-this.vel.x),this.pos.x=this.size+c),this.pos.y>=this.height-this.size-f?(this.vel.y>0&&(this.vel.y=-this.vel.y),this.pos.y=this.height-this.size-f):this.pos.y<=this.size+f&&(this.vel.y<0&&(this.vel.y=-this.vel.y),this.pos.y=this.size+f),this.pos=this.pos.add(this.vel)};var I=function(t,i,e,s){this.step=5,this.width=t,this.height=i,this.wh=Math.min(t,i),this.sx=Math.floor(this.width/this.step),this.sy=Math.floor(this.height/this.step),this.paint=!1,this.metaFill=M(t,i,s),this.plx=[0,0,1,0,1,1,1,1,1,1,0,1,0,0,0,0],this.ply=[0,0,0,0,0,0,1,0,0,1,1,1,0,1,0,1],this.mscases=[0,3,0,3,1,3,0,3,2,2,0,2,1,1,0],this.ix=[1,0,-1,0,0,1,0,-1,-1,0,1,0,0,1,1,0,0,0,1,1],this.grid=[],this.balls=[],this.iter=0,this.sign=1;for(var r=0;r<(this.sx+2)*(this.sy+2);r++)this.grid[r]=new x(r%(this.sx+2)*this.step,Math.floor(r/(this.sx+2))*this.step);for(var h=0;h<e;h++)this.balls[h]=new S(this)};I.prototype.destroy=function(){var t;for(t in this.balls)this.balls.hasOwnProperty(t)&&delete this.balls[t];for(t in this)this.hasOwnProperty(t)&&delete this[t]},I.prototype.computeForce=function(t,i,e){var s,r=e||t+i*(this.sx+2);if(0===t||0===i||t===this.sx||i===this.sy)s=.6*this.sign;else{s=0;var h=this.grid[r];if(!h)return;for(var n,a=0;n=this.balls[a++];)s+=n.size*n.size/(-2*h.x*n.pos.x-2*h.y*n.pos.y+n.pos.magnitude+h.magnitude);s*=this.sign}if(this.grid[r])return this.grid[r].force=s,s},I.prototype.marchingSquares=function(t){var i=t[0],e=t[1],s=t[2],r=i+e*(this.sx+2);if(this.grid[r]){if(this.grid[r].computed===this.iter)return!1;for(var h,n,a=0,l=0;l<4;l++){var o=i+this.ix[l+12]+(e+this.ix[l+16])*(this.sx+2);if(!this.grid[o]){n=!0;break}var d=this.grid[o].force;(d>0&&this.sign<0||d<0&&this.sign>0||!d)&&(d=this.computeForce(i+this.ix[l+12],e+this.ix[l+16],o)),Math.abs(d)>1&&(a+=Math.pow(2,l))}if(!n){if(15===a)return[i,e-1,!1];if(5===a)h=2===s?3:1;else if(10===a)h=3===s?0:2;else{if(h=this.mscases[a],!this.grid[r])return;this.grid[r].computed=this.iter}var u=this.step/(Math.abs(Math.abs(this.grid[i+this.plx[4*h+2]+(e+this.ply[4*h+2])*(this.sx+2)].force)-1)/Math.abs(Math.abs(this.grid[i+this.plx[4*h+3]+(e+this.ply[4*h+3])*(this.sx+2)].force)-1)+1);return z.lineTo(this.grid[i+this.plx[4*h]+(e+this.ply[4*h])*(this.sx+2)].x+this.ix[h]*u,this.grid[i+this.plx[4*h+1]+(e+this.ply[4*h+1])*(this.sx+2)].y+this.ix[h+4]*u),this.paint=!0,[i+this.ix[h+4],e+this.ix[h+8],h]}}},I.prototype.renderMetaballs=function(){for(var t,i=0;t=this.balls[i++];)t.move();for(this.iter++,this.sign=-this.sign,this.paint=!1,z.fillStyle=this.metaFill,a&&(z.shadowBlur=a,z.shadowColor=l,z.shadowOffsetX=o,z.shadowOffsetY=d),p&&(z.strokeStyle=u,z.lineWidth=p),z.beginPath(),i=0;t=this.balls[i++];){var e=[Math.round(t.pos.x/this.step),Math.round(t.pos.y/this.step),!1];do{e=this.marchingSquares(e)}while(e);this.paint&&(z.fill(),z.closePath(),p&&z.stroke(),z.beginPath(),this.paint=!1)}};var M=function(t,i,s){return s[1]?"radial"===(s=s[0]).type?function(t,i,e,s){i*=.5,e*=.5;for(var r,h=t.createRadialGradient(i,e,0,i,e,i),n=s.length,a=0;a<n;a++)r=s[a],h.addColorStop(.01*r.position,b(r.r,r.g,r.b,r.a));return h}(z,t,i,s.colors):function(t,i,s,r,h){var n,a,l,o=e.calcLinearGradient(t,i,s,h,!0);n=r.length;for(var d=0;d<n;d++)a=r[d],l=parseInt(a.position,10),o.addColorStop(.01*l,b(a.r,a.g,a.b,a.a));return o}(z,t,i,s.colors,s.angle):s[0]},F=function(){P&&!P.paused&&(z.clearRect(0,0,O.width,O.height),y.renderMetaballs(),requestAnimationFrame(F))},O=m.screen.init(null,!0),z=O.ctx,A=function(){y&&y.destroy(),y=new I(O.width,O.height,h,n)};function C(){P.paused=!0,cancelAnimationFrame(F),z.clearRect(0,0,O.width,O.height),y&&y.destroy(),O.destroy(),y=null,m=null,x=null,S=null,I=null,F=null,O=null,P=null,A=null,M=null,z=null}var P={play:F,paused:!0,screen:O,inited:A,started:!1,destroy:C,height:i,width:t};return P}(d.width,d.height,s.slider,s.canvas,parseInt(x,10),s.color,parseInt(p,10),g,parseInt(v,10),parseInt(w,10),f,parseInt(c,10),parseInt(y,10),parseInt(m,10),parseFloat(S),parseFloat(I),s.opt.bw);i.data("bubbleaddon",M),i.data("bubblesplaying")&&l(M,i)}}function l(t,i){t.paused=!1,t.screen.resize(),t.started||(t.started=!0,t.inited()),i.data("bubblesplaying",!0),t.play()}function o(t,i){t.paused=!0,i.data("bubblesplaying",!1)}function d(t){for(var i,e=t.colors,s=e.length,r=[],h=0;h<s;h++){var n=e[h];delete n.align,i?JSON.stringify(n)!==JSON.stringify(i)&&(r[r.length]=n):r[r.length]=n,i=n}return t.colors=r,t}function u(t){if("object"==typeof t)return[t=d(t),!0];if("transparent"===t.trim())return["#FFFFFF",!1];if(-1===t.search(/\[\{/))return-1!==t.search("#")?[t,!1]:-1!==t.search("rgba")?[t.replace(/\s/g,"").replace(/false/g,"1"),!1]:-1!==t.search("rgb")?[t.replace(/\s/g,""),!1]:/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(t)?[t,!1]:["#FFFFFF",!1];try{return[t=d(t=JSON.parse(t.replace(/\&/g,'"'))),!0]}catch(t){return["#FFFFFF",!1]}}function b(t,i,e,s){return"rgba("+t+", "+i+", "+e+", "+s+")"}window.BubbleMorphAddOn=function(e,r,h){if(e&&r)return i=(t=e)(window),t.event.special.rsBubbleMorphDestroyed={remove:function(t){t.handler()}},new s(r,h)},s.prototype={onLoaded:function(){var i,s=this.slider,r=this.carousel,h=!(!t.fn.revolution||!t.fn.revolution[s[0].id])&&t.fn.revolution[s[0].id];if(e=t.fn.revolution,h){this.revObj=h;var n=h.gridwidth,a=h.responsiveLevels;for(Array.isArray(n)||(n=[n]);n.length<4;)n[n.length]=n[n.length-1];for(i=0;i<4;i++)n[i]=parseInt(n[i],10);if(a){for(Array.isArray(a)||(a=[a]);a.length<4;)a[a.length]=a[a.length-1];for(i=0;i<4;i++)a[i]=parseInt(a[i],10)}this.morph=s.find(".tp-bubblemorph").each((function(){var i=t(this),e=i.attr("data-bubblemorph");try{e=JSON.parse(e)}catch(t){return}var l=t("<canvas />").appendTo(i),o=e.num,d=e.speedx,b=e.speedy,p=e.bufferx,c=e.buffery,f=i.attr("data-dim");if(f){for(var g=!1,v=!1,w=(f=f.split(";")).length,y=0;y<w&&("w"===f[y].charAt(0).toLowerCase()?g=f[y].replace("w:","").split(","):"h"===f[y].charAt(0).toLowerCase()&&(v=f[y].replace("h:","").split(",")),!1===g||!1===v);y++);if(!1!==g&&!1!==v){for(;g.length<4;)g[g.length]=g[g.length-1];for(;v.length<4;)v[v.length]=v[v.length-1];for(;v.length<g.length;)v[v.length]=v[v.length-1];for(;g.length<v.length;)v[g.length]=g[g.length-1];o=o.split("|"),p=p.split("|"),c=c.split("|"),d=d.split("|"),b=b.split("|");var m=i.hasClass("rs-layer-static")?i.closest("rs-static-layers"):i.closest("rs-slide"),x={opt:h,velX:d,velY:b,layr:i,grids:n,layerW:g,layerH:v,slider:s,levels:a,bufferX:p,bufferY:c,canvas:l[0],carousel:r,numBubbles:o,wrapper:i.closest("rs-layer-wrap"),isStatic:i.hasClass("rs-layer-static"),color:u(e.bg),fullAlign:"slide"===this.getAttribute("data-basealign"),slotholder:m.find("rs-sbg-wrap"),slideIndex:i.hasClass("rs-layer-static")?9999:parseInt(m.attr("data-originalindex"),10)},S=e.blur;S&&(x.blurStrength=S.split("|"),x.blurColor=e.blurcolor.split("|"),x.blurX=e.blurx.split("|"),x.blurY=e.blury.split("|"));var I=e.bordersize;I&&(x.borderSize=I.split("|"),x.borderColor=e.bordercolor.split("|")),i.data("bubbleObj",x)}}})),this.morph.length?(void 0!==this.revObj.onBeforeSwap&&this.beforeChange.call(this,null,this.revObj.onBeforeSwap),s.on("leftviewport",this.leftViewport.bind(this)).on("enterviewport",this.enterViewport.bind(this)).on("revolution.slide.onbeforeswap",this.beforeChange.bind(this)).on("revolution.slide.onafterswap",this.afterSwap.bind(this)).on("revolution.slide.afterdraw",this.onResize.bind(this)).on("revolution.slideprepared",this.slidePrepared.bind(this))):this.destroy()}},slidePrepared:function(t,i){this.waitingForSlidePrepare&&this.beforeChange.call(this,null,this.revObj.onBeforeSwap)},beforeChange:function(t,i){this.waitingForSlidePrepare=!1,(this.revObj.slidePresets&&this.revObj.slidePresets[i.nextSlideLIIndex]||(this.waitingForSlidePrepare=!0,this.carousel))&&(this.slider.find(".tp-bubblemorph").data("bubbleIndex",parseInt(i.nextSlideIndex,10)),this.carousel?this.slider.on("revolution.slide.layeraction",this.layerAction.bind(this)):this.slider.one("revolution.slide.layeraction",this.layerAction.bind(this)))},afterSwap:function(i,e){var s=e.slideIndex-1;this.slider[0].activeBubbleIndex=s,this.slider.find("rs-slide").each((function(i,e){t(e).find(".tp-bubblemorph").each((function(){if(i!==s){this.bubbleSlideIndex=i;var e=t(this),r=e.data("bubbleaddon");r&&o(r,e)}}))}))},enterViewport:function(){var i=this.slider[0].activeBubbleIndex;this.slider.find(".tp-bubblemorph").each((function(){var e=t(this),s=e.data("bubbleaddon");s&&s.paused&&(void 0===this.bubbleSlideIndex||this.bubbleSlideIndex===i)&&l(s,e)}))},leftViewport:function(i){this.slider.find(".tp-bubblemorph").each((function(){var i=t(this),e=i.data("bubbleaddon");e&&o(e,i)}))},createBubbles:function(){this.morph.each(a)},onResize:function(t){clearTimeout(this.resizeTimer),this.resizeTimer=setTimeout(this.resize.bind(this),250)},resize:function(){this.morph.each((function(){var i=t(this);i.data("bubbleaddon")&&(r.call(i),a.call(i))}))},layerAction:function(i){var e=this;this.slider.find(".tp-bubblemorph").each((function(){var i=t(this),s=i.data("bubbleaddon");if(s||a.call(i),s=i.data("bubbleaddon")){if(s.screen&&s.screen.width&&s.screen.height||(a.call(i),s=i.data("bubbleaddon")),e.carousel){var r=n(i.data("bubbleObj"));r.width===s.width&&r.height===s.height||a.call(i)}s.paused&&s.screen&&s.screen.resize&&l(s,i)}}))},checkRemoved:function(){return(!this.slider||!document.body.contains(this.slider[0]))&&(this.destroy(),!0)},destroy:function(){for(var i in this.slider.find(".tp-bubblemorph").each((function(){var i=t(this);i.data("bubbleaddon").paused=!0,i.removeData("bubbleaddon bubbleObj")})),this)this.hasOwnProperty(i)&&delete this[i]}},window.RS_MODULES=window.RS_MODULES||{},window.RS_MODULES.bubblemorph={loaded:!0,version:"3.0.4"},window.RS_MODULES.checkMinimal&&window.RS_MODULES.checkMinimal()}();