PageSourceSearch

https://www.calacademy.org/sites/default/files/js/js_7nIMTCDroOlDOOD8z9lP4ElLzNoNX5U4eacRcSK6q_o.js

js calacademy.org collected 2026-09-24 06:24:41 UTC 411,938 bytes, 6,921 lines download raw bytes

1var ChimeraPopup = function () {
2	var $ = jQuery;
3
4	var _onDateSelect = function (td) {
5		var data = td.data();
6
7		if (data.performance) {
8			var url = chimera.TNEW_URL + chimera.CART_URL_LOGIN + encodeURIComponent('/memberadmissiontimed/' + data.performance.PerformanceId);
9			window.location.href = url;
10		}
11
12		return false;
13	}
14
15	var _onData = function () {
16		$('.modal.chimera').find('td').each(function () {
17			$(this).removeClass('active');
18			var data = $(this).data();
19
20			// make sure tix on sale
21			if (data.performance) {
22				if (data.performance.PublishWebApiStartDate) {
23					var time = moment(data.performance.PublishWebApiStartDate);
24
25					if (time.isValid()) {
26						if (time.isAfter()) return;
27					}
28				}
29			}
30
31			// append availability
32			var numAvailable = 0;
33			
34			if (data.availability) {
35				$.each(data.availability, function (i, obj) {
36					if (obj.AvailableCount > numAvailable) {
37						numAvailable = obj.AvailableCount;
38					}
39				});
40			}
41
42			if (numAvailable > 0) {
43				$(this).attr('price-class', 'generic');
44				$(this).addClass('active');
45
46				var str = numAvailable + '<br />';
47				str += (numAvailable == 1) ? 'ticket' : 'tickets';
48				
49				$(this).find('.performance').not(':first').remove();
50				$(this).find('.performance').append('<div>' + str + '</div>');
51			}
52		});
53	}
54
55	var _getModal = function () {
56		var modal = $('<div />');
57		modal.addClass('modal');
58		modal.addClass('chimera');
59		modal.addClass('loading');
60		
61		// close button
62		var close = $('<a href="#" rel="modal:close" class="close">Close</a>');
63		modal.append(close);
64
65		// blurb
66		if (chimera.MEMBERSHIP_CALENDAR_CONFIG.blurb) {
67			var b = $.trim(chimera.MEMBERSHIP_CALENDAR_CONFIG.blurb);
68
69			if (b != '') {
70				var blurb = $('<div />');
71				blurb.addClass('blurb');
72				blurb.html(b);
73				modal.append(blurb);
74			}
75		}
76
77		// calendar
78		var cal = $('<div />');
79		cal.addClass('calendar');
80		$('html').addClass('calendar-small');
81		cal.addClass('inline-embed');
82
83		var foo = new TessituraCalendarView(cal, {
84			minDate: 0,
85			maxDate: chimera.MEMBER_TIX_SEARCH_FUTURE,
86			performanceTypes: [
87				{
88					id: chimera.MEMBER_TIX_TYPE_ID,
89					priceTypes: [ chimera.REFERENCE_PRICE_TYPE ]
90				}
91			],
92			onData: _onData,
93			onDateSelect: _onDateSelect
94		});
95
96		modal.on($.modal.OPEN, function () {
97			$('html').addClass('modal-open');
98		});
99
100		modal.on($.modal.CLOSE, function () {
101			$('html').removeClass('modal-open');
102		});
103
104		modal.append(cal);
105		
106		return modal;	
107	}
108
109	var _onClick = function () {
110		$('.chimera-calendar-popup, .modal').remove();
111
112		$(window).off('resize.modal');
113		
114		$(window).on('resize.modal', function () {
115			$('.modal').css('display', 'inline-block');
116		});
117
118		var modal = _getModal();
119
120		// open modal
121		modal.modal({
122			blockerClass: 'chimera-calendar-popup',
123			fadeDuration: 300,
124  			fadeDelay: 0.5,
125			showClose: false
126		});
127
128		return false;
129	}
130
131	this.initialize = function () {
132		if (typeof(chimera) != 'object') return;
133		if (!chimera.MEMBERSHIP_CALENDAR_CONFIG) return;
134		if (!chimera.MEMBERSHIP_CALENDAR_CONFIG.urlFragment) return;
135
136		var links = $('a[href*="' + $.trim(chimera.MEMBERSHIP_CALENDAR_CONFIG.urlFragment) + '"]');
137		var e = Modernizr.touch ? 'touchend' : 'click';
138
139		links.off();
140		links.on(e, _onClick);
141	}
142
143	this.initialize();
144}
145;
146/*! Magnific Popup - v1.1.0 - 2016-02-20
147* http://dimsemenov.com/plugins/magnific-popup/
148* Copyright (c) 2016 Dmitry Semenov; */
149!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(a){var b,c,d,e,f,g,h="Close",i="BeforeClose",j="AfterClose",k="BeforeAppend",l="MarkupParse",m="Open",n="Change",o="mfp",p="."+o,q="mfp-ready",r="mfp-removing",s="mfp-prevent-close",t=function(){},u=!!window.jQuery,v=a(window),w=function(a,c){b.ev.on(o+a+p,c)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(c,d){b.ev.triggerHandler(o+c,d),b.st.callbacks&&(c=c.charAt(0).toLowerCase()+c.slice(1),b.st.callbacks[c]&&b.st.callbacks[c].apply(b,a.isArray(d)?d:[d]))},z=function(c){return c===g&&b.currTemplate.closeBtn||(b.currTemplate.closeBtn=a(b.st.closeMarkup.replace("%title%",b.st.tClose)),g=c),b.currTemplate.closeBtn},A=function(){a.magnificPopup.instance||(b=new t,b.init(),a.magnificPopup.instance=b)},B=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(void 0!==a.transition)return!0;for(;b.length;)if(b.pop()+"Transition"in a)return!0;return!1};t.prototype={constructor:t,init:function(){var c=navigator.appVersion;b.isLowIE=b.isIE8=document.all&&!document.addEventListener,b.isAndroid=/android/gi.test(c),b.isIOS=/iphone|ipad|ipod/gi.test(c),b.supportsTransition=B(),b.probablyMobile=b.isAndroid||b.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),d=a(document),b.popupsCache={}},open:function(c){var e;if(c.isObj===!1){b.items=c.items.toArray(),b.index=0;var g,h=c.items;for(e=0;e<h.length;e++)if(g=h[e],g.parsed&&(g=g.el[0]),g===c.el[0]){b.index=e;break}}else b.items=a.isArray(c.items)?c.items:[c.items],b.index=c.index||0;if(b.isOpen)return void b.updateItemHTML();b.types=[],f="",c.mainEl&&c.mainEl.length?b.ev=c.mainEl.eq(0):b.ev=d,c.key?(b.popupsCache[c.key]||(b.popupsCache[c.key]={}),b.currTemplate=b.popupsCache[c.key]):b.currTemplate={},b.st=a.extend(!0,{},a.magnificPopup.defaults,c),b.fixedContentPos="auto"===b.st.fixedContentPos?!b.probablyMobile:b.st.fixedContentPos,b.st.modal&&(b.st.closeOnContentClick=!1,b.st.closeOnBgClick=!1,b.st.showCloseBtn=!1,b.st.enableEscapeKey=!1),b.bgOverlay||(b.bgOverlay=x("bg").on("click"+p,function(){b.close()}),b.wrap=x("wrap").attr("tabindex",-1).on("click"+p,function(a){b._checkIfClose(a.target)&&b.close()}),b.container=x("container",b.wrap)),b.contentContainer=x("content"),b.st.preloader&&(b.preloader=x("preloader",b.container,b.st.tLoading));var i=a.magnificPopup.modules;for(e=0;e<i.length;e++){var j=i[e];j=j.charAt(0).toUpperCase()+j.slice(1),b["init"+j].call(b)}y("BeforeOpen"),b.st.showCloseBtn&&(b.st.closeBtnInside?(w(l,function(a,b,c,d){c.close_replaceWith=z(d.type)}),f+=" mfp-close-btn-in"):b.wrap.append(z())),b.st.alignTop&&(f+=" mfp-align-top"),b.fixedContentPos?b.wrap.css({overflow:b.st.overflowY,overflowX:"hidden",overflowY:b.
149st.overflowY}):b.wrap.css({top:v.scrollTop(),position:"absolute"}),(b.st.fixedBgPos===!1||"auto"===b.st.fixedBgPos&&!b.fixedContentPos)&&b.bgOverlay.css({height:d.height(),position:"absolute"}),b.st.enableEscapeKey&&d.on("keyup"+p,function(a){27===a.keyCode&&b.close()}),v.on("resize"+p,function(){b.updateSize()}),b.st.closeOnContentClick||(f+=" mfp-auto-cursor"),f&&b.wrap.addClass(f);var k=b.wH=v.height(),n={};if(b.fixedContentPos&&b._hasScrollBar(k)){var o=b._getScrollbarSize();o&&(n.marginRight=o)}b.fixedContentPos&&(b.isIE7?a("body, html").css("overflow","hidden"):n.overflow="hidden");var r=b.st.mainClass;return b.isIE7&&(r+=" mfp-ie7"),r&&b._addClassToMFP(r),b.updateItemHTML(),y("BuildControls"),a("html").css(n),b.bgOverlay.add(b.wrap).prependTo(b.st.prependTo||a(document.body)),b._lastFocusedEl=document.activeElement,setTimeout(function(){b.content?(b._addClassToMFP(q),b._setFocus()):b.bgOverlay.addClass(q),d.on("focusin"+p,b._onFocusIn)},16),b.isOpen=!0,b.updateSize(k),y(m),c},close:function(){b.isOpen&&(y(i),b.isOpen=!1,b.st.removalDelay&&!b.isLowIE&&b.supportsTransition?(b._addClassToMFP(r),setTimeout(function(){b._close()},b.st.removalDelay)):b._close())},_close:function(){y(h);var c=r+" "+q+" ";if(b.bgOverlay.detach(),b.wrap.detach(),b.container.empty(),b.st.mainClass&&(c+=b.st.mainClass+" "),b._removeClassFromMFP(c),b.fixedContentPos){var e={marginRight:""};b.isIE7?a("body, html").css("overflow",""):e.overflow="",a("html").css(e)}d.off("keyup"+p+" focusin"+p),b.ev.off(p),b.wrap.attr("class","mfp-wrap").removeAttr("style"),b.bgOverlay.attr("class","mfp-bg"),b.container.attr("class","mfp-container"),!b.st.showCloseBtn||b.st.closeBtnInside&&b.currTemplate[b.currItem.type]!==!0||b.currTemplate.closeBtn&&b.currTemplate.closeBtn.detach(),b.st.autoFocusLast&&b._lastFocusedEl&&a(b._lastFocusedEl).focus(),b.currItem=null,b.content=null,b.currTemplate=null,b.prevHeight=0,y(j)},updateSize:function(a){if(b.isIOS){var c=document.documentElement.clientWidth/window.innerWidth,d=window.innerHeight*c;b.wrap.css("height",d),b.wH=d}else b.wH=a||v.height();b.fixedContentPos||b.wrap.css("height",b.wH),y("Resize")},updateItemHTML:function(){var c=b.items[b.index];b.contentContainer.detach(),b.content&&b.content.detach(),c.parsed||(c=b.parseEl(b.index));var d=c.type;if(y("BeforeChange",[b.currItem?b.currItem.type:"",d]),b.currItem=c,!b.currTemplate[d]){var f=b.st[d]?b.st[d].markup:!1;y("FirstMarkupParse",f),f?b.currTemplate[d]=a(f):b.currTemplate[d]=!0}e&&e!==c.type&&b.container.removeClass("mfp-"+e+"-holder");var g=b["get"+d.charAt(0).toUpperCase()+d.slice(1)](c,b.currTemplate[d]);b.appendContent(g,d),c.preloaded=!0,y(n,c),e=c.type,b.container.prepend(b.contentContainer),y("AfterChange")},appendContent:function(a,c){b.content=a,a?b.st.showCloseBtn&&b.st.closeBtnInside&&b.currTemplate[c]===!0?b.content.find(".mfp-close").length||b.content.append(z()):b.content=a:b.content="",y(k),b.container.addClass("mfp-"+c+"-holder"),b.contentContainer.append(b.content)},parseEl:function(c){var d,e=b.items[c];if(e.tagName?e={el:a(e)}:(d=e.type,e={data:e,src:e.src}),e.el){for(var f=b.types,g=0;g<f.length;g++)if(e.el.hasClass("mfp-"+f[g])){d=f[g];break}e.src=e.el.attr("data-mfp-src"),e.src||(e.src=e.el.attr("href"))}return e.type=d||b.st.type||"inline",e.index=c,e.parsed=!0,b.items[c]=e,y("ElementParse",e),b.items[c]},addGroup:function(a,c){var d=function(d){d.mfpEl=this,b._openClick(d,a,c)};c||(c={});var e="click.magnificPopup";c.mainEl=a,c.items?(c.isObj=!0,a.off(e).on(e,d)):(c.isObj=!1,c.delegate?a.off(e).on(e,c.delegate,d):(c.items=a,a.off(e).on(e,d)))},_openClick:function(c,d,e){var f=void 0!==e.midClick?e.midClick:a.magnificPopup.defaults.midClick;if(f||!(2===c.which||c.ctrlKey||c.metaKey||c.altKey||c.shiftKey)){var g=void 0!==e.disableOn?e.disableOn:a.magnificPopup.defaults.disableOn;if(g)if(a.isFunction(g)){if(!g.call(b))return!0}else if(v.width()<g)return!0;c.type&&(c.preventDefault(),b.isOpen&&c.stopPropagation()),e.el=a(c.mfpEl),e.delegate&&(e.items=d.find(e.delegate)),b.open(e)}},updateStatus:function(a,d){if(b.preloader){c!==a&&b.container.removeClass("mfp-s-"+c),d||"loading"!==a||(d=b.st.tLoading);var e={status:a,text:d};y("UpdateStatus",e),a=e.status,d=e.text,b.preloader.html(d),b.preloader.find("a").on("click",function(a){a.stopImmediatePropagation()}),b.container.addClass("mfp-s-"+a),c=a}},_checkIfClose:function(c){if(!a(c).hasClass(s)){var d=b.st.closeOnContentClick,e=b.st.closeOnBgClick;if(d&&e)return!0;
149if(!b.content||a(c).hasClass("mfp-close")||b.preloader&&c===b.preloader[0])return!0;if(c===b.content[0]||a.contains(b.content[0],c)){if(d)return!0}else if(e&&a.contains(document,c))return!0;return!1}},_addClassToMFP:function(a){b.bgOverlay.addClass(a),b.wrap.addClass(a)},_removeClassFromMFP:function(a){this.bgOverlay.removeClass(a),b.wrap.removeClass(a)},_hasScrollBar:function(a){return(b.isIE7?d.height():document.body.scrollHeight)>(a||v.height())},_setFocus:function(){(b.st.focus?b.content.find(b.st.focus).eq(0):b.wrap).focus()},_onFocusIn:function(c){return c.target===b.wrap[0]||a.contains(b.wrap[0],c.target)?void 0:(b._setFocus(),!1)},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),y(l,[b,c,d]),a.each(c,function(c,d){if(void 0===d||d===!1)return!0;if(e=c.split("_"),e.length>1){var f=b.find(p+"-"+e[0]);if(f.length>0){var g=e[1];"replaceWith"===g?f[0]!==d[0]&&f.replaceWith(d):"img"===g?f.is("img")?f.attr("src",d):f.replaceWith(a("<img>").attr("src",d).attr("class",f.attr("class"))):f.attr(e[1],d)}}else b.find(p+"-"+c).html(d)})},_getScrollbarSize:function(){if(void 0===b.scrollbarSize){var a=document.createElement("div");a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),b.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return b.scrollbarSize}},a.magnificPopup={instance:null,proto:t.prototype,modules:[],open:function(b,c){return A(),b=b?a.extend(!0,{},b):{},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">&#215;</button>',tClose:"Close (Esc)",tLoading:"Loading...",autoFocusLast:!0}},a.fn.magnificPopup=function(c){A();var d=a(this);if("string"==typeof c)if("open"===c){var e,f=u?d.data("magnificPopup"):d[0].magnificPopup,g=parseInt(arguments[1],10)||0;f.items?e=f.items[g]:(e=d,f.delegate&&(e=e.find(f.delegate)),e=e.eq(g)),b._openClick({mfpEl:e},d,f)}else b.isOpen&&b[c].apply(b,Array.prototype.slice.call(arguments,1));else c=a.extend(!0,{},c),u?d.data("magnificPopup",c):d[0].magnificPopup=c,b.addGroup(d,c);return d};var C,D,E,F="inline",G=function(){E&&(D.after(E.addClass(C)).detach(),E=null)};a.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){b.types.push(F),w(h+"."+F,function(){G()})},getInline:function(c,d){if(G(),c.src){var e=b.st.inline,f=a(c.src);if(f.length){var g=f[0].parentNode;g&&g.tagName&&(D||(C=e.hiddenClass,D=x(C),C="mfp-"+C),E=f.after(D).detach().removeClass(C)),b.updateStatus("ready")}else b.updateStatus("error",e.tNotFound),f=a("<div>");return c.inlineElement=f,f}return b.updateStatus("ready"),b._parseMarkup(d,{},c),d}}});var H,I="ajax",J=function(){H&&a(document.body).removeClass(H)},K=function(){J(),b.req&&b.req.abort()};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){b.types.push(I),H=b.st.ajax.cursor,w(h+"."+I,K),w("BeforeChange."+I,K)},getAjax:function(c){H&&a(document.body).addClass(H),b.updateStatus("loading");var d=a.extend({url:c.src,success:function(d,e,f){var g={data:d,xhr:f};y("ParseAjax",g),b.appendContent(a(g.data),I),c.finished=!0,J(),b._setFocus(),setTimeout(function(){b.wrap.addClass(q)},16),b.updateStatus("ready"),y("AjaxContentAdded")},error:function(){J(),c.finished=c.loadError=!0,b.updateStatus("error",b.st.ajax.tError.replace("%url%",c.src))}},b.st.ajax.settings);return b.req=a.ajax(d),""}}});var L,M=function(c){if(c.data&&void 0!==c.data.title)return c.data.title;
149var d=b.st.image.titleSrc;if(d){if(a.isFunction(d))return d.call(b,c);if(c.el)return c.el.attr(d)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var c=b.st.image,d=".image";b.types.push("image"),w(m+d,function(){"image"===b.currItem.type&&c.cursor&&a(document.body).addClass(c.cursor)}),w(h+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),v.off("resize"+p)}),w("Resize"+d,b.resizeImage),b.isLowIE&&w("AfterChange",b.resizeImage)},resizeImage:function(){var a=b.currItem;if(a&&a.img&&b.st.image.verticalFit){var c=0;b.isLowIE&&(c=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",b.wH-c)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(b.content&&b.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var c=0,d=a.img[0],e=function(f){L&&clearInterval(L),L=setInterval(function(){return d.naturalWidth>0?void b._onImageHasSize(a):(c>200&&clearInterval(L),c++,void(3===c?e(10):40===c?e(50):100===c&&e(500)))},f)};e(1)},getImage:function(c,d){var e=0,f=function(){c&&(c.img[0].complete?(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("ready")),c.hasSize=!0,c.loaded=!0,y("ImageLoadComplete")):(e++,200>e?setTimeout(f,100):g()))},g=function(){c&&(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("error",h.tError.replace("%url%",c.src))),c.hasSize=!0,c.loaded=!0,c.loadError=!0)},h=b.st.image,i=d.find(".mfp-img");if(i.length){var j=document.createElement("img");j.className="mfp-img",c.el&&c.el.find("img").length&&(j.alt=c.el.find("img").attr("alt")),c.img=a(j).on("load.mfploader",f).on("error.mfploader",g),j.src=c.src,i.is("img")&&(c.img=c.img.clone()),j=c.img[0],j.naturalWidth>0?c.hasSize=!0:j.width||(c.hasSize=!1)}return b._parseMarkup(d,{title:M(c),img_replaceWith:c.img},c),b.resizeImage(),c.hasSize?(L&&clearInterval(L),c.loadError?(d.addClass("mfp-loading"),b.updateStatus("error",h.tError.replace("%url%",c.src))):(d.removeClass("mfp-loading"),b.updateStatus("ready")),d):(b.updateStatus("loading"),c.loading=!0,c.hasSize||(c.imgHidden=!0,d.addClass("mfp-loading"),b.findImageSize(c)),d)}}});var N,O=function(){return void 0===N&&(N=void 0!==document.createElement("p").style.MozTransform),N};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a,c=b.st.zoom,d=".zoom";if(c.enabled&&b.supportsTransition){var e,f,g=c.duration,j=function(a){var b=a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+c.duration/1e3+"s "+c.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,b.css(e),b},k=function(){b.content.css("visibility","visible")};w("BuildControls"+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.content.css("visibility","hidden"),a=b._getItemToZoom(),!a)return void k();f=j(a),f.css(b._getOffset()),b.wrap.append(f),e=setTimeout(function(){f.css(b._getOffset(!0)),e=setTimeout(function(){k(),setTimeout(function(){f.remove(),a=f=null,y("ZoomAnimationEnded")},16)},g)},16)}}),w(i+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.st.removalDelay=g,!a){if(a=b._getItemToZoom(),!a)return;f=j(a)}f.css(b._getOffset(!0)),b.wrap.append(f),b.content.css("visibility","hidden"),setTimeout(function(){f.css(b._getOffset())},16)}}),w(h+d,function(){b._allowZoom()&&(k(),f&&f.remove(),a=null)})}},_allowZoom:function(){return"image"===b.currItem.type},_getItemToZoom:function(){return b.currItem.hasSize?b.currItem.img:!1},_getOffset:function(c){var d;d=c?b.currItem.img:b.st.zoom.opener(b.currItem.el||b.currItem);var e=d.offset(),f=parseInt(d.css("padding-top"),10),g=parseInt(d.css("padding-bottom"),10);e.top-=a(window).scrollTop()-f;var h={width:d.width(),height:(u?d.innerHeight():d[0].offsetHeight)-g-f};return O()?h["-moz-transform"]=h.transform="translate("+e.left+"px,"+e.top+"px)":(h.left=e.left,h.top=e.top),h}}});
149var P="iframe",Q="//about:blank",R=function(a){if(b.currTemplate[P]){var c=b.currTemplate[P].find("iframe");c.length&&(a||(c[0].src=Q),b.isIE8&&c.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(P,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){b.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(h+"."+P,function(){R()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){return e.indexOf(this.index)>-1?(this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1):void 0});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var S=function(a){var c=b.items.length;return a>c-1?a-c:0>a?c+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,e=".mfp-gallery";return b.direction=!0,c&&c.enabled?(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){return b.items.length>1?(b.next(),!1):void 0}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s);e.click(function(){b.prev()}),f.click(function(){b.next()}),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowRight=b.arrowLeft=null})):!1},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a('<img class="mfp-img" />').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),A()});;
150!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exp
150orts.Sketchfab=e():t.Sketchfab=e()}(self,(()=>(()=>{"use strict";var t={d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}t.d(e,{default:()=>h});var n=function(t,e){t.forEach((function(t){this[t]=function(){var i,n=e._requestIdCounter++,s=Array.prototype.slice.call(arguments);if(s.length>0){var r=s[s.length-1];"function"==typeof r&&(i=s.pop())}i&&(e._pendingRequests[n]=i.bind(this)),e._target.postMessage({type:"api.request",instanceId:e.getIdentifier(),requestId:n,member:t,arguments:s},e.getDomain())}}),this),this.addEventListener=function(t,i,n){"viewerready"===t&&e.isViewerReady&&i(),e._eventListeners[t]||(e._eventListeners[t]=[]),e._eventListeners[t].push(i),n&&this.setListenerOptions&&(n.name=t,this.setListenerOptions(n))},this.removeEventListener=function(t,i){if(e._eventListeners[t]){var n=e._eventListeners[t].indexOf(i);-1!==n&&e._eventListeners[t].splice(n,1)}}},s=function(t,e,i){this._target=t,this._requestIdCounter=0,this._pendingRequests={},this._eventListeners={},this._ready=!1,this._domain=i,this._instanceId=e,this.listenServer()};s.prototype={getIdentifier:function(){return this._instanceId},getDomain:function(){return this._domain},setIdentifier:function(t){this._instanceId=t},use:function(t,e){this._version=t,this._ready=!0;var i=this._requestIdCounter++;this._pendingRequests[i]=function(t,i,s){t?e.call(this,t):e.call(this,null,new n(s,this))}.bind(this),this._target.postMessage({type:"api.initialize",requestId:i,name:t,instanceId:this._instanceId},this._domain)},listenServer:function(){if(!this._serverReceiveMessageBinded){var t=["api.initialize.result","api.request.result","api.event"];this._serverReceiveMessageBinded=function(e){if(e.origin===this._domain&&e.data&&e.data.type&&e.data.instanceId&&e.data.instanceId===this.getIdentifier()){var i=e.data.type;if(-1!==t.indexOf(i))if("api.event"===i){var n=e.data.results,s=n[0];if(this._eventListeners["*"]||this._eventListeners.all)return void["*","all"].forEach((function(t){var e=this._eventListeners[t];e&&e.forEach((function(t){t.apply(t,n)}))}),this);var r=n.slice(1),o=this._eventListeners[s];o?o.forEach((function(t){t.apply(t,r)})):"viewerready"===s&&(this.isViewerReady=!0)}else{var a=e.data.requestId,d=this._pendingRequests[a];if(!d)return;d.apply(null,e.data.results),this._pendingRequests[a]=void 0}}}.bind(this),window.addEventListener("message",this._serverReceiveMessageBinded)}}};const r=s;var o=/[&|;]+/g;function a(t){return"object"===i(t)?(e=t,n={},Object.keys(e).forEach((function(t){n[t]=Array.isArray(e[t])?e[t]:[e[t]]})),n):("?"===t[0]&&(t=t.substr(1)),t.split(o).reduce((function(t,e){if(0===e.length)return t;var i=e.indexOf("=");-1===i&&(i=e.length);var n=decodeURIComponent(e.substr(0,i).replace(/\+/g,"%20")),s=decodeURIComponent(e.substr(i+1).replace(/\+/g,"%20"));return void 0===t[n]&&(t[n]=[]),t[n].push(s),t}),{}));var e,n}window.SketchfabAPIClient=r;var d=function(t,e){var n=t,s=e;"object"===i(t)&&(s=t,n=null),this._version=n,this._target=s,window.sketchfabAPIinstances||(window.sketchfabAPIinstances=[]),window.sketchfabAPIinstances.push(this),this._apiId=window.sketchfabAPIinstances.length.toString(),this._target.id&&(this._apiId+="_"+this._target.id),this._target.allow||(this._target.allow="vr; autoplay; fullscreen"),this._client=void 0,this._options=void 0,this._domain="sketchfab.com",this._domain="same-as-current"===this._domain?window.location.hostname:this._domain,this._urlTemplate="https://YYYY/models/XXXX/embed",this._url=this._urlTemplate.replace("YYYY",this._domain),this._transmitOptions={},this._getURLOptions()};d.prototype={_urlOptionsDict:{skfb_api_version:{default:"1.12.1",type:"string"}},_optionsLoaded:function(t){this._urlOptions=t,this._version=this._getURLOption("skfb_api_version",this._version)},_getURLOption:function(t,e){var i=this._urlOptionsDict[t];if(!i)return e;null==e&&(e=i.default);var n=this._urlOptions[t];return n&&n.length?n[0]:e},_getURLOptions:function(){if(!window||!window.location.search)return this._optionsLoaded({});var t=a(window.location.search);for(var e in t)e.startsWith("skfb_")&&(this._transmitOptions[e.substr(5)]=t[e]);return this._optionsLoaded(t)},getEmbedURL:function(t,e){var i=this._url+"?api_version="+this._version+"&api_id="+this._apiId;e&&Object.keys(e).forEach((function(t){null!=e[t]&&"function"!=typeof e[t]&&(i+="&"+t.toString()+"="+e[t].toString())}));var n=this._transmitOptions;
150return Object.keys(this._transmitOptions).forEach((function(t){i+="&"+t.toString()+"="+n[t].toString()})),i.replace("XXXX",t)},init:function(t,e){this._options=e,this._uid=t,this._realInit()},_initializeAPIEmbed:function(t){if(t.data&&t.data.instanceId&&this._apiId===t.data.instanceId&&"api.ready"===t.data.type&&this._target.src){if(void 0!==t.data.error)return this.error(t.data.error),void window.removeEventListener("message",this._initializeAPIEmbedBinded);var e=this._target.src.split("/");e="https://"+e[2],this._client&&(console.log("reusing a Sketchfab instance for multiple client is not supported, please create a new sketchfab instance"),window.removeEventListener("message",this._client._serverReceiveMessageBinded)),this._client=new window.SketchfabAPIClient(this._target.contentWindow,this._apiId,e),this._client.use(this._version,function(t,e){if(t)throw t;this.success.call(this,e)}.bind(this)),window.removeEventListener("message",this._initializeAPIEmbedBinded)}},_realInit:function(){this._initializeAPIEmbedBinded||(this._initializeAPIEmbedBinded=this._initializeAPIEmbed.bind(this)),window.addEventListener("message",this._initializeAPIEmbedBinded),this._target.src=this.getEmbedURL(this._uid,this._options)},success:function(t){this._options.success&&"function"==typeof this._options.success&&this._options.success(t)},error:function(t){this._options.error&&"function"==typeof this._options.error&&this._options.error(t)},show:function(){var t=this._target.style.top;this._target.style.top="-1000vh",Promise.resolve().then(function(){this._target.style.top=t}.bind(this))}};const h=d;return e.default})()));
151
152var ModelInline = function (id, copy) {
153	var $ = jQuery;
154	var _api;
155    
156    var _onLoad = function () {
157        _api.removeEventListener('camerastart', _onLoad);
158
159        _api.setPostProcessing({
160            vignetteEnable: false
161        });
162
163        $('html').addClass('model-loaded');
164    }
165
166    var _getModelId = function () {
167    	var arr = $('.model-inline').data('models');
168    	var i = Math.floor(Math.random() * arr.length);
169
170    	return arr[i];
171    }
172
173    var _insertWatermark = function () {
174    	var a = $('<a class="sketchfab-watermark" title="View on Sketchfab" href="https://sketchfab.com/calacademy" target="_blank">View on Sketchfab</a>');
175    	$('.model-inline').append(a);
176    }
177
178	this.initialize = function () {
179		$('html').addClass('has-model-inline');
180		
181		$('.model-inline').append('<div class="iframe-container"><iframe src="" id="sketchfab-frame" frameborder="0" allow="autoplay; fullscreen; vr" allowvr allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" allowtransparency="true"></iframe></div>');
182
183		var iframe = $('#sketchfab-frame').get(0);
184	    var client = new Sketchfab(iframe);
185
186	    client.init(_getModelId(), {
187	    	transparent: 1,
188	    	preload: 1,
189	    	ui_hint: 0,
190	        autospin: 0.35,
191	        autostart: 1,
192	        ui_infos: 0,
193	        ui_controls: 0,
194	        ui_stop: 0,
195	        success: function onSuccess (api) {
196	            _api = api;
197	            _api.addEventListener('camerastart', _onLoad);
198
199	            _api.load(function () {
200	                _api.start();
201	                _insertWatermark();
202	            });
203	        }
204	    });
205	}
206
207	this.initialize();
208}
209
210jQuery(document).ready(function ($) {
211	var _doSkull = function () {
212		if (!window.calacademyJazz) return false;
213		if (!$('html').hasClass('skull') && !window.calacademyJazz.skull) return false;
214		if ($('.model-inline').length != 1) return false;
215		
216		return true;
217	}
218
219	if (_doSkull()) {
220		$('.skull-remove').remove();
221		$('.skull-message').html('Happy Halloween from the Academy! Take hundreds of spooky skulls for a spin on our new <a href="https://sketchfab.com/calacademy/">Sketchfab channel</a>.');
222		var foo = ModelInline();
223	} else {
224		$('.skull-message, .model-inline').remove();
225	}
226});
227;
228(function(c){c.fn.extend({defaultValue:function(e){if("placeholder"in document.createElement("input"))return!1;return this.each(function(){if(c(this).data("defaultValued"))return!1;var a=c(this),h=a.attr("placeholder"),f={input:a};a.data("defaultValued",!0);var d=function(){var b;if(a.context.nodeName.toLowerCase()=="input")b=c("<input />").attr({type:"text"});else if(a.context.nodeName.toLowerCase()=="textarea")b=c("<textarea />");else throw"DefaultValue only works with input and textareas";b.attr({value:h,
229"class":a.attr("class")+" empty",size:a.attr("size"),style:a.attr("style"),tabindex:a.attr("tabindex"),rows:a.attr("rows"),cols:a.attr("cols"),name:"defaultvalue-clone-"+((1+Math.random())*65536|0).toString(16).substring(1)});b.focus(function(){b.hide();a.show();setTimeout(function(){a.focus()},1)});return b}();f.clone=d;d.insertAfter(a);var g=function(){a.val().length<=0?(d.show(),a.hide()):(d.hide(),a.show().trigger("click"))};a.bind("blur",g);g();e&&e(f)})}})})(jQuery);;
230/**
231 * Copyright (c) 2007-2014 Ariel Flesler - aflesler<a>gmail<d>com | http://flesler.blogspot.com
232 * Licensed under MIT
233 * @author Ariel Flesler
234 * @version 1.4.13
235 */
236;(function(k){'use strict';k(['jquery'],function($){var j=$.scrollTo=function(a,b,c){return $(window).scrollTo(a,b,c)};j.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:!0};j.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(f,g,h){if(typeof g=='object'){h=g;g=0}if(typeof h=='function')h={onAfter:h};if(f=='max')f=9e9;h=$.extend({},j.defaults,h);g=g||h.duration;h.queue=h.queue&&h.axis.length>1;if(h.queue)g/=2;h.offset=both(h.offset);h.over=both(h.over);return this._scrollable().each(function(){if(f==null)return;var d=this,$elem=$(d),targ=f,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=win?$(targ):$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}
236var e=$.isFunction(h.offset)&&h.offset(d,targ)||h.offset;$.each(h.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=j.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(h.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=e[pos]||0;if(h.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*h.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(h.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&h.queue){if(old!=attr[key])animate(h.onAfterFirst);delete attr[key]}});animate(h.onAfter);function animate(a){$elem.animate(attr,g,h.easing,a&&function(){a.call(this,targ,h)})}}).end()};j.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return $.isFunction(a)||typeof a=='object'?a:{top:a,left:a}}return j})}(typeof define==='function'&&define.amd?define:function(a,b){if(typeof module!=='undefined'&&module.exports){module.exports=b(require('jquery'))}else{b(jQuery)}}));;
237/*
238 *	jQuery dotdotdot 1.6.16
239 *
240 *	Copyright (c) Fred Heusschen
241 *	www.frebsite.nl
242 *
243 *	Plugin website:
244 *	dotdotdot.frebsite.nl
245 *
246 *	Dual licensed under the MIT and GPL licenses.
247 *	http://en.wikipedia.org/wiki/MIT_License
248 *	http://en.wikipedia.org/wiki/GNU_General_Public_License
249 */
250!function(t,e){function n(t,e,n){var r=t.children(),o=!1;t.empty();for(var i=0,d=r.length;d>i;i++){var l=r.eq(i);if(t.append(l),n&&t.append(n),a(t,e)){l.remove(),o=!0;break}n&&n.detach()}return o}function r(e,n,i,d,l){var s=!1,c="table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, blockquote, select, optgroup, option, textarea, script, style",u="script, .dotdotdot-keep";return e.contents().detach().each(function(){var f=this,h=t(f);if("undefined"==typeof f||3==f.nodeType&&0==t.trim(f.data).length)return!0;if(h.is(u))e.append(h);else{if(s)return!0;e.append(h),l&&e[e.is(c)?"after":"append"](l),a(i,d)&&(s=3==f.nodeType?o(h,n,i,d,l):r(h,n,i,d,l),s||(h.detach(),s=!0)),s||l&&l.detach()}}),s}function o(e,n,r,o,d){var c=e[0];if(!c)return!1;var f=s(c),h=-1!==f.indexOf(" ")?" ":" ",p="letter"==o.wrap?"":h,g=f.split(p),v=-1,w=-1,b=0,y=g.length-1;for(o.fallbackToLetter&&0==b&&0==y&&(p="",g=f.split(p),y=g.length-1);y>=b&&(0!=b||0!=y);){var m=Math.floor((b+y)/2);if(m==w)break;w=m,l(c,g.slice(0,w+1).join(p)+o.ellipsis),a(r,o)?(y=w,o.fallbackToLetter&&0==b&&0==y&&(p="",g=g[0].split(p),v=-1,w=-1,b=0,y=g.length-1)):(v=w,b=w)}if(-1==v||1==g.length&&0==g[0].length){var x=e.parent();e.detach();var T=d&&d.closest(x).length?d.length:0;x.contents().length>T?c=u(x.contents().eq(-1-T),n):(c=u(x,n,!0),T||x.detach()),c&&(f=i(s(c),o),l(c,f),T&&d&&t(c).parent().append(d))}else f=i(g.slice(0,v+1).join(p),o),l(c,f);return!0}function a(t,e){return t.innerHeight()>e.maxHeight}function i(e,n){for(;t.inArray(e.slice(-1),n.lastCharacter.remove)>-1;)e=e.slice(0,-1);return t.inArray(e.slice(-1),n.lastCharacter.noEllipsis)<0&&(e+=n.ellipsis),e}function d(t){return{width:t.innerWidth(),height:t.innerHeight()}}function l(t,e){t.innerText?t.innerText=e:t.nodeValue?t.nodeValue=e:t.textContent&&(t.textContent=e)}function s(t){return t.innerText?t.innerText:t.nodeValue?t.nodeValue:t.textContent?t.textContent:""}function c(t){do t=t.previousSibling;while(t&&1!==t.nodeType&&3!==t.nodeType);return t}function u(e,n,r){var o,a=e&&e[0];if(a){if(!r){if(3===a.nodeType)return a;
250if(t.trim(e.text()))return u(e.contents().last(),n)}for(o=c(a);!o;){if(e=e.parent(),e.is(n)||!e.length)return!1;o=c(e[0])}if(o)return u(t(o),n)}return!1}function f(e,n){return e?"string"==typeof e?(e=t(e,n),e.length?e:!1):e.jquery?e:!1:!1}function h(t){for(var e=t.innerHeight(),n=["paddingTop","paddingBottom"],r=0,o=n.length;o>r;r++){var a=parseInt(t.css(n[r]),10);isNaN(a)&&(a=0),e-=a}return e}if(!t.fn.dotdotdot){t.fn.dotdotdot=function(e){if(0==this.length)return t.fn.dotdotdot.debug('No element found for "'+this.selector+'".'),this;if(this.length>1)return this.each(function(){t(this).dotdotdot(e)});var o=this;o.data("dotdotdot")&&o.trigger("destroy.dot"),o.data("dotdotdot-style",o.attr("style")||""),o.css("word-wrap","break-word"),"nowrap"===o.css("white-space")&&o.css("white-space","normal"),o.bind_events=function(){return o.bind("update.dot",function(e,d){e.preventDefault(),e.stopPropagation(),l.maxHeight="number"==typeof l.height?l.height:h(o),l.maxHeight+=l.tolerance,"undefined"!=typeof d&&(("string"==typeof d||d instanceof HTMLElement)&&(d=t("<div />").append(d).contents()),d instanceof t&&(i=d)),g=o.wrapInner('<div class="dotdotdot" />').children(),g.contents().detach().end().append(i.clone(!0)).find("br").replaceWith("  <br />  ").end().css({height:"auto",width:"auto",border:"none",padding:0,margin:0});var c=!1,u=!1;return s.afterElement&&(c=s.afterElement.clone(!0),c.show(),s.afterElement.detach()),a(g,l)&&(u="children"==l.wrap?n(g,l,c):r(g,o,g,l,c)),g.replaceWith(g.contents()),g=null,t.isFunction(l.callback)&&l.callback.call(o[0],u,i),s.isTruncated=u,u}).bind("isTruncated.dot",function(t,e){return t.preventDefault(),t.stopPropagation(),"function"==typeof e&&e.call(o[0],s.isTruncated),s.isTruncated}).bind("originalContent.dot",function(t,e){return t.preventDefault(),t.stopPropagation(),"function"==typeof e&&e.call(o[0],i),i}).bind("destroy.dot",function(t){t.preventDefault(),t.stopPropagation(),o.unwatch().unbind_events().contents().detach().end().append(i).attr("style",o.data("dotdotdot-style")||"").data("dotdotdot",!1)}),o},o.unbind_events=function(){return o.unbind(".dot"),o},o.watch=function(){if(o.unwatch(),"window"==l.watch){var e=t(window),n=e.width(),r=e.height();e.bind("resize.dot"+s.dotId,function(){n==e.width()&&r==e.height()&&l.windowResizeFix||(n=e.width(),r=e.height(),u&&clearInterval(u),u=setTimeout(function(){o.trigger("update.dot")},100))})}else c=d(o),u=setInterval(function(){if(o.is(":visible")){var t=d(o);(c.width!=t.width||c.height!=t.height)&&(o.trigger("update.dot"),c=t)}},500);return o},o.unwatch=function(){return t(window).unbind("resize.dot"+s.dotId),u&&clearInterval(u),o};var i=o.contents(),l=t.extend(!0,{},t.fn.dotdotdot.defaults,e),s={},c={},u=null,g=null;return l.lastCharacter.remove instanceof Array||(l.lastCharacter.remove=t.fn.dotdotdot.defaultArrays.lastCharacter.remove),l.lastCharacter.noEllipsis instanceof Array||(l.lastCharacter.noEllipsis=t.fn.dotdotdot.defaultArrays.lastCharacter.noEllipsis),s.afterElement=f(l.after,o),s.isTruncated=!1,s.dotId=p++,o.data("dotdotdot",!0).bind_events().trigger("update.dot"),l.watch&&o.watch(),o},t.fn.dotdotdot.defaults={ellipsis:"... ",wrap:"word",fallbackToLetter:!0,lastCharacter:{},tolerance:0,callback:null,after:null,height:null,watch:!1,windowResizeFix:!0},t.fn.dotdotdot.defaultArrays={lastCharacter:{remove:[" "," ",",",";",".","!","?"],noEllipsis:[]}},t.fn.dotdotdot.debug=function(){};var p=1,g=t.fn.html;t.fn.html=function(n){return n!=e&&!t.isFunction(n)&&this.data("dotdotdot")?this.trigger("update",[n]):g.apply(this,arguments)};var v=t.fn.text;t.fn.text=function(n){return n!=e&&!t.isFunction(n)&&this.data("dotdotdot")?(n=t("<div />").text(n).html(),this.trigger("update",[n])):v.apply(this,arguments)}}}(jQuery);;
251/*! Hammer.JS - v2.0.3 - 2014-09-10
252 * http://hammerjs.github.io/
253 *
254 * Copyright (c) 2014 Jorik Tangelder;
255 * Licensed under the MIT license */
256
257
258!function(a,b,c,d){"use strict";function e(a,b,c){return setTimeout(k(a,c),b)}function f(a,b,c){return Array.isArray(a)?(g(a,c[b],c),!0):!1}function g(a,b,c){var e;
vendor: 5,595 bytes, line 258
258if(a)if(a.forEach)a.forEach(b,c);else if(a.length!==d)for(e=0;e<a.length;)b.call(c,a[e],e,a),e++;else for(e in a)a.hasOwnProperty(e)&&b.call(c,a[e],e,a)}function h(a,b,c){for(var e=Object.keys(b),f=0;f<e.length;)(!c||c&&a[e[f]]===d)&&(a[e[f]]=b[e[f]]),f++;return a}function i(a,b){return h(a,b,!0)}function j(a,b,c){var d,e=b.prototype;d=a.prototype=Object.create(e),d.constructor=a,d._super=e,c&&h(d,c)}function k(a,b){return function(){return a.apply(b,arguments)}}function l(a,b){return typeof a==ib?a.apply(b?b[0]||d:d,b):a}function m(a,b){return a===d?b:a}function n(a,b,c){g(r(b),function(b){a.addEventListener(b,c,!1)})}function o(a,b,c){g(r(b),function(b){a.removeEventListener(b,c,!1)})}function p(a,b){for(;a;){if(a==b)return!0;a=a.parentNode}return!1}function q(a,b){return a.indexOf(b)>-1}function r(a){return a.trim().split(/\s+/g)}function s(a,b,c){if(a.indexOf&&!c)return a.indexOf(b);for(var d=0;d<a.length;){if(c&&a[d][c]==b||!c&&a[d]===b)return d;d++}return-1}function t(a){return Array.prototype.slice.call(a,0)}function u(a,b,c){for(var d=[],e=[],f=0;f<a.length;){var g=b?a[f][b]:a[f];s(e,g)<0&&d.push(a[f]),e[f]=g,f++}return c&&(d=b?d.sort(function(a,c){return a[b]>c[b]}):d.sort()),d}function v(a,b){for(var c,e,f=b[0].toUpperCase()+b.slice(1),g=0;g<gb.length;){if(c=gb[g],e=c?c+f:b,e in a)return e;g++}return d}function w(){return mb++}function x(a){var b=a.ownerDocument;return b.defaultView||b.parentWindow}function y(a,b){var c=this;this.manager=a,this.callback=b,this.element=a.element,this.target=a.options.inputTarget,this.domHandler=function(b){l(a.options.enable,[a])&&c.handler(b)},this.init()}function z(a){var b,c=a.options.inputClass;return new(b=c?c:pb?N:qb?O:ob?Q:M)(a,A)}function A(a,b,c){var d=c.pointers.length,e=c.changedPointers.length,f=b&wb&&d-e===0,g=b&(yb|zb)&&d-e===0;c.isFirst=!!f,c.isFinal=!!g,f&&(a.session={}),c.eventType=b,B(a,c),a.emit("hammer.input",c),a.recognize(c),a.session.prevInput=c}function B(a,b){var c=a.session,d=b.pointers,e=d.length;c.firstInput||(c.firstInput=E(b)),e>1&&!c.firstMultiple?c.firstMultiple=E(b):1===e&&(c.firstMultiple=!1);var f=c.firstInput,g=c.firstMultiple,h=g?g.center:f.center,i=b.center=F(d);b.timeStamp=lb(),b.deltaTime=b.timeStamp-f.timeStamp,b.angle=J(h,i),b.distance=I(h,i),C(c,b),b.offsetDirection=H(b.deltaX,b.deltaY),b.scale=g?L(g.pointers,d):1,b.rotation=g?K(g.pointers,d):0,D(c,b);var j=a.element;p(b.srcEvent.target,j)&&(j=b.srcEvent.target),b.target=j}function C(a,b){var c=b.center,d=a.offsetDelta||{},e=a.prevDelta||{},f=a.prevInput||{};(b.eventType===wb||f.eventType===yb)&&(e=a.prevDelta={x:f.deltaX||0,y:f.deltaY||0},d=a.offsetDelta={x:c.x,y:c.y}),b.deltaX=e.x+(c.x-d.x),b.deltaY=e.y+(c.y-d.y)}function D(a,b){var c,e,f,g,h=a.lastInterval||b,i=b.timeStamp-h.timeStamp;if(b.eventType!=zb&&(i>vb||h.velocity===d)){var j=h.deltaX-b.deltaX,k=h.deltaY-b.deltaY,l=G(i,j,k);e=l.x,f=l.y,c=kb(l.x)>kb(l.y)?l.x:l.y,g=H(j,k),a.lastInterval=b}else c=h.velocity,e=h.velocityX,f=h.velocityY,g=h.direction;b.velocity=c,b.velocityX=e,b.velocityY=f,b.direction=g}function E(a){for(var b=[],c=0;c<a.pointers.length;)b[c]={clientX:jb(a.pointers[c].clientX),clientY:jb(a.pointers[c].clientY)},c++;return{timeStamp:lb(),pointers:b,center:F(b),deltaX:a.deltaX,deltaY:a.deltaY}}function F(a){var b=a.length;if(1===b)return{x:jb(a[0].clientX),y:jb(a[0].clientY)};for(var c=0,d=0,e=0;b>e;)c+=a[e].clientX,d+=a[e].clientY,e++;return{x:jb(c/b),y:jb(d/b)}}function G(a,b,c){return{x:b/a||0,y:c/a||0}}function H(a,b){return a===b?Ab:kb(a)>=kb(b)?a>0?Bb:Cb:b>0?Db:Eb}function I(a,b,c){c||(c=Ib);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return Math.sqrt(d*d+e*e)}function J(a,b,c){c||(c=Ib);var d=b[c[0]]-a[c[0]],e=b[c[1]]-a[c[1]];return 180*Math.atan2(e,d)/Math.PI}function K(a,b){return J(b[1],b[0],Jb)-J(a[1],a[0],Jb)}function L(a,b){return I(b[0],b[1],Jb)/I(a[0],a[1],Jb)}function M(){this.evEl=Lb,this.evWin=Mb,this.allow=!0,this.pressed=!1,y.apply(this,arguments)}function N(){this.evEl=Pb,this.evWin=Qb,y.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function O(){this.evTarget=Sb,this.targetIds={},y.apply(this,arguments)}function P(a,b){var c=t(a.touches),d=this.targetIds;if(b&(wb|xb)&&1===c.length)return d[c[0].identifier]=!0,[c,c];var e,f=t(a.targetTouches),g=t(a.changedTouches),h=[];if(b===wb)for(e=0;e<f.length;)d[f[e].identifier]=!0,e++;for(e=0;e<g.length;)d[g[e].identifier]&&h.push(g[e]),b&(yb|zb)&&delete d[g[e].identifier],e++;return h.length?[u(f.concat(h),"identifier",!0),h]:void 0}function Q(){y.apply(this,arguments);var a=k(this.handler,this);this.touch=new O(this.manager,a),this.mouse=new M(this.manager,a)}function R(a,b){this.manager=a,this.set(b)}function S(a){if(q(a,Yb))return Yb;var b=q(a,Zb),c=q(a,$b);return b&&c?Zb+" "+$b:b||c?b?Zb:$b:q(a,Xb)?Xb:Wb}function T(a){this.id=w(),this.manager=null,this.options=i(a||{},this.defaults),this.options.enable=m(this.options.enable,!0),this.state=_b,this.simultaneous={},this.requireFail=[]}function U(a){return a&ec?"cancel":a&cc?"end":a&bc?"move":a&ac?"start":""}function V(a){return a==Eb?"down":a==Db?"up":a==Bb?"left":a==Cb?"right":""}function W(a,b){var c=b.manager;return c?c.get(a):a}function X(){T.apply(this,arguments)}function Y(){X.apply(this,arguments),this.pX=null,this.pY=null}function Z(){X.apply(this,arguments)}function $(){T.apply(this,arguments),this._timer=null,this._input=null}function _(){X.apply(this,arguments)}function ab(){X.apply(this,arguments)}function bb(){T.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function cb(a,b){return b=b||{}
258,b.recognizers=m(b.recognizers,cb.defaults.preset),new db(a,b)}function db(a,b){b=b||{},this.options=i(b,cb.defaults),this.options.inputTarget=this.options.inputTarget||a,this.handlers={},this.session={},this.recognizers=[],this.element=a,this.input=z(this),this.touchAction=new R(this,this.options.touchAction),eb(this,!0),g(b.recognizers,function(a){var b=this.add(new a[0](a[1]));a[2]&&b.recognizeWith(a[2]),a[3]&&b.requireFailure(a[3])},this)}function eb(a,b){var c=a.element;g(a.options.cssProps,function(a,d){c.style[v(c.style,d)]=b?a:""})}function fb(a,c){var d=b.createEvent("Event");d.initEvent(a,!0,!0),d.gesture=c,c.target.dispatchEvent(d)}var gb=["","webkit","moz","MS","ms","o"],hb=b.createElement("div"),ib="function",jb=Math.round,kb=Math.abs,lb=Date.now,mb=1,nb=/mobile|tablet|ip(ad|hone|od)|android/i,ob="ontouchstart"in a,pb=v(a,"PointerEvent")!==d,qb=ob&&nb.test(navigator.userAgent),rb="touch",sb="pen",tb="mouse",ub="kinect",vb=25,wb=1,xb=2,yb=4,zb=8,Ab=1,Bb=2,Cb=4,Db=8,Eb=16,Fb=Bb|Cb,Gb=Db|Eb,Hb=Fb|Gb,Ib=["x","y"],Jb=["clientX","clientY"];y.prototype={handler:function(){},init:function(){this.evEl&&n(this.element,this.evEl,this.domHandler),this.evTarget&&n(this.target,this.evTarget,this.domHandler),this.evWin&&n(x(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&o(this.element,this.evEl,this.domHandler),this.evTarget&&o(this.target,this.evTarget,this.domHandler),this.evWin&&o(x(this.element),this.evWin,this.domHandler)}};var Kb={mousedown:wb,mousemove:xb,mouseup:yb},Lb="mousedown",Mb="mousemove mouseup";j(M,y,{handler:function(a){var b=Kb[a.type];b&wb&&0===a.button&&(this.pressed=!0),b&xb&&1!==a.which&&(b=yb),this.pressed&&this.allow&&(b&yb&&(this.pressed=!1),this.callback(this.manager,b,{pointers:[a],changedPointers:[a],pointerType:tb,srcEvent:a}))}});var Nb={pointerdown:wb,pointermove:xb,pointerup:yb,pointercancel:zb,pointerout:zb},Ob={2:rb,3:sb,4:tb,5:ub},Pb="pointerdown",Qb="pointermove pointerup pointercancel";a.MSPointerEvent&&(Pb="MSPointerDown",Qb="MSPointerMove MSPointerUp MSPointerCancel"),j(N,y,{handler:function(a){var b=this.store,c=!1,d=a.type.toLowerCase().replace("ms",""),e=Nb[d],f=Ob[a.pointerType]||a.pointerType,g=f==rb;e&wb&&(0===a.button||g)?b.push(a):e&(yb|zb)&&(c=!0);var h=s(b,a.pointerId,"pointerId");0>h||(b[h]=a,this.callback(this.manager,e,{pointers:b,changedPointers:[a],pointerType:f,srcEvent:a}),c&&b.splice(h,1))}});var Rb={touchstart:wb,touchmove:xb,touchend:yb,touchcancel:zb},Sb="touchstart touchmove touchend touchcancel";j(O,y,{handler:function(a){var b=Rb[a.type],c=P.call(this,a,b);c&&this.callback(this.manager,b,{pointers:c[0],changedPointers:c[1],pointerType:rb,srcEvent:a})}}),j(Q,y,{handler:function(a,b,c){var d=c.pointerType==rb,e=c.pointerType==tb;if(d)this.mouse.allow=!1;else if(e&&!this.mouse.allow)return;b&(yb|zb)&&(this.mouse.allow=!0),this.callback(a,b,c)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Tb=v(hb.style,"touchAction"),Ub=Tb!==d,Vb="compute",Wb="auto",Xb="manipulation",Yb="none",Zb="pan-x",$b="pan-y";R.prototype={set:function(a){a==Vb&&(a=this.compute()),Ub&&(this.manager.element.style[Tb]=a),this.actions=a.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var a=[];return g(this.manager.recognizers,function(b){l(b.options.enable,[b])&&(a=a.concat(b.getTouchAction()))}),S(a.join(" "))},preventDefaults:function(a){if(!Ub){var b=a.srcEvent,c=a.offsetDirection;if(this.manager.session.prevented)return void b.preventDefault();var d=this.actions,e=q(d,Yb),f=q(d,$b),g=q(d,Zb);return e||f&&c&Fb||g&&c&Gb?this.preventSrc(b):void 0}},preventSrc:function(a){this.manager.session.prevented=!0,a.preventDefault()}};var _b=1,ac=2,bc=4,cc=8,dc=cc,ec=16,fc=32;T.prototype={defaults:{},set:function(a){return h(this.options,a),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(a){if(f(a,"recognizeWith",this))return this;var b=this.simultaneous;return a=W(a,this),b[a.id]||(b[a.id]=a,a.recognizeWith(this)),this},dropRecognizeWith:function(a){return f(a,"dropRecognizeWith",this)?this:(a=W(a,this),delete this.simultaneous[a.id],this)}
vendor: 4,433 bytes, line 258
258,requireFailure:function(a){if(f(a,"requireFailure",this))return this;var b=this.requireFail;return a=W(a,this),-1===s(b,a)&&(b.push(a),a.requireFailure(this)),this},dropRequireFailure:function(a){if(f(a,"dropRequireFailure",this))return this;a=W(a,this);var b=s(this.requireFail,a);return b>-1&&this.requireFail.splice(b,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(a){return!!this.simultaneous[a.id]},emit:function(a){function b(b){c.manager.emit(c.options.event+(b?U(d):""),a)}var c=this,d=this.state;cc>d&&b(!0),b(),d>=cc&&b(!0)},tryEmit:function(a){return this.canEmit()?this.emit(a):void(this.state=fc)},canEmit:function(){for(var a=0;a<this.requireFail.length;){if(!(this.requireFail[a].state&(fc|_b)))return!1;a++}return!0},recognize:function(a){var b=h({},a);return l(this.options.enable,[this,b])?(this.state&(dc|ec|fc)&&(this.state=_b),this.state=this.process(b),void(this.state&(ac|bc|cc|ec)&&this.tryEmit(b))):(this.reset(),void(this.state=fc))},process:function(){},getTouchAction:function(){},reset:function(){}},j(X,T,{defaults:{pointers:1},attrTest:function(a){var b=this.options.pointers;return 0===b||a.pointers.length===b},process:function(a){var b=this.state,c=a.eventType,d=b&(ac|bc),e=this.attrTest(a);return d&&(c&zb||!e)?b|ec:d||e?c&yb?b|cc:b&ac?b|bc:ac:fc}}),j(Y,X,{defaults:{event:"pan",threshold:10,pointers:1,direction:Hb},getTouchAction:function(){var a=this.options.direction,b=[];return a&Fb&&b.push($b),a&Gb&&b.push(Zb),b},directionTest:function(a){var b=this.options,c=!0,d=a.distance,e=a.direction,f=a.deltaX,g=a.deltaY;return e&b.direction||(b.direction&Fb?(e=0===f?Ab:0>f?Bb:Cb,c=f!=this.pX,d=Math.abs(a.deltaX)):(e=0===g?Ab:0>g?Db:Eb,c=g!=this.pY,d=Math.abs(a.deltaY))),a.direction=e,c&&d>b.threshold&&e&b.direction},attrTest:function(a){return X.prototype.attrTest.call(this,a)&&(this.state&ac||!(this.state&ac)&&this.directionTest(a))},emit:function(a){this.pX=a.deltaX,this.pY=a.deltaY;var b=V(a.direction);b&&this.manager.emit(this.options.event+b,a),this._super.emit.call(this,a)}}),j(Z,X,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Yb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.scale-1)>this.options.threshold||this.state&ac)},emit:function(a){if(this._super.emit.call(this,a),1!==a.scale){var b=a.scale<1?"in":"out";this.manager.emit(this.options.event+b,a)}}}),j($,T,{defaults:{event:"press",pointers:1,time:500,threshold:5},getTouchAction:function(){return[Wb]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime>b.time;if(this._input=a,!d||!c||a.eventType&(yb|zb)&&!f)this.reset();else if(a.eventType&wb)this.reset(),this._timer=e(function(){this.state=dc,this.tryEmit()},b.time,this);else if(a.eventType&yb)return dc;return fc},reset:function(){clearTimeout(this._timer)},emit:function(a){this.state===dc&&(a&&a.eventType&yb?this.manager.emit(this.options.event+"up",a):(this._input.timeStamp=lb(),this.manager.emit(this.options.event,this._input)))}}),j(_,X,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Yb]},attrTest:function(a){return this._super.attrTest.call(this,a)&&(Math.abs(a.rotation)>this.options.threshold||this.state&ac)}}),j(ab,X,{defaults:{event:"swipe",threshold:10,velocity:.65,direction:Fb|Gb,pointers:1},getTouchAction:function(){return Y.prototype.getTouchAction.call(this)},attrTest:function(a){var b,c=this.options.direction;return c&(Fb|Gb)?b=a.velocity:c&Fb?b=a.velocityX:c&Gb&&(b=a.velocityY),this._super.attrTest.call(this,a)&&c&a.direction&&a.distance>this.options.threshold&&kb(b)>this.options.velocity&&a.eventType&yb},emit:function(a){var b=V(a.direction);b&&this.manager.emit(this.options.event+b,a),this.manager.emit(this.options.event,a)}}),j(bb,T,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:2,posThreshold:10},getTouchAction:function(){return[Xb]},process:function(a){var b=this.options,c=a.pointers.length===b.pointers,d=a.distance<b.threshold,f=a.deltaTime<b.time;if(this.reset(),a.eventType&wb&&0===this.count)return this.failTimeout();if(d&&f&&c){if(a.eventType!=yb)return this.failTimeout();var g=this.pTime?a.timeStamp-this.pTime<b.interval:!0,h=!this.pCenter||I(this.pCenter,a.center)<b.posThreshold;this.pTime=a.timeStamp,this.pCenter=a.center,h&&g?this.count+=1:this.count=1,this._input=a;
258var i=this.count%b.taps;if(0===i)return this.hasRequireFailures()?(this._timer=e(function(){this.state=dc,this.tryEmit()},b.interval,this),ac):dc}return fc},failTimeout:function(){return this._timer=e(function(){this.state=fc},this.options.interval,this),fc},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==dc&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),cb.VERSION="2.0.3",cb.defaults={domEvents:!1,touchAction:Vb,enable:!0,inputTarget:null,inputClass:null,preset:[[_,{enable:!1}],[Z,{enable:!1},["rotate"]],[ab,{direction:Fb}],[Y,{direction:Fb},["swipe"]],[bb],[bb,{event:"doubletap",taps:2},["tap"]],[$]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var gc=1,hc=2;db.prototype={set:function(a){return h(this.options,a),a.touchAction&&this.touchAction.update(),a.inputTarget&&(this.input.destroy(),this.input.target=a.inputTarget,this.input.init()),this},stop:function(a){this.session.stopped=a?hc:gc},recognize:function(a){var b=this.session;if(!b.stopped){this.touchAction.preventDefaults(a);var c,d=this.recognizers,e=b.curRecognizer;(!e||e&&e.state&dc)&&(e=b.curRecognizer=null);for(var f=0;f<d.length;)c=d[f],b.stopped===hc||e&&c!=e&&!c.canRecognizeWith(e)?c.reset():c.recognize(a),!e&&c.state&(ac|bc|cc)&&(e=b.curRecognizer=c),f++}},get:function(a){if(a instanceof T)return a;for(var b=this.recognizers,c=0;c<b.length;c++)if(b[c].options.event==a)return b[c];return null},add:function(a){if(f(a,"add",this))return this;var b=this.get(a.options.event);return b&&this.remove(b),this.recognizers.push(a),a.manager=this,this.touchAction.update(),a},remove:function(a){if(f(a,"remove",this))return this;var b=this.recognizers;return a=this.get(a),b.splice(s(b,a),1),this.touchAction.update(),this},on:function(a,b){var c=this.handlers;return g(r(a),function(a){c[a]=c[a]||[],c[a].push(b)}),this},off:function(a,b){var c=this.handlers;return g(r(a),function(a){b?c[a].splice(s(c[a],b),1):delete c[a]}),this},emit:function(a,b){this.options.domEvents&&fb(a,b);var c=this.handlers[a]&&this.handlers[a].slice();if(c&&c.length){b.type=a,b.preventDefault=function(){b.srcEvent.preventDefault()};for(var d=0;d<c.length;)c[d](b),d++}},destroy:function(){this.element&&eb(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},h(cb,{INPUT_START:wb,INPUT_MOVE:xb,INPUT_END:yb,INPUT_CANCEL:zb,STATE_POSSIBLE:_b,STATE_BEGAN:ac,STATE_CHANGED:bc,STATE_ENDED:cc,STATE_RECOGNIZED:dc,STATE_CANCELLED:ec,STATE_FAILED:fc,DIRECTION_NONE:Ab,DIRECTION_LEFT:Bb,DIRECTION_RIGHT:Cb,DIRECTION_UP:Db,DIRECTION_DOWN:Eb,DIRECTION_HORIZONTAL:Fb,DIRECTION_VERTICAL:Gb,DIRECTION_ALL:Hb,Manager:db,Input:y,TouchAction:R,TouchInput:O,MouseInput:M,PointerEventInput:N,TouchMouseInput:Q,Recognizer:T,AttrRecognizer:X,Tap:bb,Pan:Y,Swipe:ab,Pinch:Z,Rotate:_,Press:$,on:n,off:o,each:g,merge:i,extend:h,inherit:j,bindFn:k,prefixed:v}),typeof define==ib&&define.amd?define(function(){return cb}):"undefined"!=typeof module&&module.exports?module.exports=cb:a[c]=cb}(window,document,"Hammer");
259;
260(function($, Hammer, dataAttr) {
261    function hammerify(el, options) {
262        var $el = $(el);
263        if(!$el.data(dataAttr)) {
264            $el.data(dataAttr, new Hammer($el[0], options));
265        }
266    }
267
268    $.fn.hammer = function(options) {
269        return this.each(function() {
270            hammerify(this, options);
271        });
272    };
273
274    // extend the emit method to also trigger jQuery events
275    Hammer.Manager.prototype.emit = (function(originalEmit) {
276        return function(type, data) {
277            originalEmit.call(this, type, data);
278            $(this.element).trigger({
279                type: type,
280                gesture: data
281            });
282        };
283    })(Hammer.Manager.prototype.emit);
284})(jQuery, Hammer, "hammer");
285;
286!function(t){var i=t(window);t.fn.visible=function(t,e,o){if(!(this.length<1)){var r=this.length>1?this.eq(0):this,n=r.get(0),f=i.width(),h=i.height(),o=o?o:"both",l=e===!0?n.offsetWidth*n.offsetHeight:!0;if("function"==typeof n.getBoundingClientRect){var g=n.getBoundingClientRect(),u=g.top>=0&&g.top<h,s=g.bottom>0&&g.bottom<=h,c=g.left>=0&&g.left<f,a=g.right>0&&g.right<=f,v=t?u||s:u&&s,b=t?c||a:c&&a;if("both"===o)return l&&v&&b;if("vertical"===o)return l&&v;if("horizontal"===o)return l&&b}else{var d=i.scrollTop(),p=d+h,w=i.scrollLeft(),m=w+f,y=r.offset(),z=y.top,B=z+r.height(),C=y.left,R=C+r.width(),j=t===!0?B:z,q=t===!0?z:B,H=t===!0?R:C,L=t===!0?C:R;if("both"===o)return!!l&&p>=q&&j>=d&&m>=L&&H>=w;if("vertical"===o)return!!l&&p>=q&&j>=d;if("horizontal"===o)return!!l&&m>=L&&H>=w}}}}(jQuery);
287;
288/*! jQuery UI - v1.12.1 - 2019-01-11
289* http://jqueryui.com
290* Includes: widget.js, data.js, keycode.js, scroll-parent.js, widgets/draggable.js, widgets/datepicker.js, widgets/mouse.js
291* Copyright jQuery Foundation and other contributors; Licensed MIT */
292
293(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){for(var e,i;t.length&&t[0]!==document;){if(e=t.css("position"),("absolute"===e||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}function i(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
293ay","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.regional.en=t.extend(!0,{},this.regional[""]),this.regional["en-US"]=t.extend(!0,{},this.regional.en),this.dpDiv=s(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function s(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.on("mouseout",i,function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",i,n)}function n(){t.datepicker._isDisabledDatepicker(h.inline?h.dpDiv.parent()[0]:h.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))}function o(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}t.ui=t.ui||{},t.ui.version="1.12.1";var a=0,r=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},l=e.split(".")[0];e=e.split(".")[1];var h=l+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var i,s,n=r.call(arguments,1),o=0,a=n.length;a>o;o++)for(i in n[o])s=n[o][i],n[o].hasOwnProperty(i)&&void 0!==s&&(e[i]=t.isPlainObject(s)?t.isPlainObject(e[i])?t.widget.extend({},e[i],s):t.widget.extend({},s):s);return e},t.widget.bridge=function(e,i){var s=i.prototype.widgetFullName||e;t.fn[e]=function(n){var o="string"==typeof n,a=r.call(arguments,1),l=this;return o?this.length||"instance"!==n?this.each(function(){var i,o=t.data(this,s);return"instance"===n?(l=o,!1):o?t.isFunction(o[n])&&"_"!==n.charAt(0)?(i=o[n].apply(o,a),i!==o&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+n+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+n+"'")}):l=void 0:(a.length&&(n=t.widget.extend.apply(null,[n].concat(a))),this.each(function(){var e=t.data(this,s);e?(e.option(n||{}),e._init&&e._init()):t.data(this,s,new i(n,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(e,i){i=t(i||this.defaultElement||this)[0],this.element=t(i),this.uuid=a++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t
293(),this.classesElementLookup={},i!==this&&(t.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===i&&this.destroy()}}),this.document=t(i.style?i.ownerDocument:i.document||i),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var l=!1;t(document).on("mouseup",function(){l=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!l){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,s=1===e.which,n="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),l=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,l=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])}
vendor: 5,773 bytes, line 293
293,call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blurActiveElement(e),this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("<div>").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=t.ui.safeActiveElement(this.document[0]),s=t(e.target);s.closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}
vendor: 4,535 bytes, line 293
293),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),l=t.pageX,h=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.left<i[0]&&(l=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(h=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(l=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(h=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,h=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>
vendor: 11,366 bytes, lines 293-294
293i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,l=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(l=this.originalPageX),"x"===a.axis&&(h=this.originalPageY)),{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY<n.scrollSensitivity?a.scrollTop=o=a.scrollTop+n.scrollSpeed:e.pageY-s.overflowOffset.top<n.scrollSensitivity&&(a.scrollTop=o=a.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+a.offsetWidth-e.pageX<n.scrollSensitivity?a.scrollLeft=o=a.scrollLeft+n.scrollSpeed:e.pageX-s.overflowOffset.left<n.scrollSensitivity&&(a.scrollLeft=o=a.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(e.pageY-t(r).scrollTop()<n.scrollSensitivity?o=t(r).scrollTop(t(r).scrollTop()-n.scrollSpeed):t(window).height()-(e.pageY-t(r).scrollTop())<n.scrollSensitivity&&(o=t(r).scrollTop(t(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(e.pageX-t(r).scrollLeft()<n.scrollSensitivity?o=t(r).scrollLeft(t(r).scrollLeft()-n.scrollSpeed):t(window).width()-(e.pageX-t(r).scrollLeft())<n.scrollSensitivity&&(o=t(r).scrollLeft(t(r).scrollLeft()+n.scrollSpeed)))),o!==!1&&t.ui.ddmanager&&!n.dropBehaviour&&t.ui.ddmanager.prepareOffsets(s,e)}}),t.ui.plugin.add("draggable","snap",{start:function(e,i,s){var n=s.options;s.snapElements=[],t(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var e=t(this),i=e.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:e.outerWidth(),height:e.outerHeight(),top:i.top,left:i.left})})},drag:function(e,i,s){var n,o,a,r,l,h,c,u,d,p,f=s.options,g=f.snapTolerance,m=i.offset.left,_=m+s.helperProportions.width,v=i.offset.top,b=v+s.helperProportions.height;for(d=s.snapElements.length-1;d>=0;d--)l=s.snapElements[d].left-s.margins.left,h=l+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,l-g>_||m>h+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(l-_),r=g>=Math.abs(h-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(l-m),r=g>=Math.abs(h-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)
294}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.extend(t.ui,{datepicker:{version:"1.12.1"}});var h;t.extend(i.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return o(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,o;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),o=this._newInst(t(e),n),o.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,o):n&&this._inlineDatepicker(e,o)},_newInst:function(e,i){var n=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:n,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?s(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(i),t.data(e,"datepicker",i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,o,a=this._get(i,"appendText"),r=this._get(i,"isRTL");i.append&&i.append.remove(),a&&(i.append=t("<span class='"+this._appendClass+"'>"+a+"</span>"),e[r?"before":"after"](i.append)),e.off("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.on("focus",this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),o=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:o,alt:n,title:n}):t("<button type='button'></button>").addClass(this._triggerClass).html(o?t("<img/>").attr({src:o,alt:n,title:n}):n)),e[r?"before":"after"](i.trigger),i.trigger.on("click",function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,o=new Date(2009,11,20),a=this._get(t,"dateFormat");a.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,"datepicker",i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,n,a){var r,l,h,c,u,d=this._dialogInst;return d||(this.uuid+=1,r="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+r+"' style='position: absolute; top: -100px; width: 0px;'/>
294"),this._dialogInput.on("keydown",this._doKeyDown),t("body").append(this._dialogInput),d=this._dialogInst=this._newInst(this._dialogInput,!1),d.settings={},t.data(this._dialogInput[0],"datepicker",d)),o(d.settings,n||{}),i=i&&i.constructor===Date?this._formatDate(d,i):i,this._dialogInput.val(i),this._pos=a?a.length?a:[a.pageX,a.pageY]:null,this._pos||(l=document.documentElement.clientWidth,h=document.documentElement.clientHeight,c=document.documentElement.scrollLeft||document.body.scrollLeft,u=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[l/2-100+c,h/2-150+u]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),d.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],"datepicker",d),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,"datepicker");s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,"datepicker"),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty(),h===n&&(h=null))},_enableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,o.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),o=t.data(e,"datepicker");n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,o.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,"datepicker")}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,i,s){var n,a,r,l,h=this._getInst(e);return 2===arguments.length&&"string"==typeof i?"defaults"===i?t.extend({},t.datepicker._defaults):h?"all"===i?t.extend({},h.settings):this._get(h,i):null:(n=i||{},"string"==typeof i&&(n={},n[i]=s),h&&(this._curInst===h&&this._hideDatepicker(),a=this._getDateDatepicker(e,!0),r=this._getMinMaxDate(h,"min"),l=this._getMinMaxDate(h,"max"),o(h.settings,n),null!==r&&void 0!==n.dateFormat&&void 0===n.minDate&&(h.settings.minDate=this._formatDate(h,r)),null!==l&&void 0!==n.dateFormat&&void 0===n.maxDate&&(h.settings.maxDate=this._formatDate(h,l)),"disabled"in n&&(n.disabled?this._disableDatepicker(e):this._enableDatepicker(e)),this._attachments(t(e),h),this._autoSize(h),this._setDate(h,a),this._updateAlternate(h),this._updateDatepicker(h)),void 0)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,o=t.datepicker._getInst(e.target),a=!0,r=o.dpDiv.is(".ui-datepicker-rtl");if(o._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),a=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",o.dpDiv),n[0]&&t.datepicker._selectDay(e.target,o.selectedMonth,o.selectedYear,n[0]),i=t.datepicker._get(o,"onSelect"),i?(s=t.datepicker._formatDate(o),i.apply(o.input?o.input[0]:null,[s,o])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),a=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),a=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?1:-1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(o,"stepBigMonths"):-t.datepicker._get(o,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),a=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,r?-1:1,"D"),a=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(o,"stepBigMonths"):+t.datepicker._get(o,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),a=e.ctrlKey||e.metaKey;break;default:a=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):a=!1;a&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var i,s,n=t.datepicker._getInst(e.target);return t.datepicker._get(n,"constrainInput")?(i=t.datepicker._possibleChars(t.datepicker._get(n,"dateFormat")),s=String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),e.ctrlKey||e.metaKey||" ">s||!i||i.indexOf(s)>-1):void 0},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(i){if(i=i.target||i,"input"!==i.nodeName.toLowerCase()&&(i=t("input",i.parentNode)[0]),!t.datepicker._isDisabledDatepicker(i)&&t.datepicker._lastInput!==i){var s,n,a,r,l,h,c;s=t.datepicker._getInst(i),t.datepicker._curInst&&t.datepicker._curInst!==s&&(t.datepicker._curInst.dpDiv.stop(!0,!0),s&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),n=t.datepicker._get(s,"beforeShow"),a=n?
vendor: 18,401 bytes, line 294
294n.apply(i,[i,s]):{},a!==!1&&(o(s.settings,a),s.lastVal=null,t.datepicker._lastInput=i,t.datepicker._setDateFromField(s),t.datepicker._inDialog&&(i.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(i),t.datepicker._pos[1]+=i.offsetHeight),r=!1,t(i).parents().each(function(){return r|="fixed"===t(this).css("position"),!r}),l={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,s.dpDiv.empty(),s.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(s),l=t.datepicker._checkOffset(s,l,r),s.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":r?"fixed":"absolute",display:"none",left:l.left+"px",top:l.top+"px"}),s.inline||(h=t.datepicker._get(s,"showAnim"),c=t.datepicker._get(s,"duration"),s.dpDiv.css("z-index",e(t(i))+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[h]?s.dpDiv.show(h,t.datepicker._get(s,"showOptions"),c):s.dpDiv[h||"show"](h?c:null),t.datepicker._shouldFocusInput(s)&&s.input.trigger("focus"),t.datepicker._curInst=s))}},_updateDatepicker:function(e){this.maxRows=4,h=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var i,s=this._getNumberOfMonths(e),o=s[1],a=17,r=e.dpDiv.find("."+this._dayOverClass+" a");r.length>0&&n.apply(r.get(0)),e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),o>1&&e.dpDiv.addClass("ui-datepicker-multi-"+o).css("width",a*o+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.trigger("focus"),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),o=e.dpDiv.outerHeight(),a=e.input?e.input.outerWidth():0,r=e.input?e.input.outerHeight():0,l=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),h=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-a:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+r?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>l&&l>n?Math.abs(i.left+n-l):0),i.top-=Math.min(i.top,i.top+o>h&&h>o?Math.abs(o+r):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,o,a=this._curInst;!a||e&&a!==t.data(e,"datepicker")||this._datepickerShowing&&(i=this._get(a,"showAnim"),s=this._get(a,"duration"),n=function(){t.datepicker._tidyDialog(a)},t.effects&&(t.effects.effect[i]||t.effects[i])?a.dpDiv.hide(i,t.datepicker._get(a,"showOptions"),s,n):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,o=this._get(a,"onClose"),o&&o.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),o=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(o,i+("M"===s?this._get(o,"showCurrentAtPos"):0),s),this._updateDatepicker(o))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),o=this._getInst(n[0]);o["selected"+("M"===s?"Month":"Year")]=o["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(o),this._adjustDate(n)},_selectDay:function(e,i,s,n){var o,a=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(a[0])||(o=this._getInst(a[0]),o.selectedDay=o.currentDay=t("a",n).html(),o.selectedMonth=o.currentMonth=i,o.selectedYear=o.currentYear=s,this._selectDate(e,this._formatDate(o,o.currentDay,o.currentMonth,o.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),o=this._getInst(n[0]);i=null!=i?i:this._formatDate(o),o.input&&o.input.val(i),this._updateAlternate(o),s=this._get(o,"onSelect"),s?s.apply(o.input?o.input[0]:null,[i,o]):o.input&&o.input.trigger("change"),o.inline?this._updateDatepicker(o):(this._hideDatepicker(),this._lastInput=o.input[0],"object"!=typeof o.input[0]&&o.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,o=this._get(e,"altField");o&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(o).val(n))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(e,i,s){if(null==e||null==i)throw"Invalid arguments";if(i="object"==typeof i?""+i:i+"",""===i)return null;var n,o,a,r,l=0,h=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,c="string"!=typeof h?h:(new Date).getFullYear()%100+parseInt(h,10),u=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,d=(s?s.dayNames:null)||this._defaults.dayNames,p=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,f=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,m=-1,_=-1,v=-1,b=!1,y=function(t){var i=e.length>n+1&&e.charAt(n+1)===t;return i&&n++,i},w=function(t){var e=y(t),s="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n="y"===t?s:1,o=RegExp("^\\d{"+n+","+s+"}"),a=i.substring(l).match(o);if(!a)throw"Missing number at position "+l;return l+=a[0].length,parseInt(a[0],10)},k=function(e,s,n){var o=-1,a=t.map(y(e)?n:s,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(a,function(t,e){var s=e[1];return i.substr(l,s.length).toLowerCase()===s.toLowerCase()?(o=e[0],l+=s.length,!1):void 0}),-1!==o)return o+1;throw"Unknown name at position "+l},x=function(){if(i.charAt(l)!==e.charAt(n))throw"Unexpected literal at position "+l;l++};for(n=0;e.length>n;n++)if(b)"'"!==e.charAt(n)||y("'")?x():b=!1;else switch(e.charAt(n)){case"d":_=w("d");break;case"D":k("D",u,d);break;case"o":v=w("o");break;case"m":m=w("m");break;case"M":m=k("M",p,f);break;case"y":g=w("y");break;case"@":r=new Date(w("@")),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"!":r=new Date((w("!")-this._ticksTo1970)/1e4),g=r.getFullYear(),m=r.getMonth()+1,_=r.getDate();break;case"'":y("'")?x():b=!0;break;default:x()}if(i.length>l&&(a=i.substr(l),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c>=g?0:-100)),v>-1)for(m=1,_=v;;){if(o=this._getDaysInMonth(g,m-1),o>=_)break;m++,_-=o}if(r=this._daylightSavingAdjust(new Date(g,m-1,_)),r.getFullYear()!==g||r.getMonth()+1!==m||r.getDate()!==_)throw"Invalid date";return r},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,o=(i?i.dayNames:null)||this._defaults.dayNames,a=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,r=(i?i.monthNames:null)||this._defaults.monthNames,l=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},h=function(t,e,i){var s=""+e;if(l(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return l(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||l("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=h("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,o);break;case"o":u+=h("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=h("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),a,r);break;case"y":u+=l("y")?e.getFullYear():(10>e.getFullYear()%100?"0":"")+e.getFullYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":l("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,e){return void 0!==t.settings[e]?t.settings[e]:this._defaults[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(r){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},o=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,o=n.getFullYear(),a=n.getMonth(),r=n.getDate(),l=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,h=l.exec(i);h;){switch(h[2]||"d"){case"d":case"D":r+=parseInt(h[1],10);break;case"w":case"W":r+=7*parseInt(h[1],10);break;case"m":case"M":a+=parseInt(h[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a));break;case"y":case"Y":o+=parseInt(h[1],10),r=Math.min(r,t.datepicker._getDaysInMonth(o,a))}h=l.exec(i)}return new Date(o,a,r)},a=null==i||""===i?s:"string"==typeof i?o(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return a=a&&"Invalid Date"==""+a?s:a,a&&(a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0)),this._daylightSavingAdjust(a)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,a=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=a.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=a.getMonth(),t.drawYear=t.selectedYear=t.currentYear=a.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).on(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,l,h,c,u,d,p,f,g,m,_,v,b,y,w,k,x,C,D,T,I,M,P,S,N,H,A,z,O,E,W,F,L,R=new Date,Y=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),B=this._get(t,"isRTL"),j=this._get(t,"showButtonPanel"),q=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),V=this._get(t,"showCurrentAtPos"),X=this._get(t,"stepMonths"),$=1!==U[0]||1!==U[1],G=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),J=this._getMinMaxDate(t,"min"),Q=this._getMinMaxDate(t,"max"),Z=t.drawMonth-V,te=t.drawYear;if(0>Z&&(Z+=12,te--),Q)for(e=this._daylightSavingAdjust(new Date(Q.getFullYear(),Q.getMonth()-U[0]*U[1]+1,Q.getDate())),e=J&&J>e?J:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-X,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(B?"e":"w")+"'>"+i+"</span></a>":q?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(B?"e":"w")+"'>"+i+"</span></a>",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+X,1)),this._getFormatConfig(t)):n,o=this._canAdjustMonth(t,1,te,Z)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(B?"w":"e")+"'>"+n+"</span></a>":q?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+n+"'><span class='ui-icon ui-icon-circle-triangle-"+(B?"w":"e")+"'>"+n+"</span></a>",a=this._get(t,"currentText"),r=this._get(t,"gotoCurrent")&&t.currentDay?G:Y,a=K?this.formatDate(a,r,this._getFormatConfig(t)):a,l=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",h=j?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(B?l:"")+(this._isInRange(t,r)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+a+"</button>":"")+(B?"":l)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),g=this._get(t,"monthNamesShort"),m=this._get(t,"beforeShowDay"),_=this._get(t,"showOtherMonths"),v=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;U[0]>k;k++){for(x="",this.maxRows=4,C=0;U[1]>C;C++){if(D=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),T=" ui-corner-all",I="",$){if(I+="<div class='ui-datepicker-group",U[1]>1)switch(C){case 0:I+=" ui-datepicker-group-first",T=" ui-corner-"+(B?"right":"left");break;case U[1]-1:I+=" ui-datepicker-group-last",T=" ui-corner-"+(B?"left":"right");break;default:I+=" ui-datepicker-group-middle",T=""}I+="'>"}for(I+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+T+"'>"+(/all|left/.test(T)&&0===k?B?o:s:"")+(/all|right/.test(T)&&0===k?B?s:o:"")+this._generateMonthYearHeader(t,Z,te,J,Q,k>0||C>0,f,g)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",M=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",w=0;7>w;w++)P=(w+c)%7,M+="<th scope='col'"+((w+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[P]+"'>"+p[P]+"</span></th>";for(I+=M+"</tr></thead><tbody>",S=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,S)),N=(this._getFirstDayOfMonth(te,Z)-c+7)%7,H=Math.ceil((N+S)/7),A=$?this.maxRows>H?this.maxRows:H:H,this.maxRows=A,z=this._daylightSavingAdjust(new Date(te,Z,1-N)),O=0;A>O;O++){for(I+="<tr>",E=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(z)+"</td>":"",w=0;7>w;w++)W=m?m.apply(t.input?t.input[0]:null,[z]):[!0,""],F=z.getMonth()!==Z,L=F&&!v||!W[0]||J&&J>z||Q&&z>Q,E+="<td class='"+((w+c+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(z.getTime()===D.getTime()&&Z===t.selectedMonth&&t._keyEvent||b.getTime()===z.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!_?"":" "+W[1]+(z.getTime()===G.getTime()?" "+this._currentClass:"")+(z.getTime()===Y.getTime()?" ui-datepicker-today":""))+"'"+(F&&!_||!W[2]?"":" title='"+W[2].replace(/'/g,"&#39;")+"'")+(L?"":" data-handler='selectDay' data-event='click' data-month='"+z.getMonth()+"' data-year='"+z.getFullYear()+"'")+">"+(F&&!_?"&#xa0;":L?"<span class='ui-state-default'>"+z.getDate()+"</span>":"<a class='ui-state-default"+(z.getTime()===Y.getTime()?" ui-state-highlight":"")+(z.getTime()===G.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+"' href='#'>"+z.getDate()+"</a>")+"</td>",z.setDate(z.getDate()+1),z=this._daylightSavingAdjust(z);I+=E+"</tr>"}Z++,Z>11&&(Z=0,te++),I+="</tbody></table>"+($?"</div>"+(U[0]>0&&C===U[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),x+=I}y+=x}return y+=h,t._keyEvent=!1,y}
294,_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var l,h,c,u,d,p,f,g,m=this._get(t,"changeMonth"),_=this._get(t,"changeYear"),v=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",y="";if(o||!m)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(l=s&&s.getFullYear()===i,h=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!l||c>=s.getMonth())&&(!h||n.getMonth()>=c)&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(v||(b+=y+(!o&&m&&_?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",o||!_)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),g=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,g=n?Math.min(g,n.getFullYear()):g,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";g>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),v&&(b+=(!o&&m&&_?"":"&#xa0;")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),o=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),a=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,o)));t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),o=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&o.setDate(this._getDaysInMonth(o.getFullYear(),o.getMonth())),this._isInRange(t,o)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),o=this._getMinMaxDate(t,"max"),a=null,r=null,l=this._get(t,"yearRange");return l&&(i=l.split(":"),s=(new Date).getFullYear(),a=parseInt(i[0],10),r=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(a+=s),i[1].match(/[+\-].*/)&&(r+=s)),(!n||e.getTime()>=n.getTime())&&(!o||e.getTime()<=o.getTime())&&(!a||e.getFullYear()>=a)&&(!r||r>=e.getFullYear())
295},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).on("mousedown",t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new i,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.12.1",t.datepicker});
296;
297/*!
298 * jQuery UI Touch Punch 0.2.3
299 *
300 * Copyright 2011–2014, Dave Furfero
301 * Dual licensed under the MIT or GPL Version 2 licenses.
302 *
303 * Depends:
304 *  jquery.ui.widget.js
305 *  jquery.ui.mouse.js
306 */
307!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);;
308/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
309 * Build: http://modernizr.com/download/#-csstransforms3d-inputtypes-svg-touch-shiv-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-css_calc-css_overflow_scrolling-css_positionsticky
310 */
311;window.Modernizr=function(a,b,c){function C(a){j.cssText=a}function D(a,b){return C(n.join(a+";")+(b||""))}function E(a,b){return typeof a===b}function F(a,b){return!!~(""+a).indexOf(b)}function G(a,b){for(var d in a){var e=a[d];if(!F(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function H(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:E(f,"function")?f.bind(d||b):f}return!1}function I(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return E(b,"string")||E(b,"undefined")?G(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),H(e,b,c))}function J(){e.inputtypes=function(a){for(var d=0,e,f,h,i=a.length;d<i;d++)k.setAttribute("type",f=a[d]),e=k.type!=="text",e&&(k.value=l,k.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&k.style.WebkitAppearance!==c?(g.appendChild(k),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(k,null).WebkitAppearance!=="textfield"&&k.offsetHeight!==0,g.removeChild(k)):/^(search|tel)$/.test(f)||(/^(url|email)$/.test(f)?e=k.checkValidity&&k.checkValidity()===!1:e=k.value!=l)),t[a[d]]=!!e;return t}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var d="2.8.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k=b.createElement("input"),l=":)",m={}.toString,n=" -webkit- -moz- -o- -ms- ".split(" "),o="Webkit Moz O ms",p=o.split(" "),q=o.toLowerCase().split(" "),r={svg:"http://www.w3.org/2000/svg"},s={},t={},u={},v=[],w=v.slice,x,y=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["&#173;",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},z=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=E(e[d],"function"),E(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),A={}.hasOwnProperty,B;!E(A,"undefined")&&!E(A.call,"undefined")?B=function(a,b){return A.call(a,b)}:B=function(a,b){return b in a&&E(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;
311var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e}),s.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:y(["@media (",n.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},s.csstransforms3d=function(){var a=!!I("perspective");return a&&"webkitPerspective"in g.style&&y("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect};for(var K in s)B(s,K)&&(x=K.toLowerCase(),e[x]=s[K](),v.push((e[x]?"":"no-")+x));return e.input||J(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)B(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},C(""),i=k=null,function(a,b){function l(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function m(){var a=s.elements;return typeof a=="string"?a.split(" "):a}function n(a){var b=j[a[h]];return b||(b={},i++,a[h]=i,j[i]=b),b}function o(a,c,d){c||(c=b);if(k)return c.createElement(a);d||(d=n(c));var g;return d.cache[a]?g=d.cache[a].cloneNode():f.test(a)?g=(d.cache[a]=d.createElem(a)).cloneNode():g=d.createElem(a),g.canHaveChildren&&!e.test(a)&&!g.tagUrn?d.frag.appendChild(g):g}function p(a,c){a||(a=b);if(k)return a.createDocumentFragment();c=c||n(a);var d=c.frag.cloneNode(),e=0,f=m(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function q(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return s.shivMethods?o(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(s,b.frag)}function r(a){a||(a=b);var c=n(a);return s.shivCSS&&!g&&!c.hasCSS&&(c.hasCSS=!!l(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),k||q(a,c),a}var c="3.7.0",d=a.html5||{},e=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,f=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,g,h="_html5shiv",i=0,j={},k;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",g="hidden"in a,k=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){g=!0,k=!0}})();var s={elements:d.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:c,shivCSS:d.shivCSS!==!1,supportsUnknownElements:k,shivMethods:d.shivMethods!==!1,type:"default",shivDocument:r,createElement:o,createDocumentFragment:p};a.html5=s,r(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.hasEvent=z,e.testProp=function(a){return G([a])},e.testAllProps=I,e.testStyles=y,e.prefixed=function(a,b,c){return b?I(a,b,c):I(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),Modernizr.addTest("overflowscrolling",function(){return Modernizr.testAllProps("overflowScrolling")}),Modernizr.addTest("csspositionsticky",function(){var a="position:",b="sticky",c=document.createElement("modernizr"),d=c.style;return d.cssText=a+Modernizr._prefixes.join(b+";"+a).slice(0,-a.length),d.position.indexOf(b)!==-1}),Modernizr.addTest("csscalc",function(){var a="width:",b="calc(10px);",c=document.createElement("div");return c.style.cssText=a+Modernizr._prefixes.join(b+a),!!c.style.length});;
312if (typeof(jQuery) != 'undefined') {
313	window.addEventListener('load', function() {
314		jQuery('body').addClass('loaded');
315	}, false);
316
317	jQuery.fn.cleanWhitespace = function () {
318		textNodes = this.contents().filter(
319		  function() { return (this.nodeType == 3 && !/\S/.test(this.nodeValue)); })
320		  .remove();
321		return this;
322	};
323
324	jQuery.fn.touchFix = function (options) {
325	    if (!Modernizr.touch) return this;
326
327	    var $ = jQuery;
328	    var $parent = $(this);
329
330	    $(document)
331	    .on('focus', options.inputElements, function (e) {
332	        $parent.addClass(options.addClass);
333	    })
334	    .on('blur', options.inputElements, function (e) {
335	        $parent.removeClass(options.addClass);
336
337	        // Fix for some scenarios where you need to start scrolling
338	        // setTimeout(function() {
339	        //     $(document).scrollTop($(document).scrollTop());
340	        // }, 1);
341	    });
342
343	    return this;
344	};
345
346	(function ($) {
347	    $.extend({
348	        getQueryString: function (name) {
349	            function parseParams() {
350	                var params = {},
351	                    e,
352	                    a = /\+/g,  // Regex for replacing addition symbol with a space
353	                    r = /([^&=]+)=?([^&]*)/g,
354	                    d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
355	                    q = window.location.search.substring(1);
356
357	                while (e = r.exec(q))
358	                    params[d(e[1])] = d(e[2]);
359
360	                return params;
361	            }
362
363	            if (!this.queryStringParams)
364	                this.queryStringParams = parseParams();
365
366	            return this.queryStringParams[name];
367	        }
368	    });
369	})(jQuery);
370}
371
372var calacademy = {
373	Constants: {
374		isShake: false,
375		defaultSearchText: '',
376		emptyGif: '/sites/all/themes/calacademy_zen/images/empty.gif',
377		emptyGifLandscape: '/sites/all/themes/calacademy_zen/images/empty-landscape.gif',
378		breakpoints: {
379			smartphone: 320,
380			tablet: 870,
381			desktop: 1000
382		},
383		popUpProfiles: {
384			chat: {
385				width: 430,
386				height: 450,
387				resizable: 0,
388				center: 1,
389				createnew: 0
390			}
391		}
392	},
393	addConfetti: function (el, targetElSelector, eventName) {
394		if (typeof(confetti) != 'function') return;
395
396		var _fire = function (e, particleRatio, opts) {
397			if (typeof(targetElSelector) == 'string') {
398				if (!jQuery(e.target).is(targetElSelector)) {
399					// skip if not target
400					return;
401				}
402			}
403
404			opts.zIndex = 9999;
405			opts.particleCount = Math.floor(200 * particleRatio);
406			opts.colors = ['#89c53f', '#16bde1', '#61569b'];
407
408			if (jQuery('html').hasClass('claude-countdown-complete')) {
409				// add pink
410				opts.colors.push('#EA368E');
411			}
412
413			opts.scalar = 1.5;
414			
415			if (e.originalEvent && e.originalEvent.touches) {
416				// touch event
417				opts.origin = {
418					x: e.originalEvent.touches[0].clientX / window.innerWidth,
419					y: e.originalEvent.touches[0].clientY / window.innerHeight
420				};
421			} else if (e.clientX && e.clientY) {
422				// mouse event
423				opts.origin = {
424					x: e.clientX / window.innerWidth,
425					y: e.clientY / window.innerHeight
426				};
427			}
428
429			var rectangle = confetti.shapeFromPath({ path: 'M0 0 H100 V25 H0 Z' });
430			opts.shapes = [ rectangle ];
431
432			confetti(opts);
433		}
434
435		var trigger = Modernizr.touch ? 'touchstart' : 'mouseover';
436		if (typeof(eventName) == 'string') trigger = eventName;
437
438		trigger += '.calacademy-confetti';
439		el.off('.calacademy-confetti');		
440
441		el.on(trigger, function (e) {
442			_fire(e, 0.25, {
443				spread: 26,
444				startVelocity: 55,
445			});
446			_fire(e, 0.2, {
447				spread: 60,
448			});
449			_fire(e, 0.35, {
450				spread: 100,
451				decay: 0.91,
452				scalar: 0.8
453			});
454			_fire(e, 0.1, {
455				spread: 120,
456				startVelocity: 25,
457				decay: 0.92,
458				scalar: 1.2
459			});
460			_fire(e, 0.1, {
461				spread: 120,
462				startVelocity: 45,
463			});
464		});
465	},
466	fixRightRail: function () {
467		var $ = jQuery;
468
469		var foo = setInterval(function () {
470			if ($('cl-donation-form').length > 0) {
471				clearInterval(foo);
472				$('.right-rail').insertAfter('.center-wrapper .panel-col-first');
473			}
474		}, 333);
475	},
476	Utils: {
477		initHeroVideo: function (v) {
478			var $ = jQuery;
479
480			var _onAutoplayError = function () {
481				// mimic autoplay via user interaction
482				$('body').on('click.video-autoplay touchstart.video-autoplay', function () {
483					v.get(0).play();
484					$('body').off('.video-autoplay');
485				});
486			}
487
488			v.off();
489			$('.video-control-container').remove();
490			$('html').attr('video-state', '');
491
492			// no fade out
493			if (v.hasClass('playing')) {
494				v.addClass('no-transition');
495				v.removeClass('playing');
496			}
497
498			v.on('playing', function () {
499				$(this).off('playing');
500
501				$(this).removeClass('no-transition');
502				$(this).addClass('playing');
503
504				// add playing attribute
505				$('html').attr('video-state', 'playing');
506
507				// insert button
508				var btn = $('<button>Toggle video playback</button>');
509
510				btn.on('touchend click', function () {
511					var video = v.get(0);
512
513					if (video.paused) {
514						video.play();
515						$('html').attr('video-state', 'playing');
516					} else {
517						video.pause();
518						$('html').attr('video-state', 'paused');
519					}
520
521					return false;
522				});
523
524				var container = $('<div />');
525				container.addClass('container');
526				container.addClass('video-control-container');
527				container.append(btn);
528
529				v.parent().append(container);
530			});
531
532			v.on('canplay', function () {
533				$(this).off('canplay');
534
535				// check if autoplay enabled
536				var promise = $(this).get(0).play();
537
538				if (typeof(promise.catch) == 'function') {
539				    promise.catch(_onAutoplayError);
540				}
541			});
542
543			if (v.get(0).readyState > 3) {
544				v.trigger('canplay');
545			}
546		},
547		log: function (obj, css) {
548			if (typeof(console) == 'undefined') {
549				if (typeof(dump) == 'function') {
550					dump(obj);
551				} else {
552					// alert(obj);
553				}
554			} else {
555				if (css) {
556					console.log('%c' + obj, css);
557				} else {
558					console.log(obj);
559				}
560			}
561		},
562		getBrowserInfo: function () {
563			var ua=navigator.userAgent,tem,M=ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
564
565			if(/trident/i.test(M[1])){
566				tem=/\brv[ :]+(\d+)/g.exec(ua) || [];
567				return {name:'IE ',version:(tem[1]||'')};
568			}
569			if(M[1]==='Chrome'){
570				tem=ua.match(/\bOPR\/(\d+)/)
571				if(tem!=null)   {return {name:'Opera', version:tem[1]};}
572			}
573
574			M=M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
575			if((tem=ua.match(/version\/(\d+)/i))!=null) {M.splice(1,1,tem[1]);}
576
577			return {
578				name: M[0],
579				version: M[1]
580			};
581		},
582		getFileExtension: function (file) {
583			file = file.split('?').shift();
584			return file.split('.').pop().toLowerCase();
585		},
586		initSignupForms: function (callback, formId) {
587			jQuery('.enews-signup').on('submit', function () {
588				if (jQuery(this).hasClass('submitting')) {
589					return false;
590				}
591
592				jQuery(this).addClass('submitting');
593
594				var email = jQuery.trim(jQuery('.email', this).val()).toLowerCase();
595
596				if (!calacademy.Utils.isEmail(email)) {
597					jQuery(this).removeClass('submitting');
598					jQuery('.email', this).val('');
599					jQuery('.email', this).attr('placeholder', 'Please enter a valid email address');
600					return false;
601				}
602
603				var field = jQuery('.email', this);
604
605				field.val('');
606				field.blur();
607				field.attr('disabled', 'true');
608				field.attr('placeholder', 'Submitting...');
609
610				var host = location.host;
611				// use prod www host unless www-stg or local env
612				if ((host.indexOf('local') === -1) && (host.indexOf('www-stg') === -1)) {
613					host = 'www.calacademy.org';
614				}
615
616				var baseurl = location.protocol + '//' + host;
617
618				// this needs to be cloned to calacademy_instant_articles_get_footer
619				// /sites/all/modules/custom/calacademy_instant_articles/calacademy_instant_articles.module
620
621				var transactionId = '2911631';
622				var listIds = [ 10233915 ];
623
624				if (jQuery('body').hasClass('section-nightlife')) {
625					transactionId = '3165489';
626					listIds = [ 10233914 ];
627				}
628
629				if (jQuery('body').hasClass('section-educators')) {
630					listIds = [ 451929166 ];
631				}
632
633				jQuery.ajax({
634					dataType: 'jsonp',
635					url: baseurl + '/mailjet-client-proxy',
636					data: {
637						email: email,
638						list_ids: listIds,
639						collection_point: 'wwwfooter',
640						template_transaction_id: transactionId
641					},
642					success: function (data, textStatus, XMLHttpRequest) {
643						field.val('');
644						field.blur();
645						field.attr('placeholder', 'Thank you for signing up!');
646						field.removeAttr('disabled');
647						field.closest('.enews-signup').removeClass('submitting');
648						
649						window.dataLayer = window.dataLayer || [];
650
651						window.dataLayer.push({
652							'event': 'email_sign_up',
653							'email_signup_name': formId ? formId : 'subscribe_form_footer',
654							'userId': btoa(encodeURIComponent(email))
655						});
656
657						if (typeof(callback) == 'function') callback();
658					},
659					error: function (XMLHttpRequest, textStatus, errorThrown) {
660						field.val('');
661						field.attr('placeholder', 'The server encountered an error. Please try again.');
662						field.removeAttr('disabled');
663						field.closest('.enews-signup').removeClass('submitting');
664					}
665				});
666
667				return false;
668			});
669		},
670		snow: function (alwaysSnow) {
671			if (typeof(alwaysSnow) == 'undefined') alwaysSnow = false;
672			if (jQuery('#snow-container').length > 0) return;
673
674			if (!alwaysSnow) {
675				if (!window.calacademyJazz) return;
676				if (!jQuery('html').hasClass('snow') && !window.calacademyJazz.snow) return;
677			}
678
679			jQuery.getJSON('/sites/all/themes/calacademy_zen/js/particlesjs-config.json', function (data) {
680				var snowContainer = jQuery('<div id="snow-container" />');
681
682				snowContainer.css({
683					position: 'fixed',
684					top: '0',
685					left: '0',
686					bottom: '0',
687					right: '0',
688					zIndex: '997',
689					pointerEvents: 'none'
690				});
691
692				jQuery('body').append(snowContainer);
693
694				particlesJS('snow-container', data);
695			});
696		},
697		getEvents: function (el) {
698			return jQuery._data(el.get(0), 'events');
699		},
700		addBadges: function () {
701			var $ = jQuery;
702
703			var _getBadgeSlug = function (el) {
704				var str = $.trim(el.text()).toLowerCase();
705				if (str == '') return false;
706
707				return 'badge-' + str.split(' ').join('-');
708			}
709
710			var imgFields = [
711				'.views-field-field-image-primary-1',
712				'.views-field-field-hero-region',
713				'.views-field-field-image-primary',
714				'.views-field-field-inline-image',
715				'.views-field-field-slideshow-frame-bg-image'
716			];
717
718			var imgSelector = imgFields.join(', ');
719
720			// from view field
721			$('.views-field-field-badge').each(function () {
722				var badgeClass = _getBadgeSlug($(this));
723				if (!badgeClass) return true;
724
725				var row = $(this).closest('.views-row');
726				row.find(imgSelector).addClass(badgeClass);
727			});
728
729			// from img data
730			$(imgSelector).find('img').each(function () {
731				if ($(this).data('badge')) {
732					var row = $(this).closest('.views-row');
733					row.find(imgSelector).addClass($(this).data('badge'));
734				}
735			});
736
737			// from body class
738			$.each([
739				'virtual-event', 'sold-out', 'closing-soon', 'coming-soon', 'new', 'expand'
740			], function (i, str) {
741				if (jQuery('body').hasClass('body-badge-' + str)) {
742					jQuery('.pane-hero-media-slideshow-standard').addClass('badge-' + str);
743					return false;
744				}
745			});
746		},
747		randomRange: function (low, high) {
748			return (Math.random() * (high - low)) + low;
749		},
750		getRowHeight: function (row) {
751			// this only works for "portrait" style views
752			var $ = jQuery;
753			var h = parseInt(row.css('marginTop')) + parseInt(row.css('marginBottom'));
754
755			$('.views-field', row).each(function () {
756				// don't calculate hidden fields
757				if (!$(this).is(':visible')) return;
758
759				// use width for primary image cuz sometimes height is miscalculated or absent
760				if ($(this).hasClass('views-field-field-image-primary')
761					|| $(this).hasClass('views-field-field-hero-region')
762					|| $(this).hasClass('views-field-field-slideshow-frame-bg-image')) {
763					h += $(this).width() + parseInt($(this).css('marginBottom')) + parseInt($(this).css('marginTop'));
764				} else {
765					h += $(this).outerHeight(true);
766				}
767			});
768
769			return h;
770		},
771		getClusterHeight: function (cluster) {
772			var $ = jQuery;
773
774			// iterate all rows and record bottom positions
775			var bottoms = [];
776
777			$('.views-row', cluster).each(function () {
778				var rowTop = $(this).position().top;
779				bottoms.push(rowTop + calacademy.Utils.getRowHeight($(this)));
780			});
781
782			// return the bottom-most value
783			return Math.max.apply(Math, bottoms);
784		},
785		clearClusterHeights: function (viewElement) {
786			var $ = jQuery;
787
788			viewElement.each(function () {
789				$('.view', this).addClass('dynamic-css');
790				$('.view', this).css('height', calacademy.Utils.getClusterHeight($(this)) + 'px');
791			});
792		},
793		removeEmptyElements: function (selector, container) {
794			var $ = jQuery;
795
796			// remove empty tags
797			$(selector, container).each(function () {
798				if ($('img, iframe, video, audio', this).length > 0) return;
799
800				if ($.trim($(this).text()) == '') {
801					$(this).remove();
802				}
803			});
804		},
805		fixHeroField: function (container, link) {
806			var $ = jQuery;
807
808			// skip if irrelevant
809			if (container.length == 0) return;
810			if (container.hasClass('js-hero-dom-processed')) return;
811
812			// remove empty a tags
813			calacademy.Utils.removeEmptyElements('a', this);
814
815			var img = $('img', container).eq(0);
816			var caption = $('blockquote', container).eq(0);
817
818			if (img.length == 0) {
819				// no image, remove
820				container.remove();
821			} else {
822				if (link.length == 0) {
823					// no link, just use img
824					container.html(img);
825				} else {
826					// no alt then derive from hero title anchor label
827					if (!img.attr('alt')) {
828						var heroFields = $(container).parent().parent().children();
829						$(heroFields).each(function() {
830							var heroFieldClass = $(this).attr('class');
831							if (heroFieldClass.indexOf('field-title') > -1) {
832								$(this).find('a').each(function () {
833									img.attr('alt', 'image: ' + this.text);
834								})
835							}
836						})
837					}
838					// add link
839					var newA = $('<a />');
840					newA.attr('href', link.attr('href'));
841
842					// add video class to link if necessary
843					if ($('.video', container).length == 1) {
844						newA.addClass('video');
845					}
846
847					newA.html(img);
848					container.html(newA);
849				}
850
851				// add caption
852				if (caption.length == 1) {
853					if ($.trim(caption.text()) != '') {
854						container.append(caption);
855					}
856				}
857
858				container.addClass('js-hero-dom-processed');
859			}
860		},
861		addImageLoadEvent: function (container, pseudoSingletonClass) {
862			var $ = jQuery;
863
864			if (typeof(pseudoSingletonClass) == 'undefined') {
865				pseudoSingletonClass = 'js-load-processed';
866			}
867
868			// load events don't bubble, so they can't be delegated
869			$('img', container).one('load', function () {
870				var inst = $(this);
871
872				// skip if already processed
873				if (inst.hasClass(pseudoSingletonClass)) return;
874
875				var delay = calacademy.Utils.randomRange(300, 600);
876
877				// shorten delay for exposed filters
878				if (inst.parents('.exposed-filters').length > 0) {
879					delay = calacademy.Utils.randomRange(0, 300);
880				}
881
882				setTimeout(function () {
883					inst.addClass('loaded');
884				}, delay);
885
886				inst.addClass(pseudoSingletonClass);
887			});
888
889			$('img', container).each(function () {
890				if (this.complete) {
891					$(this).trigger('load');
892				}
893			});
894		},
895		alterLinkTargets: function (container) {
896			if (typeof(container) != 'object') {
897				container = jQuery('body');
898			}
899
900			// remove target by default
901			jQuery('a:not(.keep-target)', container).removeAttr('target');
902
903			// offsite links and pdfs get target _blank
904			var offsiteLinks = jQuery('a[href*="//"]:not([href*="calacademy.org"]), a[href*="//store.calacademy.org"], a[href$=".pdf"], a[href*="google.com"], a.offsite', container);
905
906			offsiteLinks.addClass('offsite');
907			offsiteLinks.prop('target', '_blank');
908			offsiteLinks.prop('rel', 'noreferrer');
909		},
910		addSecondaryBg: function (myClass, anchor) {
911			var rail = jQuery('.right-rail');
912
913			// do nothing
914			if (rail.length == 0) return;
915
916			// apply secondary bg
917			jQuery('body').addClass(myClass);
918
919			jQuery(window).on('resize.' + myClass, function () {
920				var x = Math.round(jQuery('#page').outerWidth() / 2) - 100;
921
922				var y;
923
924				if (anchor.length != 1) {
925					y = rail.offset().top;
926				} else {
927					y = anchor.offset().top + anchor.outerHeight();
928				}
929
930				y -= jQuery('#page').offset().top;
931				y -= 200;
932
933				if (jQuery('html').hasClass('tablet')) {
934					x -= 75;
935				}
936
937				// @note
938				// background-position-x and background-position-y don't work in FF
939				jQuery('#page').css('background-position', x + 'px ' + y + 'px');
940			});
941
942			jQuery(window).trigger('resize.' + myClass);
943		},
944		isEmail: function (value) {
945			var isValid = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value );
946
947			if (!isValid) return false;
948
949			// check if dotless
950			// @see https://www.icann.org/news/announcement-2013-08-30-en
951			var arr = value.split('@');
952			return (arr[1].indexOf('.') !== -1);
953		},
954		isMobile: {
955	        Android: function () {
956	            return navigator.userAgent.match(/Android/i) ? true : false;
957	        },
958	        BlackBerry: function () {
959	            return navigator.userAgent.match(/BlackBerry/i) ? true : false;
960	        },
961	        iOS: function () {
962	            return navigator.userAgent.match(/iPhone|iPad|iPod/i) ? true : false;
963	        },
964	        Opera: function () {
965	            return navigator.userAgent.match(/Opera Mini/i) ? true : false;
966	        },
967	        Windows: function () {
968	            return navigator.userAgent.match(/IEMobile/i) ? true : false;
969	        }
970	    }
971	},
972	Statics: {
973		pageObjects: [],
974		device: false,
975		browser: null
976	},
977};
978
979calacademy.Statics.browser = calacademy.Utils.getBrowserInfo();
980;
981(function(a){a.isScrollToFixed=function(b){return !!a(b).data("ScrollToFixed")};a.ScrollToFixed=function(d,i){var l=this;l.$el=a(d);l.el=d;l.$el.data("ScrollToFixed",l);var c=false;var G=l.$el;var H;var E;var e;var y;var D=0;var q=0;var j=-1;var f=-1;var t=null;var z;var g;function u(){G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed");f=-1;D=G.offset().top;q=G.offset().left;if(l.options.offsets){q+=(G.offset().left-G.position().left)}if(j==-1){j=q}H=G.css("position");c=true;if(l.options.bottom!=-1){G.trigger("preFixed.ScrollToFixed");w();G.trigger("fixed.ScrollToFixed")}}function n(){var I=l.options.limit;if(!I){return 0}if(typeof(I)==="function"){return I.apply(G)}return I}function p(){return H==="fixed"}function x(){return H==="absolute"}function h(){return !(p()||x())}function w(){if(!p()){t.css({display:G.css("display"),width:G.outerWidth(true),height:G.outerHeight(true),"float":G.css("float")});cssOptions={"z-index":l.options.zIndex,position:"fixed",top:l.options.bottom==-1?s():"",bottom:l.options.bottom==-1?"":l.options.bottom,"margin-left":"0px"};if(!l.options.dontSetWidth){cssOptions.width=G.width()}G.css(cssOptions);G.addClass(l.options.baseClassName);if(l.options.className){G.addClass(l.options.className)}H="fixed"}}function b(){var J=n();var I=q;if(l.options.removeOffsets){I="";J=J-D}cssOptions={position:"absolute",top:J,left:I,"margin-left":"0px",bottom:""};if(!l.options.dontSetWidth){cssOptions.width=G.width()}G.css(cssOptions);H="absolute"}
981function k(){if(!h()){f=-1;t.css("display","none");G.css({"z-index":y,width:"",position:E,left:"",top:e,"margin-left":""});G.removeClass("scroll-to-fixed-fixed");if(l.options.className){G.removeClass(l.options.className)}H=null}}function v(I){if(I!=f){G.css("left",q-I);f=I}}function s(){var I=l.options.marginTop;if(!I){return 0}if(typeof(I)==="function"){return I.apply(G)}return I}function A(){if(!a.isScrollToFixed(G)){return}var K=c;if(!c){u()}else{if(h()){D=G.offset().top;q=G.offset().left}}var I=a(window).scrollLeft();var L=a(window).scrollTop();var J=n();if(l.options.minWidth&&a(window).width()<l.options.minWidth){if(!h()||!K){o();G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed")}}else{if(l.options.maxWidth&&a(window).width()>l.options.maxWidth){if(!h()||!K){o();G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed")}}else{if(l.options.bottom==-1){if(J>0&&L>=J-s()){if(!x()||!K){o();G.trigger("preAbsolute.ScrollToFixed");b();G.trigger("unfixed.ScrollToFixed")}}else{if(L>=D-s()){if(!p()||!K){o();G.trigger("preFixed.ScrollToFixed");w();f=-1;G.trigger("fixed.ScrollToFixed")}v(I)}else{if(!h()||!K){o();G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed")}}}}else{if(J>0){if(L+a(window).height()-G.outerHeight(true)>=J-(s()||-m())){if(p()){o();G.trigger("preUnfixed.ScrollToFixed");if(E==="absolute"){b()}else{k()}G.trigger("unfixed.ScrollToFixed")}}else{if(!p()){o();G.trigger("preFixed.ScrollToFixed");w()}v(I);G.trigger("fixed.ScrollToFixed")}}else{v(I)}}}}}function m(){if(!l.options.bottom){return 0}return l.options.bottom}function o(){var I=G.css("position");if(I=="absolute"){G.trigger("postAbsolute.ScrollToFixed")}else{if(I=="fixed"){G.trigger("postFixed.ScrollToFixed")}else{G.trigger("postUnfixed.ScrollToFixed")}}}var C=function(I){if(G.is(":visible")){c=false;A()}};var F=function(I){(!!window.requestAnimationFrame)?requestAnimationFrame(A):A()};var B=function(){var J=document.body;if(document.createElement&&J&&J.appendChild&&J.removeChild){var L=document.createElement("div");if(!L.getBoundingClientRect){return null}L.innerHTML="x";L.style.cssText="position:fixed;top:100px;";J.appendChild(L);var M=J.style.height,N=J.scrollTop;J.style.height="3000px";J.scrollTop=500;var I=L.getBoundingClientRect().top;J.style.height=M;var K=(I===100);J.removeChild(L);J.scrollTop=N;return K}return null};var r=function(I){I=I||window.event;if(I.preventDefault){I.preventDefault()}I.returnValue=false};l.init=function(){l.options=a.extend({},a.ScrollToFixed.defaultOptions,i);y=G.css("z-index");l.$el.css("z-index",l.options.zIndex);t=a("<div />");H=G.css("position");E=G.css("position");e=G.css("top");if(h()){l.$el.after(t)}a(window).bind("resize.ScrollToFixed",C);a(window).bind("scroll.ScrollToFixed",F);if("ontouchmove" in window){a(window).bind("touchmove.ScrollToFixed",A)}if(l.options.preFixed){G.bind("preFixed.ScrollToFixed",l.options.preFixed)}if(l.options.postFixed){G.bind("postFixed.ScrollToFixed",l.options.postFixed)}if(l.options.preUnfixed){G.bind("preUnfixed.ScrollToFixed",l.options.preUnfixed)}if(l.options.postUnfixed){G.bind("postUnfixed.ScrollToFixed",l.options.postUnfixed)}if(l.options.preAbsolute){G.bind("preAbsolute.ScrollToFixed",l.options.preAbsolute)}if(l.options.postAbsolute){G.bind("postAbsolute.ScrollToFixed",l.options.postAbsolute)}if(l.options.fixed){G.bind("fixed.ScrollToFixed",l.options.fixed)}if(l.options.unfixed){G.bind("unfixed.ScrollToFixed",l.options.unfixed)}if(l.options.spacerClass){t.addClass(l.options.spacerClass)}G.bind("resize.ScrollToFixed",function(){t.height(G.height())});G.bind("scroll.ScrollToFixed",function(){G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed");A()});G.bind("detach.ScrollToFixed",function(I){r(I);G.trigger("preUnfixed.ScrollToFixed");k();G.trigger("unfixed.ScrollToFixed");a(window).unbind("resize.ScrollToFixed",C);a(window).unbind("scroll.ScrollToFixed",F);G.unbind(".ScrollToFixed");t.remove();l.$el.removeData("ScrollToFixed")});C()};l.init()};a.ScrollToFixed.defaultOptions={marginTop:0,limit:0,bottom:-1,zIndex:1000,baseClassName:"scroll-to-fixed-fixed"};a.fn.scrollToFixed=function(b){return this.each(function(){(new a.ScrollToFixed(this,b))})}})(jQuery);;
982/* MediaMatch v.2.0.2 - Testing css media queries in Javascript. Authors & copyright (c) 2013: WebLinc, David Knight. */
983
984window.matchMedia||(window.matchMedia=function(c){var a=c.document,w=a.documentElement,l=[],t=0,x="",h={},G=/\s*(only|not)?\s*(screen|print|[a-z\-]+)\s*(and)?\s*/i,H=/^\s*\(\s*(-[a-z]+-)?(min-|max-)?([a-z\-]+)\s*(:?\s*([0-9]+(\.[0-9]+)?|portrait|landscape)(px|em|dppx|dpcm|rem|%|in|cm|mm|ex|pt|pc|\/([0-9]+(\.[0-9]+)?))?)?\s*\)\s*$/,y=0,A=function(b){var z=-1!==b.indexOf(",")&&b.split(",")||[b],e=z.length-1,j=e,g=null,d=null,c="",a=0,l=!1,m="",f="",g=null,d=0,f=null,k="",p="",q="",n="",r="",k=!1;if(""===
985b)return!0;do{g=z[j-e];l=!1;if(d=g.match(G))c=d[0],a=d.index;if(!d||-1===g.substring(0,a).indexOf("(")&&(a||!d[3]&&c!==d.input))k=!1;else{f=g;l="not"===d[1];a||(m=d[2],f=g.substring(c.length));k=m===x||"all"===m||""===m;g=-1!==f.indexOf(" and ")&&f.split(" and ")||[f];d=g.length-1;if(k&&0<=d&&""!==f){do{f=g[d].match(H);if(!f||!h[f[3]]){k=!1;break}k=f[2];n=p=f[5];q=f[7];r=h[f[3]];q&&(n="px"===q?Number(p):"em"===q||"rem"===q?16*p:f[8]?(p/f[8]).toFixed(2):"dppx"===q?96*p:"dpcm"===q?0.3937*p:Number(p));
986k="min-"===k&&n?r>=n:"max-"===k&&n?r<=n:n?r===n:!!r;if(!k)break}while(d--)}if(k)break}}while(e--);return l?!k:k},B=function(){var b=c.innerWidth||w.clientWidth,a=c.innerHeight||w.clientHeight,e=c.screen.width,j=c.screen.height,g=c.screen.colorDepth,d=c.devicePixelRatio;h.width=b;h.height=a;h["aspect-ratio"]=(b/a).toFixed(2);h["device-width"]=e;h["device-height"]=j;h["device-aspect-ratio"]=(e/j).toFixed(2);h.color=g;h["color-index"]=Math.pow(2,g);h.orientation=a>=b?"portrait":"landscape";h.resolution=
987d&&96*d||c.screen.deviceXDPI||96;h["device-pixel-ratio"]=d||1},C=function(){clearTimeout(y);y=setTimeout(function(){var b=null,a=t-1,e=a,j=!1;if(0<=a){B();do if(b=l[e-a])if((j=A(b.mql.media))&&!b.mql.matches||!j&&b.mql.matches)if(b.mql.matches=j,b.listeners)for(var j=0,g=b.listeners.length;j<g;j++)b.listeners[j]&&b.listeners[j].call(c,b.mql);while(a--)}},10)},D=a.getElementsByTagName("head")[0],a=a.createElement("style"),E=null,u="screen print speech projection handheld tv braille embossed tty".split(" "),
988m=0,I=u.length,s="#mediamatchjs { position: relative; z-index: 0; }",v="",F=c.addEventListener||(v="on")&&c.attachEvent;a.type="text/css";a.id="mediamatchjs";D.appendChild(a);for(E=c.getComputedStyle&&c.getComputedStyle(a)||a.currentStyle;m<I;m++)s+="@media "+u[m]+" { #mediamatchjs { position: relative; z-index: "+m+" } }";a.styleSheet?a.styleSheet.cssText=s:a.textContent=s;x=u[1*E.zIndex||0];D.removeChild(a);B();F(v+"resize",C);F(v+"orientationchange",C);return function(a){var c=t,e={matches:!1,
989media:a,addListener:function(a){l[c].listeners||(l[c].listeners=[]);a&&l[c].listeners.push(a)},removeListener:function(a){var b=l[c],d=0,e=0;if(b)for(e=b.listeners.length;d<e;d++)b.listeners[d]===a&&b.listeners.splice(d,1)}};if(""===a)return e.matches=!0,e;e.matches=A(a);t=l.push({mql:e,listeners:null});return e}}(window));;
990/*!
991 * enquire.js v2.1.0 - Awesome Media Queries in JavaScript
992 * Copyright (c) 2013 Nick Williams - http://wicky.nillia.ms/enquire.js
993 * License: MIT (http://www.opensource.org/licenses/mit-license.php)
994 */
995
996(function(t,i,n){var e=i.matchMedia;"undefined"!=typeof module&&module.exports?module.exports=n(e):"function"==typeof define&&define.amd?define(function(){return i[t]=n(e)}):i[t]=n(e)})("enquire",this,function(t){"use strict";function i(t,i){var n,e=0,s=t.length;for(e;s>e&&(n=i(t[e],e),n!==!1);e++);}function n(t){return"[object Array]"===Object.prototype.toString.apply(t)}function e(t){return"function"==typeof t}function s(t){this.options=t,!t.deferSetup&&this.setup()}function o(i,n){this.query=i,this.isUnconditional=n,this.handlers=[],this.mql=t(i);var e=this;this.listener=function(t){e.mql=t,e.assess()},this.mql.addListener(this.listener)}
996function r(){if(!t)throw Error("matchMedia not present, legacy browsers require a polyfill");this.queries={},this.browserIsIncapable=!t("only all").matches}return s.prototype={setup:function(){this.options.setup&&this.options.setup(),this.initialised=!0},on:function(){!this.initialised&&this.setup(),this.options.match&&this.options.match()},off:function(){this.options.unmatch&&this.options.unmatch()},destroy:function(){this.options.destroy?this.options.destroy():this.off()},equals:function(t){return this.options===t||this.options.match===t}},o.prototype={addHandler:function(t){var i=new s(t);this.handlers.push(i),this.matches()&&i.on()},removeHandler:function(t){var n=this.handlers;i(n,function(i,e){return i.equals(t)?(i.destroy(),!n.splice(e,1)):void 0})},matches:function(){return this.mql.matches||this.isUnconditional},clear:function(){i(this.handlers,function(t){t.destroy()}),this.mql.removeListener(this.listener),this.handlers.length=0},assess:function(){var t=this.matches()?"on":"off";i(this.handlers,function(i){i[t]()})}},r.prototype={register:function(t,s,r){var h=this.queries,u=r&&this.browserIsIncapable;return h[t]||(h[t]=new o(t,u)),e(s)&&(s={match:s}),n(s)||(s=[s]),i(s,function(i){h[t].addHandler(i)}),this},unregister:function(t,i){var n=this.queries[t];return n&&(i?n.removeHandler(i):(n.clear(),delete this.queries[t])),this}},new r});
997;
998jQuery.fn.popupwindow = function(p)
999{
1000
1001	var profiles = p || {};
1002
1003	return this.each(function(index){
1004		var settings, parameters, mysettings, b, a, winObj;
1005		
1006		// for overrideing the default settings
1007		mysettings = (jQuery(this).attr("rel") || "").split(",");
1008
1009		
1010		settings = {
1011			height:600, // sets the height in pixels of the window.
1012			width:600, // sets the width in pixels of the window.
1013			toolbar:0, // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
1014			scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
1015			status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
1016			resizable:1, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
1017			left:0, // left position when the window appears.
1018			top:0, // top position when the window appears.
1019			center:0, // should we center the window? {1 (YES) or 0 (NO)}. overrides top and left
1020			createnew:1, // should we create a new window for each occurance {1 (YES) or 0 (NO)}.
1021			location:0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
1022			menubar:0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
1023			onUnload:null // function to call when the window is closed
1024		};
1025
1026		// if mysettings length is 1 and not a value pair then assume it is a profile declaration
1027		// and see if the profile settings exists
1028
1029		if(mysettings.length == 1 && mysettings[0].split(":").length == 1)
1030		{
1031			a = mysettings[0];
1032			// see if a profile has been defined
1033			if(typeof profiles[a] != "undefined")
1034			{
1035				settings = jQuery.extend(settings, profiles[a]);
1036			}
1037		}
1038		else
1039		{
1040			// overrides the settings with parameter passed in using the rel tag.
1041			for(var i=0; i < mysettings.length; i++)
1042			{
1043				b = mysettings[i].split(":");
1044				if(typeof settings[b[0]] != "undefined" && b.length == 2)
1045				{
1046					settings[b[0]] = b[1];
1047				}
1048			}
1049		}
1050
1051		// center the window
1052		if (settings.center == 1)
1053		{
1054			settings.top = (screen.height-(settings.height + 110))/2;
1055			settings.left = (screen.width-settings.width)/2;
1056		}
1057		
1058		parameters = "location=" + settings.location + ",menubar=" + settings.menubar + ",height=" + settings.height + ",width=" + settings.width + ",toolbar=" + settings.toolbar + ",scrollbars=" + settings.scrollbars  + ",status=" + settings.status + ",resizable=" + settings.resizable + ",left=" + settings.left  + ",screenX=" + settings.left + ",top=" + settings.top  + ",screenY=" + settings.top;
1059		
1060		jQuery(this).bind("click", function(){
1061			var name = settings.createnew ? "PopUpWindow" + index : "PopUpWindow";
1062			winObj = window.open(this.href, name, parameters);
1063			
1064			if (settings.onUnload) {
1065				// Incremental check for window status
1066				// Attaching directly to window.onunlaod event causes invoke when document within window is reloaded
1067				// (i.e. an inner refresh)
1068				unloadInterval = setInterval(function() {
1069					if (!winObj || winObj.closed) {
1070						clearInterval(unloadInterval);	
1071						settings.onUnload.call($(this));
1072					}
1073				},500);
1074			}
1075			
1076			winObj.focus();
1077			
1078			return false;
1079		});
1080	});
1081
1082};;
1083(function ($) {
1084 
1085    $.webFontListener = function (callbacks) {
1086		// config
1087		var defaults = {
1088			timeout: 8000,
1089            onFontLoad: function () {},
1090            onFontLoadError: function () {}          
1091        };
1092
1093        callbacks = $.extend({}, defaults, callbacks);
1094
1095        // private
1096        var _testElement = $('<span />');
1097        var _testElementText = 'QW@HhsXJ';
1098        var _initialWidth;
1099        var _pollInterval;
1100        var _pollDuration = 50;
1101        var _startTime;
1102        var _instance = this;
1103
1104		var _checkFont = function () {
1105			var currentTime = (new Date()).getTime();
1106			
1107			if ((currentTime - _startTime) >= defaults.timeout) {
1108				// timeout failure
1109				_instance.destroy();
1110
1111				if ($.isFunction(callbacks.onFontLoadError)) {
1112					callbacks.onFontLoadError.call(_instance);	
1113				}
1114
1115				return;
1116			}
1117
1118			var w = _testElement.width();
1119
1120			// nothing has changed or we have a bogus measurement
1121			if (isNaN(w) || w <= 0) return;
1122			if (w == _initialWidth) return;
1123
1124			// success
1125			_instance.destroy();
1126			
1127			if ($.isFunction(callbacks.onFontLoad)) {
1128				callbacks.onFontLoad.call(_instance);	
1129			}
1130		}
1131
1132		// public
1133		this.destroy = function () {
1134			clearInterval(_pollInterval);
1135			_testElement.remove();	
1136		}
1137
1138	    this.initialize = function () {
1139		    // init test element
1140			_testElement.html(_testElementText);
1141			_testElement.addClass('font-load-test');
1142			_testElement.addClass('monospace');
1143			
1144			// add it to the DOM and measure
1145			$('body').append(_testElement);
1146			_initialWidth = _testElement.width();
1147			
1148			// remove ref font
1149			_testElement.removeClass('monospace');
1150
1151			// start polling for custom font
1152			_startTime = (new Date()).getTime();
1153			
1154			clearInterval(_pollInterval);
1155	        _pollInterval = setInterval(_checkFont, _pollDuration);
1156			_checkFont();
1157
1158	        return this;
1159	    };
1160
1161    	return this.initialize();
1162	};
1163 
1164}(jQuery));
1165;
1166var HackDOM = function () {
1167	var $ = jQuery;
1168	var _gcseInterval;
1169	var _imageFieldSelector = '.views-field-field-hero-region, .views-field-field-image-primary, .views-field-field-slideshow-frame-bg-image, .views-field-field-image-primary-large';
1170
1171	var _removeCruft = function () {
1172		// remove bogus styles
1173		$('p, p *').attr('style', '');
1174
1175		// some more aggressive stuff for blogs
1176		//$('.node-type-blog .panel-col-first *').attr('style', ''); // too aggressive - botching hero slideshows
1177		$('.node-type-blog .field-name-body *').attr('style', '');
1178		$('.node-type-blog .panel-col-first img').parent('a, div').addClass('img-container');
1179
1180		$('p > img, .img-container', '.node-type-blog .panel-col-first').each(function () {
1181			if ($(this).parent('p').length == 1) {
1182				if ($(this).prop('tagName') == 'IMG') {
1183					$(this).parent('p').before('<div class="img-container"><img src="'+ $(this).attr('src') +'" /></div>');
1184					$(this).remove();
1185				} else {
1186					$(this).parent('p').before($(this));
1187				}
1188			}
1189		});
1190
1191		// remove empty p tags
1192		$('p').each(function () {
1193			if ($.trim($(this).text()) == '' && $('img, iframe', this).length == 0) {
1194				$(this).remove();
1195			}
1196		});
1197
1198		$('.node-type-blog .panel-col-first p').after('<div class="clear-floats">&nbsp;</div>');
1199
1200		// hide panels that are just 0
1201		$('.panel-pane').each(function () {
1202			if ($('img, iframe, #live-stream-container', this).length > 0) {
1203				return;
1204			}
1205
1206			var content = $.trim($(this).text());
1207
1208			if (content == '0' || content == '1') {
1209				$(this).remove();
1210			}
1211		});
1212
1213		// add a class to non-empty article section fields
1214		$('.view-display-id-panel_pane_blog_article_section .view-content > div').each(function () {
1215			$(this).find('> div').each(function () {
1216				if ($(this).find('img, p, iframe, li, h1, h2').length > 0) {
1217					$(this).addClass('article-section-field-with-content');
1218				}
1219			});
1220
1221			$(this).find('.article-section-field-with-content').last().addClass('last');
1222		});
1223		
1224		// remove empty CTA button panels
1225		$('.pane-node-field-cta-buttons').each(function () {
1226			if ($(this).find('.content *').length == 0) {
1227				$(this).remove();
1228			}
1229		});
1230	}
1231
1232	var _getViewsFieldClass = function (classList) {
1233		var prefix = 'field-name';
1234		var myClass;
1235
1236		$.each(classList, function (index, item) {
1237			if (item.indexOf(prefix) === 0) {
1238				myClass = item.replace(prefix, 'views-field');
1239			}
1240		});
1241
1242		return myClass;
1243	}
1244
1245	var _addViewsFieldClasses = function (el) {
1246		$('.field', el).each(function () {
1247			var classList = $(this).attr('class').split(/\s+/);
1248
1249			$(this).addClass(_getViewsFieldClass(classList));
1250			$(this).addClass('views-field');
1251		});
1252	}
1253
1254	var _getPseudoRows = function (obj, startIndex, myMax, myImgSelector) {
1255		var i = (typeof(startIndex) == 'undefined') ? 0 : startIndex;
1256		var max = (typeof(myMax) == 'undefined') ? 0 : myMax;
1257		var imgSelector = (typeof(myImgSelector) == 'undefined') ? _imageFieldSelector : myImgSelector;
1258		var rows = [];
1259
1260		obj.each(function () {
1261			i++;
1262			if (max > 0 && i > max) return;
1263
1264			// add some additional classes to each field
1265			_addViewsFieldClasses($(this));
1266
1267			// derive title from header
1268			if ($('header', this).length == 1) {
1269				var title = $('<div />');
1270				title.addClass('views-field');
1271				title.addClass('views-field-title');
1272				title.html($('header .node-title', this).html());
1273
1274				var img = $(imgSelector, this);
1275
1276				if (img.length == 0) {
1277					// prepend
1278					$(this).prepend(title);
1279				} else {
1280					// put the title after the primary image
1281					img.after(title);
1282				}
1283
1284				// ok, now remove the header
1285				$('header', this).remove();
1286			}
1287
1288			// all set, now create a phony view row
1289			var row = $('<div />');
1290			row.addClass('views-row');
1291			row.addClass('views-row-' + i);
1292
1293			// clone the content
1294			row.html($(this).html());
1295			rows.push(row);
1296		});
1297
1298		return rows;
1299	}
1300
1301	var _convertNLGalleryToPseudoRows = function () {
1302		_addViewsFieldClasses($('.view-display-id-past_nl_gallery'));
1303		$('.view-display-id-past_nl_gallery .views-field-field-links').addClass('views-field-title');
1304
1305		// switch href on img link
1306		$('.view-display-id-past_nl_gallery .views-row').each(function () {
1307			var img = $('img', this);
1308
1309			if (img.length == 1) {
1310				var a = $('.views-field-title a', this);
1311
1312				if (a.length == 1) {
1313					var parentA = img.parents('a').first();
1314					parentA.attr('href', a.attr('href'));
1315				}
1316			}
1317		});
1318	}
1319
1320	var _alterNightLife = function () {
1321		// NightLife Landing (gallery)
1322		_convertNLGalleryToPseudoRows();
1323
1324		// NightLife Landing (tri grid / people)
1325		var peeps = $('.page-nightlife-landing .views-field .field-name-field-featured-people > .field-items > .field-item > .node');
1326		var rows = _getPseudoRows(peeps, 1, 3);
1327
1328		// add
1329		$.each(rows, function (index, item) {
1330			peeps.parents('.view-content').first().append(item);
1331		});
1332
1333		// remove
1334		peeps.parents('.views-field').remove();
1335
1336		// lingering scheduled item location cleanup (when peep not set but loc is)
1337		$('.page-nightlife-landing .views-field .field-name-field-location').remove();
1338
1339		// remove non-image fields from hero region
1340		$('.view-nightlife-upcoming .field-name-field-hero-region').each(function () {
1341			calacademy.Utils.fixHeroField($(this), $('.views-field-title a', $(this).parent()));
1342		});
1343
1344		// NightLife Detail (people / music)
1345		var sec = $('.node-type-event-nightlife #music');
1346		var peeps = $('.field-name-field-featured-people > .field-items > .field-item > .node', sec);
1347		var rows = _getPseudoRows(peeps);
1348
1349		if (!($.isEmptyObject(rows))) {
1350
1351			var view = $('<div class="view"><div class="view-content"></div></div>');
1352			sec.append(view);
1353
1354			var originalView = $('.view', sec).first();
1355
1356			// add
1357			$.each(rows, function (index, item) {
1358				var originalRow = $('.item-list li', originalView).eq(index);
1359
1360				$('.views-field-title', item).before($('.field-name-field-location', originalRow));
1361				$('.views-field-title', item).after($('.field-name-field-time-slots', originalRow));
1362				calacademy.Utils.fixHeroField($('.field-name-field-hero-region', item), $('.views-field-title a', item));
1363
1364				$('.view-content', view).append(item);
1365			});
1366
1367			// remove
1368			originalView.remove();
1369
1370		} else {
1371			sec.remove();
1372		}
1373
1374		// NightLife Detail (events)
1375		var sec = $('.node-type-event-nightlife #events');
1376		var events = $('.field-name-field-article-section .content', sec);
1377		var rows = _getPseudoRows(events);
1378
1379		// remove
1380		$('.field', sec).remove();
1381
1382		var view = $('<div class="view"><div class="view-content"></div></div>');
1383		sec.append(view);
1384
1385		// add
1386		$.each(rows, function (index, item) {
1387			$('.view-content', view).append(item);
1388		});
1389	}
1390
1391	var _removeEmptySlideshows = function () {
1392		var arr = [
1393			'.pane-node-field-hero-region',
1394			'.pane-hero-media-slideshow-large',
1395			'.pane-hero-media-revision-slideshow-large',
1396			'.pane-hero-media-slideshow-standard',
1397			'.pane-hero-media-revision-slideshow-standard',
1398			'.pane-hero-media-standard-hero-image-pane',
1399			'.pane-hero-media-revision-standard-hero-image-pane',
1400			'.pane-hero-media-large-hero-image-pane',
1401			'.pane-hero-media-revision-large-hero-image-pane',
1402			'.pane-slideshows-large-hero-image-pane',
1403			'.pane-slideshows-slideshow-large-bridge-pane',
1404			'.pane-slideshows-standard-hero-image-pane',
1405			'.pane-slideshows-slideshow-standard-bridge-pane'
1406		];
1407
1408		calacademy.Utils.removeEmptyElements(arr.join(', '), $('body'));
1409	}
1410
1411	var _alterESLandingPage = function () {
1412		// remove empty panels
1413		calacademy.Utils.removeEmptyElements('.panel-pane, .panel-panel, .center-wrapper', $('body'));
1414
1415		// remove empty a tags
1416		$('.es-categories a').each(function () {
1417			if ($('img', this).length == 1) return;
1418
1419			if ($.trim($(this).text()) == '') {
1420				$(this).remove();
1421			}
1422		});
1423
1424		// ticket #81150390, temp hide blog category
1425		$('.blog-category-container').parent('.views-row').remove();
1426
1427		// concatenate "blog pseudo" and "selected" category views
1428		var pseudoRows = $('.es-categories > .view > .attachment > .view > .view-content > .views-row');
1429
1430		if (pseudoRows.length > 0) {
1431			pseudoRows.each(function () {
1432				// alter these rows to match the DOM of the other categories
1433				$(this).prepend($('.link-block', this));
1434				$('.views-field-title-1', this).remove();
1435
1436				$('.es-categories > .view > .view-content').append($(this));
1437			});
1438
1439			$('.es-categories > .view > .attachment').remove();
1440		}
1441
1442		var categories = $('.es-categories > .view > .view-content > .views-row');
1443
1444		// do nothing if less than or equal to three
1445		if (categories.length <= 3) return;
1446
1447		// create container
1448		var container = $('<div />');
1449		container.addClass('clone-container');
1450		container.addClass('smartphone-hide');
1451		container.addClass('image-top');
1452		container.addClass('es-categories');
1453
1454		// place container directly after the callout box
1455		$('.body-box > .field').after(container);
1456
1457		// populate container
1458		var i = 1;
1459
1460		categories.each(function () {
1461			if (i > 3) {
1462				if (i % 2 == 0) {
1463					// clone into container
1464					var clone = $(this).clone();
1465					container.append(clone);
1466
1467					$('img', clone).off('load');
1468					calacademy.Utils.addImageLoadEvent(clone, 'js-load-processed-clone');
1469
1470					// original should be hidden on non-smartphones
1471					$(this).addClass('smartphone-only');
1472				}
1473			}
1474
1475			i++;
1476		});
1477	}
1478
1479	var _setBlurbOffset = function () {
1480		// reset
1481		$('.pane-node-field-blurb-description, .pane-node-field-article-section:first').attr('style', '');
1482
1483		var blockquotes = $('.slideshow-hero-large blockquote, .view-hero-media blockquote');
1484		var blurb = $('.pane-node-field-blurb-description');
1485		if (blockquotes.length == 0 || blurb.length != 1) return;
1486
1487		// offset blurb to accommodate image captions
1488		var captionHeight = 0;
1489
1490		if (!$('html').hasClass('smartphone')) {
1491			blockquotes.each(function () {
1492				var h = $(this).outerHeight();
1493
1494				if (h > captionHeight) {
1495					captionHeight = h;
1496				}
1497			});
1498		}
1499
1500		var blurbMargin = parseInt(blurb.css('margin-top'));
1501		blurbMargin -= captionHeight;
1502		blurb.css('margin-top', blurbMargin);
1503
1504		var sideThing = $('.pane-node-field-article-section:first');
1505		var sideThingMargin = parseInt(sideThing.css('margin-top'));
1506		sideThingMargin += captionHeight;
1507		sideThing.css('margin-top', sideThingMargin);
1508	}
1509
1510	var _alterLandingAndExhibitsPage = function () {
1511		$(window).off('load.blurb');
1512		$(window).on('load.blurb', _setBlurbOffset);
1513		$(document).off('breakpoint.blurb');
1514		$(document).on('breakpoint.blurb', _setBlurbOffset);
1515
1516		// alter people article sections to mimic views styles
1517		var sec = $('#people');
1518		var peeps = $('.field-name-field-featured-people > .field-items > .field-item > .node', sec);
1519		var rows = _getPseudoRows(peeps);
1520
1521		// remove
1522		$('.field', sec).remove();
1523
1524		var view = $('<div class="view"><div class="view-content"></div></div>');
1525		sec.append(view);
1526
1527		// add
1528		$.each(rows, function (index, item) {
1529			$('.view-content', view).append(item);
1530		});
1531
1532		// simplify hero region
1533		var link = $('.views-field-title a', sec);
1534		var heroRegion = $('.field-name-field-hero-region', sec);
1535		calacademy.Utils.fixHeroField(heroRegion, link);
1536
1537		// drop some article sections in weird places
1538		// make a clone and put it under the blurb if there's more than two sections
1539		var numArticles = $('.pane-node-field-article-section > .field > .field-items > .field-item').length;
1540
1541		if (numArticles > 2) {
1542			var orig = $('.pane-node-field-article-section');
1543			var clone = orig.clone();
1544
1545			orig.addClass('article-section-orig');
1546			clone.addClass('article-section-clone');
1547			clone.insertAfter(orig);
1548
1549			var origArticleSelector = '.article-section-orig > .field > .field-items > .field-item';
1550			var cloneArticleSelector = '.article-section-clone > .field > .field-items > .field-item';
1551
1552			if (numArticles == 3) {
1553				// remove the first article from the clone
1554				$(cloneArticleSelector).first().remove();
1555
1556				// remove everything but the first from the original
1557				var i = 0;
1558
1559				$(origArticleSelector).each(function () {
1560					if (i > 0) $(this).addClass('cloned');
1561					i++;
1562				});
1563			} else {
1564				// remove the first two articles from the clone
1565				$(cloneArticleSelector).first().remove();
1566				$(cloneArticleSelector).first().remove();
1567
1568				// remove everything but the first two from the original
1569				var i = 0;
1570
1571				$(origArticleSelector).each(function () {
1572					if (i > 1) $(this).addClass('cloned');
1573					i++;
1574				});
1575			}
1576		}
1577
1578		// clone right rail to bottom for smartphone
1579		var smartphoneRightrail = $('.right-rail').clone(true);
1580		smartphoneRightrail.addClass('cloned');
1581		smartphoneRightrail.appendTo('#content');
1582	}
1583
1584	var _cloneMenuGarnish = function () {
1585		var clone = $('.block-menu-garnish').eq(0).clone();
1586		clone.addClass('clone');
1587		clone.addClass('block-views-menu-garnish-block-clone');
1588
1589		$('.tb-megamenu .nav.level-0 > li:first-child').after(clone);
1590
1591		var buyTickets = $('.tb-megamenu .nav.level-0 > li:last-child a').eq(0).clone();
1592		buyTickets.addClass('cta-clone');
1593		$('#main-nav .btn-navbar').after(buyTickets);
1594	}
1595
1596	var _cloneAlerts = function () {
1597		var clone = $('.alerts').clone();
1598		clone.addClass('clone');
1599
1600		// clear some stuff
1601		$('*', clone).off();
1602		$('*', clone).removeClass();
1603		$('li', clone).attr('style', '');
1604
1605		$('.menu-garnish-container').before(clone);
1606	}
1607
1608	var _fixColumnFields = function () {
1609		$('.column-fields').each(function () {
1610			var numColumns = $(this).children('.field').children('.field-items').children('.field-item').length;
1611
1612			if (numColumns < 2) {
1613				$(this).removeClass('column-fields');
1614				$(this).addClass('floated-fields');
1615			}
1616		});
1617	}
1618
1619	var _addFileClasses = function () {
1620		$('.file-icon').each(function () {
1621			var type = $(this).attr('title');
1622			var src = $(this).attr('src');
1623			var link = $(this).next();
1624
1625			link.addClass(type);
1626			link.css('background-image', 'url("'+ src +'")');
1627		});
1628	}
1629
1630	var _alterMegaMenuFeaturedItems = function () {
1631		$('.tb-megamenu .featured').each(function () {
1632			var featured = $(this);
1633			var rows = $('.field-name-field-megamenu-featured-item > .field-items > .field-item', this);
1634			var html = '';
1635
1636			featured.empty();
1637
1638			rows.each(function () {
1639				var row = $('<div />');
1640				row.addClass('featured-item');
1641
1642				var title = $('.node-title a', this).addClass('title');
1643				var subtitle = $('.field-name-field-subtitle .field-item', this).addClass('subtitle');
1644
1645				if ($('img', this).length == 1) {
1646					// create container
1647					var imgContainer = $('<div />');
1648					imgContainer.addClass('image-container');
1649
1650					// fix hero field then add to container
1651					calacademy.Utils.fixHeroField($(this), title);
1652					imgContainer.html($(this).html());
1653
1654					// add container to row
1655					row.append(imgContainer);
1656				}
1657
1658				row.append(subtitle);
1659
1660				title.html('<span>' + title.text() + '</span>');
1661				row.append(title);
1662
1663				featured.prepend(row);
1664			});
1665		});
1666	}
1667
1668	var _alterClusters = function () {
1669		// add non-image fields to a seperate container so they can be styled properly
1670		$('.tri-large > .view > .view-content > .views-row').each(function () {
1671			// create container
1672			var container = $('<div />');
1673			container.addClass('field-container');
1674
1675			// add non-image fields to container
1676			var fields = $(this).children().not(_imageFieldSelector);
1677			container.html(fields);
1678
1679			$(this).append(container);
1680		});
1681	}
1682
1683	var _alterScienceTodayLanding = function () {
1684		// add sci today logo image inset element to top story image
1685		var logoSciToday = $('<div />');
1686		logoSciToday.addClass('science-today-logo-inset');
1687		$('.view-es-science-today-featured-articles > .view-content > .views-row-first > .views-field-field-hero-region > .field-content').append(logoSciToday);
1688
1689		// hide hero region on cant miss items that are not first item
1690		var countCantMiss = 0;
1691		$('.view-display-id-panel_pane_st_cant_miss > .view-content > .views-row').each(function () {
1692			if (countCantMiss != 0) {
1693				$(this).children('.views-field-field-hero-region').hide();
1694			}
1695			countCantMiss++;
1696		});
1697
1698		$('.view-display-id-panel_pane_st_cant_miss > .view-content > .views-row:nth-child(1)').addClass('cant-miss-right-column');
1699		$('.view-display-id-panel_pane_st_cant_miss > .view-content > .views-row:nth-child(2)').addClass('cant-miss-left-column');
1700		$('.view-display-id-panel_pane_st_cant_miss > .view-content > .views-row:nth-child(3)').addClass('cant-miss-left-column');
1701		$('.view-display-id-panel_pane_st_cant_miss > .view-content > .views-row:nth-child(4)').addClass('cant-miss-right-column');
1702		$('.view-display-id-panel_pane_st_cant_miss > .view-content > .views-row:nth-child(5)').addClass('cant-miss-right-column');
1703		$('.view-display-id-panel_pane_st_cant_miss > .view-content > .views-row:nth-child(6)').addClass('cant-miss-left-column');
1704
1705		$('.pane-astronomical-events-panel-pane-1').addClass('cant-miss-left-column');
1706
1707		$('.cant-miss-left-column').wrapAll('<div class="cant-miss-container-left" />');
1708		$('.cant-miss-right-column').wrapAll('<div class="cant-miss-container-right" />');
1709
1710		// replace link on cant miss hero - custom req. - std hero img fix not working here
1711		var titleLinkHref = $('.cant-miss-container-right > .views-row:nth-child(1) > .views-field-title > .field-content > a').attr('href');
1712		$('.cant-miss-container-right > .views-row:nth-child(1) > .views-field-field-hero-region > .field-content > a').attr('href', titleLinkHref);
1713
1714		// add astro-event non-image fields to a seperate container so they can be styled properly
1715		$('.pane-astronomical-events-panel-pane-1 > .view > .view-content > .views-row').each(function () {
1716			// create container
1717			var container = $('<div />');
1718			container.addClass('field-container');
1719			// add non-image fields to container
1720			var fields = $(this).children().not(_imageFieldSelector);
1721			container.html(fields);
1722			$(this).append(container);
1723		});
1724
1725		// add creature of the week non-image fields to a seperate container so they can be styled properly
1726		$('.pane-es-science-today-featured-articles-panel-pane-creature-week > .pane-title').insertBefore('.pane-es-science-today-featured-articles-panel-pane-creature-week > .view > .view-content > .views-row > .views-field-title');
1727		$('.pane-es-science-today-featured-articles-panel-pane-creature-week > .view > .view-content > .views-row').each(function () {
1728			// create container
1729			var container = $('<div />');
1730			container.addClass('creature-field-container');
1731			// add non-image fields to container
1732			var fields = $(this).children().not(_imageFieldSelector);
1733			container.html(fields);
1734			$(this).append(container);
1735		});
1736
1737		// add link to cant miss hero
1738		var sec = $('.pane-es-science-today-featured-articles-panel-pane-creature-week > .view > .view-content > .views-row');
1739		var link = $('.creature-field-container > .views-field-title > span > a', sec);
1740		var heroRegion = $('.views-field-field-hero-region', sec);
1741		calacademy.Utils.fixHeroField(heroRegion, link);
1742
1743		// browse by topic
1744		$('.es-categories > .view-category-listings > .view-content > .views-row').each(function () {
1745			var catLinkName = $(this).children('.views-field-name').children('span').children('a').text();
1746			var catLinkBlock = $('<a />');
1747			catLinkBlock.attr('href', $(this).children('.views-field-name').children('span').children('a').attr('href'));
1748			catLinkBlock.addClass('link-block');
1749			catLinkBlock.append('<span>' + catLinkName + '</span>');
1750			$(this).append(catLinkBlock);
1751			$(this).children('.views-field-name').css('display', 'none');
1752		});
1753
1754	}
1755
1756	var _alterSlideshowCaptions = function () {
1757		$('.slideshow-hero-large .flex-caption > div').each(function () {
1758			if ($.trim($('.field_slideshow_frame_title', this).text()) == ''
1759				&& $.trim($('.field_link', this).text()) == '') {
1760				// remove if no text
1761				$(this).parent().remove();
1762			} else {
1763				// add some style classes
1764				if ($.trim($('.field_slideshow_large_text_displ', this).text().toLowerCase()).indexOf('large') == 0) {
1765					$(this).addClass('large');
1766				} else {
1767					$(this).addClass('medium');
1768				}
1769			}
1770		});
1771	}
1772
1773	var _alterPriceTable = function () {
1774		// add a CSS class for best deal
1775		$('.field-name-field-best-deal .field-item').each(function () {
1776			if (parseInt($(this).text())) {
1777				// apply a class to its parent
1778				var parentSquare = $(this).parents('.field-item').eq(0);
1779				parentSquare.addClass('best-deal');
1780			}
1781		});
1782
1783		// fix the wonky entity references
1784		var v = $('<div />');
1785		v.addClass('view');
1786		v.append($('.pane-node-field-entities.image-top-four-columns .field-name-field-subtitle h2'));
1787
1788		var rows = _getPseudoRows($('.pane-node-field-entities.image-top-four-columns .node'));
1789
1790		$.each(rows, function (index, item) {
1791			// remove hero type label
1792			$('.field-name-field-hero-type', item).remove();
1793
1794			// simplify hero
1795			var hasVideo = $('.view-simulator-hero-img > .video', item).length == 1;
1796			var img = $('.view-simulator-hero-img img', item);
1797			$('.view-simulator-hero-img', item).html(img);
1798
1799			var myDiv = $('<div class="field-content" />');
1800			img.wrap(myDiv);
1801
1802			// wrap image in link
1803			var clone = $('.views-field-title a', item).clone();
1804			if (hasVideo) clone.addClass('video');
1805			clone.empty();
1806			$('img', item).wrap(clone);
1807
1808			v.append(item);
1809		});
1810
1811		// replace pane contents with derived content
1812		$('.pane-node-field-entities.image-top-four-columns').html(v);
1813	}
1814
1815	var _alterEntityCollections = function () {
1816		var newContent = $('<div />');
1817
1818		// page body
1819		var b = $('<div />');
1820		b.addClass('page-header');
1821		b.addClass('pane-node-body');
1822
1823		var bodyEl = $('#content > article > .field-name-body');
1824
1825		// missing p tag
1826		if ($('p', bodyEl).length == 0) {
1827			$('.field-item', bodyEl).wrapInner('<p></p>')
1828		}
1829
1830		b.html(bodyEl);
1831		newContent.append(b);
1832
1833		var hasRightRail = ($('.field-name-field-right-rail-items article').length > 0);
1834		var entityContainer = $('<div />');
1835		entityContainer.addClass('entity-container');
1836
1837		if (hasRightRail) {
1838			$('body').addClass('with-right-rail');
1839		}
1840
1841		// "panes"
1842		$('.field-name-field-entities-5-, .field-name-field-entities > .field-items > .field-item').each(function () {
1843			var p = $('<div />');
1844			p.addClass('panel-pane entity-collections-panel-pane');
1845
1846			var isTriGrid = $(this).hasClass('field-name-field-entities-5-');
1847
1848			if (isTriGrid) {
1849				p.addClass('skewed-tri-grid');
1850			} else {
1851				if (hasRightRail) {
1852					p.addClass('image-top-three-columns');
1853				} else {
1854					p.addClass('image-top-four-columns');
1855				}
1856			}
1857
1858			if (hasRightRail && !isTriGrid) {
1859				entityContainer.append(p);
1860			} else {
1861				newContent.append(p);
1862			}
1863
1864			// view header
1865			var t = $('.field-name-field-subtitle h2', this);
1866			t.addClass('pane-title');
1867			p.append(t);
1868
1869			var v = $('<div />');
1870			v.addClass('view');
1871			v.addClass('simulated');
1872			p.append(v);
1873
1874			// rows
1875			var rows = _getPseudoRows($('.field-type-entityreference .node', this), 0, 0, '.view-simulator-hero-img');
1876
1877			$.each(rows, function (index, item) {
1878				// remove hero type label
1879				$('.field-name-field-hero-type', item).remove();
1880
1881				// simplify hero
1882				var hasVideo = $('.view-simulator-hero-img > .video', item).length == 1;
1883				var img = $('.view-simulator-hero-img img', item);
1884				$('.view-simulator-hero-img', item).html(img);
1885
1886				//no alt then derive from hero title anchor label
1887				if (!img.attr('alt')) {
1888					var title = $('.views-field-title > a', item).text();
1889					img.attr('alt', 'image: ' + title);
1890				}
1891
1892				var myDiv = $('<div class="field-content" />');
1893				img.wrap(myDiv);
1894
1895				// wrap image in link
1896				var clone = $('.views-field-title a', item).clone();
1897				if (hasVideo) clone.addClass('video');
1898				clone.empty();
1899				$('img', item).wrap(clone);
1900
1901				v.append(item);
1902			});
1903		});
1904
1905		// add link as a pseudo-row
1906		var linkSelector = '#content > article > .field-name-field-title-link a';
1907
1908		if ($(linkSelector).length == 1) {
1909			var container = $('.entity-collections-panel-pane .view', newContent).first();
1910			var linkContainer = $('<div />');
1911
1912			linkContainer.html($(linkSelector).clone());
1913			$('a', linkContainer).addClass('views-field');
1914			linkContainer.addClass('views-row');
1915			linkContainer.addClass('cta-block');
1916			linkContainer.addClass('views-row-' + ($('.views-row', container).length + 1));
1917
1918			container.append(linkContainer);
1919		}
1920
1921		// right rail
1922		if (hasRightRail) {
1923			var p = $('<div />');
1924			p.addClass('right-rail');
1925
1926			var n = $('<div />');
1927			n.addClass('panel-pane');
1928			n.addClass('pane-node-field-right-rail-items');
1929
1930			p.append(n);
1931
1932			n.html($('.field-name-field-right-rail-items').html());
1933			newContent.append(entityContainer);
1934			newContent.append(p);
1935		}
1936
1937		// replace content with new stuff
1938		$('#content').html(newContent.html());
1939
1940		// add skip link target anchor
1941		$('#content').prepend('<a id="main-content" name="#main-content" tabindex="-1"></a>');
1942	}
1943
1944	var _addLessonPlansSearch = function () {
1945		var form = $('<form class="lesson-plan-search views-exposed-widget" action="/educators/search/" method="get"><label for="search-lesson-plans">Search Lesson Plans</label><input id="search-lesson-plans" class="form-text" name="gq" size="15" type="text" placeholder="Search Lesson Plans" /><div class="submit-container"><input type="submit" class="form-submit" value="Search" /></div></form>');
1946
1947		form.on('submit', function () {
1948			var t = encodeURIComponent($.trim($(this).find('.form-text').val()));
1949			window.location.href = '/educators/search/#t=' + t + '&tids=9762';
1950
1951			return false;
1952		});
1953
1954		$('.exposed-filters .view-lesson-plan-content').before(form);
1955	}
1956
1957	var _addEventDetailTimeslotFormat = function() {
1958		var timeslots = $('#event_detail_timeslots').html();
1959		if(typeof(timeslots) != "undefined" && timeslots !== null) {
1960			var timeslotList = timeslots.split(',');
1961			var timeslotListFormatted = '';
1962			for(i=0; i < timeslotList.length; i++) {
1963				var time = moment(timeslotList[i], ["HH:mm"]).format("h:mm a");
1964				timeslotListFormatted += time;
1965				if (i < timeslotList.length-1) {
1966					timeslotListFormatted += ", ";
1967				}
1968			}
1969			$('#event_detail_timeslots').html(timeslotListFormatted);
1970		}
1971	}
1972
1973	var _alterLogos = function () {
1974		$('.field-name-field-logo-container .entity, .field-name-field-logo-container > .field-items > .field-item').each(function () {
1975			$(this).hide();
1976			var title = false;
1977
1978			if ($('.field-name-field-title', this).length == 1) {
1979				title = $('<h2 class="pane-title">' + $('.field-name-field-title .field-item', this).html() + '</h2>');
1980			}
1981
1982			var view = $('<div />');
1983			view.addClass('view');
1984			view.addClass('view-logos');
1985
1986			$('.field-name-field-logo-details > .field-items > .field-item', this).each(function () {
1987				var row = $('<div />');
1988				row.addClass('views-row');
1989
1990				if ($('img', this).length == 1) {
1991					var img = $('<div />');
1992					img.addClass('views-field');
1993					img.addClass('views-field-field-image-primary');
1994					img.html($('img', this));
1995
1996					row.append(img);
1997				}
1998
1999				if ($('.field-name-field-image-link', this).length == 1) {
2000					var l = $('<div />');
2001					l.addClass('views-field');
2002					l.addClass('views-field-image-link');
2003					l.hide();
2004					l.html($('.field-name-field-image-link .field-item', this).html());
2005
2006					row.append(l);
2007				}
2008
2009				if ($('.field-name-field-description', this).length == 1) {
2010					var d = $('<div />');
2011					d.addClass('views-field');
2012					d.addClass('views-field-description');
2013					d.html($('.field-name-field-description .field-item', this).html());
2014
2015					row.append(d);
2016				}
2017
2018				view.append(row);
2019			});
2020
2021			$(this).parent().parent().append(view);
2022			if (title) view.before(title);
2023		});
2024
2025		$('.pane-node-field-logo-container .field-collection-container > div').unwrap();
2026	}
2027
2028	var _fixMultiTimeslots = function () {
2029		// var now = moment();
2030
2031		$('.view.simulated .field-name-field-date').each(function () {
2032			if ($('.field-item', this).length > 1) {
2033				$(this).addClass('multi');
2034
2035				// this doesn't work for timeslots that span multiple years
2036				/*
2037				$('.field-item', this).each(function () {
2038					var test = moment($(this).text(), 'MMMM D at h:mm a');
2039
2040					if (test.diff(now) > 0) {
2041						$(this).addClass('most-current');
2042						return false;
2043					}
2044				});
2045				*/
2046			}
2047		});
2048
2049		// $('.view.simulated .field-name-field-date .field-item').not('.most-current').remove();
2050	}
2051
2052	// hide "Revisions" tab from node view for auth users
2053	var _hideRevisionsTab = function () {
2054		$('.tabs-primary .tabs-primary__tab a').each(function() {
2055			if ($(this).is(':contains("Revisions")')) {
2056				$(this).css('display', 'none');
2057			}
2058		});
2059	}
2060
2061	// @see
2062	// http://help.calacademy.org/helpdesk/WebObjects/Helpdesk.woa/wa/TicketActions/view?ticket=132443
2063	var _alterEventsArticleSectionSubtitle = function () {
2064		var articleSectionsContent = $('.pane-node-field-article-section > .field');
2065		$('.field-name-field-autoplay', articleSectionsContent).remove();
2066
2067		var content = $.trim(articleSectionsContent.text());
2068
2069		if (content == '') {
2070			// empty article section, remove the subtitle
2071			$('.pane-node-field-article-section > .pane-title').remove();
2072		}
2073	}
2074
2075	var _alterRightRails = function () {
2076		$('.right-rail .field-collection-item-field-contact-collection').each(function () {
2077			if ($('.field-name-field-person-name-first', this).length == 1) {
2078				$(this).addClass('has-name');
2079			}
2080		});
2081
2082		var first = $('.right-rail .node').eq(0);
2083
2084		if (first.children('.field').eq(0).hasClass('field-name-field-inline-image')) {
2085			$('.right-rail').addClass('image-first');
2086		}
2087	}
2088
2089	var _removeCruftyLinks = function () {
2090		$('.views-row .links.inline').remove();
2091	}
2092
2093	var _onSearchResultsChange = function () {
2094		$('.gsc-result').not('.processed').each(function () {
2095			var title = $(this).find('.gs-title').first();
2096			var url = $(this).find('.gsc-url-top');
2097
2098			$(this).find('.gsc-table-cell-snippet-close').prepend(url);
2099			$(this).find('.gsc-table-cell-snippet-close').prepend(title);
2100
2101			$(this).addClass('processed');
2102		});
2103	}
2104
2105	var _alterGoogleSearchResults = function () {
2106		// blocks should be wrapped in #search-results-container
2107		if ($('#search-results-container').length != 1) return;
2108
2109		var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
2110		if (typeof(MutationObserver) !== 'function') return;
2111
2112		var observer = new MutationObserver(_onSearchResultsChange);
2113		var target = $('#search-results-container').get(0);
2114
2115		observer.observe(target, {
2116			attributes: true,
2117			childList: false,
2118			characterData: false,
2119			subtree: true
2120		});
2121	}
2122
2123	var _alterHighlights = function () {
2124		$('.field-name-field-highlight').each(function () {
2125			var link = $(this).find('.field-name-field-legacy-link a');
2126			var img = $(this).find('.field-name-field-inline-image img');
2127
2128			if (link.length == 1 && img.length == 1) {
2129				var clonedLink = link.clone();
2130				clonedLink.text('');
2131
2132				img.wrap(clonedLink);
2133			}
2134		});
2135	}
2136
2137	var _reduceRelatedEvents = function () {
2138		var _getTitle = function (el) {
2139			return $.trim(el.text());
2140		}
2141
2142		var titles = [ _getTitle($('.page-header .pane-node-title')) ];
2143		var i = 0;
2144
2145		$('.view-display-id-upcoming_related .views-row').each(function () {
2146			var title = _getTitle($(this).find('.views-field-title'));
2147
2148			if ($.inArray(title, titles) >= 0) {
2149				$(this).remove();
2150			} else {
2151				titles.push(title);
2152				$(this).addClass('do-not-remove');
2153				i++;
2154			}
2155
2156			if (i == 3) {
2157				return false;
2158			}
2159		});
2160
2161		$('.view-display-id-upcoming_related .views-row').not('.do-not-remove').remove();
2162
2163		if ($('.view-display-id-upcoming_related .views-row').length == 0) {
2164			$('.pane-event-list-upcoming-related').remove();
2165		}
2166	}
2167
2168	var _alterGifSrc = function () {
2169		var cropStyles = [
2170			'styles/manual_crop_square_460px/public/',
2171			'styles/manual_crop_standard_960x540/public/',
2172			'styles/manual_crop_large_1920x970/public/',
2173			'styles/automatic_landscape_940x460/public/'
2174		];
2175
2176		$(_imageFieldSelector + ', .views-field-field-inline-image').find('img').each(function () {
2177			var src = $(this).attr('src');
2178
2179			if (calacademy.Utils.getFileExtension(src) == 'gif') {
2180				$(this).addClass('image-src-replaced');
2181
2182				// square gif
2183				var gifSrc = calacademy.Constants.emptyGif;
2184
2185				if ($(this).attr('height') != $(this).attr('width')) {
2186					// landscape gif
2187					$(this).addClass('image-src-replaced-landscape');
2188					gifSrc = calacademy.Constants.emptyGifLandscape;
2189				}
2190
2191				$(this).attr('src', gifSrc);
2192
2193				// background url
2194				$.each(cropStyles, function (i, j) {
2195					src = src.replace(j, '');
2196				});
2197
2198				$(this).css('background-image', 'url(' + src + ')');
2199			}
2200		});
2201	}
2202
2203	var _a11yYoutubeFieldPlayerIframe = function () {
2204		$('iframe.youtube-field-player').each(function () {
2205			var title = $(this).attr('title');
2206			if (typeof title == 'undefined' || title == false) {
2207				$(this).attr('title', 'YouTube Player');
2208			}
2209		});
2210	}
2211
2212	var _alterYoutubeEmbedLanding = function () {
2213		var embed = $('.youtube-field-player');
2214		if (embed.length != 1) return;
2215
2216		var src = embed.attr('src');
2217		embed.attr('src', src + '&controls=0&mute=1&autoplay=1');
2218
2219		// move
2220		$('.pane-node-field-hero-region').prepend(embed);
2221
2222		// size
2223		$(window).on('resize.yt-embed', function () {
2224			var w = embed.outerWidth();
2225			var h = (1080 / 1920) * w;
2226			embed.css('height', h + 'px');
2227		});
2228
2229		$(window).trigger('resize.yt-embed');
2230	}
2231
2232	var _alterPageStoryLanding = function() {
2233
2234		// exposed form modify before form ajax sort+filter
2235		var formExposed = $('#views-exposed-form-story-nonfeatured-story-list-panel-pane');
2236		$('label', formExposed).css('display', 'none');
2237		$('.form-item-tid select option:contains("Story Topic")', formExposed).text('See all posts');
2238		$('.views-widget-sort-by', formExposed).css('display', 'none');
2239		$('.form-item-sort-order select option:contains("Order")', formExposed).text('Oldest first');
2240		$('.form-item-sort-order select option:contains("Desc")', formExposed).text('Newest first');
2241		$('.form-item-sort-order select', formExposed).find('option').each(function() {
2242			$(this).prependTo($('.form-item-sort-order select', formExposed));
2243		});
2244
2245		// exposed form modify after form ajax sort+filter
2246		$(document).ajaxComplete(function(e) {
2247			var formExposedAjax = $('#views-exposed-form-story-nonfeatured-story-list-panel-pane');
2248			$('label', formExposedAjax).css('display', 'none');
2249			$('.views-widget-sort-by', formExposedAjax).css('display', 'none');
2250			$('.form-item-tid select option:contains("Story Topic")', formExposedAjax).text('See all posts');
2251			$('.form-item-sort-order select option:contains("Order")', formExposedAjax).text('Oldest first');
2252			$('.form-item-sort-order select option:contains("Desc")', formExposedAjax).text('Newest first');
2253			$('.form-item-sort-order select', formExposedAjax).find('option').each(function() {
2254				$(this).prependTo($('.form-item-sort-order select', formExposedAjax));
2255			});
2256		});
2257
2258	}
2259
2260	var _alterPageStory = function() {
2261		// story reaction widget handler (markup in nodeview template variant)
2262		// rule: only process if reaction widget showing in page
2263		if (!$('#reaction-widget')) return;
2264		// get reactions for page (if they exist yet)
2265		// rule: there are exactly 4 reactions
2266		var url = new URL(window.location);
2267		var page = url.hostname + url.pathname;
2268		page = page.replace(/[^A-Za-z0-9]+/g, '');
2269		page = page.toLowerCase();
2270		// account for "calacademy.org" url hostname use without "www" subdomain
2271		if (page.indexOf('calacademyorg') === 0) {
2272			page = page.replace('calacademyorg', 'wwwcalacademyorg');
2273		}
2274		$.ajax({
2275			url: "https://4nngj4s65c.execute-api.us-west-2.amazonaws.com/v1/reactions/" + page + ".json",
2276			type: 'GET',
2277      success: function(data) {
2278				if (data.votes.length == 4) {
2279					for (let i = 0; i < 4; i++) {
2280						$('#reaction-widget #reaction-widget-reaction-' + i + ' .reaction-widget-reaction-count').html(data.votes[i] || 0);
2281					}
2282				}
2283			},
2284			error: function(xhr, statusText) {
2285				// display 0's
2286				$('#reaction-widget').find('.reaction-widget-reaction-count').html("0");
2287			}
2288		});
2289		// put reaction for page
2290		// rule: no limit on votes per page view
2291		var btn = $('#reaction-widget .reaction-widget-reaction');
2292		var vote = 'click';
2293		btn.on(vote, function () {
2294			var reactionPos = $(this).attr('id');
2295			reactionPos = reactionPos.replace('reaction-widget-reaction-', '');
2296			reactionPos = parseInt(reactionPos);
2297			var currentCount = $(this).find('.reaction-widget-reaction-count').html();
2298			currentCount = parseInt(currentCount);
2299			// display upvote
2300			$(this).find('.reaction-widget-reaction-count').html(currentCount + 1);
2301			// update remote saved votes
2302			// get latest votes again (account for delay between page load and vote)
2303			$.ajax({
2304				url: "https://4nngj4s65c.execute-api.us-west-2.amazonaws.com/v1/reactions/" + page + ".json",
2305				type: 'GET',
2306	      success: function(data) {
2307					var votes = data.votes;
2308					votes[reactionPos] = parseInt(data.votes[reactionPos]) + 1;
2309					var d = {"votes": votes};
2310					$.ajax({
2311						url: "https://4nngj4s65c.execute-api.us-west-2.amazonaws.com/v1/reactions/" + page + ".json",
2312						type: 'PUT',
2313						contentType: 'application/json',
2314						data: JSON.stringify(d)
2315					});
2316				},
2317				// no remote saved votes yet - add
2318				error: function(xhr, statusText) {
2319					var votes = [0,0,0,0];
2320					votes[reactionPos] = 1;
2321					var d = {"votes": votes};
2322					$.ajax({
2323						url: "https://4nngj4s65c.execute-api.us-west-2.amazonaws.com/v1/reactions/" + page + ".json",
2324						type: 'PUT',
2325						contentType: 'application/json',
2326						data: JSON.stringify(d)
2327					});
2328				}
2329			});
2330		});
2331	}
2332
2333	this.initialize = function () {
2334		_removeCruft();
2335		_removeEmptySlideshows();
2336		_alterSlideshowCaptions();
2337		_cloneMenuGarnish();
2338		_cloneAlerts();
2339		_fixColumnFields();
2340		_addFileClasses();
2341		_alterMegaMenuFeaturedItems();
2342		_alterClusters();
2343		_reduceRelatedEvents();
2344		_alterLogos();
2345		_hideRevisionsTab();
2346		_alterRightRails();
2347		_alterGoogleSearchResults();
2348		_alterGifSrc();
2349		_a11yYoutubeFieldPlayerIframe();
2350
2351		if ($('body').hasClass('section-nightlife')) {
2352			_alterNightLife();
2353		}
2354
2355		if ($('body').hasClass('node-type-landing-page')
2356			|| $('body').hasClass('node-type-exhibit')) {
2357			_alterLandingAndExhibitsPage();
2358			_alterYoutubeEmbedLanding();
2359		}
2360
2361		if ($('body').hasClass('node-type-es-landing-page')) {
2362			_alterESLandingPage();
2363		}
2364
2365		if ($('body').hasClass('node-type-price-table')) {
2366			_alterPriceTable();
2367		}
2368
2369		if ($('body').hasClass('node-type-landing-page-science-today')) {
2370			_alterScienceTodayLanding();
2371		}
2372
2373		if ($('body').hasClass('node-type-entity-collections')) {
2374			_alterEntityCollections();
2375		}
2376
2377		if ($('body').hasClass('page-lesson-plans-landing')) {
2378			_addLessonPlansSearch();
2379		}
2380
2381		if ($('body').hasClass('node-type-event')) {
2382			_addEventDetailTimeslotFormat();
2383			_alterEventsArticleSectionSubtitle();
2384		}
2385
2386		if ($('body').hasClass('page-story-landing')) {
2387			_alterPageStoryLanding();
2388		}
2389
2390		if ($('body').hasClass('node-type-story')) {
2391			_alterPageStory();
2392		}
2393
2394		_alterHighlights();
2395		_fixMultiTimeslots();
2396		_removeCruftyLinks();
2397	}
2398
2399	this.initialize();
2400}
2401;
2402/**
2403 * jquery.sanitize.js
2404 *
2405 * @author Greg Rotter
2406 * @todo Add tests
2407 */
2408;(function($){
2409	/**
2410	 * Strip all tags except those specified in a whitelist
2411	 *
2412	 * @param {string} whitelist A jQuery selector of tags not to be stripped
2413	 */
2414	$.fn.stripTags = function (whitelist) {
2415	    $('*', this).not(whitelist).each(function () {
2416			var content = $(this).contents();
2417			$(this).replaceWith(content);
2418		});
2419
2420	    return this;
2421	}
2422
2423	/**
2424	 * Strip all attributes except those specified in a whitelist
2425	 *
2426	 * @param {array} whitelist An array of objects that define whitelisted
2427	 * attributes and what tag types they apply to
2428	 * @example
2429	 * // strip all attributes except for href, name and id on anchor tags.
2430	 * $('#container').stripAttributes([{tag: 'a', allowedAttributes: ['href', 'name', 'id']}]);
2431	 */
2432	$.fn.stripAttributes = function (whitelist) {
2433		$('*', this).each(function () {
2434			var inst = $(this);
2435			var tagName = $(this).prop('tagName').toLowerCase();
2436
2437			var attributes = $.map(this.attributes, function (item) {
2438				return item.name;
2439			});
2440
2441			// strip everything by default
2442			var _strip = function (i, item) {
2443				inst.removeAttr(item);
2444			}
2445
2446			// we have a whitelist defined
2447			if (typeof(whitelist) != 'undefined') {
2448				$.each(whitelist, function (index, value) {
2449					if (value.tag == tagName) {
2450						// redefine strip routine to apply to selected tag
2451						_strip = function (i, item) {
2452							// if found attribute is NOT contained in whitelist, remove it
2453							if ($.inArray(item, value.allowedAttributes) == -1) {
2454								inst.removeAttr(item);
2455							}
2456						}
2457
2458						return false;
2459					}
2460				});
2461			}
2462
2463			$.each(attributes, _strip);
2464		});
2465
2466	    return this;
2467	}
2468})(jQuery);
2469;
2470var iNatEmbed = function () {
2471	var $ = jQuery;
2472
2473	var _apiBase = 'https://api.inaturalist.org/v1/';
2474	var _apiBaseLegacy = 'https://www.inaturalist.org/';
2475
2476	var _getObservationHtml = function (obj) {
2477		// pic
2478		var url = obj.photos[0].url;
2479		url = url.replace('square', 'medium');
2480
2481		// identification
2482		var obsId = !obj.species_guess ? 'Unknown' : obj.species_guess;
2483		var isScientific = false;
2484
2485		if ($.isArray(obj.identifications)) {
2486			if (obj.identifications.length > 0) {
2487				obsId = obj.identifications[0].taxon.name;
2488				isScientific = true;
2489			}
2490		}
2491
2492		var html = '<a class="observation-image" href="' + obj.uri + '">';
2493		html += '<div class="image-container" style="background-image: url(' + url + ');"><img src="' + calacademy.Constants.emptyGif + '" /></div>';
2494		
2495		if (isScientific) {
2496			html += '<div class="observation-id scientific">' + obsId + '</div>';
2497		} else {
2498			html += '<div class="observation-id">' + obsId + '</div>';	
2499		}
2500		
2501		html += '</a>';
2502
2503		if (obj.description) {
2504			html += '<div class="observation-description">' + obj.description + '</div>';	
2505		}
2506		
2507		return html;	
2508	}
2509
2510	var _getData = function (apiUrl, onSuccess, onError) {
2511		var foo = $.ajax({
2512			url: apiUrl,
2513			success: function (data) {
2514				if (typeof(onSuccess) == 'function') {
2515					onSuccess(data);
2516				}
2517			},
2518			error: function () {
2519				if (typeof(onError) == 'function') {
2520					onError();
2521				}
2522			}
2523		});
2524	}
2525
2526	var _getStat = function () {
2527		var container = $(this);
2528		var id = container.closest('.inat-container').data('project-id');
2529		var endpoint = container.data('endpoint') + '?project_id=' + id + '&per_page=1';
2530
2531		_getData(_apiBase + endpoint, function (data) {
2532			$('span', container).html(data.total_results);
2533		});
2534	}
2535
2536	var _embed = function () {
2537		var container = $(this);
2538		var projectUrl = container.data('project-url');
2539		var slug = projectUrl.split('/').pop();
2540		
2541		// project info
2542		_getData(_apiBaseLegacy + 'projects/' + slug + '.json', function (data) {
2543			console.log(data);
2544			container.data('project-id', data.id);
2545			
2546			$('.title', container).html(data.title);
2547			$('.description', container).html(data.description);
2548
2549			// sanitize description
2550			$('.description', container).stripAttributes([
2551				{
2552					tag: 'a',
2553					allowedAttributes: ['href']
2554				}
2555			]);
2556
2557			// observations
2558			_getData(_apiBase + 'observations?project_id=' + data.id + '&order=desc&order_by=created_at&per_page=12&photos=true', function (obj) {
2559				$.each(obj.results, function (i, result) {
2560					var html = _getObservationHtml(result);
2561					$('.observations ul', container).append('<li>' + html + '</li>');	
2562				});
2563
2564				if (calacademy.Utils) {
2565					calacademy.Utils.alterLinkTargets($('.inat-container'));	
2566				}
2567			});
2568
2569			// stats
2570			$('.stats li', container).each(_getStat);
2571
2572			// display
2573			container.addClass('data-fetched');
2574		});
2575	}
2576
2577	this.initialize = function () {
2578		$('.inat-container').each(_embed);
2579	}
2580
2581	this.initialize(); 
2582}
2583;
2584var mediaGallery = function () {
2585	var $ = jQuery;
2586
2587	var _init = function () {
2588
2589		var options = {
2590			type: 'image',
2591			image: {
2592				titleSrc: function(item) {
2593					return item.el.closest('.views-row').find('.media-gallery-item-text').html();
2594				}
2595			},
2596			iframe: {
2597				markup: '<div class="mfp-iframe-scaler">'+
2598				'<div class="mfp-close"></div>'+
2599				'<iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe>'+
2600				'<div class="mfp-bottom-bar"><div class="mfp-title"></div></div>'+
2601				'</div>',
2602				patterns: {
2603    			youtube: {
2604      			index: 'youtube.com/',
2605						id: function(url) {
2606							return url;
2607						},
2608						src: '%id%?autoplay=1&mute=1'
2609					}
2610				},
2611				srcAction: 'iframe_src',
2612			},
2613			gallery: {
2614				enabled: true,
2615				preload: [0,1],
2616				tCounter: ''
2617			},
2618			callbacks: {
2619				markupParse: function(template, values, item) {
2620			    template.closest('.mfp-iframe-scaler').find('.mfp-bottom-bar').css('margin-top', '0');
2621					template.closest('.mfp-iframe-scaler').find('.mfp-title').html(item.el.closest('.views-row').find('.media-gallery-item-text').html());
2622			  },
2623				change: function() {
2624					$(this.content).find('img[src*="1080x1440"]').closest('.mfp-content').addClass('portrait');
2625					$(this.content).find('img[src*="1080x1440"]').closest('.mfp-content').removeClass('landscape');
2626					$(this.content).find('img[src*="1920x1080"]').closest('.mfp-content').addClass('landscape');
2627					$(this.content).find('img[src*="1920x1080"]').closest('.mfp-content').removeClass('portrait');
2628
2629					//$(this.content).find('img').css('max-height', '540px');
2630					//$(this.content).find('img[src*="1080x1440"]').closest('.mfp-figure').find('.mfp-close').css('margin-right', '-236px');
2631					//$(this.content).find('img[src*="1920x1080"]').closest('.mfp-figure').find('.mfp-close').css('margin-right', '0');
2632					//$(this.content).closest('.mfp-iframe-scaler').find('.mfp-close').css('margin-right', '0');
2633					//$(this.content).find('.mfp-iframe').closest('.mfp-iframe-scaler').closest('.mfp-content').css({'max-width':'818px', 'max-height':'460px'});
2634					//$(this.content).find('img[src*="1080x1440"]').closest('.mfp-figure').find('.mfp-bottom-bar').css({'margin-left':'-240px', 'width':'820px'});
2635					//$(this.content).find('img[src*="1920x1080"]').closest('.mfp-figure').find('.mfp-bottom-bar').css({'margin-left':'0', 'width':'auto'});
2636					//$(this.content).closest('.mfp-iframe-scaler').find('.mfp-bottom-bar').css({'margin-left':'0', 'margin-top':'3px', 'width':'auto'});
2637					//$(this.content).find('img').closest('.mfp-content').css({'max-width':'unset', 'max-height':'unset'});
2638				},
2639				resize: function() {
2640					$(this.content).find('img[src*="1080x1440"]').closest('.mfp-content').addClass('portrait');
2641					$(this.content).find('img[src*="1920x1080"]').closest('.mfp-content').addClass('landscape');
2642					//$(this.container[0]).find('img').css('max-height', '540px');
2643					//$(this.container[0]).find('img[src*="1080x1440"]').closest('.mfp-figure').find('.mfp-close').css('margin-right', '-236px');
2644					//$(this.container[0]).find('img[src*="1920x1080"]').closest('.mfp-figure').find('.mfp-close').css('margin-right', '0');
2645					//$(this.container[0]).closest('.mfp-iframe-scaler').find('.mfp-close').css('margin-right', '0');
2646					//$(this.container[0]).find('.mfp-iframe').closest('.mfp-iframe-holder').find('.mfp-content').css({'max-width':'818px', 'max-height':'460px'});
2647					//$(this.container[0]).find('img[src*="1080x1440"]').closest('.mfp-figure').find('.mfp-bottom-bar').css({'margin-left':'-240px', 'width':'820px'});
2648					//$(this.container[0]).find('img[src*="1920x1080"]').closest('.mfp-figure').find('.mfp-bottom-bar').css({'margin-left':'0', 'width':'auto'});
2649					//$(this.container[0]).closest('.mfp-iframe-scaler').find('.mfp-bottom-bar').css({'margin-left':'0', 'margin-top':'3px', 'width':'auto'});
2650					//$(this.container[0]).find('img').closest('.mfp-content').css({'max-width':'unset', 'max-height':'unset'});
2651				},
2652				open: function() {
2653					// override magnific-popup overflowy scroll hide + html margin-right
2654					$('html').css('margin-right', '0');
2655					$(this.container[0]).find('img[src*="1080x1440"]').closest('.mfp-content').addClass('portrait');
2656					$(this.container[0]).find('img[src*="1920x1080"]').closest('.mfp-content').addClass('landscape');
2657
2658					//$(this.container[0]).find('img').css('max-height', '540px');
2659					//$(this.container[0]).find('img[src*="1080x1440"]').closest('.mfp-figure').find('.mfp-close').css('margin-right', '-236px');
2660					//$(this.container[0]).find('img[src*="1920x1080"]').closest('.mfp-figure').find('.mfp-close').css('margin-right', '0');
2661					//$(this.container[0]).closest('.mfp-iframe-scaler').find('.mfp-close').css('margin-right', '0');
2662					//$(this.container[0]).find('.mfp-iframe').closest('.mfp-iframe-holder').find('.mfp-content').css({'max-width':'818px', 'max-height':'460px'});
2663					//$(this.container[0]).find('img[src*="1080x1440"]').closest('.mfp-figure').find('.mfp-bottom-bar').css({'margin-left':'-240px', 'width':'820px'});
2664					//$(this.container[0]).find('img[src*="1920x1080"]').closest('.mfp-figure').find('.mfp-bottom-bar').css({'margin-left':'0', 'width':'auto'});
2665					//$(this.container[0]).closest('.mfp-iframe-scaler').find('.mfp-bottom-bar').css({'margin-left':'0', 'margin-top':'3px', 'width':'auto'});
2666				}
2667			}
2668		};
2669
2670		$(this).find('.modal-trigger').magnificPopup(options);
2671	}
2672
2673	this.initialize = function () {
2674		// media gallery dependent upon magnific popup
2675		if (typeof($.fn.magnificPopup) != 'function') return;
2676		$('.view-media-gallery').each(_init);
2677	}
2678
2679	this.initialize();
2680}
2681;
2682var Popup = function () {
2683	var $ = jQuery;
2684	var _originalPlaceholder;
2685	var _autocloseTimeout;
2686	var _container;
2687	var _delaySecs = 2;
2688
2689	var _initPopup = function(popup, bypassCookie) {
2690		if (typeof(popup) != 'string') return;
2691
2692		var popupName = popup.replace("popup-", "");
2693
2694		// if this is email acquisition popup, check for user cookie for list id
2695		var emailListId = '';
2696		if ($('#' + popup + ' input.list_id').length) {
2697		  emailListId = $('#' + popup + ' input.list_id').val();
2698		}
2699
2700		if (!bypassCookie) {
2701			// if existing cookie for this popup, remove popup before display
2702			if (
2703				$.cookie('suppress-popup-' + popupName, Number) ||
2704				$.cookie('suppress-popups', Number) ||
2705				$.cookie('suppress-popup-email-list-id-' + emailListId, Number) ||
2706				$.getQueryString('suppress-popups') == '1'
2707			) {
2708				$('.popup').remove();
2709				return;
2710			}
2711		}
2712
2713		// set session cookie for any and all popups
2714		$.cookie('suppress-popups', '1', {path: '/'});
2715
2716		// set N day popup-specific cookie
2717		var intCookieDays = $('#' + popup).attr('data-cookie-days');
2718		intCookieDays = parseInt(intCookieDays);
2719		if (intCookieDays > 0) {
2720			$.cookie('suppress-popup-' + popupName, 1, {expires: intCookieDays, path: '/'});
2721		}
2722
2723		setTimeout(function () {
2724			_showPopup(popupName, emailListId);
2725		}, _delaySecs * 1000);
2726	}
2727
2728	var _showPopup = function (name, emailListId) {
2729
2730		_container = $('#popup-' + name);
2731
2732		if (_container.length != 1) return;
2733
2734		if (_container.length == 1) {
2735			_container.show();
2736			// a11y: popup dialog must trap keyboard; focus to 1st actionable element
2737			var popupInputEmail = _container.find('input[name="email"]').first();
2738			var popupCTA = _container.find('a.cta-link').first();
2739			if (popupInputEmail.length > 0) {
2740				popupInputEmail.focus();
2741			} else if (popupCTA.length > 0) {
2742				popupCTA.focus();
2743			}
2744		}
2745		calacademy.Utils.log('Showing popup: ' + _container.attr('id'));
2746
2747		$('button', _container).on('click', function () {
2748			_container.addClass('close');
2749			$(this).blur();
2750			$(document.body).focus();
2751		});
2752
2753		_initSignupForm(name, function () {
2754			// email acquisition success for this popup
2755			// set 100-year cookie to block popups for this email acquisition list id
2756			if (emailListId) {
2757				$.cookie('suppress-popup-email-list-id-' + emailListId, 1, {expires: 100*365, path: '/'});
2758			} else {
2759				calacademy.Utils.log('email acquisition popup list id not found');
2760			}
2761		});
2762
2763	}
2764
2765	var _initSignupForm = function (name, onSuccess, onError) {
2766
2767		_container.removeClass('submit-success');
2768		_container.removeClass('submit-error');
2769
2770		_originalPlaceholder = $('.email', _container).attr('placeholder');
2771
2772		$('form', _container).on('submit', function () {
2773
2774			var host = location.host;
2775			var baseurl = location.protocol + '//' + host;
2776
2777			if ($(this).hasClass('submitting')) {
2778				return false;
2779			}
2780
2781			$(this).addClass('submitting');
2782
2783			var field = $('.email', this);
2784			var email = $.trim(field.val()).toLowerCase();
2785
2786			if (!calacademy.Utils.isEmail(email)) {
2787				$(this).removeClass('submitting');
2788				field.val('');
2789				field.attr('placeholder', 'Please enter a valid email address');
2790				return false;
2791			}
2792
2793			field.val('');
2794			field.blur();
2795			field.attr('disabled', 'true');
2796			field.attr('placeholder', 'Submitting...');
2797
2798			var data = {
2799				email: email,
2800				list_ids: parseInt($('.list_id', _container).val()),
2801				collection_point: $('.collection_point', _container).val(),
2802				template_transaction_id: parseInt($('.template_transaction_id', _container).val()),
2803			};
2804
2805			if ($('.template_transaction_vars', this).length > 0) {
2806				var jsonObj = {};
2807				$('.template_transaction_vars', this).each(function () {
2808					jsonObj[$(this).attr('name')] = $(this).val();
2809				});
2810				data.template_transaction_vars = JSON.stringify(jsonObj);
2811			}
2812
2813			calacademy.Utils.log(data);
2814
2815			window.dataLayer = window.dataLayer || [];
2816
2817			$.ajax({
2818				dataType: 'jsonp',
2819				url: baseurl + '/mailjet-client-proxy',
2820				data: data,
2821				success: function (data, textStatus, XMLHttpRequest) {
2822					field.val('');
2823					field.blur();
2824
2825					_container.addClass('submit-success');
2826
2827					$('h2', _container).html($('.copy .success .header', _container).html());
2828					$('p', _container).html($('.copy .success .subheader', _container).html());
2829
2830					field.removeAttr('disabled');
2831					field.attr('placeholder', _originalPlaceholder);
2832					$('form', _container).removeClass('submitting');
2833					$('form', _container).addClass('success');
2834
2835					// auto-close
2836					_autocloseTimeout = setTimeout(function () {
2837						_container.addClass('close');
2838						$(document.body).focus();
2839					}, 5000);
2840
2841					window.dataLayer.push({
2842						'event': 'pop_up_email',
2843						'pop_up_name': _container.attr('id'),
2844						'userId': btoa(encodeURIComponent(email))
2845					});
2846
2847					// callback
2848					if (typeof(onSuccess) == 'function') {
2849						onSuccess();
2850					}
2851				},
2852				error: function (XMLHttpRequest, textStatus, errorThrown) {
2853					field.val('');
2854
2855					_container.addClass('submit-error');
2856
2857					$('h2', _container).html($('.copy .error .header', _container).html());
2858					$('p', _container).html($('.copy .error .subheader', _container).html());
2859
2860					field.removeAttr('disabled');
2861					field.attr('placeholder', _originalPlaceholder);
2862					$('form', _container).removeClass('submitting');
2863
2864					// callback
2865					if (typeof(onError) == 'function') {
2866						onError();
2867					}
2868				}
2869			});
2870
2871			return false;
2872		});
2873	}
2874
2875	var _schedulePrune = function () {
2876		// chimera dependency
2877		if (typeof(chimera) != 'object') return;
2878
2879		$('.popup').each(function () {
2880			// if no scheduling data present, assume active
2881			if ($.isArray($(this).data('schedule'))) {
2882				var isExpired = true;
2883
2884				// if any conditions met, do not remove
2885				$.each($(this).data('schedule'), function (i, obj) {
2886					if (chimera.utils.isActive(obj)) {
2887						isExpired = false;
2888						return false;
2889					}
2890				});
2891
2892				if (isExpired) {
2893					calacademy.Utils.log($(this).data('schedule'));
2894					calacademy.Utils.log($(this).attr('id') + ' not yet active or expired. Removing from DOM.');
2895					$(this).remove();
2896				}
2897			}
2898		});
2899	}
2900
2901	var _getPopup = function (obj) {
2902		var domEl = $('<div />', {
2903			'id': 'popup-' + obj.nid,
2904			'class': 'popup lightbox-popup lightbox-popup-banner popup-cms',
2905			'role': 'alertdialog',
2906			'aria-modal': 'true',
2907			'aria-labelledby': 'dialog_label',
2908			'aria-describedby': 'dialog_desc'
2909		});
2910
2911		var container = $('<div />');
2912		container.addClass('container');
2913
2914		var closeButton = $('<button tabindex="2" />');
2915		closeButton.html('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 45 45" style="enable-background:new 0 0 45 45;" xml:space="preserve"><polygon points="13,15.2 20.3,22.5 13,29.8 15.2,32 22.5,24.7 29.8,32 32,29.8 24.7,22.5 32,15.2 29.8,13 22.5,20.3 15.2,13 "/></svg>');
2916		container.append(closeButton);
2917		
2918		obj.img.desktop.addClass('non-smartphone-only');
2919		obj.img.smartphone.addClass('smartphone-only');
2920
2921		container.append(obj.img.desktop);
2922		container.append(obj.img.smartphone);
2923
2924		var title = false;
2925		var p = false;
2926
2927		if (obj.title && typeof(obj.title) == 'string') {
2928			title = $('<h2 id="dialog_label">' + obj.title + '</h2>');
2929			container.append(title);
2930		}
2931		
2932		if (obj.body && typeof(obj.body) == 'string') {
2933			p = $('<p id="dialog_desc" />');
2934			p.append(obj.body);
2935			container.append(p);
2936		}
2937
2938		obj.cta.attr('tabindex', '1');
2939		obj.cta.addClass('cta-link');
2940
2941		var ctaContainer = $('<div />');
2942		ctaContainer.append(obj.cta.attr('tabindex', '1'));
2943		container.append(ctaContainer);
2944
2945		domEl.append(container);
2946
2947		// color
2948		container.css('background-color', obj.color.background);
2949		closeButton.css('background-color', obj.color.backgroundButton);
2950		closeButton.css('outline-color', obj.color.textButton);
2951		closeButton.find('svg').css('fill', obj.color.textButton);
2952		if (title) title.css('color', obj.color.text);
2953		if (p) p.css('color', obj.color.text);
2954		obj.cta.css('outline-color', obj.color.textButton);
2955		obj.cta.css('background-color', obj.color.backgroundButton);
2956		obj.cta.css('color', obj.color.textButton);
2957
2958		return domEl;
2959	}
2960
2961	var _popupCMSPreview = function () {
2962		if (!Drupal.settings.calacademy_zen) return;
2963		var nid = Drupal.settings.calacademy_zen.nid;
2964
2965		$('.node-popup').hide();
2966
2967		$('body').append(_getPopup({
2968			nid: nid,
2969			title: $('.field-name-field-subtitle .field-item h2').html(),
2970			body: $('.field-name-field-body .field-item').html(),
2971			cta: $('.field-name-field-cta-button a'), 
2972			img: {
2973				smartphone: $('.field-name-field-inline-image img'),
2974				desktop: $('.field-name-field-poster-image img')
2975			},
2976			color: {
2977				background: $('.field-name-field-bg-color .field-items').text().trim(),
2978				backgroundButton: $('.field-name-field-button-color .field-items').text().trim(),
2979				text: $('.field-name-field-text .field-items').text().trim(),
2980				textButton: $('.field-name-field-button-text-color .field-items').text().trim()
2981			}
2982		}));
2983		
2984		_showPopup(nid);
2985	}
2986
2987	var _isExcluded = function (exclude_urls) {
2988		var excludeUrls = exclude_urls.trim().split("\n").map(function (url) {
2989			return url.trim().toLowerCase();
2990		});
2991
2992		var currentPath = window.location.pathname.replace(/^\/|\/$/g, '').toLowerCase();
2993		
2994		if (currentPath === '' || currentPath === 'homepage') {
2995			currentPath = '&lt;front&gt;';
2996		}
2997
2998		return excludeUrls.includes(currentPath);
2999	}
3000
3001	this.initialize = function () {
3002		if ($('body').hasClass('node-type-popup')) {
3003			// unpublished node data excluded from service
3004			_popupCMSPreview();
3005			return;
3006		}
3007
3008		if ($('#' + $.getQueryString('popup') + '.popup').length == 1) {
3009			// deep link to a popup if it exists
3010			_initPopup($.getQueryString('popup'), true);
3011			return;
3012		}
3013
3014		$.getJSON('/rest/popups.json', function (data) {
3015			// iterate published CMS popup data
3016			$.each(data, function (i, obj) {
3017				if (!obj.nid) return true;
3018				if (_isExcluded(obj.exclude_urls)) return true;
3019
3020				// setup popup object
3021				obj.cta = $(obj.cta);
3022				
3023				obj.img = {
3024					smartphone: $(obj.image_smartphone),
3025					desktop: $(obj.image)
3026				};
3027
3028				obj.color = {
3029					background: obj.color_bg,
3030					backgroundButton: obj.color_bg_button,
3031					text: obj.color_text,
3032					textButton: obj.color_text_button
3033				};
3034
3035				// add to DOM
3036				$('body').append(_getPopup(obj));
3037			});
3038
3039			// prune any popups that are not active
3040			_schedulePrune();
3041
3042			// remove evergreen popups if we have at least one cms popup
3043			if ($('.popup-cms').length > 0) {
3044				$('.popup.evergreen').remove();
3045			}
3046			
3047			// no popups, quit
3048			if ($('.popup').length == 0) return;
3049
3050			// randomly select a popup to display
3051			var i = Math.floor(Math.random() * $('.popup').length);
3052			_initPopup($('.popup').eq(i).attr('id'));
3053		});
3054	};
3055
3056	this.initialize();
3057}
3058;
3059var EducatorSearch = function () {
3060	var $ = jQuery;
3061	var _gcseInitInterval;
3062	var _firstRun = true;
3063
3064	var _vocab = {
3065		field_educators_content_type: [],
3066		field_educators_search_filters: []
3067	};
3068
3069	function _getSanitizedString (str) {
3070		var container = document.createElement('div');
3071		var text = document.createTextNode(str);
3072		container.appendChild(text);
3073
3074		return container.innerHTML;
3075	}
3076
3077	var _getHashValue = function (key) {
3078		var hash = window.location.hash.substring(1);
3079		if (hash == '') return false;
3080
3081		var arr = hash.split('&');
3082		var value = false;
3083		
3084		$.each(arr, function (i, val) {
3085			var pair = val.split('=');
3086			
3087			if (pair[0] == key) {
3088				value = pair[1];
3089				return false;
3090			}
3091 		});
3092
3093		if (value === false) return false;
3094 		value = $.trim(decodeURIComponent(value));
3095
3096 		return _getSanitizedString(value);
3097	}
3098
3099	var _getHash = function () {
3100		var keyVals = [];
3101
3102		// text
3103		if ($.trim($('.educator-search #t').val()) != '') {
3104			keyVals.push('t=' + encodeURIComponent($.trim($('.educator-search #t').val())));	
3105		}
3106		
3107		// tids
3108		var arr = [];
3109
3110		$('#search-filters-container input:checked').each(function () {
3111			arr.push($(this).val());
3112		});
3113
3114		if (arr.length > 0) {
3115			keyVals.push('tids=' + arr.join(','));
3116		}
3117		
3118		return keyVals.join('&');
3119	}
3120
3121	var _truncate = function (el) {
3122		el.dotdotdot({
3123			height: 30,
3124			watch: true
3125		});
3126	}
3127
3128	var _getTidsForList = function (ul) {
3129		var arr = [];
3130
3131		$('input:checked', ul).each(function () {
3132			arr.push($(this).val());
3133		});
3134
3135		if (arr.length == 0) {
3136			return false;
3137		} else {
3138			return arr.join(',');	
3139		}
3140	}
3141
3142	var _getQuery = function (freeText) {
3143		var filters = [];
3144		
3145		// checkboxes
3146		$('#search-filters-container ul').each(function () {
3147			var tids = _getTidsForList($(this));
3148			
3149			if (tids) {
3150				filters.push('more:pagemap:document-' + $(this).data('field') + ':' + tids);
3151			}	
3152		});
3153
3154  		if (filters.length == 0) {
3155  			// no filters, limit to educators
3156  			return $.trim(freeText + ' site:calacademy.org/educators');
3157  		} else {
3158  			return $.trim(freeText + ' ' + filters.join(' '));
3159  		}
3160	}
3161
3162	var _track = function (freeText) {
3163		if (typeof(ga) != 'function') return;
3164
3165		// @see
3166		// https://stackoverflow.com/questions/15744042/events-not-being-tracked-in-new-google-analytics-analytics-js-setup
3167		var tracker = ga.getAll()[0];
3168		if (typeof(tracker.send) != 'function') return;
3169
3170		var filters = [];
3171
3172		$('#search-filters-container input:checked').each(function () {
3173			var label = $.trim($(this).siblings('label').text());
3174			filters.push(label);
3175		});
3176
3177		if (freeText != '') {
3178			freeText += ' | ';
3179		}
3180
3181		var searchTerm;
3182
3183  		if (filters.length == 0) {
3184  			searchTerm = $.trim(freeText + 'site:calacademy.org/educators');
3185  		} else {
3186  			searchTerm = $.trim(freeText + filters.join(', '));
3187  		}
3188
3189  		var url = '/educators/search?t=' + encodeURIComponent(searchTerm);
3190
3191  		calacademy.Utils.log('track pageview: ' + url);
3192  		tracker.send('pageview', url);		
3193	}
3194
3195	var _updateSelectedFiltersUI = function (freeText) {
3196		$('.selected-filters').empty();
3197		
3198		// free text
3199		if (freeText != '') {
3200			var button = $('<a href="#">&ldquo;' + freeText + '&rdquo;</a>');
3201			button.addClass('button-free-text');
3202
3203			// clear free text when clicked
3204			button.on('click', function () {
3205				$('#t').val('');
3206				_onSubmit();
3207
3208				return false;
3209			});
3210
3211			// insert into DOM
3212			$('.selected-filters').append(button);
3213		}
3214
3215		// iterate each checked filter
3216		$('#search-filters-container input:checked').each(function () {
3217			var label = $(this).siblings('label').html();
3218
3219			var button = $('<a href="#">' + label + '</a>');
3220			button.data('term-id', $(this).attr('id'));
3221			button.addClass('button-' + $(this).attr('id'));
3222			
3223			// clear the corresponding filter when clicked
3224			button.on('click', function () {
3225				var correspondingInput = $('#' + $(this).data('term-id'));
3226				correspondingInput.prop('checked', false);
3227
3228				// resubmit query
3229				_onSubmit();
3230
3231				return false;
3232			});
3233
3234			// insert into DOM
3235			$('.selected-filters').append(button);
3236		});
3237
3238		// update indicators 
3239		$('.smartphone-filter-toggle span').remove();
3240		$('#search-filters-container h3 span').remove();
3241		$('#search-filters-container h4').remove();
3242		
3243		$('#search-filters-container ul').each(function () {
3244			var checked = $(this).find('input:checked');
3245
3246			if (checked.length > 0) {
3247				$(this).prev('h3').append('<span> (' + checked.length + ')</span>');
3248				$(this).prev('h3').addClass('has-selected-filters');
3249
3250				var h4 = $('<h4 />');
3251				h4.addClass($(this).data('tid'));
3252
3253				var labels = [];
3254
3255				checked.each(function () {
3256					var label = $(this).siblings('label');
3257					labels.push(label.html());
3258				});
3259
3260				h4.html(labels.join(', '));
3261				h4.insertAfter($(this).prev('h3'));
3262
3263				if ($(this).hasClass('collapsed')) {
3264					h4.addClass('collapsed');
3265					_truncate(h4);
3266				}
3267			} else {
3268				$(this).prev('h3').removeClass('has-selected-filters');
3269			}
3270		});
3271
3272		// smartphone toggle
3273		var totalChecked = $('#search-filters-container input:checked').length;
3274		
3275		if (totalChecked > 0) {
3276			$('.smartphone-filter-toggle').append('<span> (' + totalChecked + ')</span>');
3277		}
3278	}
3279
3280	var _onSubmit = function () {
3281		if ($('#search-results-container').length != 1) {
3282			// jump to results page
3283			var url = '/educators/search/';
3284			var hash = _getHash();
3285			
3286			if (hash != '') {
3287				url += '#' + hash;
3288			}
3289
3290			window.location.href = url;
3291			return false;
3292		}
3293
3294		var freeText = $.trim($('#t').val());
3295		_updateSelectedFiltersUI(freeText);
3296
3297  		// scroll
3298  		/*
3299  		if (typeof($.fn.scrollTo) == 'function') {
3300  			$(window).scrollTo(0, 500);
3301  		} else {
3302  			window.scrollTo(0, 0);
3303  		}
3304  		*/
3305
3306  		if (_firstRun) {
3307  			_firstRun = false;
3308  			_onNav();
3309  		} else {
3310  			// update hash
3311  			window.location.hash = _getHash();
3312  		}
3313
3314		return false;
3315	}
3316
3317	var _appendFilterSection = function (title, tidClass, field) {
3318		var container = $('#search-filters-container .container');
3319
3320		var h3 = $('<h3>' + title + '</h3>');
3321		h3.data('tid', tidClass);
3322		
3323		container.append(h3);
3324				
3325		var ul = $('<ul />');
3326		ul.addClass(tidClass);
3327		ul.data('tid', tidClass);
3328		ul.data('field', field);
3329
3330		container.append(ul);	
3331	}
3332
3333	var _initFilters = function () {
3334		// create checkboxes
3335		var container = $('<div id="search-filters-container"><div class="container"></div></div>');
3336		$('.search-term').after(container);
3337		
3338		$('<div class="selected-filters" />').insertAfter($('.search-term'));
3339
3340		// create list for content types
3341		_appendFilterSection('Resource Type', 'parent-tid-content_type', 'field_educators_content_type');		
3342
3343		// create lists for filters
3344		$.each(_vocab.field_educators_search_filters, function (key, obj) {
3345			if (!obj.parent_tid) {
3346				var tidClass = 'parent-tid-' + obj.tid;
3347				_appendFilterSection(obj.name, tidClass, 'field_educators_search_filters');
3348			}
3349		});
3350
3351		_createFilterUI(_vocab.field_educators_content_type);
3352		_createFilterUI(_vocab.field_educators_search_filters);
3353
3354		// insert the smartphone filter toggle button
3355		var btn = $('<a href="#">Filters</a>');
3356		btn.addClass('smartphone-filter-toggle');
3357		
3358		btn.on('click', function () {
3359			$('html').toggleClass('show-filters');
3360			return false;
3361		});
3362
3363		$('#search-filters-container').prepend(btn);
3364
3365		// interaction
3366		$('#search-filters-container h3').on('click', _onFilterTitleClick);
3367		$('#search-filters-container input').on('change', _onSubmit);
3368	}
3369
3370	var _onFilterTitleClick = function () {
3371		$(this).toggleClass('collapsed');
3372		$('.' + $(this).data('tid')).toggleClass('collapsed');
3373
3374		var h4 = $('h4.' + $(this).data('tid'));
3375
3376		if (h4.hasClass('collapsed')) {
3377			_truncate(h4);
3378		}
3379	}
3380
3381	var _createFilterUI = function (terms) {
3382		var tids = false;
3383
3384		if ($.getQueryString('tids')) {
3385			var clean = _getSanitizedString($.getQueryString('tids'));
3386			tids = $.trim(clean).split(',');
3387
3388			window.location.hash += '&tids=' + tids.join(',');
3389		}
3390
3391		var hashTids = _getHashValue('tids');
3392		
3393		if (hashTids) {
3394			tids = hashTids.split(',');
3395		}
3396
3397		$.each(terms, function (key, obj) {
3398			if (!obj.parent_tid) return;
3399
3400			var checkbox = $('<input type="checkbox" id="' + obj.tid + '" value="' + obj.tid + '" />');
3401			
3402			var li = $('<li />');
3403			li.append(checkbox);
3404			li.append('<label for="' + obj.tid + '">' + obj.name + '</label>');
3405			li.data('term-data', obj);
3406
3407			$('#search-filters-container .parent-tid-' + obj.parent_tid).append(li);
3408
3409			// preselect per query string
3410			if (tids) {
3411				if ($.inArray(obj.tid, tids) !== -1) {
3412					checkbox.prop('checked', true);	
3413				}
3414			}
3415		});
3416	}
3417
3418	var _getContentTypeData = function () {
3419		$.ajax({
3420			dataType: 'jsonp',
3421			url: '/rest/educators-content-types/',
3422			cache: false,
3423			success: function (data, textStatus, XMLHttpRequest) {
3424				_vocab.field_educators_content_type = data;
3425
3426				// create a phony parent tid for "Resource Type" terms
3427				$.each(_vocab.field_educators_content_type, function (key, obj) {
3428					obj.parent_tid = 'content_type';
3429				});
3430
3431				_initFilters();
3432				_onSubmit();
3433			}
3434		});
3435	}
3436
3437	var _getFilterData = function () {
3438		$.ajax({
3439			dataType: 'jsonp',
3440			url: '/rest/educators-taxonomy/',
3441			cache: false,
3442			success: function (data, textStatus, XMLHttpRequest) {
3443				_vocab.field_educators_search_filters = data;
3444				_getContentTypeData();
3445			}
3446		});
3447	}
3448
3449	var _initForm = function () {
3450		// check query
3451		var queryT = $.getQueryString('t');
3452
3453		if (queryT) {
3454			queryT = _getSanitizedString($.trim(queryT));
3455			$('.educator-search #t').val(queryT);
3456
3457			window.location.hash += 't=' + encodeURIComponent(queryT);
3458		}
3459
3460		// check hash
3461		var hashT = _getHashValue('t');
3462
3463		if (hashT !== false) {
3464			$('.educator-search #t').val(hashT);
3465		}
3466
3467		$('.educator-search form').on('submit', _onSubmit);	
3468	}
3469
3470	var _onLoadCheck = function () {
3471		if (!$('html').hasClass('gcse-init')) return;
3472		clearInterval(_gcseInitInterval);
3473		_getFilterData();
3474	}
3475
3476	var _onNav = function (e) {
3477		// update UI
3478		var t = _getHashValue('t');
3479
3480		if (t !== false) {
3481			$('#t').val(t);
3482		} else {
3483			$('#t').val('');
3484		}
3485
3486		var tids = _getHashValue('tids');
3487		
3488		if (tids === false) {
3489			tids = '';
3490		}
3491
3492		tids = tids.split(',');
3493
3494		$('#search-filters-container input').each(function () {
3495			var tid = $(this).attr('id');
3496			var checked = ($.inArray(tid, tids) > -1);
3497			
3498			$(this).prop('checked', checked);
3499		});
3500
3501		_updateSelectedFiltersUI($('#t').val());
3502
3503		// execute query
3504  		var freeText = $.trim($('#t').val());
3505  		var query = _getQuery(freeText);
3506
3507  		calacademy.Utils.log(query, 'background: #eaff00;');
3508		
3509  		try {
3510			var element = google.search.cse.element.getElement('educator-results');
3511  			element.execute(query);
3512  		} catch (e) {
3513  			calacademy.Utils.log(e);
3514  		}
3515		
3516  		_track(freeText);
3517	}
3518
3519	this.initialize = function () {
3520		if ($('.educator-search').length == 0) return;
3521		if ($('#header, .pane-node-title h1').length == 0) return;
3522
3523		// move form to proper location in dom
3524		if ($('body').hasClass('page-search-results')) {
3525			$('#header').append($('.educator-search'));
3526		} else {
3527			var prependTo = $('.page-header');
3528
3529			if ($('#header').length == 1) {
3530				prependTo = $('#header');
3531			}
3532
3533			prependTo.prepend($('.educator-search'));
3534		}
3535
3536		_initForm();
3537
3538		if ($('#search-results-container').length == 1) {
3539			window.onhashchange = _onNav;		
3540			_gcseInitInterval = setInterval(_onLoadCheck, 100);	
3541		}
3542	}
3543
3544	this.initialize();
3545}
3546;
3547/************************************************************************************************
3548 * jquery.mlens.js
3549 * http://mlens.musings.it
3550 * magnifying lens jQuery plugin for images
3551 * originally developed for the project "RubiniFirma" and released as a freebie
3552 * based on jquery.imageLens.js by http://www.dailycoding.com
3553 *
3554 * mlens supports multiple instances, these are the configurable parameters
3555 * lensShape: shape of the lens (square or circle)
3556 * lensSize: lens dimension (in px)
3557 * borderSize: lens border size (in px)
3558 * borderColor: lens border color (hex value)
3559 * borderRadius: lens border radius (if you like rounded corners when the shape is "square")
3560 * imgSrc: address of the hi-res image
3561 * lensCss: lens class if you like to style it your own way
3562 * imgOverlay: address of the overlay image for the lens (optional)
3563 * overlayAdapt: boolean that indicates if the overlay image has to adapt to the lens size (dafault: true)
3564 * imgSrc2x: address of the double pixel density image (for retina displays)
3565 * zoomLevel: number for moltiplicating the zoom (zoomed image can pixellate!)
3566 *
3567 * @author Federica Sibella
3568 * Copyright (c) 2012-14 Federica Sibella - musings(at)musings(dot)it | http://www.musings.it
3569 * Double licensed MIT or GPLv3.
3570 * Date: 2014/05/22
3571 * @version 1.4
3572 *
3573 * changelog:
3574 * 2015/05/22 rewritten destroy method, added zoomLevel, some parts of the code optimized v.1.4
3575 * 2013/12/16 added retina support v.1.3
3576 * 2013/09/25 added overlay image control v. 1.2
3577 * 2013/08/26 added touch support for v. 1.1
3578 ************************************************************************************************/
3579
3580;(function($){
3581	// global variables
3582	var mlens = [], // mlens array
3583		instance = 0, // instance of mlens
3584		methods = { // methods for mlens plugin
3585		// function for initializing the lens instance
3586		init: function(options) {
3587			// Defaults for lens options
3588			var defaults = {
3589				lensShape: "square",
3590				lensSize: 100,
3591   				borderSize: 4,
3592    			borderColor: "#888",
3593				borderRadius: 0,
3594				imgSrc: "",
3595				imgSrc2x: "",
3596				lensCss: "",
3597				lensShowClass: "",
3598				lensHideClass: "",
3599				wrapperClass: "",
3600				imgOverlay: "",
3601				overlayAdapt: true,
3602				zoomLevel: 1
3603			},
3604			settings = $.extend({}, defaults, options);
3605
3606			// for each instance of mlens
3607			this.each(function () {
3608				// internal variables
3609				var $image = $(this), 				// the image on which mlens is called
3610					data = $image.data("mlens"), 	// data array for mlens
3611					$target = $(), 					// the target lens
3612					$overlay = $(), 				// lens overlay
3613					$imageWrapper = $(), 			// image wrapper for attaching lens and hi-res image correctly
3614					$imageTag = $(), 				// hi-res hidden image
3615					imgSrc = $image.attr("src"), 	// initial value of the hi-res image src
3616					imgWidth = "auto"; 				// initial width of the underlying hi-res image
3617
3618				// control on the zoomLevel parameter: must be a number, must be > 0
3619				if(typeof(settings.zoomLevel) !== "number" || settings.zoomLevel <= 0) {
3620					settings.zoomLevel = defaults.zoomLevel;
3621				}
3622
3623				// have we got retina image and the device has retina support?
3624				if(settings.imgSrc2x != "" && window.devicePixelRatio > 1) {
3625					imgSrc = settings.imgSrc2x;
3626					// create a new image out of the DOM for precise measurements
3627					var bigimg = new Image();
3628					// after the big image has been fully loaded
3629					bigimg.onload = function() {
3630						// take its width and divide by 2
3631						imgWidth = String(parseInt(this.width/2) * settings.zoomLevel) + "px";
3632						// use it as the background size for the lens
3633						$target.css({"backgroundSize": imgWidth + " auto"});
3634						// use it as the width for the hi-res image itself
3635						$imageTag.css({"width": imgWidth});
3636					}
3637					bigimg.src = imgSrc;
3638				}
3639				else {
3640					// if there's imgSrc in the settings use it
3641					if(settings.imgSrc != "") {
3642						imgSrc = settings.imgSrc;
3643					}
3644					// create a new image out of the DOM for precise measurements
3645					var bigimg = new Image();
3646					// after the big image has been fully loaded
3647					bigimg.onload = function() {
3648						// take its width and divide by 2
3649						imgWidth = String(parseInt(this.width) * settings.zoomLevel) + "px";
3650						// use it as the background size for the lens
3651						$target.css({"backgroundSize": imgWidth + " auto"});
3652						// use it as the width for the hi-res image itself
3653						$imageTag.css({"width": imgWidth});
3654					}
3655					bigimg.src = imgSrc;
3656				}
3657
3658				// build lens style using user's settings
3659				var lensStyle = "background-position: 0px 0px;width: " + String(settings.lensSize) + "px;height: " + String(settings.lensSize) + "px;"
3660	            				+ "float: left; border: " + String(settings.borderSize) + "px solid " + settings.borderColor + ";"
3661	            				+ "background-repeat: no-repeat;position: absolute;";
3662
3663				// build image overlay style (just in case it has to be used)
3664				var overlayStyle= "position: absolute; width: 100%; height: 100%; left: 0; top: 0; background-position: center center; background-repeat: no-repeat; z-index: 1;"
3665
3666				// if overlay image has to adapt to lens size
3667				if(settings.overlayAdapt === true) {
3668					overlayStyle = overlayStyle + "background-position: center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;";
3669				}
3670
3671				// choosing lens shape and overlay style on the basis of user's settings
3672				switch(settings.lensShape) {
3673					case "square":
3674					case "":
3675					default:
3676						lensStyle = lensStyle + "border-radius:"  + String(settings.borderRadius) + "px;";
3677						overlayStyle = overlayStyle + "border-radius:"  + String(settings.borderRadius) + "px;";
3678					break;
3679					case "circle":
3680						lensStyle = lensStyle + "border-radius: " + String(settings.lensSize / 2 + settings.borderSize) + "px;";
3681						overlayStyle = overlayStyle + "border-radius: " + String(settings.lensSize / 2 + settings.borderSize) + "px;";
3682					break;
3683				}
3684
3685				// lens wrapping div to attach target lens and hi-res image correctly
3686				$image.wrap("<div id='mlens_wrapper_" + instance + "' />");
3687				$imageWrapper = $image.parent();
3688				$imageWrapper.addClass(settings.wrapperClass);
3689
3690				// grotter
3691				// $imageWrapper.css({"width": $image.width()});
3692
3693				// create the target lens
3694
3695				// grotter
3696				// $target = $("<div id='mlens_target_" + instance + "' style='" + lensStyle + "' class='" + settings.lensCss + "'>&nbsp;</div>").appendTo($imageWrapper);
3697				$target = $("<div id='mlens_target_" + instance + "' style='" + lensStyle + "' class='" + settings.lensCss + " " + settings.lensHideClass + "'>&nbsp;</div>");
3698
3699				// grotter
3700				// $target.appendTo('body');
3701				$target.prependTo('body');
3702
3703				// lens style on the basis of the previous infos
3704	            $target.css({
3705					"backgroundImage": "url('" + imgSrc + "')",
3706					"backgroundSize": imgWidth + " auto",
3707					"cursor": "none"
3708				});
3709
3710				// create hi-res image tag
3711				$imageTag = $("<img style='display:none;width:" + imgWidth + ";height:auto;max-width:none;max-height;none;' src='" + imgSrc + "' />").appendTo($imageWrapper);
3712
3713				// if there's an overlay append it to the $target lens
3714				if(settings.imgOverlay != "") {
3715					// create the overlay
3716					$overlay = $("<div id='mlens_overlay_" + instance + "' style='" + overlayStyle + "'>&nbsp;</div>");
3717
3718					// style the overlay
3719					$overlay.css({
3720						"backgroundImage": "url('" + settings.imgOverlay + "')",
3721						"cursor": "none"
3722					});
3723
3724					// append it to the $target lens
3725					$overlay.appendTo($target);
3726				}
3727
3728				// give the image a data-id attribute containing the instance for future use
3729	            $image.attr("data-id","mlens_" + instance);
3730
3731				//attaching mousemove event both to the target and to the image
3732				$target.mousemove(function(e) {
3733					$.fn.mlens("move",$image.attr("data-id"),e);
3734				});
3735
3736	            $image.mousemove(function(e) {
3737					$.fn.mlens("move",$image.attr("data-id"),e);
3738				});
3739
3740				//touch events imitating mousemove both for the target and for the image
3741				$target.on("touchmove", function(e) {
3742					e.preventDefault();
3743					var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
3744					$.fn.mlens("move",$image.attr("data-id"),touch);
3745				});
3746
3747	            $image.on("touchmove",function(e) {
3748					e.preventDefault();
3749					var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
3750					$.fn.mlens("move",$image.attr("data-id"),touch);
3751				});
3752
3753	            var _glassToggle = function (boo, e) {
3754	            	if (Modernizr.touch) {
3755	            		e = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
3756	            	}
3757
3758					$.fn.mlens("move",$image.attr("data-id"),e);
3759
3760	            	if (boo) {
3761	            		$target.removeClass(settings.lensHideClass);
3762	            		$target.addClass(settings.lensShowClass);
3763	            		// $target.show();
3764	            	} else {
3765	            		$target.removeClass(settings.lensShowClass);
3766	            		$target.addClass(settings.lensHideClass);
3767	            		// $target.hide();
3768	            	}
3769	            }
3770
3771				//target visibility relies both on its own visibility and that of the original image
3772				$target.hover(function(e) {
3773					_glassToggle(true, e);
3774				}, function(e) {
3775					_glassToggle(false, e);
3776				});
3777
3778				$image.hover(function(e) {
3779					_glassToggle(true, e);
3780				}, function(e) {
3781					_glassToggle(false, e);
3782				});
3783
3784				//touch events for the target (target visibility)
3785				$target.on("touchstart", function(e) {
3786					e.preventDefault();
3787					_glassToggle(true, e);
3788				});
3789
3790				$target.on("touchend", function(e) {
3791					e.preventDefault();
3792					_glassToggle(false, e);
3793				});
3794
3795				//touch events for the image (target visibility)
3796				$image.on("touchstart", function(e) {
3797					e.preventDefault();
3798					_glassToggle(true, e);
3799				});
3800
3801				$image.on("touchend", function(e) {
3802					e.preventDefault();
3803					_glassToggle(false, e);
3804				});
3805
3806				//saving data in mlens instance
3807				$image.data("mlens", {
3808					image: $image,
3809					settings: settings,
3810					target: $target,
3811					imageTag: $imageTag,
3812					imgSrc: imgSrc,
3813					imgWidth: imgWidth,
3814					imageWrapper: $imageWrapper,
3815					overlay: $overlay,
3816					instance: instance
3817				});
3818
3819				// saving data in the data array and in mlens instance array
3820				data = $image.data("mlens");
3821				mlens[instance] = data;
3822
3823				//instance increment
3824				instance++;
3825				return mlens;
3826			});
3827		},
3828		// function that defines "move" command
3829		move: function(id,e) {
3830			id = find_instance(id);
3831			// taking parameters values based on the instance
3832			var data = mlens[id],
3833				$image = data.image,
3834				$target = data.target,
3835				$imageTag = data.imageTag,
3836				offset = $image.offset(),
3837        		leftPos = parseInt(e.pageX - offset.left),
3838        		topPos = parseInt(e.pageY - offset.top),
3839				widthRatio = $imageTag.width() / $image.width(),
3840				heightRatio = $imageTag.height() / $image.height();
3841
3842			// if mouse position is inside our image
3843	        if(leftPos > 0 && topPos > 0 && leftPos < $image.width() && topPos < $image.height()) {
3844				// calculating hi-res image position as target lens background
3845	            leftPos = String(-((e.pageX - offset.left) * widthRatio  - $target.width() / 2));
3846	            topPos = String(-((e.pageY - offset.top) * heightRatio - $target.height() / 2));
3847	            $target.css({"backgroundPosition": leftPos + "px " + topPos + "px"});
3848
3849				// calculating target lens position inside the image
3850
3851	            // grotter
3852	            // leftPos = String(e.pageX - offset.left - $target.width() / 2);
3853	            // topPos = String(e.pageY - offset.top - $target.height() / 2);
3854
3855	            leftPos = String(e.pageX - ($target.width() / 2));
3856	            topPos = String(e.pageY - ($target.height() / 2));
3857
3858	            $target.css({"left": leftPos + "px", "top": topPos + "px"});
3859	        }
3860
3861			// saving new data in the mlens instance
3862			data.target = $target;
3863
3864			mlens[id] = data;
3865			return mlens;
3866		},
3867		// function that defines "update" command (to modify mlens options on-the-fly)
3868		// same functioning as init
3869		update: function(options) {
3870			var id = find_instance($(this).attr("data-id")),
3871				data = mlens[id],
3872				$image = data.image,
3873				$target = data.target,
3874				$overlay = data.overlay,
3875				$imageTag = data.imageTag,
3876				imgSrc = data.imgSrc,
3877				defaults = data.settings,
3878				settings = $.extend({}, defaults, options),
3879				imgWidth = "auto";
3880
3881			if(settings.imgSrc2x != "" && window.devicePixelRatio > 1) {
3882				imgSrc = settings.imgSrc2x;
3883				var bigimg = new Image();
3884				bigimg.onload = function() {
3885					imgWidth = String(parseInt(this.width/2)) + "px";
3886					$target.css({"backgroundSize": imgWidth + " auto"});
3887					$imageTag.css({"width": imgWidth});
3888				}
3889				bigimg.src = imgSrc;
3890			}
3891			else {
3892				// if there's imgSrc in the settings use it
3893				if(settings.imgSrc != "") {
3894					imgSrc = settings.imgSrc;
3895				}
3896				// create a new image out of the DOM for precise measurements
3897				var bigimg = new Image();
3898				// after the big image has been fully loaded
3899				bigimg.onload = function() {
3900					// take its width and divide by 2
3901					imgWidth = String(parseInt(this.width) * settings.zoomLevel) + "px";
3902					// use it as the background size for the lens
3903					$target.css({"backgroundSize": imgWidth + " auto"});
3904					// use it as the width for the hi-res image itself
3905					$imageTag.css({"width": imgWidth});
3906				}
3907				bigimg.src = imgSrc;
3908			}
3909
3910			var lensStyle = "background-position: 0px 0px;width: " + String(settings.lensSize) + "px;height: " + String(settings.lensSize) + "px;"
3911            				+ "float: left;display: none;border: " + String(settings.borderSize) + "px solid " + settings.borderColor + ";"
3912            				+ "background-repeat: no-repeat;position: absolute;";
3913
3914			var overlayStyle= "position: absolute; width: 100%; height: 100%; left: 0; top: 0; background-position: center center; background-repeat: no-repeat; z-index: 1;"
3915
3916			if(settings.overlayAdapt === true) {
3917				overlayStyle = overlayStyle + "background-position: center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;";
3918			}
3919
3920			switch(settings.lensShape) {
3921				case "square":
3922				case "":
3923				default:
3924					lensStyle = lensStyle + "border-radius:"  + String(settings.borderRadius) + "px;";
3925					overlayStyle = overlayStyle + "border-radius:"  + String(settings.borderRadius) + "px;";
3926				break;
3927				case "circle":
3928					lensStyle = lensStyle + "border-radius: " + String(settings.lensSize / 2 + settings.borderSize) + "px;";
3929					overlayStyle = overlayStyle + "border-radius: " + String(settings.lensSize / 2 + settings.borderSize) + "px;";
3930				break;
3931			}
3932
3933			$target.attr("style", lensStyle);
3934			$imageTag.attr("src", imgSrc);
3935			$imageTag.css({"width": imgWidth});
3936            $target.css({
3937				"backgroundImage": "url('" + imgSrc + "')",
3938				"backgroundSize": imgWidth + " auto",
3939				"cursor": "none"
3940			});
3941
3942			$overlay.attr("style", overlayStyle);
3943			$overlay.css({
3944				"backgroundImage": "url('" + settings.imgOverlay + "')",
3945				"cursor": "none"
3946			});
3947
3948			data.image = $image;
3949			data.target = $target;
3950			data.overlay = $overlay;
3951			data.settings = settings;
3952			data.imgSrc = imgSrc;
3953			data.imageTag = $imageTag;
3954
3955			mlens[id] = data;
3956			return mlens;
3957		},
3958		//function that destroys mlens instance
3959		destroy: function() {
3960			var id = find_instance($(this).attr("data-id"));
3961
3962			data = mlens[id];
3963			data.target.remove();
3964			data.imageTag.remove();
3965			data.imageWrapper.remove();
3966			data.overlay.remove();
3967            $.removeData(data, "mlens");
3968		    this.unbind();
3969		    this.element = null;
3970        }
3971	};
3972
3973	/**
3974	 * service functions
3975	 */
3976
3977	/**
3978	 * function to find mlens actual instance
3979	 * @param {Object} id
3980	 */
3981	function find_instance(id) {
3982		if(typeof(id) === "string")
3983		{
3984			var position = id.indexOf("_");
3985			if(position != -1)
3986			{
3987				id = id.substr(position+1);
3988			}
3989		}
3990		return id;
3991	}
3992
3993	/**
3994	 * function that generates mlens plugin
3995	 * @param {Object} method
3996	 */
3997	$.fn.mlens = function(method) {
3998	    //method calling logic
3999	    if(methods[method]) {
4000	      return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
4001	    }
4002		else if( typeof method === 'object' || !method) {
4003	      return methods.init.apply(this, arguments);
4004	    }
4005		else {
4006	      $.error('Method ' +  method + ' does not exist on jQuery.mlens');
4007	    }
4008  	};
4009})(jQuery);;
4010!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function f(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function l(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(var t in e)if(m(e,t))return;return 1}function r(e){return void 0===e}function h(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function a(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function d(e,t){for(var n=[],s=0;s<e.length;++s)n.push(t(e[s],s));return n}function c(e,t){for(var n in t)m(t,n)&&(e[n]=t[n]);return m(t,"toString")&&(e.toString=t.toString),m(t,"valueOf")&&(e.valueOf=t.valueOf),e}function _(e,t,n,s){return xt(e,t,n,s,!0).utc()}function y(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invali
vendor: 20,484 bytes, line 4010
4010dMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function g(e){if(null==e._isValid){var t=y(e),n=i.call(t.parsedDateParts,function(e){return null!=e}),s=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(s=s&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return s;e._isValid=s}return e._isValid}function w(e){var t=_(NaN);return null!=e?c(y(t),e):y(t).userInvalidated=!0,t}i=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};var p=f.momentProperties=[],t=!1;function v(e,t){var n,s,i;if(r(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),r(t._i)||(e._i=t._i),r(t._f)||(e._f=t._f),r(t._l)||(e._l=t._l),r(t._strict)||(e._strict=t._strict),r(t._tzm)||(e._tzm=t._tzm),r(t._isUTC)||(e._isUTC=t._isUTC),r(t._offset)||(e._offset=t._offset),r(t._pf)||(e._pf=y(t)),r(t._locale)||(e._locale=t._locale),0<p.length)for(n=0;n<p.length;n++)r(i=t[s=p[n]])||(e[s]=i);return e}function k(e){v(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===t&&(t=!0,f.updateOffset(this),t=!1)}function M(e){return e instanceof k||null!=e&&null!=e._isAMomentObject}function D(e){!1===f.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function n(i,r){var a=!0;return c(function(){if(null!=f.deprecationHandler&&f.deprecationHandler(null,i),a){for(var e,t,n=[],s=0;s<arguments.length;s++){if(e="","object"==typeof arguments[s]){for(t in e+="\n["+s+"] ",arguments[0])m(arguments[0],t)&&(e+=t+": "+arguments[0][t]+", ");e=e.slice(0,-2)}else e=arguments[s];n.push(e)}D(i+"\nArguments: "+Array.prototype.slice.call(n).join("")+"\n"+(new Error).stack),a=!1}return r.apply(this,arguments)},r)}var s,S={};function Y(e,t){null!=f.deprecationHandler&&f.deprecationHandler(e,t),S[e]||(D(t),S[e]=!0)}function O(e){return"undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function b(e,t){var n,s=c({},e);for(n in t)m(t,n)&&(u(e[n])&&u(t[n])?(s[n]={},c(s[n],e[n]),c(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)m(e,n)&&!m(t,n)&&u(e[n])&&(s[n]=c({},s[n]));return s}function x(e){null!=e&&this.set(e)}f.suppressDeprecationWarnings=!1,f.deprecationHandler=null,s=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)m(e,t)&&n.push(t);return n};function T(e,t,n){var s=""+Math.abs(e),i=t-s.length;return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}var N=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,P=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,R={},W={};function C(e,t,n,s){var i="string"==typeof s?function(){return this[s]()}:s;e&&(W[e]=i),t&&(W[t[0]]=function(){return T(i.apply(this,arguments),t[1],t[2])}),n&&(W[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function U(e,t){return e.isValid()?(t=H(t,e.localeData()),R[t]=R[t]||function(s){for(var e,i=s.match(N),t=0,r=i.length;t<r;t++)W[i[t]]?i[t]=W[i[t]]:i[t]=(e=i[t]).match(/\[[\s\S]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"");return function(e){for(var t="",n=0;n<r;n++)t+=O(i[n])?i[n].call(e,s):i[n];return t}}(t),R[t](e)):e.localeData().invalidDate()}function H(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(P.lastIndex=0;0<=n&&P.test(e);)e=e.replace(P,s),P.lastIndex=0,--n;return e}var F={};function L(e,t){var n=e.toLowerCase();F[n]=F[n+"s"]=F[t]=e}function V(e){return"string"==typeof e?F[e]||F[e.toLowerCase()]:void 0}function G(e){var t,n,s={};for(n in e)m(e,n)&&(t=V(n))&&(s[t]=e[n]);return s}var E={};function A(e,t){E[e]=t}function j(e){return e%4==0&&e%100!=0||e%400==0}function I(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function Z(e){var t=+e,n=0;return 0!=t&&isFinite(t)&&(n=I(t)),n}function z(t,n){return function(e){return null!=e?(q(this,t,e),f.updateOffset(this,n),this):$(this,t)}}function $(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function q(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&j(e.year())&&1===e.month()&&29===e.date()?(n=Z(n),e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),xe(n,e.month()))):e._d["set"+(e._isUTC?"UTC":"")+t](n))}var B,J=/\d/,Q=/\d\d/,X=/\d{3}/,K=/\d{4}/,ee=/[+-]?\d{6}/,te=/\d\d?/,ne=/\d\d\d\d?/,se=/\d\d\d\d\d\d?/,ie=/\d{1,3}/,re=/\d{1,4}/,ae=/[+-]?\d{1,6}/,oe=/\d+/,ue=/[+-]?\d+/,le=/Z|[+-]\d\d:?\d\d/gi,he=/Z|[+-]\d\d(?::?\d\d)?/gi,de=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;function ce(e,n,s){B[e]=O(n)?n:function(e,t){return e&&s?s:n}}function fe(e,t){return m(B,e)?B[e](t._strict,t._locale):new RegExp(me(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function me(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}B={};var _e={};function ye(e,n){var t,s=n;for("string"==typeof e&&(e=[e]),h(n)&&(s=function(e,t){t[n]=Z(e)}),t=0;t<e.length;t++)_e[e[t]]=s}function ge(e,i){ye(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var we,pe=0,ve=1,ke=2,Me=3,De=4,Se=5,Ye=6,Oe=7,be=8;function xe(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,s=(t%(n=12)+n)%n;return e+=(t-s)/12,1==s?j(e)?29:28:31-s%7%2}we=Array.prototype.indexOf?Array.prototype.indexOf:function(e){for(var t=0;t<this.length;++t)if(this[t]===e)return t;return-1},C("M",["MM",2],"Mo",function(){return this.month()+1}),C("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),C("MMMM",0,0,function(e){return this.localeData().months(this,e)}),L("month","M"),A("month",8),ce("M",te),ce("MM",te,Q),ce("MMM",function(e,t){return t.monthsShortRegex(e)}),ce("MMMM",function(e,t){return t.monthsRegex(e)}),ye(["M","MM"],function(e,t){t[ve]=Z(e)-1}),ye(["MMM","MMMM"],function(e,t,n,s){var i=n._locale.monthsParse(e,s,n._strict);null!=i?t[ve]=i:y(n).invalidMonth=e});var Te="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Ne="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),Pe=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Re=de,We=de;function Ce(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=Z(t);else if(!h(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),xe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function Ue(e){return null!=e?(Ce(this,e),f.updateOffset(this,!0),this):$(this,"Month")}function He(){function e(e,t){return t.length-e.length}for(var t,n=[],s=[],i=[],r=0;r<12;r++)t=_([2e3,r]),n.push(this.monthsShort(t,"")),s.push(this.months(t,"")),i.push(this.months(t,"")),i.push(this.monthsShort(t,""));for(n.sort(e),s.sort(e),i.sort(e),r=0;r<12;r++)n[r]=me(n[r]),s[r]=me(s[r]);for(r=0;r<24;r++)i[r]=me(i[r]);this._monthsRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+n.join("|")+")","i")}function Fe(e){return j(e)?366:365}C("Y",0,0,function(){var e=this.year();return e<=9999?T(e,4):"+"+e}),C(0,["YY",2],0,function(){return this.year()%100}),C(0,["YYYY",4],0,"year"),C(0,["YYYYY",5],0,"year"),C(0,["YYYYYY",6,!0],0,"year"),L("year","y"),A("year",1),ce("Y",ue),ce("YY",te,Q),ce("YYYY",re,K),ce("YYYYY",ae,ee),ce("YYYYYY",ae,ee),ye(["YYYYY","YYYYYY"],pe),ye("YYYY",function(e,t){t[pe]=2===e.length?f.parseTwoDigitYear(e):Z(e)}),ye("YY",function(e,t){t[pe]=f.parseTwoDigitYear(e)}),ye("Y",function(e,t){t[pe]=parseInt(e,10)}),f.parseTwoDigitYear=function(e){return Z(e)+(68<Z(e)?1900:2e3)};var Le=z("FullYear",!0);function Ve(e){var t,n;return e<100&&0<=e?((n=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Ge(e,t,n){var s=7+t-n;return s-(7+Ve(e,0,s).getUTCDay()-t)%7-1}function Ee(e,t,n,s,i){var r,a=1+7*(t-1)+(7+n-s)%7+Ge(e,s,i),o=a<=0?Fe(r=e-1)+a:a>Fe(e)?(r=e+1,a-Fe(e)):(r=e,a);return{year:r,dayOfYear:o}}function Ae(e,t,n){var s,i,r=Ge(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+je(i=e.year()-1,t,n):a>je(e.year(),t,n)?(s=a-je(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function je(e,t,n){var s=Ge(e,t,n),i=Ge(e+1,t,n);return(Fe(e)-s+i)/7}C("w",["ww",2],"wo","week"),C("W",["WW",2],"Wo","isoWeek"),L("week","w"),L("isoWeek","W"),A("week",5),A("isoWeek",5),ce("w",te),ce("ww",te,Q),ce("W",te),ce("WW",te,Q),ge(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=Z(e)});function Ie(e,t){return e.slice(t,7).concat(e.slice(0,t))}C("d",0,"do","day"),C("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),C("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),C("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),C("e",0,0,"weekday"),C("E",0,0,"isoWeekday"),L("day","d"),L("weekday","e"),L("isoWeekday","E"),A("day",11),A("weekday",11),A("isoWeekday",11),ce("d",te),ce("e",te),ce("E",te),ce("dd",function(e,t){return t.weekdaysMinRegex(e)}),ce("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ce("dddd",function(e,t){return t.weekdaysRegex(e)}),ge(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:y(n).invalidWeekday=e}),ge(["d","e","E"],function(e,t,n,s){t[s]=Z(e)});var Ze="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),$e="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),qe=de,Be=de,Je=de;function Qe(){function e(e,t){return t.length-e.length}for(var t,n,s,i,r=[],a=[],o=[],u=[],l=0;l<7;l++)t=_([2e3,1]).day(l),n=me(this.weekdaysMin(t,"")),s=me(this.weekdaysShort(t,"")),i=me(this.weekdays(t,"")),r.push(n),a.push(s),o.push(i),u.push(n),u.push(s),u.push(i);r.sort(e),a.sort(e),o.sort(e),u.sort(e),this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Xe(){return this.hours()%12||12}function Ke(e,t){C(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function et(e,t){return t._meridiemParse}C("H",["HH",2],0,"hour"),C("h",["hh",2],0,Xe),C("k",["kk",2],0,function(){return this.hours()||24}),C("hmm",0,0,function(){return""+Xe.apply(this)+T(this.minutes(),2)}),C("hmmss",0,0,function(){return""+Xe.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),C("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),C("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),Ke("a",!0),Ke("A",!1),L("hour","h"),A("hour",13),ce("a",et),ce("A",et),ce("H",te),ce("h",te),ce("k",te),ce("HH",te,Q),ce("hh",te,Q),ce("kk",te,Q),ce("hmm",ne),ce("hmmss",se),ce("Hmm",ne),ce("Hmmss",se),ye(["H","HH"],Me),ye(["k","kk"],function(e,t,n){var s=Z(e);t[Me]=24===s?0:s}),ye(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ye(["h","hh"],function(e,t,n){t[Me]=Z(e),y(n).bigHour=!0}),ye("hmm",function(e,t,n){var s=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s)),y(n).bigHour=!0}),ye("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s,2)),t[Se]=Z(e.substr(i)),y(n).bigHour=!0}),ye("Hmm",function(e,t,n){var s=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s))}),ye("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[Me]=Z(e.substr(0,s)),t[De]=Z(e.substr(s,2)),t[Se]=Z(e.substr(i))});var tt=z("Hours",!0);var nt,st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Te,monthsShort:Ne,week:{dow:0,doy:6},weekdays:Ze,weekdaysMin:$e,weekdaysShort:ze,meridiemParse:/[ap]\.?m?\.?/i},it={},rt={};function at(e){return e?e.toLowerCase().replace("_","-"):e}function ot(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=at(e[r]).split("-")).length,n=(n=at(e[r+1]))?n.split("-"):null;0<t;){if(s=ut(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&function(e,t){for(var n=Math.min(e.length,t.length),s=0;s<n;s+=1)if(e[s]!==t[s])return s;return n}(i,n)>=t-1)break;t--}r++}return nt}function ut(t){var e;if(void 0===it[t]&&"undefined"!=typeof module&&module&&module.exports)try{e=nt._abbr,require("./locale/"+t),lt(e)}catch(e){it[t]=null}return it[t]}function lt(e,t){var n;return e&&((n=r(t)?dt(e):ht(e,t))?nt=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),nt._abbr}function ht(e,t){if(null===t)return delete it[e],null;var n,s=st;if(t.abbr=e,null!=it[e])Y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=it[e]._config;else if(null!=t.parentLocale)if(null!=it[t.parentLocale])s=it[t.parentLocale]._config;else{if(null==(n=ut(t.parentLocale)))return rt[t.parentLocale]||(rt[t.parentLocale]=[]),rt[t.parentLocale].push({name:e,config:t}),null;s=n._config}return it[e]=new x(b(s,t)),rt[e]&&rt[e].forEach(function(e){ht(e.name,e.config)}),lt(e),it[e]}function dt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return nt;if(!o(e)){if(t=ut(e))return t;e=[e]}return ot(e)}function ct(e){var t,n=e._a;return n&&-2===y(e).overflow&&(t=n[ve]<0||11<n[ve]?ve:n[ke]<1||n[ke]>xe(n[pe],n[ve])?ke:n[Me]<0||24<n[Me]||24===n[Me]&&(0!==n[De]||0!==n[Se]||0!==n[Ye])?Me:n[De]<0||59<n[De]?De:n[Se]<0||59<n[Se]?Se:n[Ye]<0||999<n[Ye]?Ye:-1,y(e)._overflowDayOfYear&&(t<pe||ke<t)&&(t=ke),y(e)._overflowWeeks&&-1===t&&(t=Oe),y(e)._overflowWeekday&&-1===t&&(t=be),y(e).overflow=t),e}var ft=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,mt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/Z|[+-]\d\d(?::?\d\d)?/,yt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],gt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],wt=/^\/?Date\((-?\d+)/i,pt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,vt={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function kt(e){var t,n,s,i,r,a,o=e._i,u=ft.exec(o)||mt.exec(o);if(u){for(y(e).iso=!0,t=0,n=yt.length;t<n;t++)if(yt[t][1].exec(u[1])){i=yt[t][0],s=!1!==yt[t][2];break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=gt.length;t<n;t++)if(gt[t][1].exec(u[3])){r=(u[2]||" ")+gt[t][0];break}if(null==r)return void(e._isValid=!1)}if(!s&&null!=r)return void(e._isValid=!1);if(u[4]){if(!_t.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),Ot(e)}else e._isValid=!1}function Mt(e,t,n,s,i,r){var a=[function(e){var t=parseInt(e,10);{if(t<=49)return 2e3+t;if(t<=999)return 1900+t}return t}(e),Ne.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&a.push(parseInt(r,10)),a}function Dt(e){var t,n,s,i,r=pt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(r){if(t=Mt(r[4],r[3],r[2],r[5],r[6],r[7]),n=r[1],s=t,i=e,n&&ze.indexOf(n)!==new Date(s[0],s[1],s[2]).getDay()&&(y(i).weekdayMismatch=!0,!void(i._isValid=!1)))return;e._a=t,e._tzm=function(e,t,n){if(e)return vt[e];if(t)return 0;var s=parseInt(n,10),i=s%100;return 60*((s-i)/100)+i}(r[8],r[9],r[10]),e._d=Ve.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),y(e).rfc2822=!0}else e._isValid=!1}function St(e,t,n){return null!=e?e:null!=t?t:n}function Yt(e){var t,n,s,i,r,a,o,u=[];if(!e._d){for(a=e,o=new Date(f.now()),s=a._useUTC?[o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate()]:[o.getFullYear(),o.getMonth(),o.getDate()],e._w&&null==e._a[ke]&&null==e._a[ve]&&function(e){var t,n,s,i,r,a,o,u,l;null!=(t=e._w).GG||null!=t.W||null!=t.E?(r=1,a=4,n=St(t.GG,e._a[pe],Ae(Tt(),1,4).year),s=St(t.W,1),((i=St(t.E,1))<1||7<i)&&(u=!0)):(r=e._locale._week.dow,a=e._locale._week.doy,l=Ae(Tt(),r,a),n=St(t.gg,e._a[pe],l.year),s=St(t.w,l.week),null!=t.d?((i=t.d)<0||6<i)&&(u=!0):null!=t.e?(i=t.e+r,(t.e<0||6<t.e)&&(u=!0)):i=r);s<1||s>je(n,r,a)?y(e)._overflowWeeks=!0:null!=u?y(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[pe]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=St(e._a[pe],s[pe]),(e._dayOfYear>Fe(r)||0===e._dayOfYear)&&(y(e)._overflowDayOfYear=!0),n=Ve(r,0,e._dayOfYear),e._a[ve]=n.getUTCMonth(),e._a[ke]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=u[t]=s[t];for(;t<7;t++)e._a[t]=u[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[Me]&&0===e._a[De]&&0===e._a[Se]&&0===e._a[Ye]&&(e._nextDay=!0,e._a[Me]=0),e._d=(e._useUTC?Ve:function(e,t,n,s,i,r,a){var o;return e<100&&0<=e?(o=new Date(e+400,t,n,s,i,r,a),isFinite(o.getFullYear())&&o.setFullYear(e)):o=new Date(e,t,n,s,i,r,a),o}).apply(null,u),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[Me]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(y(e).weekdayMismatch=!0)}}function Ot(e){if(e._f!==f.ISO_8601)if(e._f!==f.RFC_2822){e._a=[],y(e).empty=!0;for(var t,n,s,i,r,a,o,u=""+e._i,l=u.length,h=0,d=H(e._f,e._locale).match(N)||[],c=0;c<d.length;c++)n=d[c],(t=(u.match(fe(n,e))||[])[0])&&(0<(s=u.substr(0,u.indexOf(t))).length&&y(e).unusedInput.push(s),u=u.slice(u.indexOf(t)+t.length),h+=t.length),W[n]?(t?y(e).empty=!1:y(e).unusedTokens.push(n),r=n,o=e,null!=(a=t)&&m(_e,r)&&_e[r](a,o._a,o,r)):e._strict&&!t&&y(e).unusedTokens.push(n);y(e).charsLeftOver=l-h,0<u.length&&y(e).unusedInput.push(u),e._a[Me]<=12&&!0===y(e).bigHour&&0<e._a[Me]&&(y(e).bigHour=void 0),y(e).parsedDateParts=e._a.slice(0),y(e).meridiem=e._meridiem,e._a[Me]=function(e,t,n){var s;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):(null!=e.isPM&&((s=e.isPM(n))&&t<12&&(t+=12),s||12!==t||(t=0)),t)}(e._locale,e._a[Me],e._meridiem),null!==(i=y(e).era)&&(e._a[pe]=e._locale.erasConvertYear(i,e._a[pe])),Yt(e),ct(e)}else Dt(e);else kt(e)}function bt(e){var t,n,s=e._i,i=e._f;return e._locale=e._locale||dt(e._l),null===s||void 0===i&&""===s?w({nullInput:!0}):("string"==typeof s&&(e._i=s=e._locale.preparse(s)),M(s)?new k(ct(s)):(a(s)?e._d=s:o(i)?function(e){var t,n,s,i,r,a,o=!1;if(0===e._f.length)return y(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<e._f.length;i++)r=0,a=!1,t=v({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],Ot(t),g(t)&&(a=!0),r+=y(t).charsLeftOver,r+=10*y(t).unusedTokens.length,y(t).score=r,o?r<s&&(s=r,n=t):(null==s||r<s||a)&&(s=r,n=t,a&&(o=!0));c(e,n||t)}(e):i?Ot(e):r(n=(t=e)._i)?t._d=new Date(f.now()):a(n)?t._d=new Date(n.valueOf()):"string"==typeof n?function(e){var t=wt.exec(e._i);
vendor: 5,079 bytes, line 4010
4010null===t?(kt(e),!1===e._isValid&&(delete e._isValid,Dt(e),!1===e._isValid&&(delete e._isValid,e._strict?e._isValid=!1:f.createFromInputFallback(e)))):e._d=new Date(+t[1])}(t):o(n)?(t._a=d(n.slice(0),function(e){return parseInt(e,10)}),Yt(t)):u(n)?function(e){var t,n;e._d||(n=void 0===(t=G(e._i)).day?t.date:t.day,e._a=d([t.year,t.month,n,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),Yt(e))}(t):h(n)?t._d=new Date(n):f.createFromInputFallback(t),g(e)||(e._d=null),e))}function xt(e,t,n,s,i){var r,a={};return!0!==t&&!1!==t||(s=t,t=void 0),!0!==n&&!1!==n||(s=n,n=void 0),(u(e)&&l(e)||o(e)&&0===e.length)&&(e=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=i,a._l=n,a._i=e,a._f=t,a._strict=s,(r=new k(ct(bt(a))))._nextDay&&(r.add(1,"d"),r._nextDay=void 0),r}function Tt(e,t,n,s){return xt(e,t,n,s,!1)}f.createFromInputFallback=n("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),f.ISO_8601=function(){},f.RFC_2822=function(){};var Nt=n("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=Tt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:w()}),Pt=n("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=Tt.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:w()});function Rt(e,t){var n,s;if(1===t.length&&o(t[0])&&(t=t[0]),!t.length)return Tt();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Wt=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ct(e){var t=G(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.week||t.isoWeek||0,a=t.day||0,o=t.hour||0,u=t.minute||0,l=t.second||0,h=t.millisecond||0;this._isValid=function(e){var t,n,s=!1;for(t in e)if(m(e,t)&&(-1===we.call(Wt,t)||null!=e[t]&&isNaN(e[t])))return!1;for(n=0;n<Wt.length;++n)if(e[Wt[n]]){if(s)return!1;parseFloat(e[Wt[n]])!==Z(e[Wt[n]])&&(s=!0)}return!0}(t),this._milliseconds=+h+1e3*l+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+i+3*s+12*n,this._data={},this._locale=dt(),this._bubble()}function Ut(e){return e instanceof Ct}function Ht(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){C(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+T(~~(e/60),2)+n+T(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),ce("Z",he),ce("ZZ",he),ye(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Vt(he,e)});var Lt=/([\+\-]|\d\d)/gi;function Vt(e,t){var n,s,i=(t||"").match(e);return null===i?null:0===(s=60*(n=((i[i.length-1]||[])+"").match(Lt)||["-",0,0])[1]+Z(n[2]))?0:"+"===n[0]?s:-s}function Gt(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(M(e)||a(e)?e.valueOf():Tt(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),f.updateOffset(n,!1),n):Tt(e).local()}function Et(e){return-Math.round(e._d.getTimezoneOffset())}function At(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}f.updateOffset=function(){};var jt=/^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,It=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Zt(e,t){var n,s,i,r=e,a=null;return Ut(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:h(e)||!isNaN(+e)?(r={},t?r[t]=+e:r.milliseconds=+e):(a=jt.exec(e))?(n="-"===a[1]?-1:1,r={y:0,d:Z(a[ke])*n,h:Z(a[Me])*n,m:Z(a[De])*n,s:Z(a[Se])*n,ms:Z(Ht(1e3*a[Ye]))*n}):(a=It.exec(e))?(n="-"===a[1]?-1:1,r={y:zt(a[2],n),M:zt(a[3],n),w:zt(a[4],n),d:zt(a[5],n),h:zt(a[6],n),m:zt(a[7],n),s:zt(a[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(i=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Gt(t,e),e.isBefore(t)?n=$t(e,t):((n=$t(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(Tt(r.from),Tt(r.to)),(r={}).ms=i.milliseconds,r.M=i.months),s=new Ct(r),Ut(e)&&m(e,"_locale")&&(s._locale=e._locale),Ut(e)&&m(e,"_isValid")&&(s._isValid=e._isValid),s}function zt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function $t(e,t){var n={};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=t-e.clone().add(n.months,"M"),n}function qt(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(Y(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),Bt(this,Zt(e,t),s),this}}function Bt(e,t,n,s){var i=t._milliseconds,r=Ht(t._days),a=Ht(t._months);e.isValid()&&(s=null==s||s,a&&Ce(e,$(e,"Month")+a*n),r&&q(e,"Date",$(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s&&f.updateOffset(e,r||a))}
4010Zt.fn=Ct.prototype,Zt.invalid=function(){return Zt(NaN)};var Jt=qt(1,"add"),Qt=qt(-1,"subtract");function Xt(e){return"string"==typeof e||e instanceof String}function Kt(e){return M(e)||a(e)||Xt(e)||h(e)||function(t){var e=o(t),n=!1;e&&(n=0===t.filter(function(e){return!h(e)&&Xt(t)}).length);return e&&n}(e)||function(e){var t,n,s=u(e)&&!l(e),i=!1,r=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"];for(t=0;t<r.length;t+=1)n=r[t],i=i||m(e,n);return s&&i}(e)||null==e}function en(e,t){if(e.date()<t.date())return-en(t,e);var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(n,"months"),i=t-s<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(1+n,"months")-s);return-(n+i)||0}function tn(e){var t;return void 0===e?this._locale._abbr:(null!=(t=dt(e))&&(this._locale=t),this)}f.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",f.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var nn=n("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function sn(){return this._locale}var rn=126227808e5;function an(e,t){return(e%t+t)%t}function on(e,t,n){return e<100&&0<=e?new Date(e+400,t,n)-rn:new Date(e,t,n).valueOf()}function un(e,t,n){return e<100&&0<=e?Date.UTC(e+400,t,n)-rn:Date.UTC(e,t,n)}function ln(e,t){return t.erasAbbrRegex(e)}function hn(){for(var e=[],t=[],n=[],s=[],i=this.eras(),r=0,a=i.length;r<a;++r)t.push(me(i[r].name)),e.push(me(i[r].abbr)),n.push(me(i[r].narrow)),s.push(me(i[r].name)),s.push(me(i[r].abbr)),s.push(me(i[r].narrow));this._erasRegex=new RegExp("^("+s.join("|")+")","i"),this._erasNameRegex=new RegExp("^("+t.join("|")+")","i"),this._erasAbbrRegex=new RegExp("^("+e.join("|")+")","i"),this._erasNarrowRegex=new RegExp("^("+n.join("|")+")","i")}function dn(e,t){C(0,[e,e.length],0,t)}function cn(e,t,n,s,i){var r;return null==e?Ae(this,s,i).year:((r=je(e,s,i))<t&&(t=r),function(e,t,n,s,i){var r=Ee(e,t,n,s,i),a=Ve(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}.call(this,e,t,n,s,i))}C("N",0,0,"eraAbbr"),C("NN",0,0,"eraAbbr"),C("NNN",0,0,"eraAbbr"),C("NNNN",0,0,"eraName"),C("NNNNN",0,0,"eraNarrow"),C("y",["y",1],"yo","eraYear"),C("y",["yy",2],0,"eraYear"),C("y",["yyy",3],0,"eraYear"),C("y",["yyyy",4],0,"eraYear"),ce("N",ln),ce("NN",ln),ce("NNN",ln),ce("NNNN",function(e,t){return t.erasNameRegex(e)}),ce("NNNNN",function(e,t){return t.erasNarrowRegex(e)}),ye(["N","NN","NNN","NNNN","NNNNN"],function(e,t,n,s){var i=n._locale.erasParse(e,s,n._strict);i?y(n).era=i:y(n).invalidEra=e}),ce("y",oe),ce("yy",oe),ce("yyy",oe),ce("yyyy",oe),ce("yo",function(e,t){return t._eraYearOrdinalRegex||oe}),ye(["y","yy","yyy","yyyy"],pe),ye(["yo"],function(e,t,n,s){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[pe]=n._locale.eraYearOrdinalParse(e,i):t[pe]=parseInt(e,10)}),C(0,["gg",2],0,function(){return this.weekYear()%100}),C(0,["GG",2],0,function(){return this.isoWeekYear()%100}),dn("gggg","weekYear"),dn("ggggg","weekYear"),dn("GGGG","isoWeekYear"),dn("GGGGG","isoWeekYear"),L("weekYear","gg"),L("isoWeekYear","GG"),A("weekYear",1),A("isoWeekYear",1),ce("G",ue),ce("g",ue),ce("GG",te,Q),ce("gg",te,Q),ce("GGGG",re,K),ce("gggg",re,K),ce("GGGGG",ae,ee),ce("ggggg",ae,ee),ge(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=Z(e)}),ge(["gg","GG"],function(e,t,n,s){t[s]=f.parseTwoDigitYear(e)}),C("Q",0,"Qo","quarter"),L("quarter","Q"),A("quarter",7),ce("Q",J),ye("Q",function(e,t){t[ve]=3*(Z(e)-1)}),C("D",["DD",2],"Do","date"),L("date","D"),A("date",9),ce("D",te),ce("DD",te,Q),ce("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),ye(["D","DD"],ke),ye("Do",function(e,t){t[ke]=Z(e.match(te)[0])});var fn=z("Date",!0);C("DDD",["DDDD",3],"DDDo","dayOfYear"),L("dayOfYear","DDD"),A("dayOfYear",4),ce("DDD",ie),ce("DDDD",X),ye(["DDD","DDDD"],function(e,t,n){n._dayOfYear=Z(e)}),C("m",["mm",2],0,"minute"),L("minute","m"),A("minute",14),ce("m",te),ce("mm",te,Q),ye(["m","mm"],De);var mn=z("Minutes",!1);C("s",["ss",2],0,"second"),L("second","s"),A("second",15),ce("s",te),ce("ss",te,Q),ye(["s","ss"],Se);var _n,yn,gn=z("Seconds",!1);for(C("S",0,0,function(){return~~(this.millisecond()/100)}),C(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),C(0,["SSS",3],0,"millisecond"),C(0,["SSSS",4],0,function(){return 10*this.millisecond()}),C(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),C(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),C(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),C(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),C(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),L("millisecond","ms"),A("millisecond",16),ce("S",ie,J),ce("SS",ie,Q),ce("SSS",ie,X),_n="SSSS";_n.length<=9;_n+="S")ce(_n,oe);
vendor: 5,376 bytes, line 4010
4010function wn(e,t){t[Ye]=Z(1e3*("0."+e))}for(_n="S";_n.length<=9;_n+="S")ye(_n,wn);yn=z("Milliseconds",!1),C("z",0,0,"zoneAbbr"),C("zz",0,0,"zoneName");var pn=k.prototype;function vn(e){return e}pn.add=Jt,pn.calendar=function(e,t){1===arguments.length&&(arguments[0]?Kt(arguments[0])?(e=arguments[0],t=void 0):function(e){for(var t=u(e)&&!l(e),n=!1,s=["sameDay","nextDay","lastDay","nextWeek","lastWeek","sameElse"],i=0;i<s.length;i+=1)n=n||m(e,s[i]);return t&&n}(arguments[0])&&(t=arguments[0],e=void 0):t=e=void 0);var n=e||Tt(),s=Gt(n,this).startOf("day"),i=f.calendarFormat(this,s)||"sameElse",r=t&&(O(t[i])?t[i].call(this,n):t[i]);return this.format(r||this.localeData().calendar(i,this,Tt(n)))},pn.clone=function(){return new k(this)},pn.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Gt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=V(t)){case"year":r=en(this,s)/12;break;case"month":r=en(this,s);break;case"quarter":r=en(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:I(r)},pn.endOf=function(e){var t,n;if(void 0===(e=V(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?un:on,e){case"year":t=n(this.year()+1,0,1)-1;break;case"quarter":t=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":t=n(this.year(),this.month()+1,1)-1;break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":t=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":t=this._d.valueOf(),t+=36e5-an(t+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":t=this._d.valueOf(),t+=6e4-an(t,6e4)-1;break;case"second":t=this._d.valueOf(),t+=1e3-an(t,1e3)-1;break}return this._d.setTime(t),f.updateOffset(this,!0),this},pn.format=function(e){e=e||(this.isUtc()?f.defaultFormatUtc:f.defaultFormat);var t=U(this,e);return this.localeData().postformat(t)},pn.from=function(e,t){return this.isValid()&&(M(e)&&e.isValid()||Tt(e).isValid())?Zt({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},pn.fromNow=function(e){return this.from(Tt(),e)},pn.to=function(e,t){return this.isValid()&&(M(e)&&e.isValid()||Tt(e).isValid())?Zt({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},pn.toNow=function(e){return this.to(Tt(),e)},pn.get=function(e){return O(this[e=V(e)])?this[e]():this},pn.invalidAt=function(){return y(this).overflow},pn.isAfter=function(e,t){var n=M(e)?e:Tt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=V(t)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},pn.isBefore=function(e,t){var n=M(e)?e:Tt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=V(t)||"millisecond")?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},pn.isBetween=function(e,t,n,s){var i=M(e)?e:Tt(e),r=M(t)?t:Tt(t);return!!(this.isValid()&&i.isValid()&&r.isValid())&&(("("===(s=s||"()")[0]?this.isAfter(i,n):!this.isBefore(i,n))&&(")"===s[1]?this.isBefore(r,n):!this.isAfter(r,n)))},pn.isSame=function(e,t){var n,s=M(e)?e:Tt(e);return!(!this.isValid()||!s.isValid())&&("millisecond"===(t=V(t)||"millisecond")?this.valueOf()===s.valueOf():(n=s.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},pn.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},pn.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},pn.isValid=function(){return g(this)},pn.lang=nn,pn.locale=tn,pn.localeData=sn,pn.max=Pt,pn.min=Nt,pn.parsingFlags=function(){return c({},y(this))},pn.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t,n=[];for(t in e)m(e,t)&&n.push({unit:t,priority:E[t]});return n.sort(function(e,t){return e.priority-t.priority}),n}(e=G(e)),s=0;s<n.length;s++)this[n[s].unit](e[n[s].unit]);else if(O(this[e=V(e)]))return this[e](t);return this},pn.startOf=function(e){var t,n;if(void 0===(e=V(e))||"millisecond"===e||!this.isValid())return this;switch(n=this._isUTC?un:on,e){case"year":t=n(this.year(),0,1);break;case"quarter":t=n(this.year(),this.month()-this.month()%3,1);break;case"month":t=n(this.year(),this.month(),1);break;case"week":t=n(this.year(),this.month(),this.date()-this.weekday());break;case"isoWeek":t=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1));break;case"day":case"date":t=n(this.year(),this.month(),this.date());break;case"hour":t=this._d.valueOf(),t-=an(t+(this._isUTC?0:6e4*this.utcOffset()),36e5);break;case"minute":t=this._d.valueOf(),t-=an(t,6e4);break;case"second":t=this._d.valueOf(),t-=an(t,1e3);break}return this._d.setTime(t),f.updateOffset(this,!0),this},pn.subtract=Qt,pn.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},pn.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},pn.toDate=function(){return new Date(this.valueOf())},pn.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;
vendor: 15,224 bytes, line 4010
4010return n.year()<0||9999<n.year()?U(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):O(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",U(n,"Z")):U(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},pn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,n,s="moment",i="";return this.isLocal()||(s=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),e="["+s+'("]',t=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n=i+'[")]',this.format(e+t+"-MM-DD[T]HH:mm:ss.SSS"+n)},"undefined"!=typeof Symbol&&null!=Symbol.for&&(pn[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),pn.toJSON=function(){return this.isValid()?this.toISOString():null},pn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},pn.unix=function(){return Math.floor(this.valueOf()/1e3)},pn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},pn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},pn.eraName=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].name;if(t[n].until<=e&&e<=t[n].since)return t[n].name}return""},pn.eraNarrow=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].narrow;if(t[n].until<=e&&e<=t[n].since)return t[n].narrow}return""},pn.eraAbbr=function(){for(var e,t=this.localeData().eras(),n=0,s=t.length;n<s;++n){if(e=this.clone().startOf("day").valueOf(),t[n].since<=e&&e<=t[n].until)return t[n].abbr;if(t[n].until<=e&&e<=t[n].since)return t[n].abbr}return""},pn.eraYear=function(){for(var e,t,n=this.localeData().eras(),s=0,i=n.length;s<i;++s)if(e=n[s].since<=n[s].until?1:-1,t=this.clone().startOf("day").valueOf(),n[s].since<=t&&t<=n[s].until||n[s].until<=t&&t<=n[s].since)return(this.year()-f(n[s].since).year())*e+n[s].offset;return this.year()},pn.year=Le,pn.isLeapYear=function(){return j(this.year())},pn.weekYear=function(e){return cn.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},pn.isoWeekYear=function(e){return cn.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},pn.quarter=pn.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},pn.month=Ue,pn.daysInMonth=function(){return xe(this.year(),this.month())},pn.week=pn.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},pn.isoWeek=pn.isoWeeks=function(e){var t=Ae(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},pn.weeksInYear=function(){var e=this.localeData()._week;return je(this.year(),e.dow,e.doy)},pn.weeksInWeekYear=function(){var e=this.localeData()._week;return je(this.weekYear(),e.dow,e.doy)},pn.isoWeeksInYear=function(){return je(this.year(),1,4)},pn.isoWeeksInISOWeekYear=function(){return je(this.isoWeekYear(),1,4)},pn.date=fn,pn.day=pn.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},pn.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},pn.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null==e)return this.day()||7;var t,n,s=(t=e,n=this.localeData(),"string"==typeof t?n.weekdaysParse(t)%7||7:isNaN(t)?null:t);return this.day(this.day()%7?s:s-7)},pn.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},pn.hour=pn.hours=tt,pn.minute=pn.minutes=mn,pn.second=pn.seconds=gn,pn.millisecond=pn.milliseconds=yn,pn.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null==e)return this._isUTC?i:Et(this);if("string"==typeof e){if(null===(e=Vt(he,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Et(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?Bt(this,Zt(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,f.updateOffset(this,!0),this._changeInProgress=null)),this},pn.utc=function(e){return this.utcOffset(0,e)},pn.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Et(this),"m")),this},pn.parseZone=function(){var e;return null!=this._tzm?this.utcOffset(this._tzm,!1,!0):"string"==typeof this._i&&(null!=(e=Vt(le,this._i))?this.utcOffset(e):this.utcOffset(0,!0)),this},pn.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?Tt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},pn.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},pn.isLocal=function(){return!!this.isValid()&&!this._isUTC},pn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},pn.isUtc=At,pn.isUTC=At,pn.zoneAbbr=function(){return this._isUTC?"UTC":""},pn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},pn.dates=n("dates accessor is deprecated. Use date instead.",fn),pn.months=n("months accessor is deprecated. Use month instead",Ue),pn.years=n("years accessor is deprecated. Use year instead",Le),pn.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),pn.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!r(this._isDSTShifted))return this._isDSTShifted;var e,t={};return v(t,this),(t=bt(t))._a?(e=(t._isUTC?_:Tt)(t._a),this._isDSTShifted=this.isValid()&&0<function(e,t,n){for(var s=Math.min(e.length,t.length),i=Math.abs(e.length-t.length),r=0,a=0;a<s;a++)(n&&e[a]!==t[a]||!n&&Z(e[a])!==Z(t[a]))&&r++;return r+i}(t._a,e.toArray())):this._isDSTShifted=!1,this._isDSTShifted});var kn=x.prototype;function Mn(e,t,n,s){var i=dt(),r=_().set(s,t);return i[n](r,e)}function Dn(e,t,n){if(h(e)&&(t=e,e=void 0),e=e||"",null!=t)return Mn(e,t,n,"month");for(var s=[],i=0;i<12;i++)s[i]=Mn(e,i,n,"month");return s}function Sn(e,t,n,s){t=("boolean"==typeof e?h(t)&&(n=t,t=void 0):(t=e,e=!1,h(n=t)&&(n=t,t=void 0)),t||"");var i,r=dt(),a=e?r._week.dow:0,o=[];if(null!=n)return Mn(t,(n+a)%7,s,"day");for(i=0;i<7;i++)o[i]=Mn(t,(i+a)%7,s,"day");return o}kn.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return O(s)?s.call(t,n):s},kn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(N).map(function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e}).join(""),this._longDateFormat[e])},kn.invalidDate=function(){return this._invalidDate},kn.ordinal=function(e){return this._ordinal.replace("%d",e)},kn.preparse=vn,kn.postformat=vn,kn.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return O(i)?i(e,t,n,s):i.replace(/%d/i,e)},kn.pastFuture=function(e,t){var n=this._relativeTime[0<e?"future":"past"];return O(n)?n(t):n.replace(/%s/i,t)},kn.set=function(e){var t,n;for(n in e)m(e,n)&&(O(t=e[n])?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},kn.eras=function(e,t){for(var n,s=this._eras||dt("en")._eras,i=0,r=s.length;i<r;++i){switch(typeof s[i].since){case"string":n=f(s[i].since).startOf("day"),s[i].since=n.valueOf();break}switch(typeof s[i].until){case"undefined":s[i].until=1/0;break;case"string":n=f(s[i].until).startOf("day").valueOf(),s[i].until=n.valueOf();break}}return s},kn.erasParse=function(e,t,n){var s,i,r,a,o,u=this.eras();for(e=e.toUpperCase(),s=0,i=u.length;s<i;++s)if(r=u[s].name.toUpperCase(),a=u[s].abbr.toUpperCase(),o=u[s].narrow.toUpperCase(),n)switch(t){case"N":case"NN":case"NNN":if(a===e)return u[s];break;case"NNNN":if(r===e)return u[s];break;case"NNNNN":if(o===e)return u[s];break}else if(0<=[r,a,o].indexOf(e))return u[s]},kn.erasConvertYear=function(e,t){var n=e.since<=e.until?1:-1;return void 0===t?f(e.since).year():f(e.since).year()+(t-e.offset)*n},kn.erasAbbrRegex=function(e){return m(this,"_erasAbbrRegex")||hn.call(this),e?this._erasAbbrRegex:this._erasRegex},kn.erasNameRegex=function(e){return m(this,"_erasNameRegex")||hn.call(this),e?this._erasNameRegex:this._erasRegex},kn.erasNarrowRegex=function(e){return m(this,"_erasNarrowRegex")||hn.call(this),e?this._erasNarrowRegex:this._erasRegex},kn.months=function(e,t){return e?o(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||Pe).test(t)?"format":"standalone"][e.month()]:o(this._months)?this._months:this._months.standalone},kn.monthsShort=function(e,t){return e?o(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[Pe.test(t)?"format":"standalone"][e.month()]:o(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},kn.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=_([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=we.call(this._shortMonthsParse,a))?i:null:-1!==(i=we.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=we.call(this._shortMonthsParse,a))||-1!==(i=we.call(this._longMonthsParse,a))?i:null:-1!==(i=we.call(this._longMonthsParse,a))||-1!==(i=we.call(this._shortMonthsParse,a))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=_([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},kn.monthsRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||He.call(this),e?this._monthsStrictRegex:this._monthsRegex):(m(this,"_monthsRegex")||(this._monthsRegex=We),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},kn.monthsShortRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||He.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(m(this,"_monthsShortRegex")||(this._monthsShortRegex=Re),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},kn.week=function(e){return Ae(e,this._week.dow,this._week.doy).week},kn.firstDayOfYear=function(){return this._week.doy},kn.firstDayOfWeek=function(){return this._week.dow},kn.weekdays=function(e,t){var n=o(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?Ie(n,this._week.dow):e?n[e.day()]:n},kn.weekdaysMin=function(e){return!0===e?Ie(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},kn.weekdaysShort=function(e){return!0===e?Ie(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},kn.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=_([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=we.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=we.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=we.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=we.call(this._weekdaysParse,a))||-1!==(i=we.call(this._shortWeekdaysParse,a))||-1!==(i=we.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=we.call(this._shortWeekdaysParse,a))||-1!==(i=we.call(this._weekdaysParse,a))||-1!==(i=we.call(this._minWeekdaysParse,a))?i:null:-1!==(i=we.call(this._minWeekdaysParse,a))||-1!==(i=we.call(this._weekdaysParse,a))||-1!==(i=we.call(this._shortWeekdaysParse,a))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=_([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},kn.weekdaysRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(m(this,"_weekdaysRegex")||(this._weekdaysRegex=qe),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},kn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(m(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Be),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},kn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Qe.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(m(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Je),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},kn.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},kn.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},lt("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;
4010return e+(1===Z(e%100/10)?"th":1==t?"st":2==t?"nd":3==t?"rd":"th")}}),f.lang=n("moment.lang is deprecated. Use moment.locale instead.",lt),f.langData=n("moment.langData is deprecated. Use moment.localeData instead.",dt);var Yn=Math.abs;function On(e,t,n,s){var i=Zt(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function bn(e){return e<0?Math.floor(e):Math.ceil(e)}function xn(e){return 4800*e/146097}function Tn(e){return 146097*e/4800}function Nn(e){return function(){return this.as(e)}}var Pn=Nn("ms"),Rn=Nn("s"),Wn=Nn("m"),Cn=Nn("h"),Un=Nn("d"),Hn=Nn("w"),Fn=Nn("M"),Ln=Nn("Q"),Vn=Nn("y");function Gn(e){return function(){return this.isValid()?this._data[e]:NaN}}var En=Gn("milliseconds"),An=Gn("seconds"),jn=Gn("minutes"),In=Gn("hours"),Zn=Gn("days"),zn=Gn("months"),$n=Gn("years");var qn=Math.round,Bn={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Jn(e,t,n,s){var i=Zt(e).abs(),r=qn(i.as("s")),a=qn(i.as("m")),o=qn(i.as("h")),u=qn(i.as("d")),l=qn(i.as("M")),h=qn(i.as("w")),d=qn(i.as("y")),c=(r<=n.ss?["s",r]:r<n.s&&["ss",r])||a<=1&&["m"]||a<n.m&&["mm",a]||o<=1&&["h"]||o<n.h&&["hh",o]||u<=1&&["d"]||u<n.d&&["dd",u];return null!=n.w&&(c=c||h<=1&&["w"]||h<n.w&&["ww",h]),(c=c||l<=1&&["M"]||l<n.M&&["MM",l]||d<=1&&["y"]||["yy",d])[2]=t,c[3]=0<+e,c[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,c)}var Qn=Math.abs;function Xn(e){return(0<e)-(e<0)||+e}function Kn(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n,s,i,r,a,o,u=Qn(this._milliseconds)/1e3,l=Qn(this._days),h=Qn(this._months),d=this.asSeconds();return d?(e=I(u/60),t=I(e/60),u%=60,e%=60,n=I(h/12),h%=12,s=u?u.toFixed(3).replace(/\.?0+$/,""):"",i=d<0?"-":"",r=Xn(this._months)!==Xn(d)?"-":"",a=Xn(this._days)!==Xn(d)?"-":"",o=Xn(this._milliseconds)!==Xn(d)?"-":"",i+"P"+(n?r+n+"Y":"")+(h?r+h+"M":"")+(l?a+l+"D":"")+(t||e||u?"T":"")+(t?o+t+"H":"")+(e?o+e+"M":"")+(u?o+s+"S":"")):"P0D"}var es=Ct.prototype;return es.isValid=function(){return this._isValid},es.abs=function(){var e=this._data;return this._milliseconds=Yn(this._milliseconds),this._days=Yn(this._days),this._months=Yn(this._months),e.milliseconds=Yn(e.milliseconds),e.seconds=Yn(e.seconds),e.minutes=Yn(e.minutes),e.hours=Yn(e.hours),e.months=Yn(e.months),e.years=Yn(e.years),this},es.add=function(e,t){return On(this,e,t,1)},es.subtract=function(e,t){return On(this,e,t,-1)},es.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=V(e))||"quarter"===e||"year"===e)switch(t=this._days+s/864e5,n=this._months+xn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Tn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},es.asMilliseconds=Pn,es.asSeconds=Rn,es.asMinutes=Wn,es.asHours=Cn,es.asDays=Un,es.asWeeks=Hn,es.asMonths=Fn,es.asQuarters=Ln,es.asYears=Vn,es.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*Z(this._months/12):NaN},es._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return 0<=r&&0<=a&&0<=o||r<=0&&a<=0&&o<=0||(r+=864e5*bn(Tn(o)+a),o=a=0),u.milliseconds=r%1e3,e=I(r/1e3),u.seconds=e%60,t=I(e/60),u.minutes=t%60,n=I(t/60),u.hours=n%24,a+=I(n/24),o+=i=I(xn(a)),a-=bn(Tn(i)),s=I(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},es.clone=function(){return Zt(this)},es.get=function(e){return e=V(e),this.isValid()?this[e+"s"]():NaN},es.milliseconds=En,es.seconds=An,es.minutes=jn,es.hours=In,es.days=Zn,es.weeks=function(){return I(this.days()/7)},es.months=zn,es.years=$n,es.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var n,s,i=!1,r=Bn;return"object"==typeof e&&(t=e,e=!1),"boolean"==typeof e&&(i=e),"object"==typeof t&&(r=Object.assign({},Bn,t),null!=t.s&&null==t.ss&&(r.ss=t.s-1)),n=this.localeData(),s=Jn(this,!i,r,n),i&&(s=n.pastFuture(+this,s)),n.postformat(s)},es.toISOString=Kn,es.toString=Kn,es.toJSON=Kn,es.locale=tn,es.localeData=sn,es.toIsoString=n("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Kn),es.lang=nn,C("X",0,0,"unix"),C("x",0,0,"valueOf"),ce("x",ue),ce("X",/[+-]?\d+(\.\d{1,3})?/),ye("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e))}),ye("x",function(e,t,n){n._d=new Date(Z(e))}),f.version="2.29.1",e=Tt,f.fn=pn,f.min=function(){return Rt("isBefore",[].slice.call(arguments,0))},f.max=function(){return Rt("isAfter",[].slice.call(arguments,0))},f.now=function(){return Date.now?Date.now():+new Date},f.utc=_,f.unix=function(e){return Tt(1e3*e)},f.months=function(e,t){return Dn(e,t,"months")},f.isDate=a,f.locale=lt,f.invalid=w,f.duration=Zt,f.isMoment=M,f.weekdays=function(e,t,n){return Sn(e,t,n,"weekdays")},f.parseZone=function(){return Tt.apply(null,arguments).parseZone()},f.localeData=dt,f.isDuration=Ut,f.monthsShort=function(e,t){return Dn(e,t,"monthsShort")},f.weekdaysMin=function(e,t,n){return Sn(e,t,n,"weekdaysMin")},f.defineLocale=ht,f.updateLocale=function(e,t){var n,s,i;return null!=t?(i=st,null!=it[e]&&null!=it[e].parentLocale?it[e].set(b(it[e]._config,t)):(null!=(s=ut(e))&&(i=s._config),t=b(i,t),null==s&&(t.abbr=e),(n=new x(t)).parentLocale=it[e],it[e]=n),lt(e)):null!=it[e]&&(null!=it[e].parentLocale?(it[e]=it[e].parentLocale,e===lt()&&lt(e)):null!=it[e]&&delete it[e]),it[e]},f.locales=function(){return s(it)},f.weekdaysShort=function(e,t,n){return Sn(e,t,n,"weekdaysShort")},f.normalizeUnits=V,f.relativeTimeRounding=function(e){return void 0===e?qn:"function"==typeof e&&(qn=e,!0)},f.relativeTimeThreshold=function(e,t){return void 0!==Bn[e]&&(void 0===t?Bn[e]:(Bn[e]=t,"
4010s"===e&&(Bn.ss=t-1),!0))},f.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},f.prototype=pn,f.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},f});
4011
4012/*!
4013 * jQuery Cookie Plugin v1.4.1
4014 * https://github.com/carhartl/jquery-cookie
4015 *
4016 * Copyright 2006, 2014 Klaus Hartl
4017 * Released under the MIT license
4018 */
4019(function (factory) {
4020	if (typeof define === 'function' && define.amd) {
4021		// AMD
4022		define(['jquery'], factory);
4023	} else if (typeof exports === 'object') {
4024		// CommonJS
4025		factory(require('jquery'));
4026	} else {
4027		// Browser globals
4028		factory(jQuery);
4029	}
4030}(function ($) {
4031
4032	var pluses = /\+/g;
4033
4034	function encode(s) {
4035		return config.raw ? s : encodeURIComponent(s);
4036	}
4037
4038	function decode(s) {
4039		return config.raw ? s : decodeURIComponent(s);
4040	}
4041
4042	function stringifyCookieValue(value) {
4043		return encode(config.json ? JSON.stringify(value) : String(value));
4044	}
4045
4046	function parseCookieValue(s) {
4047		if (s.indexOf('"') === 0) {
4048			// This is a quoted cookie as according to RFC2068, unescape...
4049			s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
4050		}
4051
4052		try {
4053			// Replace server-side written pluses with spaces.
4054			// If we can't decode the cookie, ignore it, it's unusable.
4055			// If we can't parse the cookie, ignore it, it's unusable.
4056			s = decodeURIComponent(s.replace(pluses, ' '));
4057			return config.json ? JSON.parse(s) : s;
4058		} catch(e) {}
4059	}
4060
4061	function read(s, converter) {
4062		var value = config.raw ? s : parseCookieValue(s);
4063		return $.isFunction(converter) ? converter(value) : value;
4064	}
4065
4066	var config = $.cookie = function (key, value, options) {
4067
4068		// Write
4069
4070		if (arguments.length > 1 && !$.isFunction(value)) {
4071			options = $.extend({}, config.defaults, options);
4072
4073			if (typeof options.expires === 'number') {
4074				var days = options.expires, t = options.expires = new Date();
4075				t.setTime(+t + days * 864e+5);
4076			}
4077
4078			return (document.cookie = [
4079				encode(key), '=', stringifyCookieValue(value),
4080				options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
4081				options.path    ? '; path=' + options.path : '',
4082				options.domain  ? '; domain=' + options.domain : '',
4083				options.secure  ? '; secure' : ''
4084			].join(''));
4085		}
4086
4087		// Read
4088
4089		var result = key ? undefined : {};
4090
4091		// To prevent the for loop in the first place assign an empty array
4092		// in case there are no cookies at all. Also prevents odd result when
4093		// calling $.cookie().
4094		var cookies = document.cookie ? document.cookie.split('; ') : [];
4095
4096		for (var i = 0, l = cookies.length; i < l; i++) {
4097			var parts = cookies[i].split('=');
4098			var name = decode(parts.shift());
4099			var cookie = parts.join('=');
4100
4101			if (key && key === name) {
4102				// If second argument (value) is a function it's a converter...
4103				result = read(cookie, value);
4104				break;
4105			}
4106
4107			// Prevent storing a cookie that we couldn't decode.
4108			if (!key && (cookie = read(cookie)) !== undefined) {
4109				result[name] = cookie;
4110			}
4111		}
4112
4113		return result;
4114	};
4115
4116	config.defaults = {};
4117
4118	$.removeCookie = function (key, options) {
4119		if ($.cookie(key) === undefined) {
4120			return false;
4121		}
4122
4123		// Must not alter options, thus extending a fresh object...
4124		$.cookie(key, '', $.extend({}, options, { expires: -1 }));
4125		return !$.cookie(key);
4126	};
4127
4128}));
4129;
4130/*!
4131 * headroom.js v0.7.0 - Give your page some headroom. Hide your header until you need it
4132 * Copyright (c) 2014 Nick Williams - http://wicky.nillia.ms/headroom.js
4133 * License: MIT
4134 */
4135
4136!function(a,b){"use strict";function c(a){this.callback=a,this.ticking=!1}function d(b){return b&&"undefined"!=typeof a&&(b===a||b.nodeType)}function e(a){if(arguments.length<=0)throw new Error("Missing arguments in extend function");var b,c,f=a||{};for(c=1;c<arguments.length;c++){var g=arguments[c]||{};for(b in g)f[b]="object"!=typeof f[b]||d(f[b])?f[b]||g[b]:e(f[b],g[b])}return f}function f(a){return a===Object(a)?a:{down:a,up:a}}function g(a,b){b=e(b,g.options),this.lastKnownScrollY=0,this.elem=a,this.debouncer=new c(this.update.bind(this)),this.tolerance=f
4136(b.tolerance),this.classes=b.classes,this.offset=b.offset,this.scroller=b.scroller,this.initialised=!1,this.onPin=b.onPin,this.onUnpin=b.onUnpin,this.onTop=b.onTop,this.onNotTop=b.onNotTop}var h={bind:!!function(){}.bind,classList:"classList"in b.documentElement,rAF:!!(a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame)};a.requestAnimationFrame=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame,c.prototype={constructor:c,update:function(){this.callback&&this.callback(),this.ticking=!1},requestTick:function(){this.ticking||(requestAnimationFrame(this.rafCallback||(this.rafCallback=this.update.bind(this))),this.ticking=!0)},handleEvent:function(){this.requestTick()}},g.prototype={constructor:g,init:function(){return g.cutsTheMustard?(this.elem.classList.add(this.classes.initial),setTimeout(this.attachEvent.bind(this),100),this):void 0},destroy:function(){var a=this.classes;this.initialised=!1,this.elem.classList.remove(a.unpinned,a.pinned,a.top,a.initial),this.scroller.removeEventListener("scroll",this.debouncer,!1)},attachEvent:function(){this.initialised||(this.lastKnownScrollY=this.getScrollY(),this.initialised=!0,this.scroller.addEventListener("scroll",this.debouncer,!1),this.debouncer.handleEvent())},unpin:function(){var a=this.elem.classList,b=this.classes;(a.contains(b.pinned)||!a.contains(b.unpinned))&&(a.add(b.unpinned),a.remove(b.pinned),this.onUnpin&&this.onUnpin.call(this))},pin:function(){var a=this.elem.classList,b=this.classes;a.contains(b.unpinned)&&(a.remove(b.unpinned),a.add(b.pinned),this.onPin&&this.onPin.call(this))},top:function(){var a=this.elem.classList,b=this.classes;a.contains(b.top)||(a.add(b.top),a.remove(b.notTop),this.onTop&&this.onTop.call(this))},notTop:function(){var a=this.elem.classList,b=this.classes;a.contains(b.notTop)||(a.add(b.notTop),a.remove(b.top),this.onNotTop&&this.onNotTop.call(this))},getScrollY:function(){return void 0!==this.scroller.pageYOffset?this.scroller.pageYOffset:void 0!==this.scroller.scrollTop?this.scroller.scrollTop:(b.documentElement||b.body.parentNode||b.body).scrollTop},getViewportHeight:function(){return a.innerHeight||b.documentElement.clientHeight||b.body.clientHeight},getDocumentHeight:function(){var a=b.body,c=b.documentElement;return Math.max(a.scrollHeight,c.scrollHeight,a.offsetHeight,c.offsetHeight,a.clientHeight,c.clientHeight)},getElementHeight:function(a){return Math.max(a.scrollHeight,a.offsetHeight,a.clientHeight)},getScrollerHeight:function(){return this.scroller===a||this.scroller===b.body?this.getDocumentHeight():this.getElementHeight(this.scroller)},isOutOfBounds:function(a){var b=0>a,c=a+this.getViewportHeight()>this.getScrollerHeight();return b||c},toleranceExceeded:function(a,b){return Math.abs(a-this.lastKnownScrollY)>=this.tolerance[b]},shouldUnpin:function(a,b){var c=a>this.lastKnownScrollY,d=a>=this.offset;return c&&d&&b},shouldPin:function(a,b){var c=a<this.lastKnownScrollY,d=a<=this.offset;return c&&b||d},update:function(){var a=this.getScrollY(),b=a>this.lastKnownScrollY?"down":"up",c=this.toleranceExceeded(a,b);this.isOutOfBounds(a)||(a<=this.offset?this.top():this.notTop(),this.shouldUnpin(a,c)?this.unpin():this.shouldPin(a,c)&&this.pin(),this.lastKnownScrollY=a)}},g.options={tolerance:{up:0,down:0},offset:0,scroller:a,classes:{pinned:"headroom--pinned",unpinned:"headroom--unpinned",top:"headroom--top",notTop:"headroom--not-top",initial:"headroom"}},g.cutsTheMustard="undefined"!=typeof h&&h.rAF&&h.bind&&h.classList,a.Headroom=g}(window,document);;
4137/*!
4138 * headroom.js v0.7.0 - Give your page some headroom. Hide your header until you need it
4139 * Copyright (c) 2014 Nick Williams - http://wicky.nillia.ms/headroom.js
4140 * License: MIT
4141 */
4142
4143!function(a){a&&(a.fn.headroom=function(b){return this.each(function(){var c=a(this),d=c.data("headroom"),e="object"==typeof b&&b;e=a.extend(!0,{},Headroom.options,e),d||(d=new Headroom(this,e),d.init(),c.data("headroom",d)),"string"==typeof b&&d[b]()})},a("[data-headroom]").each(function(){var b=a(this);b.headroom(b.data())}))}(window.Zepto||window.jQuery);;
4144var CalAcademy = function (todaysDate) {
4145	var $ = jQuery;
4146	var _isFontLoaded = false;
4147	var _device;
4148	var _orientationChangeTimeout;
4149	var _pages = calacademy.Statics.pageObjects;
4150	var _breakpoints = calacademy.Constants.breakpoints;
4151	var _scrollPosition;
4152
4153	var _placeUnder = function (anchor, target) {
4154		if (anchor.length === 0 || target.length === 0) return;
4155
4156		target.addClass('dynamic-css');
4157		target.css('position', 'absolute');
4158
4159		target.css('top', anchor.position().top + calacademy.Utils.getRowHeight(anchor) + 'px');
4160		target.css('left', anchor.position().left + 'px');
4161	}
4162
4163	var _clearClusterHeights = function () {
4164		calacademy.Utils.clearClusterHeights($('.skewed-tri-grid, .tri-col-highlight, .skewed-four-col'));
4165	}
4166
4167	var _clusterLayout = function () {
4168		// put things in special places
4169		$('.skewed-tri-grid').each(function () {
4170			$('.views-row-1', this).find('.views-field-field-hero-region, .views-field-field-image-primary-1, .views-field-field-image-primary, .views-field-field-inline-image').addClass('mega-square');
4171			_placeUnder($('.views-row-1', this), $('.views-row-4', this));
4172			_placeUnder($('.views-row-2', this), $('.views-row-5', this));
4173			_placeUnder($('.views-row-3', this), $('.views-row-6', this));
4174		});
4175
4176		$('.skewed-four-col').each(function () {
4177			_placeUnder($('.views-row-2', this), $('.views-row-5', this));
4178			_placeUnder($('.views-row-3', this), $('.views-row-6', this));
4179			_placeUnder($('.views-row-6', this), $('.views-row-7', this));
4180		});
4181
4182		$('.tri-col-highlight').each(function () {
4183			var h = calacademy.Utils.getRowHeight($('.views-row-1', this)) + calacademy.Utils.getRowHeight($('.views-row-2', this)) + calacademy.Utils.getRowHeight($('.views-row-3', this));
4184			h -= $('.views-row-1 .views-field-field-hero-region, .views-row-1 .views-field-field-image-primary, .views-row-1 .views-field-field-slideshow-frame-bg-image', this).height();
4185			h += 75;
4186
4187			$('.views-row-5', this).addClass('dynamic-css');
4188			$('.views-row-5', this).css('marginTop', '-' + h + 'px');
4189		});
4190
4191		_clearClusterHeights();
4192	}
4193
4194	var _getBgDimensions = function (containerWidth) {
4195		var w = 1920;
4196		var h = 970;
4197
4198		return {
4199			computedHeight: Math.ceil((containerWidth * h) / w),
4200		}
4201	}
4202
4203	var _midfeatureLayout = function () {
4204		$('.slideshow-midfeature').each(function () {
4205			var w = $('.slides li', this).outerWidth();
4206
4207			$('.slides li', this).css('height', 'auto');
4208			var slideHeights = [];
4209
4210			$('.slides li', this).each(function () {
4211				slideHeights.push($(this).outerHeight());
4212
4213				// background positioning per field
4214				var el = $('.views-field-field-horizontal-offset-percenta, .field-name-field-horizontal-offset-percenta', this);
4215				var img = $('.field-name-field-slideshow-frame-bg-image, .views-field-field-slideshow-frame-bg-image', this);
4216
4217				if (el.length == 1 && !isNaN(el.text())) {
4218					var per = el.text() + '%';
4219
4220					// this only affects smaller viewports
4221					img.css('background-position', per + ' 0');
4222				}
4223			});
4224
4225			// heighten slides to tallest
4226			$('.slides li', this).css('height', Math.max.apply(Math, slideHeights) + 'px');
4227
4228			var height = $('.slideshow-midfeature-container').outerHeight(true);
4229
4230			// bg image height
4231			var bgImg = $('.field-name-field-slideshow-frame-bg-image, .views-field-field-slideshow-frame-bg-image', this);
4232			var w = bgImg.outerWidth();
4233			var h = _getBgDimensions(w).computedHeight;
4234			if (h < height) h = height;
4235			bgImg.css('height', h);
4236			bgImg.css('top', Math.round((height - h) / 2) + 'px');
4237
4238			// force next element below absolutely positioned slideshow
4239			if ($(this).parent().css('position') == 'absolute') {
4240				if ($(this).parent().next('.midfeature-shim').length == 0) {
4241					// insert a shim if we haven't already
4242					var shim = $('<div>.</div>');
4243					shim.addClass('midfeature-shim');
4244
4245					$(this).parent().after(shim);
4246				}
4247
4248				$(this).parent().next('.midfeature-shim').height(height);
4249			}
4250		});
4251	}
4252
4253	var _setSlideshowLayout = function () {
4254		$('.flexslider').on('before', function () {
4255			$(this).addClass('animating');
4256		});
4257
4258		$('.flexslider').on('after', function () {
4259			$(this).removeClass('animating');
4260		});
4261
4262		$('.flexslider').each(function () {
4263			// add a class for no captions
4264			var captions = $(this).find('.views-field-field-slideshow-frame-caption, blockquote');
4265
4266			if (captions.length == 0) {
4267				$(this).addClass('no-captions');
4268			}
4269		});
4270
4271		$('.node-type-hub-page').find('.pane-hero-media-large-hero-image-pane, .pane-hero-media-slideshow-large, .pane-node-field-hero-region').each(function () {
4272			var captions = $(this).find('blockquote');
4273
4274			if (captions.length == 0) {
4275				$('html').addClass('no-hub-hero-captions');
4276			}
4277		});
4278
4279		// large slideshows get a special smartphone rendition
4280		$('.loaded .slideshow-hero-large img.delay-load').each(function () {
4281			if ($(window).width() < _breakpoints.tablet) {
4282				$(this).attr('src', $(this).data('smartphone-src'));
4283			} else {
4284				$(this).attr('src', $(this).data('src'));
4285			}
4286		});
4287
4288		var _getReferenceElement = function (el) {
4289			if (el.hasClass('flex-control-paging') && el.parent().hasClass('slideshow-midfeature')) {
4290				if ($('html').hasClass('tablet')) {
4291					return el.parent().find('.flex-viewport');
4292				} else {
4293					return el.parent();
4294				}
4295			}
4296
4297			var slider = el.closest('.flexslider');
4298			var pane = slider.closest('.panel-pane');
4299			var referenceElement = slider.find('img').first();
4300
4301			if (pane.hasClass('slideshow-midfeature-container')) {
4302				referenceElement = pane;
4303			}
4304
4305			return referenceElement;
4306		}
4307
4308		$(window).on('resize.slideshow-layout', function () {
4309			// hack to resize svgs properly
4310			if ($('.svg-container svg').length > 0) {
4311				var swapsies = $('.svg-container svg').data('swapsies');
4312
4313				if (swapsies) {
4314					$('.svg-container svg').css('height', '100%');
4315				} else {
4316					$('.svg-container svg').css('height', '99.99999%');
4317				}
4318
4319				$('.svg-container svg').data('swapsies', !swapsies);
4320			}
4321
4322			$('.slideshow-hero .slides > li').each(function () {
4323				var img = $('.views-field-field-slideshow-frame-bg-image, .field-name-field-sli
4323deshow-frame-bg-image', this);
4324				var caption = $('.views-field-field-slideshow-frame-caption', this);
4325
4326				if ($.trim(caption.text()) == '') {
4327					$('.field-content, .field-item', caption).html('&nbsp;');
4328				}
4329			});
4330
4331			$('.flex-control-paging').each(function () {
4332				var r = _getReferenceElement($(this));
4333				$(this).css('top', r.height() + 'px');
4334			});
4335
4336			$('.flexslider .flex-direction-nav a').each(function () {
4337				var r = _getReferenceElement($(this));
4338				$(this).css('top', (Math.floor(r.height() / 2)) + 'px');
4339			});
4340
4341			_midfeatureLayout();
4342		});
4343
4344		$(window).trigger('resize.slideshow-layout');
4345
4346		setTimeout(function () {
4347			$(window).trigger('resize.slideshow-layout');
4348		}, 100);
4349
4350		if ($('.slideshow-midfeature').length > 0) {
4351			setInterval(_midfeatureLayout, 500);
4352
4353			$('.slideshow-midfeature').each(function () {
4354				// hack to fix pagination styles
4355				var pager = $(this).find('.flex-control-paging');
4356				$(this).prepend(pager);
4357			});
4358		}
4359	}
4360
4361	var _layout = function () {
4362		_setSmartphoneSubnavHeight();
4363		_clusterLayout();
4364	}
4365
4366	var _registerBreakpoints = function () {
4367		enquire
4368		.register('screen and (min-width: ' + _breakpoints.smartphone + 'px) and (max-width: ' + (_breakpoints.tablet - 1) + 'px)', {
4369			match: function () {
4370				$('.dynamic-css').attr('style', '');
4371				_onBreakpoint('smartphone');
4372			}
4373		})
4374		.register('screen and (min-width: ' + _breakpoints.tablet + 'px) and (max-width: ' + _breakpoints.desktop + 'px)', {
4375			match: function () {
4376				_layout();
4377				_onBreakpoint('tablet');
4378			}
4379		})
4380		.register('screen and (min-width: ' + (_breakpoints.desktop + 1) + 'px)', {
4381			match: function () {
4382				_layout();
4383				_onBreakpoint('desktop');
4384			}
4385		});
4386	}
4387
4388	var _initSubnavPosition = function () {
4389		// iterate each top level menu item and match left position of
4390		// its immediate dropdown
4391		$('.level-1 > .dropdown-toggle', $('nav').not('.smartphone-nav')).each(function () {
4392			var topLevelLeft = Math.round($(this).parent().position().left);
4393			var subNav = $(this).siblings('.dropdown-menu');
4394
4395			// clear on smartphone break
4396			subNav.addClass('dynamic-css');
4397
4398			// match position
4399			subNav.css('left', topLevelLeft + 'px');
4400		});
4401	}
4402
4403	var _setSideScrollStyle = function () {
4404		if ($('.side-scroll').length == 0) return;
4405
4406		$('.side-scroll .view-content, .side-scroll .views-row').attr('style', '');
4407
4408		var numCols = 4;
4409
4410		// create (non-smartphone) flexslider carousel
4411		$('.side-scroll').not('.cloned').each(function () {
4412			var isCarousel = $(this).find('.views-row').length >
4412 numCols;
4413
4414			$(this).addClass('cloned');
4415
4416			var pane = $('<div class="panel-pane side-scroll-carousel" />');
4417			pane.insertBefore($(this));
4418			pane.append($(this).find('.pane-title').clone());
4419
4420			if (isCarousel) {
4421				var container = $('<div class="flexslider carousel" />');
4422				pane.append(container);
4423
4424				var slides = $('<ul class="slides" />');
4425				container.append(slides);
4426
4427				$(this).find('.views-row').each(function () {
4428					var li = $('<li />');
4429					li.append($(this).clone());
4430					slides.append(li);
4431				});
4432
4433				container.flexslider({
4434					animation: 'slide',
4435					slideshow: false,
4436					controlNav: false,
4437					animationLoop: false,
4438					itemWidth: $(this).find('.views-row').first().outerWidth(),
4439					maxItems: numCols
4440				});
4441			} else {
4442				pane.addClass('image-top-four-columns');
4443				pane.append($(this).find('.view').clone());
4444			}
4445		});
4446
4447		// move title
4448		$('.side-scroll .pane-title').each(function () {
4449			var pane = $(this).closest('.panel-pane');
4450			var div = $('<div class="panel-pane moved-title" />');
4451			div.append($(this));
4452			div.insertBefore(pane);
4453		});
4454
4455		$(window).off('.side-scroll');
4456
4457		if (_device != 'smartphone') return;
4458
4459		$(window).on('resize.side-scroll', function () {
4460			// side scroll
4461			$('.side-scroll .view-content, .side-scroll .views-row').attr('style', '');
4462
4463			$('.side-scroll .view-content').each(function () {
4464				var rows = $(this).find('.views-row');
4465
4466				if (rows.length > 2) {
4467					$(this).closest('.side-scroll').addClass('more-than-two');
4468
4469					var padding = parseInt(rows.first().css('padding-right'));
4470					var minWidth = $(this).closest('.side-scroll').outerWidth() / 1.5;
4471					minWidth -= padding / rows.length;
4472					rows.css('min-width', minWidth + 'px');
4473
4474					var rowWidth = rows.first().outerWidth();
4475					var containerWidth = rowWidth * rows.length;
4476					containerWidth += padding * 2;
4477					$(this).css('width', containerWidth + 'px');
4478				} else {
4479					$(this).css('width', '100%');
4480					rows.css('width', '50%');
4481					rows.css('min-width', '50%');
4482				}
4483			});
4484		});
4485
4486		$(window).trigger('resize.side-scroll');
4487	}
4488
4489	var _onBreakpoint = function (device) {
4490		_device = device;
4491		calacademy.Statics.device = device;
4492
4493		// remove all device classes
4494		$.each(['smartphone', 'tablet', 'desktop'], function (i, val) {
4495			$('html').removeClass(val);
4496		});
4497
4498		// add the new one
4499		$('html').addClass(_device);
4500
4501		_setSlideshowLayout();
4502		_setSideScrollStyle();
4503
4504		$.each(_pages, function (i, obj) {
4505			if (typeof(obj.onBreakpoint) == 'function') {
4506				obj.onBreakpoint(device);
4507			}
4508		});
4509
4510		$(document).trigger('breakpoint', [ _device ]);
4511	}
4512
4513	var _onFontLoad = function () {
4514		// do the layout once on the first font load
4515		if (_isFontLoaded) return;
4516		_isFontLoaded = true;
4517
4518		$('html').addClass('wf-active');
4519
4520		// _layout gets fired
4521		_registerBreakpoints();
4522
4523		// trigger page object callbacks
4524		var i = _pages.length;
4525
4526		while (i--) {
4527			var obj = _pages[i];
4528
4529			if (typeof(obj.onFontLoad) == 'function') {
4530				obj.onFontLoad();
4531			}
4532		}
4533	}
4534
4535	var _onOrientationChange = function () {
4536		_layout();
4537
4538		var i = _pages.length;
4539
4540		while (i--) {
4541			var obj = _pages[i];
4542
4543			if (typeof(obj.layout) == 'function') {
4544				obj.layout();
4545			}
4546		}
4547	}
4548
4549	var _addMSIEClasses = function () {
4550		if (isMSIE) {
4551			$('html').addClass('ie');
4552		} else {
4553			$('html').addClass('not-ie');
4554		}
4555
4556		var probIE = 'ActiveXObject' in window;
4557		
4558		if (probIE) {
4559			$('html').addClass('probably-ie');
4560		} else {
4561			$('html').addClass('probably-not-ie');
4562		}
4563	}
4564
4565	var _isValidSearchInput = function (str) {
4566		str = $.trim(str);
4567
4568		if (str == '') return false;
4569		if (str == calacademy.Constants.defaultSearchText) return false;
4570
4571		return true;
4572	}
4573
4574	var _initDefaultText = function () {
4575		var field = $('.block-search-form #search-field, #search-field-404');
4576		var label = field.siblings('label');
4577
4578		if (label.length > 0) {
4579			calacademy.Constants.defaultSearchText = $.trim(label.eq(0).text());
4580		}
4581
4582		if (field.attr('placeholder')) {
4583			calacademy.Constants.defaultSearchText = field.attr('placeholder');
4584		}
4585
4586		field.attr('placeholder', calacademy.Constants.defaultSearchText);
4587		field.attr('length', calacademy.Constants.defaultSearchText.length);
4588		field.defaultValue();
4589	}
4590
4591	var _initSearchUI = function () {
4592		var btn = $('.block-search-form .toggle');
4593		var close = $('.block-search-form .close');
4594		var form = $('.block-search-form form');
4595		var field = $('.block-search-form input[type="search"]');
4596		var myEvent = 'touchend click';
4597
4598		field.val('');
4599
4600		close.on(myEvent, function () {
4601			$('html').removeClass('search-open');
4602			return false;
4603		});
4604
4605		btn.on(myEvent, function () {
4606			$('html').toggleClass('search-open');
4607
4608			// focus search field
4609			if ($('html').hasClass('search-open')) {
4610				if ($('html').hasClass('smartphone-nav-open')) {
4611					_collapseSmartphoneNav();
4612				}
4613
4614				// workaround
4615				$('html').addClass('search-open');
4616
4617				field.focus();
4618			}
4619
4620			_setSmartphoneSubnavHeight();
4621			return false;
4622		});
4623
4624		$(window).on('scroll.nav-ui', function () {
4625			// collapse search on homepage scroll if search doesn't have focus
4626			if ($('html').hasClass('search-open')
4627				&& $('body').hasClass('page-homepage')
4628				&& !$('.block-search-form .form-type-textfield input').is(':focus')) {
4629				field.val('');
4630				btn.trigger(myEvent);
4631			}
4632
4633			_setSmartphoneSubnavHeight();
4634		});
4635
4636		if (Modernizr.touch) {
4637			$('body').on('touchmove', '*', function (e) {
4638				var nav = $(e.target).parents('nav, #top-level-nav-wrapper');
4639
4640				if (nav.length == 0) {
4641					$(window).trigger('scroll.nav-ui');
4642				}
4643			});
4644		}
4645
4646		field.on('input', function (e) {
4647			if (_isValidSearchInput($(this).val())) {
4648				form.addClass('enabled');
4649			} else {
4650				form.removeClass('enabled');
4651			}
4652		});
4653
4654		form.off();
4655
4656		form.on('submit', function (e) {
4657			var f = $(this).find('input[type="search"]');
4658
4659			if (!_isValidSearchInput(f.val())) {
4660				f.val('');
4661				return false;
4662			}
4663
4664			return true;
4665		});
4666	}
4667
4668	var _setSmartphoneSubnavHeight = function () {
4669		// just set to auto since the nav isn't open
4670		if (!$('html').hasClass('smartphone-nav-open') || _device != 'smartphone') {
4671			$('nav:visible .tb-megamenu-nav').css('height', 'auto');
4672			$('nav:visible .level-0').parent().css('height', '0px');
4673			return;
4674		}
4675
4676		// start with viewport height
4677		var h = window.innerHeight ? window.innerHeight : $(window).height();
4678
4679		// subtract fixed item height
4680		h -= $('nav:visible .btn-navbar').outerHeight();
4681
4682		// account for page offset
4683		h -= $('nav:visible').position().top - window.pageYOffset;
4684
4685		$('nav:visible .tb-megamenu-nav').css('height', h + 'px');
4686		$('nav:visible .level-0').parent().css('height', 'auto');
4687	}
4688
4689	var _collapseSmartphoneNav = function (suppressTrigger) {
4690		if ($('html').hasClass('smartphone-nav-open')) {
4691			if (!suppressTrigger) {
4692				var myEvent = Modernizr.touch ? 'touchend' : 'click';
4693				$('.tb-megamenu button').trigger(myEvent);
4694			}
4695
4696			$('html').removeClass('smartphone-nav-open');
4697
4698			if (typeof(_scrollPosition) == 'number') {
4699				$('html, body').scrollTop(_scrollPosition);
4700
4701				// hacky chrome fix
4702				$('html, body').animate({
4703					scrollTop: _scrollPosition
4704				}, 50);
4705			}
4706		}
4707	}
4708
4709	var _initNav = function () {
4710		// skip tabbing
4711		$('.page-homepage #main-nav a[href="/"]').attr('tabindex', '-1');
4712
4713		// map dropdown focus to hover
4714		$('#main-nav').find('.dropdown-toggle').on('focus', function () {
4715			$('#main-nav').find('.dropdown-toggle').trigger('mouseout');
4716			$(this).trigger('mouseover');
4717		});
4718
4719		$('#main-nav').find('a, button').on('blur', function () {
4720			var ul = $(this).closest('ul');
4721
4722			if (ul.hasClass('tb-megamenu-subnav')) {
4723				if ($(this).closest('li').is(':last-child')) {
4724					$('#main-nav').find('.dropdown-toggle').trigger('mouseout');
4725				}
4726			}
4727		});
4728
4729		// nav style
4730		if ($('.first-menu-link-ibss').length > 0) {
4731			$('body').addClass('section-researchers');
4732		}
4733		if ($('.first-menu-link-edu').length > 0) {
4734			$('body').addClass('section-educators');
4735		}
4736
4737		$('nav .suppress-link > a').attr('href', '#');
4738
4739		// toggle a class on the responsive nav hamburger on click
4740		var myEvent = Modernizr.touch ? 'touchend' : 'click';
4741
4742		$('.tb-megamenu-button').on(myEvent, function (e) {
4743			if ($('html').hasClass('smartphone-nav-open')) {
4744		    	_collapseSmartphoneNav(true);
4745		    } else {
4746				_scrollPosition = $(document).scrollTop();
4747		    	$('html').addClass('smartphone-nav-open');
4748		    	$('html').removeClass('search-open');
4749		    }
4750
4751		    _setSmartphoneSubnavHeight();
4752		});
4753
4754		// collapse nav on window resize if open
4755		$(window).on('resize.smartphone-nav', _setSmartphoneSubnavHeight);
4756
4757		_fixTouchNav();
4758		_hackMegamenu();
4759		_addNavInteraction();
4760
4761		if (Modernizr.csspositionsticky && $('html').hasClass('scroll-collapse')) {
4762			$('html').headroom();
4763		}
4764
4765		$(window).on('resize.position-nav', _positionNav);
4766		$(window).trigger('resize.position-nav');
4767
4768		$('body').attr('style', 'min-height: 100%;');
4769
4770		setTimeout(function () {
4771			$('body').attr('style', 'min-height: 100%;');
4772			$('html').addClass('nav-init');
4773		}, 300);
4774
4775		// collapse on scroll
4776		var nc = $('<div />');
4777		nc.addClass('color-block');
4778		$('body').prepend(nc);
4779
4780		$('html').addClass('has-nav-compression');
4781		var lastScrollPos = 0;
4782
4783		window.compressNav = function () {
4784			var h = $('#top-level-nav-wrapper').outerHeight();
4785			$('html').addClass('compress-nav');
4786			$('#top-level-nav-wrapper').css('transform', 'translateY(' + (h * -1) + 'px)');
4787			_positionNav(true);
4788		}
4789
4790		$(window).on('scroll.compress-nav resize.compress-nav', function () {
4791			if ($('html').hasClass('full-viewport')) {
4792				$('html').addClass('compress-nav');
4793				$(this).off('.compress-nav');
4794				return;
4795			}
4796
4797			var s = $(this).scrollTop();
4798			var h = $('#top-level-nav-wrapper').outerHeight();
4799
4800			if (!isNaN(s) && (s != (lastScrollPos + h))) {
4801				if (!isNaN(s) && (s > 200)) {
4802					window.compressNav();
4803				} else {
4804					$('html').removeClass('compress-nav');
4805					$('#top-level-nav-wrapper').css('transform', 'translateY(0px)');
4806					_positionNav();
4807				}
4808			}
4809			lastScrollPos = s;
4810
4811		});
4812
4813		$(window).trigger('scroll.compress-nav');
4814	}
4815
4816	var _positionNav = function (forceAlertHide) {
4817		// nav
4818		var h = $('#top-level-nav-wrapper').outerHeight();
4819		if (!$('#top-level-nav-wrapper').is(':visible')) h = 0;
4820		if (forceAlertHide === true) h = 0;
4821
4822		$('nav:visible').css('top', h);
4823
4824		// content
4825		var top = $('nav:visible').outerHeight();
4826		top += h;
4827
4828		var cb = $('.color-block');
4829
4830		if (cb.length == 1) {
4831			var calcTop = (cb.outerHeight() * -1) + top;
4832			cb.css('top', calcTop);
4833
4834			// account from some browser glitchiness
4835			if (calcTop == cb.position().top) {
4836				cb.addClass('positioned');
4837			} else {
4838				cb.removeClass('positioned');
4839			}
4840		}
4841
4842		$('.search-form-container, .node-type-3d-object #content').css('top', top);
4843		$('.node-type-gigamacro-specimen #content').css('top', $('.block-search-form .toggle').outerHeight());
4844
4845		var bgCol = $('#nav-wrapper').css('background-color');
4846		$('.node-type-es-landing-page #content, nav + div, nav + header').css('border-top', top + 'px solid ' + bgCol);
4847
4848		$('.csspositionsticky .clone-container').css('top', top);
4849
4850		$('.chimera-container-page body .chimera').attr('style', '');
4851
4852		if (!$('html').hasClass('smartphone') && $('html').hasClass('compress-nav')) top -= 50;
4853		$('.csspositionsticky .node-tabular-data .clone-container').css('top', top);
4854		$('.chimera-container-page.chimera-takeover body .chimera').css('top', top);
4855
4856		var hWithPadding = $('html').hasClass('smartphone') ? h + 12 : h + 20;
4857		$('.node-type-event #content, .node-type-event-nightlife #content, .node-type-blog .pane-node-title, .section-blogs .educator-search').css('padding-top', hWithPadding);
4858
4859		// exceptions
4860		$('.page-map #main').attr('style', '');
4861
4862		// make sure footer fills short pages
4863		var bottom = $('#footer .bottom');
4864		bottom.css('height', 'auto');
4865
4866		var diff = $(window).height() - $('#page').outerHeight();
4867
4868		if (diff > 0 && !$('html').hasClass('full-viewport')) {
4869			bottom.css('height', bottom.outerHeight() + diff);
4870		}
4871	}
4872
4873	var _hackMegamenu = function () {
4874		var el = $('nav .nav-child .nav-child');
4875		el.attr('class', 'nav-next-level');
4876
4877		$('.tb-megamenu-column', $('.mega-col-nav').not('.featured')).removeClass('tb-megamenu-column');
4878		$('.dropdown-submenu').removeClass('dropdown-submenu');
4879	}
4880
4881	var _addNavInteraction = function () {
4882		if ($('#main-nav .level-0 > li:last-child').hasClass('active')) {
4883			$('#main-nav .level-0').addClass('last-over');
4884		}
4885
4886		if (Modernizr.touch) {
4887			// Safari can still navigate an <a href> on tap even when touchstart,
4888			// touchend, pointerdown, pointerup and click all have preventDefault()
4889			// called on them. Stripping href (and restoring it via data-nav-href
4890			// once doubletap fires, or once the link no longer needs doubletap
4891			// protection) is the only reliable way to block it.
4892			$('#main-nav .level-0 > li > a').each(function () {
4893				$(this).data('nav-href', $(this).attr('href'));
4894				$(this).attr('href', '#');
4895			});
4896
4897			$('#main-nav .level-0 > li > a').hammer().on('tap doubletap', function (e) {
4898				if (!$(this).parent().hasClass('suppress-link')) {
4899					var isNav = true;
4900
4901					// if tap, only nav if smartphone
4902					if (e.type == 'tap' && !$('html').hasClass('smartphone')) isNav = false;
4903
4904					if (isNav) {
4905						window.location.href = $(this).data('nav-href') || $(this).attr('href');
4906					}
4907				}
4908
4909				e.preventDefault();
4910			});
4911
4912			$('#main-nav .level-0 > li').hammer().on('tap', function (e) {
4913				_removeMenuBorder();
4914
4915				if ($(this).is(':last-child')) {
4916					$(this).parent().addClass('last-over');
4917				}
4918
4919				$('#main-nav .level-0 > li').removeClass('open');
4920				_initSubnavPosition();
4921				$(this).addClass('open');
4922
4923				e.preventDefault();
4924			});
4925		} else {
4926			$('#main-nav .level-0 > li').on('mouseover', function () {
4927				if ($(this).is(':last-child')) {
4928					$(this).parent().addClass('last-over');
4929				}
4930
4931				_initSubnavPosition();
4932				$(this).addClass('open');
4933			});
4934
4935			$('#main-nav .level-0 > li').on('mouseout', function () {
4936				_removeMenuBorder();
4937				$(this).removeClass('open');
4938			});
4939
4940			$('#main-nav .level-0 > li.suppress-link > a').on('click', function (e) {
4941				return false;
4942			});
4943		}
4944	}
4945
4946	var _removeMenuBorder = function () {
4947		if ($('#main-nav .level-0 > li:last-child').hasClass('active')) return;
4948		$('#main-nav .level-0').removeClass('last-over');
4949	}
4950
4951	var _isNavOpen = function () {
4952		return $('nav .tb-megamenu-item').hasClass('open');
4953	}
4954
4955	var _fixTouchNav = function () {
4956		if (!Modernizr.touch) return;
4957
4958		// close the nav when touching anything other than itself
4959		$('body').on('touchstart', '*', function (e) {
4960			var nav = $(e.target).parents('nav');
4961
4962			if (nav.length == 0) {
4963				$('nav a').removeClass('tb-megamenu-clicked');
4964				$('nav .tb-megamenu-item').removeClass('open');
4965				_removeMenuBorder();
4966			}
4967		});
4968
4969		// account for weird bfcaching (back-forward cache) behavior
4970		$(window).bind('pageshow', function (event) {
4971		    try {
4972			    if (event.originalEvent.persisted) {
4973			        $('body').trigger('touchstart');
4974			        $('.block-search-form .form-type-textfield input').val('');
4975			        _collapseSmartphoneNav();
4976			    }
4977		    } catch (err) {}
4978		});
4979	}
4980
4981	var _initSlideshow = function () {
4982		// svg overlay
4983		$('.page-homepage .views-field-field-svg-overlay, .page-homepage .views-field-field-svg-overlay-smartphone').each(function () {
4984			var link = $(this).siblings('.views-field-field-title-link');
4985			var container = $('<div class="svg-container" />');
4986			var artboard;
4987
4988			if ($(this).hasClass('views-field-field-svg-overlay-smartphone')) {
4989				container.addClass('svg-container-smartphone');
4990				artboard = '0 0 744 552';
4991			} else {
4992				container.addClass('svg-container-desktop');
4993				artboard = '0 0 960 460';
4994			}
4995
4996			if ($('.views-field-field-svg-overlay-smartphone', $(this).parent()).length == 1) {
4997				$(this).parent().addClass('smartphone-svg');
4998			} else {
4999				$(this).parent().addClass('no-smartphone-svg');
5000			}
5001
5002			container.load($.trim($(this).text()) + ' svg', function () {
5003				// basic security
5004				$('script', this).remove();
5005
5006				// svg doesn't work with standard jQuery DOM manipulation
5007				try {
5008					var svg = $('svg', this).get(0);
5009					svg.setAttribute('viewBox', artboard);
5010					svg.setAttribute('width', '100%');
5011					svg.setAttribute('height', '100%');
5012					svg.removeAttribute('id');
5013				} catch (e) {}
5014
5015				$(this).addClass('svg-loaded');
5016			});
5017
5018			$(this).after(container);
5019
5020			if (link.length == 1) {
5021				container.parent().addClass('with-link');
5022
5023				container.parent().on('click', function () {
5024					window.location.href = $.trim(link.text());
5025					return false;
5026				});
5027			}
5028		});
5029
5030		$('.slideshow-midfeature .flexslider .slides li').each(function () {
5031			// set the highlight color
5032			var highlight = $('.container > .views-field-field-highlight-color, .container > .field-name-field-highlight-color', this);
5033
5034			if (highlight.length == 1) {
5035				var colorTerm = $.trim(highlight.text());
5036				$(this).addClass('highlight-' + colorTerm.toLowerCase());
5037			}
5038
5039			// set the background color
5040			var colorData = $('.container > .views-field-field-bg-color, .container > .field-name-field-bg-color', this);
5041
5042			if (colorData.length == 1) {
5043				var hex = $.trim(colorData.text());
5044				$(this).css('background-color', hex);
5045			}
5046
5047			// bg img gets set onload
5048		});
5049
5050		$('.slideshow-midfeature-colorized').each(function () {
5051			// color theme
5052			var theme = $.trim($(this).find('.color-theme').html().toLowerCase());
5053			$(this).addClass('color-theme-' + theme);
5054
5055			$(this).find('li').each(function () {
5056				var t = $('<div />');
5057				t.addClass('text-container');
5058				$(this).append(t);
5059
5060				t.append($(this).find('h3, > p, .cta-button'));
5061				t.append($(this).find('blockquote'));
5062
5063				// wrapper
5064				var w = $('<div />');
5065				w.addClass('container');
5066				$(this).wrapInner(w);
5067
5068				if ($(this).find('img').length == 0) {
5069					$(this).addClass('no-image');
5070				}
5071			});
5072		});
5073
5074		_suppressAutoAdvance();
5075	}
5076
5077	var _suppressAutoAdvance = function () {
5078		$('.views-field-field-autoplay').each(function () {
5079			var suppress = parseInt($(this).text());
5080
5081			if (suppress === 1) {
5082				var parent = $(this).parent();
5083
5084				if ($('.flexslider', parent).length == 1) {
5085					var id = $('.flexslider', parent).attr('id');
5086					$('#' + id).flexslider('pause');
5087				}
5088			}
5089		});
5090	}
5091
5092	var _initDatepicker = function () {
5093		// close desktop datepicker on scroll, nav hover and outside touch
5094		$(window).on('scroll.datepicker-collapse', function () {
5095			if (_device != 'smartphone') {
5096				try {
5097					$('.date-popup-init').datepicker('hide');
5098				} catch (e) {}
5099			}
5100		});
5101
5102		var myEvent = Modernizr.touch ? 'touchend.datepicker-collapse' : 'mouseover.datepicker-collapse';
5103
5104		$('.level-0 > li > a').on(myEvent, function () {
5105			$(window).trigger('scroll.datepicker-collapse');
5106		});
5107
5108		// iPad fix, clicking outside the datepicker doesn't collapse
5109		if (Modernizr.touch) {
5110			$('body').on('touchstart', '*', function (e) {
5111				var cal = $(e.target).parents('.ui-datepicker');
5112
5113				if (cal.length == 0) {
5114					$(window).trigger('scroll.datepicker-collapse');
5115				}
5116			});
5117		}
5118	}
5119
5120	var _isWebformRequiredTextFulfilled = function(el) {
5121		var valid = true;
5122		el.find(':input[type="text"], :input[type="email"], textarea, select, :input[type="number"]').each(function() {
5123			if ($(this).hasClass('required')) {
5124				if ($(this).val() == '') {
5125					valid = false;
5126				}
5127			}
5128		});
5129		el.find('div.webform-component-date label span.form-required').each(function() {
5130			if ($(this).parent().parent().find('select.year').val() == "") {
5131				valid = false;
5132			}
5133			if ($(this).parent().parent().find('select.month').val() == "") {
5134				valid = false;
5135			}
5136			if ($(this).parent().parent().find('select.day').val() == "") {
5137				valid = false;
5138			}
5139		});
5140		el.find('div.webform-component-checkboxes label span.form-required').each(function() {
5141			if ($(this).parent().parent().find('input:checked').length < 1) {
5142				valid = false;
5143			}
5144		});
5145		el.find('div.webform-component-radios label span.form-required').each(function() {
5146			if ($(this).parent().parent().find('input:checked').length < 1) {
5147				valid = false;
5148			}
5149		});
5150
5151		return valid;
5152	}
5153
5154	var _stripEmojis = function (el, e) {
5155		var orig = el.val();
5156
5157		if (typeof(orig) == 'string') {
5158			var clean = orig.stripEmojis();
5159
5160			if (clean != orig) {
5161				el.val(clean);
5162			}
5163		}
5164	}
5165
5166	var _initWebforms = function () {
5167		// fix css nav bug on ios focus
5168		$('html').touchFix({
5169			inputElements: '.webform-client-form input, .webform-client-form textarea, .webform-client-form select',
5170        	addClass: 'fixfixed'
5171		});
5172
5173		// accessibility enhancement
5174		$('.webform-client-form .required').attr('aria-required', 'true');
5175
5176		// if showing a form response, add a class for styling
5177		if ($('.messages--status').length > 0) {
5178			$('body').addClass('webform-response');
5179		}
5180
5181		// default values
5182		$("body:not(.page-love-letters-form) .webform-client-form input[type='text'], .webform-client-form input[type='email'], .webform-client-form textarea").each(function () {
5183			if (!$(this).closest('.panel-pane').hasClass('ajax_form_block')) {
5184				$(this).attr('placeholder', $(this).val());
5185				$(this).val('');
5186				$(this).defaultValue();
5187			}
5188		});
5189
5190		// default disabled submit button
5191		$(".webform-client-form input.form-submit").addClass('disable');
5192
5193		// prevent double submit click
5194		$(".webform-client-form").on('submit', function () {
5195			$(".webform-client-form input.form-submit").addClass('disable');
5196		});
5197
5198		// redefine some validator stuff with additional functionality
5199		$('.webform-client-form').each(function () {
5200			//init keyup listening to enable submit on required input text (inc. number)
5201			var _form = $(this);
5202			var submitBtn = _form.find('.webform-submit');
5203
5204			_form.find(':input[type="text"], :input[type="email"], textarea, :input[type="number"]').on('paste input', function (e) {
5205				_stripEmojis($(this), e);
5206			});
5207			
5208			_form.find(':input[type="text"], :input[type="email"], textarea, :input[type="number"]').keyup(function (e) {
5209				_stripEmojis($(this), e);
5210
5211				if ($(this).hasClass('required')) {
5212					if (_isWebformRequiredTextFulfilled(_form)) {
5213						submitBtn.removeClass('disable');
5214					} else {
5215						submitBtn.addClass('disable');
5216					}
5217				}
5218			});
5219			
5220			//init change listening to enable submit on required select, checkbox, radio, number
5221			_form.find('select, :input[type="checkbox"], :input[type="radio"], :input[type="number"]').change(function (e) {
5222				_stripEmojis($(this), e);
5223
5224				if (($(this).hasClass('required')) || (($(this).parent().parent().parent().find('span.form-required').length !==0))) {
5225					if (_isWebformRequiredTextFulfilled(_form)) {
5226						submitBtn.removeClass('disable');
5227					} else {
5228						submitBtn.addClass('disable');
5229					}
5230				}
5231			});
5232
5233			// if recaptcha, make sure it is checked
5234			_form.find('.g-recaptcha').each(function() {
5235				var recaptchaIntervalCheck = setInterval(function() {
5236					var response = grecaptcha.getResponse();
5237
5238					if(response.length == 0) {
5239						// not verified
5240						submitBtn.addClass('disable');
5241					} else {
5242						if (_isWebformRequiredTextFulfilled(_form)) {
5243							submitBtn.removeClass('disable');
5244						} else {
5245							submitBtn.addClass('disable');
5246						}
5247					}
5248				}, 1000);
5249			});
5250
5251			if (typeof($(this).validate) != 'function') return;
5252
5253			var settings = $(this).validate().settings;
5254			var highlight = settings.highlight;
5255			var unhighlight = settings.unhighlight;
5256
5257			settings.highlight = function (element, errorClass, validClass) {
5258				var parent = $(element).parents('.form-item').first();
5259				parent.addClass('calacademy-' + errorClass).removeClass('calacademy-' + validClass);
5260
5261				highlight(element, errorClass, validClass);
5262			}
5263
5264			settings.unhighlight = function (element, errorClass, validClass) {
5265				var parent = $(element).parents('.form-item').first();
5266				parent.removeClass('calacademy-' + errorClass).addClass('calacademy-' + validClass);
5267
5268				unhighlight(element, errorClass, validClass);
5269			}
5270		});
5271
5272		// parse checkbox options and add some markup for styling
5273		$('.webform-component-checkboxes label.option').each(function () {
5274			var str = $(this).text();
5275
5276			if (str.indexOf(': ') >= 0) {
5277				str = str.replace(': ', '<p>');
5278				str += '</p>';
5279
5280				$(this).html(str);
5281			}
5282		});
5283
5284		// parse radio options and add some markup for styling
5285		$('.webform-component-radios label.option').each(function () {
5286			var str = $(this).text();
5287
5288			if (str.indexOf(': ') >= 0) {
5289				str = str.replace(': ', '<p>');
5290				str += '</p>';
5291
5292				$(this).html(str);
5293			}
5294		});
5295
5296		// insert missing required indicators to labels
5297		$('.webform-client-form input.required').each(function () {
5298			var label = $(this).siblings('label');
5299
5300			if (label.length == 1) {
5301				if (label.find('span.form-required').length == 0) {
5302					label.append('<span class="form-required">required</span>');
5303				}
5304			}
5305		});
5306
5307		// replace default required field text
5308		$('.webform-client-form span.form-required').each(function () {
5309			$(this).html('required');
5310		});
5311	}
5312
5313	var _initPopups = function () {
5314		if (typeof($.fn.popupwindow) != 'function') return;
5315		$('.popup-trigger').popupwindow(calacademy.Constants.popUpProfiles);
5316	}
5317
5318	var _initFAQ = function () {
5319		$('.faq-answer-container .field-name-field-inline-image').each(function () {
5320			var p = $(this).parent();
5321			p.addClass('has-image');
5322
5323			// wrap image in link if specified
5324			var link = p.find('.field-name-field-blurb-title-link');
5325			var url = false;
5326
5327			if (link.length == 1) {
5328				url = $.trim(link.text());
5329			} else {
5330				var cta = p.find('.field-name-field-email-cta-link a');
5331
5332				if (cta.length == 1) {
5333					url = cta.prop('href');
5334				}
5335			}
5336
5337			if (url) {
5338				$(this).wrap('<a href="' + url + '"></a>');
5339			}
5340		});
5341
5342		// accessibility enhancement
5343		var selectEvent = Modernizr.touch ? 'touchend' : 'click';
5344		var btns = $('.faq > .field > .field-items > .field-item .field-name-field-question');
5345
5346		btns.attr({
5347			'role': 'button',
5348			'tabindex': '0'
5349		});
5350
5351		btns.on(selectEvent, function () {
5352			$(this).parent().toggleClass('open');
5353		});
5354
5355		btns.on('keyup', function (e) {
5356			var enabled = $(this).css('pointer-events') != 'none' && !$(this).is(':disabled');
5357
5358			if (enabled && e.keyCode == jQuery.ui.keyCode.ENTER) {
5359				$(this).trigger(selectEvent);
5360			}
5361		});
5362
5363		// default open
5364		$('.faq-answer-container').each(function () {
5365			if ($(this).find('.field-name-field-autoplay').length == 1) {
5366				var isOpen = $.trim($(this).find('.field-name-field-autoplay').text()) == '1';
5367				
5368				if (isOpen) {
5369					$(this).parent().addClass('open');
5370				}
5371			}
5372		});
5373	}
5374
5375	var _addSectionClasses = function () {
5376		if ($('.nav-educators').length > 0) {
5377			$('body').addClass('section-educators');
5378		}
5379	}
5380
5381	var _addChatLinkClasses = function () {
5382		var selector = 'a[href="/chat"], a[href="http://www.calacademy.org/chat"], a[href="https://www.calacademy.org/chat"], ';
5383		selector += 'a[href="/chat/"], a[href="http://www.calacademy.org/chat/"], a[href="https://www.calacademy.org/chat/"]';
5384
5385		// add popup functionality
5386		$(selector).attr('rel', 'chat');
5387		$(selector).addClass('popup-trigger');
5388
5389		// hide when call center not open
5390		var standaloneChatLinks = $(selector, '.field-type-link-field').addClass('call-center-link');
5391	}
5392
5393	var _clearEmptyRightRail = function () {
5394		if ($('.right-rail #ibss-downloadables .view-content').length == 0) return;
5395
5396		var str = $.trim($('.right-rail #ibss-downloadables .view-content').text());
5397		if (str != '') return;
5398
5399		// remove the panel
5400		$('.right-rail #ibss-downloadables').remove();
5401
5402		// some compensatory styles
5403		$('.right-rail article').eq(0).css({
5404			'border': 0,
5405			'padding-top': 0
5406		});
5407	}
5408
5409	var _fixShareButtonToggleStyles = function () {
5410		// if share buttons are turned off for a node, remove the border from the next article element
5411		if ($.trim($('.right-rail .pane-title').eq(0).text()) == '') {
5412			$('.right-rail .pane-title').eq(0).remove();
5413
5414			$('.right-rail article').eq(0).css({
5415				'border': 0,
5416				'padding-top': 0
5417			});
5418		}
5419	}
5420
5421	var _isSupported = function () {
5422		// manual override
5423		if ($('html').hasClass('unsupported')) return false;
5424
5425		// dismissed
5426		if ($.cookie('dismiss-unsupported', Number)) return true;
5427
5428		if (Modernizr.touch) {
5429			if (calacademy.Utils.isMobile.iOS() && !Modernizr.csspositionsticky) {
5430				// < iOS 7
5431				return false;
5432			} else {
5433				// other touch devices
5434				return true;
5435			}
5436		}
5437
5438		var v = parseFloat(calacademy.Statics.browser.version);
5439
5440		// can't determine version, assume ok
5441		if (isNaN(v)) return true;
5442
5443		var ua = calacademy.Statics.browser.name.toLowerCase();
5444
5445		// IE
5446		if (ua == 'ie' && v < 10) return false;
5447
5448		// Firefox
5449		var _isFirefox = ua.indexOf('firefox') > -1;
5450		if (_isFirefox && v < 11) return false;
5451
5452		return true;
5453	}
5454
5455	var _unsupported = function () {
5456		if (_isSupported()) return;
5457
5458		$('html').addClass('unsupported');
5459
5460		var d = $('<div />');
5461		d.addClass('unsupported-msg');
5462		d.html('<p>For optimal viewing and security, we recommend that you <a href="/supported-browsers">update</a> your browser. <a href="#" class="dismiss">Dismiss</a></p>');
5463
5464		var e = Modernizr.touch ? 'touchend' : 'click';
5465
5466		$('.dismiss', d).on(e, function () {
5467			$.cookie('dismiss-unsupported', '1');
5468			$('.unsupported-msg').remove();
5469			return false;
5470		});
5471
5472		$('body').prepend(d);
5473	}
5474
5475	var _redirectIframeContainers = function () {
5476		// not relevant
5477		if (!$('body').hasClass('iframe-container')) return;
5478		if ($('#content .panel-pane iframe').length != 1) return;
5479
5480		var iframeSrc = $('#content .panel-pane iframe').attr('src').toLowerCase();
5481
5482		// agnostic protocol
5483		if (iframeSrc.indexOf('//') == 0) return;
5484
5485		var currentProtocol = document.location.protocol;
5486
5487		if (iframeSrc.indexOf(currentProtocol) != 0) {
5488			// not a match, switch protocols
5489			var otherProtocol = (currentProtocol == 'https:') ? 'http:' : 'https:';
5490			window.location.href = window.location.href.replace(currentProtocol, otherProtocol);
5491		}
5492	}
5493
5494	var _processArticleSections = function () {
5495		$('.view-display-id-panel_pane_blog_article_section .view-content > div, .view-display-id-panel_pane_ibss_project_article_section .view-content > div').each(function () {
5496			// $(this).addClass('views-row');
5497
5498			// if inline image
5499			if ($('.views-field-field-inline-image img', this).length > 0) {
5500				$(this).addClass('has-inline-image');
5501
5502				// wrap in first cta button if present else cta link if present
5503				if ($('.views-field-field-cta-button a', this).length > 0) {
5504					var link = $('.views-field-field-cta-button a', this).first().clone();
5505					link.empty();
5506					link.addClass('img-link');
5507					$('.views-field-field-inline-image img', this).wrap(link);
5508				} else
5509				if ($('.views-field-field-cta-link a', this).length > 0) {
5510					var link = $('.views-field-field-cta-link a', this).first().clone();
5511					link.empty();
5512					link.addClass('img-link');
5513					$('.views-field-field-inline-image img', this).wrap(link);
5514				}
5515			}
5516
5517			// if text
5518			var hasText = false;
5519
5520			$(this).children('.views-field').each(function () {
5521				if (!$(this).hasClass('views-field-field-subtitle')
5522					&& !$(this).hasClass('views-field-field-autoplay')) {
5523
5524					var text = $.trim($(this).text());
5525
5526					if (text != '') {
5527						hasText = true;
5528					}
5529				}
5530
5531				if (!$(this).hasClass('views-field-field-inline-image')
5532					&& !$(this).hasClass('views-field-field-youtube-video')
5533					&& !$(this).hasClass('views-field-field-image-primary')) {
5534					var text = $.trim($(this).text());
5535
5536					if (text == '') {
5537						$(this).addClass('empty');
5538					}
5539				}
5540			});
5541
5542			if (!hasText) {
5543				$(this).addClass('no-txt');
5544			}
5545		});
5546	}
5547
5548	var _modifyYouTube = function () {
5549		// see /sites/all/modules/custom/calacademy_cam_control/CamControl.js for custom ptz code
5550		if ($('#live-stream-container').length > 0) return;
5551
5552		if ($('.field-type-youtube').length == 0) return;
5553
5554		// load iframe API if necessary
5555		if (typeof(YT) == 'undefined') {
5556			$.getScript('https://www.youtube.com/iframe_api');
5557		}
5558
5559		window.onYouTubeIframeAPIReady = function () {
5560			$('.field-type-youtube').each(function () {
5561				if ($(this).find('iframe').length == 0) return true;
5562
5563				var iframe = $(this).find('iframe');
5564				var src = iframe.attr('src');
5565				var arr = src.split('?');
5566				var youtubeId = arr[0].split('/').pop();
5567				var params = new URLSearchParams(arr[1]);
5568
5569				// check for autoplay field
5570				var autoplay = $(this).parent().find('.field-name-field-autoplay');
5571				var isAutoplay = false;
5572				
5573				if (autoplay.length == 1) {
5574					if (parseInt($.trim(autoplay.text()))) {
5575						isAutoplay = true;
5576						params.set('autoplay', 1);
5577						params.set('mute', 1);
5578					}
5579				}
5580
5581				// replace existing iframe
5582				var id = iframe.attr('id');
5583				var el = $('<div id="' + id + '" />');
5584				el.insertBefore(iframe);
5585				iframe.remove();
5586
5587				var field = $(this);
5588				var player;
5589
5590				var fallbackTimeout = setTimeout(function () {
5591					if (!isAutoplay) return;
5592					// _onYouTubeError(field, player, id);
5593				}, 8000);
5594
5595				player = new YT.Player(id, {
5596					videoId: youtubeId,
5597					playerVars: Object.fromEntries(params),
5598					events: {
5599						'onStateChange': function (e) {
5600							if (e.data == YT.PlayerState.PLAYING) {
5601								clearTimeout(fallbackTimeout);
5602							}
5603						},
5604						'onAutoplayBlocked': function () {
5605							clearTimeout(fallbackTimeout);
5606						},
5607						'onError': function (e) {
5608							clearTimeout(fallbackTimeout);
5609							_onYouTubeError(field, e.target, id);
5610						}
5611					}
5612				});
5613			});
5614		}
5615	}
5616
5617	var _onYouTubeError = function (field, player, id) {
5618		// load fallback once
5619		if (field.hasClass('yt-fallback')) return;
5620
5621		var fallbackId = field.parent().find('.field-name-field-fallback-youtube-video');
5622
5623		if (fallbackId.length == 1 && $.trim(fallbackId.text()) != '') {
5624			player.loadVideoById($.trim(fallbackId.text()));
5625			field.addClass('yt-fallback');
5626
5627			if (typeof(calacademy.onVideoFallback) == 'function') {
5628				calacademy.onVideoFallback(id);
5629			}
5630		}
5631	}
5632
5633	var _cloneAlerts = function () {
5634		// gather content
5635		var og = $('.alerts .flexslider');
5636		var content = [];
5637
5638		$('.slides > li', og).each(function () {
5639			var field = $('.views-field-field-clone-to-homepage', this);
5640
5641			if (field.length == 1) {
5642				if (parseInt(field.text()) == 1) {
5643					content.push($('.views-field-body', this).html());
5644				}
5645			}
5646		});
5647
5648		// long alerts
5649		$('.alerts-long > .view-alerts .slides > li').each(function () {
5650			content.push($('.views-field-body', this).html());
5651		});
5652
5653		// any alerts to clone?
5654		if (content.length == 0) return;
5655
5656		// create a new slideshow container and insert it into the DOM
5657		var alerts = $('<div class="flexslider"><ul class="slides"></ul></div>');
5658		$('.node-right-rail-hours li:first-child h3').after(alerts);
5659
5660		// populate container with content
5661		var homepageUl = $('<ul />');
5662		var i = content.length;
5663
5664		while (i--) {
5665			var li = $('<li />');
5666			li.html(content[i]);
5667			$('.slides', alerts).prepend(li);
5668			homepageUl.prepend(li);
5669		}
5670
5671		$('#homepage-alert-container').append(homepageUl);
5672
5673		// init slideshow
5674		if (typeof($.flexslider) == 'function') {
5675			var options = {
5676				controlNav: false,
5677				slideshow: true
5678			};
5679
5680			if (og.data('flexslider')) {
5681				options = og.data('flexslider').vars;
5682			}
5683
5684			alerts.flexslider(options);
5685		}
5686	}
5687
5688	var _wrapRightRailImages = function () {
5689		$('.right-rail .node .field-name-field-title-link a').each(function () {
5690			var img = $(this).closest('.node').find('.field-name-field-inline-image img');
5691
5692			if (img.length == 1) {
5693				img.wrap($(this).empty());
5694			}
5695		});
5696	}
5697
5698	var _wrapLogoImages = function () {
5699		$('.views-field-image-link a').each(function () {
5700			var img = $(this).closest('.views-row').find('.views-field-field-image-primary img');
5701
5702			if (img.length == 1) {
5703				img.wrap($(this).empty());
5704			}
5705		});
5706	}
5707
5708	var _addNightLifeStyle = function () {
5709		var path = $.trim(window.location.pathname.toLowerCase());
5710
5711		if (path.indexOf('nightlife') >= 0 || $('html').hasClass('nl-test')) {
5712			var nlExceptions = [
5713				'/form/',
5714				'/email-content/',
5715				'/press/'
5716			];
5717
5718			var isException = false;
5719
5720			$.each(nlExceptions, function (i, e) {
5721				if (path.indexOf(e) >= 0) {
5722					isException = true;
5723					return false;
5724				}
5725			});
5726
5727			if (!isException) {
5728				$('body').addClass('section-nightlife');
5729			}
5730		}
5731	}
5732
5733	var _setTabularDataRowHeight = function () {
5734		if ($('.node-tabular-data .field-name-field-extra').length != 1) return;
5735
5736		$('.node-tabular-data .field-name-field-extra table tbody td:first-child').each(function () {
5737			var h = $(this).outerHeight();
5738			$(this).parent('tr').css('height', h + 'px');
5739		});
5740	}
5741
5742	var _ghostScroll = function (per) {
5743		var scroll = $('.scroll-container').first();
5744		var total = scroll.get(0).scrollWidth - scroll.outerWidth();
5745
5746		scroll.scrollTo(Math.round(per * total), 0);
5747
5748		_onTableScroll();
5749	}
5750
5751	var _updateScrollBar = function (per) {
5752		var handle = $('.scrollbar .scroll-handle');
5753
5754		if (!handle.hasClass('dragging')) {
5755			var trackWidth = handle.parent().outerWidth();
5756			var pos = Math.floor(per * (trackWidth - handle.outerWidth()));
5757
5758			handle.css('left', pos + 'px');
5759		}
5760	}
5761
5762	var _onTableScroll = function (e) {
5763		var scroll = $(this).hasClass('scroll-container') ? $(this) : $('.scroll-container').first();
5764		var total = scroll.get(0).scrollWidth - scroll.outerWidth();
5765		var per = scroll.scrollLeft() / total;
5766
5767		_updateScrollBar(per);
5768
5769		// set other element scroll position
5770		var other = $('.scroll-container').not(scroll).get(0);
5771
5772		if (other) {
5773			other.scrollLeft = scroll.scrollLeft();
5774		}
5775	}
5776
5777	var _onScrollTrack = function (e) {
5778		var scrollbar = $('.scrollbar');
5779		var trackWidth = scrollbar.outerWidth();
5780
5781		var per = e.offsetX / trackWidth;
5782		_ghostScroll(per);
5783	}
5784
5785	var _onHandleDrag = function (e) {
5786		var per = parseFloat($(this).css('left')) / ($(this).parent().outerWidth() - $(this).outerWidth());
5787		_ghostScroll(per);
5788	}
5789
5790	var _initTabularData = function () {
5791		if ($('.node-tabular-data .field-name-field-extra').length != 1) return;
5792
5793		_setTabularDataRowHeight();
5794
5795		// clone header
5796		var table = $('.node-tabular-data .field-name-field-extra .field-item table');
5797		table.parent().addClass('scroll-container');
5798		table.addClass('regular');
5799
5800		var clone = table.clone();
5801		clone.find('tbody').remove();
5802		clone.addClass('clone');
5803		clone.removeClass('regular');
5804
5805		clone.insertBefore($('.node-tabular-data .field-name-field-extra'));
5806		clone.wrap('<div class="clone-container scroll-container" />');
5807
5808		// scroll
5809		var scrollbar = $('<div class="scrollbar"><div class="scroll-handle"></div><div class="scroll-track"></div></div>');
5810		$('.node-tabular-data .field-name-field-extra').prepend(scrollbar);
5811
5812		$('.scroll-handle').draggable({
5813			axis: 'x',
5814			containment: 'parent',
5815			drag: _onHandleDrag,
5816			start: function () {
5817				$(this).addClass('dragging');
5818			},
5819			stop: function () {
5820				$(this).removeClass('dragging');
5821			}
5822		});
5823
5824		$('.scroll-track').on('mouseup touchend', _onScrollTrack);
5825
5826		$('.scroll-container').on('scroll', _onTableScroll);
5827		$(window).on('resize.table-scroll', _onTableScroll);
5828	}
5829
5830	var _insertMuseumHours = function () {
5831		if ($('.nuts-and-bolts').length == 0) return;
5832		if ($('body').hasClass('page-homepage')) return;
5833
5834		var endpoint = '/get-museum-hours/';
5835		var timewarp = $.getQueryString('timewarp');
5836
5837		if (typeof(timewarp) == 'string') {
5838			endpoint += '?date=' + $.trim(timewarp);
5839		}
5840
5841		$.ajax({
5842			url: endpoint,
5843			success: function (data, textStatus, XMLHttpRequest) {
5844				if (data.formatted) {
5845					var html = 'Today&rsquo;s hours: ' + data.formatted.html;
5846					var h3 = $('<h3>'+ html +'</h3>');
5847					h3.addClass('museum-hours');
5848					h3.insertAfter($('.nuts-and-bolts h2'));
5849				}
5850			}
5851		});
5852
5853		$('.nuts-and-bolts li:visible:last').addClass('last-visible');
5854	}
5855
5856	var _hackAlerts = function (msg) {
5857		// create first alert with module var
5858		var firstRow = $('<li />');
5859		firstRow.append('<div class="views-field-body">' + msg + '</div>');
5860		firstRow.append('<div class="views-field-field-clone-to-homepage">1</div>');
5861
5862		var lis = [];
5863		lis.push(firstRow);
5864
5865		// add other alerts
5866		var view = $('.alerts .flexslider');
5867
5868		view.find('li').each(function () {
5869			lis.push($(this));
5870		});
5871
5872		// remove original container
5873		$('.alerts').remove();
5874
5875		// create new alert list
5876		var ul = $('<ul />');
5877		ul.addClass('slides');
5878
5879		$.each(lis, function (i, l) {
5880			var li = $('<li />');
5881			li.html(l.html());
5882			ul.append(li);
5883		});
5884
5885		// create flexslider containers
5886		var container = $('<div />');
5887		container.addClass('flexslider');
5888		container.append(ul);
5889
5890		// insert into DOM
5891		var alerts = $('<div />');
5892		alerts.addClass('alerts');
5893		alerts.addClass('region-header');
5894		alerts.append(container);
5895
5896		$('#top-level-nav').append(alerts);
5897
5898		// start carousel
5899		if (typeof($.flexslider) == 'function') {
5900			container.flexslider({
5901				controlNav: false,
5902				slideshow: true,
5903				touch: false,
5904				directionNav: false,
5905				keyboard: false,
5906				pauseOnAction: false,
5907				pauseOnHover: false
5908			});
5909		}
5910	}
5911
5912	var _initAlerts = function () {
5913		if ($.cookie('dismiss-alerts', Number)) return;
5914		if ($('.alerts .slides li').length == 0 && typeof(calacademySoldout) == 'undefined') return;
5915
5916		if (typeof(calacademySoldout) == 'object') {
5917			_hackAlerts(calacademySoldout.msg);
5918		}
5919
5920		$('html').addClass('with-alerts');
5921
5922		var close = $('<a href="#" class="close">Close</a>');
5923
5924		close.on('touchend click', function () {
5925			$('html').removeClass('with-alerts');
5926			$(window).trigger('resize');
5927			$.cookie('dismiss-alerts', '1');
5928			return false;
5929		});
5930
5931		$('.alerts').prepend(close);
5932	}
5933
5934	this.initialize = function () {
5935		$('html').removeClass('no-js');
5936
5937		// create dots
5938		if ($.getQueryString('dots') == '1') {
5939			var dots = $('<div />');
5940			dots.addClass('wavydots');
5941
5942			var i = 1600;
5943			
5944			while (i--) {
5945				var dot = $('<div />');
5946				dot.addClass('dot');
5947				dots.append(dot);
5948			}
5949
5950			$('body').append(dots);
5951		}
5952
5953		// staging class
5954		var hn = window.location.hostname;
5955
5956		if (hn.indexOf('www-stg') === 0 || hn.indexOf('www-local') === 0) {
5957			$('html').addClass('is-staging');	
5958		}
5959
5960		// admin style hack
5961		$('body').removeClass('admin-menu');
5962
5963		// add / remove classes for AJAX events
5964		$(document).on('ajaxSend', function (e, xhr, ajaxOptions) {
5965			var n = ajaxOptions.namespace;
5966			if (n == 'chimera' || n == 'track') return;
5967
5968			$('html').addClass('ajax-loading');
5969		});
5970
5971		$(document).on('ajaxComplete', function (e, xhr, ajaxOptions) {
5972			var n = ajaxOptions.namespace;
5973			if (n == 'chimera' || n == 'track') return;
5974			
5975			$('html').removeClass('ajax-loading');
5976		});
5977
5978		var foo = new HackDOM();
5979		var eduSearch = new EducatorSearch();
5980		var popup = new Popup();
5981		var inat = new iNatEmbed();
5982		var mg = new mediaGallery();
5983
5984		_addNightLifeStyle();
5985		_addMSIEClasses();
5986		_unsupported();
5987		_initAlerts();
5988		_initNav();
5989		calacademy.Utils.initSignupForms();
5990		_initSearchUI();
5991		_initSlideshow();
5992		_initDatepicker();
5993		_initWebforms();
5994		_addChatLinkClasses();
5995		_initPopups();
5996		_initFAQ();
5997		_initDefaultText();
5998		_addSectionClasses();
5999		_processArticleSections();
6000		_clearEmptyRightRail();
6001		_fixShareButtonToggleStyles();
6002		_redirectIframeContainers();
6003		_modifyYouTube();
6004		_cloneAlerts();
6005		_insertMuseumHours();
6006		_wrapRightRailImages();
6007		_wrapLogoImages();
6008		_initTabularData();
6009
6010		calacademy.Utils.alterLinkTargets();
6011		calacademy.Utils.addBadges();
6012
6013		$('.todays-date-from-server').html(todaysDate);
6014
6015		// make stuff touchy
6016		if (Modernizr.touch) {
6017			document.addEventListener('touchstart', function () {}, true);
6018		}
6019
6020		if ($('html').hasClass('debug') || chimera.utils.getQueryString('nowebfont') == '1') _onFontLoad();
6021
6022		// listen for web font load
6023		$.webFontListener({
6024			onFontLoad: function () {
6025				$('html').removeClass('wf-error');
6026				_setTabularDataRowHeight();
6027				_onFontLoad();
6028			},
6029			onFontLoadError: function () {
6030				calacademy.Utils.log('onFontLoadError');
6031				$('html').addClass('wf-error');
6032				_onFontLoad();
6033			}
6034		});
6035
6036		// orientation change listener
6037		$(window).on('orientationchange', function () {
6038			clearTimeout(_orientationChangeTimeout);
6039			_orientationChangeTimeout = setTimeout(_onOrientationChange, 100);
6040		});
6041
6042		if ($.getQueryString('shake') == '1' || calacademy.Constants.isShake) {
6043			$(window).on('load', function () {
6044				setTimeout(function () {
6045					$('body').addClass('shake');
6046
6047					var secs = $.getQueryString('duration') ? parseInt($.getQueryString('duration')) : 10;
6048					var speed = $.getQueryString('speed') ? parseInt($.getQueryString('speed')) : 500;
6049					$('body').css('animation-duration', (speed / 1000) + 's');
6050
6051					setTimeout(function () {
6052						$('body').removeClass('shake');
6053					}, secs * 100);
6054				}, 100);
6055			});
6056		}
6057	}
6058
6059	this.initialize();
6060}
6061;
6062(function ($, Drupal, window, document, undefined) {
6063
6064	var _pageDailyCalendar = function () {
6065		if (typeof(calacademy.onDailyCalendarDate) == 'function') {
6066			calacademy.onDailyCalendarDate();
6067		}
6068
6069		// suppress iOS keyboard
6070		$('.form-item-field-date-value-value-date input').prop('readonly', true);
6071
6072		// suppress typing (except Firefox)
6073		if (calacademy.Statics.browser.name != 'Firefox') {
6074			$('.form-item-field-date-value-value-date input').on('focus', function () {
6075				$(this).trigger('blur');
6076			});
6077		}
6078
6079		// fix pagination that broke randomly
6080		$('#date-pager a').off('click');
6081
6082		$('#date-pager a').on('click', function () {
6083			// suppress crazy clicks
6084			if ($('html').hasClass('ajax-loading')) return false;
6085
6086			var arr = $(this).attr('href').split('/');
6087			var date = false;
6088
6089			// weird views issue that appends the node id to the end
6090			// of the pagination href ala...
6091			// http://calacademy-local.calacademy.org/daily-calendar-view/2014-06-04//1876
6092			// ...so just find the first with a dash, starting at the end
6093			var i = arr.length;
6094
6095			while (i--) {
6096				var d = arr[i];
6097
6098				if (d.indexOf('-') >= 0) {
6099					date = d;
6100					break;
6101				}
6102			}
6103
6104			if (date == false) return false;
6105
6106			// set and trigger the real picker
6107			var realPicker = $('.views-widget-filter-field_date_value input');
6108			realPicker.val(date);
6109			realPicker.trigger('change');
6110
6111			return false;
6112		});
6113
6114		// add some weird style stuff once
6115		if ($('.js-clone').length > 0) return;
6116
6117		var orig = $('.view-daily-calendar table');
6118		var clone = orig.clone();
6119
6120		clone.addClass('js-clone');
6121
6122		orig.after(clone);
6123	}
6124
6125	var _fixHeroViewsImages = function () {
6126		// views
6127		var arr = [
6128			'.view:not(.skip-hero-processing) .views-field-field-hero-region',
6129			'.view:not(.skip-hero-processing) .views-field-field-image-primary'
6130		];
6131
6132		$(arr.join(', ')).each(function () {
6133			calacademy.Utils.fixHeroField($('.field-content', this), $('.field-content > a', this));
6134		});
6135
6136		// load effects
6137		calacademy.Utils.addImageLoadEvent($(arr.join(', ')));
6138
6139		// user page
6140		calacademy.Utils.fixHeroField($('.pane-user-field-hero-region'), []);
6141	}
6142
6143	var _exposedFilters = function () {
6144		// change the first option on exposed form selects to match the associated label
6145		$('.exposed-filters form label').each(function () {
6146			var str = $.trim($(this).text());
6147			var select = $('#' + $(this).attr('for'));
6148
6149			if (!select.is('[multiple]') && $('option', select).length > 0) {
6150				$('option', select).first().text(str);
6151			}
6152		});
6153
6154		// default text
6155		$('.exposed-filters input[type="text"]').each(function () {
6156			var label = $('label', $(this).parents('.views-exposed-widget'));
6157			$(this).attr('placeholder', $.trim(label.text()));
6158			$(this).defaultValue();
6159		});
6160	}
6161
6162	var _addExtraClasses = function () {
6163		var classes = $.getQueryString('classes');
6164
6165		if (typeof(classes) == 'string') {
6166			var arr = classes.split(',');
6167
6168			$.each(arr, function (i, val) {
6169				$('html').addClass($.trim(val));
6170			});
6171		}
6172
6173		$('.pane-node-field-highlight').each(function () {
6174			if (!$(this).hasClass('chimera') && $.trim($(this).text()) == '' && $(this).find('img').length == 0 && $(this).find('.chimera').length == 0) {
6175				$(this).hide();
6176			}
6177		});
6178	}
6179
6180	var _replace = function () {
6181		$('.view-content .field-content').each(function () {
6182			var pattern = /{{(.?[a-zA-Z0-9]+)}}/g;
6183			var matches = this.innerHTML.match(pattern);
6184			
6185			if ($.isArray(matches) && matches.length > 0) {
6186				this.innerHTML = this.innerHTML.replace(pattern, '<span class="num">$1</span>');	
6187			}
6188		});
6189
6190		$(window).off('resize.num');
6191		
6192		$(window).on('resize.num', function () {
6193			$('span.num').each(function () {
6194				var h = $(this).outerHeight();
6195				$(this).css('min-width', h + 'px');
6196			});
6197		});
6198
6199		$(window).trigger('resize.num');
6200	}
6201
6202	Drupal.behaviors.calacademy_zen = {
6203		'attach': function(context, settings) {
6204			_addExtraClasses();
6205			_exposedFilters();
6206			_fixHeroViewsImages();
6207			_replace();
6208			calacademy.Utils.addBadges();
6209
6210			// remove whitespace in view DOM to account
6211			// for Android inline-block margin issue
6212			// @see http://davidwalsh.name/remove-whitespace-inline-block
6213			$('.view-content').cleanWhitespace();
6214
6215			if ($('body').hasClass('page-daily-calendar')) {
6216				_pageDailyCalendar();
6217			}
6218
6219			if (typeof(ChimeraPopup) == 'function') {
6220				var foo = new ChimeraPopup();
6221			}
6222		}
6223	}
6224
6225	// load slideshow images
6226	var _calacademyLoad = function () {
6227		// make sure this only runs once
6228		if ($('html').hasClass('calacademy-has-loaded')) return;
6229		$('html').addClass('calacademy-has-loaded');
6230
6231		// giant slideshows crash older touch devices
6232		// Android seems ok
6233		if (Modernizr.touch && !Modernizr.csspositionsticky && !calacademy.Utils.isMobile.Android()) {
6234			// remove everything but the first slide (offset by one per looping)
6235			var firstSlide = $('.slideshow-hero-large li').eq(1);
6236			$('.slideshow-hero-large').html(firstSlide.html());
6237		}
6238
6239		$('img.delay-load').each(function () {
6240			// skip midfeature, see below
6241			if ($(this).parents('.slideshow-midfeature').length > 0) return;
6242			
6243			// forgot to specify smartphone rendition
6244			if (typeof($(this).data('smartphone-src')) == 'undefined') {
6245				$(this).data('smartphone-src', $(this).data('src'));
6246			}
6247
6248			// homepage gets a special, shorter rendition
6249			if ($('body').hasClass('page-homepage')) {
6250				$(this).data('src', $(this).data('short-hero-src'));
6251			}
6252
6253			var src = $(this).data('src');
6254			$(this).removeAttr('src');
6255
6256			$(this).load(function () {
6257				$(window).trigger('resize.slideshow-layout');
6258
6259				if ($(this).parents('.slideshow-hero-large, .slideshow-hero').length > 0) {
6260					$(this).parents('li').addClass('slide-loaded');
6261					$(this).parents('.slides').addClass('slides-loaded');
6262					$(this).parents('.slideshow-hero-large, .slideshow-hero').addClass('slideshow-loaded');
6263					// $('.flex-caption', $(this).parents('li')).addClass('slide-loaded');
6264				}
6265
6266				if ($(this).closest('.clear-height').length == 1) {
6267					$(this).closest('.clear-height').css('min-height', $(this).outerHeight(true));
6268				}
6269			});
6270
6271			if ($(this).parents('.slideshow-hero-large, .page-homepage .creature').length > 0 && $(window).width() < calacademy.Constants.breakpoints.tablet) {
6272				$(this).attr('src', $(this).data('smartphone-src'));
6273			} else {
6274				$(this).attr('src', src);
6275			}
6276		});
6277
6278		// background img for midfeature
6279		$(window).resize(function () {
6280			$('.slideshow-midfeature .views-field-field-slideshow-frame-bg-image, .slideshow-midfeature .field-name-field-slideshow-frame-bg-image').each(function () {
6281				var img = $('img', this);
6282
6283				if (img.length == 1) {
6284					var src;
6285
6286					if ($(window).width() < calacademy.Constants.breakpoints.tablet) {
6287						src = img.data('smartphone-src');
6288					} else {
6289						src = img.data('src');
6290					}
6291
6292					$(this).css('background-image', 'url(' + src + ')');
6293				}
6294			});
6295		});
6296
6297		$(window).trigger('resize');
6298
6299		// other homepage stuff
6300		if ($('body').hasClass('page-homepage')) {
6301			PageHomepageStatic.onPageLoad();
6302		}
6303
6304		$(window).trigger('resize.slideshow-layout');
6305
6306		setTimeout(function () {
6307			$(window).trigger('resize.slideshow-layout');
6308		}, 100);
6309	}
6310
6311	// whichever runs first...
6312	$(window).load(_calacademyLoad);
6313	setTimeout(_calacademyLoad, 5000);
6314
6315})(jQuery, Drupal, this, this.document);
6316
6317;
6318var PageHomepage = function () {
6319	var $ = jQuery;
6320
6321	var _getViewsFieldElement = function (field) {
6322		var el = $('<div />');
6323		el.addClass('views-field');
6324		el.addClass('views-field-' + field);
6325
6326		return el;
6327	}
6328
6329	var _createViewRowsFromEntities = function (container, entities, offset) {
6330		if (isNaN(offset)) offset = 0;
6331		var i = offset + 1;
6332
6333		entities.each(function () {
6334			// eyebrow
6335			var eyebrow = false;
6336
6337			if ($('.field-name-field-subtitle h2', this).length) {
6338				eyebrow = _getViewsFieldElement('name');
6339				eyebrow.html($('.field-name-field-subtitle h2', this).html());
6340			}
6341
6342			// title
6343			var title = _getViewsFieldElement('title');
6344			title.html($('header .node-title', this).html());
6345
6346			// image
6347			calacademy.Utils.fixHeroField($('.views-field-field-hero-region', this), $('a', title));
6348			$('a.video', this).wrap($('<div class="field-content" />'));
6349
6350			// description
6351			var desc = _getViewsFieldElement('body');
6352			desc.html($('.field-name-body', this));
6353
6354			// create row container
6355			var row = $('<div />');
6356			row.addClass('views-row');
6357			row.addClass('views-row-' + i);
6358			i++;
6359
6360			row.append($('.views-field-field-hero-region', this));
6361			row.append(title);
6362			if (eyebrow) row.append(eyebrow);
6363			row.append(desc);
6364
6365			container.append(row);
6366		});
6367	}
6368
6369	var _hackDom = function () {
6370		// layout entities
6371		$('#entities').prepend('<div class="view-container" />');
6372		_createViewRowsFromEntities($('#entities .view-container'), $('.field-name-field-homepage-entities > .field-items > .field-item'));
6373		
6374		// now remove
6375		$('#entities > article').remove();
6376
6377		// clear
6378		$('#entities').after('<br style="clear: both;" />');
6379
6380		if ($('html').hasClass('hide-first-entity')) {
6381			// insert silhouette image
6382			var img = $('<img />');
6383			
6384			img.attr({
6385				id: 'silhouette',
6386				src: $('#first-entity-silhouette').data('src')
6387			});
6388
6389			$('#entities .views-row-1').append(img);
6390		}
6391
6392		// move around hours & admission
6393		$('#hours-and-admission').detach().prependTo('#animal-ambassadors');
6394	}
6395
6396	var _setHeroSlideshowHeight = function () {
6397		var w = $('body').outerWidth();
6398		var aspect = 700 / 1920;
6399
6400		if (w < calacademy.Constants.breakpoints.tablet) {
6401			aspect = 552 / 768;
6402		}
6403
6404		var h = Math.floor(w * aspect);
6405
6406		$('.slideshow-hero-large .flexslider').css('height', h + 'px');
6407	}
6408
6409	var _windowResize = function (e) {
6410		$('#animal-ambassadors').css('min-height', $('#animal-ambassadors img').outerHeight(true));
6411		_setHeroSlideshowHeight();
6412	}
6413
6414	var _cloneNav = function () {
6415		var navClone = $('nav').clone();
6416		navClone.addClass('smartphone-nav');
6417
6418		var s = navClone.find('#search-field');
6419		s.prop('id', 'search-field-smartphone');
6420		s.siblings('label').prop('for', 'search-field-smartphone');
6421
6422		$('#hero').before(navClone);
6423	}
6424
6425	var _setHideFirstEntity = function () {
6426		var field = $('.field-name-field-hide-first-entity');
6427		if (field.length == 0) return;
6428
6429		if (parseInt(field.text()) == 1) {
6430			$('html').addClass('hide-first-entity');
6431		}
6432	}
6433
6434	var _initPromos = function () {
6435		$('.field-name-field-homepage-promos >
6435 .field-items > .field-item').each(function () {
6436			// banner color
6437			var col = 'blue';
6438			var colField = $(this).find('.field-name-field-color');
6439
6440			if (colField.length == 1) {
6441				col = $.trim(colField.text()).toLowerCase();
6442			}
6443
6444			var img = $('<img />', {
6445				src: '/sites/all/themes/calacademy_zen/images/svgs/promo-bg-' + col + '.svg',
6446				alt: 'curved background'
6447			});
6448
6449			$(this).find('.content').append(img);
6450
6451			// position
6452			var position = parseInt($(this).find('.field-name-field-priority-level').text());
6453
6454			if (!isNaN(position)) {
6455				if (position > 0) {
6456					var sections = $('.field-name-field-section > .field-items > .field-item');
6457
6458					if (position <= sections.length) {
6459						var div = $('<div />');
6460						div.addClass('field-name-field-homepage-promos');
6461						div.addClass('field-item');
6462						div.append($(this));
6463
6464						div.insertBefore(sections.eq(position - 1));
6465					}
6466				}
6467			}
6468		});
6469	}
6470
6471	var _sizeLastCard = function () {
6472		var card = $('#banner .slider li:last-child a');
6473		var img = $('#banner .slider img').first();
6474		
6475		card.css('height', 'inherit');
6476
6477		if ($(window).outerWidth() < calacademy.Constants.breakpoints.tablet) {
6478			card.css('height', img.outerHeight() + 'px');
6479		}
6480	}
6481
6482	var _initColumns = function () {
6483		var i = 1;
6484
6485		$('#banner .column').not(':hidden').each(function () {
6486			$(this).addClass('column-' + i);
6487			i++;
6488		});
6489
6490		i = 1;
6491
6492		$('#banner > section').each(function () {
6493			$(this).addClass('section-' + i);
6494			i++;
6495		});
6496
6497		// clone blurb
6498		// var blurb = $('#banner .blurb').clone();
6499		// blurb.addClass('smartphone');
6500		// blurb.insertAfter($('#banner .banner'));
6501	}
6502
6503	var _initArrows = function () {
6504		$('#hero, #banner > section').each(function () {
6505			var button = $('<button>Jump to next section</button>');
6506			button.addClass('jump-to-next-section');
6507
6508			button.on('touchend click', function (e) {
6509				// figure out target
6510				var target;
6511
6512				if ($(this).parent().hasClass('section-1')) {
6513					// from first section, second section
6514					target = $('#banner > section').not('.section-1');
6515				} else {
6516					if ($(this).parent().attr('id') == 'hero') {
6517						// from hero, first section
6518						target = $('#banner > .section-1');
6519					} else {
6520						// from second section, #sections
6521						target = $('#sections');	
6522					}
6523				}
6524				
6525				// offset nav height
6526				var navHeight = $('nav:visible').outerHeight() + parseInt($('nav:visible').css('top'));
6527				
6528				// nav compress
6529				if (!$('html').hasClass('smartphone')) {
6530					navHeight -= 50;	
6531				}
6532
6533				$('html, body').animate({
6534					scrollTop: target.offset().top - navHeight + 1
6535				}, 500);
6536
6537				return false;
6538			});
6539
6540			$(this).append(button);
6541		});
6542	}
6543
6544	var _initLazyLoad = function () {
6545		var _getSrc = function (img) {
6546			var imgSrc = img.parent().data('src');
6547			var container = img.closest('.section-box');
6548
6549			if (container.find('.smartphone-data').length == 1) {
6550				if ($('html').hasClass('smartphone')) {
6551					imgSrc = container.find('.smartphone-data').data('src');
6552				}
6553			}
6554
6555			return imgSrc;
6556		}
6557
6558		$(window).on('scroll.img-load-check resize.img-load-check', function () {
6559			$('.lazy-load img').each(function () {
6560				if ($(this).visible(true)) {
6561					var p = $(this).parent();
6562					var imgSrc = _getSrc($(this));
6563					var previouslyLoaded = p.data('previously-loaded-src');
6564
6565					if (typeof(previouslyLoaded) == 'string') {
6566						if (previouslyLoaded != imgSrc) {
6567							// switching renditions, clear
6568							p.removeClass('lazy-loaded');
6569							p.removeClass('bg-img-loaded');
6570						}
6571					}
6572
6573					p.data('previously-loaded-src', imgSrc);
6574					
6575					if (!p.hasClass('lazy-loaded')) {
6576						p.css('background-image', 'url(' + imgSrc + ')');
6577						p.addClass('lazy-loaded');
6578
6579						// wait for load
6580						var img = new Image();
6581						
6582						$(img).one('load', function () {
6583							p.addClass('bg-img-loaded');
6584							$(this).off();
6585						});
6586
6587						img.src = imgSrc;
6588					}
6589				}
6590			});
6591		});
6592
6593		$(window).trigger('scroll.img-load-check');
6594	}
6595
6596	var _initSections = function () {
6597		$('.section-box').each(function () {
6598			var swap = $.trim($(this).find('.field-name-field-show-label').text());
6599			
6600			if (parseInt(swap) == 1) {
6601				$(this).insertBefore($(this).prev());
6602			}
6603		});
6604	}
6605
6606	this.onBreakpoint = function (device) {
6607		var v = $('#hero video');
6608		if (v.length != 1) return;
6609
6610		var size = (device == 'smartphone') ? 'small' : 'large';
6611
6612		if (v.data('active-size') != size) {
6613			var src = (size == 'small') ? v.data('src-smartphone') : v.data('src');
6614
6615			v.attr('src', src);
6616			v.data('active-size', size);
6617
6618			calacademy.Utils.initHeroVideo(v);
6619		}
6620
6621		$(window).trigger('scroll.img-load-check');
6622	}
6623
6624	this.initialize = function () {
6625		_cloneNav();
6626		
6627		if ($('body').hasClass('page-homepage-v3')) {
6628			_initSections();
6629			_initPromos();
6630			_initColumns();
6631			_initArrows();
6632			_initLazyLoad();
6633			$('.slider').wrap('<div class="slider-container" />');
6634			$(window).on('resize.home-size-last-card', _sizeLastCard);
6635			$(window).trigger('resize.home-size-last-card');
6636		} else {
6637			_setHideFirstEntity();
6638			_hackDom();
6639			
6640			$('#animal-ambassadors').addClass('clear-height');
6641			$(window).on('resize.home-check-scroll', _windowResize);
6642			$(window).on('scroll.home-check-scroll', _setHeroSlideshowHeight);
6643			$(window).trigger('resize.home-check-scroll');
6644		}
6645	}
6646
6647	this.initialize();
6648}
6649
6650var PageHomepageStatic = {
6651	onPageLoad: function () {
6652		var $ = jQuery;
6653
6654		$('html').addClass('page-loaded');
6655
6656		calacademy.Utils.snow();
6657	}
6658};
6659;
6660var PageNightlifeLanding = function () {
6661	var $ = jQuery;
6662	var _device;
6663
6664	this.onBreakpoint = function (device) {
6665		_device = device;
6666		this.layout();
6667
6668		var v = $('#nightlife-video');
6669		if (v.length != 1) return;
6670
6671		var size = (device == 'smartphone') ? 'small' : 'large';
6672
6673		if (v.data('active-size') != size) {
6674			var src = (size == 'small') ? v.data('src-smartphone') : v.data('src');
6675
6676			v.attr('src', src);
6677			v.data('active-size', size);
6678
6679			calacademy.Utils.initHeroVideo(v);
6680		}
6681	}
6682
6683	this.layout = function () {
6684		calacademy.Utils.log('PageNightlifeLanding.layout');
6685		calacademy.Utils.clearClusterHeights($('.page-nightlife-landing #upcoming'));
6686	}
6687  
6688	var _addDynamicJelly = function () {
6689		//calacademy.Utils.addSecondaryBg('secondary-bg-jelly', $('.pane-nightlife-upcoming-next-upcoming-nl .views-row-2'));
6690	}
6691  	
6692	var _addCtaToCarousel = function () {
6693		var buttons = $('.pane-node-field-cta-buttons .field-name-field-cta-link a');
6694		if (buttons.length == 0 || $('.upcoming-events-pane').length != 1) return;
6695
6696		var mimicRow = $('<div class="views-row cta-block" />');
6697		buttons.first().appendTo(mimicRow);
6698
6699		mimicRow.find('a').html('<span>' + mimicRow.find('a').html() + '</span>');
6700		$('.upcoming-events-pane .view-content').append(mimicRow);
6701		
6702		// CTA height
6703		if ($('.side-scroll .cta-block a').length == 0) return;
6704
6705		$(window).on('resize.side-scroll-cta', function () {
6706			$('.side-scroll, .side-scroll-carousel').each(function () {
6707				var img = $(this).find('img').first();
6708				$(this).find('.cta-block a').css('height', img.outerWidth() + 'px');
6709			});
6710		});
6711
6712		$(window).trigger('resize.side-scroll-cta');
6713
6714	}
6715
6716	this.initialize = function () {
6717		calacademy.Utils.log('PageNightlifeLanding.initialize');
6718
6719		$(window).load(function () {
6720			setTimeout(_addDynamicJelly, 500);
6721		});
6722
6723		// sometimes load event doesn't fire
6724		setInterval(_addDynamicJelly, 2000);
6725
6726		_addCtaToCarousel();
6727	}
6728
6729	this.initialize();
6730}
6731;
6732var PageDailyCalendar = function () {
6733	var $ = jQuery;
6734	var _viewDate;
6735	var _lastSelectedDate;
6736	var _html5Picker;
6737
6738	var _getOption = function (i) {
6739		var myFormat = 'YYYY-MM-DD';
6740		var option = $('<option />');
6741		var date = moment(_lastSelectedDate, myFormat).add(i, 'days');
6742
6743		option.val(date.format(myFormat));
6744		option.html(date.format('dddd, MMMM D'));
6745
6746		return option;
6747	}
6748
6749	var _createPseudoPicker = function () {
6750		_html5Picker = $('<select />');
6751
6752		_html5Picker.attr({
6753			'id': 'html5-date-picker'
6754		});
6755
6756		_html5Picker.addClass('pseudo-picker');
6757		_setPseudoOptions();
6758	}
6759
6760	var _setPseudoOptions = function () {
6761		if (!_html5Picker.hasClass('pseudo-picker')) return;
6762
6763		_html5Picker.empty();
6764
6765		var i = 0;
6766
6767		while (i < 60) {
6768			var future = _getOption(i);
6769
6770			if (i == 0) {
6771				future.attr('selected', 'true');
6772			}
6773
6774			_html5Picker.append(future);
6775
6776			if (i > 0) {
6777				var past = _getOption(i * -1);
6778				_html5Picker.prepend(past);
6779			}
6780
6781			i++;
6782		}
6783	}
6784
6785	var _initHtml5Picker = function () {
6786		if (Modernizr.inputtypes.date && Modernizr.touch) {
6787			_html5Picker = $('<input />');
6788
6789			_html5Picker.attr({
6790				'id': 'html5-date-picker',
6791				'type': 'date',
6792				'value': _viewDate
6793			});
6794		} else {
6795			_createPseudoPicker();
6796		}
6797
6798		// some style stuff
6799		_html5Picker.on('focus', function () {
6800			$('.panel-col-first .view-header').addClass('active');
6801		});
6802
6803		// listen for a value change and trigger AJAX
6804		var myEvent = 'change keypress paste textInput input';
6805		if (!Modernizr.touch) myEvent = 'change';
6806
6807		_html5Picker.on(myEvent, function () {
6808			var val = $(this).val();
6809			$('.panel-col-first .view-header').removeClass('active');
6810
6811			if (val != _lastSelectedDate) {
6812				calacademy.Utils.log('triggering AJAX: ' + val);
6813
6814				// set and trigger the real picker
6815				var realPicker = $('.views-widget-filter-field_date_value input');
6816				realPicker.val(val);
6817				realPicker.trigger('change');
6818
6819				_lastSelectedDate = val;
6820
6821				if ($(this).hasClass('pseudo-picker')) {
6822					_setPseudoOptions();
6823				}
6824			}
6825		});
6826
6827		// insert into the DOM
6828		_html5Picker.insertBefore('.pane-daily-calendar .view');
6829	}
6830
6831	this.initialize = function () {
6832		calacademy.Utils.log('PageDailyCalendar.initialize');
6833
6834		// the 'page' date
6835		_viewDate = $('.view-header h3').data('date');
6836		_lastSelectedDate = _viewDate;
6837
6838		// setup our fancy new picker and tell it to trigger the real one
6839		_initHtml5Picker();
6840	}
6841
6842	this.initialize();
6843}
6844;
6845var PageTaxonomyTerm = function () {
6846	var $ = jQuery;
6847	var _device;
6848
6849	this.onBreakpoint = function (device) {
6850		_device = device;
6851	}
6852
6853	var _addSidebarBg = function (offset, tabletOffset, yOffset, yOffsetTablet) {
6854		setTimeout(function () {
6855			var rail = $('.right-rail');
6856
6857			// do nothing since the right rail doesn't exist
6858			if (rail.length == 0) return;
6859			rail = rail.eq(0);
6860
6861			$(window).on('resize.secondary-bg', function () {
6862				var railX = rail.offset().left - offset;
6863				var railY = rail.offset().top;
6864				var railHeight = rail.height() - yOffset;
6865
6866				if ($('html').hasClass('tablet')) {
6867					railHeight += yOffsetTablet;
6868					railX += tabletOffset;
6869				}
6870
6871				// @note
6872				// background-position-x and background-position-y don't work in FF
6873				$('#page').css('background-position', Math.round(railX) + 'px ' + Math.round(railY + railHeight) + 'px');
6874			});
6875
6876			$(window).trigger('resize.secondary-bg');
6877			$('body').addClass('secondary-bg');
6878		}, 500)
6879	}
6880
6881	this.initialize = function () {
6882		calacademy.Utils.log('PageTaxonomyTerm.initialize');
6883
6884		if ($('body').hasClass('section-events')) {
6885			_addSidebarBg(150, 50, 25, 75);
6886		}
6887		if ($('body').hasClass('section-audience')) {
6888			var yOffset = 25;
6889			var yOffsetTablet = 75;
6890
6891			if ($('body').hasClass('page-taxonomy-term-545')) {
6892				yOffset = 250;
6893				yOffsetTablet = -120;
6894			}
6895			if ($('body').hasClass('page-taxonomy-term-547')) {
6896				yOffset = 100;
6897				yOffsetTablet = -60;
6898			}
6899
6900			_addSidebarBg(0, -20, yOffset, yOffsetTablet);
6901		}
6902	}
6903
6904	this.initialize();
6905}
6906;
6907var PageUser = function () {
6908	this.initialize = function() {
6909		var injectHTML = '<p><div class="views-row"><div class="views-field-title"><!--<a href="https://sso.calacademy.org/adfs/ls/IdpInitiatedSignon.aspx">Use Academy authentication</a>--><a href="/user/password">Reset password</a></div></div></p>';
6910		jQuery('#user-login').before(injectHTML);
6911	};
6912	this.initialize();
6913};
6914;
6915/**
6916 * Minified by jsDelivr using Terser v5.19.2.
6917 * Original file: /npm/[email protected]/dist/confetti.browser.js
6918 *
6919 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6920 */
6921!function(t,e){!function t(e,a,n,r){var o=!!(e.Worker&&e.Blob&&e.Promise&&e.OffscreenCanvas&&e.OffscreenCanvasRenderingContext2D&&e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype.transferControlToOffscreen&&e.URL&&e.URL.createObjectURL),i="function"==typeof Path2D&&"function"==typeof DOMMatrix,l=function(){if(!e.OffscreenCanvas)return!1;var t=new OffscreenCanvas(1,1),a=t.getContext("2d");a.fillRect(0,0,1,1);var n=t.transferToImageBitmap();try{a.createPattern(n,"no-repeat")}catch(t){return!1}return!0}();function s(){}function c(t){var n=a.exports.Promise,r=void 0!==n?n:e.Promise;return"function"==typeof r?new r(t):(t(s,s),null)}var h,f,u,d,m,g,p,b,M,v,y,w=(h=l,f=new Map,{transform:function(t){if(h)return t;if(f.has(t))return f.get(t);var e=new OffscreenCanvas(t.width,t.height);return e.getContext("2d").drawImage(t,0,0),f.set(t,e),e},clear:function(){f.clear()}}),x=(m=Math.floor(1e3/60),g={},p=0,"function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame?(u=function(t){var e=Math.random();return g[e]=requestAnimationFrame((function a(n){p===n||p+m-1<n?(p=n,delete g[e],t()):g[e]=requestAnimationFrame(a)})),e},d=function(t){g[t]&&cancelAnimationFrame(g[t])}):(u=function(t){return setTimeout(t,m)},d=function(t){return clearTimeout(t)}),{frame:u,cancel:d}),C=(v={},function(){if(b)return b;if(!n&&o){var e=["var CONFETTI, SIZE = {}, module = {};","("+t.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {","  if (msg.data.options) {","    CONFETTI(msg.data.options).then(function () {","      if (msg.data.callback) {","        postMessage({ callback: msg.data.callback });","      }","    });","  } else if (msg.data.reset) {","    CONFETTI && CONFETTI.reset();","  } else if (msg.data.resize) {","    SIZE.width = msg.data.resize.width;","    SIZE.height = msg.data.resize.height;","  } else if (msg.data.canvas) {","    SIZE.width = msg.data.canvas.width;","    SIZE.height = msg.data.canvas.height;","    CONFETTI = module.exports.create(msg.data.canvas);","  }","}"].join("\n");try{b=new Worker(URL.createObjectURL(new Blob([e])))}catch(t){return void 0!==typeof console&&"function"==typeof console.warn&&console.warn("🎊 Could not load worker",t),null}!function(t){function e(e,a){t.postMessage({options:e||{},callback:a})}t.init=function(e){var a=e.transferControlToOffscreen();t.postMessage({canvas:a},[a])},t.fire=function(a,n,r){if(M)return e(a,null),M;var o=Math.random().toString(36).slice(2);return M=c((function(n){function i(e){e.data.callback===o&&(delete v[o],t.removeEventListener("message",i),M=null,w.clear(),r(),n())}t.addEventListener("message",i),e(a,o),v[o]=i.bind(null,{data:{callback:o}})}))},t.reset=function(){for(var e in t.postMessage({reset:!0}),v)v[e](),delete v[e]}}(b)}return b}),I={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function T(t,e,a){return function(t,e){return e?e(t):t}(t&&null!=t[e]?t[e]:I[e],a)}function E(t){return t<0?0:Math.floor(t)}function P(t){return parseInt(t,16)}function S(t){return t.map(O)}function O(t){var e=String(t).replace(/[^0-9a-f]/gi,"");return e.length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),{r:P(e.substring(0,2)),g:P(e.substring(2,4)),b:P(e.substring(4,6))}}function k(t){t.width=document.documentElement.clientWidth,t.height=document.documentElement.clientHeight}function B(t){var e=t.getBoundingClientRect();t.width=e.width,t.height=e.height}function F(t,e){e.x+=Math.cos(e.angle2D)*e.velocity+e.drift,e.y+=Math.sin(e.angle2D)*e.velocity+e.gravity,e.velocity
6921*=e.decay,e.flat?(e.wobble=0,e.wobbleX=e.x+10*e.scalar,e.wobbleY=e.y+10*e.scalar,e.tiltSin=0,e.tiltCos=0,e.random=1):(e.wobble+=e.wobbleSpeed,e.wobbleX=e.x+10*e.scalar*Math.cos(e.wobble),e.wobbleY=e.y+10*e.scalar*Math.sin(e.wobble),e.tiltAngle+=.1,e.tiltSin=Math.sin(e.tiltAngle),e.tiltCos=Math.cos(e.tiltAngle),e.random=Math.random()+2);var a=e.tick++/e.totalTicks,n=e.x+e.random*e.tiltCos,r=e.y+e.random*e.tiltSin,o=e.wobbleX+e.random*e.tiltCos,l=e.wobbleY+e.random*e.tiltSin;if(t.fillStyle="rgba("+e.color.r+", "+e.color.g+", "+e.color.b+", "+(1-a)+")",t.beginPath(),i&&"path"===e.shape.type&&"string"==typeof e.shape.path&&Array.isArray(e.shape.matrix))t.fill(function(t,e,a,n,r,o,i){var l=new Path2D(t),s=new Path2D;s.addPath(l,new DOMMatrix(e));var c=new Path2D;return c.addPath(s,new DOMMatrix([Math.cos(i)*r,Math.sin(i)*r,-Math.sin(i)*o,Math.cos(i)*o,a,n])),c}(e.shape.path,e.shape.matrix,e.x,e.y,.1*Math.abs(o-n),.1*Math.abs(l-r),Math.PI/10*e.wobble));else if("bitmap"===e.shape.type){var s=Math.PI/10*e.wobble,c=.1*Math.abs(o-n),h=.1*Math.abs(l-r),f=e.shape.bitmap.width*e.scalar,u=e.shape.bitmap.height*e.scalar,d=new DOMMatrix([Math.cos(s)*c,Math.sin(s)*c,-Math.sin(s)*h,Math.cos(s)*h,e.x,e.y]);d.multiplySelf(new DOMMatrix(e.shape.matrix));var m=t.createPattern(w.transform(e.shape.bitmap),"no-repeat");m.setTransform(d),t.globalAlpha=1-a,t.fillStyle=m,t.fillRect(e.x-f/2,e.y-u/2,f,u),t.globalAlpha=1}else if("circle"===e.shape)t.ellipse?t.ellipse(e.x,e.y,Math.abs(o-n)*e.ovalScalar,Math.abs(l-r)*e.ovalScalar,Math.PI/10*e.wobble,0,2*Math.PI):function(t,e,a,n,r,o,i,l,s){t.save(),t.translate(e,a),t.rotate(o),t.scale(n,r),t.arc(0,0,1,i,l,s),t.restore()}(t,e.x,e.y,Math.abs(o-n)*e.ovalScalar,Math.abs(l-r)*e.ovalScalar,Math.PI/10*e.wobble,0,2*Math.PI);else if("star"===e.shape)for(var g=Math.PI/2*3,p=4*e.scalar,b=8*e.scalar,M=e.x,v=e.y,y=5,x=Math.PI/y;y--;)M=e.x+Math.cos(g)*b,v=e.y+Math.sin(g)*b,t.lineTo(M,v),g+=x,M=e.x+Math.cos(g)*p,v=e.y+Math.sin(g)*p,t.lineTo(M,v),g+=x;else t.moveTo(Math.floor(e.x),Math.floor(e.y)),t.lineTo(Math.floor(e.wobbleX),Math.floor(r)),t.lineTo(Math.floor(o),Math.floor(l)),t.lineTo(Math.floor(n),Math.floor(e.wobbleY));return t.closePath(),t.fill(),e.tick<e.totalTicks}function A(t,a){var i,l=!t,s=!!T(a||{},"resize"),h=!1,f=T(a,"disableForReducedMotion",Boolean),u=o&&!!T(a||{},"useWorker")?C():null,d=l?k:B,m=!(!t||!u)&&!!t.__confetti_initialized,g="function"==typeof matchMedia&&matchMedia("(prefers-reduced-motion)").matches;function p(e,a,o){for(var l,s,h,f,u,m=T(e,"particleCount",E),g=T(e,"angle",Number),p=T(e,"spread",Number),b=T(e,"startVelocity",Number),M=T(e,"decay",Number),v=T(e,"gravity",Number),y=T(e,"drift",Number),C=T(e,"colors",S),I=T(e,"ticks",Number),P=T(e,"shapes"),O=T(e,"scalar"),k=!!T(e,"flat"),B=function(t){var e=T(t,"origin",Object);return e.x=T(e,"x",Number),e.y=T(e,"y",Number),e}(e),A=m,R=[],N=t.width*B.x,z=t.height*B.y;A--;)R.push((l={x:N,y:z,angle:g,spread:p,startVelocity:b,color:C[A%C.length],shape:P[(f=0,u=P.length,Math.floor(Math.random()*(u-f))+f)],ticks:I,decay:M,gravity:v,drift:y,scalar:O,flat:k},s=void 0,h=void 0,s=l.angle*(Math.PI/180),h=l.spread*(Math.PI/180),{x:l.x,y:l.y,wobble:10*Math.random(),wobbleSpeed:Math.min(.11,.1*Math.random()+.05),velocity:.5*l.startVelocity+Math.random()*l.startVelocity,angle2D:-s+(.5*h-Math.random()*h),tiltAngle:(.5*Math.random()+.25)
6921*Math.PI,color:l.color,shape:l.shape,tick:0,totalTicks:l.ticks,decay:l.decay,drift:l.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:3*l.gravity,ovalScalar:.6,scalar:l.scalar,flat:l.flat}));return i?i.addFettis(R):(i=function(t,e,a,o,i){var l,s,h=e.slice(),f=t.getContext("2d"),u=c((function(e){function c(){l=s=null,f.clearRect(0,0,o.width,o.height),w.clear(),i(),e()}l=x.frame((function e(){!n||o.width===r.width&&o.height===r.height||(o.width=t.width=r.width,o.height=t.height=r.height),o.width||o.height||(a(t),o.width=t.width,o.height=t.height),f.clearRect(0,0,o.width,o.height),(h=h.filter((function(t){return F(f,t)}))).length?l=x.frame(e):c()})),s=c}));return{addFettis:function(t){return h=h.concat(t),u},canvas:t,promise:u,reset:function(){l&&x.cancel(l),s&&s()}}}(t,R,d,a,o),i.promise)}function b(a){var n=f||T(a,"disableForReducedMotion",Boolean),r=T(a,"zIndex",Number);if(n&&g)return c((function(t){t()}));l&&i?t=i.canvas:l&&!t&&(t=function(t){var e=document.createElement("canvas");return e.style.position="fixed",e.style.top="0px",e.style.left="0px",e.style.pointerEvents="none",e.style.zIndex=t,e}(r),document.body.appendChild(t)),s&&!m&&d(t);var o={width:t.width,height:t.height};function b(){if(u){var e={getBoundingClientRect:function(){if(!l)return t.getBoundingClientRect()}};return d(e),void u.postMessage({resize:{width:e.width,height:e.height}})}o.width=o.height=null}function M(){i=null,s&&(h=!1,e.removeEventListener("resize",b)),l&&t&&(document.body.contains(t)&&document.body.removeChild(t),t=null,m=!1)}return u&&!m&&u.init(t),m=!0,u&&(t.__confetti_initialized=!0),s&&!h&&(h=!0,e.addEventListener("resize",b,!1)),u?u.fire(a,o,M):p(a,o,M)}return b.reset=function(){u&&u.reset(),i&&i.reset()},b}function R(){return y||(y=A(null,{useWorker:!0,resize:!0})),y}a.exports=function(){return R().apply(this,arguments)},a.exports.reset=function(){R().reset()},a.exports.create=A,a.exports.shapeFromPath=function(t){if(!i)throw new Error("path confetti are not supported in this browser");var e,a;"string"==typeof t?e=t:(e=t.path,a=t.matrix);var n=new Path2D(e),r=document.createElement("canvas").getContext("2d");if(!a){for(var o,l,s=1e3,c=s,h=s,f=0,u=0,d=0;d<s;d+=2)for(var m=0;m<s;m+=2)r.isPointInPath(n,d,m,"nonzero")&&(c=Math.min(c,d),h=Math.min(h,m),f=Math.max(f,d),u=Math.max(u,m));o=f-c,l=u-h;var g=Math.min(10/o,10/l);a=[g,0,0,g,-Math.round(o/2+c)*g,-Math.round(l/2+h)*g]}return{type:"path",path:e,matrix:a}},a.exports.shapeFromText=function(t){var e,a=1,n="#000000",r='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';"string"==typeof t?e=t:(e=t.text,a="scalar"in t?t.scalar:a,r="fontFamily"in t?t.fontFamily:r,n="color"in t?t.color:n);var o=10*a,i=o+"px "+r,l=new OffscreenCanvas(o,o),s=l.getContext("2d");s.font=i;var c=s.measureText(e),h=Math.ceil(c.actualBoundingBoxRight+c.actualBoundingBoxLeft),f=Math.ceil(c.actualBoundingBoxAscent+c.actualBoundingBoxDescent),u=c.actualBoundingBoxLeft+2,d=c.actualBoundingBoxAscent+2;h+=4,f+=4,(s=(l=new OffscreenCanvas(h,f)).getContext("2d")).font=i,s.fillStyle=n,s.fillText(e,u,d);var m=1/a;return{type:"bitmap",bitmap:l.transferToImageBitmap(),matrix:[m,0,0,m,-h*m/2,-f*m/2]}}}(function(){return void 0!==t?t:"undefined"!=typeof self?self:this||{}}(),e,!1),t.confetti=e.exports}(window,{});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.