(function(n,t){typeof define=="function"&&define.amd?define(["jquery"],t):t(n.jQuery)})(this,function(n){function u(){var i=document.createElement("smartbanner"),n={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var t in n)if(i.style[t]!==undefined)return{end:n[t]};return!1}var t=navigator.userAgent,r=/Edge/i.test(t),i=function(i){var e,u,f;if((this.origHtmlMargin=parseFloat(n("html").css("margin-top")),this.options=n.extend({},n.smartbanner.defaults,i),e=navigator.standalone,this.options.force?this.type=this.options.force:t.match(/Windows Phone/i)!==null&&t.match(/Edge|Touch/i)!==null?this.type="windows":t.match(/iPhone|iPod/i)!==null||t.match(/iPad/)&&this.options.iOSUniversalApp?t.match(/Safari/i)!==null&&(t.match(/CriOS/i)!==null||t.match(/FxiOS/i)!=null||window.Number(t.substr(t.indexOf("OS ")+3,3).replace("_","."))<6)&&(this.type="ios"):t.match(/\bSilk\/(.*\bMobile Safari\b)?/)||t.match(/\bKF\w/)||t.match("Kindle Fire")?this.type="kindle":t.match(/Android/i)!==null&&(this.type="android"),this.type&&!e&&!this.getCookie("sb-closed")&&!this.getCookie("sb-installed"))&&(this.scale=this.options.scale=="auto"?n(window).width()/window.screen.width:this.options.scale,this.scale<1&&(this.scale=1),u=n(this.type=="android"?'meta[name="google-play-app"]':this.type=="ios"?'meta[name="apple-itunes-app"]':this.type=="kindle"?'meta[name="kindle-fire-app"]':'meta[name="msApplication-ID"]'),u.length)){if(this.type=="windows")r&&(this.appId=n('meta[name="msApplication-PackageEdgeName"]').attr("content")),this.appId||(this.appId=n('meta[name="msApplication-PackageFamilyName"]').attr("content"));else if(f=/app-id=([^\s,]+)/.exec(u.attr("content")),f)this.appId=f[1];else return;this.title=this.options.title?this.options.title:u.data("title")||n("title").text().replace(/\s*[|\-·].*$/,"");this.author=this.options.author?this.options.author:u.data("author")||(n('meta[name="author"]').length?n('meta[name="author"]').attr("content"):window.location.hostname);this.iconUrl=u.data("icon-url");this.price=u.data("price");this.options.onInstall=typeof this.options.onInstall=="function"?this.options.onInstall:function(){};this.options.onClose=typeof this.options.onClose=="function"?this.options.onClose:function(){};this.create();this.show();this.listen()}};(i.prototype={constructor:i,create:function(){var t,u=this.price||this.options.price,f=this.options.url||function(){switch(this.type){case"android":return"market://details?id=";case"kindle":return"amzn://apps/android?asin=";case"windows":return r?"ms-windows-store://pdp/?productid=":"ms-windows-store:navigate?appid="}return"https://itunes.apple.com/"+this.options.appStoreLanguage+"/app/id"}.call(this)+this.appId,o=u?function(){var n=u+" - ";switch(this.type){case"android":return n+this.options.inGooglePlay;case"kindle":return n+this.options.inAmazonAppStore;case"windows":return n+this.options.inWindowsStore}return n+this.options.inAppStore}.call(this):"",e=this.options.iconGloss==null?this.type=="ios":this.options.iconGloss,i;this.type=="android"&&this.options.GooglePlayParams&&(f+="&referrer="+this.options.GooglePlayParams);i='
×<\/a><\/span>
'+this.title+"<\/strong>"+this.author+"<\/span>"+o+'<\/span><\/div>'+this.options.button+"<\/span><\/a><\/div><\/div>";this.options.layer?n(this.options.appendToSelector).append(i):n(this.options.appendToSelector).prepend(i);this.options.icon?t=this.options.icon:this.iconUrl?t=this.iconUrl:n('link[rel="apple-touch-icon-precomposed"]').length>0?(t=n('link[rel="apple-touch-icon-precomposed"]').attr("href"),this.options.iconGloss==null&&(e=!1)):n('link[rel="apple-touch-icon"]').length>0?t=n('link[rel="apple-touch-icon"]').attr("href"):n('meta[name="msApplication-TileImage"]').length>0?t=n('meta[name="msApplication-TileImage"]').attr("content"):n('meta[name="msapplication-TileImage"]').length>0&&(t=n('meta[name="msapplication-TileImage"]').attr("content"));t?(n("#smartbanner .sb-icon").css("background-image","url("+t+")"),e&&n("#smartbanner .sb-icon").addClass("gloss")):n("#smartbanner").addClass("no-icon");this.bannerHeight=n("#smartbanner").outerHeight()+2;this.scale>1&&(n("#smartbanner").css("top",parseFloat(n("#smartbanner").css("top"))*this.scale).css("height",parseFloat(n("#smartbanner").css("height"))*this.scale).hide(),n("#smartbanner .sb-container").css("-webkit-transform","scale("+this.scale+")").css("-msie-transform","scale("+this.scale+")").css("-moz-transform","scale("+this.scale+")").css("width",n(window).width()/this.scale));n("#smartbanner").css("position",this.options.layer?"absolute":"relative")},listen:function(){n("#smartbanner .sb-close").on("click",n.proxy(this.close,this));n("#smartbanner .sb-button").on("click",n.proxy(this.install,this))},show:function(t){var i=n("#smartbanner"),r;i.stop();this.options.layer?(i.animate({top:0,display:"block"},this.options.speedIn).addClass("shown").show(),n(this.pushSelector).animate({paddingTop:this.origHtmlMargin+this.bannerHeight*this.scale},this.options.speedIn,"swing",t)):n.support.transition?(i.animate({top:0},this.options.speedIn).addClass("shown"),r=function(){n("html").removeClass("sb-animation");t&&t()},n(this.pushSelector).addClass("sb-animation").one(n.support.transition.end,r).css("margin-top",this.origHtmlMargin+this.bannerHeight*this.scale)):i.slideDown(this.options.speedIn).addClass("shown")},hide:function(t){var i=n("#smartbanner"),r;i.stop();this.options.layer?(i.animate({top:-1*this.bannerHeight*this.scale,display:"block"},this.options.speedIn).removeClass("shown"),n(this.pushSelector).animate({paddingTop:this.origHtmlMargin},this.options.speedIn,"swing",t)):n.support.transition?(this.type!=="android"?i.css("top",-1*this.bannerHeight*this.scale).removeClass("shown"):i.css({display:"none"}).removeClass("shown"),r=function(){n("html").removeClass("sb-animation");t&&t()},n(this.pushSelector).addClass("sb-animation").one(n.support.transition.end,r).css("margin-top",this.origHtmlMargin)):i.slideUp(this.options.speedOut).removeClass("shown")},close:function(n){n.preventDefault();this.hide();this.setCookie("sb-closed","true",this.options.daysHidden);this.options.onClose(n)},install:function(n){this.options.hideOnInstall&&this.hide();this.setCookie("sb-installed","true",this.options.daysReminder);this.options.onInstall(n)},setCookie:function(n,t,i){var r=new Date;r.setDate(r.getDate()+i);t=encodeURI(t)+(i==null?"":"; expires="+r.toUTCString());document.cookie=n+"="+t+"; path=/;"},getCookie:function(n){for(var r,u,i=document.cookie.split(";"),t=0;t