define("article/story/templates",["underscore/nyt"],function(_){var templates={};return templates.adSlug=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='

ADVERTISEMENT

';return __p},templates.adSlugAccessibility=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='
\n

Advertisement

\n
';return __p},templates.communityPlaceholder=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.drawerItemDebug=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="
\n'+(null==(__t=name)?"":__t)+"\n
";return __p},templates.google300x250Text=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='\n\n';return __p},templates.google728x90Text=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='\n\n';return __p},templates.ledeAd=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.ledeAdDebug=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.marketingModule=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.marketingModuleDebug=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.mediumRectangleAd=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="';return __p},templates.mediumRectangleAdDebug=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+="
MED REC
";return __p},templates.realestateSearchSuggestion=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",results.length&&(__p+="\n\n"),__p+="";return __p},templates.reviewsMapInfowin=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='";return __p},templates.reviewsRestaurantMapInfowin=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='";return __p},templates.reviewsTheaterMapInfowin=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='";return __p},templates.supplementalItem=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.supportedByAd=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates}),define("article/common/helpers/articleAdLayout",["jquery/nyt","underscore/nyt","foundation/views/page-manager"],function(e,t,i){"use strict";var n={shouldArticleHaveLedeAd:function(){var e,t=i.getSection();switch(t){case"books":case"arts":case"movies":case"theater":case"fashion":case"style":case"t-magazine":e=!0;break;default:e=!1}return i.flag("removeSectionDependentAdLogicForJanuary")&&(e=!1),e}};return n}),define("article/story/helpers/sprinkling-rules",["jquery/nyt","underscore/nyt","article/story/templates","article/common/helpers/articleAdLayout"],function(e,t,i,n){"use strict";var s={sprinkler:null,1:e.noop,2:function(){var e=this.getItemFromDrawer("NewsEvent"),t=this.sprinkler.getNextAvailableColumn();e&&t&&!t.isLast&&this.placeItem(t,e)},3:function(){var e=this.getItemFromDrawer("CombinedMarginalia"),t=this.sprinkler.getNextAvailableColumn(0,395);e&&t&&!t.isLast&&this.placeItem(t,e)},4:function(){var e=410,t=this.getItemFromDrawer("PaidPost"),i=this.sprinkler.getNextAvailableColumn(1,e);t&&i&&!i.$el.data("no-ads")&&this.placeItem(i,t,e)},5:function(){var e=this.sprinkler.getLastAvailableColumn();e&&this.placeMarketingModule(e)},6:function(){for(var e=0,t=["RealEstateSearch","CollectionMarginalia"],i=this.getItemFromDrawer(t),n=this.sprinkler.getNextAvailableColumn();i&&this.sprinkler.hasAvailableColumns()&&100>e;)"CollectionMarginalia"!==i.name||n.isLast?"RealEstateSearch"===i.type?this.placeItem(n,i):i.$el.remove():this.placeItem(n,i),i=this.getItemFromDrawer(t),n=this.sprinkler.getNextAvailableColumn(n.order+1),e++},7:function(){var n=this,s=this.sprinkler,a=345,o="undefined"!=typeof this.getItemFromDrawer("Community"),r=s.getNextAvailableColumn(0,a),l={$el:e(i.communityPlaceholder())};o&&r&&(this.placeItem(r,l,a),this.placeCommunityItem(),s.subscribe("nyt:community:peek-rendered",function(){t.delay(function(){n.placeCommunityItem()},2e3),s.stopSubscribing("nyt:community:peek-rendered")}))},8:function(){for(var e=1,t=this.sprinkler.getNextAvailableColumn(1),i=this.sprinkler.config.ads.max;this.sprinkler.hasAvailableColumns()&&i>=e;)this.placeMedRec(t,e),e+=1,t=this.sprinkler.getNextAvailableColumn()},placeLedeAd:function(){var e,t=1,n=this.sprinkler.columns[0];n&&(e=n.remaining>=700?"ledeAd":"mediumRectangleAd",n.$el.append(i[e]({index:t})),n.remaining=0,n.items+=1)},placeItem:function(e,i,n){n=n||0,e.$el.append(i.$el),e.remaining-=n||parseInt(i.$el.outerHeight(!0),10),e.items+=1,this.sprinkler.drawer=t.without(this.sprinkler.drawer,i)},getItemFromDrawer:function(e){var i,n,s,a=this.sprinkler.drawer,o=t.isArray(e)?e:[e];for(n=0;n0?(a.replaceWith(i.$el),this.sprinkler.drawer=t.without(this.sprinkler.drawer,i)):n&&n.$el.children().length>0?(a.replaceWith(n.$el),this.sprinkler.drawer=t.without(this.sprinkler.drawer,n)):s&&s.$el.children().length>0?(a.replaceWith(s.$el),this.sprinkler.drawer=t.without(this.sprinkler.drawer,s)):a.addClass("hidden no-content")},setup:function(e){var i=this,s=0;this.sprinkler=e,this.sprinkler.subscribeOnce("nyt:sprinkler:columns-set",function(){e.pageManager.flag("supportedByAdFullBleed")&&e.columns&&e.columns.length>0&&i.placeSponsorshipAd(),n.shouldArticleHaveLedeAd()&&i.placeLedeAd()}),this.sprinkler.subscribeOnce("nyt:sprinkler:rules-complete",function(){e.broadcast("nyt:ad-library:dfp:discover")}),t.each(i,function(e,i){t.isNaN(parseInt(i,10))||(s+=1)},this),this.length=s},placeSponsorshipAd:function(){var t;(e(".story").hasClass("has-full-bleed-cover")||e(".story").hasClass("has-full-bleed-image-lede")||e(".story").hasClass("has-vertical-full-bleed")||e(".story").hasClass("has-headline-image-topper"))&&(t=this.sprinkler.columns[0],t.$el.append(i.supportedByAd))},run:function(e){"function"==typeof this[e]&&this[e]()}};return s}),define("article/story/views/sprinkler",["underscore/nyt","jquery/nyt","foundation/views/base-view","article/story/templates","article/story/helpers/sprinkling-rules"],function(e,t,i,n,s){"use strict";var a=i.extend({config:{ads:{max:15},height:{firstItem:700,item:900,minItem:400,margin:45},selectors:{drawer:"#storage-drawer",supplemental:".supplemental",subItem:".supplemental-sub-item"}},interrupterAds:{FlexAd:t("#FlexAd")},rules:s,columns:[],supplementals:[],drawer:[],sprinkled:!1,nytEvents:{"nyt:sprinkler:rules-complete":"handleAfterSprinkled"},initialize:function(){this.rules.setup(this),this.isFlexAdInStoryBody()&&this.setNoAdsBetweenFlexFrames(),this.setColumns(),this.pageManager.getUrlParam("DEBUG")&&this.debug(),this.setDrawer(),this.broadcast("nyt:sprinkler:columns-set",this)},handleDomReady:function(){this.measure(),this.hasAvailableColumns()?this.executeRules():this.checkForTablets()},isFlexAdInStoryBody:function(){return t(this.interrupterAds.FlexAd).length>0},setNoAdsBetweenFlexFrames:function(){var e=t(this.interrupterAds.FlexAd).parent(".story-interrupter"),i=e.prevAll(".story-body-supplemental");i.each(function(){t(this).find(".supplemental").attr("data-between-flex-ads",!0)})},checkForTablets:function(){this.$html.hasClass("viewport-portrait")&&this.subscribe("nyt:page-viewportchange",function(){this.magnum.getWidth()>1020&&!this.sprinkled&&(this.initialize(),this.measure(),this.executeRules(),this.broadcast("nyt:refresh-paidposts"))})},setColumns:function(){var e=0,i=this;t(this.config.selectors.supplemental).each(function(n){var s,a,o=0,r=t(this),l=i.getColumnStats(n,r);for(i.setColumnAttributes(l,r);o0&&(this.columns[this.columns.length-1].isLast=!0)},createColumnObject:function(e,t,i){this.columns[i]={$el:e,height:t,remaining:t,items:0,order:i}},determineItemHeight:function(e,t,i){var n;return n=0===e&&0===t?i.firstItemHeight:t+1===i.maxNumberOfItems?i.lastItemHeight:i.defaultItemHeight},setColumnAttributes:function(e,t){e.isShort&&t.addClass("short"),t.attr("data-pre-height",e.height).attr("data-max-items",e.maxNumberOfItems).attr("data-remaining",e.remaining).attr("data-minimum",e.minimum).attr("data-last-item-height",e.lastItemHeight).attr("data-flex-ad-adjacency",e.isFlexAdAdjacent)},measure:function(){var e,i,n=0;for(n=0;n=l&&(d+=1,o=c+h,1===d&&(a=c,i=!0)):c>=l&&(d+=1,o=c,a=1===d?o:s),{firstItemHeight:0===e?a:s,defaultItemHeight:s,height:r,maxNumberOfItems:d,lastItemHeight:o,isShort:i,isFlexAdAdjacent:n,remaining:c,minimum:l,$el:t}},hasFlexAdAdjacency:function(e){var t=e.parent(".story-body-supplemental"),i=t.next(".story-interrupter"),n=i.find(this.interrupterAds.FlexAd);return n.length>0},setDrawer:function(){var e=this;t(this.config.selectors.drawer).children().each(function(i){var n=t(this);e.drawer[i]={$el:n.children(),name:n.attr("data-attribute-name"),type:n.attr("data-attribute-type"),subtype:n.attr("data-attribute-subtype")||""}})},executeRules:function(){var e=0;for(e=0;e<=this.rules.length&&this.hasAvailableColumns();e+=1)this.rules.run(e);this.broadcast("nyt:sprinkler:rules-complete")},handleAfterSprinkled:function(){this.sprinkled=!0},getNextAvailableColumn:function(e,t){var i=e||0,n=this.columns;for(t=t||330,i=i;i=t&&n[i].items<2)return n[i];return e>0?this.getNextAvailableColumn():void 0},hasAvailableColumns:function(){return void 0!==this.getNextAvailableColumn()},getLastColumn:function(e){var t;return t=e&&e.lastOrder?this.columns[e.lastOrder]:this.columns[this.columns.length-1]},getLastAvailableColumn:function(){var e=this.columns,t=this.columns.length-1,i=330;for(t=t;t>=0;t-=1)if(e[t].remaining>=i&&e[t].items<2)return e[t]},getColumn:function(e){return this.columns[e]},debug:function(){t(this.config.selectors.supplemental).each(function(){t(this).addClass("debug-supplemental")}),n.ledeAd=n.ledeAdDebug,n.marketingModule=n.marketingModuleDebug,n.mediumRectangleAd=n.mediumRectangleAdDebug,t(this.config.selectors.subItem).each(function(){var e=t(this),i=e.attr("data-attribute-name")+" "+e.attr("data-attribute-type")+" "+e.attr("data-attribute-subtype");e.html(n.drawerItemDebug({name:i}))})}});return a}),define("article/common/instances/sprinkler",["foundation/views/page-manager","article/story/views/sprinkler"],function(e,t){"use strict";return new t}),define("shared/adlibrary/helpers/filter-placements-mixin",["underscore/nyt"],function(e){"use strict";var t={map:{forcexxl:{placement:"lede-ad",size:[468,648]},force970x250:{placement:"TopAd",size:[970,250]},force970x90:{placement:"TopAd",size:[970,90]},force300x600:{placement:["lede-ad","MiddleRight"],size:[300,600]},force300x250:{placement:"lede-ad",size:[300,250]},force970x418:{placement:"MegaAd",size:[970,418]},forcexxl2:{placement:"lede-ad",size:[450,623]}},run:function(t,i){var n;!e.isUndefined(t)&&this.map[t]&&(n=this.map[t],e.isArray(n.placement)?e.each(n.placement,function(e){i[e]&&(i[e]=n.size)}):i[n.placement]&&(i[n.placement]=n.size))}};return t}),define("shared/adlibrary/views/base-ad",["underscore/nyt","foundation/views/base-view","shared/adlibrary/helpers/filter-placements-mixin"],function(e,t,i){"use strict";var n=t.extend({isReady:!1,constructor:function(e){this.isDisabled()||(this.setUpOptions(e),i.run(this.pageManager.getUrlParam("ad-keywords"),this.placements),t.apply(this,arguments),this.sitewide.initialize(this),this.sitewide.async||(this.sitewide.isReady=!0,this.signalReady()),this.requirements.initialize(this),this.requirements.async||(this.requirements.isReady=!0,this.signalReady()))},requirements:{async:!1,initialize:function(e){this[e.viewName]=e}},sitewide:{async:!1,initialize:function(e){this[e.viewName]=e}},placements:{TopAd:[[728,90],[970,90],[970,66],[970,250]]},broadcastAdEvent:function(){var e,t,i=Array.prototype.slice.call(arguments);if(0===i.length)throw"Please provide event name as the first argument to notify()";e=i.slice(0,1)[0],i=i.slice(1),t=-1===e.indexOf("nyt:")?"nyt:ad-library:"+this.viewName+":"+e:e,this.broadcast.apply(this,[t].concat(i))},listenToAdEvent:function(e,t){var i=Array.prototype.slice.call(arguments,2),n="boolean"==typeof i[0]?i[0]:!1,s="object"==typeof i[0]?i[0]:i[1],a=n?"listenToOnce":"listenTo",o=-1===e.indexOf("nyt:")?"nyt:ad-library:"+this.viewName+":"+e:e;if(arguments.length<2)throw"Please provide event name and callback to watch()";this[a].call(s||this,this.pageManager,o,t)},ignoreAdEvent:function(e,t){var i=-1===e.indexOf("nyt:")?"nyt:ad-library:"+this.viewName+":"+e:e;this.stopSubscribing(i,t)},signalReady:function(){this.sitewide.isReady&&this.requirements.isReady&&this.broadcastAdEvent("ready")},triggerTagX:function(){var e=this.$html,t={module:"Page",viewportWidth:this.$window.width(),ledeMediaSize:e.attr("data-lede-media-size"),pageLayout:e.attr("data-page-layout")};this.trackingTriggerRaw("ad-tracking",t,"interaction")},setUpOptions:function(t){t&&(this.placements=t.placements?e.extend({},this.placements,t.placements):this.placements,this.requirements=t.requirements||this.requirements)},getAdPlacements:function(){return this.placements},getAdKeywords:function(){return this.pageManager.getUrlParam("ad-keywords")},getAdSensitivity:function(){return this.pageManager.getMeta("ad_sensitivity")},isDisabled:function(){return"undefined"!=typeof this.pageManager.getUrlParam("nojoy")||"noads"===this.pageManager.getUrlParam("adx_campaign")||"pay"===this.pageManager.getUrlParam("gwt")},isAmazonDisabled:function(){return"false"===this.pageManager.getMeta("dfp-amazon-enabled")||this.pageManager.getMeta("dfp-amazon-enabled")===!1}});return n}),define("shared/adlibrary/helpers/dfp-ordered-custom-criteria-mixin",["underscore/nyt","foundation/views/page-manager"],function(e,t){"use strict";function i(i){var n="";return"blogs"==t.getMeta("sourceApp")&&e.isString(i)&&i.indexOf(";")>=0&&(i=i.split(";")),e.isArray(i)?(i=e.each(i,function(e,t){n+=t>0?",":"",n+=e.toLowerCase().replace(/[^a-z0-9]+/gi,"").substring(0,30)}),n):e.isString(i)?i.toLowerCase().replace(/[^a-z0-9]+/gi,"").substring(0,30):""}function n(){return"rec"===t.getUrlParam("src")?"recpg":"Recommendation"===t.getUrlParam("module")?"recmod":t.getUrlParam("pgtype")?t.getUrlParam("pgtype"):""}function s(){if(t.getUrlParam("smid")){if("fb-nytimes"===t.getUrlParam("smid")||"fb-share"===t.getUrlParam("smid"))return"facebook";if("tw-nytimes"===t.getUrlParam("smid")||"tw-share"===t.getUrlParam("smid"))return"twitter"}return""}function a(){var e,t=document.createElement("a");return document.referrer?(t.href=document.referrer,e=t.hostname.toLowerCase().split("."),e=e.length>2?e[1]:e[0]):""}var o;return o=[{key:"adv",value:t.getUrlParam("ad-keywords")},{key:"plat",value:"web"},{key:"prop",value:"nyt"},{key:"ver",value:"nyt5"},{key:"sub",value:""},{key:"typ",value:""},{key:"pos",value:""},{key:"spon",value:i(t.getMeta("ad-sponsor")?t.getMeta("ad-sponsor").split(","):[])},{key:"des",value:i(t.getMeta("des"))},{key:"per",value:i(t.getMeta("per"))},{key:"org",value:i(t.getMeta("org"))},{key:"geo",value:i(t.getMeta("geo"))},{key:"ttl",value:i(t.getMeta("ttl"))},{key:"col",value:i(t.getMeta("col"))},{key:"ser",value:i(t.getMeta("ser"))},{key:"id",value:t.getMeta("articleid")},{key:"auth",value:i(t.getMeta("author"))},{key:"amznslots",value:""},{key:"ref",value:n()},{key:"srch",value:""},{key:"edn",value:t.isInternationalEdition()?"intl":"us"},{key:"lan",value:""},{key:"etua",value:""},{key:"subsrc",value:""},{key:"env",value:""},{key:"cs",value:""},{key:"jt",value:""},{key:"ind",value:""},{key:"g",value:""},{key:"em",value:""},{key:"inc",value:""},{key:"wat",value:""},{key:"refdom",value:s()},{key:"topref",value:a()},{key:"sov",value:(Math.floor(4*Math.random())+1).toString()},{key:"refresh",value:"true"}]}),define("shared/adlibrary/helpers/dfp-placements-mixin",["foundation/views/page-manager"],function(e){"use strict";var t,i=[[728,90],[970,90],[970,66],[970,250]];return e.flag("TopFlexAdSiteWide")&&i.push("fluid"),t={TopAd:i,TopAd1:[728,90],TopAd2:[728,90],TopAd3:[728,90],TopAd4:[728,90],TopAd5:[728,90],"lede-ad":[[468,648],[300,600],[300,250]],"marketing-ad":[301,250],MiddleRight1:[300,250],MiddleRight2:[300,250],MiddleRight3:[300,250],MiddleRight4:[300,250],MiddleRight5:[300,250],MiddleRight6:[300,250],MiddleRight7:[300,250],MiddleRight8:[300,250],MiddleRight9:[300,250],MiddleRight10:[300,250],MiddleRight11:[300,250],MiddleRight12:[300,250],MiddleRight13:[300,250],MiddleRight14:[300,250],MiddleRight15:[300,250],MostEm:[88,31],TopNavAd:[88,31],Moses:[[970,418],[970,40]],Frame4A:[96,60],Frame6A:[336,90],Position1:[96,60],Spon2:[88,31],MiddleRightN:[300,250],TopAdN:[728,90],BigAd3:[300,250],Ribbon:[240,75],RibbonInterstitial:[900,500],Interstitial:[[1,1],[640,480]],WelcomeBack:[300,250],sponsortile:[150,50]}}),define("shared/adlibrary/templates",["underscore/nyt"],function(_){var templates={};return templates.iFrameStyleSheet=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.interstitialModal=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='

Continue »

';return __p},templates.ribbonInterstitial=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates}),define("shared/modal/templates",["underscore/nyt"],function(_){var templates={};return templates.modal=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
\n';return __p},templates}),define("shared/modal/views/modal",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/modal/templates"],function(e,t,i,n){"use strict";var s=i.registerView("modal").extend({template:n.modal,className:"modal-container",events:{"click .modal-close, .modal-pointer, .dismiss-button":"close","mouseenter .modal":"handleMouseOutClose"},defaultSettings:{id:"default-modal",modalTitle:"",headerContent:"",modalContent:"",modalFooter:"",addlClasses:"",binding:"",disableBindings:!1,tailDirection:"down",tailTopOffset:0,tailLeftOffset:0,fixedOverride:!1,hasOverlay:!1,hasCloseButton:!1,canOpenOnHover:!1,closeOnMouseOut:!1,mouseOutDelay:0,mouseEnterDelay:0,closeOnClick:!0,autoPosition:!1,positionTailSide:!1,toggleSpeed:300,focusOnShow:!0,closeOnEsc:!0},initialize:function(e){t.bindAll(this,"close","open","mouseEnterOpen","mouseOutClose","handleClickClose","removeFromPage"),this.settings=t.extend({},this.defaultSettings,e),this.settings.modalStyles="width: "+e.width+";",this.render()},render:function(){var e=this.settings.id+"-container";return this.settings.closeClass=this.settings.hasCloseButton?"":"hidden",this.$el.hide().addClass(e).html(this.template(this.settings)),this.$modal=this.$el.find(".modal"),this.$el.find(".overlay").toggle(this.settings.hasOverlay),this},addToPage:function(e,t){var i="string"==typeof e?this.$body.find(e):this.$body;return t="function"==typeof i[t]?t:"append",i[t](this.$el),""===this.settings.binding||this.settings.disableBindings||(this.$body.on("click",this.settings.binding,this.open),this.settings.canOpenOnHover&&(this.$body.on("mouseenter",this.settings.binding,this.mouseEnterOpen),this.$body.on("mouseleave",this.settings.binding,this.mouseOutClose))),this},removeFromPage:function(){return this.close(),this.$el.remove(),""===this.settings.binding||this.settings.disableBindings||(this.$body.off("click",this.settings.binding,this.open),this.settings.canOpenOnHover&&(this.$body.off("mouseenter",this.settings.binding,this.mouseEnterOpen),this.$body.off("mouseleave",this.settings.binding,this.mouseOutClose))),this.remove()},updateTemplate:function(e){return this.$modal.find(".modal-content").html(e),this.positionDialog(!1),this},updateModalTitle:function(e){this.$modal.find(".modal-heading").html(e)},open:function(t){var i=this;return t?(t.returnValue=!1,t.preventDefault(),this.$target=e(t.currentTarget)):this.$target=e(this.settings.binding).eq(0),this.$el.fadeIn(this.settings.toggleSpeed,function(){i.broadcast("nyt:modal-show"),i.broadcast("nyt:modal-show-"+i.settings.id)}),this.settings.autoPosition?this.autoPosition():this.positionDialog(!0),(this.settings.openCallback||e.noop).call(this),this.subscribe("nyt:page-resize",this.positionDialog),this.settings.closeOnEsc&&this.subscribeOnce("nyt:page-key-esc",this.close),this.$body.on("click",this.handleClickClose),this.pageManager.isMobile()&&this.$body.css("cursor","pointer"),this.settings.focusOnShow&&this.$modal.focus(),this},mouseEnterOpen:function(e){window.clearTimeout(this.mouseLeaveTimeout),this.mouseEnterTimeout=t.delay(this.open,this.settings.mouseEnterDelay,e)},close:function(t){var i=this;return t&&t.currentTarget&&this.settings.disableBindings&&e(t.currentTarget).hasClass("modal-pointer")?this:(this.$el.fadeOut(this.settings.toggleSpeed,function(){(i.settings.closeCallback||e.noop).call(i),i.broadcast("nyt:modal-hide"),i.broadcast("nyt:modal-hide-"+i.settings.id)}),this.stopSubscribing("nyt:page-resize",this.positionDialog),this.$body.off("click",this.handleClickClose),window.clearTimeout(this.mouseEnterTimeout),this.pageManager.isMobile()&&this.$body.css("cursor",""),this)},mouseOutClose:function(t){var i=e(t.relatedTarget);i.is(this.$.target)||this.$modal.has(i).length>0||(window.clearTimeout(this.mouseEnterTimeout),this.$modal.is(":visible")&&(this.mouseLeaveTimeout=window.setTimeout(this.close,this.settings.mouseOutDelay)))},handleMouseOutClose:function(){this.settings.closeOnMouseOut&&this.$modal.on("mouseleave",this.close)},handleClickClose:function(e){this.settings.closeOnClick&&0===this.$modal.has(e.target).length&&this.$modal[0]!==e.target&&this.close()},positionDialog:function(t){var i,n,s,a,o,r=this.pageManager.getViewport(),l=this.$target,d=this.$modal,c="absolute",h=d.outerHeight(),u=d.outerWidth(),m={marginLeft:"0",marginTop:"0",top:"",left:""};switch(l&&l.length>0&&(a=l.outerHeight(),o=l.outerWidth(),n=l.offset().top+this.settings.tailTopOffset,s=l.offset().left+this.settings.tailLeftOffset),this.settings.tailDirection){case"up":m.top=n+a+14,m.left=s+Math.floor(.5*o)-Math.floor(.5*u)-9;break;case"up-right":m.top=n+a+14,m.left=s+Math.floor(.5*o)-(u-25);break;case"up-left":m.top=n+a+14,m.left=s+Math.floor(.5*o)-25;break;case"down":m.top=n-h-15,m.left=s+Math.floor(.5*o)-Math.floor(.5*u)-8;break;case"down-right":m.top=n-h-15,m.left=s+Math.floor(.5*o)-(u-25);break;case"down-left":m.top=n-h-15,m.left=s+Math.floor(.5*o)-25;break;case"left":m.top=n+Math.floor(.5*a)-Math.floor(.5*h)+5,this.pageManager.isMobile()&&this.$html.hasClass("navigation-active")?m.left=s+o:m.left=s+o+15;break;case"left-bottom":m.top=n+Math.floor(.5*a)-(h-25),m.left=s+o+15;break;case"left-top":m.top=n+Math.floor(.5*a)-25,m.left=s+o+15;break;case"right":m.top=n+Math.floor(.5*a)-Math.floor(.5*h)+5,m.left=s-u-16;break;case"right-bottom":m.top=n+Math.floor(.5*a)-(h-25),m.left=s-u-16;break;case"right-top":m.top=n+Math.floor(.5*a)-25,m.left=s-u-16;break;case"centered":i=r.height,m.top=h>i?r.top+5:Math.floor(.5*(i-h))+r.top,m.left=Math.floor(.5*r.width-.5*u);break;case"fixed":default:c="fixed",u=this.settings.width||d.width(),h=this.settings.height||d.height(),m.top="50%",m.left="50%",m.marginLeft=-Math.floor(.5*u)+this.settings.tailLeftOffset+"px",m.marginTop=-Math.floor(.5*h)+this.settings.tailTopOffset+"px"}return l&&"fixed"===l.css("position")||this.settings.fixedOverride?(c="fixed",m.top-=r.top,this.$el.css("position","fixed")):this.$el.css("position",""),m.top+=e.isNumeric(m.top)?"px":"",m.left+=e.isNumeric(m.left)?"px":"",d.css("position",c),t===!0?d.css(m):d.stop().animate(m,"fast"),this},autoPosition:function(){var e,t,i,n=this.pageManager.getViewport(),s=this.$modal.outerHeight(),a=this.$modal.outerWidth();return this.settings.positionTailSide&&(i=this.$target.offset().left>n.width/2,this.settings.tailDirection=i?"right":"left"),this.positionDialog(!0),e=this.$target.offset(),this.settings.positionTailSide?(t=this.settings.tailDirection,e.top-n.top-.5*s<0?t+="-top":e.top-n.top+.5*s>n.height&&s-42n.width?t+="-right":e.left<0&&(t+="-left")),this.$modal.find(".modal-pointer").attr("class","modal-pointer modal-pointer-"+t),this.settings.tailDirection=t,this.positionDialog(!0),this}});return s}),define("shared/adlibrary/helpers/dfp-sitewide-requirements-mixin",["jquery/nyt","underscore/nyt","foundation/models/user-data","shared/adlibrary/templates","shared/modal/views/modal","foundation/cookies"],function(e,t,i,n,s,a){ "use strict";var o={aax:"3030",async:!0,dfp:null,isReady:!1,amazonKeywords:[],tabletPortraitSize:1020,small20ViewportSize:719,hasSentComscore:!1,pageViewId:"",hasTrackedPageView:!1,adExclusivity:{active:!1},cookieDataAdded:!1,hasTrackedSlotPageView:!1,adTrackingObj:{responseStart:0},initialize:function(e){var t=this;this.dfp=e,this.adDiagnosticActive=window.NYTD&&window.NYTD.Abra&&"1"===window.NYTD.Abra("www-ad-diagnostic"),this.dfp.isAmazonDisabled()?this.async=!1:this.setUpAmazonGlobal(),this.setPageViewId(),this.dfp.setCustomCriteria({page_view_id:this.getPageViewId()}),this.dfp.setCustomCriteria({aid:a.readCookie("nyt-a")}),i.hasSynced?this.addCookieData():this.dfp.listenToAdEvent("nyt:user-ready",t.addCookieData,t),this.adDiagnosticActive&&(this.adTrackingObj.responseStart=window.performance.timing.responseStart),this.integrateKrux(),this.determineAdSizes(),this.modifyChamber(),this.handleSupportedBy(),this.addPostMessage(t),"article"===this.dfp.pageManager.getApplicationName()&&this.addTrendingKeywords(),this.adDiagnosticActive&&e.listenToAdEvent("ad-viewable",t.handleAdViewable,t),e.listenToAdEvent("ad-rendered",t.handleAdRendered,t),e.listenToAdEvent("ad-rendered",t.handlePageViewId,t),e.listenToAdEvent("ad-slot-defined",t.handleSlotPageViewId,t),e.listenToAdEvent("ad-slot-defined",t.handleSlotDefined,t),e.listenToAdEvent("nyt:masthead-search-toggle",t.handleSearchSponsor,t),e.listenToAdEvent("nyt:page-breakpoint",t.handleBreakpoint,t),e.listenToAdEvent("refresh",t.handleRefresh,t)},addPostMessage:function(e){var t=e;window.addEventListener("message",this.handlePostMessage.bind(t),!1)},handlePostMessage:function(e){var t=this,i=e.origin||e.originalEvent.origin;if("//tpc.googlesyndication.com"===i.split(":")[1]&&e.data){if(!e.data.exclusive)return;t.adExclusivity.active=!0,t.adExclusivity.type=e.data.type,t.dfp.broadcastAdEvent("ad-exclusive-msg-recieved")}},handlePageExclusivity:function(e,t,i){var n=this;i||n.dfp.listenToAdEvent("ad-exclusive-msg-recieved",function(){n.applyExclusiveAdRules(e,t)},n)},applyExclusiveAdRules:function(t,i){var n,s,a=this;a.adExclusivity.active&&("only-child"===a.adExclusivity.type?(a.dfp.setCustomCriteria({adv:i}),a.dfp.addPageLevelParameters(),a.dfp.pageManager.flag("adExclusiveIERibbonCheck")&&e(".ribbon-ad-container").length?a.removeRibbonContainer():a.dfp.listenToAdEvent("nyt:ribbon-rendered",a.removeRibbonContainer,a),a.dfp.deleteAllPlacements(),a.dfp.ignoreAdEvent("nyt:page-scroll",a.dfp.scan),s=e(".story-ad"),s.length&&s.remove(),n=e("#FlexAd"),n.length&&n.remove(),e("#middle-right-paid-post-container").addClass("hidden")):"family-plan"===a.adExclusivity.type&&(a.dfp.setCustomCriteria({adv:i}),a.dfp.addPageLevelParameters(),a.modifyChamber(),e("#middle-right-paid-post-container").addClass("hidden")))},removeRibbonContainer:function(){e(".ribbon-ad-container").hide()},handleSlotPageViewId:function(){this.hasTrackedSlotPageView||(this.dfp.trackingTriggerRaw("ad_slot_defined_page_view_id",{module:"page",priority:!0,ad_slot_defined_page_view_id:this.getPageViewId()},"interaction"),this.hasTrackedSlotPageView=!0)},handlePageViewId:function(){this.hasTrackedPageView||(this.dfp.trackingTriggerRaw("page_view_id",{module:"page",priority:!0,page_view_id:this.getPageViewId()},"interaction"),this.hasTrackedPageView=!0)},setPageViewId:function(){this.pageViewId=this.generatePageViewId()},generatePageViewId:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0,i="x"==e?t:3&t|8;return i.toString(16)})},getPageViewId:function(){return this.pageViewId},modifyChamber:function(){var e=this.dfp;e.clearChamber()},signalReady:function(){this.isReady=!0,this.dfp.signalReady()},handleAdRendered:function(e,t,i,n,s,a){var o=this,r=this.dfp.getAdElement(e),l=this.adTrackingObj[e];switch(this.determineVisibility(r,i),t=t||[0,0],this.adDiagnosticActive&&(l.adRendered=Date.now()-this.adTrackingObj.responseStart,l.creativeId=a,l.lineItemId=n,l.isEmpty=i,this.dfp.trackingTriggerRaw("dfp-ad-rendered",this.adTrackingObj[e],"interaction")),t[0]){case 728:"TopAd"!=e&&o.checkPoliticalStatus(r,i,t[0]);break;case 300:o.checkPoliticalStatus(r,i,t[0]),o.triggerComScore(e,n,s);break;case 301:o.checkPoliticalStatus(r,i,t[0]),o.triggerComScore(e,n,s);break;case 468:o.triggerComScore(e,n,s)}switch(e){case"TopAd":o.handleTopAd(r,t,i),o.handlePageExclusivity(e,n,i);break;case"lede-ad":o.handleBigAdRendered(r,t,i);break;case"SupportedBy":o.handleSupportedByAd(r,i);break;case"Interstitial":o.handleInterstitial(r,i,t);break;case"TopTileAds1":case"TopTileAds2":case"TopTileAds3":case"TopTileAds4":case"TopTileAds5":o.handleTileAds(r,i)}},handleTopAd:function(e,t,i){var n=e.find("iframe"),s=n.prev("div"),a=this.dfp.$adsOnPage.TopAd;return i?(this.dfp.$html.removeClass("has-top-ad"),void this.dfp.$html.removeClass("has-top-flex-frame-ad")):(1605==n.width()||1605==t[0]||0==t[0]?(this.dfp.$html.addClass("has-top-flex-frame-ad"),e.addClass("flex-frame-ad")):(this.dfp.$html.addClass("has-top-ad"),e.removeClass("flex-frame-ad")),e.attr("display","block"),this.has970TopAd=this.dfp.$html.hasClass("has-top-ad")&&(n.width()>728||s.width()>728)&&1605!==t[0],this.hasFlexFrameTopAd=this.dfp.$html.hasClass("has-top-ad")&&(1605==t[0]||0==t[0]),void(this.has970TopAd&&a.css("min-height","26px")))},handleBigAdRendered:function(e,t,i){i?this.dfp.$html.removeClass("has-big-ad"):(t[0]>=468||450===t[0]&&623===t[1])&&(this.dfp.$html.addClass("has-xxl"),this.hasXXLAd=!0)},handleSupportedBy:function(){var t=e("html").hasClass("viewport-medium-10");this.dfp.pageManager.flag("supportedBy")&&(t?this.dfp.addPlacementSize("SupportedBy",[150,50]):this.dfp.addPlacementSize("SupportedBy",[320,25]))},handleSupportedByAd:function(t,i){i||(e(".supported-by").removeClass("hidden"),this.dfp.$html.addClass("has-supported-by-ad"))},handleTileAds:function(t,i){i||e(".tile-ads").removeClass("hidden")},handleAdViewable:function(e){this.adTrackingObj[e].adViewable=Date.now()-this.adTrackingObj.responseStart,this.dfp.trackingTriggerRaw("dfp-ad-viewable",this.adTrackingObj[e],"interaction")},checkPoliticalStatus:function(t,i,n){var s;if(!i)try{t.find("iframe").contents().find("html #politicalAd").length>0&&!this.dfp.hasAdSlug(t)&&(s=e("
").addClass("ad-header").attr("aria-hidden","true").append(e("

")).find("p").css({width:n+"px"}).text("ADVERTISEMENT").end(),t.prepend(s))}catch(a){e.noop()}},integrateKrux:function(){this.setUpKruxGlobal(),this.addKruxKeywords()},setUpKruxGlobal:function(){window.Krux=window.Krux||((window.Krux=function(){window.Krux.q.push(arguments)}).q=[])},addKruxKeywords:function(){var e={},t=this.retrieveKruxData("segs"),i=this.retrieveKruxData("user");t&&(e.ksg=t,window.Krux.segments=t.split(",")||[]),i&&(e.kuid=i,window.Krux.user=i),this.dfp.setCustomCriteria(e)},retrieveKruxData:function(e){var t,i="kx"+e;return window.localStorage?window.localStorage[i]||"":navigator.cookieEnabled?(t=document.cookie.match(i+"=([^;]*)"),t&&window.unescape(t[1])||""):""},setUpAmazonGlobal:function(){var t=this;window.amznads={updateAds:e.noop,renderAd:e.noop},e.ajax({url:"//c.amazon-adsystem.com/aax2/amzn_ads.js",dataType:"script",timeout:1e3}).always(function(){t.getAmazonKeywords()})},getAmazonKeywords:function(){var t=this,i=encodeURIComponent(document.location.toString().split("?")[0]);try{i=encodeURIComponent(""+window.top.location.toString().split("?")[0])}catch(n){e.noop()}e.ajax({url:"//aax.amazon-adsystem.com/e/dtb/bid?src="+t.aax+"&u="+i+"&cb="+Math.round(1e7*Math.random()),dataType:"script",timeout:1e3}).done(function(){t.addAmazonKeywords()}).always(function(){t.signalReady()})},handleRefresh:function(){var e=this.dfp,i=t.toArray(arguments),n=function(){e.refreshSlots.apply(e,i)};this.dfp.isAmazonDisabled()?n():this.refreshAmazonKeywords(n)},refreshAmazonKeywords:function(e){var i=this;window.amznads.getAdsCallback&&(window.amznads.getAdsCallback(this.aax,function(){i.addAmazonKeywords(),t.isFunction(e)&&e()}),this.dfp.googletag.cmd.push(function(){i.dfp.googletag.pubads().clearTargeting("amznslots")}))},addAmazonKeywords:function(){window.amznads.ads&&this.dfp.setCustomCriteria({amznslots:t.keys(window.amznads.ads)})},addTrendingKeywords:function(){var t,i,n=e("#trending-link-json").get(0).innerHTML;try{i=JSON.parse(n)}catch(s){i={}}if(null!==i){switch(i.trending_type){case"trending_page":i.dfpTrendingType="trending";break;case"most_emailed_1":i.dfpTrendingType="email";break;case"most_viewed_7":i.dfpTrendingType="icymi";break;case"most_shared_facebook_1":i.dfpTrendingType="fb"}t={trend:i.dfpTrendingType},this.dfp.setCustomCriteria(t)}},addCookieData:function(){var e=i.attributes;this.addEventTrackerId(e),this.parseSubscriberStatus(e),this.parseDemographicData(e.demographics),this.dfp.broadcastAdEvent("userinfo-data-added"),this.cookieDataAdded=!0},addEventTrackerId:function(e){var t={};"0"!==e.id&&(t.etua=e.id,this.dfp.setCustomCriteria(t))},parseSubscriberStatus:function(e){var t,i={};t="0"===e.id?"anon":e.subscription.length<=4?"reg":"sub",i.sub=t,this.dfp.setCustomCriteria(i)},parseDemographicData:function(e){var n,s={};t.isObject(e)&&(s.cs=i.getCompanySize(),s.jt=i.getJobTitle(),s.ind=i.getJobIndustry(),s.g=i.getGender(),s.em=i.getEmailSubscriptions(),s.inc=i.getIncomeRange(),s.wat=i.getWat(),i.getBundleSubscriptions()&&i.getBundleSubscriptions().length>0&&(n=i.getBundleSubscriptions()[0],s.subprm=n.promotion,s.grace=n.in_grace?"t":"f",t.isString(n.bundle)&&(s.sub=n.bundle.toLowerCase()),t.isString(n.source)&&(s.subsrc=n.source)),this.dfp.setCustomCriteria(s))},determineAdSizes:function(){var e=this.dfp.pageManager.getViewport().width;975>e&&(this.dfp.hasResponsiveSizePlacement("TopAd")||(this.dfp.removePlacementSize("TopAd",[970,90]),this.dfp.removePlacementSize("TopAd",[970,66]),this.dfp.removePlacementSize("TopAd",[970,250])),this.dfp.hasResponsiveSizePlacement("lede-ad")||this.dfp.removePlacementSize("lede-ad",[468,648])),765>e&&(this.dfp.hasResponsiveSizePlacement("TopAd")||this.dfp.removePlacement("TopAd"),this.dfp.hasResponsiveSizePlacement("TopAd1")||this.dfp.removePlacement("TopAd1"),this.dfp.hasResponsiveSizePlacement("TopAd2")||this.dfp.removePlacement("TopAd2"),this.dfp.hasResponsiveSizePlacement("TopAd3")||this.dfp.removePlacement("TopAd3"),this.dfp.hasResponsiveSizePlacement("TopAd4")||this.dfp.removePlacement("TopAd4"),this.dfp.hasResponsiveSizePlacement("TopAd5")||this.dfp.removePlacement("TopAd5"),this.dfp.removePlacement("SponLink"))},handleSlotDefined:function(e,t,i){var n;switch(t){case"lede-ad":n="mid1";break;case"MiddleRight2":n="mid2";break;case"Frame6A":n="artexp";break;case"MostEm":n="emmod";break;case"TopAd":n="top";break;case"TopAd1":n="bottom";break;case"TopNavAd":case"SponsorAd":n="ssearch";break;case"Spon2":n=t;break;case"FlexAd":n="flex";break;case"TopTileAds1":n="tile1";break;case"TopTileAds2":n="tile2";break;case"TopTileAds3":n="tile3";break;case"TopTileAds4":n="tile4";break;case"TopTileAds5":n="tile5"}this.adDiagnosticActive&&(this.adTrackingObj[t]={slotId:t,adSize:i,pageViewId:this.getPageViewId(),responseStart:this.adTrackingObj.responseStart,adSlotDefined:Date.now()-this.adTrackingObj.responseStart,adViewable:null},this.dfp.trackingTriggerRaw("dfp-ad-slot-defined",this.adTrackingObj[t],"interaction")),n&&e.setTargeting("pos",n)},determineVisibility:function(e,t){if(t)e.addClass("hidden").removeClass("request-pending");else try{e.find("iframe").contents().find("html #exclusivity").length>0?e.addClass("hidden ad-exclusivity"):e.removeClass("hidden request-pending")}catch(i){e.removeClass("hidden request-pending")}},handleSearchSponsor:function(){var e=this.dfp.$shell.find("#SponsorAd");e.find("iframe").length>0||this.dfp.requestDynamicAd("SponsorAd",[88,31])},handleBreakpoint:function(e){this.has970TopAd&&this.hideTopAdForSmallViewport(e),this.hasXXLAd&&this.hideXxlForSmallViewport(e),this.hasFlexFrameTopAd&&this.hideFlexFrameTopAdForSmallViewport(e)},hideTopAdForSmallViewport:function(e){var t=this.dfp.getAdElement("TopAd");e<=this.tabletPortraitSize?(t.addClass("hidden"),this.dfp.$html.removeClass("has-top-ad")):(t.removeClass("hidden"),this.dfp.$html.addClass("has-top-ad"))},hideXxlForSmallViewport:function(e){var t=this.dfp.getAdElement("lede-ad");e<=this.tabletPortraitSize?(t.addClass("hidden"),this.dfp.$html.removeClass("has-xxl")):(t.removeClass("hidden"),this.dfp.$html.addClass("has-xxl"))},hideFlexFrameTopAdForSmallViewport:function(e){var t=this.dfp.getAdElement("TopAd");e<=this.small20ViewportSize?(t.addClass("hidden"),this.dfp.$html.removeClass("has-top-ad")):(t.removeClass("hidden"),this.dfp.$html.addClass("has-top-ad"))},triggerComScore:function(e,t,i){this.dfp.getAdElement(e).data("isInitial")||this.hasSentComscore||(this.dfp.trackingComscorePVC({module:"Ad",version:e,action:"Impression",contentCollection:i,contentID:t,region:this.dfp.adPath,eventName:"AdImpression"}),this.hasSentComscore=!0)},setupInterstitial:function(){var e=this;this.interstitialModal=new s({id:"interstitial-ad-modal",modalTitle:"advertisement",tailDirection:"fixed",hasOverlay:!0,hasCloseButton:!0,width:640,height:480,modalContent:n.interstitialModal(),closeCallback:function(){e.closeInterstitial()}}).addToPage(),e.requestInterstitial()},requestInterstitial:function(){this.dfp.broadcastAdEvent("request-placement","Interstitial")},scheduleInterstitialClose:function(){this.closeTimeout=window.setTimeout(this.interstitialModal.close,17e3)},closeInterstitial:function(){window.clearTimeout(this.closeTimeout)},handleInterstitial:function(e,t,i){t||1===i[0]||(this.interstitialModal.open(),this.scheduleInterstitialClose())}};return o}),define("shared/adlibrary/views/dfp",["jquery/nyt","underscore/nyt","shared/adlibrary/views/base-ad","foundation/hosts","shared/adlibrary/helpers/dfp-ordered-custom-criteria-mixin","shared/adlibrary/helpers/dfp-placements-mixin","shared/adlibrary/helpers/dfp-sitewide-requirements-mixin"],function(e,t,i,n,s,a,o){"use strict";var r=i.extend({alreadyRequested:{},notYetRequested:{},readyForDisplay:{},adPath:"",viewName:"dfp",chamber:[],adsOnPage:{},$adsOnPage:{},slots:{},googletag:null,customCriteria:[],placements:a,isScanning:!1,hasTragedy:!1,piiDetected:!1,initialize:function(e){if(this.pageManager.flag("piiBlockDFP")){var i=document.referrer||"",n=window.location.href,a=/([a-zA-Z0-9_\-\.]+)(@|%40)([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})/;(a.test(n)||a.test(i))&&(this.piiDetected=!0)}e=e||{},this.listenToAdEvent("ready",this.handleReady),this.adPath=this.getAdUnitPath(),this.sitewide=o,this.customCriteria=t.each(s,function(e){return t.clone(e)}),this.setCustomCriteria(e.customCriteria),this.discoverAdsOnPage(),this.addToChamber(this.adsOnPage),this.listenToAdEvent("ad-slot-defined",this.handleSlotDefined),this.listenToAdEvent("ad-rendered",this.triggerTagX,!0),this.listenToAdEvent("request-placement",this.requestDynamicAd),this.listenToAdEvent("queue-placement",this.queueDynamicAd),this.listenToAdEvent("scan",this.scan),this.listenToAdEvent("discover",this.discoverAdsOnPage),this.broadcastAdEvent("waiting",this)},getAdUnitPath:function(){var e,i,s=(this.getAdSensitivity(),this.pageManager.getMeta("dfp-ad-unit-path"));return t.isUndefined(s)&&(e=this.pageManager.getMeta("CG"),i=this.pageManager.getMeta("SCG")?"/"+this.pageManager.getMeta("SCG"):"",s=e+i),n.dfpHost+s},handleReady:function(){var e=this;if(this.googletag=window.googletag,!this.googletag)return setTimeout(function(){e.handleReady()},500);if(this.isReady)throw new Error("DFP already in ready state. Do not signal ready more than once.");this.isReady=!0,this.addPageLevelParameters(),this.initialAdRequest(),this.enableServices(),this.scan(),this.listenToAdEvent("placement-added",this.scan)},handleSlotDefined:function(e,t){this.trackRequested(e,t)},requestAdsInViewport:function(){this.requestMultipleAds(this.getAdsInViewport())},trackRequested:function(e,i){this.readyForDisplay[i]=this.notYetRequested[i],delete this.notYetRequested[i],0===t.keys(this.notYetRequested).length&&(this.isScanning=!1,this.stopSubscribing("nyt:page-scroll",this.requestAdsInViewport))},getAdsInViewport:function(){var e=this,i={};return t.each(this.$adsOnPage,function(t,n){!e.alreadyRequested[n]&&e.isElementInViewport(t)&&(i[n]={$el:t,size:e.adsOnPage[n]})}),i},enableServices:function(){var e=this.googletag,t=this;e.cmd.push(function(){e.pubads().addEventListener&&(e.pubads().addEventListener("slotRenderEnded",function(e){t.broadcastAdEvent("ad-rendered",e.slot.getSlotId().getDomId(),e.size,e.isEmpty,e.lineItemId,e.serviceName,e.creativeId)}),e.pubads().addEventListener("impressionViewable",function(e){t.broadcastAdEvent("ad-viewable",e.slot.getSlotId().getDomId())})),t.broadcastAdEvent("enable-services"),e.pubads().enableSingleRequest(),e.enableServices()})},addPageLevelParameters:function(){var e=this.googletag;t.each(this.customCriteria,function(i){t.isEmpty(i.value)||e.cmd.push(function(){e.pubads().setTargeting(i.key,i.value)})})},setCustomCriteria:function(e){t.isObject(e)&&t.each(e,function(e,i){var n=t.findWhere(this.customCriteria,{key:i});e&&(t.isString(e)||t.isArray(e)||(e=e.toString()),n?n.value=e:this.customCriteria.push({key:i,value:e}))},this)},defineAdSlots:function(e){var i=this,n=e.isInitial,s=i.googletag;e=t.omit(e,t.keys(i.slots)),t.isEmpty(e)||s.cmd.push(function(){t.each(e,function(e,a){var o,r,l;t.isArray(e)&&("fluid"===e||t.isArray(e)&&e.indexOf("fluid")>-1?o=e:t.isArray(e)&&t.isArray(e[0])&&t.isArray(e[0][0])?(o=[],r=e):o=e,l=s.defineSlot(i.adPath,o,a),r&&l.defineSizeMapping(r),l.addService(s.pubads()).setCollapseEmptyDiv(!0),i.slots[a]=l,i.$adsOnPage[a].data("isInitial",n),i.broadcastAdEvent("ad-slot-defined",l,a,e))})})},requestMultipleAds:function(e){t.each(e,function(e,t){"undefined"==typeof this.slots[t]?this.requestDynamicAd(t,e.size):this.requestSingleAd(t)},this)},requestSingleAd:function(e){var i=this.googletag,n=this;if(!n.piiDetected&&!this.hasTragedy){if(!n.isReady)return n.listenToAdEvent("ready",function(){n.requestSingleAd(e)},!0);i.cmd.push(function(){i.display(e),t.extend(n.alreadyRequested,n.readyForDisplay),delete n.readyForDisplay[e]})}},discoverAdsOnPage:function(){var t=this,i=e(".ad, .text-ad, .sponsor-ad");i.each(function(e,i){i.id in t.placements&&!t.$adsOnPage[i.id]&&t.addPlacement(i.id)})},addToChamber:function(){this.chamber.push.apply(this.chamber,t.toArray(arguments))},clearChamber:function(){var e=this.chamber;return this.chamber=[],e},initialAdRequest:function(){t.each(this.chamber,function(e){e.isInitial=!0,this.defineAdSlots(e)},this)},requestDynamicAd:function(t,i){var n=this;return n.isReady?this.alreadyRequested[t]?(this.$adsOnPage[t]=e("#"+t),!1):(this.addPlacement(t,i),this.defineAdSlots(this.getPlacement(t)),void this.requestSingleAd(t)):n.listenToAdEvent("ready",function(){n.requestDynamicAd(t,i)},!0)},queueDynamicAd:function(e,t){this.addPlacement(e,t),this.scan()},getAdElement:function(t){return this.$adsOnPage[t]||e()},hasPlacementSize:function(e,t){var i,n=this.placements[e];if(n)for(i=0;i0},scan:function(){this.isScanning||(this.isScanning=!0,this.requestAdsInViewport(),this.subscribe("nyt:page-scroll",this.requestAdsInViewport))}});return r}),define("shared/ad/models/ad",["backbone/nyt"],function(e){"use strict";var t=e.Model.extend({});return t}),define("shared/adlibrary/collections/adx-collection",["backbone/nyt","underscore/nyt","foundation/collections/base-collection","foundation/hosts","shared/ad/models/ad"],function(e,t,i,n,s){"use strict";var a=i.extend({url:n.ADXHost+"/adx/bin/adxrun.html",model:s,initialize:function(e){if(this.options=e||{},this.placements=this.options.placements,!this.options.placements)throw new Error("No ad placements found in ADX collection");t.isUndefined(this.pageManager.getMeta("adxPage"))?this.host=this.pageManager.getUrlParam("adx_campaign")||this.options.adx_campaign||"www.nytimes.com":(this.host="",this.options.page=this.pageManager.getMeta("adxPage")),this.interstitial=this.options.interstitial?1:0,this.setPageParameter()},setPageParameter:function(){var e;this.options.page||(e=location.pathname,e=e.replace(/\d{4}/,"yr").replace(/\d{2}/,"mo").replace(/\d{2}/,"day"),this.options.page=this.host+e)},sync:function(i,n,s){var a=this;return s.dataType="jsonp",s.jsonp="jsonp",s.jsonpCallback="processAdx",s.data={page:a.options.page,positions:t.keys(this.placements).join(","),autoconfirm:0,v:3,cpp:0,attributes:"nyt5",keywords:this.getAdxKeywords(),secureClientside:1},e.sync(i,n,s)},getAdxKeywords:function(){var e=this.pageManager.getMeta("keywords")||"",t=this.pageManager.getUrlParam("ad-keywords"),i=3500;return e.length>i&&(e=e.substring(0,i)),t&&(e=e+","+t),e},parse:function(e){var t,i=[];for(t in e.ads)e.ads.hasOwnProperty(t)&&this.placements.hasOwnProperty(t)&&(e.ads[t].adId=t,i.push(e.ads[t]));return i}});return a}),define("shared/adlibrary/helpers/adx-placements-mixin",[],function(){"use strict";var e={Inv1:[],Inv2:[],Inv3:[],ab1:[],ab2:[],ab3:[],prop1:[],prop2:[],Anchor:[],Bar1:[],ADX_CLIENTSIDE:[]};return e}),define("shared/adlibrary/views/adx",["jquery/nyt","underscore/nyt","shared/adlibrary/views/base-ad","shared/adlibrary/templates","shared/adlibrary/collections/adx-collection","shared/adlibrary/helpers/adx-placements-mixin"],function(e,t,i,n,s,a){"use strict";var o=i.extend({viewName:"adx",placements:a,iframeClass:"ad-frame",initialize:function(){this.ads=new s({placements:this.placements}),this.subscribe(this.ads,"sync",this.receiveAds),this.requestAds(),this.listenToAdEvent("request-placement",function(e){this.renderAdFromData({id:e})})},requestAds:function(){this.ads.fetch()},renderAdFromData:function(t){var i,s;(t.model||t.id)&&(i=t.model||this.ads.findWhere({adId:t.id}),s=t.id||(i?i.get("adId"):null),i&&s&&this.renderInIframe({el:e("#"+s),model:i,frameStyle:n.iFrameStyleSheet(),secondaryIframeClass:"frame-for-article"}))},receiveAds:function(e){var t=this;e.each(function(e){t.renderAdFromData({model:e,id:e.get("adId")})})},renderInIframe:function(i){var n,s,a,o,r,l,d,c=document.createElement("iframe");i=i||{},s=i.model,s&&"undefined"!=typeof s.get&&i.el&&!s.get("hasPainted")&&(i.el=e(i.el),o=s.get("confirmation-url"),r=s.get("creative"),d=s.get("isInlineSafe"),"string"==typeof d&&"n"===d.toLowerCase()&&(d=!1),d?i.el.append(i.el.html()+r):0===i.el.find("iframe").length&&"ADX_CLIENTSIDE"!==s.get("name")&&(a=i.frameStyle?i.frameStyle+r:r,e(c).attr("frameBorder",0).addClass(this.iframeClass).css(this.calculateIFrameCss(s.get("width"),s.get("height"))),i.secondaryIframeClass&&(c.className+=" "+i.secondaryIframeClass),i.el.append(c),c.contentDocument?n=c.contentDocument:c.contentWindow&&(n=c.contentWindow.document),n&&(n.open(),n.write(a),t.defer(function(){n.close()}))),e(i.el.selector+"-alternate-content").addClass("hidden"),o&&""!==o&&(l=new Image,l.src=o),this.trackingTriggerImpression("ad-render",{module:"Ad",version:s.get("name"),action:"Impression",contentCollection:s.get("campaign"),contentID:s.get("classification"),region:i.page||"",eventName:"AdImpression"}),this.broadcastAdEvent("ad-rendered",s.get("adId")),i.callback&&i.callback())},calculateIFrameCss:function(e,t){var i={};return i.width=e||0,i.height=t||0,i}});return o}),define("article/common/views/adlibrary/placements/adx-placements-mixin",[],function(){"use strict";var e={Inv1:[],Inv2:[],Inv3:[],ab1:[],ab2:[],ab3:[],prop1:[],prop2:[],Anchor:[],Bar1:[]};return e}),define("shared/adlibrary/helpers/responsive-gpt-mixin",[],function(){"use strict";var e={setPlacementAfter:function(e,t){return[[[e,0],t]]},disablePlacementAfter:function(e){return[[[e,0],[]]]},setPlacementForViewport:function(e,t){return[[e,0],t]},disablePlacementAfterViewport:function(e){return[[e,0],[]]}};return e}),define("article/common/views/adlibrary/placements/dfp-placements-mixin",["jquery/nyt","foundation/views/page-manager","shared/adlibrary/helpers/responsive-gpt-mixin"],function(e,t,i){"use strict";var n=[i.setPlacementForViewport(1020,["fluid",[728,90],[970,90],[970,250],[1605,300]]),i.setPlacementForViewport(765,["fluid",[728,90],[1605,300]]),i.disablePlacementAfterViewport(0)],s=function(){var e={TopAd:n,TopAd1:[[728,90]],TopAd2:[[728,90]],TopAd3:[[728,90]],TopAd4:[[728,90]],TopAd5:[[728,90]],"lede-ad":[[450,623],[300,600],[300,250]],"marketing-ad":[301,250],MiddleRight1:[300,250],MiddleRight2:[300,250],MiddleRight3:[300,250],MiddleRight4:[300,250],MiddleRight5:[300,250],MiddleRight6:[300,250],MiddleRight7:[300,250],MiddleRight8:[300,250],MiddleRight9:[300,250],MiddleRight10:[300,250],MiddleRight11:[300,250],MiddleRight12:[300,250],MiddleRight13:[300,250],MiddleRight14:[300,250],MiddleRight15:[300,250],Middle1C:[88,31],MostEm:[88,31],Moses:[[1605,300],[970,418],[970,40],[971,90],[971,250],[729,90]],Frame4A:[96,60],Frame6A:[336,90],Position1:[96,60],Spon2:[88,31],MiddleRightN:[300,250],TopAdN:[728,90],BigAd3:[300,250],Ribbon:[244,75],Interstitial:[[1,1],[640,480]],WelcomeBack:[300,250],"supported-by-ad":[150,50],"medium-rectangle-ad-1":[300,250],"medium-rectangle-ad-2":[300,250],"medium-rectangle-ad-3":[300,250],"medium-rectangle-ad-4":[300,250],"medium-rectangle-ad-5":[300,250],"medium-rectangle-ad-6":[300,250],"medium-rectangle-ad-7":[300,250],"medium-rectangle-ad-8":[300,250],"medium-rectangle-ad-9":[300,250],"medium-rectangle-ad-10":[300,250],"medium-rectangle-ad-11":[300,250],"medium-rectangle-ad-12":[300,250],"medium-rectangle-ad-13":[300,250],"medium-rectangle-ad-14":[300,250],"medium-rectangle-ad-15":[300,250],FlexAd:["fluid",[728,90],[1605,300],[1600,512]]};return e},a=function(){var t,n=[i.setPlacementForViewport(1020,["fluid",[728,90],[970,90],[970,250],[1605,300]]),i.setPlacementForViewport(765,["fluid",[728,90]]),i.disablePlacementAfterViewport(0)],s=[i.setPlacementForViewport(1230,[[728,90],[970,90],[970,250]]),i.setPlacementForViewport(765,[[728,90],[300,250]]),i.setPlacementForViewport(0,[[300,250]])],a=[i.setPlacementForViewport(1230,["fluid",[728,90],[970,90],[970,250],[1605,300]]),i.setPlacementForViewport(765,["fluid",[728,90],[1605,300],[300,250]]),i.setPlacementForViewport(0,[[300,250],[414,457]])],o={Ribbon:[244,75],"supported-by-ad":[150,50],TopAd:n,WelcomeBack:[300,250]},r=e(".body-ad--story").length;for(r>0&&(o["body-ad-0"]=a),t=1;r>t;t+=1)o["body-ad-"+t]=s;return o},o=function(){return"oak"==t.getMeta("PT")?a():s()};return o()}),define("article/common/views/adlibrary/requirements/dfp-article-requirements-mixin",["jquery/nyt","underscore/nyt","article/story/templates","article/common/helpers/articleAdLayout","shared/adlibrary/helpers/responsive-gpt-mixin"],function(e,t,i,n,s){"use strict";var a={dfp:null,closeTimeout:null,tabletPortraitSize:1020,ribbonImpressionSent:!1,marginaliaImpressionSent:!1,moreInSent:!1,marginaliaPaidPostCounter:0,flexFrameVariant:null,surveyLink:null,containers:{mobile:{$el:null,selector:".ad.story-ad",isLoaded:!1},desktop:{$el:null,selector:".medium-rectangle-ad",isLoaded:!1}},adExclusivity:!1,initialize:function(e){var t=this;this.dfp=e,this.setupAggroTest(),e.listenToAdEvent("ad-rendered",t.handleAdRendered,t),e.listenToAdEvent("nyt:ribbon-rendered",t.requestRibbonAd,t),e.listenToAdEvent("ad-slot-defined",t.handleSlotDefined,t),e.listenToAdEvent("nyt:comments-panel-opened",t.requestCommentsTile,t),e.listenToAdEvent("nyt:refresh-paidposts",this.addPaidPostPlacements,t),e.listenToAdEvent("ad-exclusive-msg-recieved",function(){t.adExclusivity=!0}),this.dfp.pageManager.flag("paidpostSprinklingFix")&&e.listenToAdEvent("nyt:sprinkler:rules-complete",this.addPaidPostPlacements,t),this.addMarketingPlacement(),this.shouldRequestInterstitial()&&this.dfp.sitewide.setupInterstitial(),this.setArticleCustomCriteria(),this.setAdPlacementsOnPageManager(),this.removeXxlOnLede(),this.removeFinalAdOnShortArticles(),this.dfp.pageManager.flag("removeSectionDependentAdLogicForJanuary")||this.removeFlexAdonSections(),this.dfp.pageManager.flag("paidpostSprinklingFix")||this.addPaidPostPlacements(),this.prepareInitialRequest(),this.setupViewportToggle(),this.checkForTragedy(),e.listenToAdEvent("enable-services",t.handleEnableServices,t)},setupAggroTest:function(){var e;this.aggroTest=-1!==window.magnum.getFlags().indexOf("strik143adAggro")&&window.NYTD.Abra("www-strik-143-ad-aggro")&&"control"!==window.NYTD.Abra("www-strik-143-ad-aggro"),this.aggroTest&&(e=window.NYTD.Abra("www-strik-143-ad-aggro"),this.containers.aggro={$el:null,selector:".flex-ad, .ad.ad-aggro_"+e,isLoaded:!1},this.aggroPlacement=[s.setPlacementForViewport(1230,["fluid",[728,90],[970,90],[970,250],[1605,300]]),s.setPlacementForViewport(765,["fluid",[728,90],[1605,300],[300,250]]),s.setPlacementForViewport(0,[[300,250],[414,457]])])},findNextSupplemental:function(t){var i,n=e("#"+t),s=n.parent().siblings().attr("id").split("-")[1];for(i=parseInt(s,10);i>=1;i--)e("#supplemental-"+i).remove()},prepareInitialRequest:function(){this.dfp.clearChamber(),"tragedy"===this.dfp.getAdSensitivity()?(this.dfp.deleteAllPlacements(),this.dfp.addPlacement({TragedyAd:[2,2]}),this.dfp.requestSingleAd("TragedyAd")):"oak"==this.dfp.pageManager.getMeta("PT")?this.dfp.addToChamber(this.dfp.getPlacement("TopAd","TopNavAd","supported-by-ad")):this.dfp.addToChamber(this.dfp.getPlacement("TopAd","lede-ad","TopNavAd","supported-by-ad"))},checkForTragedy:function(){"tragedy"===this.dfp.getAdSensitivity()&&(this.dfp.addPlacement({ TragedyAd:[2,2]}),this.dfp.requestSingleAd("TragedyAd"))},addPaidPostPlacements:function(){this.dfp.sitewide.adExclusivity.active||this.dfp.pageManager.getCurrentBreakpoint()>=1031&&(this.dfp.pageManager.flag("paidpostSprinklingFix")?(this.dfp.registerBatchRequest({MiddleRightPaidPost1:[300,77],MiddleRightPaidPost2:[300,77],MiddleRightPaidPost3:[300,77],MiddleRightPaidPost4:[300,77]}),this.dfp.triggerSRARequest()):this.dfp.addPlacement({MiddleRightPaidPost1:[300,77],MiddleRightPaidPost2:[300,77],MiddleRightPaidPost3:[300,77],MiddleRightPaidPost4:[300,77]}))},targetInlineAd:function(e,t){var i,n;n=t.split("-"),i=n[n.length-1],t.indexOf("body-ad")>-1&&"number"==typeof parseInt(i)?e.setTargeting("pos","mid"+(parseInt(i)+1)):"number"==typeof parseInt(i)&&e.setTargeting("pos","mid"+i)},setAdTargeting:function(e,t){if(t.indexOf("medium-rectangle-ad")>-1||t.indexOf("story-ad")>-1||t.indexOf("body-ad")>-1)return void this.targetInlineAd(e,t);switch(t){case"marketing":case"marketing-ad":e.setTargeting("pos","mktg");break;case"Spon2":e.setTargeting("pos","comment");break;case"body-ad-0":e.setTargeting("pos","mid1");break;case"body-ad-1":e.setTargeting("pos","mid2");break;case"body-ad-2":e.setTargeting("pos","mid3");break;case"body-ad-3":e.setTargeting("pos","mid4");break;case"body-ad-4":e.setTargeting("pos","mid5");break;case"TopAd":e.setTargeting("pos","top");break;case"TopAd1":e.setTargeting("pos","bottom");break;case"lede-ad":e.setTargeting("pos","mid");break;case"FlexAd":e.setTargeting("pos","mid1")}-1!=t.indexOf("aggro")&&e.setTargeting("pos","mid"+t.split("-").slice(-1)[0])},addMarketingPlacement:function(){var e=0,i=this.dfp;i.$html.hasClass("format-short")||(t.each(i.adsOnPage,function(t,i){i.indexOf("MiddleRight")>-1&&"MiddleRightN"!==i&&e++}),i.getAdElement("MiddleRight"+e).attr("id","marketing-ad"),i.removePlacement("MiddleRight"+e),i.addPlacement("marketing-ad"))},setAdPlacementsOnPageManager:function(){var e=this.dfp;e.pageManager.setMeta("ads_adNames",t.keys(e.placements))},hasJumboLede:function(){return"jumbo"===this.dfp.$html.attr("data-lede-media-size")||this.dfp.$html.hasClass("has-jumbo-lede")},determineAdsizes:function(){this.determineLedeAdSizes()},determineLedeAdSizes:function(){var e=this.dfp.$html.attr("data-page-layout"),t=this.dfp.getAdKeywords(),i=!this.dfp.$html.hasClass("format-short"),n=this.dfp.pageManager.getViewport().width;"a"===e&&"force300x250"===t&&"force300x600"===t&&this.dfp.editPlacementSize("lede-ad",[[300,250],[300,600]]),"b"===e&&(i&&n>=975?this.dfp.editPlacementSize("lede-ad",[468,648]):this.dfp.editPlacementSize("lede-ad",[[300,250],[300,600]]))},setArticleCustomCriteria:function(){var i=this.dfp.pageManager.getViewport().width,n={typ:"art",ledemedsz:this.dfp.$html.attr("data-lede-media-size"),coll:[]},s=this.getArticleLengthParameter(this.dfp.$html.attr("data-keywords")),a=e("#page-config-data"),o=a.length>0?JSON.parse(a.html()).pageconfig:{},r=o.collections;this.aggroTest&&(n.adstridetest="yes"),"oak"==this.dfp.pageManager.getMeta("PT")&&(n.typ="art,oak"),765>i?n.vp="small":i>=766&&1020>i?n.vp="medium":n.vp="large",t.each(r,function(e){t.each(e,function(e){e=e.replace(/-/g,"").toLowerCase(),n.coll.push(e)})}),s&&(n.artlen=s),"Review"==this.dfp.pageManager.getMeta("genre")&&(n.typ=["art","rev"]),this.dfp.setCustomCriteria(n)},getArticleLengthParameter:function(e){var t,i,n={"article-short":"short","article-medium":"medium","article-long":"long",xlong:"xlong"};if(e)for(e=e.split(","),i=0;i0),t||n?(this.dfp.removePlacement("Interstitial"),!1):!0},handleAdRendered:function(e,t,n){var s=this,a=s.dfp,o=a.getAdElement(e);if((o.hasClass("story-ad")||o.hasClass("mega-ad")||o.hasClass("flex-ad"))&&s.handleStoryAd(o,t,n),o.hasClass("body-ad--story"))return void s.handleStoryBodyAd(o,t,n);switch(window.magnum.getFlags().indexOf("accessibilityAdHeaderForSupplementalAds")>-1&&(o.hasClass("medium-rectangle-ad")||o.hasClass("marketing-ad"))&&o.hasClass("marginalia-item")&&o.prepend(i.adSlugAccessibility()),e){case"Ribbon":s.handleRibbonAd(o,n);break;case"TragedyAd":s.handleTragedyAd(o,n);break;case"supported-by-ad":s.handleSponsorTile(o,n);break;case"MiddleRightPaidPost1":case"MiddleRightPaidPost2":case"MiddleRightPaidPost3":case"MiddleRightPaidPost4":s.handleMarginaliaPaidPostAd(o,n);break;case"MoreIn":s.handleMoreIn(o,n);break;case"FlexAd":s.handleFlexAd(o,n,e)}},handleFlexAd:function(e,t,i){var n,s,a,o,r=this;t||(e.addClass("ad-loaded"),this.dfp.pageManager.flag("FlexAdDoubleHeightTracking")&&(s=document.getElementById(i),n=new MutationObserver(function(t){t.forEach(function(t){"height"===t.attributeName&&(o=e.height(),"number"==typeof o&&(o=parseInt(o,10)+""),r.dfp.trackingTriggerImpression("flexAdDoubleHeightTracking",{module:"flexFrameAd",region:"body",version:o,priority:!0}),n.disconnect())})}),a={attributes:!0,childList:!0,characterData:!0,subtree:!0},n.observe(s,a)))},handleStoryAd:function(t,n,s){var a;if(!s){this.aggroTest&&t.addClass("ad-loaded"),t.hasClass("flex-ad")||728!==n[0]||this.aggroTest||t.css({width:"728px"});try{1605===n[0]||this.dfp.hasAdSlug(t)||0!==n[0]&&(a=e(i.adSlug()),t.prepend(a),t.find(".accessibility-ad-header").remove())}catch(o){e.noop()}}},handleStoryBodyAd:function(t,n,s){var a;s||(0!=n[0]||0!=n[1])&&(414!=n[0]||457!=n[1])&&(1605!=n[0]||300!=n[1])&&(a=e(i.adSlug()),t.prepend(a),t.find(".accessibility-ad-header").remove())},handleRibbonAd:function(e,t){var i;t?e.closest(".ribbon-ad-container").addClass("hidden"):(this.dfp.broadcastAdEvent("ribbon-ad-visible",e),i={module:"PaidPostDriver",version:"Ribbon",region:"Header",action:"Impression",eventName:"Impression"},this.handleTriggerPaidPostImpression(e,i))},moveLedeAds:function(){this.dfp.$html.find(".story-body-text").eq(0).before(this.dfp.$html.find(".lede-container-ads"))},removeXxlOnLede:function(){this.dfp.$html.attr("data-lede-media-size");this.hasJumboLede()&&this.dfp.removePlacementSize("lede-ad",[468,648])},removeFlexAdonSections:function(){this.dfp.pageManager.flag("removeSectionDependentAdLogicForJanuary")||n.shouldArticleHaveLedeAd()&&this.dfp.removePlacement("FlexAd")},removeFinalAdOnShortArticles:function(){var e=this.dfp.$html.hasClass("format-short");this.hasJumboLede()&&e&&this.dfp.removePlacement("MiddleRightN")},handleSponsorTile:function(e,t){t||e.parent().removeClass("hidden")},handleMarginaliaPaidPostAd:function(t,i){var n;i||(t.parent().removeClass("hidden"),this.marginaliaPaidPostCounter++),3===this.marginaliaPaidPostCounter&&(e("#middle-right-paid-post-container").removeClass("hidden").find(".marginalia-heading").text("From Our Advertisers"),n={module:"PaidPostDriver",version:"Marginalia",region:"Marginalia",action:"Impression",eventName:"Impression"},this.handleTriggerPaidPostImpression(e("#middle-right-paid-post-container"),n))},handleTriggerPaidPostImpression:function(e,t){var i=this;e.is(":visible")&&this.dfp.isElementInViewport(e)?this.handlePaidPostImpression(e,t):this.dfp.listenToAdEvent("nyt:page-scroll",function(){i.handleScrollCheck(e,t)})},handleScrollCheck:function(e,t){e.is(":visible")&&this.dfp.isElementInViewport(e)&&this.handlePaidPostImpression(e,t)},handleMoreIn:function(t,i){var n,s=this;i||(t.parent().removeClass("hidden"),this.dfp.broadcastAdEvent("morein-ad-visible",t,s.adExclusivity),n={module:"PaidPostDriver",version:"MoreInSection",region:"Footer",action:"Impression",eventName:"Impression"},this.handleTriggerPaidPostImpression(e("#MoreIn"),n))},handlePaidPostImpression:function(e,t){var i=!1;"Ribbon"===e.attr("id")&&this.ribbonImpressionSent===!1&&(this.ribbonImpressionSent=!0,i=!0),"middle-right-paid-post-container"===e.attr("id")&&this.marginaliaImpressionSent===!1&&(this.marginaliaImpressionSent=!0,i=!0),"MoreIn"===e.attr("id")&&this.moreInSent===!1&&(this.moreInSent=!0,i=!0),i===!0&&this.dfp.trackingTrigger("post-paid-driver",t)},requestCommentsTile:function(){this.dfp.broadcastAdEvent("request-placement","Spon2")},handleEnableServices:function(){this.dfp.pageManager.flag("headerBidder")&&window.advBidxc&&window.advBidxc.isLoaded&&window.advBidxc.setTargetingForAdUnitsGPTAsync()},handleSlotDefined:function(e,t,i,n){!n&&window.advBidxc&&window.advBidxc.isLoaded&&window.advBidxc.setTargetingForAdUnitsGPTAsync(),this.setAdTargeting(e,t)},setupViewportToggle:function(){var t=this;this.containers.mobile.$el=e(this.containers.mobile.selector),this.containers.desktop.$el=e(this.containers.desktop.selector),this.aggroTest?this.containers.aggro.$el=e(this.containers.aggro.selector):this.containers.$aggroOnlyEl=e(".aggro-only"),this.checkViewport(),this.dfp.listenToAdEvent("nyt:page-viewportchange",t.checkViewport,t)},checkViewport:function(){var t=this.containers.desktop.$el,i=this.containers.mobile.$el,n=this.dfp.pageManager.cachedViewport.width;this.aggroTest?(this.containers.aggro.isLoaded||(this.installViewPortContainers(this.containers.aggro.$el,this.aggroPlacement),this.containers.aggro.isLoaded=!0),i.addClass("hidden"),t.addClass("hidden"),this.containers.aggro.$el.removeClass("hidden")):n>=this.tabletPortraitSize&&!this.dfp.$html.hasClass("template-minimal")?(this.containers.desktop.isLoaded||(this.installViewPortContainers(t,[300,250]),this.containers.desktop.isLoaded=!0),this.handleArticleAdLayout(),t.removeClass("hidden"),i.addClass("hidden")):(nn&&this.dfp.editPlacementSize("lede-ad",[[300,250],[300,600]])},installViewPortContainers:function(e,t){var i,n=this.dfp;e.each(function(e,s){i=s.id,"story-ad-1"!==i&&n.addPlacement(i,t)}),this.dfp.broadcastAdEvent("scan")},handleTragedyAd:function(){this.dfp.hasTragedy=!0},handleArticleAdLayout:function(){var t=e("#FlexAd");this.dfp.pageManager.flag("removeSectionDependentAdLogicForJanuary")?(this.dfp.removePlacement("FlexAd"),this.dfp.addPlacement("FlexAd",["fluid",[728,90],[1605,300],[1600,512]]),t.removeClass("hidden")):n.shouldArticleHaveLedeAd()||(this.dfp.removePlacement("FlexAd"),this.dfp.addPlacement("FlexAd",["fluid",[728,90],[1605,300],[1600,512]]),t.removeClass("hidden"))},handleAdLayoutforSmallViewport:function(){var t=e("#FlexAd");this.dfp.removePlacement("FlexAd"),this.dfp.addPlacement("FlexAd",["fluid",[300,250],[728,90],[1605,300]]),t.removeClass("hidden")}};return a}),define("article/story/instances/ad-manager",["foundation/views/page-manager","shared/adlibrary/views/dfp","shared/adlibrary/views/adx","article/common/views/adlibrary/placements/adx-placements-mixin","article/common/views/adlibrary/placements/dfp-placements-mixin","article/common/views/adlibrary/requirements/dfp-article-requirements-mixin"],function(e,t,i,n,s,a){"use strict";var o;return e.getMeta("errorpage")||(new i({placements:n}),o=new t({placements:s,requirements:a})),o}),define("shared/interstitialmodal/templates",["underscore/nyt"],function(_){var templates={};return templates.survey=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='

\n
\n
\n

We value your opinion as a New York Times reader.

\n

The New York Times would like your help with a research project.

\n
\n\n
\n
';return __p},templates.surveyHeader=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates}),define("shared/interstitialmodal/views/survey-interstitial",["jquery/nyt","underscore/nyt","backbone/nyt","foundation/views/base-view","shared/modal/views/modal","shared/interstitialmodal/templates","foundation/cookies","foundation/models/user-data"],function(e,t,i,n,s,a,o,r){"use strict";var l=n.registerView("interstitial").extend({template:a.survey,events:{"click .container .survey-button":"handleSurveyButtonClick","click .container .thanks-button":"handleThanksButtonClick"},templateParams:{subStatus:!1},trackingParams:{module:"Survey",region:"Interstitial"},initialize:function(){var e=window.NYTD&&window.NYTD.Abra&&"VariantA"===window.NYTD.Abra("www-story-survey-test");this.isRender=!1,this.modalSettings=t.extend({},{id:"interstitial-survey-modal",binding:".interstitial-survey-modal",tailDirection:"left-top",hasOverlay:!1,hasCloseButton:!1,headerContent:a.surveyHeader(),modalContent:"",closeOnClick:!1,closeOnEsc:!1},{openCallback:function(){null===o.readCookie("NYT-survey")&&o.writeCookie("NYT-survey","-1",{expires:1})},closeCallback:function(){this.removeFromPage()}}),this.flag("surveyInterstitial")&&e&&null===o.readCookie("NYT-survey")&&(this.isRender=!0)},handleUserReady:function(){"sub"===this.determineUserStatus()?this.templateParams.subStatus=!0:r.attributes.subscription.length>4&&(this.templateParams.subStatus=!0),this.isRender&&this.render()},render:function(){this.modalSettings.modalContent=this.template(this.templateParams),this.interstitialModal=new s(this.modalSettings),this.interstitialModal.addToPage(),this.setElement(this.interstitialModal.$modal),this.interstitialModal.open(),this.trackingTriggerImpression("survey-interstitial",{module:this.trackingParams.module,region:this.trackingParams.region,action:"Impression",IsSub:this.templateParams.subStatus,priority:!0})},determineUserStatus:function(){var e,t=document.getElementById("user-info-data");if(!t)return"";try{e=JSON.parse(t.innerHTML)}catch(i){return""}return e.data&&e.data.subscription&&e.data.subscription.length&&e.data.subscription.length>4?"sub":""},handleSurveyButtonClick:function(t){var i,n=e(t.currentTarget),s=n.attr("href");this.trackingTriggerRaw("accept-click ",{module:this.trackingParams.module,region:this.trackingParams.region,action:"Click",eventname:"take-survey-click",IsSub:this.templateParams.subStatus},"interaction"),this.interstitialModal.close(),i=window.open(s,"_blank"),i.opener=null},handleThanksButtonClick:function(){this.trackingTriggerRaw("dismiss-click",{module:this.trackingParams.module,region:this.trackingParams.region,action:"Click",eventname:"no-thanks-click",IsSub:this.templateParams.subStatus},"interaction"),this.interstitialModal.close()}});return l}),define("shared/interstitialmodal/instances/survey-interstitial",["shared/interstitialmodal/views/survey-interstitial"],function(e){"use strict";return new e}),define("article/story/views/image-resizer",["underscore/nyt","jquery/nyt","foundation/views/base-view"],function(e,t,i){"use strict";var n=i.extend({imageRatioLimit:.6,initialize:function(){this.checkMobileBreakpoint(),this.subscribe("nyt:page-breakpoint",this.checkMobileBreakpoint)},handleVerticalImageRatio:function(i,n){var s,a,o,r,l,d=t(".embedded.layout-large-vertical img"),c=this;e.each(d,function(e){r=t(e),s=new Image,s.src=r.attr("src"),a=s.width,o=s.height,a/o<=c.imageRatioLimit&&(l=r.parents(".media"),n===!0?l.addClass(i):l.removeClass(i))})},checkMobileBreakpoint:function(){this.pageManager.getCurrentBreakpoint()>=1010?this.handleVerticalImageRatio("ratio-tall",!1):this.pageManager.getCurrentBreakpoint()<1010&&this.handleVerticalImageRatio("ratio-tall",!0)}});return n}),define("article/common/instances/image-resizer",["article/story/views/image-resizer"],function(e){"use strict";return new e}),define("shared/community/api-mixin",["jquery/nyt","underscore/nyt","foundation/hosts"],function(e,t,i){"use strict";var n={apiPath:i.communityApiHost+"/svc/community/V3/requestHandler",COMMANDS:{all:"GetCommentsAll",reader:"GetCommentsReadersPicks",nytpicks:"GetCommentsNYTPicks",nytreplies:"GetCommentsNYTReplies",replies:"GetRepliesBySequence",permalink:"GetCommentByPermid",recommend:"PostRecommend",userinfo:"GetBasicInfo",comment:"PostComment",notify:"CommentNotify",summary:"GetCommentSummary",content:"GetUserContentSummary",reply:"PostComment",flag:"FlagComment",review:"",rate:"",avgRating:"",usrRating:""},QUERIES:{asset:"url",filter:"cmd",command:"cmd",context:"commentSequence"},apiPost:function(e){return this.makeRequest(e,"post")},apiGet:function(e){return this.makeRequest(e,"get")},hasErrors:function(e,t){var i=!0;return e&&("undefined"!=typeof e.status?(i=!1,this.wantsComments(t)?i=!(e.results&&e.results.comments):"OK"!==e.status&&(i=!0)):i=!1),i},wantsComments:function(e){if(!e)return!1;switch(e.filter){case"all":case"nytreplies":case"nytpicks":case"reader":case"replies":return!0;default:return!1}},sanitize:function(e,t){var i=[];return e&&(i=e.comments),t&&i&&i[0]&&("replies"===t.filter?(i[0].replies.context=i[0].commentSequence,i=i[0].replies):"permalink"===t.filter&&(i.context=i[0].commentSequence)),i},formatRequest:function(e,i){var n,s,a={};switch(t.each(e,function(e,t){t=this.QUERIES[t]||t,"cmd"===t||"commentSequence"===t&&0===e||(a[t]=e)},this),e.command){case"comment":a.commentType="comment";break;case"notify":i=a.commentNotify?"post":"delete",delete a.commentNotify;break;case"reply":a.commentType="userReply";break;case"review":}return a.url&&a.url.match&&a.url.match(/\/story\//)&&(s=a.url.substr(a.url.indexOf("/story/")+7),a.url.match(/\/qa-fe\//)?a.url="http://www.nytimes.com/"+s:a.url="http://www.stg.nytimes.com/"+s),"post"===i?a={postdata:encodeURIComponent(JSON.stringify(a))}:a.url=a.url?encodeURIComponent(a.url):void 0,a.cmd=this.COMMANDS[e.filter||e.command],a.method=i,n={url:this.apiPath,dataType:"jsonp",data:a,contentType:"post"===i?"application/json; charset=utf-8":"application/x-www-form-urlencoded; charset=utf-8",jsonp:"callback",cache:!1}},makeRequest:function(t,i){var n=this,s=new e.Deferred,a=this.formatRequest(t,i),o=!0;return a.success=function(e){n.hasErrors(e,t)?a.error(e):s.resolve(e.results||e)},a.error=function(t){o?(e.ajax(a),o=!1):s.reject({status:"ERROR",message:"The request failed",response:t})},e.ajax(a),s.promise()}};return n}),define("shared/community/models/community-user",["jquery/nyt","backbone/nyt","underscore/nyt","foundation/models/base-model","foundation/hosts","foundation/models/user-data","shared/community/api-mixin"],function(e,t,i,n,s,a,o){"use strict";var r=n.extend(i.extend({},o,{defaults:{userID:null,picURL:"",location:"",displayName:"",email:"",myaccounturl:"",wwwhost:"",tphost:"",comment_notify:!0},initialize:function(){!this.getUserId()&&a.isLoggedIn()&&this.fetch()},setCarefully:function(e){var t={userID:"UserId",location:"Location",displayName:"Name",email:"Email"};i.isObject(e)&&i.each(e,function(e,i){t[i]&&!this["has"+t[i]]()&&e&&this["set"+t[i]](e)},this)},getUserId:function(){return this.get("userID")},getAvatar:function(){return this.get("picURL")},addCSRFHeader:function(e){this.csrf_token&&e.setRequestHeader("X-CSRF-Token",this.csrf_token)},broadcastAvatarFailure:function(){this.local(this,"avatarFailed")},addRawAvatar:function(t){var i=new FormData;i.append("image",t),e.ajax({url:this.avatarURL,type:"POST",data:i,processData:!1,contentType:!1,xhrFields:{withCredentials:!0},beforeSend:this.addCSRFHeader.bind(this),success:function(e){this.local(this,"avatarUploaded",e.results)}.bind(this),error:this.broadcastAvatarFailure.bind(this)})},cropRawAvatar:function(t){e.ajax({url:this.avatarURL,type:"PUT",data:t,xhrFields:{withCredentials:!0},beforeSend:this.addCSRFHeader.bind(this),success:function(e){this.setAvatar(e.results),this.local(this,"avatarCropped",e.results)}.bind(this),error:this.broadcastAvatarFailure.bind(this)})},getLocation:function(){return this.get("location")},getName:function(){return this.get("displayName")},getEmail:function(){return this.get("email")},getAccountUrl:function(){return this.get("myaccounturl")},getNotify:function(){return this.get("comment_notify")},hasUserId:function(){return null!==this.get("userID")&&this.get("userID")>0},hasAvatar:function(){return this.getAvatar().length>0?-1===this.getAvatar().indexOf("none.png"):!1},hasLocation:function(){return"string"==typeof this.get("location")&&this.get("location").length>0},hasName:function(){return"string"==typeof this.get("displayName")&&this.get("displayName").length>0},hasEmail:function(){return"string"==typeof this.get("email")&&this.get("email").length>0},setUserId:function(e){this.set("userID",e)},setLocation:function(e){this.set("location",e)},setName:function(e){return this.set("displayName",e)},setEmail:function(e){return this.set("email",e)},setNotify:function(e){return this.set("comment_notify",e)},setAvatar:function(e){return this.set("picURL",e)},url:s.personasApiHost+"/v1/current/user.json",avatarURL:s.personasApiHost+"/v1/current/avatar.json",sync:function(n,s,a){var o,r=this,l="X-CSRF-Token";return a=i.extend({},a,{xhrFields:{withCredentials:!0}}),o=a.success,a.success=function(e,t,i){r.csrf_token=i.getResponseHeader(l)||i.getResponseHeader(l.toLowerCase()),o&&o.call(this,e,t,i)},"read"!==n&&(a.data=e.param(i.extend({csrf_token:r.csrf_token},this.toJSON())),a.beforeSend=function(e){e.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}),t.sync.call(this,n,this,a)},parse:function(e){return e.results&&"OK"===e.status?(e.results.id=e.results.userID,e.results):void 0},toJSON:function(){return{uid:this.get("uid"),displayname:this.getName(),location:this.getLocation(),comment_notify:this.getNotify()}}}));return r}),define("shared/community/instances/community-user",["shared/community/models/community-user"],function(e){"use strict";return new e}),define("shared/community/models/post",["underscore/nyt","foundation/models/base-model","shared/community/api-mixin","shared/community/instances/community-user"],function(e,t,i,n){"use strict";var s=t.extend(e.extend({},i,{defaults:{commentID:0,replies:[]},initialize:function(){this.getReplies().length>2&&(this.getReplies().length=2),this.convertUnixTimeStamp()},recommend:function(e,t,i){var s=this,a=arguments.length>3?Array.prototype.slice.call(arguments,3):[];return"undefined"==typeof e&&(e=this.isRecommended()?0:1),this.apiPost({command:"recommend",userID:n.getUserId(),userEmail:n.getEmail(),asset:t,commentSequence:this.getSequence(),parentID:this.getParentId(),recommend:e}).done(function(e){s.set({recommendedFlag:e.recommended,recommendations:e.recommendations}),i.local.apply(this,[i,"nyt:community-post-recommended",s].concat(a))})},convertUnixTimeStamp:function(){e.each(["approveDate","createDate","updateDate"],function(e){this.set(e,1e3*parseInt(this.get(e),10))},this)},isTrusted:function(){return this.get("trusted")>0},isPicked:function(){return this.get("editorsSelection")},isNyt:function(){return"reporterReply"===this.get("commentType")},isRecommended:function(){return 1===this.get("recommendedFlag")},isReported:function(){return 1===this.get("reportAbuseFlag")},hasReplies:function(){return this.getReplyCount()>0},hasAvatar:function(){return this.getAvatar().length>0?-1===this.getAvatar().indexOf("none.png"):!1},hasAdditionalReplies:function(){return this.getReplyCount()>this.getReplies().length},getDate:function(){return this.get("approveDate")},getBody:function(){return this.get("commentBody")},getAuthor:function(){return this.get("userDisplayName")||this.get("display_name")},getAvatar:function(){return this.get("picURL")||""},getLocation:function(){return this.get("userLocation")||this.get("location")},getReplies:function(){return this.get("replies")},getReplyCount:function(){return this.get("replyCount")},getId:function(){return this.get("commentID")},getPermId:function(){return this.get("permID")},getSequence:function(){return this.get("commentSequence")},getParentId:function(){return this.get("parentID")||0},getRecommendations:function(){return this.get("recommendations")},getUserTitle:function(){return this.get("userTitle")},getParentAuthor:function(){return this.get("parentUserDisplayName")},getParentPermId:function(){return this.get("parentPermID")}}));return s}),define("shared/community/collections/stream",["underscore/nyt","foundation/collections/base-collection","shared/community/models/post"],function(e,t,i){"use strict";var n=t.extend({model:i,sortMethods:{newest:function(e){return-parseInt(e.getDate(),10)},oldest:function(e){return parseInt(e.getDate(),10)},reader:function(e){return-parseInt(e.getRecommendations(),10)}},order:function(e){this.comparator=this.sortMethods[e||"newest"]},has:function(e){return this.where({commentID:e.getId()}).length>0},convertPosts:function(t,n){return e.each(t,function(e,s){var a=new i(e);n&&(n.getReplies()[s]=a),a.hasReplies()&&this.convertPosts(a.getReplies(),a),t[s]=a},this),this},stripDupes:function(t){var i=[],n=[];return e.each(t,function(t){-1===e.indexOf(n,t.getId())&&(i.push(t),n.push(t.getId()))},this),i},populate:function(t){var i=[],n=t.context;return t=this.convertPosts(t).stripDupes(t),e.each(t,function(t){this.has(t)||(i.push(t),this.ensurePermId(t,n),t.hasReplies()&&(t.set("replies",this.stripDupes(t.getReplies())),e.each(t.getReplies(),function(e){this.ensurePermId(e,t.getSequence())},this)))},this),this.add(i),i},ensurePermId:function(e,t){e.getPermId()||e.set("permID",(t?t+":":"")+e.getSequence()),e.set("parentPermID",e.getPermId().split(":")[0])}});return n}),define("shared/community/models/thread",["underscore/nyt","foundation/models/base-model","shared/community/collections/stream"],function(e,t,i){"use strict";var n=t.extend({defaults:{context:"0",filter:"all",sort:"newest",offset:0,permID:null,stream:null,requested:25},initialize:function(){var e=this.getStream();e&&"function"!=typeof e.slice||(e=new i(e),this.set("stream",e)),e.order(this.get("sort"))},toQuery:function(t){return e.extend({context:this.get("context"),filter:this.get("filter"),sort:this.get("sort"),offset:this.get("offset")},{permID:this.get("permID")||void 0},t)},getStream:function(){return this.get("stream")},getCount:function(){return this.get("count")},getRequested:function(){return this.get("requested")},isEmpty:function(){return!this.isLoading()&&0===this.getStream().length},isLoading:function(){return this.get("loading")},setLoading:function(e){this.set("loading",e)},setCount:function(e){this.set("count",e)},trackRequested:function(e){this.set("requested",e+(this.getRequested()||0))},hasAdditionalPosts:function(){return this.getRequested()-1&&"undefined"!=typeof t[i]&&(s[i]=t[i]);return s},getSummary:function(){var e=this,t={"comment-list-sort-approvedate":{sort:"oldest",filter:"all"},"comment-list-sort-approvedate-desc":{sort:"newest",filter:"all"},"comment-list-sort-recommended":{filter:"reader"},"comment-list-sort-editors":{filter:"nytpicks"},"comment-list-sort-replies":{filter:"nytreplies"}};this.apiGet({asset:this.getAsset(),command:"summary"}).done(function(i){var n=t[i.sortBy||"comment-list-sort-approvedate-desc"];e.setDefaultQuery(n),e.setMetaData(i),e.local(e,"nyt:community-summary",n,e)}).fail(function(){e.local(e,"nyt:community-summary",t["comment-list-sort-approvedate-desc"],e)})},load:function(e,t){var i=arguments.length>2?Array.prototype.slice.call(arguments,2):[],n=this.getThreads(),s=this.buildValidQuery(e),a=n.findWhere(s);this.local(t||this,"nyt:community-request",e),a||(n.add(s),a=n.findWhere(s)),a.isLoading()?this.addThreadWatcher.apply(this,[t,a].concat(i)):e.limit?this.fetchMorePosts(e,a,t,i):a.isEmpty()||"replies"===e.filter?this.fetchPosts(e,a,t,i):(this.local.apply(this,[t||this,"nyt:community-thread-loaded",[],a.getStream().models].concat(i)),this.addReplies.apply(this,[a.getStream().models,t,a].concat(i)))},addThreadWatcher:function(e,t){var i=this;this.listenTo(t,"nyt:community-thread-loaded",function(){i.local.apply(i,[e,"nyt:community-thread-loaded"].concat(Array.prototype.slice.call(arguments,0)))})},fetchPosts:function(e,t,i,n){var s,a,o=this,r=this.toQuery(e||{},t);t.setLoading(!0),this.addThreadWatcher.apply(this,[i||this,t].concat(n)),a=this.apiGet(r).done(function(i){s=t.getStream().populate(o.sanitize(i,r)),"replies"===e.filter&&o.updateParentPost(t),o.setMetaData(i,t,e),t.setLoading(!1),o.local.apply(o,[t,"nyt:community-thread-loaded",s,t.getStream().models].concat(n)),o.addReplies.apply(o,[s,t,t].concat(n)),o.stopListening(t,"nyt:community-thread-loaded")}).fail(function(){t.setLoading(!1),o.local.apply(o,[t,"nyt:community-thread-loaded",[],t.getStream().models].concat(n))}),this.local(i||this,"nyt:community-thread-requested",this,a)},toQuery:function(t,i,n){return e.extend(i.toQuery(),{offset:t&&t.offset?t.offset:i.get("offset"),limit:t?t.limit:void 0,asset:this.getAsset()},n)},addReplies:function(t,i,n,a){var o=this.getThreads();a=a||{},e.each(t,function(t){var r,l={context:t.getSequence(),permID:t.getPermId()},d=t.getReplies();n&&"nytreplies"===n.get("filter")?l.filter=n.get("filter"):l.filter="replies",r=o.findWhere(l),d.length>0&&(r||(r=new s({context:t.getSequence(),filter:l.filter,permID:t.getPermId(),stream:d}),o.add(r)),a.parent=t.getId(),this.local.apply(this,[i||this,"nyt:community-thread-loaded",d,r.getStream().models,a]),this.addReplies(r.getStream().models,i,n,e.clone(a)))},this)},updateParentPost:function(e){var t,i=this.getThreads().findWhere({context:"0"}),n=i.getStream().findWhere({commentSequence:e.get("context")});n&&(n.set("replies",e.getStream().models),t=this.getThreads().findWhere({context:n.getSequence(),filter:"replies",sort:"newest"}),t&&this.getThreads().remove(t))},buildTaxonomy:function(){var e,t,i,n,s,a=this.pageManager.getMeta("SCG");this.isValidTaxonomy(this.getTaxonomy())||(s=this.pageManager.getMeta("communityAssetTaxonomy"),t=this.pageManager.getMeta("CG"),i=this.pageManager.getMeta("hdl"),n=this.pageManager.getMeta("slug"),s||(e=[],"string"==typeof t&&""!==t&&e.push(t),"string"==typeof i&&""!==i&&(i=i.replace(/\&\%\?/g,""),e.push(i)),s=e.join("/"),"string"==typeof n&&""!==n&&(s+=" ("+n+")")),"roomfordebate"===a&&s.indexOf("(undefined)")>-1&&(e=[],"string"==typeof t&&""!==t&&e.push(t.toLowerCase()),e.push(a),"string"==typeof n&&""!==n&&"undefined"!==n&&e.push(n),s=e.join("/")),this.setTaxonomy(s))},fetchMorePosts:function(t,i,n){this.fetchPosts(e.extend({limit:25},t,{offset:i.getStream().length}),i,n)},fetchLatestPosts:function(e){this.fetchPosts({},e)},post:function(e,t,i){var n,s,a=this.getUser();return i.ancestorId>0||i.parentId>0?(n="reply",s=i.ancestorId>0?i.ancestorId:i.parentId):(n="comment",s=0),this.apiPost({ command:n,userID:a.getUserId(),userEmail:a.getEmail(),userDisplayName:a.getName(),userLocation:a.getLocation(),asset:this.getAsset(),parentID:s,commentBody:t.commentBody,commentTitle:t.commentTitle,notifyViaEmailOnApproval:t.commentNotify,assetTaxonomy:this.getTaxonomy()}).done(function(){e.local(e,"nyt:community-comment-posted",t,i),a.setNotify(t.commentNotify),a.save()})},setMetaData:function(t,i,n){var s=["all"];i&&"permalink"!==i.get("filter")&&(this.setCount(t,i,n),this.setUserData(t.userData)),"string"==typeof t.commentQuestion&&t.commentQuestion.length>0&&this.setPrompt(t.commentQuestion),"undefined"!=typeof t.userRating&&this.setRating(t),e.isObject(t.asset)&&this.isValidTaxonomy(t.asset.taxonomy)&&this.setTaxonomy(t.asset.taxonomy),"undefined"!=typeof t.canSubmit&&this.setOpen(t.canSubmit),t.totalRecommendationsFound&&s.push("reader"),t.totalEditorsSelectionFound&&s.push("nytpicks"),t.totalReporterReplyCommentsFound&&s.push("nytreplies"),this.setFilters(s)},findPost:function(e){var t=!1;return this.getThreads().each(function(i){var n;return t?!1:(n=i.getStream().findWhere(e),n?(t=n,!1):void 0)},this),t},setUserData:function(e){var t=this.getUser();t&&t.setCarefully(e)},setRating:function(e){this.set("userRating",e.userRating),this.set("avgRating",e.averageRating)},setCount:function(e,t,i){if("replies"!==t.get("filter")){switch(this.set("total-all",e.totalCommentsFound),this.set("total-parent",e.totalParentCommentsFound),this.set("total-reader",e.totalRecommendationsFound),this.set("total-nytpicks",e.totalEditorsSelectionFound),this.set("total-nytreplies",e.totalReporterReplyCommentsFound),t.get("filter")){case"all":t.set("count",e.totalParentCommentsFound);break;case"reader":t.set("count",e.totalRecommendationsFound);break;case"nytpicks":t.set("count",e.totalEditorsSelectionFound);break;case"nytreplies":t.set("count",e.totalReporterReplyCommentsFound)}i.limit&&t.trackRequested(i.limit)}},getUserContent:function(){var e=this,t=e.getThreads();("undefined"==typeof this.getExcerpt()||0===this.getExcerpt().length)&&this.apiGet({path:this.getAsset(),command:"content"}).done(function(i){var n;i.hasOwnProperty("excerpts")&&(n=new s({context:0,filter:"excerpt",stream:i.excerpts}),t.add(n),e.setExcerpt(n.getStream().models[0]))})},getNumberOfPosts:function(e){return this.get("total-"+("string"==typeof e?e:"all"))},hasAdditionalPosts:function(e){var t=this.getThreads(),i=this.buildValidQuery(e),n=t.findWhere(i);return n?n.hasAdditionalPosts():!1},isValidTaxonomy:function(e){return"string"==typeof e&&e.length>0&&-1===e.indexOf("undefined")},getAverageRating:function(){return this.get("averageRating")},getViews:function(){return this.get("views")},getAsset:function(){return this.get("asset")},getThreads:function(){return this.get("threads")},getTaxonomy:function(){return this.get("taxonomy")},getExcerpt:function(){return this.get("excerpt")||""},getUser:function(){return this.get("user")},isOpen:function(){return this.get("isOpen")},getPrompt:function(){return this.get("prompt")},getFilters:function(){return this.get("filters")},getDefaultQuery:function(){return this.get("defaultQuery")},setTaxonomy:function(e){this.set("taxonomy",e)},setExcerpt:function(e){this.set("excerpt",e)},setOpen:function(e){this.set("isOpen",e)},setPrompt:function(e){this.set("prompt",e)},setFilters:function(e){this.set("filters",e)},setUser:function(e){this.set("user",e)},setDefaultQuery:function(e){this.set("defaultQuery",e)}}));return a}),define("shared/community/collections/community-loader",["underscore/nyt","foundation/collections/base-collection","shared/community/models/discussion","shared/community/instances/community-user","foundation/models/user-data"],function(e,t,i,n,s){"use strict";var a=t.extend({model:i,StatusCode:{ENABLED:"enabled",DISABLED:"disabled",WAITING:"waiting"},enabledQueue:[],disabledQueue:[],initialize:function(){this.subscribe("nyt:community-request",this.loadDiscussion),this.subscribe(this,"add",this.notify),this.subscribe(this,"add",this.setUserModel),this.status=this.StatusCode.WAITING,s.isReady()?this.userReady():s.listenToOnce(this.pageManager,"nyt:user-ready",this.userReady.bind(this))},enabled:function(e){"function"==typeof e&&this.enabledQueue.push(e)},disabled:function(e){"function"==typeof e&&this.disabledQueue.push(e)},ready:function(){this.pageManager.$html.hasClass("has-comments")?this.setStatus(this.StatusCode.ENABLED):this.setStatus(this.StatusCode.DISABLED),this.runQueue()},userReady:function(){this.pageManager.isDomReady()?this.ready():this.subscribe("nyt:page-ready",this.ready)},setStatus:function(e){this.status=e},isEnabled:function(){return this.status===this.StatusCode.ENABLED},runQueue:function(){e.each(this[this.status+"Queue"],function(e){e.call(this)},this),this[this.status]=function(e){"function"==typeof e&&e.call(this)}},loadDiscussion:function(t,i,n){var s;t=t||((location.origin||location.protocol+"//"+location.hostname)+location.pathname).replace(/www\.dev|www\.sbx/i,"www.stg"),this.pageManager.getMeta("communityAssetURL")&&(t=this.pageManager.getMeta("communityAssetURL")),s=this.findWhere({asset:t}),this.local(i,"nyt:community-loading",t),s?(s.getViews().push(i),this.notify(s,this,{},i)):this.add(e.extend({},n||{},{asset:t,views:[i],permID:location.hash.substr(location.hash.indexOf("=")+1)||void 0}))},notify:function(e,t,i,n){this.local(n||e.getViews()[0],"nyt:community-loaded",e)},setUserModel:function(e){e.setUser(n)}});return a}),define("shared/community/templates",["underscore/nyt"],function(_){var templates={};return templates.button=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",skipToContentId&&(__p+='\nContinue reading the main story\n'),__p+='\n\n',__p+=count>0?'\n\n':'\n\n',__p+="\n",count>0?(__p+='\n'+(null==(__t=count)?"":__t)+"\n",showUnits&&(__p+='\n'+(null==(__t=units)?"":__t)+"\n"),__p+="\n"):defaultText&&(__p+='\n'+(null==(__t=defaultText)?"":__t)+"\n"),__p+="\n";return __p},templates.comments=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
\n\n
\n
\n
\n

'+(null==(__t=header)?"":__t)+"

\n",commentPromptVisibility&&(__p+='\n

'+(null==(__t=commentPrompt)?"":__t)+"

\n"),__p+="\n",isOpen||(__p+='\n

The comments section is closed. To submit a letter to the editor for publication, write to letters@nytimes.com.

\n'),__p+='\n
\n
\n
\n
\n
    \n',_.each(filters,function(e,t){__p+='\n
  • '+(null==(__t=e)?"":__t)+' '+(null==(__t=view.model.getNumberOfPosts(t))?"":__t)+"
  • \n"}),__p+='\n
\n
\n
\n
'+(null==(__t=sort)?"":__t)+'
\n
\n
\n
\n
\n
\n
Read More
\n
\n
\n
Loading...
\n
\n
\n',view.model.getNumberOfPosts("all")>1&&(__p+='\n
View all '+(null==(__t=view.model.getNumberOfPosts("all"))?"":__t)+" comments
\n"),__p+="\n
";return __p},templates.commentsButton=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",skipToContentId&&(__p+='\nContinue reading the main story\n'),__p+='\n\n',count>0?(__p+='\n\n'+(null==(__t=count)?"":__t)+"\n",showUnits&&(__p+='\n'+(null==(__t=units)?"":__t)+"\n"),__p+="\n\n"):defaultText&&(__p+='\n\n'+(null==(__t=defaultText)?"":__t)+"\n\n"),__p+="\n";return __p},templates.commentsButtonThemeSpeechBubbleXSmall=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='\n\n',count>0?__p+='\n\n'+(null==(__t=count)?"":__t)+"\n\n":defaultText&&(__p+='\n\n'+(null==(__t=defaultText)?"":__t)+"\n\n"),__p+="\n";return __p},templates.commentsPanel=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='
\n\n
\n
\n
';return __p},templates.flag=function(obj){var __t,__p="";Array.prototype.join;with(obj||{}){__p+='
\n';var i=0;_.each(reasons,function(e,t){i+=1,__p+='\n
\n
\n\n
\n
\n\n
\n
\n"}),__p+='\n
\n\n\n
\n
'}return __p},templates.form=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
\n',"0"!==user.getUserId()&&(__p+='
',user.getName()&&user.getLocation()?(__p+="\n",user.hasAvatar()&&(__p+='\n
\n'),__p+='\n
\n

'+(null==(__t=user.getName())?"":__t)+'

\n
\n

\n

Not You? Log Out

\n
\n

'+(null==(__t=user.getLocation())?"":__t)+"

\n
"):(__p+="\n",user.hasAvatar()&&(__p+='\n
\n'),__p+='
\n
\n\n
\n
\n\n\n
\n
\n
\n\n
\n
\n\n\n
\n
'),__p+="\n
"),__p+='
\n
\n\n
\n
\n\n
\n
',parseInt(user.getUserId(),10)>0&&(__p+='\n
\n

1500

\n
\n\n
\n
\n\n\n\n
\n
\n
\n
'),__p+="\n
",confirmPost&&(__p+='\n
\n

',__p+=message.commentNotify?" Thank you for your submission. We'll notify you at "+(null==(__t=user.getEmail())?"":__t)+" when your comment has been approved.\n":"\nThank you for your submission. Your comment will appear once it has been approved.\n",__p+='

\n
\n',showAvatar&&user.hasAvatar()&&(__p+='\n
\n'),__p+='\n
\n

'+(null==(__t=user.getName())?"":__t)+"

\n",showLocation&&(__p+='\n'+(null==(__t=user.getLocation())?"":__t)+"\n"),__p+='\n\n
\n

'+(null==(__t=message.commentBody)?"":__t)+"

\n
\n
\n"),__p+="";return __p},templates.peek=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",skipToContentId&&(__p+='\nContinue reading the main story\n'),__p+="\n",header&&(__p+='\n
\n

'+(null==(__t=header)?"":__t)+"

\n
\n"),__p+='\n
\n',_.each(posts,function(e,t){isPrompt?__p+='\n

'+(null==(__t=e)?"":__t)+'

\n

Share your thoughts »

\n':t\n
\n

'+(null==(__t=e.getAuthor())?"":__t)+"

\n",showDate&&(__p+='\n\n"),__p+="\n",showLocation&&(__p+='\n'+(null==(__t=e.getLocation())?"":__t)+"\n"),__p+='\n
\n

'+(null==(__t=isExcerpt?e.get("commentExcerpt"):e.get("commentBody"+(maxChars||"")))?"":__t)+"

\n\n")}),__p+="\n
\n",showFooter&&(__p+='\n
\n
    \n
  • \n',__p+=showCount?"\n"+(null==(__t=count)?"":__t)+" Comment"+(null==(__t=1===count?"":"s")?"":__t)+"\n":"\nSee All Comments\n",__p+="\n
  • \n",isOpen&&(__p+='\n
  • Write a comment
  • \n'),__p+="\n
\n
\n"),__p+="";return __p},templates.post=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
\n',post.isPicked()&&(__p+='\nNYT Pick\n'),__p+="\n",showAvatar&&post.hasAvatar()&&(__p+='\n
\n'),__p+='\n
\n

'+(null==(__t=post.getAuthor())?"":__t)+"

\n",(post.isTrusted()||post.isNyt())&&(__p+='\n'+(null==(__t=post.isTrusted()?"is a trusted commenter":"is an NYTimes reporter")?"":__t)+"\n"),__p+="\n",post.isNyt()?__p+='\n'+(null==(__t=post.getUserTitle())?"":__t)+"\n":showLocation&&(__p+='\n'+(null==(__t=post.getLocation())?"":__t)+"\n"),__p+='\n'+(null==(__t=post.get(dateFormat+"Date"))?"":__t)+'\n
\n

'+(null==(__t=post.get("commentBody"))?"":__t)+'

\n
\n
    \n\n","all"!==filter&&!isPermalink&&post.getParentId()>0&&(__p+='\n
  • In Reply to '+(null==(__t=post.getParentAuthor())?"":__t)+"
  • \n"),__p+="\n",isOpen&&(__p+='\n\n'),__p+='\n\n
  • \n
\n
\n
\n',post.hasReplies()&&(__p+='\n
\n',post.hasAdditionalReplies()&&!isPermalink&&"all"===filter&&(__p+='\n
See All Replies
\n'),__p+="\n"),__p+="\n
";return __p},templates.verified=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='\nVerified Commenters\n\ncan leave comments on NYTimes.com without initial moderation. Verified status is earned based on a history of quality comments.';return __p},templates}),define("shared/community/views/comments-panel",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/community/templates","foundation/hosts"],function(e,t,i,n,s){"use strict";var a=i.extend({className:"comments-panel",template:n.commentsPanel,events:{"click .close-panel-button":"close","mousewheel #comments":"handleMouseScroll","DOMMouseScroll #comments":"handleMouseScroll"},nytEvents:{"nyt:community-commentspanel-open":"open","nyt:community-commentspanel-close":"close","nyt:messaging-critical-alerts-move-furniture":"movePanelForAlerts","nyt:messaging-suggestions-move-furniture":"movePanelForAlerts"},defaultSettings:{},initialize:function(i){this.settings=t.extend({},this.defaultSettings,i),this.$main=e("#main"),this.$story=e("#story"),this.$commentsButton=e(".comments-button"),this.expandIsExplicit=!1,this.pageManager.isDomReady()?this.render():this.subscribe("nyt:page-ready",this.render)},render:function(){var t=this;return this.$el.hide().addClass(this.settings.className).html(this.template(this.settings)),this.$story.append(this.$el),this.$body.on("click",function(i){e(i.target).hasClass("comments-panel-trigger")&&t.open()}),this},open:function(){return this.pageManager.isMobile()&&this.pageManager.getViewport().width=10070?(e=this.$shell.offset().left+1,this.subscribe("nyt:page-resize",this.adjustRightOffset)):(e="0",this.stopSubscribing("nyt:page-resize",this.adjustRightOffset)),e},handlePanelSettings:function(){this.$el.css("right",this.handleRightOffset()),this.broadcast("nyt:community-panel-positioned")},movePanelForAlerts:function(e){e(this.$el)},handleMouseScroll:function(e){var t=e.originalEvent,i=e.currentTarget,n=t.wheelDelta||-t.detail,s=i.scrollHeight-i.scrollTop===i.clientHeight,a=0===i.scrollTop;return s&&0>n||a&&n>0?(e.preventDefault(),!1):!0},toMobileWebURL:function(){return s.mobileWeb+"/redirect?target=comments&to-mobile="+encodeURIComponent(this.pageManager.getCanonical())}});return a}),define("shared/community/views/utils-mixin",["jquery/nyt","underscore/nyt"],function(e,t){"use strict";var i={request:function(){this.broadcast("nyt:community-request",this.settings.asset,this,this.settings)},getPosts:function(e){this.model=e,this.model.load(this.settings,this)},toQuery:function(e){return e=e||{},t.extend({},this.settings,e)},openPanel:function(e){var i;this.broadcast("nyt:community-commentspanel-open",e),i=t.extend({module:"Comments",action:"Click",eventName:"OpenCommentsPanel"},this.getTrackingParams()),this.trackingTrigger("comments-open-panel",i),this.trackingComscorePVC(i)},truncate:function(e){var i=this,n=function(e,t){var i;if(e.length<=t)return e;for(i=t;i>=0;i--)if(" "===e.charAt(i)||"."===e.charAt(i))return e.substr(0,i)+"...";return e.substr(0,t)+"..."};"undefined"!=typeof e&&(e=e.slice?e:[e],t.each(e,function(e){e.set("commentBody"+i.settings.maxChars,n(i.stripHtml(e.getBody()),i.settings.maxChars))}))},stripHtml:function(t){return"string"==typeof t?e("

"+t+"

").text():""+t},formatDefaultDate:function(e){return e},formatDate:function(e){"undefined"!=typeof e&&(e=e.slice?e:[e]),t.each(e,function(e){var t=e.getDate();t="interval"===this.settings.dateFormat?this.prettyDate(t):this.formatDefaultDate(t),e.set(this.settings.dateFormat+"Date",t),e.hasReplies()&&this.formatDate(e.getReplies())},this)},getTrackingParams:function(){var e={},i={"theme-kicker":{region:"Header",version:"CommentsHeader"},"button-masthead":{region:"TopBar",version:"CommentsTopBar"},"selected-comment-marginalia":{region:"Marginalia",version:"RecentComments"},"featured-comment-marginalia":{region:"Body",version:"FeaturedComments"},"comment-prompt-marginalia":{region:"Body",version:"CommentsPrompt"},"theme-speech-bubble":{region:"Body",version:"CommentsBubble"},"comments-panel":{region:"Body",version:"CommentsPanel"},"theme-story-footer":{region:"EndOfArticle",version:"ShareTools"},"story-meta-footer-comments-button":{region:"Header",version:"CommentsHeader"}},n=this.$el.attr("class").split(" ");return t.each(n,function(t){i.hasOwnProperty(t)&&(e=i[t])}),this.trackingBaseData.contentCollection=this.trackingBaseData.contentCollection||this.pageManager.getMeta("article:section"),e}};return i}),define("shared/community/views/comments-button",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/community/views/utils-mixin","shared/community/templates"],function(e,t,i,n,s){"use strict";var a=i.extend(t.extend({},n,{template:s.button,events:{click:"openPanel"},defaultSettings:{units:"Comments",showUnits:!0,defaultText:null,hideWhenClosed:!1},commentsCount:0,initialize:function(e){this.settings=t.extend({},this.defaultSettings,e),this.$el.hasClass("theme-speech-bubble-x-small")||this.$el.hasClass("theme-kicker")?this.template=s.commentsButtonThemeSpeechBubbleXSmall:this.$el.hasClass("comments-button")&&(this.template=s.commentsButton),this.subscribeOnce(this,"nyt:community-loaded",this.render),this.isTransparentMasthead()&&this.subscribe("nyt:masthead-storytheme",this.updateCommentsButtonTemplate),this.request()},render:function(e){var i,n=e.getNumberOfPosts(),s=this.$el.attr("data-skip-to-para-id");return this.commentsCount=n,1===n&&(this.settings.units="Comment"),i=t.extend({},this.settings,{count:n,skipToContentId:s}),this.model||(this.model=e,this.listenTo(e,"change:total-all",this.render)),!this.model.isOpen()&&this.settings.hideWhenClosed?this.$el.hide():(this.$el.html(this.template(i)),this)},isTransparentMasthead:function(){return this.pageManager.$masthead.is(".masthead-theme-transparent, .masthead-theme-transparent-ffffff")},updateCommentsButtonTemplate:t.debounce(function(e){var t;t=e?this.pageManager.$masthead.find(".theme-speech-bubble-small").append(s.commentsButton({skipToContentId:!1,count:this.commentsCount,showUnits:!1,units:"",defaultText:""})):this.pageManager.$masthead.find(".theme-speech-bubble-x-small").append(s.commentsButtonThemeSpeechBubbleXSmall({count:this.commentsCount})),t.hide().fadeIn(300).end()})},200));return a}),define("shared/community/views/comments-peek",["underscore/nyt","foundation/views/base-view","shared/community/views/utils-mixin","shared/community/templates"],function(e,t,i,n){"use strict";var s=t.extend(e.extend({},i,{className:"comments-peek",template:n.peek,events:{click:"openWithPermId"},defaultSettings:{header:null,hideOnOpen:!0,maxPosts:3,filter:"all",sort:"newest",showCount:!1,showDate:!0,dateFormat:"standard",isExcerpt:!1,isPrompt:!1,showLocation:!0,showFooter:!0,maxChars:140,defaultPrompt:"Share your thoughts."},initialize:function(t){this.settings=e.extend({},this.defaultSettings,t),this.settings.isPrompt&&(this.settings.showFooter=!1,this.settings.showDate=!1),this.settings.isExcerpt&&(this.settings.showDate=!1,this.settings.showCount=!0),this.subscribe(this,"nyt:community-loaded",this.getPosts),this.subscribeOnce(this,"nyt:community-thread-loaded",this.render),this.request()},render:function(t){var i,n,s=this.$el.attr("data-skip-to-para-id");if(this.settings.isExcerpt){if(0===this.model.getExcerpt().length)return this.$el.addClass("hidden");t=[this.model.getExcerpt()],this.listenTo(this.model,"change:excerpt",this.render)}else if(this.settings.isPrompt){if(!this.model.isOpen()||this.model.getPrompt().toLowerCase()===this.settings.defaultPrompt.toLowerCase())return this.$el.addClass("hidden");t=[this.model.getPrompt()],n=1===this.model.getNumberOfPosts()?"Comment":"Comments",this.settings.header=this.model.getNumberOfPosts()+" "+n}else if(this.model.getNumberOfPosts()<=this.settings.maxPosts)return this.$el.addClass("hidden");return i=e.extend({},this.settings,{posts:t,count:this.model.getNumberOfPosts(),isOpen:this.model.isOpen(),skipToContentId:s}),this.settings.maxChars>0&&!this.settings.isPrompt&&!this.settings.isExcerpt&&this.truncate(i.posts),this.settings.showDate&&this.formatDate(i.posts),this.$el.html(this.template(i)),this.broadcast("nyt:community:peek-rendered"),this},openWithPermId:function(){var e=this.$(".comment");1===e.length?this.openPanel(e.data("permid")):this.openPanel()}}));return s}),define("shared/sharetools/helpers/share-tools-config",["underscore/nyt","foundation/views/page-manager"],function(e,t){"use strict";var i={width:600,height:450,adPosition:"Frame4A",overlayAdPosition:"Frame6A",isModalMember:!0,isArticleTool:!1,isInDefaultSet:!1,isPopup:!0,usesShortUrl:!1,shareDataParameters:{},shareServiceParameters:{}},n=function(t){var n=e.extend({},i,t);return Object.freeze?Object.freeze(n):n},s={EMAIL:n({label:"Email",isInDefaultSet:!0,requiresLogin:!0,loginModalTitle:"Log in to email",modalDisplayOrder:1,mobileModalDisplayOrder:1}),FACEBOOK:n({label:"Share", isInDefaultSet:!0,url:"http://www.facebook.com/sharer.php",smid:"fb-share",modalDisplayOrder:3,mobileModalDisplayOrder:2,shareDataParameters:{url:"u"}}),GOOGLE:n({label:"Google+",url:"https://plus.google.com/share",smid:"go-share",height:600,modalDisplayOrder:4,mobileModalDisplayOrder:6,shareDataParameters:{url:"url"},shareServiceParameters:{hl:"en-US"}}),REDDIT:n({label:"Reddit",url:"http://www.reddit.com/submit",smid:"re-share",width:854,height:550,modalDisplayOrder:6,mobileModalDisplayOrder:7,shareDataParameters:{url:"url",title:"title"}}),PINTEREST:n({label:"Pin",url:"https://www.pinterest.com/pin/create/button/",smid:"pin-share",width:750,height:330,modalDisplayOrder:7,mobileModalDisplayOrder:4,shareDataParameters:{url:"url",media:"media",description:"description"}}),TWITTER:n({label:"Tweet",isInDefaultSet:!0,url:"https://twitter.com/share",smid:"tw-share",usesShortUrl:!0,modalDisplayOrder:5,mobileModalDisplayOrder:3,shareDataParameters:{url:"url",title:"text"}}),LINKEDIN:n({label:"Linkedin",url:"http://www.linkedin.com/shareArticle",smid:"li-share",width:750,modalDisplayOrder:2,mobileModalDisplayOrder:5,shareDataParameters:{url:"url",title:"title",description:"summary"},shareServiceParameters:{mini:"true",source:"The New York Times"}}),SAVE:n({label:"Save",isInDefaultSet:!0,isArticleTool:!0,loginModalTitle:"Log in to save",modalDisplayOrder:1}),PRINT:n({label:"Print",isModalMember:"interactive"!==t.getApplicationName(),isArticleTool:"interactive"!==t.getApplicationName(),modalDisplayOrder:3,shareServiceParameters:{pagewanted:"print"}}),REPRINTS:n({label:"Reprints",width:930,height:850,isArticleTool:!0,isModalMember:!0,url:"http://www.nytreprints.com",modalDisplayOrder:2}),EMBED:n({label:"Embed",isArticleTool:!1,isInDefaultSet:!1,isModalMember:!1}),"SHOW-ALL":n({label:"More",isInDefaultSet:!0,isModalMember:!1,isModalTrigger:!0}),AD:n({label:"Advertisement",isInDefaultSet:!0,isModalMember:!1})};return Object.freeze?Object.freeze(s):s}),define("shared/sharetools/templates",["underscore/nyt"],function(_){var templates={};return templates.emailModal=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.savemodal=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n
  • This item has been saved to read later from any device.
  • \n
  • Access saved items through your user name at the top of the page.
  • \n
\n

View Saved Items

\n';return __p},templates.shareTool=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+=''+(null==(__t=label)?"":__t)+"";return __p},templates.shareTools=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="

";return __p},templates.shareToolsModal=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='\n",!isCompact&&showTools&&(__p+='\n
\n\n
    \n'+(null==(__t=articleToolsList)?"":__t)+"\n
\n
\n"),__p+="";return __p},templates.shareToolsModalFooter=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='";return __p},templates.showAllSharetoolCompactModal=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+=' \n
\n
    \n'+(null==(__t=showAllToolList)?"":__t)+'\n
\n\n
\n
\n\n
\n
\n\n\n
\n
\n
';return __p},templates.showAllSharetoolModal=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+=' \n
\n\n
    \n'+(null==(__t=showAllToolList)?"":__t)+"\n
\n
";return __p},templates.showallLinks=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
  • \n'+(null==(__t=shareObj.label)?"":__t)+"\n
  • ";return __p},templates}),define("shared/sharetools/views/email",["jquery/nyt","underscore/nyt","foundation/hosts","foundation/views/base-view","shared/modal/views/modal","shared/sharetools/templates"],function(e,t,i,n,s,a){"use strict";var o=n.extend({template:a.emailModal,className:"email-view-container",frameSize:{small:507,full:867,ad:285},defaultSettings:{emailThisUrl:"https:"+i.www+"/mem/email-this.html?url=",scrolling:window.Modernizr.postmessage?"no":"yes"},defaultModalSettings:{id:"email-share-modal",modalTitle:"Email This Article",binding:".email-sharetool",tailDirection:"centered",hasOverlay:!0,hasCloseButton:!0,modalContent:""},initialize:function(e){var i=this;t.bindAll(this,"handlePostMessage","responsive"),this.settings=t.extend({},this.defaultSettings,e),this.frameState="full",this.modalSettings=t.extend({},this.defaultModalSettings,{openCallback:function(){window.Modernizr.postmessage&&(window.addEventListener?window.addEventListener("message",i.handlePostMessage,!1):window.attachEvent("onmessage",i.handlePostMessage)),i.listenTo(i.pageManager,"nyt:page-breakpoint",i.responsive)},closeCallback:function(){this.removeFromPage(),window.addEventListener?window.removeEventListener("message",i.handlePostMessage,!1):window.detachEvent("onmessage",i.handlePostMessage),i.stopListening(i.pageManager,"nyt:page-breakpoint",i.responsive)}}),this.prepareUrls(),this.render()},render:function(){this.modalSettings.modalContent=this.template(this.settings),this.emailModal=new s(this.modalSettings),this.emailModal.addToPage(),t.defer(this.responsive,this.pageManager.getCurrentBreakpoint())},responsive:function(e){var t=this.emailModal.$modal.find("iframe");1010>=e&&"full"===this.frameState&&(t.css("height",t.height()+this.frameSize.ad+"px").width(this.frameSize.small),this.frameSize.state="small",this.emailModal.positionDialog()),e>1010&&"small"===this.frameState&&(t.css("height",t.height()-this.frameSize.ad+"px").width(this.frameSize.full),this.frameState="full",this.emailModal.positionDialog())},handlePostMessage:function(e){var t;/\.nytimes\.com$/.test(e.origin)&&(t=e.data.match(/(.+)\:(.+)/),t&&"frameheight"===t[1]?this.$el.css("height",t[2]):t&&"closewindow"===t[1]?this.emailModal.close():t&&"loginredirect"===t[1]&&(window.location=i.myaccount+"/auth/login?URI="+encodeURIComponent(window.location.href)))},prepareUrls:function(){"string"==typeof this.settings.dataUrl&&-1===this.settings.dataUrl.indexOf("http")&&(this.settings.dataUrl="http:"+i.www+this.settings.dataUrl)}});return o}),define("shared/sharetools/models/saved-article",["jquery/nyt","underscore/nyt","backbone/nyt","foundation/models/base-model"],function(e,t,i,n){"use strict";var s=n.extend({getSummary:function(){return this.get("Data")?this.get("Data").Summary:""},getByline:function(){return this.get("Data")?this.get("Data").Byline:""},getTitle:function(){return this.get("Data")?this.get("Data").Headline:this.get("URL")},getUrl:function(){return this.get("URL")},getDate:function(){return this.get("CreatedDate")},getFormattedDate:function(){var e=new Date(this.getDate());return this.dateHelper.getMonthShortName(e.getMonth())+" "+e.getDate()+", "+e.getFullYear()},getThumbUrl:function(){return this.get("Data")?this.get("Data").ImageCrops.MediumThreeByTwo210:""},getCaption:function(){var e="";return this.get("Data")&&(e=this.get("Data").ImageCaption),e},getCaptionStripTags:function(){return this.getCaption().replace(/<\/?[^>]+>/gi,"")},hasThumb:function(){return!!this.getThumbUrl()}});return s}),define("shared/sharetools/collections/cross-platform-save",["jquery/nyt","underscore/nyt","backbone/nyt","foundation/collections/base-collection","foundation/hosts","shared/sharetools/models/saved-article"],function(e,t,i,n,s,a){"use strict";var o=n.extend({model:a,offset:0,limit:20,apiCommand:{save:"POST",list:"GET",remove:"DELETE"},url:s.readingListApiHost+"/reading-list/v2",currentArticleSaved:!1,initialize:function(){var e=this,i={};this._getArticlesStatus=function(n){var s,a;return t.has(i,n)?i[n]:(s={data:{url:n},url:e.url+"/active"},a=this.sync(this.apiCommand.list,s),i[n]=a,i[n])}},save:function(e){var t=this,i={data:JSON.stringify({URL:e})};this.sync(this.apiCommand.save,i).done(function(i){t.articleIsSaved(!0,e),t.add(i),t.trigger("nyt:xps-saved",e,i)}).fail(function(){t.trigger("nyt:xps-failed",e)})},removeSavedArticle:function(e){var t=this,i={data:JSON.stringify({URL:e})};this.sync(this.apiCommand.remove,i).done(function(i){t.articleIsSaved(!1,e),t.remove(i),t.trigger("nyt:xps-article-removed",e,i)}).fail(function(){t.trigger("nyt:xps-failed",e)})},getSavedArticles:function(){var e=this,t={data:{offset:this.offset,limit:this.limit},url:this.url+"/data"};e.reset(),this.sync(this.apiCommand.list,t).done(function(t){e.add(t.Assets),e.totalCount=t.OverallSummary.Count,e.trigger("nyt:xps-articles-loaded",t.Assets)}).fail(function(){e.trigger("nyt:xps-load-failed")})},getNextSavedArticles:function(){return this.offset+=this.limit,this.limit=10,this.totalCount>this.offset?(this.getSavedArticles(),this.totalCount<=this.offset+this.limit&&this.trigger("nyt:xps-finished"),!0):!1},getArticlesStatus:function(e){var t=this;t._getArticlesStatus(e).done(function(i){t.articleIsSaved(0===i[0],e)}).fail(function(){t.broadcast("nyt:xps-load-failed")})},articleIsSaved:function(e,t){this.currentArticleSaved=e,this.broadcast("nyt:xps-article-status",e,t)},sync:function(i,n){var s=new e.Deferred,a=setTimeout(function(){s.reject()},5e3),o={type:i,dataType:"json",contentType:"application/json",url:this.url,headers:{},xhrFields:{withCredentials:!0},success:function(e){clearTimeout(a),e?s.resolve(e):s.reject()}};return e.ajax(t.extend(o,n)),s.promise()}});return o}),define("shared/sharetools/instances/cross-platform-save",["shared/sharetools/collections/cross-platform-save"],function(e){"use strict";return new e}),define("shared/sharetools/collections/short-url",["jquery/nyt","backbone/nyt","foundation/collections/base-collection","foundation/hosts"],function(e,t,i,n){"use strict";var s=i.extend({url:n.shortenHost+"/svc/bitly/shorten.jsonp",initialize:function(){this.currentUrlRequest="",this.addCurrentPage()},sync:function(e,i,n){return n.dataType="jsonp",n.jsonpCallback="shortUrlCallback",n.jsonp="callback",n.cache=!0,n.data={url:this.currentUrlRequest},t.sync(e,i,n)},parse:function(e){return{url:this.currentUrlRequest,shortUrl:e.payload?e.payload.short_url:""}},addCurrentPage:function(){var t,i=this.pageManager.getCanonical();t="1"===this.pageManager.getUrlParam("rico")&&"undefined"!=typeof this.pageManager.getUrlParam("share_url")?this.pageManager.getUrlParam("share_url"):e("#masthead").find(".story-short-url").text(),i&&t&&this.add({url:i,shortUrl:t})},getRicoUrl:function(e){var t=this.pageManager.getUrlParam("share_url"),i=document.createElement("a");return i.href=e,i.pathname===location.pathname&&t&&7===t.indexOf("r-i.co/")?t:void 0},requestUrl:function(e){var t,i=this.findWhere({url:e});return i?i.get("shortUrl"):(t=this.getRicoUrl(e))?t:(this.currentUrlRequest=e,void this.fetch())}});return s}),define("shared/sharetools/instances/short-url",["shared/sharetools/collections/short-url"],function(e){"use strict";return new e}),define("shared/sharetools/views/common-mixin",["jquery/nyt","underscore/nyt","foundation/hosts","foundation/models/user-data","foundation/models/page-storage","foundation/tracking/tracking-mixin","shared/modal/views/modal","shared/sharetools/templates","shared/sharetools/views/email","shared/sharetools/helpers/share-tools-config","shared/sharetools/instances/cross-platform-save","shared/sharetools/instances/short-url"],function(e,t,i,n,s,a,o,r,l,d,c,h){"use strict";var u={handleShareAction:function(t,i){var s=e(t.target),a=s.attr("data-share")||s.parent().attr("data-share"),o=a&&d[a.toUpperCase()];return o?(i&&this.modal&&this.modal.close(),"imageslideshow"!==this.pageManager.getMeta("PT")&&this.trackShareData(a,o,i),o===d.EMBED?void this.triggerEmbedLoginModal(t):void(o.isModalTrigger?this.broadcast("nyt:open-share-modal",{instanceContainer:this.$instanceContainer}):o===d.EMAIL?this.isMobileShareTools()?this.openMailToLink():n.isLoggedIn()?new l({dataUrl:this.shareData.getUrl()}):this.triggerLoginModal(t,"Log in to email","Email"):o===d.PRINT?window.print():o===d.SAVE?n.isLoggedIn()?c.currentArticleSaved?this.removeItem():this.saveItem():(this.trackingTrigger("loginmodal-open",{module:"LogIn",action:"Click",region:i?"ToolsMenu":this.trackingRegion,eventName:"ArticleTool-save"}),this.triggerLoginModal(t,"Log in to save","Save")):o.isPopup&&this.popupShareWindow(o))):void 0},handleModalShareAction:function(e){this.handleShareAction(e,!0)},triggerLoginModal:function(e,t,i){e.preventDefault(),e.stopPropagation(),this.broadcast("nyt:loginmodal-open",{modalTitle:t,moduleName:i})},triggerEmbedLoginModal:function(t){t.stopPropagation(),e(".show-all-sharetool a").trigger("click"),this.$body.find(".show-all-sharetool-modal #embed-input").select()},popupShareWindow:function(e){e.usesShortUrl?this.handleShortUrlShareAction(e):window.open(this.buildShareServiceUrl(e),"_blank",this.getPopupWindowFeatures(e))},getPopupWindowFeatures:function(e){return"toolbar=0,status=0,height="+e.height+",width="+e.width+",scrollbars=yes,resizable=yes"},buildShareServiceUrl:function(e){var t,i=[],n=e.smid,s=e.shareDataParameters,a=e.shareServiceParameters,o={url:this.shareData.getUrl(),title:this.shareData.getTitle(),description:this.shareData.getDescription(),media:this.shareData.getMedia()};if(n&&(o.url+=this.getQuerystringDelimiter(o.url),o.url+="smid="+n),s)for(t in s)s.hasOwnProperty(t)&&o.hasOwnProperty(t)&&i.push(s[t]+"="+encodeURIComponent(o[t]));if(a){a.hasOwnProperty("publicationDate")&&(a.publicationDate=this.shareData.getPublicationDate()),a.hasOwnProperty("author")&&(a.author=this.shareData.getAuthor());for(t in a)a.hasOwnProperty(t)&&i.push(t+"="+encodeURIComponent(a[t]))}return e.url+"?"+i.join("&")},handleShortUrlShareAction:function(t){var i,n,s,a,o=this,r=this.shareData.getUrl(),l=t.smid;/(?:iPad|iPhone)/.test(navigator.userAgent)?(a=e("#masthead").find(".story-short-url").text()||this.pageManager.getCanonical()||r,i=t.url+"?url="+encodeURIComponent(a)+"&text="+encodeURIComponent(o.shareData.getTitle()),window.open(i,"_blank",this.getPopupWindowFeatures(t))):(n=window.open("","_blank",this.getPopupWindowFeatures(t)),s=function(e){var i=o.shareData.getVia();e=t.url+"?url="+encodeURIComponent(e)+"&text="+encodeURIComponent(o.shareData.getTitle()),i&&(e+="&via="+encodeURIComponent(i)),n.location.href=e},l&&!this.pageManager.isMobile()&&(r+=this.getQuerystringDelimiter(r),r+="smid="+l),i=h.requestUrl(r)||"",i?s(i):this.listenToOnce(h,"add",function(){var e=h.findWhere({url:r});e&&s(e.get("shortUrl"))}))},getQuerystringDelimiter:function(e){return-1===e.indexOf("?")?"?":"&"},saveItem:function(){var e,t,n,a,o=this,l=this.shareData.getUrl();t=function(){var e="sharetools_hasSaves";s.get(e)!==!0?(a(),s.set(e,!0)):n()},n=function(){o.showModal({id:"save-item-growl-modal",modalTitle:'Saved',tailDirection:"centered",openCallback:function(){window.setTimeout(this.removeFromPage,2e3)}})},a=function(){o.showModal({id:"save-item-modal",modalTitle:'Saved',modalContent:r.savemodal({link:i.www+"/saved"}),hasOverlay:!0,hasCloseButton:!0,tailDirection:"centered",closeCallback:function(){this.removeFromPage()}})},e=c.where({url:l}),e.length?n():(this.subscribeOnce(c,"nyt:xps-saved",t),c.save(l))},removeItem:function(){var e=this,t=this.shareData.getUrl(),i=function(){e.showModal({id:"save-item-growl-modal",modalTitle:'Removed',tailDirection:"centered",openCallback:function(){window.setTimeout(this.removeFromPage,2e3)}})};this.subscribeOnce(c,"nyt:xps-article-removed",i),c.removeSavedArticle(t)},trackShareData:function(e,t,i){var n={};c.currentArticleSaved&&(e="unsave"),this.trackingBaseData={module:"ShareTools",action:"click",version:this.shareData.getContentType(),contentCollection:this.pageManager.getMeta("article:section")},i?(n.region="ToolsMenu",n.version="Content"):n.region=this.trackingRegion,t.isArticleTool?(n.module="ArticleTools",n.eventName="ArticleTool-"+e):"show-all"===e?n.eventName="Share-ShowAll":n.eventName="Share-"+e,this.trackingTrigger("share-tools-click",n)},showModal:function(e){var i=new o(e);i.addToPage(),t.defer(i.open)},isMobileShareTools:function(){return this.pageManager.getCurrentBreakpoint()<1e3},openMailToLink:function(){var e="%0A%0A",t=encodeURIComponent(this.shareData.getTitle()),i=encodeURIComponent(this.shareData.getDescription()),n=encodeURIComponent(this.shareData.getUrl()),s="NYTimes.com: "+t,a="From The New York Times:"+e+t+e+i+e+n;window.location="mailto:?subject="+s+"&body="+a}};return u}),define("shared/sharetools/views/share-tool",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/sharetools/views/common-mixin","shared/sharetools/templates"],function(e,t,i,n,s){"use strict";var a=i.extend(t.extend({},n,{tagName:"li",events:{click:"handleShareAction"},initialize:function(e){this.toolId=e.toolId,this.toolConfig=e.toolConfig,this.label=e.customLabel||this.toolConfig.label,this.loginModalTitle=this.toolConfig.loginModalTitle||"",this.$instanceContainer=e.instanceContainer,this.shareData=e.shareData,this.trackingRegion=e.trackingRegion,""===e.customLabel&&(this.isLabelHidden=!0)},render:function(){var e,t,i=this.toolId.toLowerCase();return this.isAdView()?(e=this.pageManager.getCurrentBreakpoint()<=1020?"Position1":"Frame4A",this.$instanceContainer.find(".sharetools-inline-article-ad").attr("id",e),this.broadcast("nyt:ad-library:dfp:queue-placement",e),this.$instanceContainer.find("#"+e).removeClass("hidden")):(t=s.shareTool({id:i,label:this.label,loginModalTitle:this.loginModalTitle,isLabelHidden:this.isLabelHidden}),this.$el.addClass("sharetool "+i+"-sharetool"),this.$el.append(t)),this},isAdView:function(){return"AD"===this.toolId}}));return a}),define("shared/sharetools/models/share-data",["foundation/models/base-model"],function(e){"use strict";var t=e.extend({dataAttributes:{URL:"data-url",TITLE:"data-title",MEDIA:"data-media",DESCRIPTION:"data-description",PUBLICATION_DATE:"data-publish-date",CONTENT_TYPE:"data-content-type",AUTHOR:"data-author",VIA:"data-via"},initialize:function(e){this.$container=e},getUrl:function(){var e=this.$container.attr(this.dataAttributes.URL);return e?e:this.pageManager.getCanonical()},setUrl:function(e){this.$container.attr(this.dataAttributes.URL,e)},getTitle:function(){var e=this.$container.attr(this.dataAttributes.TITLE);return e?e:this.pageManager.getMeta("og:title")},setTitle:function(e){this.$container.attr(this.dataAttributes.TITLE,e)},getAuthor:function(){var e=this.$container.attr(this.dataAttributes.AUTHOR);return e?e:this.pageManager.getMeta("byl")},setAuthor:function(e){this.$container.attr(this.dataAttributes.AUTHOR,e)},getMedia:function(){var e=this.$container.attr(this.dataAttributes.MEDIA);return e?e:this.pageManager.getMeta("og:image")},setMedia:function(e){this.$container.attr(this.dataAttributes.MEDIA,e)},getDescription:function(){var e=this.$container.attr(this.dataAttributes.DESCRIPTION);return e?e:this.pageManager.getMeta("description")},setDescription:function(e){this.$container.attr(this.dataAttributes.DESCRIPTION,e)},getPublicationDate:function(){var e=this.$container.attr(this.dataAttributes.PUBLICATION_DATE);return e?e:this.pageManager.getMeta("DISPLAYDATE")},setPublicationDate:function(e){this.$container.attr(this.dataAttributes.PUBLICATION_DATE,e)},getVia:function(){var e=this.$container.attr(this.dataAttributes.VIA),t=this.pageManager.getMeta("twitter:site");return e?e:"upshot"===this.pageManager.getMeta("CG")?"UpshotNYT":t&&"@nytimes"!==t?t.replace("@",""):""},setVia:function(e){this.$container.attr(this.dataAttributes.VIA,e)},getContentType:function(){var e=this.$container.attr(this.dataAttributes.CONTENT_TYPE);return e?e:"Content"},setContentType:function(e){this.$container.attr(this.dataAttributes.CONTENT_TYPE,e)}});return t}),define("shared/sharetools/views/containers-mixin",["jquery/nyt","underscore/nyt","shared/sharetools/models/share-data","shared/sharetools/views/share-tool","shared/sharetools/helpers/share-tools-config"],function(e,t,i,n,s){"use strict";var a={getToolIdsAndCustomLabels:function(e){var t,i,n,a;if(this.toolIds=[],this.customLabels={},e)for(e=e.split(","),t=0,n=e.length;n>t;t++)i=e[t].toUpperCase(),a=i.indexOf("|"),-1!==a&&(i=i.substring(0,a),this.customLabels[i]=e[t].substr(a+1)),this.toolIds.push(i);else for(i in s)s.hasOwnProperty(i)&&s[i].isInDefaultSet===!0&&this.toolIds.push(i)},instantiateViews:function(e){var i,a,o,r,l,d=[];for(i=0,a=e.length;a>i;i++)o=e[i],r=this.customLabels&&this.customLabels[o],s.hasOwnProperty(o)&&(l={toolId:o,toolConfig:s[o],instanceContainer:this.$instanceContainer,shareData:this.shareData,trackingRegion:this.trackingRegion},t.isString(r)&&(l.customLabel=r),d.push(new n(l)));return d},renderToolViews:function(){var e,t,i;for(t=this.instantiateViews(this.toolIds),e=0,i=t.length;i>e;e++)t[e].isAdView()?t[e].render():this.$el.append(t[e].render().el)},getToolViewsMarkup:function(t){var i,n=document.createElement("div"),s=this.instantiateViews(t),a=s.length;for(i=0;a>i;i++)n.appendChild(s[i].render().el);return e(n).html()}};return a}),define("shared/sharetools/views/share-tools-modal-container",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/modal/views/modal","shared/sharetools/helpers/share-tools-config","shared/sharetools/views/share-tool","shared/sharetools/views/common-mixin","shared/sharetools/views/containers-mixin","shared/sharetools/instances/short-url","shared/sharetools/templates"],function(e,t,i,n,s,a,o,r,l,d){"use strict";var c=i.extend(t.extend({},o,r,{events:{click:"handleModalShareAction"},defaultModalSettings:{id:"show-all-sharetool-modal",modalTitle:"share",binding:".show-all-sharetool",tailDirection:"up",hasOverlay:!1,hasCloseButton:!1,positionTailSide:!1,autoPosition:!1,modalContent:"",toolTypeSponsor:"Share",tailLeftOffset:0,tailTopOffset:0,openCallback:function(){this.$target.addClass("active")},closeCallback:function(){this.$target.removeClass("active"),this.removeFromPage()}},initialize:function(i){this.$instanceContainer=i.instanceContainer,this.trackingRegion=i.trackingRegion,this.shareData=i.shareData,this.configIds=i.modalSettings.shares,this.showTools=i.modalSettings.hasOwnProperty("showTools")?i.modalSettings.showTools:!0,this.modalSettings=t.extend({},this.defaultModalSettings,i.modalSettings),this.modalSettings.modalFooter=d.shareToolsModalFooter({toolTypeSponsor:this.modalSettings.toolTypeSponsor}),this.isMobileShareTools()&&(this.modalSettings=t.extend({},this.modalSettings,{tailDirection:"centered",hasCloseButton:!0,hasOverlay:!0,positionTailSide:!1,autoPosition:!1})),this.el=document.createElement("ul"),this.el.className="sharetools-menu",this.$el=e(this.el),this.urlWithSmid=this.shareData.getUrl(),this.urlWithSmid+=-1===this.urlWithSmid.indexOf("?")?"?":"&",this.urlWithSmid+="smid=pl-share",this.permalink=l.requestUrl(this.urlWithSmid)||"",this.permalink||this.listenToOnce(l,"add",this.handleShortUrl),this.render()},render:function(){var e="Frame6A",t=this;this.modalSettings.modalContent=d.shareToolsModal(this.buildMarkup()),this.modal=new n(this.modalSettings),this.setElement(this.modal.$modal),this.modalSettings.embedCode&&this.modal.$modal.find(".embed-input").val(this.modalSettings.embedCode),this.modal.$modal.find(".show-all-sharetool-modal-ad").attr("id",e),this.modalSettings.articleSaved&&this.modal.$modal.find(".save-sharetool").addClass("article-saved"),this.modal.addToPage(),this.isMobileShareTools()||this.broadcast("nyt:ad-library:dfp:request-placement",e),this.subscribe("nyt:page-resize",function(){t.modal.close()})},buildMarkup:function(){var i,n,a,o=this,r=[],l=[],d=function(e){var i;s.hasOwnProperty(e)&&(i=t.extend({},s[e],{id:e}),s[e].isArticleTool?"REPRINTS"===e?"article"!==o.pageManager.getMeta("PT")||/\/(?:aponline|reuters|opinion|t-magazine|magazine)\//.test(o.shareData.getUrl())||"books"===o.pageManager.getMeta("CG")&&"Review"===o.pageManager.getMeta("tom")||l.push(i):s[e].isArticleTool&&l.push(i):r.push(i))};if(this.configIds)for(this.getToolIdsAndCustomLabels(this.configIds),i=0,a=this.toolIds.length;a>i;i++)d(this.toolIds[i]);else{for(n in s)s[n].isModalMember&&d(n);r=t.sortBy(r,function(t){return e("html").hasClass("viewport-medium")?t.modalDisplayOrder:t.mobileModalDisplayOrder}),l=t.sortBy(l,function(t){return e("html").hasClass("viewport-medium")?t.modalDisplayOrder:t.mobileModalDisplayOrder})}return{shortUrl:this.permalink,showTools:this.showTools,isCompact:"homepage"===o.pageManager.getApplicationName(),standardToolsList:this.getToolViewsMarkup(t.pluck(r,"id")),articleToolsList:this.getToolViewsMarkup(t.pluck(l,"id"))}},handleShortUrl:function(){var e=l.findWhere({url:this.urlWithSmid});e&&this.modal.$modal.find(".short-url-input").val(e.get("shortUrl"))}}));return c}),define("shared/community/views/flag-modal",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/community/api-mixin","shared/modal/views/modal","shared/community/templates"],function(e,t,i,n,s,a){"use strict";var o=i.extend(t.extend({},n,{defaultSettings:{id:"flag-modal",addlClasses:"flag-modal",modalContent:"",binding:".comment-flag:not(.comment-reported)",tailDirection:"down-right",hasOverlay:!1,reasons:{Vulgar:"Vulgar",Spam:"Spam",Inflammatory:"Inflammatory","Off Topic":"Off-topic","Personal Attack":"Personal-attack"},openCallback:function(){this.flaggedComment=this.$target.parents(".comment").data("id"),this.$target.addClass("active"),this.subscribeOnce("nyt:page-scroll",this.close),this.subscribeOnce(this.comments,"nyt:community-scroll",this.close),this.trackingTrigger("comment-flag-click",{module:"Comments",action:"Click",region:"Marginalia",eventName:"comments-user-flagged",eventType:"interaction"})}},events:{"click .flag-button":"submitFlag","click .cancel-button":"handleClose"},initialize:function(e){var i=this;this.defaultSettings.closeCallback=function(){i.resetReasons(),this.flaggedComment=0,this.$target.removeClass("active")},this.modalSettings=t.extend({},this.defaultSettings,e),this.modalSettings.modalContent=a.flag(this.modalSettings),this.render(),this.model=e.model,this.flagModal.comments=e.view},render:function(){this.flagModal=new s(this.modalSettings).addToPage(),this.setElement(this.flagModal.$modal)},getReasons:function(){var e=0,i="";return t.each(this.modalSettings.reasons,function(t){this.$("#flag-checkbox-"+t).is(":checked")&&(i+=e>0?","+t:t,e+=1)},this),i},resetReasons:function(){t.each(this.modalSettings.reasons,function(e){this.$("#flag-checkbox-"+e).attr("checked",!1)},this)},submitFlag:function(){var e=this;return this.apiPost({command:"flag",userID:this.model.getUser().getUserId(),commentID:this.flagModal.flaggedComment,asset:this.model.getAsset(),commentLabels:this.getReasons()}).always(function(){e.local(e.flagModal.comments,"nyt:community-comment-flagged",e.flagModal.flaggedComment),e.flagModal.close()}),!1},removeLinkFromReported:function(){e(".comment-reported").click(function(e){e.preventDefault()})},handleClose:function(){return this.flagModal.close(),!1}}));return o}),define("shared/community/views/verified-modal",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/modal/views/modal","shared/community/templates"],function(e,t,i,n,s){"use strict";var a=i.extend({defaultSettings:{id:"verified-modal",addlClasses:"verified-modal",modalContent:"",binding:".trusted-icon",tailDirection:"down",tailLeftOffset:7,canOpenOnHover:!0,hasOverlay:!1,closeOnMouseOut:!0,closeOnClick:!1,openCallback:function(){this.subscribeOnce("nyt:page-scroll",this.close),this.subscribeOnce("nyt:community-scroll",this.close)}},initialize:function(e){this.modalSettings=t.extend({},this.defaultSettings,e),this.modalSettings.modalContent=s.verified(this.modalSettings),this.render()},render:function(){this.verifiedModal=new n(this.modalSettings).addToPage(),this.setElement(this.verifiedModal.$modal)}});return a}),define("shared/community/views/comments",["jquery/nyt","underscore/nyt","foundation/views/base-view","foundation/models/user-data","shared/community/views/utils-mixin","shared/sharetools/views/share-tools-modal-container","shared/sharetools/helpers/share-tools-config","shared/community/views/flag-modal","shared/community/views/verified-modal","shared/community/templates","foundation/lib/polyfills/placeholder","shared/sharetools/models/share-data"],function(e,t,i,n,s,a,o,r,l,d,c,h){ "use strict";var u=i.extend(t.extend({},s,{template:d.comments,postTemplate:d.post,formTemplate:d.form,shareTools:null,events:{click:"toggleForm","click .comments-thread-expand":"loadMore","click .comments-subthread-expand":"loadReplies","click .comments-view-navigation li":"loadFilter","click .comments-sort-container":"loadSort","click .comments-view .comment .comment-time":"handlePermalinkClick","click .comments-view .comment .comment-parent":"handlePermalinkClick","click .comment-recommend":"recommend","click .sharetools span":"handleShare","click .comment-submit-button":"submitForm","click .comment-reply":"toggleReplyForm","click .view-all":"loadFilter","keypress .commenter-gateway-input":"toggleForm","focus .commenter-gateway-input":"toggleForm"},active:{0:{},permalink:{}},defaultSettings:{header:"Comments",maxPosts:25,filter:"all",sort:"newest",showDate:!0,dateFormat:"interval",showLocation:!0,showAvatar:!0,maxCharCount:1500,adPlacement:"Spon2",defaultPrompt:"Share your thoughts.",promoPrompt:'Click here to read the best Times comments from the past week.',animateSpeed:250},initialize:function(e){this.settings=t.extend({},this.defaultSettings,e),this.subscribe(this,"nyt:community-loaded",this.getPosts),this.subscribe(this,"nyt:community-post-recommended",this.updateRecCount),this.subscribe(this,"nyt:community-comment-posted",this.confirmPost),this.subscribe("nyt:comments-panel-opened nyt:page-breakpoint nyt:page-resize",this.resizeHeaderContainer),this.subscribeOnce(this,"nyt:community-thread-loaded",this.render),this.subscribe("nyt:community-commentspanel-open",function(e){(t.isString(e)||t.isNumber(e))&&this.loadPermalink(""+e),this.$el.focus(),this.panelActive(!0)}),this.subscribe("nyt:comments-panel-closed",function(){this.resetForms(),this.panelActive(!1)}),this.request()},request:function(){this.broadcast("nyt:community-request",this.settings.asset,this,this.settings)},getPosts:function(e){var t;this.model=this.model||e,this.model.getDefaultQuery()?(t=this.model.getDefaultQuery(),this.settings.filter=t.filter||this.settings.filter,this.settings.sort=t.sort||this.settings.sort,this.model.load(this.settings,this)):this.subscribeOnce(this.model,"nyt:community-summary",this.getPosts)},render:function(e){var i,n,s,a=this,o=this.model.getPrompt();return o.toLowerCase()===this.settings.defaultPrompt.toLowerCase()&&(o=this.settings.promoPrompt),i={all:"All",reader:"Readers’ Picks",nytpicks:"NYT Picks",nytreplies:"NYT Replies"},n=t.extend({},this.settings,{filters:{},header:"Comment",view:this,isOpen:this.model.isOpen(),commentPrompt:o,commentPromptVisibility:!0}),s=t.throttle(function(){a.toggleHeader(),a.broadcast(a.comments,"nyt:community-scroll")},500),this.subscribe(this,"nyt:community-request",function(e){e.limit||"replies"===e.filter||a.toggleLoader(!0)}),this.subscribe(this,"nyt:community-thread-loaded",function(){a.toggleLoader(!1)}),this.subscribe(this,"nyt:community-comment-flagged",this.confirmFlagged),this.model.getNumberOfPosts()>0&&(n.header=this.model.getNumberOfPosts()+" "+n.header+(this.model.getNumberOfPosts()>1?"s":"")),this.settings.showDate&&this.formatDate(n.posts),t.each(this.model.getFilters(),function(e){n.filters[e]=i[e]},this),this.subscribe(this,"nyt:community-thread-loaded",this.updateView),this.$el.html(this.template(n)).show(),this.renderAd(),this.cacheElements(),this.updateView(e),this.updateNavigation(),this.toggleSortButtons(),this.toggleLoadButtons(),this.renderForm(),this.renderFlagModal(),this.renderVerifiedModal(),this.toggleEmpty(0===e.length),this.cloneHeader(),this.$comments.on("drag scroll touchend touchstart touchmove swipe",s),this.$clonedHeader.find(".section-heading").on("touchend click",function(){a.updateScrollPosition()}),this.broadcast("nyt:community-rendered",this.settings.asset,this),t.defer(function(){a.readHash()}),this.pageManager.setMeta("isCommentsOpen",this.model.isOpen()),this},cacheElements:function(){this.$comments=this.$(".comments"),this.$loader=this.$comments.find(".loader-container").hide(),this.$panelBody=this.$comments.find(".comments-view"),this.$loadMore=this.$comments.find(".comments-footer"),this.$permalink=this.$(".comment-permalink-view"),this.$viewAll=this.$(".view-all"),this.$header=this.$(".comments-header-container"),0===this.$loadMore.length&&this.subscribeOnce(this,"nyt:community-thread-loaded",this.cacheElements)},setActive:function(e,i,n){e=e||[],i&&(n?this.active.permalink={}:this.active={0:{},permalink:{}}),t.each(e,function(e){var t=n?"permalink":e.getParentId();this.active[t]||(this.active[t]={}),this.active[t][e.getId()]=e},this)},isActive:function(e,i){var n=!1;return i?n=e&&e.getId?this.active.permalink[e.getId()]:this.active.permalink[e]:"number"==typeof e?t.each(this.active,function(i){t.has(i,e)&&(n=i[e])}):n=e&&e.getParentId&&this.active[e.getParentId()]?this.active[e.getParentId()][e.getId()]:!1,n},configureProperties:function(e){return e=e||{},"undefined"==typeof e.isPermalink&&(e.isPermalink=!1),e.isPermalink?(e.container=this.$permalink,e.isSubThread=!1,"number"==typeof e.parent&&(e.container=this.$permalink.find("[data-id="+e.parent+"]").find(".thread"),e.isSubThread=!0)):"number"==typeof e.parent?(e.container=this.$panelBody.find("[data-id="+e.parent+"]").find(".thread"),e.isSubThread=!0):e.container&&e.container.attr?(e.container=e.container.find(".thread"),e.isSubThread=!0):(e.container=this.$panelBody,e.isSubThread=!1),e.isSubThread&&(e.clearView=!1),e.view=this,e},updateView:function(e,t,i){t=t||e,i=this.configureProperties(i),this.settings.showDate&&this.formatDate(t),i.clearView&&this.unload(),this.addPostsToView(t,i),this.setActive(t,i.clearView,i.isPermalink),i.isSubThread||(this.togglePermalink(i.isPermalink),this.toggleLoadButtons(),this.orderElements(),this.toggleSortButtons(),this.updateNavigation()),0===e&&this.updateNavigation(),this.toggleEmpty(0===t.length)},updateScrollPosition:function(){this.slideHeaderUp(),this.$comments.scrollTop(0),this.$(".thread-form").show()},resizeHeaderContainer:function(){var e;this.$comments&&(e=this.$comments.width()-15,this.$header.css({width:e}),this.$clonedHeader.css({width:e}))},orderElements:function(){this.$loader.appendTo(this.$panelBody),this.$loadMore.appendTo(this.$panelBody)},addPostsToView:function(i,n){var s=n.container.children("article").toArray(),a=this.model.isOpen(),o=this,r=s.length?s[0]:!1;t.each(i,function(i,l){var d;return this.isActive(i,n.isPermalink)?(s.shift(),void(r=s.length?s[0]:!1)):(d=this.postTemplate(t.extend({},this.settings,n,{post:i,view:o,isOpen:a,index:l})),void(r?e(r).before(d):n.container.append(d)))},this),this.checkAvatars()},checkAvatars:function(){this.$(".avatar").not(".avatar-loaded").find("img").each(function(t,i){var n=new Image,s=e(i.parentNode);n.addEventListener("load",function(){this.loadAvatar(s,i)}.bind(this)),n.src=i.src}.bind(this))},loadAvatar:function(e,t){e.addClass("avatar-loaded"),t.naturalWidth>1&&e.addClass("show-avatar")},togglePermalink:function(e){this.$permalink[e?"show":"hide"]()},toQuery:function(e){return e=e||{},t.extend({},this.settings,e)},loadMore:function(){this.model.load(this.toQuery({limit:this.settings.maxPosts}),this),this.track("load-more-comments",{eventName:"More-coms-in-panel",module:"Comments",action:"Click",region:"Comments"})},loadReplies:function(e,i){var n;t.isObject(i)||(i={}),t.isObject(e)?(n=this.$(e.target).parents(".comment"),this.$(e.target).remove(),e=parseInt(n.data("sequence"),10)):n=this.$("[data-sequence="+e+"]"),this.model.load(this.toQuery({context:e,filter:"replies",sort:"oldest"}),this,t.extend({container:n},i)),this.track("load-replies",{eventName:"All-replies",module:"Comments",action:"Click",region:"Comments"})},loadFilter:function(e){var t=this.$(e.target).data("filter");this.settings.filter=t,"reader"===t?this.settings.sort=t:this.settings.sort="newest",this.toggleLoadButtons(),this.model.load(this.toQuery(),this,{clearView:!0}),this.updateScrollPosition(),this.$(e.target).hasClass("view-all")?this.track("click-view-all",{module:"Comments",version:"RecentComments",action:"Click",region:"Marginalia",eventName:"comments-open-panel",eventType:"interaction",clickLocation:"ViewAllComments"}):"all"===t&&this.track("click-all",{module:"Comments",version:"RecentComments",action:"Click",region:"Marginalia",eventName:"comments-open-panel",eventType:"interaction",clickLocation:"All"})},loadSort:function(){this.settings.sort=this.$(".comments-sort").data("sort"),this.model.load(this.toQuery({sort:this.$(".comments-sort").data("sort")}),this,{clearView:!0}),this.updateScrollPosition()},handlePermalinkClick:function(t){var i,n;i=e(t.target),i.data("permid")||(i=i.parents(".comment")),n=i.data("permid"),this.loadPermalink(n),t.preventDefault()},loadPermalink:function(e){var t;e+="",t=e.split(":")[0],this.$permalink.empty(),this.setActive([],!0,!0),this.subscribeOnce(this,"nyt:community-thread-loaded",function(e){e[0]&&this.loadReplies(t,{isPermalink:!0,parent:e[0].getId()})}),this.model.load(this.toQuery({filter:"permalink",permID:t}),this,{isPermalink:!0}),this.updateScrollPosition(),this.pageManager.setUrlHash("permid="+e)},unload:function(){this.setActive([],!0),this.$loadMore.detach(),this.$loader.detach(),this.$panelBody.empty().append(this.$loadMore).append(this.$loader)},panelActive:function(e){this.pageManager.setMeta("commentspanel_isOpen",e)},toggleLoadButtons:function(){this.model.hasAdditionalPosts(this.settings)?this.$loadMore.find(".comments-expand").show():this.$loadMore.find(".comments-expand").hide(),"all"!==this.settings.filter?this.model.hasAdditionalPosts(this.settings)?this.$viewAll.hide():this.$viewAll.show():this.$viewAll.hide()},toggleSortButtons:function(){var e=this.$(".comments-sort-container"),t=this.$(".comments-sort");"all"===this.settings.filter?(this.settings.sort=this.settings.sort||"newest","newest"===this.settings.sort?t.text("Newest").data("sort","oldest"):t.text("Oldest").data("sort","newest"),e.show()):e.hide()},updateNavigation:function(){this.$(".tab").removeClass("selected").filter("[data-filter="+this.settings.filter+"]").addClass("selected")},recommend:function(e){var t,i=this.$(e.target).hasClass("comment-recommend")?this.$(e.target):this.$(e.target).parents(".comment-recommend:first"),s=i.parents(".comment:first"),a=this.isActive(parseInt(s.data("id"),10));n.isLoggedIn()||this.track("loginmodal-open",{module:"LogIn",action:"Click",region:"Marginalia",eventName:"Recommend"}),a.recommend(t,this.model.getAsset(),this,i)},updateRecCount:function(e,t){var i,n="";e.getRecommendations()>0&&(n=''+e.getRecommendations()+""),e.isRecommended()?(t.html(n+"Recommended").addClass("recommended"),i="Rec"):(t.html(n+"Recommend").removeClass("recommended"),i="Un-Rec"),this.track("recommend-comment",{eventName:i,module:"Comments",action:"Click",region:"Comments"})},handleShare:function(e){var t=this.$(e.target).data("share")||this.$(e.target).parent().data("share"),i=o[t.toUpperCase()];this.shareData=new h(this.$(e.target).parents(".comment:first")),this.shareTools=new a({el:this.$el.find(".sharetools"),modalSettings:{shares:"facebook,twitter"},shareData:this.shareData}),"facebook"===t?this.shareTools.popupShareWindow(i):this.shareTools.handleShortUrlShareAction(i),this.track("comments-share",{module:"ShareTools",action:"Click",version:"CommentsPanel",region:"Comments",eventName:"Share-"+(t||"").toLowerCase()})},renderAd:function(){this.settings.adPlacement&&this.broadcast("nyt:ads-new-placement",this.settings.adPlacement)},renderForm:function(){var e=this;this.model.isOpen()&&(this.$(".thread-form").html(this.formTemplate({user:this.model.getUser(),confirmPost:!1,gatewayLabel:this.model.getPrompt(),gatewayPlaceholder:this.settings.defaultPrompt})).on("change keyup cut paste",function(){e.updateCount(e.$(".thread-form")),e.toggleSubmitButton(e.$(".thread-form"))}),this.toggleForm(),c(),this.checkAvatars(),this.model.getUser().on("sync",this.updateUserInfo.bind(this)))},updateUserInfo:function(){var e=this.model.getUser(),t=this.$(".thread-form");t.find(".commenter").text(e.getName()),t.find(".commenter-location").text(e.getLocation()),e.getNotify()?t.find(".comment-notify").attr("checked","checked"):t.find(".comment-notify").removeAttr("checked"),e.hasAvatar()&&t.find(".avatar img").attr("src",e.getAvatar())},toggleForm:function(e){var t;e?(t=this.$(e.target),t.hasClass("comment-flag")&&!n.isLoggedIn()&&this.track("loginmodal-open",{module:"LogIn",action:"Click",region:"Marginalia",eventName:"flag"}),0===t.parents(".thread-form").length?this.toggleForm():n.isLoggedIn()?(this.$(".thread-form .primary-control").hide(),this.$(".thread-form .secondary-control").show(),t.hasClass(".thread-form")&&t.find("textarea").focus()):(t.blur(),e.preventDefault(),e.stopPropagation(),this.track("loginmodal-open",{module:"LogIn",action:"Click",region:"Marginalia",eventName:"ShareYourThoughts"}),this.broadcast("nyt:loginmodal-open",{modalTitle:"Log in to comment",moduleName:"CommentsPanel"}))):(this.$(".thread-form .secondary-control").hide(),this.$(".thread-form .primary-control").show())},confirmPost:function(e,t){var i=t.$formControl||this.$(".thread-form");this.toggleSubmitButton(i,!1),this.toggleTextBox(i,!1),i.html(this.formTemplate({user:this.model.getUser(),confirmPost:!0,message:e,showAvatar:this.settings.showAvatar,showLocation:this.settings.showLocation,gatewayLabel:this.model.getPrompt(),gatewayPlaceholder:this.settings.defaultPrompt})),i.find("form").hide().parent().find(".comment-confirmation").show()},updateCount:function(e){var t=this.settings.maxCharCount-e.find(".comment-textarea").val().length;e.find(".comment-character-count").text(t)},checkUserInfo:function(e){var t=e.find(".commenter-input").length>0?e.find(".commenter-input").val():null,i=e.find(".commenter-location-input").length>0?e.find(".commenter-location-input").val():null,n=!1,s=new RegExp(/^([a-zA-Z0-9])+([a-zA-Z0-9\._\-])*@([a-zA-Z0-9_\-])+([a-zA-Z0-9\._\-]+)+$/);return null===t||0!==t.length&&!s.test(t)?null===i||0!==i.length&&!s.test(i)||(n=!0):n=!0,this.toggleFormError(e,n,"user-info"),!n},toggleFormError:function(e,t,i){var n,s;t?(n="removeClass",s="attr"):(n="addClass",s="removeAttr"),e.find("."+i+"-error")[n]("hidden")[s]("aria-live","assertive")[s]("role","alert")},checkCommentForm:function(e){var t=parseInt(e.find(".comment-character-count").text(),10),i=!1,n=!1;return 0>t?(i=!0,n=!0):t===this.settings.maxCharCount&&(n=!0),this.toggleFormError(e,i,"character"),!n},toggleSubmitButton:function(e,t){var i,n,s;"undefined"==typeof t?(i=!this.checkUserInfo(e),n=!this.checkCommentForm(e),s=i||n):s=t,s?e.find(".comment-submit-button").attr("disabled","disabled").addClass("disabled"):e.find(".comment-submit-button").removeAttr("disabled").removeClass("disabled")},toggleEmpty:function(e){n.isLoggedIn()&&("undefined"==typeof e&&0===this.model.totalPosts()?(this.$(".thread-form .primary-control").hide(),this.$(".thread-form .secondary-control").show()):e&&(this.$(".thread-form .primary-control").hide(),this.$(".thread-form .secondary-control").show()))},submitForm:function(e){var t=this.$(e.target),i=t.closest(".comment"),n=i.data("id"),s=i.data("parentid"),a=t.closest(".form-control"),o=/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,r={$formControl:a,parentId:n,ancestorId:s};a.find(".commenter-input").length&&(this.model.getUser().setName(this.stripHtml(a.find(".commenter-input").val().replace(o,""))),this.model.getUser().setLocation(this.stripHtml(a.find(".commenter-location-input").val().replace(o,"")))),this.toggleSubmitButton(a,!0),this.toggleTextBox(a,!0),this.model.post(this,{commentBody:this.stripHtml(a.find(".comment-textarea").val().replace(o,"")),commentNotify:a.find(".comment-notify").is(":checked")},r),e.preventDefault(),"undefined"==typeof n?this.track("post-comment-new",{module:"Comments",version:"RecentComments",action:"Click",region:"Marginalia",eventName:"comments-submit-new",eventType:"interaction"}):this.track("post-comment-reply",{module:"Comments",version:"RecentComments",action:"Click",region:"Marginalia",eventName:"comments-submit-reply",eventType:"interaction"})},toggleTextBox:function(e,t){t?e.find("textarea").attr("disabled","disabled").addClass("disabled"):e.find("textarea").removeAttr("disabled").removeClass("disabled")},toggleReplyForm:function(e){var t=this.$(".thread-form"),i=this.$(e.target).closest(".comment"),s=i.find(".reply-form-control").first(),a=i.closest(".comments-view, .comment-permalink-view"),o=this;0===s.find(".secondary-control").length&&n.isLoggedIn()&&(s=s.append('
    ').find("form"),a.find(".secondary-control").parents(".reply-form-control").empty(),t.find(".secondary-control").each(function(e,i){t.find(i).clone().show().appendTo(s.show().focus())}),s.on("change keyup cut paste",function(){o.updateCount(o.$(".reply-form-control")),o.toggleSubmitButton(o.$(".reply-form-control"))}),s.find(".comment-character-count").html(this.settings.maxCharCount),s.find(".comment-submit-button").attr("disabled","disabled").addClass("disabled"))},renderFlagModal:function(){n.isLoggedIn()&&(this.$flagModal=new r({model:this.model,view:this}))},renderVerifiedModal:function(){this.$verifiedModal=new l},cloneHeader:function(){this.$clonedHeader=this.$header.clone().find(".form-control").remove().end().hide(),this.$el.append(this.$clonedHeader)},toggleHeader:function(){this.$panelBody.position().top<0?this.$clonedHeader.isDown||this.slideHeaderDown():this.$clonedHeader.isDown&&this.slideHeaderUp()},toggleLoader:function(e){this.$loader[e?"show":"fadeOut"]()},confirmFlagged:function(e){this.$("[data-id="+e+"]").find(".comment-flag:first").addClass("comment-reported").html("Reported")},readHash:function(){var e=this.pageManager.getUrlHash(),t=!1;"commentsContainer"===e?(this.broadcast("nyt:community-commentspanel-open"),t=!0):e.indexOf("permid")>-1&&(this.broadcast("nyt:community-commentspanel-open",e.substr(7)),t=!0),t&&this.track("auto-open-comments-panel",{module:"Comments",version:"AutoOpen",action:"click",region:"FixedRight",eventName:"OpenCommentsPanel"})},resetForms:function(){this.$(".thread-form .comment-textarea").length>0&&(this.updateCount(this.$(".thread-form").find("textarea").val("").end()),this.toggleSubmitButton(this.$(".thread-form"))),this.$(".reply-form-control .comment-textarea").length>0&&(this.updateCount(this.$(".reply-form-control").find("textarea").val("").end()),this.toggleSubmitButton(this.$(".reply-form-control")))},track:function(e,i){this.trackingTrigger(e,t.extend(this.getTrackingParams(),i))},slideHeaderDown:function(){this.$header.addClass("invisible"),this.$clonedHeader.isDown=!0,this.$clonedHeader.stop(!0).show().css({position:"absolute",top:"-"+this.$clonedHeader.height()+"px"}).removeClass("hidden").animate({top:0,opacity:1},this.settings.animateSpeed)},slideHeaderUp:function(){this.$clonedHeader.isDown=!1,this.$clonedHeader.stop(!0).addClass("hidden"),this.$header.removeClass("invisible")}}));return u}),define("article/story/instances/community",["foundation/hosts","shared/community/collections/community-loader","shared/community/views/comments-panel","shared/community/views/comments-button","shared/community/views/comments-peek","shared/community/views/comments"],function(e,t,i,n,s,a){"use strict";(new t).enabled(function(){new i,new a({el:".panel-content"}),new s({el:".selected-comment-marginalia",header:"Recent Comments",showLocation:!1,dateFormat:"interval"}),new s({el:".featured-comment-marginalia",header:"Featured Comment",isExcerpt:!0}),new s({el:".comment-prompt-marginalia",isPrompt:!0}),new n({el:".comments-button.theme-speech-bubble",defaultText:"",hideWhenClosed:!1,showUnits:!1}),new n({el:".comments-button.theme-speech-bubble-x-small",showUnits:!1}),new n({el:".comments-button.theme-speech-bubble-small",showUnits:!1}),new n({el:".comments-button.theme-speech-bubble-large",defaultText:"Write A Comment",hideWhenClosed:!0,hasAbTest:!0}),new n({el:".comments-button.theme-upshot",defaultText:"Comment"}),new n({el:".comments-button.theme-story-footer",defaultText:"Comment"})})}),define("article/story/views/related-combined-coverage/related-combined-coverage",["underscore/nyt","jquery/nyt","foundation/views/base-view"],function(e,t,i){"use strict";var n=i.extend({el:"#related-combined-coverage",events:{"click .show-all-button":"handleLoadAllClick"},handleLoadAllClick:function(){t("#story-menu-additional-set").removeClass("hidden"),t(".story-menu-options").addClass("hidden"),this.$el.find("#story-menu-additional-set li:first a:first").focus()}});return n}),define("article/story/instances/related-combined-coverage",["foundation/views/page-manager","article/story/views/related-combined-coverage/related-combined-coverage"],function(e,t){"use strict";e.getMeta("errorpage")||new t}),define("shared/ribbon/templates",["underscore/nyt"],function(_){var templates={};return templates.ad=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='
  • \n
    \n
    \n
  • ';return __p},templates.article=function(obj){var __t,__p="";Array.prototype.join;with(obj||{}){__p+='
  • \n\n
    \n
    \n';var image=article.getCrop("thumbStandard");__p+="\n",_.isEmpty(image)||hideImage||(__p+='\n
    \n\n
    \n',__p+=article.isSlideshow()||article.isPromoMediaTypeSlideshow()?'\n\nView Slideshow\n':article.isVideo()||article.isPromoMediaTypeVideo()?'\n\nPlay Video\n':'\n\n'+(null==(__t=image.typeName)?"":__t)+"\n",__p+="\n
    \n
    \n"),__p+="",""!==article.get("kicker")&&(__p+='\n

    '+(null==(__t=article.get("kicker"))?"":__t)+"

    \n"),__p+='

    '+(null==(__t=article.get("headline"))?"":__t)+"

    \n
    \n
    \n
    \n
  • "}return __p},templates.ribbonPageNavTip=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='
    \n
    \n
    \n
    \n

    New!

    \n

    Use your left and right arrow keys to browse articles.

    ';return __p},templates.ribbonPageNavigation=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",__p+=hasData?'\n
    \n'),__p+='\n
    \n',kicker&&(__p+='\n

    '+(null==(__t=kicker)?"":__t)+"

    \n"),__p+='\n

    '+(null==(__t=title)?"":__t)+'

    \n
    \n\n
    \nGo to the '+(null==(__t=direction)?"":__t)+' story\n
    \n
    \n
    \n';return __p},templates.storyCollection=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
  • \n',collectionLabel.title&&(__p+='\n\n"),__p+='\n
      \n'+(null==(__t=storyCollection)?"":__t)+"\n
    \n
  • ";return __p},templates}),define("shared/data/models/article",["underscore/nyt","backbone/nyt","foundation/views/page-manager"],function(e,t,i){"use strict";var n=t.Model.extend({defaults:{title:"",kicker:"",pubdate:"",link:"",media:[{caption:"","media-metadata":[{url:""}]}],promotional_media:[{image:{image_crops:{}}}],processed:!1},initialize:function(){var e=this.get("promotional_media");!e.type&&e.data_type&&(e.type=e.data_type,this.set("promotional_media",e)),this.adjustKicker()},adjustKicker:function(){this.isOpinion()&&this.get("authors")&&this.set("kicker",this.get("authors")[0])},isOpinion:function(){return"Op-Ed Columnist"===this.get("kicker")||"Opinionator"===this.get("kicker")},getCrop:function(e){var t=this.get("promotional_media"),i="",n="image";try{if(t.type&&"image"!==t.type){switch(n=t.type){case"video":i="Play Video";break;case"slideshow":i="View Slideshow";break;case"interactive":i="View Interactive";break;default:i="View Media"}t=t.promotional_media}return t.image.image_crops[e].type=n,t.image.image_crops[e].typeName=i,t.image.image_crops[e]}catch(s){return{}}},getLink:function(){var e;return i.flag("anchorsHttps")?(e=this.get("link"),e.replace(/^http:/,"https:")):this.get("link")},getType:function(){var e="";return this.get("type")?e=this.get("type"):this.get("item_type")&&(e=this.get("item_type")),e.toLowerCase()},isVideo:function(){return"video"===this.getType()},isSlideshow:function(){var e=this.getType();return"imageslideshow"===e||"slideshow"===e},isPromoMediaTypeSlideshow:function(){var e=this.get("promotional_media");return"slideshow"===e.type},isPromoMediaTypeVideo:function(){var e=this.get("promotional_media");return"video"===e.type},getVideoKicker:function(){return this.get("kicker")?this.get("kicker"):this.get("section")},createDateObject:function(e){var t,i,n=new Date(e);return n.getDate()||e.search(/\d+T\d+/)>=0&&(t=e.split("T")[0],i=t.split("-"),n=new Date(i[0],i[1]-1,i[2])),n},getFormattedDate:function(e){var t,i=["Jan.","Feb.","March","April","May","June","July","Aug.","Sept.","Oct.","Nov.","Dec."];return e=e||this.get("pubDate"),t=this.createDateObject(e),i[t.getMonth()]+" "+t.getDate()+", "+t.getFullYear()},getDatetime:function(e){var t;return e=e||this.get("pubDate"),t=this.createDateObject(e),t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()}});return n}),define("shared/data/helpers/collection-mixin",[],function(){"use strict";var e={hasFetched:!1,getNext:function(e,t){var i=e.indexOf(t),n=i===e.length?0:i+1;return e.at(n)},loadData:function(){var e=this;return 0!==this.length||this.hasFetched||(this.hasFetched=!0,this.fetch({success:function(){e.trigger("fetchSuccess")},error:function(){e.trigger("fetchError")}})),this},getIdentifier:function(){return"rref="+this.sectionId},getName:function(){return this.sectionName},getUrl:function(){return this.sectionUrl}};return e}),define("shared/data/collections/trending-pages",["underscore/nyt","backbone/nyt","foundation/collections/base-collection","foundation/hosts","foundation/views/page-manager","shared/data/models/article","shared/data/helpers/collection-mixin"],function(e,t,i,n,s,a,o){"use strict";var r=i.extend(e.extend({},o,{model:a,url:n.s1Host+"/du/trending/top_pages.json",sync:function(e,i,n){return n.dataType="json",n.cache=!0,t.sync(e,i,n)},parse:function(t){var i,n=t.top_pages;return this.last_updated=t.updated_ts,e.map(n,function(e){e.link=e.url,s.flag("anchorsHttps")&&(i=e.url,e.link=i.replace(/^http:/,"https:"))}),n},getIdentifier:function(){return"src=trending"}}));return r}),define("shared/data/instances/trending-pages",["shared/data/collections/trending-pages"],function(e){"use strict";return new e}),define("shared/data/collections/recommendations",["backbone/nyt","foundation/collections/base-collection","shared/data/models/article","foundation/hosts","underscore/nyt","shared/data/helpers/collection-mixin"],function(e,t,i,n,s,a){"use strict";var o=t.extend(s.extend({},a,{model:i,url:n.personalizationHost+"/svc/recommendations/v3/personalized.json",location:null,initialize:function(){this.pageManager.flag("PersonalizationApiUpdate")&&(this.url=n.recommendationApiHost+"/svc/recommendations/v4/personalized.json")},sync:function(t,i,n){var s;return s=this.location?this.location:this.pageManager.getApplicationName(),n.cache=!0,n.data={access_key:"776ACB1E-6C7F-4702-9E18-CF329376F5A3",location:s},n.xhrFields={withCredentials:!0},e.sync(t,i,n)},parse:function(e){var t=this,i=s.map(e.suggestions,function(e){var i=e.thumbs||{};return e.promotional_media={image:{image_crops:{thumbStandard:e.thumbnail,mediumThreeByTwo210:t.getCrop(i,"mediumThreeByTwo210")}}},e.kicker&&"Video"===e.item_type&&(e.kicker="Video | "+e.kicker),e.byline?e.authors=[e.byline.replace("By ","").replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})]:e.authors="",e.description=e["abstract"],e.link=e.url,e.headline=e.title,e.pubDate=e.published_date,e});return this.num_articles=e.num_articles,this.uid=e.uid,this.user_displayname=e.user_displayname,this.user_pic_url=e.user_pic_url,i},getCount:function(){return this.num_articles||0},getUserId:function(){return this.uid||0},getUserDisplayName:function(){return this.user_displayname||null},getUserPictureUrl:function(){return this.user_pic_url||null},getCrop:function(e,t){var i,n;for(i=0,n=e.length;n>i;i+=1)if(e[i].type===t)return e[i].url=e[i].content,e[i]},getIdentifier:function(){return"src=recg"},setLocation:function(e){this.location=e}}));return o}),define("shared/data/instances/recommendations",["jquery/nyt","foundation/views/page-manager","shared/data/collections/recommendations"],function(e,t,i){"use strict";return new i}),define("shared/data/collections/context",["backbone/nyt","foundation/collections/base-collection","shared/data/models/article","underscore/nyt","shared/data/helpers/collection-mixin"],function(e,t,i,n,s){"use strict";var a=t.extend(n.extend({},s,{model:i,sync:function(t,i,n){var s,a=this.pageManager.getMeta("article:collection");return"Olympics"===this.pageManager.getMeta("article:section")&&(a=a.replace("/news-event/rio-olympics-2016","sports")),"Style"===this.pageManager.getMeta("article:section")&&(a=a.replace("style","fashion")),a?(n.url=a,n.dataType="jsonp",s=n.url.match(/sectionfronts\/(.+)\/index/)||["","homepage"],n.jsonpCallback="jsonFeedCallback_"+s[1].replace(/\/|\-/g,"_"),this.sectionId=s[1],e.sync(t,i,n)):null},parse:function(e){return this.sectionName=e.title.replace("NYT > ",""),this.sectionUrl=e.link,e.items}}));return a}),define("shared/data/instances/context",["jquery/nyt","foundation/views/page-manager","shared/data/collections/context"],function(e,t,i){"use strict";return new i}),define("shared/data/collections/top-news",["underscore/nyt","backbone/nyt","foundation/collections/base-collection","shared/data/models/article","foundation/hosts","shared/data/helpers/collection-mixin"],function(e,t,i,n,s,a){"use strict";var o=i.extend(e.extend({},a,{model:n,initialize:function(){this.url=s.staticHost+"/services/json/sectionfronts/index.jsonp"},sync:function(e,i,n){return n.dataType="jsonp",n.jsonpCallback="us"===this.pageManager.getEdition()?"jsonFeedCallback_homepage":"jsonFeedCallback_international",t.sync(e,i,n)},parse:function(e){var t;if(e.items[0]&&e.items[0].pubdate)for(t=0;t ",""),this.sectionUrl=e.link,e.items}}));return o}),define("shared/data/instances/section-origin",["jquery/nyt","foundation/views/page-manager","shared/data/collections/section-origin"],function(e,t,i){"use strict";return new i}),define("shared/data/collections/nyt-collection",["jquery/nyt","underscore/nyt","backbone/nyt","foundation/collections/base-collection","foundation/hosts","foundation/views/page-manager","shared/data/helpers/collection-mixin","shared/data/models/article"],function(e,t,i,n,s,a,o,r){"use strict";var l=n.extend(t.extend({},o,{model:r,url:s.ADDCollectionHost+"/svc/collections/v1/publish/"+s.wwwDomain,IDQuery:"",typeQuery:"",meta:"",type:"",relativeUrl:"",initialize:function(e,i){t.bindAll(this,"getName","getURL"),this.relativeUrl=i.relativeUrl?i.relativeUrl:"",this.url=this.url+this.relativeUrl},sync:function(e,t,n){return n.dataType="json",n.cache=!0,n.data={dom:s.wwwDomain},i.sync(e,t,n)},parse:function(e){var i,n,s,a;for(a=0;a0?e.thumbnail=n.mediumThreeByTwo210:e.thumbnail=n.thumbWide||""),"video"===e.data_type&&(e.kicker="Video"),e.link=e.url,e}),this.meta=e.papi.result,this.type=this.meta.data_type,i},formatPubDate:function(e,t){var i,n=new Date(e),s=n.getDate(),a=this.dateHelper.getMonthShortName(n.getMonth()),o=n.getFullYear();return i=t===!0?a+" "+s+", "+o:o+"-"+a+"-"+s},getIdentifier:function(){var e=["collection"];return e[1]=this.type,e[2]=this.getID(),"rref="+e.join("/")},getName:function(){return this.meta[this.type]&&this.meta[this.type].display_name?this.meta[this.type].display_name:""},getDescription:function(){return this.meta[this.type]&&this.meta[this.type].long_description?this.meta[this.type].long_description:""},getTagLine:function(){return this.meta[this.type]&&this.meta[this.type].tagline?this.meta[this.type].tagline:""},getURL:function(){if("column"===this.type){if(this.meta[this.type]&&this.meta[this.type].url)return this.meta[this.type].url;if(this.meta[this.type]&&this.meta[this.type].landing_page_url)return this.meta[this.type].landing_page_url}else if(this.meta.url)return this.meta.url;return""},getTone:function(){return this.meta.tone?this.meta.tone.toLowerCase():""},getID:function(){if("column"!=this.type){if(this.meta.data_name)return this.meta.data_name}else if(this.meta[this.type]&&this.meta[this.type].name)return this.meta[this.type].name;return""},getType:function(){return this.meta.data_type?this.meta.data_type:""},getAuthorImageAssetId:function(){var e=this.meta.authors[0];return e&&e.image&&e.image.data_id?e.image.data_id:""}}));return l}),define("shared/data/instances/nyt-collection",["jquery/nyt","foundation/views/page-manager","shared/data/collections/nyt-collection"],function(e,t,i){"use strict";return new i([],{typeQuery:t.getMeta("nyt-collection:type"),IDQuery:t.getMeta("nyt-collection:identifier"),relativeUrl:t.getMeta("nyt-collection:uri")})}),define("shared/ribbon/collections/ribbon",["backbone/nyt","underscore/nyt","foundation/collections/base-collection","shared/data/models/article","foundation/hosts","foundation/models/user-data","shared/data/instances/trending-pages","shared/data/instances/recommendations","shared/data/instances/context","shared/data/instances/top-news","shared/data/instances/section-origin","shared/data/instances/nyt-collection"],function(e,t,i,n,s,a,o,r,l,d,c,h){"use strict";var u=i.extend({url:function(){return t.isFunction(this.feedUrl)&&this.handleFeedAsFunction(this.feedUrl),this.feedUrl||""},model:n,initialize:function(e){t.bindAll(this,"getTrending","getContext","getTopNews","getRecommendations","getOrigin","getNytCollection"),this.collectionLabels=[],this.feedSource=[{nytCollection:this.getNytCollection},{origin:this.getOrigin},{context:this.getContext},{trending:this.getTrending},{homepage:this.getTopNews},{recommendations:this.getRecommendations},{world:s.staticHost+"/services/json/sectionfronts/world/index.jsonp"},{us:s.staticHost+"/services/json/sectionfronts/us/index.jsonp"},{business:s.staticHost+"/services/json/sectionfronts/business/index.jsonp"},{opinion:s.staticHost+"/services/json/sectionfronts/opinion/index.jsonp"},{technology:s.staticHost+"/services/json/sectionfronts/technology/index.jsonp"},{politics:s.staticHost+"/services/json/sectionfronts/politics/index.jsonp"},{sports:s.staticHost+"/services/json/sectionfronts/sports/index.jsonp"},{science:s.staticHost+"/services/json/sectionfronts/science/index.jsonp"},{health:s.staticHost+"/services/json/sectionfronts/health/index.jsonp"},{arts:s.staticHost+"/services/json/sectionfronts/arts/index.jsonp"},{style:s.staticHost+"/services/json/sectionfronts/fashion/index.jsonp"},{nyregion:s.staticHost+"/services/json/sectionfronts/nyregion/index.jsonp"}],this.currentArticleUrl=e.currentArticleUrl,this.originalLoadType="context",this.feedUrl=this.setFeedUrl(e.sectionFeedUrl),this.subscribe(this,"sync",this.setCurrentArticle)},loadData:function(){t.isFunction(this.feedUrl)?this.handleFeedAsFunction(this.feedUrl):this.fetch()},sync:function(t,i,n){var s=this.url().match(/sectionfronts\/(.+)\/index/)||["","homepage"];return n.dataType="jsonp",n.jsonpCallback="jsonFeedCallback_"+s[1].replace("/","_"),this.sectionId="rref="+s[1],e.sync(t,i,n)},setCurrentArticle:function(){var e=this;this.currentArticle=this.find(function(t){var i=t.get("link").replace(/^https?\:\/\//i,"//"),n=e.currentArticleUrl.replace(/^https?\:\/\//i,"//");return i===n})},parse:function(e){return this.prepCollection(e.items.slice(0,20),e.title.replace("NYT > ",""),e.link,"news")},getFeedSourceValue:function(e){var t,i;for(t=0,i=this.feedSource.length;i>t;t++)if(this.feedSource[t].hasOwnProperty(e))return this.feedSource[t][e]},removeFeedByKey:function(e){var i,n;for(i=0,n=this.feedSource.length;n>i;i++)if(t.keys(this.feedSource[i])[0]===e)return void this.feedSource.splice(i,1)},removeFeedByUrl:function(e){var i,n,s,a=this.createAnchor(e).pathname;for(i=0,n=this.feedSource.length;n>i;i++)if(s=t.values(this.feedSource[i])[0],!t.isFunction(s)&&s.indexOf(a)>-1)return void this.feedSource.splice(i,1)},createAnchor:function(e){var t=document.createElement("a");return t.href=e,t},isUrlForSection:function(e,t){var i=this.createAnchor(e).pathname,n=this.createAnchor(this.getFeedSourceValue(t)).pathname;return i===n},setFeedUrl:function(){var e,t,i,n,s=this,o=this.pageManager.getUrlParam("src")||"",r=this.pageManager.getUrlParam("rref"),l=h.IDQuery,d="origin";return r&&(n=decodeURIComponent(r).split("/")),n&&3===n.length&&n[2]===l?t="nytCollection":!l&&n&&"collection"===n[0]?(t="context",d="context"):r&&"homepage"!==r?(this.removeFeedByKey(r),t="origin"):""===this.pageManager.getUrlParam("hp")||"homepage"===r?t="homepage":this.pageManager.getUrlParam("ref")?(e=this.createAnchor(document.referrer),/.nytimes.com$/.test(e.host)&&/^\/pages/.test(e.pathname)?t="origin":(t="context",d="context")):"trending"===o?t="trending":0===o.indexOf("rec")?t="recommendations":(t="context",d="context"),i=this.getFeedSourceValue(t),this.originalLoadType=d,l||this.removeFeedByKey("nytCollection"),this.removeFeedByKey("context"),this.removeFeedByKey("origin"),this.removeFeedByKey(t),a.ready(function(){a.isLoggedIn()||s.removeFeedByKey("recommendations")}),i},handleFeedAsFunction:function(e){var i=e();t.isArray(i)?(this[1===this.length?"reset":"add"](i.slice(0,20)),this.local(this,"sync"),this.local(this,"nyt:ribbon-custom-collection-loaded")):i()},loadFeed:function(){var e;return this.feedSource.length>0?(e=t.values(this.feedSource.shift())[0],t.isFunction(e)?this.handleFeedAsFunction(e):(this.feedUrl=e,this.fetch({remove:!1})),!0):!1},getAdModel:function(){return new n({processed:!1,isAd:!0})},prepCollection:function(e,t,i,n){var s,a,o=this.collectionLabels.length;for(s=0,a=e.length;a>s;s+=1)e[s].collectionId=o;return this.collectionLabels.push({title:t,url:i,type:n}),e},next:function(e){var t,i=this.indexOf(e);return t=i===this.length?0:i+1,this.local(this,"nyt:ribbon-collection-next",this.models[t]),this.models[t]},previous:function(e){var t,i=this.indexOf(e);return t=0===i?this.models.length:i-1,this.local(this,"nyt:ribbon-collection-previous",this.models[t]),this.models[t]},importCollection:function(e){var i,n=this,s=e.collection.toJSON();return s.length>0?(e.name=t.isFunction(e.name)?e.name():e.name,e.url=t.isFunction(e.url)?e.url():e.url,this.sectionId=e.collection.getIdentifier(),this.prepCollection(s,e.name,e.url,e.type)):(this.feedSource.unshift(e.callback),function(){var t=function(){window.clearTimeout(i),n.loadFeed()};i=window.setTimeout(function(){n.stopSubscribing(e.collection,"sync",t),n.feedSource.shift(),n.loadFeed()},1500),n.subscribeOnce(e.collection,"sync",t)})},getIdentifier:function(){return this.sectionId},getTrending:function(){return this.importCollection({collection:o.loadData(),name:"Trending",url:s.www+"/trending",type:"trending-pages",callback:{trending:this.getTrending}})},getNytCollection:function(){return this.importCollection({collection:h.loadData(),name:h.getName,url:h.getURL,type:"nytCollection",callback:{nytCollection:this.getNytCollection}})},getRecommendations:function(){return this.importCollection({collection:r.loadData(),name:"Recommended",url:s.www+"/recommendations",type:"news",callback:{recommendations:this.getRecommendations}})},getTopNews:function(){return this.importCollection({collection:d.loadData(),name:"Home Page",url:s.www,type:"news",callback:{homepage:this.getTopNews}})},getContext:function(){var e=this.pageManager.getMeta("article:collection")||"";return this.removeFeedByUrl(e),this.importCollection({collection:l.loadData(),name:l.getName(),url:l.getUrl(),type:"news",callback:{context:this.getContext}})},getOrigin:function(){return this.removeFeedByKey(this.pageManager.getUrlParam("ref")),this.importCollection({collection:c.loadData(),name:c.getName(),url:c.getUrl(),type:"news",callback:{origin:this.getOrigin}})}});return u}),define("shared/ribbon/instances/ribbon-data",["jquery/nyt","foundation/views/page-manager","shared/ribbon/collections/ribbon"],function(e,t,i){"use strict";var n=e('head link[rel="canonical"]').attr("href"),s=t.getMeta("article:collection");return new i({sectionFeedUrl:s,currentArticleUrl:n})}),define("shared/ribbon/views/helpers/mixin",["underscore/nyt","jquery/nyt"],function(e,t){"use strict";var i={collectionStoryWidth:249,getActiveModel:function(t){var i=this;return e.find(t,function(e){return e.get("link")===i.canonical})},getStoryIndex:function(t,i){var n;return i||(i=this.getActiveModel(t)),n=e.indexOf(t,i),n>=0?n:0},getAdIndex:function(e){var i,n,s=t("#ribbon"),a=this.pageManager.getUrlParam("ribbon-ad-idx");return a?i=a:this.pageManager.getCurrentBreakpoint()<=1e4?(0===e?i=n=this.storyUnitsInView():(n=Math.floor((s.width()-.25*this.collectionStoryWidth)/this.collectionStoryWidth),i=e+n),n>1&&(i-=1)):i=this.getLargeScreenAdPosition(e),i},getLargeScreenAdPosition:function(e){var i,n,s,a="ribbon"===this.$el.attr("id")?this.$el:t("#ribbon"),o=this.storyUnitsInView(a);return i=0===e?a.width():a.width()-.25*this.collectionStoryWidth,n=i%this.collectionStoryWidth>.25*this.collectionStoryWidth,s=n?o-1:o-2,s+=e},storyUnitsInView:function(e){return e||(e=this.$el),Math.floor((e.width()-.25*this.collectionStoryWidth)/this.collectionStoryWidth)},createAdsDeferral:function(e){this.pageManager.getMeta("ads_adNames")?e():(this.adxTimeout=window.setTimeout(e,500),this.subscribeOnce("nyt:ads-rendered",e))}};return i}),define("shared/ribbon/views/ribbon-page-navigation",["jquery/nyt","underscore/nyt","foundation/hosts","foundation/views/base-view","foundation/views/page-manager","shared/ribbon/instances/ribbon-data","shared/ribbon/templates","shared/modal/views/modal","foundation/models/page-storage","shared/ribbon/views/helpers/mixin"],function(e,t,i,n,s,a,o,r,l,d){"use strict";var c=n.registerView("arrows").extend(t.extend({},d,{el:"body",delay:200,speed:250,expandWidth:275,expanded:!1,events:{"click .ribbon-page-navigation":"changeArticle","mouseenter .ribbon-page-navigation":"showArticle","mouseleave .ribbon-page-navigation":"hideArticle","mouseleave #ribbon-page-navigation-modal .modal":"hideArticle"},nytEvents:{"nyt:comments-panel-opened":"hideRightArrow","nyt:comments-panel-closed":"showRightArrow","nyt:page-drag":"handlePageDrag"},initialize:function(){t.bindAll(this,"preventScroll","checkForFeed"),this.feed=a,this.subscribe("nyt:ads-fire-ribbon-interstitial",this.ribbonInterstitialFired),this.pageManager.isDomReady()?this.handlePageReady():this.subscribe("nyt:page-ready",this.handlePageReady),this.trackingBaseData={module:"ArrowsNav",contentCollection:this.pageManager.getMeta("article:section")}},handlePageReady:function(){this.restrict=this.pageManager.isComponentVisible(e("#ribbon")),this.createAdsDeferral(this.checkForFeed)},checkForFeed:function(){this.feed.length>1&&this.render(),this.subscribeOnce(a,"sync",this.render)},render:function(){var t=this.feed.currentArticle,i=this.feed.previous(t),n=this.feed.next(t);this.activeStoryIndex=this.getStoryIndex(this.feed.models,this.feed.currentArticle),this.$arrows=e(this.createTemplate("previous",i).trim()+this.createTemplate("next",n).trim()),this.$shell.append(this.$arrows),this.adjustArrows(),this.adjustText(),this.subscribe("nyt:page-resize",this.adjustArrows),this.subscribe("nyt:ribbon-visiblility",this.restrictArrow),this.subscribe("nyt:ribbon-left",this.handleKeyboardLeftArrow),this.subscribe("nyt:ribbon-right",this.handleKeyboardRightArrow),(this.pageManager.isMobile()||this.pageManager.$html.hasClass("has-cover-media"))&&this.$arrows.hide()},adjustArrows:function(){var e=(this.pageManager.getCurrentBreakpoint(),this.$arrows.filter(".previous")),t=this.$arrows.filter(".next");this.cssControl||(e.css("left",""),t.css("right",""),this.cssControl=!0)},adjustText:function(){var t,i,n,s;this.$arrows.each(function(a,o){n=e(o),i=n.find(".story"),t=n.find(".story .summary"),s=parseInt(i.css("padding-top"),10),i.css({display:"block",opacity:0}),t.css("margin-top",n.height()/2-t.height()/2-s),i.css({display:"none",opacity:1})})},restrictArrow:function(e){this.restrict=e},previousPage:function(){var e=this.$arrows.filter(".previous"),t=e.data("href");t&&(window.location=t)},nextPage:function(){var e=this.$arrows.filter(".next"),t=e.data("href");t&&(window.location=t)},createTemplate:function(e,i){var n,s,a,r={direction:e,display:"none",hasData:!1,title:"",image:"",link:"",kicker:"",shouldQueueAd:!1};return i&&(t.indexOf(this.pageManager.getMeta("ads_adNames"),"Ribbon")>=0&&(a=this.getAdIndex(this.activeStoryIndex),n=a-t.indexOf(this.feed.models,i),s="previous"===e&&1===n||"next"===e&&0===n),r={direction:e,display:"block",hasData:!0,title:i.get("headline")||i.get("title"),image:i.getCrop("thumbStandard"),link:this.processLink(i.get("link"),a),kicker:i.get("kicker"),shouldQueueAd:s}),o.ribbonPageNavigation(r)},processLink:function(e,t){var n=document.createElement("a");return n.href=e,0===n.hostname.indexOf("www")&&0===window.location.hostname.indexOf("www")&&(e=0===n.pathname.indexOf("/")?i.www+n.pathname:i.www+"/"+n.pathname),t&&(e+="?ribbon-ad-idx="+t),e+=/\?/.test(e)?"&":"?",e+=this.feed.getIdentifier(),n.search.length>0&&(e+=n.search.replace("?","&")),e},changeArticle:function(t){var i,n;t.preventDefault(),i=e(t.currentTarget),n=this.trackingAppendParams(i.data("href"),{action:"click",region:i.is(".next")?"FixedRight":"FixedLeft"}),this.fireQueuedAd(i)!==!0&&(window.location=n)},fireQueuedAd:function(t){var i=t.data("queue-ad"),n=e(".ribbon-ad");return e("#ribbon").find(".collection-item").removeClass("active"),i!==!0?!1:(n.find("> iframe").length>0?(this.broadcast("nyt:ad-library:dfp:ribbon-interstitial"),t.data("queue-ad",!1)):window.location=n.find("#ribbonAdBodytxt").attr("href"),!0)},ribbonInterstitialFired:function(){this.pageManager.isMobile()&&this.$arrows.show()},preventScroll:function(e){this.scrollLock=!0,e.preventDefault()},handlePageDrag:function(e,t){var i,n,s,a,o=this.expandWidth,r=0,l=this.pageManager.getMeta("mediaviewer_isVisible")||!1;return!l&&e.gesture&&this.$arrows?(a=1.5*e.gesture.distance-20,this.scrollLock||this.$document.on("touchmove",this.preventScroll),"left"===e.gesture.direction?n=this.$arrows.filter(".next"):"right"===e.gesture.direction&&(n=this.$arrows.filter(".previous")),!n||!n.data("href")||e.gesture.distance<20?(this.$arrows.hide(),this.$document.off("touchmove",this.preventScroll),void(this.scrollLock=!1)):void("right"===t||"left"===t?(a=o>a?a:o,a=a>r?a:r,i=100>a?"hide":"show",n.show().css("width",a+"px").find(".story")[i](),this.truncateArticleSummary(n)):n&&"end"===t?(n.width()t&&(this.truncateText(e.find(".story-heading"),t),i.css("margin-top",e.find(".story-heading").height()/2-t/2))},hideArticle:function(t){var i=this,n=e("#ribbon-page-navigation-modal").find(".modal"),s=e(n.is(t.currentTarget)?".ribbon-page-navigation.next":t.currentTarget);clearTimeout(this.timeout),!this.expanded||n.has(t.relatedTarget).length>0||(s.animate({width:i.origWidth},{duration:this.speed,complete:function(){s.css("width","")}}).find(".story").hide(),this.expanded=!1)},showRightArrow:function(){this.$arrows&&this.$arrows.filter(".next").show()},hideRightArrow:function(){this.$arrows&&this.$arrows.filter(".next").hide()},addToolTip:function(){var e,t=this,i=new r({id:"ribbon-page-navigation-modal",modalContent:o.ribbonPageNavTip(),binding:".ribbon-page-navigation.next",tailDirection:"right",canOpenOnHover:!0,width:"322px",mouseEnterDelay:500,tailTopOffset:-5,tailLeftOffset:9,closeOnMouseOut:!0,openCallback:function(){l.set("ribbon_hasViewedTooltip",!0),e=window.setTimeout(i.close,2e4),t.subscribeOnce("nyt:page-scroll",i.close)},closeCallback:function(){i.removeFromPage(),window.clearTimeout(e)}});i.addToPage()}}));return c}),define("shared/ribbon/views/ribbon",["jquery/nyt","underscore/nyt","foundation/hosts","foundation/views/base-view","shared/ribbon/templates","shared/ribbon/views/ribbon-page-navigation","shared/ribbon/instances/ribbon-data","shared/ribbon/views/helpers/mixin","shared/data/instances/nyt-collection"],function(e,t,i,n,s,a,o,r,l){"use strict";var d=n.registerView("ribbon").extend(t.extend({},r,{el:"#ribbon",collection:o,template:s.storyCollection,articleTemplate:s.article,adTemplate:s.ad,isRibbonVisible:!1,isRibbonPermenant:!1,firstLoad:!0,toggleDisabled:0,oldScrollTop:0,animationDistance:100,minDownDistance:100,minUpDistance:300,speed:200,zIndexMasthead:1000000090,zIndexRibbon:1000000030,seenMoveFurniture:!1,hammerSettings:{drag_block_vertical:!0,swipe_velocity:.7,drag_min_distance:3},events:{"click .collection-menu li a":"handleArticleClick","click .ribbon-navigation-container .next":"handleNextArrow","click .ribbon-navigation-container .previous":"handlePreviousArrow",mouseenter:"handleRibbonMouseEnter",mouseleave:"handleRibbonMouseOut",touch:"handleTouch",tap:"handleArticleClick",hold:"handleTouchHold",dragstart:"handleTouchDragStart",drag:"handleRibbonDrag",swipe:"handleRibbonSwipe"},nytEvents:{"nyt:page-resize":"resizeRibbon","nyt:messaging-critical-alerts-move-furniture":"moveRibbonForAlerts","nyt:messaging-suggestions-move-furniture":"moveRibbonForAlerts","nyt:messaging-message-critical-alerts-closed":"enableRibbonToggle","nyt:messaging-message-suggestions-closed":"enableRibbonToggle","nyt:comments-panel-opened":"disableRibbonToggle","nyt:comments-panel-closed":"enableRibbonToggle","nyt:masthead-absolute":"disableRibbonToggle","nyt:masthead-fixed":"enableRibbonToggle"},initialize:function(){t.bindAll(this,"handleMouseMove","handleArticleClick","handleRibbonAdClick","hideCollectionMarkers","pollHiddenCollections","pollShowingTabs","revertRibbon","handleRibbonSwipe","handleRibbonDrag","handleTouch","handleTouchHold","handleTouchDragStart","applyTranslateToRibbon","assignListenersAndLoad"),this.isDesktop=this.pageManager.isDesktop(),this.canonical=this.pageManager.getCanonical(),this.trackingBaseData={module:"Ribbon",version:this.collection.originalLoadType,region:"Header"},this.listenToOnce(this.collection,"sync",t.bind(function(){this.trackingTriggerImpression("ribbon-first-load",{eventName:"impression",action:"impression",contentCollection:this.collection.collectionLabels[0].title})},this))},handleDomReady:function(){this.$loader=this.$(".ribbon-loader"),this.$html.addClass("has-ribbon"),this.ribbonMarginTop=parseInt(this.$el.css("margin-top"),10),this.ribbonMarginBottom=parseInt(this.$el.css("margin-bottom"),10),this.ribbonHeight=this.$el.height(),this.mastheadHeight=e("#masthead").height()-3,this.toggleDisabled=0,this.$ribbonMenu=this.$el.find(".ribbon-menu"),this.$ribbonNavigation=this.$el.find(".ribbon-navigation-container"),this.$previousArrow=this.$ribbonNavigation.find(".previous"),this.$nextArrow=this.$ribbonNavigation.find(".next"),this.isRibbonVisible=this.pageManager.isComponentVisible(this.$el),this.handleFixedRibbon(),this.listenTo(this.pageManager,"nyt:page-scroll",this.handleScroll),this.createAdsDeferral(this.assignListenersAndLoad)},assignListenersAndLoad:function(){window.clearTimeout(this.adxTimeout),this.stopSubscribing("nyt:ads-rendered",this.assignListenersAndLoad),this.listenTo(this.collection,"sync",this.render),this.listenToOnce(this.collection,"sync",this.renderFurniture),this.listenTo(this.collection,"nyt:ribbon-custom-collection-loaded",this.render),this.collection.loadData(),new a},render:function(){var i,n,s,a,o,r,l,d,c=this,h=this.collectionStoryWidth+this.animationDistance,u=t.indexOf(this.pageManager.getMeta("ads_adNames"),"Ribbon")>=0;i=this.collection.where({processed:!1}),0!==i.length&&((u||this.pageManager.getUrlParam("ribbon-ad-idx"))&&this.firstLoad===!0&&(r=this.returnRibbonAdData(i,u),o=r.index,r.model&&i.splice(r.index,0,r.model)),n=this.collection.collectionLabels[i[0].get("collectionId")],n&&(s=e(this.template({storyCollection:this.createStoryCollection(i,o,n),collectionLabel:n})),a=this.collection.length*h+this.$loader.width()+this.collection.collectionLabels.length,this.$ribbonMenu.css("width",a),this.$loader.before(s),(this.firstLoad&&!this.referredFromArticle()||!this.firstLoad)&&this.animateRibbonStories(s),l=this.$el.find("#Ribbon"),l.length>0&&this.firstLoad===!0&&this.subscribe("nyt:ad-library:dfp:ribbon-ad-visible",function(e){d=e.find("> a"),d.length&&d.attr("href",d.attr("href")+"?"+this.collection.getIdentifier()),0===e.find(".ribbonAdPaid").length&&c.assignHandlerToIframeClick(e.find("iframe"),c.handleRibbonAdClick)}),this.assignSyncedHtmlToView(),this.updateCollectionValues(),this.firstLoad=!1,this.broadcast("nyt:ribbon-rendered"),this.dealWithLateAlertMovement()))},dealWithLateAlertMovement:function(){var t=parseInt(e("#critical-alerts").height(),10);t&&t>0&&!this.seenMoveFurniture&&this.moveRibbonForAlerts(function(e){e.animate({marginTop:t-2},200)})},createStoryCollection:function(e,i,n){var s,a,o,r=this,d="",c=n.type,h=r.canonical.replace(/^https?\:\/\//i,"");return"nytCollection"===c&&(a=l.getAuthorImageAssetId()),t.each(e,function(e,n,l){var u,m,g=[],p=e.get("link"),f=r.processLink(p,i),v=e.get("kicker");s=!1,t.isObject(v)&&e.set("kicker",v.name),-1!==p.indexOf(h)&&r.firstLoad&&g.push("active"),n===l.length-1&&g.push("last-collection-item"),u=g.join(" "),e.get("isAd")!==!0?("nytCollection"===c&&(o=e.get("promotional_media"),o&&o.data_id&&(m=o.data_id,m===a&&(s=!0))),d+=r.articleTemplate({article:e,classString:u,newLink:f,hideImage:s})):d+=r.adTemplate(),e.set("processed",!0)}),d},processLink:function(e,t){var n=document.createElement("a"),s=this.collection.getIdentifier();return n.href=e,0===n.hostname.indexOf("www")&&0===window.location.hostname.indexOf("www")&&(e=0===n.pathname.indexOf("/")?i.www+n.pathname:i.www+"/"+n.pathname),t&&(e+="?ribbon-ad-idx="+t),e+=/\?/.test(e)?"&":"?",e+=s,n.search.length>0&&(e+=n.search.replace("?","&")),e},assignHandlerToIframeClick:function(e,t){var i,n;e.length&&(i=e.get(0),n=i.contentDocument||i.contentWindow.document,"undefined"!=typeof n.addEventListener?n.addEventListener("click",t,!1):"undefined"!=typeof n.attachEvent&&n.attachEvent("onclick",t))},returnRibbonAdData:function(e,t){var i,n,s=null;return n=this.getStoryIndex(e),i=this.getAdIndex(n),t&&(s=this.collection.getAdModel()),{index:i,model:s}},referredFromArticle:function(){var e,t=document.createElement("a");return document.referrer?(t.href=document.referrer,e=t.pathname,t.hostname.indexOf("nytimes.com")>-1&&/^(\/\w+)?\/\d+/.test(e)):!1},renderFurniture:function(){var e=-this.$el.find(".active").index();this.ribbonAnimation(e,!0),this.testForCollectionEnd()&&this.collection.loadFeed(),Modernizr.touch?this.assignCustomEasing():this.collectionMarkerTimeout=setTimeout(this.hideCollectionMarkers,2e3)},assignCustomEasing:function(){return e.easing.easeOutCirc=function(e,t,i,n,s){return n*Math.sqrt(1-(t=t/s-1)*t)+i},this},matrixToArray:function(e){return e.substr(7,e.length-8).split(", ")},returnXForTransform:function(){var e=this.$ribbonMenu.css("-webkit-transform");return"none"===e?this.$ribbonMenu.position().left:parseInt(this.matrixToArray(e)[4],10)},applyTranslateToRibbon:function(e){var t;return isNaN(e)?void 0:(t="translate3d("+e+"px, 0, 0)",this.$ribbonMenu.css({transform:t,"-webkit-transform":t,msTransform:t}))},handleRibbonDrag:function(e){var t,i,n,s,a=!1,o=this.returnXForTransform();e.gesture&&(e.gesture.preventDefault(),t=this.startDragLocation-o,i=0===t?e.gesture.deltaX:e.gesture.deltaX+t,s=this.handleRibbonEdges(o+i),n=this.testForCollectionEnd(this.startDragLocation),a||this.applyTranslateToRibbon(s),this.testForCollectionEnd()&&!n&&this.collection.loadFeed(),e.gesture.deltaX<0?this.pollShowingTabs():this.pollHiddenCollections())},returnStartingXForTransform:function(){var e=this.$ribbonMenu.css("transform");return"none"===e?this.$ribbonMenu.position().left:parseInt(this.matrixToArray(e)[4],10)},handleRibbonSwipe:function(e){var i,n,s,a,o,r,l=this,d=2e3,c=!1;e.gesture.preventDefault(),n=1+e.gesture.distance/l.$el.width(),s=e.gesture.deltaX*n,o=d/e.gesture.velocityX,a=l.handleRibbonEdges(l.returnXForTransform()+s),c&&(a=-this.$ribbonMenu.width()+this.$el.width()),r=t.throttle(function(){"left"===e.gesture.direction?l.pollShowingTabs():l.pollHiddenCollections()}),i={duration:o,easing:"easeOutCirc",step:l.applyTranslateToRibbon,progress:r,always:function(){l.testForCollectionEnd(a)&&l.collection.loadFeed(),r()}},this.animateSwipe(a,i)},handleTouch:function(e){e.gesture.preventDefault()},handleTouchHold:function(){this.stopSwipeAnimation()},handleTouchDragStart:function(){this.stopSwipeAnimation(),this.startDragLocation=this.returnXForTransform()},stopSwipeAnimation:function(){this.$swipeAnimationElement&&this.$swipeAnimationElement.stop()},handleRibbonMouseEnter:function(){Modernizr.touch||"undefined"==typeof this.$ribbonMenu||(this.$el.on("mousemove",this.handleMouseMove),clearTimeout(this.collectionMarkerTimeout),this.$collectionMarkers&&this.$collectionMarkers.fadeIn(150),this.$firstCollectionMarker&&this.$firstCollectionMarker.fadeIn(150))},handleMouseMove:t.throttle(function(e){this.checkForActiveNavigation(e.clientX,e.clientY)}),handleRibbonMouseOut:function(){Modernizr.touch||(this.$el.off("mousemove",this.handleMouseMove),this.hideRibbonArrows(),this.hideCollectionMarkers())},handleNextArrow:function(t){e(t.currentTarget).hasClass("inactive")||(this.trackingTrigger("ribbon-page-right",{eventName:"ScrollRight",contentCollection:this.getSectionInView(),action:"click"}),this.$previousArrow.removeClass("inactive"),this.shiftRibbonLeft())},handlePreviousArrow:function(t){e(t.currentTarget).hasClass("inactive")||(this.trackingTrigger("ribbon-page-left",{eventName:"ScrollLeft",contentCollection:this.getSectionInView(),action:"click"}),this.$nextArrow.removeClass("inactive"),this.shiftRibbonRight())},handleRibbonAdClick:function(e){var t;t=this.$el.find(".ribbon-ad-container"),this.animateRibbon(t),this.broadcast("nyt:ad-library:dfp:ribbon-interstitial",e)},animateRibbon:function(e){var t,i,n;return i=Modernizr.touch?-1*this.returnXForTransform():e.offset().left,t=-1*Math.floor(i/this.collectionStoryWidth),n=this.ribbonAnimation(t)},handleArticleClick:function(t){var i,n,s,a,o,r,l,d=e(t.target),c=d.parents("li.collection-item");c.length>0?(s=c.find("> a, #Ribbon > a"),a=s.attr("href"),a=this.trackingAppendParams(a,{action:"click",contentCollection:this.getCollectionByArticleElement(c)}),t.metaKey!==!0&&t.ctrlKey!==!0?(t.preventDefault(),this.$el.find(".collection-item").removeClass("active"),c.addClass("active"),"tap"===t.type?(r=.25*this.collectionStoryWidth-c.offset().left,l=this.returnXForTransform()+r,n=this.animateSwipe(l)):(o=c.offset().left,i=Math.floor(o/this.collectionStoryWidth),n=this.ribbonAnimation(-i)),n.done(function(){window.location.href=a})):s.attr("href",a)):d.parents(".collection-marker").length>0&&(window.location.href=t.target.href)},handleScroll:function(){var e=this.pageManager.getViewport().top;this.toggleRibbon(e),this.checkRibbonVisibility()},hideCollectionMarkers:function(){this.$collectionMarkers&&this.$collectionMarkers.fadeOut(200),this.$firstCollectionMarker&&this.$firstCollectionMarker.fadeOut(200)},slideCollectionMarkers:function(){var e=this.$firstCollectionMarker.outerWidth(),t=this.$el.find(".first-collection-marker"); return t.eq(0).animate({marginLeft:-e},100).promise()},pollHiddenCollections:function(){var t,i,n,s=this,a=this.$collectionMarkers.filter(".past-left-border");a.each(function(a,o){i=e(o),t=i.offset().left,t-(s.$el.offset().left+1)>.25*s.collectionStoryWidth&&(i.removeClass("past-left-border"),n=i.closest(".collection").prev().find(".collection-marker"),s.createFirstCollectionMarker(n,!0),s.$firstCollectionMarker.last().remove(),s.$firstCollectionMarker=s.$el.find(".first-collection-marker"))})},pollShowingTabs:function(){var t=this,i=this.$collectionMarkers.not(".past-left-border");i.each(function(i,n){t.testForNewMarker(e(n))})},testForNewMarker:function(e){var t,i=this,n=this.$firstCollectionMarker;e.offset().left-(i.$el.offset().left+1)<=.25*this.collectionStoryWidth&&(this.createFirstCollectionMarker(e),t=this.slideCollectionMarkers(),t.done(function(){n.remove(),i.$firstCollectionMarker=i.$el.find(".first-collection-marker")}))},createFirstCollectionMarker:function(e,t){var i=e.clone().addClass("first-collection-marker");return t===!0?(i.removeClass("past-left-border"),this.$firstCollectionMarker.before(i)):(e.addClass("past-left-border"),i.appendTo(this.$el)),e},ribbonAnimation:function(e,i){var n,s,a,o=this,r=this.$ribbonMenu.position()?this.$ribbonMenu.position().left:0;return 0===r&&(r=.25*this.collectionStoryWidth),n=r+e*this.collectionStoryWidth,n=this.handleRibbonEdges(n),a=this.checkArrowsAgainstRibbonBoundaries(n),a&&r-this.$el.width()e?o.pollShowingTabs():o.pollHiddenCollections()},75),this.$ribbonMenu.stop().animate({left:n},{step:s}).promise())},animateSwipe:function(t,i){var n=this;return i||(i={step:this.applyTranslateToRibbon}),this.stopSwipeAnimation(),this.$swipeAnimationElement=e({animateDummyProperty:n.returnXForTransform()}),this.$swipeAnimationElement.animate({animateDummyProperty:t},i).promise()},checkArrowsAgainstRibbonBoundaries:function(e){return e===this.$el.width()-this.getCollectionsWidth()?(this.$nextArrow.addClass("inactive"),!0):e-this.collectionStoryWidth0&&(e=0),this.testForCollectionEnd(e)&&0===this.collection.feedSource.length&&(e=this.$el.width()-this.getCollectionsWidth()),this.$el.toggleClass("ribbon-start",0===e),e},shiftRibbonRight:function(){var e=this,t=this.storyUnitsInView(),i=e.ribbonAnimation(t);i.done(function(){e.pollHiddenCollections(),e.broadcast("nyt:ribbon-animation-finished")})},shiftRibbonLeft:function(){var e=this,t=this.storyUnitsInView(),i=this.ribbonAnimation(-t);i.done(function(){e.testForCollectionEnd()&&e.collection.loadFeed(),e.pollShowingTabs(),e.broadcast("nyt:ribbon-animation-finished")})},assignSyncedHtmlToView:function(){this.$collectionMarkers=this.$ribbonMenu.find(".collection-marker"),0===this.$el.find(".first-collection-marker").length&&this.createFirstCollectionMarker(this.$collectionMarkers.eq(0)),this.$firstCollectionMarker=this.$el.find(".first-collection-marker").eq(0)},updateCollectionValues:function(){var t=this;this.$ribbonMenu.find(".story").each(function(){var i=e(this),n=i.find(".story-heading");t.truncateText(n,i.find(".kicker").length?48:64),n.toggleClass("long-story-heading",n.height()>48)})},checkForActiveNavigation:function(e){var t,i=this.$el.width(),n=Math.ceil(.4*i),s=Math.ceil(.6*i),a=n>=e,o=e>=s;a?t={left:"10px",right:"auto"}:o&&(t={left:"auto",right:"10px"}),a||o?(this.$ribbonNavigation.css(t),this.showRibbonArrows()):this.hideRibbonArrows()},resizeRibbon:function(){this.$el.css("width",this.getWidth()),this.toggleDisabled||(this.checkRibbonVisibility(),this.handleFixedRibbon())},getWidth:function(){var e=parseInt(this.$el.css("margin-left"),10);return this.$shell.width()-e},showRibbonArrows:function(){this.$ribbonNavigation.fadeIn(300)},hideRibbonArrows:function(){this.$ribbonNavigation&&this.$ribbonNavigation.fadeOut(300)},getCollectionsWidth:function(){return this.collection.length*this.collectionStoryWidth},moveRibbonForAlerts:function(e){this.seenMoveFurniture=!0,this.disableRibbonToggle(),this.isRibbonPermenant=!1,e(this.$el)},disableRibbonToggle:function(){this.toggleDisabled=1,this.revertRibbon()},enableRibbonToggle:function(){this.toggleDisabled=0},handleFixedRibbon:function(){var e=this.pageManager.getViewport().height;"interactive"===this.pageManager.getApplicationName()&&this.pageManager.getViewport().width<765||(800>e?(this.enableRibbonToggle(),this.isRibbonPermenant=!1,this.pageManager.getViewport().top>=100&&this.slideRibbonUp()):(this.isRibbonPermenant=!0,this.makeRibbonFixed()))},animateRibbonStories:function(t){var i=200,n=t.find(".active").index();n=0>n?0:n,t.find(".collection-item").slice(n).css({opacity:0,"margin-left":this.animationDistance}).each(function(){i+=200,e(this).animate({opacity:1,"margin-left":0},i)})},checkRibbonVisibility:function(){var e=this.pageManager.isComponentVisible(this.$el);e!==this.isRibbonVisible&&(this.isRibbonVisible=e,this.broadcast("nyt:ribbon-visiblility",e))},revertRibbon:function(){this.$html.hasClass("viewport-landscape")&&this.pageManager.getViewport().top<=0&&this.$el.css("top","0"),this.ribbonFixed&&(this.ribbonFixed=!1,this.$shell.css("padding-top",""),this.$el.stop(!0).css({position:"","margin-top":"",width:"",top:"","z-index":"",transform:"translateZ(0)"}))},slideRibbonDown:function(){var e;e=this.mastheadHeight,this.makeRibbonFixed(),this.$el.stop(!0).animate({top:e},this.speed)},makeRibbonFixed:function(){var e=this.ribbonHeight+this.ribbonMarginTop+this.ribbonMarginBottom;this.ribbonFixed=!0,this.pageManager.cachedViewport.width<765?this.$shell.css("padding-top",this.mastheadHeight):this.$shell.css("padding-top",e+this.mastheadHeight),this.$el.stop(!0).css({position:"fixed","margin-top":0,width:this.getWidth(),top:this.mastheadHeight,"z-index":this.zIndexRibbon}),this.broadcast("nyt:ribbon-visiblility",!0)},slideRibbonUp:function(){this.$el.stop(!0).css({"z-index":this.zIndexRibbon}).animate({top:-this.ribbonHeight},this.speed,this.revertRibbon)},toggleRibbon:function(e){var t=0>=e,i=e>this.oldScrollTop,n=e0)){if(i&&this.ribbonFixed){if(s0&&!i.getUrlParam("disable_ribbon")&&new n)}),define("shared/masthead/templates",["underscore/nyt"],function(_){var templates={};return templates.profileIcon=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='\n\n';return __p},templates.userName=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.userNameModalContent=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.userNameModalTitle=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",""!=userData.getImageUrl()&&(__p+='\n\n'),__p+='\n\n'+(null==(__t=userData.getUserName())?"":__t)+'\n'+(null==(__t=subscription.label)?"":__t)+"\n";return __p},templates.userSettingsModal=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='\n\n',showTypeSizer&&(__p+='\n\n'),__p+="";return __p},templates}),define("shared/masthead/views/masthead",["jquery/nyt","underscore/nyt","foundation/views/base-view","foundation/models/user-data","shared/masthead/templates"],function(e,t,i,n,s){"use strict";var a=i.registerView("masthead").extend({el:"#masthead",events:{"click .home-button":"handleHomeClick","click .search-button":"handleSearchClick","click .sections-button":"handleSectionsClick","click .branding a":"handleLogoClick","click .story-meta .nyt-logo":"handleLeftLogoClick","click .editions-menu a":"handleEditionClick","click .login-button":"handleLogInClick","click .subscribe-button":"handleSubscribeClick"},nytEvents:{"nyt:ribbon-visiblility":"accomodateRibbon","nyt:masthead-search-toggle":"handleSearchToggle","nyt:messaging-critical-alerts-move-furniture":"handlePageAlerts","nyt:messaging-suggestions-move-furniture":"handlePageAlerts","nyt:messaging-notification-count-update":"handleMessagingCountChange","nyt:masthead-edition-change":"handleEditionClick"},initialize:function(){this.trackingBaseData={action:"click",contentCollection:this.pageManager.getMeta("article:section"),region:"TopBar"}},handleUserReady:function(){var e=this.$el.find(".user-tools-button-group");n.isLoggedIn()?e.prepend(s.userName(n)):(this.pageManager.hasAdBlock().done(function(){e.find(".subscribe-button").removeClass("hidden")}),e.find(".login-button").removeClass("hidden"))},accomodateRibbon:function(e){e?(this.$el.addClass("ribbon-visible"),this.$el.find(".update-text").css("display","inline-block")):(this.$el.find(".update-text").css("display","none"),this.$el.removeClass("ribbon-visible"))},handlePageAlerts:function(e){e(this.$el)},handleHomeClick:function(t){var i,n;i=e(t.currentTarget).closest(".home-button"),n=this.trackingAppendParams(i.data("href"),{module:"HomePage-Button"}),window.location=n},handleSearchClick:function(e){this.broadcast("nyt:masthead-search-click",e),this.trackingTrigger("masthead-search-click",{module:"SearchOpen",eventName:"OpenSearchBar"})},handleSectionsClick:function(e){this.broadcast("nyt:masthead-section-click",e)},handleLogoClick:function(t){var i,n;i=e(t.currentTarget),n=this.trackingAppendParams(i.attr("href"),{module:"HomePage-Title"}),i.attr("href",n)},handleLeftLogoClick:function(t){var i,n;i=e(t.currentTarget).parent("a"),n=this.trackingAppendParams(i.attr("href"),{module:"HomePage-Left-Title"}),i.attr("href",n)},handleSearchToggle:function(e){this.$el.find(".search-button")[e?"addClass":"removeClass"]("active")},handleMessagingCountChange:function(e){var t=this.$el.find(".notifications-button"),i=e.count>99?"99+":e.count;t.find(".button-text").html(i),e.delta>0?(t.addClass("has-notifications animate-notifications"),setTimeout(function(){t.removeClass("animate-notifications")},2e3)):0===e.count&&t.removeClass("has-notifications")},handleEditionClick:function(t){var i=e(t.target),n=i.data("edition"),s=i.attr("href"),a="";switch(this.pageManager.setEdition(n),n){case"us":a="EditionToggleToUS";break;case"global":a="EditionToggleToGlobal";break;case"chinese":a="EditionToggleToCHNS";break;case"spanish":a="EditionToggleToSpanish"}s=this.trackingAppendParams(s,{module:a}),i.attr("href",s)},handleLogInClick:function(){var e="masthead-login";this.trackingTrigger("masthead-login-click",{module:"LogIn","WT.nav":"shell"}),this.trackingTrigger("tagx-auth-interaction",{module:e,state:n.isLoggedIn()?"logged in":"logged out",eventName:"login click | "+e})},handleSubscribeClick:function(t){var i,n;i=e(t.currentTarget).closest(".subscribe-button"),n=this.trackingAppendParams(i.data("href"),{module:"Subscribe-Now"}),window.location=n}});return a}),define("shared/masthead/views/masthead-api",["jquery/nyt","foundation/views/base-view"],function(e,t){"use strict";var i=t.extend({el:"#masthead",position:"fixed",inStory:!1,nytEvents:{"nyt:ad-library:adx:ad-rendered":"handleAdRendered"},initialize:function(){this.$container=e(".container"),this.$ribbon=e(".ribbon"),this.inStoryHeight=this.$el.height()},hide:function(){this.$el.hide(),this.$ribbon.addClass("no-masthead")},show:function(){this.$el.show(),this.$ribbon.removeClass("no-masthead")},getElement:function(){return this.$el},swap:function(e){this.$el.find(".container").hide(),e&&(this.$emptyMasthead||(this.$el.append('
    '),this.$emptyMasthead=this.$el.find(".empty-masthead")),this.$emptyMasthead.html(e))},restore:function(){this.$el.find(".container").show(),this.$el.find(".empty-masthead").remove(),this.$emptyMasthead=!1,this.$el.removeAttr("style"),this.$ribbon.css("margin-top","").removeClass("no-masthead"),this.$container.css("min-height",""),this.inStoryHeight=this.$el.height()},setHeight:function(e){if(!e||"number"!=typeof e)throw new Error("Masthead API - setHeight requires a number as an argument");this.inStoryHeight=e,this.$el.css("height",e),this.$container.css("min-height",e),this.$ribbon.css("margin-top",e),"absolute"===this.$el.css("position")&&this.$el.css("margin-top",-e)},setPosition:function(e){if("fixed"===e)this.$el.css({position:"fixed","margin-top":"0"}),this.broadcast("nyt:masthead-fixed");else{if("absolute"!==e)throw new Error('Masthead API - setPosition only accepts "absolute" or "fixed" as arguments');this.$el.css({position:"absolute","margin-top":-this.inStoryHeight+1,right:0,width:"auto"}),this.$ribbon.addClass("no-masthead"),this.broadcast("nyt:masthead-absolute")}},set:function(e){if(!e||"object"!=typeof e)throw new Error("Masthead API - set method requires an object as an argument");e.height&&this.setHeight(e.height),e.position&&this.setPosition(e.position),e.content&&this.swap(e.content),e.change&&this.change(e.change)},change:function(e){var t=this;if(!e||"function"!=typeof e)throw new Error("Masthead API - change method requires a function as an argument");this.subscribe("nyt:masthead-storytheme",function(i){t.inStory=i,e(i)})},isInStory:function(){return this.inStory},renderedAds:[],handleAdRendered:function(e){this.renderedAds.push(e)},returnRenderedAds:function(){return this.renderedAds}});return i}),define("shared/masthead/instances/masthead-api",["shared/masthead/views/masthead-api"],function(e){"use strict";return new e}),define("shared/masthead/views/in-story-theme",["jquery/nyt","underscore/nyt","foundation/views/base-view","foundation/views/page-manager","foundation/models/user-data","shared/masthead/instances/masthead-api"],function(e,t,i,n,s,a){"use strict";var o=i.extend(t.extend({},a,{el:"#masthead",events:{"click .kicker":"scrollToTop","click .kicker-label a":"handleSectionClick","click #nyt-button-sub":"trackSubscribeClick","click #subscribe_small":"trackSubscribeClick"},nytEvents:{"nyt:page-scroll":"toggleTheme","nyt:page-scroll-after":"setSwitchPosition","nyt:page-resize":"handleResize","nyt:page-breakpoint":"handleBreakPoint","nyt:masthead-switch-change":"handleSwitchChange","nyt:masthead-position-change":"handlePositionChange"},defaultSettings:{themeClass:"in-content",switchPosition:0,shouldScrollAway:!1,currentBreakPoint:n.getCurrentBreakpoint(),metaContainer:".story-meta",contentSelector:"#story",contentSwitchPointSelector:".story-meta .kicker"},initialize:function(e){this.settings=t.extend({},this.defaultSettings,e),this.viewportSmall=100,this.viewportMedium10=1010},handleDomReady:function(){this.isTransparent()?this.setSwitchOverrides("#story .story-body-text",!0):this.$switchSelector=e("#story").find(".story-meta .kicker"),this.$pageContainer=this.$el.find(".container"),this.$mastheadKicker=this.$el.find(".kicker"),this.setSwitchPosition(),this.toggleTheme(),this.checkAdsRendered(this.returnRenderedAds())},handleSwitchChange:function(e,t){this.setSwitchOverrides(e,t)},handlePositionChange:function(e){this.settings.shouldScrollAway=e||!1,e||this.$el.css("position","fixed"),this.toggleTheme()},handleResize:function(){n.isDomReady()&&(this.isTransparent()?this.setSwitchOverrides("#story .story-body-text",!0):this.$switchSelector=e("#story").find(".story-meta .kicker"),this.moveMastheadKicker(),this.bar1IsRendered?this.fixedNavSubscribe():this.checkAdsRendered(this.returnRenderedAds()),this.settings.currentBreakPoint0&&(this.settings.switchPosition=this.$switchSelector.offset().top-this.$el.height()),e===!0&&(this.settings.overridePosition=this.settings.switchPosition)},toggleTheme:function(){var e,t,i,s,a,o=this.settings.overridePosition||100;this.settings.switchPositionthis.settings.switchPosition,i=e>o,s=this.$el.hasClass(this.settings.themeClass),a="nyt:masthead-storytheme",t&&!s&&this.settings.currentBreakPoint>=this.viewportSmall?(this.settings.shouldScrollAway===!0&&this.$el.css("position","fixed"),this.$el.find(".sections-button").hasClass("mobile-navigation-active")||this.addStoryTheme(),this.removeSmallCommentButton(),this.broadcast(a,!0)):!i&&s?(this.settings.shouldScrollAway===!0&&this.$el.css("position","absolute"),this.removeStoryTheme(),this.removeExtraSmallCommentButton(),this.broadcast(a,!1)):s||this.settings.shouldScrollAway!==!0||this.$el.css("position","absolute")},addStoryTheme:function(){this.isTransparent()||this.$el.find(".branding").fadeOut(300).end().addClass(this.settings.themeClass),this.$el.find(".comments-button").removeClass("theme-speech-bubble-x-small").addClass("theme-speech-bubble-small"),this.settings.currentBreakPoint>=this.viewportMedium10&&this.$el.find(this.settings.metaContainer).fadeIn(300),this.$el.addClass(this.settings.themeClass),this.moveMastheadKicker(),this.bar1IsRendered?this.fixedNavSubscribe():this.checkAdsRendered(this.returnRenderedAds())},removeStoryTheme:function(){this.isTransparent()||this.$el.find(".branding").stop(!1,!0).show().end().removeClass(this.settings.themeClass),this.$el.find(".comments-button").removeClass("theme-speech-bubble-small").addClass("theme-speech-bubble-x-small"),this.settings.currentBreakPoint>=this.viewportMedium10&&this.$el.find(this.settings.metaContainer).stop().hide(),this.bar1IsRendered?this.fixedNavSubscribe():this.checkAdsRendered(this.returnRenderedAds()),this.$el.removeClass(this.settings.themeClass)},fixedNavSubscribe:function(){var e=this.$el.find("#nyt-button-sub").children();this.userNotSub&&(this.$el.hasClass(this.settings.themeClass)&&this.$el.not(".fixed-nav-subscribe")&&(this.trackSubscribeImpressionOnce(),this.$el.addClass("fixed-nav-subscribe")),this.pageManager.getViewport().width>=this.viewportMedium10&&this.$el.hasClass(this.settings.themeClass)?this.$el.find("#nyt-button-sub").html("Subscribe").append(e):this.pageManager.getViewport().width>=this.viewportMedium10&&!this.$el.hasClass(this.settings.themeClass)&&this.$el.find("#nyt-button-sub").html("SUBSCRIBE NOW").append(e))},trackSubscribeImpressionOnce:function(){this.trackedImpression||this.trackingTriggerImpression("fixed-nav-subscribe",{module:"fixed-nav-subscribe",action:"impression"}),this.trackedImpression=!0},trackSubscribeClick:function(){this.trackingTriggerRaw("fixed-nav-subscribe",{module:"fixed-nav-subscribe",action:"click",eventName:"subscribe"},"interaction")},removeSmallCommentButton:function(){this.isTransparent()&&this.$el.find(".theme-speech-bubble-small .button-meta").remove()},removeExtraSmallCommentButton:function(){this.isTransparent()&&this.$el.find(".theme-speech-bubble-x-small .icon").remove()},moveMastheadKicker:function(){var e;this.$mastheadKicker&&"collection"!==this.pageManager.getApplicationName()&&(e=this.$pageContainer.width()-1375,this.settings.currentBreakPoint>=10050&&this.settings.currentBreakPoint<10070&&e>0?this.$mastheadKicker.css({"margin-left":Math.floor(e/2)+"px"}):this.settings.currentBreakPoint>=10070?this.$mastheadKicker.css("margin-left","138px"):this.settings.currentBreakPoint<10050&&this.$mastheadKicker.css("margin-left","0px"))},scrollToTop:function(t){var i=e(t.target);i.is("a")||i.parent().is("a")||e("html, body").animate({scrollTop:0},400)},handleBreakPoint:function(e){this.settings.currentBreakPoint=e},isTransparent:function(){return this.$el.is(".masthead-theme-transparent, .masthead-theme-transparent-ffffff")},handleSectionClick:function(t){var i=e(t.currentTarget),n=this.trackingAppendParams(i.attr("href"),{module:"SF-FixedNav",action:"click",contentCollection:this.pageManager.getMeta("article:section"),region:"TopBar"});i.attr("href",n)}}));return o}),define("shared/searchform/models/search-suggest",["foundation/models/base-model"],function(e){"use strict";var t=e.extend({defaults:{query:"",results:[]}});return t}),define("shared/searchform/collections/search-suggest",["backbone/nyt","foundation/collections/base-collection","foundation/views/page-manager","shared/searchform/models/search-suggest","foundation/hosts"],function(e,t,i,n,s){"use strict";var a=t.extend({model:n,mobileBaseUrl:s.mobileWeb,desktopBaseUrl:s.www,settings:{numOfSuggestions:7},query:"",sync:function(t,i,n){var s="/svc/suggest/v1/homepage?query="+this.query;return this.pageManager.getCurrentBreakpoint()<120?n.url=this.mobileBaseUrl+s:n.url=this.desktopBaseUrl+s,e.sync(t,i,n)},parse:function(e){return{query:e[0],results:e[1].slice(0,this.settings.numOfSuggestions)}},newQuery:function(e){this.query=e,this.fetch()}});return a}),define("shared/searchform/templates",["underscore/nyt"],function(_){var templates={};return templates.autoSuggest=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
  • \n'+(null==(__t=suggest.replace(queryRegExp,""+query+""))?"":__t)+"\n
  • ";return __p},templates}),define("shared/searchform/helpers/search-form-mixin",["jquery/nyt","underscore/nyt","foundation/lib/polyfills/placeholder","shared/searchform/collections/search-suggest","shared/searchform/templates","foundation/hosts"],function(e,t,i,n,s,a){"use strict";var o=t.extend({},{collection:new n,searchBaseUrl:a.search+"/search/sitesearch/#/",searchMobileUrl:a.mobileWeb+"/search?query=",KEYS:{ENTER:13,ESC:27,UP_ARROW:38,DOWN_ARROW:40,LEFT_ARROW:37,RIGHT_ARROW:39},initialize:function(){var e=this.pageManager.getMeta("article:section")||"";t.bindAll(this,"handlePageClicks"),this.trackingBaseData={action:"click",contentCollection:e,region:"TopBar"}},handleDomReady:function(){this.$list=this.$el.find(".auto-suggest"),this.$clearButton=this.$el.find(".clear-button"),this.$overlay=this.$shell.find(".search-overlay"),this.$input=this.$el.find(".search-input"),this.$submitButton=this.$el.find(".submit-button"),this.disableSubmitButton(),this.listenTo(this.collection,"sync change",this.render),this.throttledSuggestions=t.debounce(this.getAutoSuggestions,250),this.afterInitialize()},afterInitialize:e.noop,render:function(){var e,t="",i=this.collection.toJSON()[0],n=new RegExp(i.query,"ig"),a=s.autoSuggest,o=i.results.length;if(o>0&&this.getSearchValue().length>0){for(e=0;o>e;e+=1)t+=a({query:i.query,queryUrl:this.getSearchUrl(i.results[e]),suggest:i.results[e],queryRegExp:n});this.$list.show().find("ol").html(t)}else this.$list.hide()},handleKeyDown:function(e){var t=e.which;t===this.KEYS.ENTER&&e.preventDefault()},handleKeyUp:function(e){var t=e.which;e.preventDefault(),t===this.KEYS.UP_ARROW||t===this.KEYS.DOWN_ARROW?this.navigateAutoSuggestions(t):t===this.KEYS.ENTER?this.handleEnterKey(e):t===this.KEYS.RIGHT_ARROW||t===this.KEYS.LEFT_ARROW?this.handleRightLeftKey(e):(this.$clearButton[this.getSearchValue().length>0?"fadeIn":"fadeOut"](200),this.getSearchValue().length?this.$submitButton.hasClass("disabled")&&this.$submitButton.removeClass("disabled"):this.disableSubmitButton(),this.throttledSuggestions())},handleEnterKey:function(){this.submitSearch()},handleRightLeftKey:e.noop,handleClearButton:function(e){e.preventDefault(),this.setSearchValue(""),this.$clearButton.fadeOut(200),this.disableSubmitButton(),this.$input.focus(),i()},setSearchValue:function(e){this.$input.val(e)},getSearchValue:function(){return e.trim(this.$input.val())},hideAutoSuggest:function(){this.$list.hide()},getAutoSuggestions:function(){var e=this.getSearchValue();e.length>1?this.collection.newQuery(e):this.hideAutoSuggest()},getSearchUrl:function(e){return this.pageManager.getCurrentBreakpoint()<120?this.searchMobileUrl+e+"&sort=rel":this.searchBaseUrl+e},navigateAutoSuggestions:function(e){var t,i;i=this.$list.find(".active"),t=i.parent().index()||0,t+=e===this.KEYS.UP_ARROW?-1:1,this.$list.find("a").removeClass("active").eq(t).addClass("active"),this.setSearchValue(this.$list.find("a").eq(t).text())},submitSearch:function(e){var t,i=this.getSearchValue();e&&e.preventDefault(),i&&(t=this.trackingAppendParams(this.getSearchUrl(i),{module:"SearchSubmit"}),this.$el.is(":visible")&&(window.location=t))},handlePageClicks:function(){this.hideAutoSuggest()},disableSubmitButton:function(){this.$submitButton.addClass("disabled")}});return o}),define("shared/masthead/views/search",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/searchform/helpers/search-form-mixin"],function(e,t,i,n){"use strict";var s=i.extend(t.extend({},n,{el:e("#masthead").find(".search-flyout-panel"),events:{"click .close-button":"close","keyup .search-input":"handleKeyUp","keydown .search-input":"handleKeyDown","click .submit-button":"submitSearch","click .clear-button":"handleClearButton"},nytEvents:{"nyt:masthead-search-click":"toggle","nyt:masthead-search-toggle":"handleSearchToggle","nyt:navigation-search-click":"toggle","nyt:search-close-ready":"close"},slideTiming:100,afterInitialize:function(){this.trackingBaseData["WT.nav"]="searchWidget",this.$input.removeAttr("placeholder")},open:function(){var e=this;this.$el.slideDown(this.slideTiming,function(){e.$el.find(".control").fadeIn(e.slideTiming).end().find(".search-input").val("").focus()}),this.broadcast("nyt:masthead-search-toggle",!0),this.$shell.on("click",this.handlePageClicks),this.subscribeOnce("nyt:page-key-esc",this.close),this.$overlay.fadeIn(200),this.$html.addClass("search-active")},close:function(){var e=this;this.$html.hasClass("search-active")&&(this.$el.find(".control").fadeOut(this.slideTiming,function(){e.$el.slideUp(e.slideTiming,function(){e.$html.removeClass("search-active")})}),this.broadcast("nyt:masthead-search-toggle",!1),this.$shell.off("click",this.handlePageClicks),this.setSearchValue(""),this.$overlay.fadeOut(200))},toggle:function(){this[this.$el.is(":visible")?"close":"open"]()},isSearchButton:function(t){var i=e(t).hasClass("search-button"),n=1===e(t).parents(".search-button").length;return i||n},isSearchFlyout:function(t){var i=e(t).hasClass("search-flyout-panel"),n=1===e(t).parents(".search-flyout-panel").length;return i||n},handlePageClicks:function(e){this.isSearchButton(e.target)||this.isSearchFlyout(e.target)||this.close(),this.hideAutoSuggest()},handleSearchToggle:function(e){e===!1&&(this.$el.find(".submit-button").addClass("disabled"),this.$el.find(".clear-button").hide())}}));return s}),define("shared/masthead/views/user-settings-modal",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/modal/views/modal","shared/masthead/templates"],function(e,t,i,n,s){"use strict";var a=i.extend({events:{"click .edition-menu a":"handleEditionClick","click .type-sizer-menu li":"handleFontSizeClick","click .help-menu a":"handleHelpMenuClick"},nytEvents:{"nyt:fontsizer-initialize":"handleFontSizeChange","nyt:fontsizer-change":"handleFontSizeChange"},defaultSettings:{id:"user-settings-modal",binding:".user-settings-button",tailDirection:"up-right",tailTopOffset:-8,tailLeftOffset:-1,width:"260px",toggleSpeed:1,showTypeSizer:!0,internationalEditionFlag:!1,openCallback:function(){this.$target.addClass("active"),this.subscribeOnce("nyt:page-scroll",this.close)},closeCallback:function(){this.$target.removeClass("active")}},webTrendsNav:"user-settings-modalContainer",initialize:function(e){var i=this.pageManager.getMeta("article:section")||"";this.settings=t.extend({},this.defaultSettings,e),this.settings.modalContent=s.userSettingsModal({showTypeSizer:this.settings.showTypeSizer,internationalEditionFlag:this.pageManager.flag("removeInternationalEdition")}),this.trackingBaseData={action:"click",region:"TopBar","WT.nav":this.webTrendsNav,contentCollection:i}},handleDomReady:function(){this.render()},render:function(){var e=new n(this.settings);this.setElement(e.$modal), e.$modal.find("a[data-edition="+this.pageManager.getEdition()+"]").addClass("selected"),e.addToPage(),this.handleFontSizeChange()},handleEditionClick:function(e){this.broadcast("nyt:masthead-edition-change",e,{"WT.nav":this.webTrendsNav})},handleHelpMenuClick:function(t){var i=e(t.target),n=i.attr("href");n&&(n=this.trackingAppendParams(n,{}),i.attr("href",n))},handleFontSizeClick:function(t){var i=e(t.currentTarget).data("size");this.broadcast("nyt:fontsizer-change",i)},handleFontSizeChange:function(e){var t="type-size-selected";e=e||this.pageManager.getMeta("fontsizer_typeSize"),this.$el.find(".type-sizer-menu li").removeClass(t),this.$el.find(".type-sizer-"+e).addClass(t)}});return a}),define("shared/account/templates",["underscore/nyt"],function(_){var templates={};return templates.accountModalHeader=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.logInModalContent=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n'+(null==(__t=oauthButtons)?"":__t)+'\n
    \n
    \nOR\n
    \n';return __p},templates.loginModalFooter=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='

    Don’t have an account? Sign Up

    ';return __p},templates.oauthButtons=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='\n";return __p},templates.registrationModalContent=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n'+(null==(__t=oauthButtons)?"":__t)+'\n
    \n
    \nOR\n
    \n
    \n
    \n
    \n
    \n\n
    \n
    \n\n\n
    \n
    \n
    \n
    \n\n
    \n
    \n\n\n
    \n
    \n
    \n
    \n\n
    \n
    \n\n\n
    \n
    \n
    \n

    \nBy signing up, you agree to receive updates and special offers for The New York Times’s products and services. You may unsubscribe at any time.\n

    \n
    \n\n
    \n\n
    \n\n\n\n\n
    \n
    ';return __p},templates.registrationModalFooter=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.userProfileModalContent=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='";return __p},templates.userProfileModalHeader=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates}),define("shared/account/views/user-profile-modal",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/modal/views/modal","shared/account/templates"],function(e,t,i,n,s){"use strict";var a=i.extend({events:{"change #user-profile-avatar-input":"handleAvatarUpload","click .cancel-button":"handleCancelClick","click .save-button":"handleSaveClick","click .crop-button":"handleCropClick","submit #profile-form":"handleFormSubmit"},defaultSettings:{id:"user-profile-modal",addlClasses:"",headerContent:s.userProfileModalHeader(),modalTitle:"Edit Profile",modalContent:"",binding:".user-profile-button",tailDirection:"fixed",hasCloseButton:!0,hasOverlay:!0,cropBoundaries:{x1:0,y1:0,x2:0,y2:0},tailLeftOffset:-40,tailTopOffset:-40,cropperWidth:80,cropperHeight:80},initialize:function(e){var i=this;this.settings=t.extend({},this.defaultSettings,e),this.settings.openCallback=function(){i.model||require(["shared/community/instances/community-user"],function(e){i.model=e,i.model.isNew()?i.model.once("change",i.render,i):i.render(),i.model.on("avatarFailed",i.render,i)}),this.subscribeOnce(i,"nyt:profile-modal-close",this.close)},this.settings.modalContent=this.renderModalContent()},renderModalContent:function(){return s.userProfileModalContent({user:this.model?this.model:null})},handleUserReady:function(){var e=new n(this.settings);this.setElement(e.$modal),e.addToPage(),e.settings.closeCallback=this.render.bind(this),this.modal=e},render:function(){this.modal&&this.model&&this.modal.updateTemplate(this.renderModalContent())},handleCancelClick:function(e){e.preventDefault(),this.local(this,"nyt:profile-modal-close")},handleSaveClick:function(e){e.preventDefault(),this.model&&(this.model.setName(this.$el.find("#user-profile-name").val()),this.model.setLocation(this.$el.find("#user-profile-location").val()),this.model.setNotify(this.$el.find("#global-comment-notify-checkbox").is(":checked")),this.$(".save-button").addClass("disabled").attr("disabled","disabled"),this.model.once("sync",function(){this.local(this,"nyt:profile-modal-close")},this).save())},handleFormSubmit:function(e){e.preventDefault()},handleAvatarUpload:function(e){this.$(".user-profile-avatar-button").addClass("loading"),this.model&&e.target.files&&this.model.once("avatarUploaded",this.createCropper.bind(this)).addRawAvatar(e.target.files[0])},handleCropClick:function(t){var i=this;t.preventDefault(),e(t.target).addClass("disabled").attr("disabled","disabled"),this.model.once("avatarCropped",function(){i.render()}).cropRawAvatar(this.settings.cropBoundaries)},getCropBoundingBox:function(e,t){var i=Math.abs(parseInt(e.css("left"),10)),n=Math.abs(parseInt(e.css("top"),10)),s={};return s.x1=Math.ceil(i*t),s.y1=Math.ceil(n*t),s.x2=Math.ceil((i+this.settings.cropperWidth)*t),s.y2=Math.ceil((n+this.settings.cropperHeight)*t),s},createCropper:function(t){var i,n=this.$(".avatar-crop"),s=this;return e.fn.draggable?(this.$("#user-profile-form").addClass("avatar-editing"),void(i=e('').on("load",function(){var t,a=this.width>this.height?"avatar-horizontal":"avatar-vertical",o=this.width>this.height?"x":"y",r=this.naturalHeight/n.height();i.removeClass("avatar-horizontal avatar-vertical").addClass(a).css({left:"0px",top:"0px"}),n.empty().append(i),s.settings.cropBoundaries=s.getCropBoundingBox(i,r),t=e('
    ').prependTo(n).css({height:s.settings.cropperHeight+2*(this.height-s.settings.cropperHeight)+"px",width:s.settings.cropperWidth+2*(this.width-s.settings.cropperWidth)+"px",top:-1*(this.height-s.settings.cropperHeight)+"px",left:-1*(this.width-s.settings.cropperWidth)+"px"}),i.draggable({axis:o,containment:t,stop:function(){s.settings.cropBoundaries=s.getCropBoundingBox(i,r)},cursor:"move"})}))):void require(["foundation/lib/jquery/jquery.draggable/1.11.4"],function(){this.createCropper(t)}.bind(this))}});return a}),define("shared/masthead/views/user-name-modal",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/modal/views/modal","shared/masthead/templates","foundation/models/user-data","foundation/hosts","shared/account/views/user-profile-modal"],function(e,t,i,n,s,a,o,r){"use strict";var l=i.extend({events:{"click .premier-subscriber a":"handleUserSubscriptionClick","click li a":"handleUserOptionClick"},defaultSettings:{id:"user-name-modal",modalTitle:"",modalContent:"",binding:".user-name-button",tailDirection:"up-right",tailTopOffset:-8,tailLeftOffset:-1,width:"260px",toggleSpeed:1,openCallback:function(){this.$target.addClass("active"),this.listenToOnce(this.pageManager,"nyt:page-scroll",this.close)},closeCallback:function(){this.$target.removeClass("active")}},initialize:function(e){t.bindAll(this,"handleLogOut"),this.settings=t.extend({},this.defaultSettings,e),this.trackingBaseData={module:"ProfileDropdown",action:"click",region:"Masthead","WT.nav":"shell"}},handleUserReady:function(){var e,t=this.getSubscriptionLabel(a);this.settings.modalTitle=s.userNameModalTitle({userData:a,subscription:t}),this.settings.modalContent=s.userNameModalContent({userData:a,hosts:o}),new r,this.render(),e=this.$el.find(".user-subscription"),""===t.label&&e.remove(),""!==t.className&&e.addClass(t.className),""!==t.link&&e.find("a").attr("href",t.link),this.listenToOnce(a,"nyt:user-image-loaded",this.handleProfileImage),this.$el.on("click",".log-out-button",this.handleLogOut)},getSubscriptionLabel:function(e){var t={label:"",className:"",link:""};return e.isPremierSubscriber()?(t.label="Times Insider Subscriber",t.className="premier-subscriber",t.link="http://www.nytimes.com/section/insider"):e.isWebSubscriber()&&e.isMobileSubscriber()?t.label="All Digital Access Subscriber":e.isTabletSubscriber()&&e.isWebSubscriber()?t.label="Tablet and Web Subscriber":e.isSmartphoneSubscriber()&&e.isWebSubscriber()?t.label="Smartphone and Web Subscriber":e.isWebSubscriber()?t.label="Web Subscriber":e.isOpinionSubscriber()&&e.isCookingSubscriber()?t.label="NYT Opinion & Cooking Subscriber":e.isCookingSubscriber()?t.label="Cooking Subscriber":e.isOpinionSubscriber()?(t.label="NYT Opinion Subscriber",t.link="http://www.nytimes.com/content/help/mobile/nyt-opinion/nyt-opinion.html"):e.isCrosswordsSubscriber()&&(t.label="Crosswords Subscriber"),t},render:function(){var e=new n(this.settings);this.setElement(e.$modal),e.addToPage()},handleProfileImage:function(){var e=s.profileIcon({userData:a});this.$el.find(".modal-heading").prepend(e)},handleUserSubscriptionClick:function(t){var i=e(t.currentTarget),n=this.trackingAppendParams(i.attr("href"),{contentCollection:"TimesPremier-InsideStory"});i.attr("href",n)},handleUserOptionClick:function(t){var i=e(t.target),n=i.text(),s=i.attr("href"),a={action:"Click",region:"TopBar","WT.nav":"shell"};s&&(n&&(a.module=n.replace(/\s/g,"")),s=this.trackingAppendParams(s,a),i.attr("href",s))},handleLogOut:function(){var e="http:"+o.www+"/logout";e=this.trackingAppendParams(e,{module:"LogOut",action:"Click",region:"TopBar","WT.nav":"shell"}),this.trackingTrigger("tagx-auth-interaction",{module:"LogOut",state:a.isLoggedIn()?"logged in":"logged out",eventName:"logout click | LogOut"}),window.location=e}});return l}),define("shared/masthead/instances/masthead",["jquery/nyt","shared/masthead/views/masthead","shared/masthead/views/in-story-theme","shared/masthead/views/search","shared/masthead/views/user-settings-modal","shared/masthead/views/user-name-modal"],function(e,t,i,n,s,a){"use strict";new t,new n,new s({fixedOverride:!0,openCallback:function(){this.$target.addClass("active"),this.listenToOnce(this.pageManager,"nyt:masthead-storytheme",this.close)}}),new a({fixedOverride:!0,openCallback:function(){this.$target.addClass("active"),this.listenToOnce(this.pageManager,"nyt:masthead-storytheme",this.close)}}),e("#masthead .kicker").text().length>1&&new i}),define("shared/fontsizer/views/font-sizer",["jquery/nyt","underscore/nyt","foundation/views/base-view","foundation/models/page-storage"],function(e,t,i,n){"use strict";var s=i.extend({events:{doubletap:"handleDoubleTap"},nytEvents:{"nyt:fontsizer-change":"handleFontChange"},typeSizes:["small","medium","large"],typePrefix:"type-size-",settingsKey:"fontsizer_typeSize",handleLocalStorageReady:function(){var e=n.get(this.settingsKey)||(this.pageManager.isMobile()?"medium":"small");this.broadcast("nyt:fontsizer-initialize",e),this.setSize(e)},getSize:function(){return this.typeSizes[this.sizeIndex]},setSize:function(e){var i=t.indexOf(this.typeSizes,e);0>i||(n.set(this.settingsKey,e),this.pageManager.setMeta(this.settingsKey,e),this.sizeIndex=i,this.adjustTypeSize())},cycle:function(){var e=this.sizeIndex;e+=1,e===this.typeSizes.length&&(e=0),this.broadcast("nyt:fontsizer-change",this.typeSizes[e])},adjustTypeSize:function(){this.$html.removeClass(function(e,t){return(t.match(/\btype-size\S+/g)||[]).join(" ")}).addClass(this.typePrefix+this.getSize())},handleFontChange:function(e){this.setSize(e)},handleDoubleTap:function(){Modernizr.touch&&this.cycle()}});return s}),define("article/common/instances/font-sizer",["shared/fontsizer/views/font-sizer"],function(e){"use strict";new e({el:"#story"})}),define("shared/account/helpers/account-modal-mixin",["jquery/nyt","underscore/nyt","foundation/lib/polyfills/placeholder","shared/account/templates","foundation/hosts"],function(e,t,i,n,s){"use strict";var a={oauthProviders:["google","facebook"],handleFormSubmit:function(e){var t="abcdefghijklmnopqrstuvxyz",i=Math.round((new Date).getTime()/1e3)+60;this.$el.find("#account-form-token").val(t),this.$el.find("#account-form-expiration").val(i),this.$el.find("#login-remember").val(this.$el.find("#login-remember-checkbox").is(":checked")?1:0)},handleFormButton:function(){this.$el.find("form").submit()},handleKeyUp:function(t){var i=e(t.target);i.parent().find(".clear-button").toggle(""!==i.val())},handleClearButton:function(t){var n=e(t.currentTarget),s=n.parent().find("input");n.toggle(!1),s.val(""),i()},executeOauthLogin:function(t){t.preventDefault(),this.oauthPopup(e(t.currentTarget).data("providerName"))},addEvent:function(e,t,i){e.addEventListener?e.addEventListener(t,i,!1):e.attachEvent("on"+t,i)},getPageUrlParams:function(){var t,i=window.location,n={URI:i.protocol+"//"+i.hostname+"/"+i.pathname.replace(/^\//,"")};return i.search.length>1&&(t=i.search.substr(1),t=t.replace(/(\?|&)?gwh=([^&]+)/g,""),t=t.replace(/(\?|&)?gwt=([^&]+)/g,""),t=t.replace(/%/g,"Q"),n.OQ=t),e.param(n)},getSocialLinkUrl:function(e,t,i){return s.myaccount+"/oauth/"+t+"-link?type=login&URI="+e+(i?"&view=popup":"")+"&flow=HPLI"},oauthPopup:function(e){var i,n,s="oauthPopup",a=450,o=600;-1!==t.indexOf(this.oauthProviders,e)&&(n=["height="+o,"width="+a,"left="+(window.screen.availLeft+window.screen.width/2-a/2),"top="+Math.max(window.screen.height/2-o/2-20,0),"scrollbars=1"],i=window.open("about:blank",s,n.join(",")),i?(i=window.open(this.getSocialLinkUrl(document.URL,e,!0),s,n.join(",")),i.focus()):window.location.href=this.getSocialLinkUrl(document.URL,e))},renderOauthButtons:function(){return n.oauthButtons({facebookId:this.getFacebookButtonId(this.modalSettings.id),googleId:this.getGoogleButtonId(this.modalSettings.id),prefix:this.modalSettings.oauthButtonText})},addOauthEvents:function(e){this.$el.find("#"+this.getGoogleButtonId(e)+", #"+this.getFacebookButtonId(e)).on("click",t.bind(this.executeOauthLogin,this))},getFacebookButtonId:function(e){return"facebook-oauth-button-"+e},getGoogleButtonId:function(e){return"google-oauth-button-"+e}};return a}),define("shared/account/views/login-modal",["jquery/nyt","underscore/nyt","foundation/views/base-view","foundation/models/user-data","shared/modal/views/modal","shared/account/templates","foundation/hosts","shared/account/helpers/account-modal-mixin","foundation/lib/polyfills/placeholder"],function(e,t,i,n,s,a,o,r,l){"use strict";var d=i.extend(t.extend({},r,{state:n.isLoggedIn()?"logged in":"logged out",events:{"click .registration-modal-trigger":"handleRegisterClick","click #login-send-button":"handleFormButton","submit #login-form":"handleFormSubmit","click .clear-button":"handleClearButton","keyup .text":"handleKeyUp","click .oauth-button":"handleLoginModalClick","click .login-form":"handleLoginModalClick"},nytEvents:{"nyt:loginmodal-open":"handleOpen"},defaultSettings:{id:"login-modal",addlClasses:"account-modal",headerContent:a.accountModalHeader(),modalContent:"",modalFooter:a.loginModalFooter(),modalTitle:"Log in",moduleName:"LogIn",oauthButtonText:"Log in",binding:".login-modal-trigger",tailDirection:"fixed",hasCloseButton:!0,hasOverlay:!0,tailLeftOffset:-40,tailTopOffset:-40,regiSource:"nyt"},initialize:function(e){var i=this;this.modalSettings=t.extend({},this.defaultSettings,e),this.registrationPlatform=!1,this.modalSettings.modalContent=a.logInModalContent({oauthButtons:this.renderOauthButtons(),loginUrl:o.myaccount+"/auth/login?"+this.getPageUrlParams(),forgotPasswordUrl:o.myaccount+"/seg/forgot-password?EXIT_URI="+encodeURIComponent(window.location.href)}),this.modalSettings.openCallback=function(){var e=i.modalTitle||this.$target.data("modal-title")||"Log in",t=i.moduleName||"LogIn";i.hasPlaceholderSupport&&this.$modal.find(".login-email").focus(),this.$modal.find("#login-modal-modal-heading").text(e),this.$modal.find(".modal-subheading").toggleClass("hidden","Log in"!==e),this.$modal.find(".field-container input").val(""),i.modalTitle=null,this.trackingTrigger("tagx-auth-interaction",{module:t,state:i.state,eventName:"modal popup | "+t})},this.subscribe("nyt:modal-show-login-modal",l)},handleDomReady:function(){this.render()},render:function(){this.logInModal=new s(this.modalSettings).addToPage(),this.setElement(this.logInModal.$modal),this.local(this,"nyt:modal-login-modal-rendered"),this.addOauthEvents(this.modalSettings.id)},handleOpen:function(e){e&&e.modalTitle&&(this.modalTitle=e.modalTitle),e&&e.moduleName&&(this.moduleName=e.moduleName),e&&e.registrationPlatform&&(this.registrationPlatform=e.registrationPlatform,this.regiSource=e.regiSource),this.logInModal&&this.logInModal.open()},handleUserReady:function(){n.isLoggedIn()&&(this.logInModal?(this.logInModal.removeFromPage(),this.remove()):this.subscribeOnce(this,"nyt:modal-login-modal-rendered",this.handleUserReady))},handleRegisterClick:function(e){var t={};e.stopPropagation(),this.registrationPlatform&&(t.platformTracking=this.registrationPlatform,t.regiSource=this.regiSource,this.registrationPlatform=!1),this.logInModal.close(),this.broadcast("nyt:registrationmodal-open",t),this.trackingTrigger("loginmodal-register-click",{module:"Registration",action:"Click","WT.z_ract":"Regnow"}),this.trackingTrigger("tagx-auth-interaction",{module:"Registration",state:this.state,eventName:"modal click | Registration"})},handleLoginModalClick:function(){this.trackingTrigger("tagx-auth-interaction",{module:"LogIn",state:this.state,eventName:"modal click | LogIn"})}}));return d}),define("shared/account/views/registration-modal",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/modal/views/modal","shared/account/templates","foundation/hosts","shared/account/helpers/account-modal-mixin","foundation/lib/polyfills/placeholder"],function(e,t,i,n,s,a,o,r){"use strict";var l=i.extend(t.extend({},o,{events:{"click .login-modal-trigger":"handleLoginClick","click #register-send-button":"handleFormButton","submit #registration-form":"handleFormSubmit","click .clear-button":"handleClearButton","keyup .text":"handleKeyUp"},nytEvents:{"nyt:registrationmodal-open":"handleOpen"},defaultSettings:{id:"registration-modal",addlClasses:"account-modal",headerContent:s.accountModalHeader(),modalContent:"",modalFooter:s.registrationModalFooter(),modalTitle:"Sign up",oauthButtonText:"Sign up",binding:".registration-modal-trigger",tailDirection:"fixed",hasCloseButton:!0,hasOverlay:!0,tailLeftOffset:-40,tailTopOffset:-40,regiSource:"nyt"},initialize:function(i){var n=this;this.modalSettings=t.extend({},this.defaultSettings,i),this.platformTracking=!1,this.modalSettings.modalContent=s.registrationModalContent({oauthButtons:this.renderOauthButtons(),regiUrl:a.myaccount+"/register?"+this.getPageUrlParams()}),this.modalSettings.openCallback=function(){n.hasPlaceholderSupport&&this.$modal.find(".register-email").focus(),this.$modal.find(".field-container input").val(""),e("#account-form-platform").remove(),n.platformTracking&&(e("#registration-form").append('').append(''),n.platformTracking=!1)},this.subscribe("nyt:modal-show-registration-modal",r)},handleDomReady:function(){this.render()},render:function(){this.registrationModal=new n(this.modalSettings).addToPage(),this.setElement(this.registrationModal.$modal),this.addOauthEvents(this.modalSettings.id)},handleLoginClick:function(){this.registrationModal.close()},handleOpen:function(e){e&&e.platformTracking&&(this.platformTracking=e.platformTracking,this.regiSource=e.regiSource),this.registrationModal&&this.registrationModal.open()}}));return l}),define("shared/account/instances/account",["shared/account/views/login-modal","shared/account/views/registration-modal","foundation/models/user-data"],function(e,t,i){"use strict";i.isLoggedIn()||(new e,new t)}),define("shared/navigation/templates",["underscore/nyt"],function(_){var templates={};return templates.mainPanel=function(obj){var __t,__p="";Array.prototype.join;with(obj||{}){__p+='
    \n';var count=1;__p+="\n",_.each(level1,function(e){__p+='\n
    \n\n
    \n"}),__p+="\n
    "}return __p},templates.menuItem=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='";return __p},templates.mobileNav=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n

    Navigation Section

    \n\n\n
    \n
    \n

    Navigation Section

    \n\n\n
    \n
    \n

    Navigation Section

    \n\n\n
    \n
    \n

    Navigation Section

    \n\n\n
    \n
    \n

    Navigation Section

    \n\n
    \n
    \n

    Navigation Section

    \n\n
    \n';return __p},templates.navigationModalContent=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n'+(null==(__t=secondary)?"":__t)+'\n
    \n
    \n'+(null==(__t=tertiary)?"":__t)+"\n
    ";return __p},templates.secondaryPanel=function(obj){var __t,__p="";Array.prototype.join;with(obj||{}){__p+='
    \n
    \n
    \n
    \n';var count=1;__p+="",_.each(level2,function(e){__p+='\n
    \n\n
    \n"}),__p+="",_.each(level1,function(e){__p+='\n
    \n\n
    \n"}),__p+="
    "}return __p},templates.tertiaryPanel=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n
    \n
    \n',_.each(level3,function(e,t){__p+='\n\n"}),__p+="";return __p},templates}),define("shared/data/models/section",["backbone/nyt"],function(e){"use strict";var t=e.Model.extend({defaults:{name:"",edition:"",className:"",path:"",show_in_nav:!0,hasSubsections:!1,level:1,taxonomyId:""},getTaxonomyId:function(){return this.get("taxonomyId")},getParentId:function(){return this.get("parent")},getEdition:function(){var e=this.get("edition");return"global"===e?"international":e},hasChildren:function(){return this.get("hasSubsections")},getPath:function(){return this.get("path")},getLevel:function(){return this.get("level")}});return t}),define("shared/data/collections/taxonomy",["backbone/nyt","underscore/nyt","foundation/collections/base-collection","shared/data/models/section","foundation/hosts","foundation/models/user-data"],function(e,t,i,n,s){"use strict";var a=i.extend({url:s.staticHost+"/services/json/taxonomy/v2/flat.jsonp",model:n,sectionMarkers:["C5BFA7D5-359C-427B-90E6-6B7245A6CDD8","5C13EEDD-D905-4D8C-A284-6859EA434563","8FB1308A-FFE4-4BED-ADF6-659A680D0884","6101A43A-8BDE-45FF-AAD5-EF7396F83AC9","FED853D9-D192-46F6-8D18-447803EB4A7B"],initialize:function(){this.editionString="us"===this.pageManager.getEdition()?"domestic":"global",this.level1=[],this.level2=[],this.level3=[],this.fetch()},sync:function(t,i,n){return n.dataType="jsonp",n.jsonpCallback="jsonTaxonomyCallback",n.cache=!0,e.sync(t,i,n)},parse:function(i){var s,a,o,r=0,l=new e.Collection,d=t.map(i.elements,function(e){return e.taxonomyId=e.id,e.id=r++,e});for(l.model=n,l.reset(d),s=l.where({parent:null}),a=0,r=0,o=s.length;o>r;r+=1)t.indexOf(this.sectionMarkers,s[r].get("taxonomyId"))>=0&&(this.levelData(l,s.slice(a,r),0),a=r);return this.levelData(l,s.slice(a,s.length),0),this.level1.push([new n({name:"More",taxonomyId:"more-section",hasSubsections:!0})]),l.toJSON()},levelData:function(e,i,n){var s,a,o,r,l,d,c;if(t.isArray(i))for(this["level"+(n+1)].push(i),s=0,a=i.length;a>s;s+=1)this.levelData(e,i[s],n+1);else 3>n&&(c=e.where({taxonomyId:i.get("taxonomyId")}).length>1,o=e.where({parent:i.get("taxonomyId"),show_in_nav:!0}),c&&(o=t.uniq(o,function(e){return e.get("taxonomyId")}))),r=o&&o.length>0,i.set("className",i.get("name").replace(/[^a-zA-Z0-9]/g,"").toLowerCase()),i.set("hasSubsections",r),i.set("level",n),l=i.get("alternate_editions"),l&&l[this.editionString]&&(d=e.findWhere({taxonomyId:l[this.editionString]}),i.set("editionName",d.get("name")),i.set("editionPath",d.get("path"))),r&&this.levelData(e,o,n)},getPrimarySections:function(){return this.level1},getSecondarySections:function(){return this.level2},getTertiarySections:function(){return this.level3},getSectionByKeyword:function(e){return this.find(function(t){var i=t.get("path")||"";return i.indexOf("/"+e+"/index.html")>0})}});return a}),define("shared/data/instances/taxonomy",["shared/data/collections/taxonomy"],function(e){"use strict";return new e}),define("shared/navigation/views/navigation",["module","jquery/nyt","underscore/nyt","foundation/views/base-view","foundation/views/page-manager","foundation/hosts","foundation/models/user-data","shared/modal/views/modal","shared/navigation/templates","shared/data/instances/taxonomy"],function(e,t,i,n,s,a,o,r,l,d){"use strict";var c=n.registerView("navigation").extend({module:e,el:"#navigation",navTemplate:l.navigation,modalTemplate:l.navigationModalContent,events:{mouseleave:"delayedClose",mouseenter:"cancelDelayedClose","mouseenter li a":"tryPrimaryHover","mouseleave li a.expandable":"delayedModalClose","click li a":"activatePrimaryItem","click .menu a[href]":"handlePrimaryNavigationClick"},nytEvents:{"nyt:masthead-section-click":"toggle","nyt:navigation-toggle-ready":"toggle","nyt:navigation-edge-click":"open","nyt:navigation-edge-mouse-enter":"delayedOpen","nyt:navigation-edge-mouse-leave":"cancelDelayedOpen","nyt:messaging-critical-alerts-move-furniture":"moveNav","nyt:messaging-suggestions-move-furniture":"moveNav","nyt:a11y-enabled":"enableA11Nav","nyt:a11y-disabled":"disableA11yNav"},defaultSettings:{panelwidth:210,navTimeout:500,navAnimation:150,hoverTimeout:500,intentRangeLower:10,intentRangeUpper:170,maxMouseLocs:2,a11yEnabled:!1},modalSettings:{id:"navigation-modal",modalTitle:"",modalContent:"",tailDirection:"left-top",closeOnClick:!1,fixedOverride:!0,autoPosition:!0,positionTailSide:!0,toggleSpeed:1},mouseLocs:[],navIds:{REAL_ESTATE:"navId-92720057-BCB6-4BDB-9351-12F29393259F",OPINION_DOMESTIC:"navId-09736473-CB3F-4B2F-9772-3AF128ABE12D",OPINION_INTERNATIONAL:"navId-AD8090D7-4137-4D71-84C8-70DA3BD89778",VIDEO:"navId-432A1823-3F24-43C0-8004-79088F94E754",CONFERENCES:"navId-0442C365-4B63-4B63-B9DE-3C28319CB622",MORE:"navId-more-section"},navLevels:{PRIMARY:1,SECONDARY:2,TERTIARY:3},initialize:function(e){i.bindAll(this,"tryPrimaryHover","trySecondaryHover","open","close","render","saveMousePosition","delayedOpen","delayedClose","cancelDelayedOpen","cancelDelayedClose","delayedModalOpen","delayedModalClose","cancelDelayedModalOpen","cancelDelayedModalClose","delayedPrimaryHover","cancelDelayedPrimaryHover","delayedSecondaryHover","cancelDelayedSecondaryHover","handleClickClose","handleTapClose","detectFalsePositive","isNavItemVisible","iterateTemplateCount"),this.settings=i.extend({},this.defaultSettings,e),this.singlePanelWidth=this.settings.panelwidth+"px",this.singlePanelPartlyShut=this.settings.panelwidth-20+"px",this.isNavAnimating=!1,this.timer={},d.length>0?this.render():this.subscribeOnce(d,"sync",this.render),this.$document.on("click","#navigation-modal a[href]",i.bind(this.handleModalClick,this)),this.trackingBaseData={module:"SectionsNav",action:"click",version:"BrowseTree",region:"TopBar"}},handleUserReady:function(){this.updateCrosswordSubscriptionLink()},updateCrosswordSubscriptionLink:function(){var e=o.isTabletSubscriber(),i=o.isSmartphoneSubscriber(),n=o.isHomeDeliverySubscriber(),s=o.isPremierSubscriber(),r=o.isOpinionSubscriber(),l=o.isCrosswordsSubscriber(),d=a.www+"/subscriptions/games/lp8J6KQ.html?campaignId=49W96",c=a.www+"/subscriptions/games/lp897H9.html?campaignId=49W8Y";(e||i||n||s||r)&&!l?t("#nyt-crossword").attr("href",d):l||t("#nyt-crossword").attr("href",c)},handlePrimaryNavigationClick:function(e){var i=t(e.currentTarget),n=this.trackingAppendParams(i.attr("href"),{contentCollection:t.trim(i.text())});i.attr("href",n)},handleModalClick:function(e){var i=t(e.currentTarget),n=t.trim(t("#navigation-modal").find(".secondary-container .header").text()),s=this.trackingAppendParams(i.attr("href"),{contentCollection:n+"/"+t.trim(i.text()),contentPlacement:i.closest("ul").hasClass("secondary")?2:3});i.attr("href",s)},moveNav:function(e){e(this.$el)},render:function(){var e,t,n,s=23,a=33,o=this,c=this.$body.find(".navigation-modal");this.navItemsInView=s,this.navItemsInView=Math.floor((this.pageManager.getViewport().height-41)/26),this.pageManager.isMobile()?this.navItemsInView=s:this.navItemsInView>a?this.navItemsInView=a:this.navItemsInViewthis.navItemsInView&&"more-section"!==e.getTaxonomyId():t<=this.navItemsInView||"more-section"===e.getTaxonomyId()},iterateTemplateCount:function(e){var t="global"===this.pageManager.getEdition()?"international":"domestic";return e.getEdition()&&t!==e.getEdition()?0:1},toggle:function(){this.$el.hasClass("active")?this.close():this.open()},open:function(){var e=this,t={width:e.singlePanelPartlyShut,display:"block",opacity:"0"},i={width:e.singlePanelWidth,opacity:"1"};this.isNavAnimating||this.$el.hasClass("active")!==!1||(this.$el.css(t),this.$el.toggleClass("active"),this.$html.toggleClass("navigation-active"),this.isNavAnimating=!0,this.$el.animate(i,this.settings.navAnimation,function(){e.isNavAnimating=!1,e.$body.on("click",e.handleTapClose)}),this.pageManager.isMobile()&&this.$body.css("cursor","pointer"),this.settings.a11yEnabled&&this.toggleFocusEvents(!0),this.broadcast("nyt:navigation-opened",this),this.$document.on("mousemove",this.saveMousePosition))},close:function(){var e,t,i;this.isNavAnimating||this.$el.hasClass("active")!==!0||(e=this,t=this.$el.css("marginTop"),i={width:this.singlePanelPartlyShut,opacity:"0"},this.navigationModal.close(),this.resetNav(this.navLevels.SECONDARY),this.isNavAnimating=!0,this.$el.animate(i,this.settings.navAnimation,function(){e.$el.toggleClass("active"),e.$html.toggleClass("navigation-active"),e.$body.off("click",e.handleClickClose),e.$body.off("click",e.handleTapClose),e.$el.removeAttr("style"),e.$el.css("marginTop",t),e.$el.find("a").removeClass("active"),e.isNavAnimating=!1}),this.pageManager.isMobile()&&this.$body.css("cursor",""),this.settings.a11yEnabled&&this.toggleFocusEvents(!1),this.broadcast("nyt:navigation-closed",this),this.$document.off("mousemove",this.saveMousePosition))},resetNav:function(e){var t=this.navigationModal.$modal;e===this.navLevels.SECONDARY&&t.find(".section").removeClass("active"),t.find(".secondary a").removeClass("active"),t.find(".tertiary").removeClass("active"),t.find(".modal-content").removeClass("expanded"),t.find(".section-heading a").removeClass("active")},activatePrimaryItem:function(e){var i,n,s,a,o,r,l,d=t(e.target).closest("a"),c=d.attr("id");e.stopPropagation(),d.hasClass("active")||this.isNavAnimating!==!1||(d.hasClass("expandable")?(i=this.navigationModal,n=i.$modal.find('[data-parent="'+c+'"]').find("li").length,s=55,a=29*n,o=a+s,l=i.$modal.find(".secondary-container"),c===this.navIds.MORE?o=this.moreInModalHeight||553:c===this.navIds.OPINION_DOMESTIC||c===this.navIds.OPINION_INTERNATIONAL?o=357:c===this.navIds.VIDEO?(o=310,l.css("width","380px")):c===this.navIds.CONFERENCES&&l.css("width","220px"),this.cancelDelayedModalClose(),this.resetNav(this.navLevels.SECONDARY),i.$modal.height(o),e.currentTarget=e.target,i.open(e),this.moveModalArrow(),this.$el.find("a").removeClass("active").attr("aria-expanded","false"),d.addClass("active").attr("aria-expanded","true"),i.$modal.find(".secondary").removeClass("active"),r=i.$modal.find(".secondary-container .section-heading"),this.setHeadingText(d,r),i.$modal.find('[data-parent="'+c+'"]').addClass("active"),c!==this.navIds.VIDEO&&c!==this.navIds.CONFERENCES&&l.css("width","190px"),this.broadcast("nyt:navigation-level-one-open",i.$modal)):this.modalClose())},setHeadingText:function(e,t){e.attr("href")?t.html(''+e.text()+""):t.html(e.text())},moveModalArrow:function(){var e,i,n,s=this.navigationModal.$modal,a=12,o=18,r=39,l=this.settings.panelwidth-10;t("html").hasClass("viewport-large-70")&&(l+=t("#navigation-edge").width()),s.css("left",l+"px"),e=s.find(".modal-pointer"),e.hasClass("modal-pointer-left")?(i=Math.floor(s.outerHeight()/2)-o,e.css("top",i+"px")):e.hasClass("modal-pointer-left-top")?e.css("top",a,"px"):e.hasClass("modal-pointer-left-bottom")&&(n=s.outerHeight()-r,e.css("top",n+"px"))},activateSecondaryItem:function(e){var i,n,s=t(e.target).closest("a");s.hasClass("active")||this.isNavAnimating!==!1||(e.preventDefault(),i=this.navigationModal.$modal,s.hasClass("expandable")?(this.resetNav(this.navLevels.TERTIARY),i.find(".modal-content").addClass("expanded"),n=i.find(".tertiary-container .section-heading"),this.setHeadingText(s,n),i.find('[data-parent="'+s.attr("id")+'"]').eq(0).addClass("active"),s.addClass("active").attr("aria-expanded","true"),this.broadcast("nyt:navigation-level-two-open",i.find(".tertiary-container"))):(this.resetNav(this.navLevels.TERTIARY),s.addClass("active")))},tryPrimaryHover:function(e){var i,n=t(e.target).closest("a"),s=n.hasClass("expandable");this.cancelDelayedClose(),s&&this.cancelDelayedModalClose(),this.cancelDelayedPrimaryHover(),this.$el.find("li a.active").length>0?(i=this.getAngle(this.mouseLocs[0],this.mouseLocs[1]),i>this.defaultSettings.intentRangeLower&&ithis.defaultSettings.intentRangeLower&&t1?(this.mouseLocs[1].x!==e.pageX||this.mouseLocs[1].y!==e.pageY)&&(this.mouseLocs.push({x:e.pageX,y:e.pageY}),this.mouseLocs.length>this.defaultSettings.maxMouseLocs&&this.mouseLocs.shift()):this.mouseLocs.push({x:e.pageX,y:e.pageY})},toggleFocusEvents:function(e){var t=e?"subscribe":"stopSubscribing";this[t]("nyt:page-key-tab nyt:page-key-up-a11y nyt:page-key-down-a11y",this.handleFocusKey),this[t]("nyt:page-key-esc-a11y nyt:page-key-left-a11y",this.handleCollapseKey),this[t]("nyt:page-key-enter nyt:page-key-right-a11y",this.handleExpandKey),this[t]("nyt:navigation-level-one-open nyt:navigation-level-two-open",this.addFocusableElements),e?(this.focusableElements=[],this.addFocusableElements(),this.$document.on("mousemove",this.detectFalsePositive)):delete this.focusableElements},addFocusableElements:function(e){var t,n;this.settings.a11yEnabled&&(e&&e.length>0?n=".active a[role=menuitem]:visible, .section-heading a.active[role=menuitem]:visible":(e=this.$el,n="a[role=menuitem]:visible, .section-heading a.active[role=menuitem]:visible"),t=e.find(n).toArray(),this.focusableElements.push({first:t[0],all:t,last:i.last(t)}),t[0].focus())},handleFocusKey:function(e){var t=i.last(this.focusableElements),n=this.getKeyDirection(e),s=document.activeElement;if(s===t.last&&"forward"===n)t.first.focus();else if(s===t.first&&"backward"===n)t.last.focus();else if("forward"===n)t.all[i.indexOf(t.all,s)+1].focus();else{if("backward"!==n)return;t.all[i.indexOf(t.all,s)-1].focus()}e.preventDefault()},handleCollapseKey:function(){var e;this.focusableElements.pop(),e=i.last(this.focusableElements),this.focusableElements.length>1?(this.resetNav(this.navLevels.TERTIARY),e.active.focus()):this.focusableElements.length>0?(this.modalClose(),e.active.focus()):this.close()},handleExpandKey:function(e){var n=t(document.activeElement),s=i.last(this.focusableElements);s.active=n,n.hasClass("expandable")&&(e.preventDefault(),n.closest(".secondary").length>0?this.activateSecondaryItem(e):this.activatePrimaryItem(e))},detectFalsePositive:i.throttle(function(e){t(e.target).is('a[role="menuitem"], li[role="presentation"')&&this.disableA11yNav()},1e3),getKeyDirection:function(e){var t="",i=this.pageManager.KEYS,n=e&&e.keyCode?e.keyCode:null;switch(n){case i.UP:case i.LEFT:t="backward";break;case i.DOWN:case i.RIGHT:case i.TAB:t="forward"}return t},enableA11Nav:function(){this.settings.a11yEnabled=!0},disableA11yNav:function(){this.settings.a11yEnabled=!1,this.toggleFocusEvents(!1),this.$document.off("mousemove",this.detectFalsePositive)}});return c}),define("shared/navigation/views/navigation-edge-adjust",["jquery/nyt","underscore/nyt","foundation/views/base-view"],function(e,t,i){"use strict";var n=i.registerView("navigation").extend({el:"#navigation-edge",events:{mouseenter:"handleMouseOver",mouseleave:"handleMouseOut",click:"handleClick"},nytEvents:{"nyt:page-breakpoint":"handleBreakPoint"},initialize:function(){this.pageManager.isDomReady()?this.render():this.subscribe("nyt:page-ready",this.render)},render:function(){this.$shell=e("#shell"),this.pageManager.getCurrentBreakpoint()>=10070&&(this.setNavWidth(),this.subscribe("nyt:page-resize",this.setNavWidth))},setNavWidth:function(){var e=this.$shell.offset();this.$shell.offset()&&(this.broadcast("nyt:navigation-edge-size-change",e.left),this.$el.css("width",e.left))},handleBreakPoint:function(e){e>=10070?this.subscribe("nyt:page-resize",this.setNavWidth):(this.stopSubscribing("nyt:page-resize",this.setNavWidth),this.$el.css("width",""))},handleMouseOver:function(e){(0!==e.clientX||0!==e.clientY)&&this.broadcast("nyt:navigation-edge-mouse-enter",e)},handleMouseOut:function(e){this.broadcast("nyt:navigation-edge-mouse-leave",e)},handleClick:function(){this.broadcast("nyt:navigation-edge-click")}});return n}),define("shared/navigation/views/mobile-navigation",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/navigation/views/navigation","shared/navigation/views/navigation-edge-adjust","shared/navigation/templates","foundation/models/user-data"],function(e,t,i,n,s,a,o){"use strict";var r=i.registerView("mobile-navigation").extend({el:"#mobile-navigation",hiddenEl:"#main, #ribbon, #site-index",nytEvents:{"nyt:masthead-section-click":"handleSectionClick","nyt:page-breakpoint":"handleBreakPoint"},handleUserReady:function(){this.$masthead=e("#masthead").find(".sections-button"),this.render()},render:function(){this.$el.append(a.mobileNav({userData:o,isGlobalEdition:this.pageManager.isInternationalEdition()}))},open:function(){this.$el.removeClass("hidden"),this.$masthead.addClass("mobile-navigation-active"),this.$el.focus(),e(this.hiddenEl).addClass("hidden"),window.scrollTo(0,0)},close:function(){this.$el.addClass("hidden"),this.$masthead.removeClass("mobile-navigation-active"),e(this.hiddenEl).removeClass("hidden")},handleSectionClick:function(){this[this.$el.is(":visible")?"close":"open"]()},handleBreakPoint:function(e){e>=120&&(new n,new s,this.close(),this.remove())}});return r}),define("shared/navigation/views/site-index-responsive",["jquery/nyt","underscore/nyt","foundation/views/base-view"],function(e,t,i){"use strict";var n=i.registerView("navigation").extend({events:{"click a":"handleSiteIndexClick","click .menu-heading":"handleClick","click .menu-label":"handleClick","keyup .menu-heading":"handleKeyboard"},nytEvents:{"nyt:page-breakpoint":"handleBreakPoint"},initialize:function(){var e=this.$el.find(".column");this.$columnHeader=e.find("h3"),this.$columnContents=e.find("ul")},handleDomReady:function(){this.render()},render:function(){this.subscribe("nyt:page-resize",this.setNavWidth),this.handleBreakPoint()},handleBreakPoint:function(){var t,i,n,s;this.pageManager.getCurrentBreakpoint()>=1e3?(this.isSmallSiteIndex=!1,t="removeClass",i="removeAttr",this.$columnContents[t]("expanded")[t]("collapsed")[i]("aria-expanded","true")[i]("aria-expanded","false")):(this.isSmallSiteIndex=!0,t="addClass",i="attr",this.$columnContents[t]("collapsed")[i]("aria-expanded","true")[i]("aria-expanded","false")),this.$columnHeader[t]("toggle")[i]("role","button")[i]("tabindex","0")[i]("aria-pressed","true")[i]("aria-pressed","false"),e.each(this.$columnHeader,function(t,a){s=e(a),n=s.text(),n=n.substr(0,n.indexOf(" ")).toLowerCase(),s[i]("id",n+"-menu-heading")[i]("aria-controls",n+"-menu"),s.siblings("ul")[i]("id",n+"-menu")[i]("aria-labelled-by",n+"-menu-heading")})},handleKeyboard:function(e){(13===e.keyCode||32===e.keyCode)&&this.handleClick(e)},handleClick:function(t){var i,n,s;this.isSmallSiteIndex&&(n=e(t.target),i=n.nextAll("ul"),s=i.find("a"),i.toggleClass("collapsed"),i.toggleClass("expanded"),"false"===n.attr("aria-pressed")?(n.attr("aria-pressed","true"),i.attr("aria-expanded","true"),s.removeAttr("tabindex","-1")):(n.attr("aria-pressed","false"),i.attr("aria-expanded","false"),s.attr("tabindex","-1")))},handleSiteIndexClick:function(t){var i=e(t.currentTarget),n=this.trackingAppendParams(i.attr("href"),{module:"SiteIndex",region:"Footer"});i.attr("href",n)}});return n}),define("shared/navigation/instances/navigation",["jquery/nyt","foundation/views/page-manager","shared/navigation/views/navigation","shared/navigation/views/mobile-navigation","shared/navigation/views/navigation-edge-adjust","shared/navigation/views/site-index-responsive"],function(e,t,i,n,s,a){"use strict";t.getCurrentBreakpoint()>=120?(new i,new s):new n,new a({el:e("#site-index")})}),define("shared/sharetools/views/share-tools-container",["jquery/nyt","underscore/nyt","foundation/views/base-view","foundation/models/user-data","shared/sharetools/models/share-data","shared/sharetools/views/containers-mixin","shared/sharetools/views/share-tools-modal-container","shared/sharetools/instances/cross-platform-save"],function(e,t,i,n,s,a,o,r){"use strict";var l=i.extend(t.extend({},a,{initializedAttribute:"data-share-tools-initialized",initialize:function(t){this.$instanceContainer=t.el,this.trackingRegion=t.trackingRegion||"",this.$instanceContainer&&!this.$instanceContainer.attr(this.initializedAttribute)&&(this.getToolIdsAndCustomLabels(this.$instanceContainer.data("shares")),this.shareData=new s(this.$instanceContainer),this.el=document.createElement("ul"),this.$el=e(this.el),this.$el.addClass("sharetools-menu"),t.modalSettings&&(this.subscribe("nyt:xps-article-status",function(e){t.modalSettings.articleSaved=e}),n.isLoggedIn()&&r.getArticlesStatus(this.pageManager.getCanonical()),this.subscribe("nyt:open-share-modal",function(e){e.instanceContainer&&this.$instanceContainer.get(0)===e.instanceContainer.get(0)&&new o({instanceContainer:e.instanceContainer,modalSettings:t.modalSettings,trackingRegion:this.trackingRegion,shareData:this.shareData})})),this.render())},render:function(){var i,n,s=void 0!==t.find(this.toolIds,function(e){return"AD"===e}),a=this.$instanceContainer.find(".sharetools-inline-article-ad");this.renderToolViews(),this.$instanceContainer.attr(this.initializedAttribute,"1"),s&&a.length?this.$el.insertBefore(a):this.$instanceContainer.append(this.el),i=this.$el.closest(".sharetools"),n=i.attr("id"),("sharetools-masthead"===n&&(this.isTemplateMinimal()||this.hasCoverMedia())||i.data("share-label"))&&e("#sharetools-masthead .show-all-sharetool .sharetool-text").text("Share")},isTemplateMinimal:function(){return this.$html.hasClass("template-minimal")?!0:void 0},hasCoverMedia:function(){return this.$html.hasClass("has-cover-media")?!0:void 0}}));return l}),define("shared/sharetools/instances/sidebar",["jquery/nyt","shared/sharetools/views/share-tools-container"],function(e,t){"use strict";var i;new t({el:e("#sharetools-story"),trackingRegion:"Body",modalSettings:{tailDirection:"left",tailLeftOffset:-8,tailTopOffset:2,positionTailSide:!0,autoPosition:!0,toolTypeSponsor:"Article",toggleSpeed:1,openCallback:function(){var e=this,t=this.pageManager.getViewport().top;i=function(){Math.abs(t-this.pageManager.getViewport().top)>300&&e.close()},this.listenTo(this.pageManager,"nyt:page-scroll",i),this.$target.addClass("active")},closeCallback:function(){this.stopListening(this.pageManager,"nyt:page-scroll",i),this.$target.removeClass("active"),this.removeFromPage()}}})}),define("shared/sharetools/instances/masthead",["jquery/nyt","shared/sharetools/views/share-tools-container"],function(e,t){"use strict";new t({el:e("#sharetools-masthead"),trackingRegion:"Masthead",modalSettings:{tailDirection:"up-right",tailLeftOffset:0,tailTopOffset:-10,fixedOverride:!0,positionTailSide:!1,toggleSpeed:1,toolTypeSponsor:"Article",openCallback:function(){this.listenToOnce(this.pageManager,"nyt:masthead-storytheme",function(){this.close()})}}})}),define("shared/sharetools/instances/upshot",["jquery/nyt","shared/sharetools/views/share-tools-container"],function(e,t){"use strict";var i;new t({el:e("#upshot-sharetools"),trackingRegion:"EndOfArticle",modalSettings:{tailDirection:"left",tailLeftOffset:-8,tailTopOffset:2,positionTailSide:!0,autoPosition:!0,toggleSpeed:1,toolTypeSponsor:"Article",openCallback:function(){var e=this,t=this.pageManager.getViewport().top;i=function(){Math.abs(t-this.pageManager.getViewport().top)>300&&e.close()},this.listenTo(this.pageManager,"nyt:page-scroll",i),this.$target.addClass("active")},closeCallback:function(){this.stopListening(this.pageManager,"nyt:page-scroll",i),this.$target.removeClass("active"),this.removeFromPage()}}})}),define("shared/sharetools/instances/story-footer",["jquery/nyt","shared/sharetools/views/share-tools-container"],function(e,t){"use strict";var i;new t({el:e("#story-footer-sharetools"),trackingRegion:"EndOfArticle",modalSettings:{tailDirection:"left",tailLeftOffset:-8,tailTopOffset:2,positionTailSide:!0,autoPosition:!0,toggleSpeed:1,toolTypeSponsor:"Article",openCallback:function(){var e=this,t=this.pageManager.getViewport().top;i=function(){Math.abs(t-this.pageManager.getViewport().top)>300&&e.close()},this.listenTo(this.pageManager,"nyt:page-scroll",i),this.$target.addClass("active")},closeCallback:function(){ this.stopListening(this.pageManager,"nyt:page-scroll",i),this.$target.removeClass("active"),this.removeFromPage()}}})}),define("shared/searchform/views/search-form",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/searchform/helpers/search-form-mixin"],function(e,t,i,n){"use strict";var s=i.extend(t.extend({},n,{events:{"keyup .search-input":"handleKeyUp","keydown .search-input":"handleKeyDown","click .submit-button":"submitSearch","click .clear-button":"handleClearButton"},afterInitialize:function(){this.$shell.on("click",this.handlePageClicks)}}));return s}),define("shared/searchform/instances/search-form",["jquery/nyt","foundation/views/page-manager","shared/searchform/views/search-form"],function(e,t,i){"use strict";t.getMeta("errorpage")&&new i({el:e(".error-page .search-form-control")})}),define("article/story/models/realestate-search-form/search-suggestion",["foundation/models/base-model"],function(e){"use strict";var t=e.extend({defaults:{query:"",results:[]}});return t}),define("article/story/collections/realestate-search-form/realestate-search-suggestions",["jquery/nyt","backbone/nyt","underscore/nyt","foundation/collections/base-collection","article/story/models/realestate-search-form/search-suggestion","foundation/hosts"],function(e,t,i,n,s,a){"use strict";var o=n.extend({model:s,basicSearchUrl:a.realestate+"/v1.3/Service.aspx",smartSearchUrl:a.realestateSmartSearch,resultsUrl:a.realestateResults,defaultSettings:{numOfSuggestions:4},query:"",apiType:"basic",searchType:"sales",previousQuery:"",previousAPICall:null,initialize:function(e){this.settings=i.extend({},this.defaultSettings,e)},sync:function(e,i,n){return n.url=this.basicSearchUrl,n.dataType="jsonp",n.beforeSend=this.beforeSendSync(),t.sync(e,i,n)},parse:function(e){var t=this.parseResponse(e),n=e.suggestresponse?e.suggestresponse.term:this.query;return i.isEmpty(t)&&this.previousQuery!==n?(this.previousQuery=n,this.newQuery(n,"use-smart-search"),null):{query:n,results:t,apiType:this.apiType}},parseResponse:function(e){var t,n,s;if("basic"===this.apiType){if(!e.group[0].option.length)return!1;t=i.map(e.group[0].option,function(e){return{display:e.title,id:e.valueseo}})}else s=e.matchgroup,i.isEmpty(s)?t=[]:(n=s[0].match[0].seopath.replace("/"+this.searchType+"/",""),t=[{id:n,display:""}]);return t.slice(0,this.settings.numOfSuggestions)},newQuery:function(e,t){this.query=e,this.apiType=t||"basic",this.fetch()},beforeSendSync:function(){var e,t=this;return function(i,n){e=n.jsonpCallback,t.previousAPICall&&t.previousAPICall.abort(),t.previousAPICall=i,"basic"===t.apiType?(n.url=t.basicSearchUrl,n.url+="?ReturnType=json&SearchType=Suggest&Channel="+encodeURIComponent(t.searchType),n.url+="&term="+encodeURIComponent(t.query),n.url+="&callback="+e):(n.url=t.smartSearchUrl,n.url+="?cha="+t.searchType,n.url+="&ret=json&key="+encodeURIComponent(t.query),n.url+="&callback="+e)}}});return o}),define("article/story/views/realestate-search-form/realestate-search-form",["jquery/nyt","underscore/nyt","foundation/views/base-view","foundation/hosts","foundation/models/user-data","article/story/templates","shared/searchform/helpers/search-form-mixin","article/story/collections/realestate-search-form/realestate-search-suggestions"],function(e,t,i,n,s,a,o,r){"use strict";var l=i.extend(t.extend({},o,{collection:new r,postAdLink:n.realestatePostAdLink,events:{"click .tabs-container":"handleSearchTabs","keyup .search-input":"handleKeyUp","keydown .search-input":"handleKeyDown","click .search-homes":"submitSearch","click .auto-suggest a, .auto-suggest li":"handleClickingSearchResults","click .plus-button, .minus-button":"handlePlusMinusButtons","click .submit-listing":"handlePostAnAd","change .price":"handleChangePrice"},initialize:function(){t.bindAll(this,"handleClickIfVisible"),this.$shell.on("click",":not(.auto-suggest)",this.handleClickIfVisible)},render:function(){var e,i,n=this.collection.toJSON()[0];t.isEmpty(n)||(i=a.realestateSearchSuggestion,e=i({results:n.results}),"basic"===n.apiType?this.$list.html(e).show():(this.$list.html(e),this.$list.find("a").click()))},afterInitialize:function(){this.$realEstateForSaleFilters=this.$el.find(".for-sale"),this.$realEstateForRentFilters=this.$el.find(".for-rent"),this.$forSalePricesCopy=this.$el.find("#for-sale-min-price").clone(),this.$forRentPricesCopy=this.$el.find("#for-rent-min-price").clone(),this.resultsUrl=n.realestateResults,this.$el.find("select").prop("selectedIndex",0)},handleClickingSearchResults:function(t){var i;t.preventDefault(),i=e(t.target).closest("a"),i.text()&&this.$input.val(i.text()),this.$input.data("href",i.data("href")),this.$list.empty().hide()},submitSearch:function(i){var n,s,a=this.getFilterType();i&&i.preventDefault(),t.isEmpty(this.$input.data("href"))&&(s=this.$list.find("a"),s.length?s.first().click():this.$input.data("href","new-york-ny-usa")),n={channel:this.getChannelType(),location:this.$input.data("href"),priceMin:a.find("[name=priceMin]").val(),priceMax:a.find("[name=priceMax]").val(),bedrooms:this.formatBedBath(this.$el.find("#bedrooms").val()),bathrooms:this.formatBedBath(this.$el.find("#bathrooms").val())},this.resultsUrl=window.location.protocol+"//"+window.location.hostname+"/real-estate/"+("sales"===n.channel?"homes-for-sale":"homes-for-rent")+"/",window.location.href=this.resultsUrl+"?"+e.param(n)},handleEnterKey:function(e){var t;this.$list.is(":visible")?(t=this.$list.find(".active"),t.length?t.click():this.$list.find("a").first().click()):this.submitSearch(e)},handlePlusMinusButtons:function(t){var i=e(t.target);t.preventDefault(),this.changeBedBath(i)},handlePostAnAd:function(){window.location.href=this.postAdLink},handleSearchTabs:function(t){var i,n=e(t.target);return n.is(".active")||n.parent().is(".active")?!1:(i=this.$el.find(".tabs-container .active"),this.$el.find(".tabs-container li").addClass("active"),i.removeClass("active"),this.$el.find(".max-min-price").toggleClass("hidden"),void(this.collection.searchType=this.getChannelType()))},changeBedBath:function(e){var t=e.hasClass("bedrooms")?"bedrooms":"bathrooms",i=this.$el.find("#"+t+" option:selected").index(),n=e.hasClass("plus-button")?i+1:Math.max(i-1,0);this.$el.find("#"+t+" option").eq(n).prop("selected",!0)},formatBedBath:function(e){return this.isForSaleSection()?e:e.replace("s","")},isForSaleSection:function(){return e(".for-sale-tab").hasClass("active")},getChannelType:function(){return this.isForSaleSection()?"sales":"rentals"},getFilterType:function(){return this.isForSaleSection()?this.$realEstateForSaleFilters:this.$realEstateForRentFilters},disableSubmitButton:function(){return e.noop},handleClickIfVisible:function(){this.$el.find(".auto-suggest:visible").length&&this.handlePageClicks()},handleChangePrice:function(t){var i,n,s,a,o,r;s=e(t.target),a=this.isForSaleSection()?this.$forSalePricesCopy:this.$forRentPricesCopy,n=a.val(s.val()).find("option:selected").index(),s.context.id.match("min")?(i=a.find("option").clone().slice(n+1),o=s.closest(".max-min-price").find(".price-max"),r=o.val(),o.html(i),"Max Price"!==o.find("option").last().val()&&o.prepend(''),o.val(r)):(i=a.find("option").clone(),n>0&&(i=i.slice(0,n)),o=s.closest(".max-min-price").find(".price-min").val(),s.closest(".max-min-price").find(".price-min").html(i).val(o))}}));return l}),define("article/story/instances/realestate-search-form",["jquery/nyt","article/story/views/realestate-search-form/realestate-search-form"],function(e,t){"use strict";e("#real-estate-search-ad").length&&new t({el:"#real-estate-search-ad"})}),define("shared/slideshow/templates",["underscore/nyt"],function(_){var templates={};return templates.embeddedSlideshow=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",isLede===!1&&(__p+='\n

    '+(null==(__t=headline)?"":__t)+"

    \n"),__p+='
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    ';return __p},templates.embeddedSlideshowHP=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='
    \n
    \n\n
    \n
    ';return __p},templates.image=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",__p+="homepage"===applicationName?'\n\n':'\n\n\n\n',__p+="";return __p},templates.imageInfo=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='";return __p},templates}),define("shared/slideshow/views/embedded-slideshow",["jquery/nyt","underscore/nyt","backbone/nyt","foundation/collections/base-collection","foundation/views/base-view","shared/slideshow/templates"],function(e,t,i,n,s,a){"use strict";var o=s.extend({speed:1e3,defaultSlideshowCaptionHeight:50,ledeSlideshowCaptionHeight:67,ledeSquareSlideshowSideCaptionHeight:245,firstSlide:!0,hammerSettings:{tap_max_touchtime:400,swipe_velocity:.1,drag_min_distance:3},imageShapes:{PANORAMIC:"ratio-panoramic",LANDSCAPE:"ratio-landscape",SQUARE:"ratio-square",PORTRAIT:"ratio-portrait"},slideshowTypes:{MIXED:"mixed",ALLPORTRAIT:"allPortrait",ALLSQUARE:"allSquare"},$prevArrow:e(),$nextArrow:e(),$captionText:e(),events:{"click .arrow-navigation-previous":"prevAsset","click .arrow-navigation-next":"nextAsset","click .image-navigation.previous":"prevAsset","click .image-navigation.next":"nextAsset","mouseenter .image-navigation.previous":"lightPrevArrow","mouseleave .image-navigation.previous":"unLightPrevArrow","mouseenter .image-navigation.next":"lightNextArrow","mouseleave .image-navigation.next":"unLightNextArrow",drag:"handleDrag",swipeleft:"nextAsset",swiperight:"prevAsset"},initialize:function(e){this.assetIndex=0,t.bindAll(this,"prevAsset","nextAsset","lightPrevArrow","unLightPrevArrow","lightNextArrow","unLightNextArrow"),e.showOnInit||this.$el.hide(),this.$body.off("click",".slideshow"),this.isMobile=this.pageManager.isMobile(),this.isLede=this.isSlideshowLede(),this.trackingBaseData={module:"Slideshow",action:"click",contentCollection:this.pageManager.getMeta("article:section"),version:"Embedded",region:"Body"},this.captionList=e.captionList,this.cropList=e.cropList,this.template=e.template||"embeddedSlideshow",this.truncateCaptions="boolean"==typeof e.truncateCaption?e.truncateCaption:!0},handleDomReady:function(){var e=a[this.template];this.getAssetsFromJSON(this.$el,this.captionList,this.cropList),this.setSlideshowClass(),this.$el.append(e({headline:this.headline,collection:this.collection,isMobile:this.isMobile,isLede:this.isLede})),this.$prevArrow=this.$el.find(".arrow-navigation-previous"),this.$nextArrow=this.$el.find(".arrow-navigation-next"),this.render(),this.setCounter(),this.$el.fadeIn(this.speed),this.trackingBaseData.contentID=this.assetID,this.debouncedHandleWindowResize=t.debounce(this.handleWindowResize,250),this.isSlideshowLede()&&this.subscribe(this.pageManager,"nyt:page-resize",this.debouncedHandleWindowResize)},findBasedOnList:function(e,t){var i;for(i=0;i<=t.length;i+=1)if(e.hasOwnProperty(t[i]))return e[t[i]];return{}},getImageShape:function(e,t){var i=1.7,n=1.1,s=.9,a=e/t;return a>i?this.imageShapes.PANORAMIC:a>n?this.imageShapes.LANDSCAPE:a>s?this.imageShapes.SQUARE:this.imageShapes.PORTRAIT},getAssetsFromJSON:function(i,s,a){var o,r,l,d=this,c=i.find("script").get(0).innerHTML,h=e.parseJSON(c),u=!0,m=!0,g=0;this.slideshowType=this.slideshowTypes.MIXED,this.headline=h.headline||"",this.assetID=h.id;try{h=t.map(h.imageslideshow.slides,function(e){return o=d.findBasedOnList(e.image_crops,a),r=d.findBasedOnList(e.caption,s),l=d.getImageShape(o.width,o.height),g=g>o.height?g:o.height,l!==d.imageShapes.PORTRAIT&&(u=!1),l!==d.imageShapes.SQUARE&&(m=!1),o?{src:o.url,caption:r,credit:e.credit,imageShape:l}:null})}catch(p){h=[]}h=t.filter(h,function(e){return!!e}),u?this.slideshowType=this.slideshowTypes.ALLPORTRAIT:m&&(this.slideshowType=this.slideshowTypes.ALLSQUARE),this.tallestImageHeight=g,this.collection=new n,this.collection.reset(h)},render:function(){var i,n,s,o,r=new Image,l=this.$el.find("figure").get("context").getAttribute("data-url"),d=this.pageManager.getApplicationName(),c=this.$el.find(".image"),h=this.$el.find(".caption"),u=this.$el.find(".loader-container"),m=this;return i=this.collection.at(this.assetIndex),n=e(a.image({src:i.get("src"),url:l,applicationName:d})),s=e(a.imageInfo({caption:i.get("caption"),credit:i.get("credit")})),c.html(n),this.isMobile||"homepage"!==d||c.css("height",this.tallestImageHeight),u.css("margin-bottom",0),h.html(s),this.$captionText=this.$el.find(".caption-text"),s.fadeIn(this.speed),o=i.get("imageShape"),this.$el.find(".container").removeClass(t.values(this.imageShapes).join(" ")).addClass(o),r.onload=function(){var e;n.fadeIn(m.speed,function(){m.toggleLoader(!1)}),m.truncateCaptions&&(e=m.getTruncationHeight(o),m.truncateText(m.$captionText,e,!0))},r.src=i.get("src"),this},nextAsset:function(e){var t;e.stopPropagation(),this.moveIndex(1),this.render(),this.setCounter(),t=this.assetIndex+1,this.trackingTrigger("embedded-slideshow-next-image",{eventName:"NextAsset-"+t+(t===this.collection.length?"-Finish":""),mdata:{currentSlide:t,totalSlides:this.collection.length}})},prevAsset:function(e){var t;e.stopPropagation(),this.moveIndex(-1),this.render(),this.setCounter(),t=this.assetIndex+1,this.trackingTrigger("embedded-slideshow-prev-image",{eventName:"PrevAsset-"+t+(t===this.collection.length?"-Finish":""),mdata:{currentSlide:t,totalSlides:this.collection.length}})},setCounter:function(){var e;this.$counter=this.$el.find(".counter"),e=this.assetIndex,this.$counter.html(e+1+" of "+this.collection.length)},moveIndex:function(e){var t=this.assetIndex,i=this.collection.length;t+=e,t===i?t=0:-1===t&&(t=i-1),this.assetIndex=t},handleDrag:function(e){var t=e.gesture;("right"===t.direction||"left"===t.direction)&&t.preventDefault()},getTruncationHeight:function(e){return this.isWideLedeSquareNoAdSlideshow()?this.ledeSquareSlideshowSideCaptionHeight:this.isLedeMixedNoAdSlideshow()?this.defaultSlideshowCaptionHeight:this.isSlideshowLede()?this.ledeSlideshowCaptionHeight:this.slideshowType===this.slideshowTypes.ALLPORTRAIT?300:this.slideshowType===this.slideshowTypes.ALLSQUARE?184:e===this.imageShapes.PORTRAIT?290:e===this.imageShapes.SQUARE?224:this.defaultSlideshowCaptionHeight},isSlideshowLede:function(){return this.$el.hasClass("lede")},setSlideshowClass:function(){var e,t=this.slideshowType;(t===this.slideshowTypes.ALLPORTRAIT||t===this.slideshowTypes.ALLSQUARE)&&(e=t.replace(/^all/,"format-all-").toLowerCase(),this.$el.addClass(e))},hasLedeAd:function(){var e=this.pageManager.$html;return e.hasClass("has-xxl")||e.hasClass("has-big-ad")||e.hasClass("has-half-page")},toggleLoader:function(e){var t=this.$el.find(".loader-container");e?t.show():t.hide()},lightPrevArrow:function(){this.unLightNextArrow(),this.$prevArrow.addClass("hover")},unLightPrevArrow:function(){this.$prevArrow.removeClass("hover")},lightNextArrow:function(){this.unLightPrevArrow(),this.$nextArrow.addClass("hover")},unLightNextArrow:function(){this.$nextArrow.removeClass("hover")},isWideLedeSquareNoAdSlideshow:function(){var e=this.pageManager.getCurrentBreakpoint();return!this.hasLedeAd()&&this.isSlideshowLede()&&this.slideshowType===this.slideshowTypes.ALLSQUARE&&e>=1030?!0:!1},isLedeMixedNoAdSlideshow:function(){return!this.hasLedeAd()&&this.isSlideshowLede()&&this.slideshowType===this.slideshowTypes.MIXED?!0:!1},handleWindowResize:function(){var e;this.truncateCaptions&&(e=this.ledeSlideshowCaptionHeight,this.isWideLedeSquareNoAdSlideshow()&&(e=this.ledeSquareSlideshowSideCaptionHeight),this.truncateText(this.$captionText,e,!0))}});return o}),define("article/story/instances/embedded-slideshow",["jquery/nyt","shared/slideshow/views/embedded-slideshow"],function(e,t){"use strict";e("#story").find(".slideshow").each(function(i,n){var s;"inline"===e(this).data("media-action")&&(s={el:n,captionList:["full","short"],cropList:["jumbo","tmagArticle","blog480"],showOnInit:!1,template:"embeddedSlideshow",truncateCaption:!0},new t(s))})}),define("article/common/templates",["underscore/nyt"],function(_){var templates={};return templates.mostEmailed=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",collection.length&&(__p+='\n\n'),__p+="";return __p},templates.mostEmailed8772=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",collection.length&&(__p+='\n\n'),__p+="";return __p},templates.trending=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",collection.length&&(__p+='\n\n'),__p+="";return __p},templates.welcomeBack=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='
    ';return __p},templates.welcomeBackFooter=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.welcomeBackStories=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",collection.length&&(__p+="

    \nMore Recommended Articles »\n

    '),__p+="";return __p},templates.welcomeBackTitle=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='\nRecommended Articles';return __p},templates}),define("article/common/views/marginalia/helpers/template-factory",["jquery/nyt","article/common/templates"],function(e,t){"use strict";var i={createTemplate:function(e){return e&&e.$el?e.$el.hasClass("most-emailed-marginalia")||e.$el.hasClass("trending-module")?t.trending:void 0:null}};return i}),define("article/common/views/marginalia/marginalia",["jquery/nyt","underscore/nyt","foundation/views/base-view","foundation/views/page-manager","article/common/views/marginalia/helpers/template-factory"],function(e,t,i,n,s){"use strict";var a=i.extend({className:"marginalia",template:null,typeAttribute:"marginalia-type",$placeholder:e('
    '),$placeholderClone:null,initialize:function(){var e=this.$el.data(this.typeAttribute);e&&this.model.setType(e),this.template=s.createTemplate(this),this.$el.data("marginalia-id",this.model.cid),this.subscribe(this.model,"marginalia:assets-changed",this.render),this.subscribe("nyt:page-scroll",this.checkMarginaliaInViewport)},render:function(e){return this.template&&(this.$el.html(this.template({collection:e})),this.$el.hasClass("hidden")&&this.$el.removeClass("hidden"),this.truncateHeadline(),this.broadcast("nyt:ad-library:dfp:request-placement","MostEm"),this.checkMarginaliaInViewport()),this},checkMarginaliaInViewport:t.throttle(function(){(this.$el.hasClass("most-emailed-marginalia")||this.$el.hasClass("trending-module"))&&n.isComponentVisible(this.$el)&&(this.stopSubscribing("nyt:page-scroll",this.checkMarginaliaInViewport),this.trackingTriggerImpression("WP-most-emailed-viewed",{contentCollection:this.pageManager.getMeta("article:section"),module:"FBMostPopular",region:"Marginalia",version:"Full",action:"Impression",eventName:"Impression",pgtype:"article"}))},300),truncateHeadline:function(){var t=this;this.$el.css("display","block"),"true"===this.$el.attr("data-truncate-enabled")&&this.$el.find(".story-link").each(function(i,n){t.truncateText(e(n).find(".truncate-text"),e(n).height())}),this.$el.css("display","")},isType:function(e){return this.model.getType()===e},createPlaceholder:function(){this.$placeholderClone=this.$placeholder.clone(),this.$el.before(this.$placeholderClone)},deletePlaceholder:function(){this.$placeholderClone.remove()},placeAfter:function(e){this.createPlaceholder(),e.after(this.el)},placeBefore:function(e){this.createPlaceholder(),e.before(this.el)},placeAtOriginalPos:function(){null!==this.$placeholderClone&&(this.$placeholderClone.before(this.el),this.deletePlaceholder())}});return a}),define("article/common/models/marginalia/marginalia",["foundation/models/base-model"],function(e){"use strict";var t=e.extend({type:null,getType:function(){return this.type},setType:function(e){this.type=e}});return t}),define("shared/data/models/most-popular",["underscore/nyt","backbone/nyt","shared/data/models/article"],function(e,t,i){"use strict";var n=i.extend({getVideoKicker:function(){return this.get("section")}});return n}),define("shared/data/collections/most-popular",["backbone/nyt","foundation/collections/base-collection","shared/data/models/most-popular","foundation/hosts","underscore/nyt","shared/data/helpers/collection-mixin","foundation/views/page-manager"],function(e,t,i,n,s,a,o){"use strict";var r=t.extend(s.extend({},a,{model:i,apis:{mostviewed:{url:n.s1Host+"/du/mostpopular/viewed/all_1.jsonp?v1",callback:"jsonCallbackViewed"},mostemailed:{url:n.s1Host+"/du/mostpopular/emailed/all_1.jsonp?v1",callback:"jsonCallbackEmailed"},mostviewed7days:{url:n.contentApiHost+"/svc/mostpopular/v2/viewed/7.jsonp",callback:"jsonCallbackMostEmailed7"},mosttweeted:{url:n.DUHost+"/svc/mostpopular/v2/shared/1/twitter.jsonp",callback:"jsonCallbackTweeted"},mostsharedonfacebook:{url:n.contentApiHost+"/svc/mostpopular/v2/shared/1/facebook.jsonp",callback:"jsonCallbackFacebook"}},initialize:function(e,t){var i;this.url=this.apis[t.type].url,this.callback=this.apis[t.type].callback,o.flag("styledMostEmailed")&&(i=this.pageManager.getUrlParam("testUrlMostEmailed"),i&&(this.url=i))},sync:function(t,i,n){return n.dataType="jsonp",n.jsonpCallback=this.callback,n.jsonp="callback",n.cache=!0,e.sync(t,i,n)},parse:function(e){var t=this,i=s.map(e.results,function(e){var i=[];return e.id&&(e.data_id=e.id,delete e.id),e.asset_id&&delete e.asset_id,""===e.media?delete e.media:i=e.media[0]["media-metadata"]||[],e.promotional_media={image:{image_crops:{thumbStandard:t.getCrop(i,"Standard Thumbnail"),mediumThreeByTwo210:t.getCrop(i,"mediumThreeByTwo210"),mediumThreeByTwo440:t.getCrop(i,"mediumThreeByTwo440")}}},e.description=e["abstract"],e.link=e.url,e.kicker=e.column,e.headline=e.title,e.authors=[e.byline.replace("By ","").replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})],e.pubDate=e.published_date,e});return i},getCrop:function(e,t){var i,n;for(i=0,n=e.length;n>i;i+=1)if(e[i].format===t)return e[i]},getIdentifier:function(){return"src=me"}}));return r}),define("shared/data/instances/facebook",["shared/data/collections/most-popular"],function(e){"use strict";return new e([],{type:"mostsharedonfacebook"})}),define("article/common/models/marginalia/most-emailed",["underscore/nyt","article/common/models/marginalia/marginalia","shared/data/instances/facebook","shared/data/instances/trending-pages"],function(e,t,i,n){"use strict";var s=t.extend({assetsCollection:null,initialize:function(){this.assetsCollection=n.loadData(),this.assetsCollection.length>0?this.handleMostEmailedCollection():this.subscribeOnce(this.assetsCollection,"sync",this.handleMostEmailedCollection)},handleMostEmailedCollection:function(){var t=this;e.defer(function(){t.local(t,"marginalia:assets-changed",t.assetsCollection)})},getMostEmailedAssets:function(){return this.assetsCollection}});return s}),define("article/common/models/marginalia/helpers/model-factory",["article/common/models/marginalia/marginalia","article/common/models/marginalia/most-emailed"],function(e,t){"use strict";var i={DefaultObj:e,createModel:function(e){return e=e||"",e.indexOf("most-emailed-marginalia")>=0||e.indexOf("trending-module")>=0?new t:new this.DefaultObj}};return i}),define("article/common/collections/marginalia/marginalia-collection",["foundation/models/base-model","foundation/collections/base-collection","article/common/models/marginalia/helpers/model-factory"],function(e,t,i){"use strict";var n=t.extend({model:i.defaultObj,add:function(n){return this.model=i.createModel(n),this.model.prototype=e.prototype,t.prototype.add.call(this,this.model),this.model}});return n}),define("article/common/views/marginalia/list",["underscore/nyt","jquery/nyt","foundation/views/base-view","article/common/views/marginalia/marginalia","article/common/collections/marginalia/marginalia-collection"],function(e,t,i,n,s){"use strict";var a=i.extend({el:t("#main"),$story:t("#story"),collection:new s,marginaliaViews:[],existingBreakpoint:null,$target:null,thresholds:{medium:1020},initialize:function(){var e=this;this.$el.find(".marginalia,.module").each(function(i,s){var a=t(s),o=e.collection.add(s.className);e.marginaliaViews.push(new n({model:o,el:a}))}),this.doMarginaliaPlacement(),this.subscribe("nyt:page-breakpoint",this.doMarginaliaPlacement),this.initializeAdPlacement(t(".lede-ad"))},doMarginaliaPlacement:function(){var t,i,n=this.getViewsByType("sprinkled").slice(0);n.length<=1||(t=e.partial(this.bringToTarget,n.shift().$el,n),i=e.partial(this.returnFromTarget,n),this.determinePlacementByBreakpoint(this.thresholds.medium,t,i))},initializeAdPlacement:function(e){var t;t=e,null!==t&&(this.resetPlacement(t),this.subscribe("nyt:page-breakpoint",this.doAdPlacement),this.doAdPlacement())},doAdPlacement:function(){var t=this.$target,i=this.getViewsByType("sprinkled"),n=e.partial(this.bringToTarget,t,i),s=e.partial(this.returnFromTarget,i);!t||t.length<1||this.determinePlacementByBreakpoint(this.thresholds.medium,n,s)},determinePlacementByBreakpoint:function(e,t,i){var n=this.pageManager.getCurrentBreakpoint();this.hasPassedIntoThreshold(n,e)?t():this.hasPassedOutsideThreshold(n,e)&&i(),this.existingBreakpoint=n},hasPassedIntoThreshold:function(e,t){return t>=e&&(this.existingBreakpoint>t||null===this.existingBreakpoint)},hasPassedOutsideThreshold:function(e,t){return e>t&&null!==this.existingBreakpoint&&this.existingBreakpoint<=t},resetPlacement:function(e){this.$target=e||this.$target,this.existingBreakpoint=null,this.stopSubscribing("nyt:page-breakpoint",this.doMarginaliaPlacement),this.stopSubscribing("nyt:page-breakpoint",this.doAdPlacement),this.returnFromTarget()},getFirstAd:function(t){var i=this.$story,n=null;return e.each(t,function(e){var t;null===n&&(t=i.find("#"+e+".marginalia-anchor-ad"),t.length>0&&(n=t.eq(0)))}),n},getLastAd:function(t){var i=this.$story,n=null;return e.each(t.reverse(),function(e){var t;null===n&&(t=i.find("#"+e+".marginalia-anchor-ad"),t.length>0&&(n=t.eq(0)))}),n},bringToTarget:function(t,i){t.hasClass("hidden")||(i=i||this.marginaliaViews,i=i.slice(0),i.length>1&&(i=i.reverse()),e.each(i,function(e){e.placeAfter(t)}))},returnFromTarget:function(t){t=t||this.marginaliaViews,e.each(t,function(e){e.placeAtOriginalPos()})},getViewsByType:function(t){var i;return i=e.filter(this.marginaliaViews,function(e){return e.isType(t)})}});return a}),define("article/common/instances/marginalia-list",["article/common/views/marginalia/list"],function(e){"use strict";new e}),define("shared/messaging/templates",["underscore/nyt"],function(_){var templates={};return templates.followButton=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='"; return __p},templates.followConfirmation=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n',thumb&&(__p+='\n
    \n\n
    \n'),__p+='\n
    \n

    '+(null==(__t=unfollowText)?"":__t)+' '+(null==(__t=following)?"":__t)+'?

    \n
    \n\n\n
    \n
    \n
    ";return __p},templates.followInfo=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='";return __p},templates.followUnfollowed=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",__p+=message_type?'\n
    \n':'\n
    \n',__p+="\n
    \n

    "+(null==(__t=confirmedText)?"":__t)+" "+(null==(__t=following)?"":__t)+".

    \n
    \n
    ";return __p},templates.message=function(obj){var __t,__p="";Array.prototype.join;with(obj||{}){if(__p+="",closeButton&&(__p+='\n\n'),__p+="",sub_type&&(sub_type=sub_type.replace(/([A-Z])/g,"-$1").toLowerCase(),"-"===sub_type.charAt(0)&&(sub_type=sub_type.substr(1))),__p+='
    ',label&&(__p+='\n'+(null==(__t=label)?"":__t)+"\n"),__p+='\n'+(null==(__t=formattedTitle)?"":__t)+"\n",buttons.length>0){__p+="\n";for(var i=0;i'+(null==(__t=buttons[i].text)?"":__t)+"\n");__p+="\n"}if(__p+="\n",1===display_type_id&&start_time){var minutes,hours,formatted,date=new Date(1e3*start_time);hours=date.getHours(),minutes=date.getMinutes(),minutes=9>=minutes?"0"+minutes:minutes,ampm=hours>=12?"PM":"AM",hours=hours>12?hours-12:hours,formatted=""+hours+":"+minutes+" "+ampm,__p+='\n\n'+(null==(__t=formatted)?"":__t)+"\n\n"}__p+="\n",4===display_type_id&&(__p+="\n"+(null==(__t=payload.dsm_cpy)?"":__t)+"\n"),__p+="\n
    "}return __p},templates.messenger=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='
    ';return __p},templates.notificationModals=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",__p+=message_type?'\n
    \n':'\n
    \n',__p+="\n",__p+=link?'\n\n':"\n\n",__p+="\n"+(null==(__t=emphasize(title,emphasis))?"":__t)+'\n\n\n
    ";return __p},templates.notificationsModal=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="","default"===show?__p+='\n
    \n
    \n
    \n

    You have no new notifications.

    \n

    Follow columns and be notified when new articles are published.

    \n
    \n\n
    \n
    \n':(__p+="\n",__p+=message_type?'\n
    \n':'\n\n"),__p+="";return __p},templates.onboardingFirstFollow=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='

    You are following '+(null==(__t=collectionName)?"":__t)+". Every time a new "+(null==(__t=collectionName)?"":__t)+" article is published, you will receive an alert in your notifications panel in the top right corner of your screen.

    ";return __p},templates.onboardingIntroducingNotifications=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='

    Introducing the notifications panel. Follow columns and receive an alert when new articles are published.

    ';return __p},templates.onboardingSuggestFollow=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='

    Follow '+(null==(__t=collectionName)?"":__t)+" and receive an alert when a new article is published.

    ";return __p},templates}),define("shared/messaging/views/messenger-format-mixin",["underscore/nyt"],function(e){"use strict";var t={emphasizeTitle:function(t,i){var n,s,a,o,r,l,d,c=[],h=[],u=0,m=t.length;if(!i||0===i.length)return t;for(s=e.sortBy(i,function(e){return e.offset});s.length>0;){if(o=s.shift(),r=o.offset+o.count,l=o.offset,u>l||r>m)return t;l===u&&c.length>0?(a=c.pop(),a+=t.slice(l,r),c.push(a),u=r):(l>u&&c.push(t.slice(u,l)),c.push(t.slice(l,r)),d={index:c.length-1,treatment:o.treatment,url:o.url},h.push(d),u=r),0===s.length&&u!==m&&c.push(t.slice(r))}return e.each(h,function(e){var t=e.index,i=e.treatment;e.url?c[t]=''+c[t]+"":c[t]=''+c[t]+""}),n=c.join("")}};return t}),define("shared/messaging/views/message",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/messaging/templates","shared/messaging/views/messenger-format-mixin"],function(e,t,i,n,s){"use strict";var a=i.registerView("messaging").extend({className:"message-container hidden",events:{"click .close-message":"dismissed","click .action-button":"acknowledged","click .action-link":"acknowledged"},defaults:{closeButton:!0,dismissAcknowledged:!0,hiddenClass:"hidden",revealClass:"",show:function(){this.$el.removeClass(this.settings.hiddenClass).addClass(this.settings.revealClass)},hide:function(){this.$el.removeClass(this.settings.revealClass).addClass(this.settings.hiddenClass)}},initialize:function(e){this.settings=t.extend({},this.defaults,e),this.template=n[this.settings.template],this.subscribe("nyt:messaging-modal-"+this.model.id+"-dismissed",this.popupDismissed),this.subscribe("nyt:messaging-modal-"+this.model.id+"-acknowledged",this.popupAcknowledged),this.subscribe(this,"nyt:messaging-message-expired",this.expired)},render:function(){var e=this;return this.$el.html(e.template(t.extend(e.model.toJSON(),e.settings,{formattedTitle:this.getFormattedTitle(),unfollowThreshold:this.pageManager.flag("unfollowComments")?5:6}))).addClass(this.settings.hiddenClass).data("id",e.model.get("id")),!e.model.get("links")||e.model.isNotificationsPanelMessage()||e.pageManager.flag("allTheEmphases")||this.insertLinks(),e.model.get("unread")?e.$el.find(".message").addClass("is-unread"):e.$el.find(".message").addClass("is-read no-transition"),this},replaceBetween:function(e,t,i,n){return n.substring(0,e)+i+n.substring(t)},insertLinks:function(){var e,t,i,n,s,a,o,r=this.$el.find(".message-title"),l=r.html(),d=this.model.get("links");for(d.length>1&&d.sort(function(e,t){return t.start-e.start}),o=0;od[o-1].start)break;s=l.substring(e,t),a=''+s+"",l=this.replaceBetween(e,t,a,l)}else l=''+l+"";r.html(l)},getFormattedTitle:function(){var e=this.model.getCombinedEmphasis(),t=this.model.get("title"),i=s.emphasizeTitle(t,e),n=this.model.get("links")[0];return this.pageManager.flag("allTheEmphases")?this.model.isNotificationsPanelMessage()||!n||n.count?i:''+i+"":this.model.isNotificationsPanelMessage()?i:t},reveal:function(e){e?this.settings.show.call(this):this.settings.hide.call(this)},dimensions:function(){return{width:this.$el.outerWidth(),height:this.$el.outerHeight()}},displayed:function(e){e=e||0,this.markRead(e),this.model.displayed()},markRead:function(e){var t=this.$el.find(".message"),i=this;e=void 0!==e?e:1500,t.hasClass("is-unread")&&window.setTimeout(function(){i.model.isNotificationsPanelMessage()&&i.broadcast("nyt:messaging-count-received",-1),t.removeClass("is-unread").addClass("is-read")},e)},showOnce:function(){this.model.showOnce()},acknowledged:function(t){var i=e(t.currentTarget).attr("href");t.preventDefault(),this.settings.dismissAcknowledged&&this.model.acknowledged(),this.local(this,"nyt:messaging-message-view-acknowledged",this),i=this.trackingAppendParams(i,{action:"Click",contentCollection:this.model.get("sub_type")||"",contentID:this.model.get("id")}),i!==window.location.href?window.location.href=i:window.location.reload()},expired:function(){this.model.expired(),this.local(this,"nyt:messaging-message-view-expired",this)},dismissed:function(e){this.model.dismissed(),this.local(this,"nyt:messaging-message-view-dismissed",this),e.preventDefault()},popupDismissed:function(){this.model.setRead(),this.markRead(0)},popupAcknowledged:function(){this.model.setRead(),this.markRead()}});return a}),define("shared/messaging/models/message",["backbone/nyt","underscore/nyt","foundation/models/base-model","foundation/models/page-storage"],function(e,t,i,n){"use strict";var s=i.extend({defaults:{display_type_id:1,id:"",title:"",status:"new",sub_type:"",label:"",pub_date:"",start_time:"",end_time:"",links:[],buttons:[],payload:{},message_type:"",thumb:!1,comment_body:!1,timestamp:!1,location:"",unread:!0,version:1},initialize:function(){var e,t=this.get("display_type_id"),i=this.get("start_time"),n=this.get("version"),s=5===t,a=this.getPrimaryLink();s&&n>1?(e=this.get("last_modified"),this.set("timestamp",e)):this.set("timestamp",i),this.isNotificationsPanelMessage()&&this.set({unfollowText:s?"Stop receiving":"Unfollow",confirmText:s?"Turn off":"Unfollow",abortText:s?"Cancel":"Keep following",confirmedText:s?"You will no longer receive":"You are no longer following"}),s&&this.set({following:"comment notifications",tag:"follow.comment-notifications"}),this.isNotificationsPanelMessage()&&void 0===this.get("popup_unread")&&this.set("popup_unread",!0),a&&this.set("link",a)},showOnce:function(){this.setRead(),this.saveToLocalStorage()},setStatus:function(e){this.set("status",e)},displayed:function(){this.set("unread",!1),this.set("status","displayed")},acknowledged:function(){this.set("unread",!1),this.set("status","acknowledged"),this.saveToLocalStorage()},expired:function(){this.set("unread",!1),this.set("status","expired"),this.saveToLocalStorage()},dismissed:function(){this.set("unread",!1),this.set("status","dismissed"),this.saveToLocalStorage()},getPrimaryLink:function(){var e=this.get("links");return e&&e[0]&&e[0].url?e[0].url:null},applyMetadata:function(e){var t,i,n;e&&(i=e[0],n=e[2],this.set("version",i),this.set("unread",n),e.length>3&&(t=e[3],this.set("popup_unread",t)))},updateProperties:function(e){var t,i,n,s,a=["byline","comment_body","display_name","display_location","emphasis","end_time","following","headline","last_modified","links","sub_type","tag","thumb","timestamp","title","link"];if(e)for(t=0;t0&&void 0!==l[0].offset&&l[0].count&&(r.emphasize=l),d&&d.length>0&&void 0!==d[0].offset&&d[0].count&&(r["link-text"]=d),t.isEmpty(r))return!1;for(e in r)if(n=r[e],n&&n.length>0)for(i=0;i=5}});return s}),define("shared/messaging/collections/messages",["jquery/nyt","underscore/nyt","backbone/nyt","foundation/collections/base-collection","foundation/views/websockets-transport","shared/messaging/models/message","foundation/hosts","foundation/cookies","foundation/models/page-storage"],function(e,t,i,n,s,a,o,r,l){"use strict";var d=n.extend({model:a,url:o.messagingHost+"/svc/message/v1/list/global.json",pageStorageKey:"messaging",defaultSettings:{webSockets:!0,longPoll:!1,fauxLongPoll:!1,interval:10,cachePullDelay:5},initialize:function(e){this.cleanLocalStorage(),this.settings=t.extend({},this.defaultSettings,e),t.bindAll(this,"fetch","fetchSuccess","handleSave","stopSaving"),this.received={},this.serverSaveQueue=[],this.statusFragments={},this.beingProcessed=!1,this.followStarts={},this.lastReceived=!1,this.cachePullOver=!1,this.pageManager.isDomReady()?this.prepareToConnect():this.subscribe(this.pageManager,"nyt:page-ready",this.prepareToConnect),this.subscribe(this,"change:status",this.saveMessageEverywhere),this.subscribe("nyt:messaging-message-state-update",this.saveMessageEverywhere)},prepareToConnect:function(){this.settings.fauxLongPoll=!0,this.settings.webSockets=!1,this.makeHTTPRequest()},initWebSockets:function(){var t=r.readCookie("NYT-S")||"";s.registerClient({name:"messaging",collection:this,fabrikApp:"hermes.push",cookies:{"nyt-s":t},handleMessage:this.handleMessage,notifyOnError:e.noop,handleFailover:this.switchToHTTP})},makeHTTPRequest:function(){var e=this;this.url=o.messagingHost+"/svc/message/v1/list/global.json",this.fetch({success:function(t,i){i&&i.results&&(i=i.results.messages),e.fetchSuccess(t,i)},error:function(){}})},switchToHTTP:function(e){e.settings.fauxLongPoll=!0,e.settings.webSockets=!1,e.stopSaving(),e.makeHTTPRequest()},sync:function(e,t,n){return this.settings.longPoll?(n.timeout=2e3,i.sync(e,t,n)):(n.cache=!1,i.sync(e,t,n))},parse:function(e){return e&&e.results?e.results.messages:void 0},handleMessage:function(e,t){var i;t.websocketConnected||t.handleSave(),e.body&&(i=JSON.parse(e.body),t.fetchSuccess(t,i))},fetchSuccess:function(e,i){var n,s,a,o,r,l,d={},c=e||this;if(i&&!t.isArray(i)&&(i=[i]),i)for(n=0,s=i.length;s>n;n+=1)l=this.preprocessMessage(i[n]),l&&(a=l.get("id"),o=l.get("title"),c.add(l),r=this.categorizeMessage(l),d[r]=d[r]||[],this.received[a]=o,d[r].push(l));if(this.settings.fauxLongPoll&&window.setTimeout(function(){c.makeHTTPRequest()},1e3*c.settings.interval),t.isEmpty(d))return!1;for(r in d)c.trigger(r,d[r])},preprocessMessage:function(e){var t;return this.cachePullOver||this.checkCachePullEnd(),this.interceptFollows(e)&&this.ensureMessageID(e)&&this.interceptFragments(e)&&this.ensureUniqueTitles(e)&&(t=this.handleUpdateableData(e))?this.ensureActive(t):!1},interceptFollows:function(e){return e.follows?(t.isEmpty(this.followStarts)&&(this.followStarts=e.follows),this.broadcast("nyt:messaging-follow-data-received",e.follows),!1):e},ensureMessageID:function(e){return e.id||e.messageId?e:!1},interceptFragments:function(e){return e.title?e:(this.isExpired(e)||this.updateMessageData(e.messageId,this.extractMessageMetadata(e)),!1)},ensureUniqueTitles:function(e){return 5!==e.display_type_id&&this.titleExists(e.title)?!1:e},handleUpdateableData:function(e){var t,i,n;if(this.settings.fauxLongPoll)return new a(e);if(this.statusFragments[e.id]?(t=this.statusFragments[e.id],delete this.statusFragments[e.id]):this.get(e.id)&&(t=this.extractMessageMetadata(this.get(e.id))),t){if(i=this.extractMessageMetadata(e),n=this.unionOfState(t,i),n.toString()===t.toString()&&this.get(e.id))return!1;if(e=new a(e),this.get(e.id))return this.updateMessageData(e.id,n,e),!1;e.applyMetadata(n)}return e=e.get?e:new a(e)},ensureActive:function(e){return this.isExpired(e)||this.isInactive(e)||this.isInLocalStorage(e)||this.isBeforeSubscribed(e)?!1:e},categorizeMessage:function(e){var t,i=e.get("display_type_id");switch(i){case 1:e.get("label")||e.set("label","Breaking News"),t="nyt:messaging-breaking-news-received";break;case 2:e.get("label")||e.set("label","Account Alert"),t="nyt:messaging-account-alert-received";break;case 3:e.get("label")||e.set("label","Live Video"),t="nyt:messaging-video-received";break;case 4:t="nyt:messaging-velcro-received";break;case 5:t="nyt:messaging-notification-received";break;case 6:t="nyt:messaging-follow-notice-received";break;default:t="nyt:messaging-message-received"}return t},isExpired:function(e){var t,i=e.get?e.get("end_time"):e.end_time,n=(new Date).getTime();return i?(t=new Date(1e3*i).getTime(),n>t):void 0},titleExists:function(i){var n=t.values(this.received);return e.inArray(i,n)>-1},isInactive:function(e){return e&&e.get?!e.get("unread")&&!e.isNotificationsPanelMessage():!0},isBeforeSubscribed:function(e){var t,i=e.get("tag");return(this.pageManager.flag("unfollowComments")||5!==e.get("display_type_id"))&&e.isNotificationsPanelMessage()?(i&&(t=this.followStarts[i]),t&&t.start?t.start>e.get("start_time"):!0):!1},handleSave:function(){var e;for(this.websocketConnected=!0;this.serverSaveQueue.length>0;)e=this.serverSaveQueue.shift(),this.saveMessageToFabrik(e)},stopSaving:function(){this.websocketConnected=!1},unionOfState:function(e,t){var i,n,s=e[1],a=e[0]>t[0]?e[0]:t[0],o=e[2]&&t[2];return e.length>3&&(n=e[3]&&t[3]),e[0]!==t[0]&&5===s&&(o=!0),i=[a,s,o],void 0!==n&&i.push(n),i},updateMessageData:function(e,t,i){var n,s,a=this.get(e)?this.extractMessageMetadata(this.get(e)):this.statusFragments[e];return a?(s=this.unionOfState(t,a),void(s.toString()!==a.toString()&&(this.get(e)?(n={id:e,update:s,message:i},this.broadcast("nyt:messaging-existing-message-update",n)):this.statusFragments[e]=s))):void(this.statusFragments[e]=t)},isInLocalStorage:function(i){var n=[],s=[],a=l.get(this.pageStorageKey),o=i.get("id").toString();return a?(n=a.split(","),s=t.map(n,function(e){return e.split("-")[0]}),e.inArray(o,s)>-1):!1},cleanLocalStorage:function(){var e,t,i,n,s,a,o,r=l.get(this.pageStorageKey);if(r)for(e=r.split(","),i=0;i7&&this.deleteInLocalStorage(t))},deleteInLocalStorage:function(e){var t=l.get(this.pageStorageKey),i=new RegExp(e+",?"),n=t.replace(i,"");l.set(this.pageStorageKey,n)},saveMessageEverywhere:function(e){e&&(this.websocketConnected?this.saveMessageToFabrik(e):this.serverSaveQueue.push(e))},saveMessageToFabrik:function(e){var t,i=e.get("popup_unread"),n=e.get("display_type_id"),a=6===n;(this.allowedToSend(e)||!this.pageManager.flag("limitFabrikSave"))&&(t={status:e.get("status"),messageId:e.get("id"),version:e.get("version")||1,date:(new Date).getTime(),start_time:e.get("start_time"),end_time:e.get("end_time"),display_type_id:n,unread:e.get("unread")},a&&(t.tag=e.get("tag")),void 0!==i&&(t.popup_unread=i),this.settings.webSockets&&s.publish({action:"send",client_app:"hermes.push",message:t}))},extractMessageMetadata:function(e){var t,i=e.version||e.get("version")||1,n=e.display_type_id||e.get("display_type_id"),s=e.get?e.get("unread"):e.unread,a=e.get?e.get("popup_unread"):e.popup_unread;return void 0===s&&(s=!0),t=[i,n,s],void 0!==a&&t.push(a),t},allowedToSend:function(e){var t=e.get("display_type_id");return 4===t||5===t||6===t?!0:!1},checkCachePullEnd:function(){var e=(new Date).getTime();this.lastReceived||(this.lastReceived=e),e-this.lastReceived>1e3*this.settings.cachePullDelay?(this.cachePullOver=!0,this.broadcast("nyt:messaging-cache-pull-over",e)):this.lastReceived=e}});return d}),define("shared/messaging/instances/messages",["shared/messaging/collections/messages"],function(e){"use strict";return new e}),define("shared/messaging/views/messenger-mixin",["jquery/nyt","underscore/nyt","shared/messaging/views/message","shared/messaging/instances/messages","shared/messaging/templates"],function(e,t,i,n,s){"use strict";var a={template:s.messenger,mixinSettings:{id:null,notifyWhen:null,messageType:null,parent:null,template:"message",newestFirst:!0,closeButton:!0,expiration:!1,animationSpeed:200,expirationAfterPause:null,fadeOutDelay:1500,dismissAcknowledged:!0,trackingVersion:""},events:{"click .action-link":"trackLinkClicks","click .action-button":"trackLinkClicks"},initialize:function(e){this.options=t.extend({},this.mixinSettings,this.defaultSettings,e),this.subscribe(this,"nyt:messaging-message-rendered",this.afterMessageReceived),this.subscribe(this,"nyt:messaging-message-removed",this.afterMessageRemoved),this.subscribe(this,"nyt:messaging-message-"+this.options.id+"-displayed nyt:messaging-message-cleared",this.addLastMessageClass),this.subscribe(this,"nyt:messaging-message-"+this.options.id+"-displayed",this.trackImpressions),this.delegateEvents(),this.collection=n,this.active={messages:{}},this.notActive={messages:{}},this.received={messages:{}},this.newestTime=0,this.oldestTime=1/0,this.pageManager.isDomReady()?this.render():this.subscribe(this.pageManager,"nyt:page-ready",this.render),this.trackingBaseData={module:"Notification",version:this.options.trackingVersion,region:"FixedTop"},this.local(this,"nyt:messaging-messenger-initialized")},render:function(){return this.$parent=this.options.parent?this.options.parent():this.$body,this.rendered||(this.$el.hide().addClass(this.options.id).append(this.template(this.options)),this.$parent.prepend(this.$el),this.rendered=!0,this.local(this,"nyt:messaging-messenger-rendered"),this.prepareView(),this.subscribe(this.collection,this.options.notifyWhen,this.notify)),this},notify:function(i){var n,s,a=this,o=[];t.each(i||[],function(e){s=e.get("id"),s&&o.push(e)}),n=o.length>0?function(){a.createMessageViews(o)}:e.noop,this.pageManager.isDomReady()?n():this.subscribe(this.pageManager,"nyt:page-ready",t.debounce(n,0))},createMessageViews:function(e){return e&&t.each(e||[],function(e){var t;t=new i({model:e,template:this.options.template,closeButton:this.options.closeButton,dismissAcknowledged:this.options.dismissAcknowledged}),this.subscribe(t,"nyt:messaging-message-view-expired",this.removeMessage),this.subscribe(t,"nyt:messaging-message-view-dismissed",this.removeMessage),this.subscribe(t,"nyt:messaging-message-view-dismissed",this.trackDismissal),this.addMessage(t)},this),this},addMessage:function(t){var i,n,s,a,o,r,l,d,c,h,u,m;if(t){if(i=t.model.get("id"),n=!0,s=this.options.newestFirst?"prepend":"append",u=t.render().$el,m=this.$(".message-bed"),this.received.messages[i]=t,this.active.messages[i]=t,a=this.countMessages(),this.options.newestFirst&&(o=t.model.get("timestamp"),o>this.newestTime&&(this.newestTime=o),oo){h.after(u);break}t.$el.data("messageId",i),this.local(this,"nyt:messaging-message-rendered",t,a)}},removeMessage:function(e){var t,i;e&&(t=e.model.get("id"),this.notActive.messages[t]=e,this.active.messages[t]&&delete this.active.messages[t],i=this.countMessages(),this.local(this,"nyt:messaging-message-removed",e,i))},addLastMessageClass:function(){this.$(".message-container").removeClass("last-message-container").last().addClass("last-message-container")},dimensions:function(){return{width:this.$el.find(".message-bed").outerWidth(!0),height:this.$el.find(".message-bed").outerHeight(!0)}},countMessages:function(){return t.size(this.active.messages)},trackImpressions:function(e){var t,i;e=e||"",t=this.received.messages[e],i=this.getcontentCollection(t)||"",this.trackingTriggerImpression("messaging-impression",{action:"Impression",contentCollection:i,eventName:"Impression",contentID:e})},trackDismissal:function(e){var t=e.model.get("id"),i=this.getcontentCollection(e);this.trackingTrigger("messaging-dismissal",{action:"Click",contentCollection:i,eventName:"DismissNotification",contentID:t})},trackLinkClicks:function(t){var i=e(t.currentTarget),n=i.parents(".message-container").data("messageId"),s=this.received.messages[n],a=this.getcontentCollection(s),o=this.trackingAppendParams(i.attr("href"),{action:"Click",contentCollection:a,contentID:n});i.attr("href",o)},getcontentCollection:function(e){return e.model.get("sub_type")?e.model.get("sub_type"):""}};return a}),define("shared/messaging/views/move-furniture-mixin",["jquery/nyt"],function(e){"use strict";var t={moveFurniture:function(t,i,n){var s,a,o,r=this,l=this.options.animationSpeed||200;"add"===i?s="+="+t:"subtract"===i&&(s="-="+t),a=function(e){e.animate({marginTop:s},l)},o=function(t){t.promise().done(function(){e(this).css({marginTop:s})})},n?(this.$el.promise().done(function(){e(this).css("height",s),r.broadcast("nyt:messaging-"+r.options.messageType+"-after")}),this.messagesHeight=this.dimensions().height,this.broadcast("nyt:messaging-"+this.options.messageType+"-move-furniture",o,s,this)):(this.$el.animate({height:s},l,function(){r.messagesHeight=r.dimensions().height,r.broadcast("nyt:messaging-"+r.options.messageType+"-after")}),this.broadcast("nyt:messaging-"+this.options.messageType+"-move-furniture",a,s,this))}};return t}),define("shared/messaging/views/critical-alerts",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/messaging/views/messenger-mixin","shared/messaging/views/move-furniture-mixin"],function(e,t,i,n,s){"use strict";var a=i.registerView("messaging").extend(t.extend({},s,n,{defaultSettings:{messageType:"critical-alerts",parent:function(){return 0===e("#critical-alerts").length&&e("body").prepend('
    '),e("#critical-alerts")}},prepareView:function(){this.messagesHeight=0,this.$el.addClass("alerts"),this.$el.parent("#critical-alerts").addClass("critical-alerts messenger"),this.$el.css("height","0")},afterMessageReceived:function(e,t){var i,n=0;e&&t>0&&(this.broadcast("nyt:messaging-message-"+this.options.id+"-received",e,this),1===t&&(n+=this.openMessenger()),e.reveal(!0),e.displayed(),n+=e.dimensions().height,this.moveFurniture(n,"add"),i=e.model.get("id"),this.local(this,"nyt:messaging-message-"+this.options.id+"-displayed",i),this.createMessageClone(e),this.alignMessages(),this.options.expiration&&this.startTimer(e))},startTimer:function(e){var t;window.setTimeout(function(){t=e.model.get("status"),t&&"dismissed"!==t&&"expired"!==t&&e.trigger("nyt:messaging-message-expired")},60*this.options.expiration*1e3)},openMessenger:function(){var e;return this.$el.show(),this.$el.find(".message-bed").show(),e=this.dimensions().height,this.subscribe(this.pageManager,"nyt:page-resize",this.handleWindowResize),this.broadcast("nyt:messaging-messenger-"+this.options.id+"-opened",this),e},afterMessageRemoved:function(e,t){var i=0;e&&null!==t&&(i+=e.dimensions().height,e.$el.hide(),this.local(this,"nyt:messaging-message-cleared"),0===t&&(i+=this.closeMessenger()),this.broadcast("nyt:messaging-message-"+this.options.id+"-closed",e,this),this.moveFurniture(i,"subtract",!0))},closeMessenger:function(){var t=this.dimensions().height,i=this;return this.$el.hide(),this.$el.find(".message-bed").hide(),this.stopListening(this.pageManager,"nyt:page-resize"),this.broadcast("nyt:messaging-messenger-"+this.options.id+"-closed",this),this.$el.promise().done(function(){e(this).siblings(".alerts").is(":hidden")&&i.broadcast("nyt:messaging-message-"+i.options.messageType+"-closed",i)}),t},createMessageClone:function(e){e.$el.find(".message").clone().addClass("hidden-message").wrapInner('
    ').appendTo(e.$el)},handleWindowResize:function(){var e,t,i,n=this;this.$el.promise().done(function(){t=n.dimensions().height,i=n.messagesHeight,t>i?(e=t-i,n.moveFurniture(e,"add",!0),n.messagesHeight=t):i>t&&(e=i-t,n.moveFurniture(e,"subtract",!0),n.messagesHeight=t),n.alignMessages()})},maxMessageWidth:function(){var e=this.$(".message-container").width();this.$(".message:not(.hidden-message)").css({"max-width":e+"px"})},alignMessages:function(){var e=0,i=this.active.messages;t.size(i)>0&&(t.each(i,function(t){var i=t.$el.find(".hidden-message .message-wrap").outerWidth();i>e&&(e=i)}),this.$el.find(".message:not(.hidden-message)").css({width:e+2+"px"}),this.maxMessageWidth())}}));return a}),define("shared/messaging/views/suggestions",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/messaging/views/messenger-mixin","shared/messaging/views/move-furniture-mixin"],function(e,t,i,n,s){"use strict";var a=i.registerView("messaging").extend(t.extend({},s,n,{nytEvents:{"nyt:masthead-storytheme":"toggleTheme","nyt:masthead-contenttheme":"toggleTheme","nyt:messaging-message-breaking-news-alerts-received":"hideMessenger","nyt:messaging-message-account-alerts-received":"hideMessenger"},defaultSettings:{messageType:"suggestions",closeButton:!1,trackingVersion:"Velcro"},prepareView:function(){this.messagePresent=!1,this.stayHidden=!1,this.$el.addClass("messenger"),this.$el.css("height","0")},afterMessageReceived:function(t){var i,n,s=e("#account-alerts"),a=e("#breaking-news-alerts"),o=e("#masthead");t&&this.$el.is(":hidden")&&s.is(":hidden")&&a.is(":hidden")&&(this.stayHidden||this.messagePresent||(t.reveal(!0),t.displayed(),t.showOnce(),this.messagePresent=!0, o.hasClass("theme-in-story")||(this.openMessenger(),i=this.dimensions().height,this.moveFurniture(i,"add"),n=t.model.get("id"),this.local(this,"nyt:messaging-message-"+this.options.id+"-displayed",n))))},openMessenger:function(){this.$el.show(),this.broadcast("nyt:messaging-messenger-"+this.options.id+"-opened",this)},afterMessageRemoved:function(e){var t=this.dimensions().height;e&&(e.$el.hide(),this.moveFurniture(t,"subtract",!0),this.broadcast("nyt:messaging-message-"+this.options.id+"-closed",e,this),this.closeMessenger())},closeMessenger:function(){this.$el.hide(),this.broadcast("nyt:messaging-messenger-"+this.options.id+"-closed",this)},hideMessenger:function(){var e=this.dimensions().height;this.$el.is(":visible")&&(this.$el.hide(),this.moveFurniture(e,"subtract",!0)),this.broadcast("nyt:messaging-message-"+this.options.id+"-hidden",this),this.stayHidden=!0},showMessenger:function(){var e=this.dimensions().height;this.moveFurniture(e,"add"),this.broadcast("nyt:messaging-message-"+this.options.id+"-shown",this),this.$el.show()},toggleTheme:function(t){var i,n=e("#account-alerts"),s=e("#breaking-news-alerts"),a=t?"hide":"show";"hide"===a&&this.$el.is(":visible")?(i=this.dimensions().height,this.moveFurniture(i,"subtract",!0),this.$el.addClass("theme-changed"),this.$el.hide()):"show"===a&&this.$el.is(":hidden")&&n.is(":hidden")&&!this.stayHidden&&this.messagePresent&&n.is(":hidden")&&s.is(":hidden")&&(this.$el.show(),i=this.dimensions().height,this.moveFurniture(i,"add",!0),this.$el.removeClass("theme-changed")),this.broadcast("nyt:messaging-message"+this.options.id+a,i,this)}}));return a}),define("shared/messaging/views/announcements",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/messaging/views/messenger-mixin"],function(e,t,i,n){"use strict";var s=i.registerView("messaging").extend(t.extend({},n,{nytEvents:{"nyt:page-resize":"adjustWidth"},defaultSettings:{messageType:"announcements",parent:function(){return e("#masthead").find(".container")},animationSpeed:400,expiration:30,expirationAfterPause:3,trackingVersion:"LiveVideo"},prepareView:function(){var e=this,t=1e3*this.options.expirationAfterPause;this.messagePresent=!1,this.timer=null,this.currentMessageId=null,this.widthDiff=45,this.$el.addClass("messenger"),this.adjustWidth(),this.$el.on("mouseenter",function(){e.clearTimer()}),this.$el.on("mouseleave",function(){e.startTimer(t)})},afterMessageReceived:function(e){var t=e.model.get("id"),i=this,n=1e3*this.options.expiration;e&&(this.messagePresent?window.setTimeout(function(){i.afterMessageReceived(e)},n):(e.reveal(!0),e.displayed(),this.local(this,"nyt:messaging-message-"+this.options.id+"-displayed",t),this.messagePresent=!0,this.openMessenger(),this.currentMessageId=t,this.startTimer(n)))},startTimer:function(e){var t=this.currentMessageId,i=this.active.messages[t],n=function(){i&&i.trigger("nyt:messaging-message-expired")};e=e||5e3,this.timer=window.setTimeout(n,e)},clearTimer:function(){window.clearTimeout(this.timer)},openMessenger:function(){var e=this.options.animationSpeed||500;this.$el.stop(!0).show().animate({top:0},e),this.broadcast("nyt:messaging-messenger-"+this.options.id+"-opened",this)},afterMessageRemoved:function(e){e&&this.closeMessenger(e)},closeMessenger:function(t){var i=this.dimensions().height,n=this.options.animationSpeed||500,s=this;t&&this.$el.stop(!0).animate({top:"-"+i},n,function(){e(this).hide(),t.$el.hide(),s.messagePresent=!1,s.broadcast("nyt:messaging-messenger-"+s.options.id+"-closed",s)})},adjustWidth:function(){var t,i=e("#masthead"),n=i.width(),s=this.widthDiff,a=this.pageManager.getCurrentBreakpoint(),o=0;a>1020?(10060>=a&&(o=parseInt(i.css("margin-left"),10)),t=n-(2*s+o),this.$el.css("width",t+"px"),this.$el.css("left",s+"px")):(this.$el.css("left","0px"),this.$el.css("width","100%"))}}));return s}),define("shared/messaging/models/follow",["underscore/nyt","foundation/models/base-model"],function(e,t){"use strict";var i=t.extend({defaults:{tag:"",type:"",following:"",thumb:"",thumbClass:!1,description:"",isFollowing:!1},follow:function(){this.set("isFollowing",!0),this.broadcast("nyt:messaging-following-"+this.id)},unfollow:function(){this.set("isFollowing",!1),this.broadcast("nyt:messaging-unfollowing-"+this.id)},isFollowing:function(){return this.get("isFollowing")},getButtonText:function(){return e.pick(this.toJSON(),["followText","followingText","unfollowText"])}});return i}),define("shared/messaging/views/follow-onboarding",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/modal/views/modal"],function(e,t,i,n){"use strict";var s=i.registerView("messaging").extend({defaults:{featureName:"",extractTemplateData:function(e){return e},animationDuration:1e3,modalDefaults:{className:"",superclass:"",template:function(){},modalOptions:{tailDirection:"up-right",disableBindings:!0,toggleSpeed:200},onShow:function(){},onHide:function(){}},allows:{}},initialize:function(e){var i,n,s,a=this;if(!e.types)return!1;this.modals={},this.settings=t.extend({},this.defaults,e),this.modalSettings={},this.settings.modalOptions=t.extend({},this.defaults.modalOptions,e.modalOptions),this.extractTemplateData=this.settings.extractTemplateData,this.allows=t.extend({},this.defaults.allows,e.allows);for(i in e.types)this.modals[i]={},this.modalSettings[i]=t.extend({},this.settings.modalDefaults,e.types[i]),this.modalSettings[i].modalOptions=t.extend({},this.settings.modalDefaults.modalOptions,e.types[i].modalOptions),n=this.modalSettings[i].modalOptions.addlClasses,s=this.modalSettings[i].className+" "+this.modalSettings[i].superclass,n=n?n+" "+s:s,n.replace(/\s/g,"").length>0&&(this.modalSettings[i].modalOptions.addlClasses=n);return this.subscribe("nyt:"+this.settings.featureName+"-onboarding-show",function(e){a.handleModalOpen(e.type,e)}),this.subscribe("nyt:"+this.settings.featureName+"-onboarding-hide",function(e){a.handleModalClose(e.type,e)}),this},createNewModal:function(i,s){var a=this,o=s?s.binding:void 0,r=s&&s.modalOptions?s.modalOptions:{},l=this.modalSettings[i];return new n(t.extend({},this.settings.modalOptions,l.modalOptions,r,{id:this.settings.featureName+"-tooltip-"+i,modalContent:l.template(a.extractTemplateData(s)),binding:o,openCallback:function(){a.trackOnboardingEvent("impression",i,o),l.onShow(a),e("#notifications-tooltip-"+i).find(".dismiss-button").on("click",function(){a.trackOnboardingEvent("click",i,o)})},closeCallback:function(){l.onHide(a)},instanceData:s}))},showModal:function(e){e&&(this.modals[e].addToPage().open(),this.broadcast("nyt:"+this.settings.featureName+"-onboarding-shown",e))},hideModal:function(e){e&&(this.modals[e].close().removeFromPage(),this.broadcast("nyt:"+this.settings.featureName+"-onboarding-hidden",this),this.modals[e]=!1)},handleModalOpen:function(e,t){(t.force||e&&this.allows[e])&&(this.modals[e]=this.createNewModal(e,t),this.showModal(e),this.allows[e]=!1)},handleModalClose:function(e){e&&!t.isEmpty(this.modals[e])&&this.hideModal(e)},trackOnboardingEvent:function(i,n,s){var a,o,r,l,d,c,h="impression"===i;n&&(r={version:"Follow"+n.toUpperCase().slice(0,1)+n.slice(1),module:"follow",eventName:h?"tooltip-shown":"tooltip-CTA",priority:h},l=["marginalia","next-in","notifications-modal","extended-byline","collection-heading","masthead"],o=t.isString(s)?e(s):s,o&&o.length&&(d=t.find(l,function(e){return o.parents("."+e).length>0})),d&&(r.region=d),a=h?"trackingTriggerImpression":"trackingTrigger",c=h?void 0:"interaction",this[a]("follow-events",r,c))}});return s}),define("shared/messaging/collections/follows",["jquery/nyt","underscore/nyt","foundation/collections/base-collection","shared/messaging/models/follow","shared/messaging/views/follow-onboarding","shared/messaging/templates","foundation/hosts"],function(e,t,i,n,s,a,o){"use strict";var r=i.extend({model:n,defaultSettings:{},initialize:function(e){this.settings=t.extend({},this.defaultSettings,e),this.followSorts=!1,this.followQueue=[],this.followsInitialized=!1,this.knowsSubscriptionData=!1,this.followLater={},this.followedAlready=!1,this.onboarding=null,this.stateKeys={onboardWelcome:"follow.onboard-welcome",onboardSuggest:"follow.onboard-suggest",onboardConfirm:"follow.onboard-confirm",betaWhitelist:"follow.whitelist"},t.bindAll(this,"createOnboardingInstance","handleOnboardingComplete"),this.pageManager.isDomReady()?this.getFollowables():this.subscribe(this.pageManager,"nyt:page-ready",this.getFollowables),this.subscribe("nyt:messaging-follow-data-received",this.handleFollowingDataReceived),this.subscribe("nyt:messaging-unfollow-tag",this.unsubscribeFromFollowable),this.subscribe("nyt:messaging-follow-tag",this.subscribeToFollowable),this.subscribe("nyt:notifications-onboarding-complete",this.handleOnboardingComplete),this.subscribe("nyt:notifications-instantiate-onboarding",this.createOnboardingInstance)},changeSubscription:function(t,i,n){var s=o.followApiHost+"/svc/pushmobile/follow/v0/"+i+".json";e.ajax({url:s,type:t,xhrFields:{withCredentials:!0}}).done(n)},unsubscribeFromFollowable:function(e){var t=this.get(e);t&&t.unfollow(),this.changeSubscription("DELETE",e,function(){})},subscribeToFollowable:function(e){var t=this.get(e);t&&(t.follow(),this.followedAlready||"follow"===e.slice(0,6)||(this.broadcast("nyt:notifications-onboarding-show",{type:"confirm",model:t}),this.followedAlready=!0)),this.changeSubscription("POST",e,function(){})},getFollowables:function(){var i=this;e.ajax({url:o.s1Host+"/messaging/available_follows.jsonp",dataType:"jsonp",jsonpCallback:"followablesCallback"}).done(function(e){var n,s;if(!e)return!1;if(e.followables)for(n in e.followables)s=e.followables[n],s.id=n,i.add(s);i.followSorts=t.omit(e,"followables"),i.followsInitialized=!0,i.local(i,"nyt:messaging-followables-received")})},handleFollowingDataReceived:function(e){var t=this;this.knowsSubscriptionData||!this.pageManager.flag("followingRelease")&&!e[this.stateKeys.betaWhitelist]||(this.knowsSubscriptionData=!0,this.pageManager.setMeta("nyt:messaging-user-has-ability-to-follow","true"),this.broadcast("nyt:messaging-user-has-ability-to-follow"),this.followsInitialized?this.followFollowables(e):(this.followQueue=e,this.subscribe(this,"nyt:messaging-followables-received",this.followFollowables)),this.pageManager.getMeta("nyt:messaging-notifications-panel-active")?this.handleOnboardingReady(e):this.subscribe("nyt:messaing-notifications-panel-active",function(){t.handleOnboardingReady(e)}))},handleOnboardingReady:function(e){e&&!e[this.stateKeys.onboardConfirm]&&"homepage"!==this.pageManager.getApplicationName()&&(this.createOnboardingInstance({following:e}),e[this.stateKeys.onboardWelcome]||this.broadcast("nyt:notifications-onboarding-show",{type:"welcome",binding:".notifications-button"}))},createOnboardingInstance:function(e){!this.onboarding&&e.following&&(this.onboarding=new s({featureName:"notifications",extractTemplateData:function(e){return e&&e.model&&e.model.get?{collectionName:e.model.get("following")}:{}},types:{welcome:{template:a.onboardingIntroducingNotifications,className:"notifications-tooltip",superclass:"tooltip",modalOptions:{tailTopOffset:-8,tailLeftOffset:-1,fixedOverride:!0},onShow:function(t){var i=function(){t.broadcast("nyt:notifications-onboarding-hide",{type:"welcome"})};t.broadcast("nyt:notifications-onboarding-complete","welcome"),"homepage"===t.pageManager.getApplicationName()?t.subscribeOnce("nyt:masthead-hidden",i):t.subscribeOnce("nyt:masthead-storytheme",i),e.cbExtension&&e.cbExtension(t.modals.welcome)}},suggest:{template:a.onboardingSuggestFollow,className:"notifications-tooltip",superclass:"tooltip",modalOptions:{tailDirection:"down-right"},onShow:function(t){t.broadcast("nyt:notifications-onboarding-complete","suggest"),t.modals.suggest.settings.fixedOverride&&t.subscribeOnce("nyt:masthead-storytheme",function(){t.broadcast("nyt:notifications-onboarding-hide",{type:"suggest"})}),e.cbExtension&&e.cbExtension(t.modals.suggest)}},confirm:{template:a.onboardingFirstFollow,className:"notifications-confirmation",modalOptions:{modalTitle:'Success!',hasOverlay:!0,hasCloseButton:!0,tailDirection:"centered"},onShow:function(e){e.broadcast("nyt:notifications-onboarding-complete","confirm")}}},modalOptions:{modalFooter:e.footerOverride||''},allows:{welcome:!e.following[this.stateKeys.onboardWelcome],suggest:!e.following[this.stateKeys.onboardSuggest],confirm:!e.following[this.stateKeys.onboardConfirm]}}),this.broadcast("nyt:messaging-user-onboarding-start"))},followFollowables:function(e){var i,n,s=e||this.followQueue;for(s=t.isArray(s)?s:t.keys(s);s.length>0;)i=s.shift(),n=this.get(i),n?n.follow():this.followLater[i]=!0;this.handleFollowDataReady()},handleFollowDataReady:function(){var e,t=this.createOrderedFullList();e=this.pageManager.flag("moreFollowSuggestions")?t:this.generateFollowSuggestions(),this.broadcast("nyt:messaging-follow-suggestions-received",e),this.broadcast("nyt:messaging-followable-list-received",t)},generateFollowSuggestions:function(e){var i,n,s=[],a=[],o=this.followSorts.weighted||this.followSorts.alpha||t.pluck(this.models,"id"),r=t.clone(o);for(e=e||3;s.length0){if(i=r.shift(),n=this.get(i),!n)continue;n.isFollowing()?a.push(n):s.push(n)}else{if(0===a.length)break;s.push(a.shift())}return s},createOrderedFullList:function(e){var i,n,s,a,o=[];for(a=t.pluck(this.models,"id"),e=e||this.followSorts.alpha||a,i=0;i=this.maxHeight?this.queue[e]=t:(this.queue[e]&&delete this.queue[e],this.active[e]=t,t.$el.addClass("active"),i=this.startTimer(e,s),t.$el.data("timerId",i))},startTimer:function(e,t){var i,n,s=this,a=function(){n=s.active[e],n&&n.close()};return i=window.setTimeout(a,t)},clearTimer:function(e){e&&window.clearTimeout(e)},closeModal:function(e){var t,i=this.active[e];i&&(t=i.$el.data("timerId"),t&&this.clearTimer(t),i.removeFromPage(),this.active[e]&&delete this.active[e],this.queue[e]&&delete this.queue[e]),this.showNext()},closeModals:function(){var e,t;for(e in this.queue)t=this.queue[e],t.removeFromPage(),delete this.queue[e];for(e in this.active)t=this.active[e],t.removeFromPage(),delete this.active[e]},showNext:function(){var e;for(e in this.queue)this.showOrWait(e,this.queue[e])},trackNotificationClose:function(e){e&&e.get&&this.trackingTrigger("notification-events",{module:"notification",version:"NotificationPopup",action:"close",region:"TopBar",contentId:e.get("link"),contentCollection:e.get("tag")},"interaction")}});return r}),define("shared/messaging/views/follow-button",["jquery/nyt","underscore/nyt","foundation/views/base-view","foundation/models/user-data","shared/messaging/templates","shared/messaging/instances/follows"],function(e,t,i,n,s,a){"use strict";var o=i.registerView("messaging").extend({className:"follow-button-container",defaults:{template:s.followButton,followingText:"Following",followText:"Follow",unfollowText:"Unfollow"},initialize:function(e){this.settings=t.extend({},this.defaults,e),this.template=this.settings.template,e.$el&&(this.model=a.get(e.$el.data("collection-id")),this.model||(this.model=a.getModelFromMeta(e.$el.data("collection-id")))),this.model&&(this.settings=t.extend(this.settings,this.model.getButtonText()),this.subscribe("nyt:messaging-following-"+this.model.id,this.updateFollowView),this.subscribe("nyt:messaging-unfollowing-"+this.model.id,this.updateFollowView),e.$el&&e.$el.replaceWith(this.render().$el))},render:function(){var i=this,n=t.extend(i.model.toJSON(),i.getRenderVars()),s=i.template(n);return i.$el.html(s),i.$el.on("click",".follow-button",function(){var t,n;return i.trackFollowButtonClick(e(this)),void 0===i.isUserLoggedIn?!1:i.isUserLoggedIn?(n=i.model.get("tag"),i.model.isFollowing()?i.broadcast("nyt:messaging-unfollow-tag",n):i.broadcast("nyt:messaging-follow-tag",n),!1):(t="Log in to follow "+i.model.get("following"),i.broadcast("nyt:loginmodal-open",{modalTitle:t,registrationPlatform:"follow_button"}),!1)}),i.$el.on("focusin mouseenter",".follow-button",function(){var t=e(this),n=t.parent().parent(),s={tailDirection:"down-right",fixedOverride:!1};t.hasClass("is-following")?t.addClass("active").find(".button-text").html(i.settings.unfollowText):n.hasClass("follow-option")||(n.hasClass("collection-heading")?s.tailTopOffset=3:n.hasClass("collection-meta")?s.tailTopOffset=-2:n.hasClass("collection-header")?(s.tailDirection="up-left",s.tailTopOffset=-2,s.tailLeftOffset=-44):n.hasClass("user-tools-button-group")?(s.tailDirection="up-right",s.tailTopOffset=-2,s.fixedOverride=!0):n.hasClass("extended-byline")&&(s.tailDirection="up-left"),i.broadcast("nyt:notifications-onboarding-show",{type:"suggest",binding:i.$el,model:i.model,modalOptions:s}))}),i.$el.on("mouseleave focusout",".follow-button.is-following",function(){e(this).removeClass("active").find(".button-text").html(i.settings.followingText)}),this},getRenderVars:function(){var e={};return this.model.isFollowing()?(e.buttonText=this.settings.followingText,e.classes="is-following"):(e.buttonText=this.settings.followText,e.classes=""),e},updateFollowView:function(){var e=this.getRenderVars(),t=this.$el.find(".follow-button"),i=t.find(".button-text");t.removeClass("is-following active").addClass(e.classes),i.html(e.buttonText)},trackFollowButtonClick:function(i){var n,s,a=this.model.get("id").split("."),o={module:"follow",state:this.model.isFollowing()?"following":"not-following",action:"click",contentId:a[1]||"",version:a[0]||"",eventName:this.model.isFollowing()?"unfollow":"follow",mData:{textLabel:!0}},r=["marginalia","next-in","notifications-modal","extended-byline","collection-heading","masthead"],l=["notifications","follow-options"];n=t.find(r,function(e){return i.parents("."+e).length>0}),n&&(o.region=n),"notifications-modal"===n&&(s=t.find(l,function(e){return i.parents("."+e).length>0}),s&&(o.state="follow-options"===s?"customize":"notification",o.contentPlacement=e(".notifications-modal ."+s+" .follow-button").index(i)+1)),this.trackingTrigger("follow-events",o,"interaction")},handleUserReady:function(){this.isUserLoggedIn=n.isLoggedIn()}});return o}),define("shared/messaging/views/follow",["underscore/nyt","foundation/views/base-view","shared/messaging/views/follow-button","shared/messaging/templates"],function(e,t,i,n){"use strict";var s=t.registerView("messaging").extend({className:"follow-option",defaults:{template:n.followInfo},initialize:function(t){this.settings=e.extend({},this.defaults,t),this.template=this.settings.template,this.followButton=new i({model:this.model}),this.subscribe("nyt:messaging-following-"+this.model.id,this.updateFollowView),this.subscribe("nyt:messaging-unfollowing-"+this.model.id,this.updateFollowView)},render:function(){var t=e.extend(this.model.toJSON(),{followClass:this.getFollowClass()}),i=this.template(t);return this.$el.html(i).append(this.followButton.render().$el),this},getFollowClass:function(){return this.model.isFollowing()?"following":""},updateFollowView:function(){var e=this.getFollowClass(),t=this.$el.find(".follow-info");t.removeClass("following").addClass(e)}});return s}),define("shared/messaging/views/notifications",["jquery/nyt","underscore/nyt","foundation/views/base-view","foundation/models/user-data","shared/messaging/instances/follows","shared/messaging/views/messenger-mixin","shared/messaging/views/notification-modal","shared/messaging/views/follow","shared/messaging/templates","shared/modal/views/modal"],function(e,t,i,n,s,a,o,r,l,d){"use strict";var c=i.registerView("messaging").extend(t.extend({},a,{defaultSettings:{messageType:"notifications",parent:function(){var t=new d({id:"notifications-modal",binding:".notifications-button",modalTitle:"Notifications",headerContent:"",modalFooter:'

    This is a beta version of notifications. Send feedback »

    ',tailDirection:"up-right",tailTopOffset:-8,tailLeftOffset:-1,width:"360px",toggleSpeed:1,fixedOverride:this.isFixed,openCallback:function(){this.$target.addClass("active"),this.subscribedAlready||(this.subscribe("nyt:comments-panel-opened",this.close),this.subscribe("nyt:loginmodal-open",this.close),"homepage"===this.pageManager.getApplicationName()?this.subscribe("nyt:masthead-hidden",this.close):this.subscribe("nyt:masthead-storytheme",this.close),this.subscribedAlready=!0),this.broadcast("nyt:messaging-notification-archive-opened",this)},closeCallback:function(){this.$target.removeClass("active"),this.broadcast("nyt:messaging-notification-archive-closed")}});return t.addToPage(),e("#notifications-modal").find(".modal-content")},template:"notificationsModal",fadeOutDelay:3e3,trackingVersion:"ReaderActivity",timestampUpdateFreq:3e4,truncateTextHeight:34,isFixed:!0,scrollCheckHeight:15},nytEvents:{"nyt:messaging-notification-archive-opened":"handleArchivePanelOpened","nyt:messaging-notification-archive-closed":"handleArchivePanelClosed","nyt:messaging-count-received":"updateCounter","nyt:messaging-existing-message-update":"updateMessageView","nyt:messaging-critical-alerts-move-furniture":"movePanelForOtherAlerts","nyt:messaging-suggestions-move-furniture":"movePanelForAlerts","nyt:messaging-follow-suggestions-received":"addSuggestedFollows","nyt:messaging-followable-list-received":"createFollowableList","nyt:messaging-cache-pull-over":"setCachePullOver","nyt:messaging-notifications-navigate":"handleNavigationRequired","nyt:messaging-notifications-panel-active":"setupPanel"},events:{"click .unsubscribe-button":"confirmUnfollowIntent","click .unfollow-button":"confirmUnfollowed","click .keep-following-button":"restoreOriginalFollowable","click .undo-action-button":"undoUnfollowFollowable","click .message-link":"handleMessageClicked"},prepareView:function(){t.bindAll(this,"trackArchiveAction"),this.notificationModal=new o,this.$el.find(".message-bed").append(l.notificationsModal({show:"default"})),this.$archivePanel=e("#notifications-modal"),this.$modalContent=this.$archivePanel.find(".modal-content"),this.$notificationsModal=this.$archivePanel.find(".notifications-modal"),this.$notificationsButton=e(".notifications-button"),this.messageCount=0,this.archiveOpen=!1,this.timestampsUpdating=!1,this.sliding=!1,this.maxHeight=parseInt(this.$modalContent.css("max-height"),10),this.isUnfollowing=!1,this.unfollowing={model:void 0,$el:void 0},this.cachePullOver=!1,this.modalsEnabled=!1,this.lastScrollCheck=0,this.unreadMessages=[],this.subscribe(this.notificationModal,"nyt:messaging-notification-modal-clicked",this.handleMessageAcknowledged),this.subscribe(this.notificationModal,"nyt:messaging-notification-modal-closed",this.handleMessageDismissed),this.pageManager.setMeta("nyt:messaging-notifications-panel-active","true"),this.broadcast("nyt:messaging-notifications-panel-active"),this.$el.show(),this.disablePageScrollOnHover()},afterMessageReceived:function(e){var t,i,n=this.$archivePanel.is(":visible");e&&(t=e.model.get("unread"),i=e.model.get("popup_unread"),t&&(this.broadcast("nyt:messaging-count-received",1),this.unreadMessages.push(e),!n&&i&&this.displayPopup(e)),this.hideDefaultNotification(),e.reveal(!0),n&&(this.truncateCommentBodies(),this.markAppropriateMessagesRead()),this.addBottomBorder())},setCachePullOver:function(){this.cachePullOver=!0},displayPopup:function(e){this.cachePullOver&&this.modalsEnabled&&this.notificationModal.render(e),e.model.setPopupRead()},markRead:function(e){var t=this.active.messages[e];t.displayed()},handleMessageAcknowledged:function(e){this.broadcast("nyt:messaging-modal-"+e+"-acknowledged")},handleMessageDismissed:function(e){this.broadcast("nyt:messaging-modal-"+e+"-dismissed")},handleArchivePanelOpened:function(){var e=this;e.archiveOpen=!0,e.timestampsUpdating||(e.updateTimestamps(e),e.timestampsUpdating=setInterval(function(){e.updateTimestamps(e)},e.timestampUpdateFreq)),e.markAppropriateMessagesRead(),e.truncateCommentBodies(),e.addBottomBorder(),e.trackArchiveAction("open")},handleArchivePanelClosed:function(){this.archiveOpen=!1,this.stopUpdatingTimestamps(),this.trackArchiveAction("close"),this.isUnfollowing&&this.restoreOriginalFollowable()},isMessageVisible:function(e){var t,i,n,s,a;return this.$modalContent.find(".follow-options").is(":visible")?!1:(t=this.$modalContent.offset().top,i=t+this.$modalContent.height(),n=e.$el.find(".message-title"),s=n.offset().top,a=s+n.height(),s>=t&&i>=a)},markAppropriateMessagesRead:function(){var t,i,n,s,a,o=this,r=[];for(i=0;i1;o.unreadMessages.length>0&&n&&(o.markAppropriateMessagesRead(),o.lastScrollCheck=t)}),this.watchingWhichMessagesAreSeen=!0)},updateCounter:function(e){var t,i;void 0!==e&&(t=this.messageCount+e,this.messageCount=Math.max(t,0),i={count:this.messageCount,delta:e},this.broadcast("nyt:messaging-notification-count-update",i))},showDefaultNotification:function(){this.$el.find(".default-message").show()},hideDefaultNotification:function(){var e=this.$el.find(".message-default").closest(".message-container");"block"===e.css("display")&&e.hide()},disablePageScrollOnHover:function(){this.$modalContent.on("mousewheel DOMMouseScroll",function(t){var i=0;"mousewheel"===t.type?i=-1*t.originalEvent.wheelDelta:"DOMMouseScroll"===t.type&&(i=40*t.originalEvent.detail),i&&(t.preventDefault(),e(this).scrollTop(i+e(this).scrollTop()))})},addBottomBorder:function(){var t=this.dimensions().height,i=parseInt(this.$modalContent.css("max-height"),10);t>i&&(e("#notifications-modal").find(".modal").addClass("scroll-active"),this.$modalContent.find(".comment-text").data("truncate",!0))},handleMessageClicked:function(t){var i,n,s,a,o;t.preventDefault(),i=e(t.currentTarget),n=i.closest(".message-container"),a=n.data("messageId"),o=this.collection.get(a),s=this.trackingAppendParams(i.attr("href"),{module:"notification",version:"NotificationPanel",action:"click",region:"TopBar",eventName:"click",contentCollection:o?o.get("tag"):"",contentPlacement:this.determineMessagePlacement(n)}),this.handleNavigationRequired(s)},handleNavigationRequired:function(e){var t,i,n,s=window.location.href.split("#")[0]===e.split("#")[0];window.location.href=e,t=e.split("#")[1],t&&s&&(n=t.split("="),i=n[1],"permid"===n[0]&&i&&this.broadcast("nyt:community-commentspanel-open",i))},trackArchiveAction:function(e){this.trackingTrigger("notification-events",{module:"notification",version:"NotificationPanel",action:e,region:"TopBar"},"interaction")},confirmUnfollowIntent:function(t){var i,n,s=e(t.currentTarget).closest(".message-container"),a=this.collection.get(s.data("id"));this.trackInlineUnfollow("dismiss",s,a),this.isUnfollowing&&this.restoreOriginalFollowable(),a.set("originalHTML",s.html()),t.preventDefault(),t.stopPropagation(),i=s.height(),s.css({height:i}),s.find(".unsubscribe-button").remove(),n=l.followConfirmation(a.toJSON()),s.find(".message").replaceWith(n),this.isUnfollowing=!0,this.unfollowing={$el:s,model:a}},confirmUnfollowed:function(t){var i,n=e(t.currentTarget).closest(".message-container"),s=this.collection.get(n.data("id")),a=s.get("tag");this.trackInlineUnfollow("unfollowing",n,s),t.preventDefault(),t.stopPropagation(),this.broadcast("nyt:messaging-unfollow-tag",a),i=l.followUnfollowed(s.toJSON()),n.css({height:"auto"}),n.find(".message").replaceWith(i),this.isUnfollowing=!1},restoreOriginalFollowable:function(t){var i=t?e(t.currentTarget).closest(".message-container"):this.unfollowing.$el,n=t?this.collection.get(i.data("id")):this.unfollowing.model;return t&&(t.preventDefault(),t.stopPropagation()),t&&t.currentTarget&&e(t.currentTarget).hasClass("keep-following-button")&&this.trackInlineUnfollow("keepfollowing",i,n),i.find(".message").replaceWith(n.get("originalHTML")),i.css({height:"auto"}),this.isUnfollowing=!1,n},undoUnfollowFollowable:function(t){var i=e(t.currentTarget).closest(".message-container"),n=this.restoreOriginalFollowable(t),s=n.get("tag");this.trackInlineUnfollow("follow",i,n),this.broadcast("nyt:messaging-follow-tag",s)},updateMessageView:function(e){ var t,i,n=this.received.messages[e.id],s=n.model;t=s.get("unread"),s.applyMetadata(e.update),i=s.get("unread"),e.message&&s.updateProperties(e.message),!t&&i?this.broadcast("nyt:messaging-count-received",1):t&&!i&&this.broadcast("nyt:messaging-count-received",-1),i?(n.$el.detach(),n.render(),this.$el.find(".message-bed").prepend(n.$el),n.reveal(!0),this.archiveOpen&&this.markAppropriateMessagesRead()):n.render().reveal(!0)},movePanelForOtherAlerts:function(e){var t;this.archiveOpen&&(t=this.$archivePanel.find(".notifications-modal"),e(t))},updateTimestamps:function(t){e(".notifications-modal .timestamp").each(function(){var i=e(this),n=1e3*parseInt(i.attr("datetime"),10),s=t.prettyDate(n);s&&i.html(s)})},stopUpdatingTimestamps:function(){this.updating&&(clearInterval(this.updating),this.updating=!1)},addSuggestedFollows:function(e){var t,i,n,s=this,a=s.$el.find(".follow-suggestions");for(i=0;i
    "),n=this.$modalContent.find(".follow-options"),t=0;t"):a.find(".modal-heading").unwrap(),s.$modalContent.removeClass("scroll-active").css({height:n.destinationHeight}).addClass("is-animating"),n.$showing.addClass("is-animating").css({width:n.width,"max-height":s.maxHeight,left:n.moveShowingTo}),n.$toShow.addClass("is-animating").css({width:n.width,left:0}),setTimeout(function(){n.scrollActive&&s.$notificationsModal.addClass("scroll-active"),n.$showing.removeClass("is-animating scroll-active").css({display:"none"}),n.$toShow.removeClass("is-animating scroll-active").css({width:"auto"}),s.$modalContent.removeClass("is-animating").css({height:"auto"}),t&&t()},i)},prepareToAnimateFollows:function(){var e,t,i,n,s,a=this.$modalContent.find(".follow-options"),o=this.$modalContent.width(),r=this.$modalContent.height(),l=this.maxHeight;return n=!1,s=a.is(":hidden"),e=s?this.$el:a,t=s?a:this.$el,this.$modalContent.css({height:r}),l=t.css({display:"inherit",width:o}).height(),l>=this.maxHeight?(t.addClass("scroll-active"),n=!0):this.$notificationsModal.removeClass("scroll-active"),r===this.maxHeight&&e.addClass("scroll-active"),l=l>this.maxHeight?this.maxHeight:l,i=s?-o:o,{$showing:e,$toShow:t,wrapButton:s,destinationHeight:l,moveShowingTo:i,width:o,scrollActive:n}},truncateCommentBodies:function(){var t=this;this.$modalContent.find(".comment-text").each(function(){var i=e(this);i.data("truncate")&&(t.truncateText(i,t.options.truncateTextHeight),i.data("truncate",!1))})},determineMessagePlacement:function(t){return e(".notifications-modal .notifications .message-container:visible").index(t)+1},trackPanelCustomizeToggle:function(t,i){i&&this.trackingTrigger("notification-events",{module:"follow",state:i.hasClass("follow-options")?"customize":"notification",action:"click",version:"NotificationPanel",region:"TopBar",contentId:e(t.currentTarget).hasClass("back-button")?"back-button":"customize-button",eventName:"click"},"interaction")},trackInlineUnfollow:function(e,t,i){var n;e&&(n=i.get("tag").split("."),this.trackingTrigger("notification-events",{module:"follow",state:"notification-unfollow",action:"click",contentId:n[1],version:n[0],eventName:e,region:"TopBar",contentPlacement:this.determineMessagePlacement(t)},"interaction"))},handleUserReady:function(){this.pageManager.flag("followingRelease")&&(this.isUserLoggedIn=n.isLoggedIn(),s.isUserLoggedIn=n.isLoggedIn(),this.setupPanel())},revealBell:function(){this.$notificationsButton.removeClass("hidden")},setupPanel:function(){var e=this;if(this.pageManager.getMeta("nyt:messaging-notifications-panel-active")){if(!this.pageManager.flag("followingRelease"))return this.revealBell(),void(this.modalsEnabled=!0);if(void 0!==this.isUserLoggedIn)return this.isUserLoggedIn?(this.modalsEnabled=!0,this.pageManager.getMeta("nyt:messaging-user-has-ability-to-follow")?void this.revealBell():void this.subscribe("nyt:messaging-user-has-ability-to-follow",function(){e.revealBell()})):(this.revealBell(),void this.handleAnonInteractions())}},handleAnonInteractions:function(){var e=this,t=(new Date).getTime()-6e4;this.broadcast("nyt:notifications-instantiate-onboarding",{following:{"follow.whitelist":{start:t},"follow.onboard-welcome":{start:t}},footerOverride:'',cbExtension:function(t){var i,n,s,a=t.settings.instanceData?t.settings.instanceData.type:null,o="Notification";a&&(i=t.settings.instanceData?t.settings.instanceData.model:null,n="Log in to follow",i&&(n=n+" "+i.get("following"),s="follow_button",o="Follow"),t.$el.find(".login-button").on("click",function(t){t.stopPropagation(),e.broadcast("nyt:notifications-onboarding-hide",{type:a}),e.trackingTrigger("tagx-auth-interaction",{module:o,state:e.isUserLoggedIn?"logged in":"logged out",eventName:"login click | "+o}),e.broadcast("nyt:loginmodal-open",{modalTitle:n,registrationPlatform:s||"follow_bell",moduleName:o})}))}}),this.$notificationsButton.hover(function(){e.anonOnboardingShown||(e.anonOnboardingShown=!0,e.broadcast("nyt:notifications-onboarding-show",{type:"welcome",binding:".notifications-button",force:!0}))}),this.$notificationsButton.click(function(t){t.stopPropagation(),e.broadcast("nyt:loginmodal-open",{modalTitle:"Log in to follow",registrationPlatform:"follow_bell",moduleName:"Notification"})})}}));return c}),define("shared/messaging/instances/messaging",["foundation/views/page-manager","shared/messaging/views/critical-alerts","shared/messaging/views/suggestions","shared/messaging/views/announcements","shared/messaging/views/notifications"],function(e,t,i,n,s){"use strict";var a=e.getMeta("nyt:messaging-user-has-ability-to-follow"),o=function(){e.flag("followFeature")&&!e.$html.hasClass("has-cover-media")&&new s({id:"notifications",notifyWhen:"nyt:messaging-notification-received nyt:messaging-follow-notice-received"})};(!e.$html.hasClass("app-interactive")||e.$html.hasClass("page-interactive-default"))&&!e.$html.hasClass("lt-ie9")&&!e.$html.hasClass("template-minimal")&&e.getCurrentBreakpoint()>=120&&(e.getCurrentBreakpoint()>=1010&&(new i({id:"suggestions",notifyWhen:"nyt:messaging-velcro-received"}),new t({id:"breaking-news-alerts",notifyWhen:"nyt:messaging-breaking-news-received",expiration:20,dismissAcknowledged:"homepage"!==e.getApplicationName(),trackingVersion:"BreakingNews"}),new t({id:"account-alerts",notifyWhen:"nyt:messaging-account-alert-received",expiration:10,trackingVersion:"UserAccounts"}),new n({id:"announcements",notifyWhen:"nyt:messaging-video-received"})),a||e.flag("followingRelease")?o():e.listenToOnce(e,"nyt:messaging-user-has-ability-to-follow",o))}),define("shared/mediaviewer/templates",["underscore/nyt"],function(_){var templates={};return templates.bigAd3=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.continueButton=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.image=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='";return __p},templates.mediaViewer=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.mediaViewerIcon=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n\n
    ';return __p},templates.video=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='";return __p},templates}),define("shared/mediaviewer/views/media-viewer",["jquery/nyt","underscore/nyt","backbone/nyt","foundation/collections/base-collection","foundation/views/base-view","shared/mediaviewer/templates"],function(e,t,i,n,s,a){"use strict";var o=s.registerView("media-viewer").extend({templates:a,collection:new n,speed:400,assetIndex:0,stepsTaken:0,marginForImage:160,clickableElements:["img","nav div",".caption",".credit",".media-viewer-video",".video-share span",".video-share i.icon",".video-share a",".image-navigation"],candidateClass:"media-viewer-candidate",overlayClass:"media-action-overlay",slideshowClass:"slideshow.promo.launch-media-viewer",isVideo:!1,videoId:0,contentType:"",$prevArrow:e(),$nextArrow:e(),settings:{minWidth:700,minHeight:550,topMargin:60,basicMargin:30,captionGutter:15,navGutter:45,captionRatio:.8,imageAspectRatio:1.3,mobileBreakpoint:765},events:{"click .media-viewer-previous":"prevAsset","click .media-viewer-next":"nextAsset","click .image-navigation.previous":"prevAsset","click .image-navigation.next":"nextAsset",click:"decideClose","mouseenter .image-navigation.previous":"lightPrevArrow","mouseleave .image-navigation.previous":"unLightPrevArrow","mouseenter .image-navigation.next":"lightNextArrow","mouseleave .image-navigation.next":"unLightNextArrow"},nytEvents:{"nyt:page-key-esc":"forceClose","nyt:page-resize-after":"renderFromResize","nyt:mediaviewer-left":"prevAsset","nyt:mediaviewer-right":"nextAsset","nyt:open-media-viewer":"renderForEmbeddedSlideshow","nyt:route:slideshow":"initFromDeepLink"},initialize:function(){t.bindAll(this,"renderForSlideshow","renderFromSymbol","renderFromClick","writeVideoTemplateToViewer","nextAsset","prevAsset","pinchClose"),this.pageManager.addRoute("slideshow/:slideshowId(/:imageId)","slideshow"),this.setElement(this.templates.mediaViewer()),this.subscribe("nyt:slideshow-ad-render",this.renderSlideshowAd)},handleDomReady:function(){this.$body.on("click","."+this.slideshowClass,this.renderForSlideshow).on("click","."+this.overlayClass,this.renderFromSymbol).on("click","."+this.candidateClass,this.renderFromClick),this.hammer&&(this.hammer(this.el).on("swiperight",this.prevAsset),this.hammer(this.el).on("swipeleft",this.nextAsset),this.hammer(this.el).on("pinch",this.pinchClose)),this.$candidates=e("."+this.candidateClass),this.$headline=this.$(".media-viewer-headline"),this.$wrapper=this.$(".media-viewer-wrapper"),this.$counter=this.$(".media-viewer-counter"),this.$nav=this.$(".media-viewer-nav"),this.$body.find("#main").append(this.$el),this.$prevArrow=this.$el.find(".media-viewer-previous"),this.$nextArrow=this.$el.find(".media-viewer-next"),this.addViewerIcon(),this.trackingBaseData={action:"click",contentCollection:this.pageManager.getMeta("article:section"),region:"Body"},this.pageManager.checkRoute()},initFromDeepLink:function(t){var i,n=t[0],s=t.length>1?parseInt(t[1],10):null,a=e("#slideshow-"+n);return a.size()>0?(this.getAssetsFromJSON(a),s&&(i=this.collection.findWhere({id:s})),"undefined"==typeof i&&(i=this.collection.at(0)),this.$el.addClass("theme-dark"),this.changeLoader("dark"),this.contentType="slideshow",this.assetIndex=this.collection.indexOf(i),void this.render(i)):void 0},addViewerIcon:function(){var t=this.templates.mediaViewerIcon({classes:this.overlayClass});this.$candidates.each(function(){e(this).after(t)})},changeLoader:function(e){var t=this.$el.find(".loader"),i="loader-t-logo-32x32-ecedeb-ffffff",n="loader-t-logo-32x32-333333-121212";"dark"===e?t.removeClass(i).addClass(n):"light"===e&&t.removeClass(n).addClass(i)},getDimension:function(e,t,i,n){var s=this.pageManager.getViewport(),a=s.width-i,o=s.height-n;return e>a&&(t*=a/e,e=a),t>o&&(e*=o/t,t=o),{width:Math.round(e),height:Math.round(t)}},getAssetsFromJSON:function(i){var n=i.find("script").get(0).innerHTML,s=e.parseJSON(n),a=s.id;this.headline=s.headline,s=t.map(s.imageslideshow.slides,function(e){var t,i="",n="";return e&&e.image_crops&&(t=e.image_crops,t.superJumbo?i=t.superJumbo.url:t.jumbo?i=t.jumbo.url:t.articleLarge?i=t.articleLarge.url:t.slide?i=t.slide.url:t.popup&&(i=t.popup.url)),e&&e.caption&&(e.caption.full?n=e.caption.full:e.caption["short"]&&(n=e.caption["short"])),{id:e.data_id,src:i,caption:n,credit:e.credit}}),this.collection.reset(s),this.collection.slideshowId=a},getAssetsFromDOM:function(){var i,n=[];this.$candidates.each(function(){i={src:e(this).data("mediaviewer-src"),caption:e(this).data("mediaviewer-caption"),credit:e(this).data("mediaviewer-credit")},n.push(i)}),this.collection.reset(t.uniq(n,function(e){return e.src}))},broadcastAd:function(){var e="",t=0===this.assetIndex,i=this.collection.length,n=this.end();if(t&&!n)e="Slideshow_int";else{if(!(i>3&&n))return!1;e="Slideshow_end"}return this.broadcast("nyt:slideshow-ad",{el:this.$wrapper,position:e}),this.adRendered},renderSlideshowAd:function(t){var i,n,s,a,o,r,l;"slideshow"===this.contentType&&(i=this,n=this.pageManager.getCurrentBreakpoint(),s=this.$wrapper.find(".ad-wrapper"),a=2*parseInt(s.css("padding-left"),10),o=parseInt(t.get("width"),10),r=parseInt(t.get("height"),10),l=e(this.templates.continueButton({message:this.end()?"RETURN TO ARTICLE":"CONTINUE SLIDE SHOW"})),this.$adBtn=l,s.append(l).css({width:o,height:r,"margin-left":-(o+a)/2,"margin-top":-(r+a)/2}),this.$nav.find(".media-viewer-previous").hide(),this.$counter.hide(),this.$headline.text(this.headline||""),this.adRendered=!0,this.toggleLoader(!1),this.start(),this.active(!0),l.show().on("click",function(e){e.stopPropagation(),e.preventDefault(),i.renderAfterAd()}),n>=1e3&&1030>n&&l.hide())},renderAfterAd:function(){this.dismissAd(),this.render()},dismissAd:function(){this.$adBtn.off("click").hide(),this.$wrapper.html(""),this.$counter.show(),this.$nav.find(".media-viewer-previous").show(),this.adRendered=!1},renderForSlideshow:function(t){var i;e(t.target).hasClass("skip-to-text-link")||(i=e(t.currentTarget),"modal"===i.data("media-action")&&(this.assetIndex=0,this.$el.addClass("theme-dark"),this.changeLoader("dark"),this.getAssetsFromJSON(i),this.contentType="slideshow",this.render()))},renderForEmbeddedSlideshow:function(e,t){this.assetIndex=t,this.$el.addClass("theme-dark"),this.changeLoader("dark"),this.getAssetsFromJSON(e),this.contentType="embedded-slideshow",this.render()},renderFromSymbol:function(t){e(t.currentTarget).siblings("."+this.candidateClass).trigger("click")},renderFromResize:function(){var t;this.adRendered||(this.isActive&&this.isVideo?(t=e("figure.media-viewer-video"),this.handleVideo(t)):this.isActive&&this.render())},renderFromClick:function(t){var i;this.getAssetsFromDOM(),i=this.collection.findWhere({src:e(t.target).data("mediaviewer-src")}),this.assetIndex=this.collection.indexOf(i),this.contentType="images",this.render(i)},renderForVideo:function(e,t){this.videoModel=e,this.videoCallback=t,this.$el.addClass("theme-dark"),this.changeLoader("dark"),this.isVideo=!0,this.render(e)},writeVideoTemplateToViewer:function(){var t=this.videoModel?this.videoModel.get("videoId"):this.videoId,i=this.$body.find("figure[data-videoid="+t+"] .video-credit"),n=e(this.templates.video({videoId:t,credit:i.html()}));this.handleVideo(n),this.$wrapper.html(n),this.pageManager.isMobile()?"function"==typeof this.videoCallback&&this.videoCallback():this.broadcast("nyt:mediaviewer-open")},render:function(e){var t=this;if(t.toggleLoader(!0),!this.broadcastAd()){if(this.isVideo)this.renderVideo();else{if(this.end())return t.toggleLoader(!1),void this.close(!0);this.renderImage(e)}this.active(!0),this.$body.css("overflow","hidden"),this.$document.on("touchmove",function(e){e.preventDefault()}),this.setCounter(),this.toggleNav()}},renderVideo:function(){var e,t=this;this.pageManager.isMobile()?(this.start(),this.writeVideoTemplateToViewer()):this.start(this.writeVideoTemplateToViewer),t.toggleLoader(!1),e={module:"Video",version:"MediaViewer",eventName:"PlayVideo"},this.trackingTrigger("media-viewer-play-video",e),this.trackingComscorePVC(e)},renderImage:function(t){var i,n,s,a,o,r=this,l=this.collection.slideshowId;t=t||this.collection.at(this.assetIndex),i=t.get("id"),this.isActive||(this.start(),this.$headline.text(this.headline||""),this.broadcast("nyt:mediaviewer-open"),a={module:this.getTrackingModule(),version:this.getTrackingVersion(),eventName:this.getTrackingOpenEventName(),mdata:{currentSlide:this.assetIndex+1,totalSlides:this.collection.length}},this.trackingTrigger("media-viewer-opened",a),this.trackingComscorePVC(a)),n=e(this.templates.image({src:t.get("src"),caption:t.get("caption"),credit:t.get("credit")})),s=e(this.templates.bigAd3()),n.find("img").load(function(){r.handleImg(n,s),r.toggleLoader(!1)}),l&&i&&(o="slideshow/"+l+"/"+i,this.pageManager.navigateRoute(o,{trigger:!1,replace:!0})),this.$wrapper.html(n),this.$wrapper.append(s)},start:function(e){e=e||function(){},this.$el.fadeIn(this.speed,e)},toggleNav:function(){var e=this.$("nav"),t=this.isMobile();1===this.collection.length||this.isVideo||t&&this.pageManager.flag("mobileMediaViewer")?e.hide():e.show()},toggleLoader:function(e){var t=this.$el.find(".loader-container");e?t.show():t.hide()},handleImg:function(i,n){var s,a,o,r,l,d,c,h,u,m,g,p,f=this.settings,v=i.closest(".media-viewer"),b=i.find("img"),y=v.find("figcaption.caption"),w=e("nav.media-viewer-nav"),_={},k=this.getElementDimensions(w),C=this.getElementDimensions(b),T=t.extend({},this.pageManager.getViewport()),x=T.width,S=this.$html.hasClass("tone-feature"),A=C.width/C.height,M=T.width/(T.height-k.height-f.topMargin-f.basicMargin),P=A>M?"below":"right",I=this.isMobile();I&&this.pageManager.flag("mobileMediaViewer")?(v.addClass("mobile"),i.after(y),this.changeLoader("dark"),T={width:window.innerWidth,height:window.innerHeight},m=T.width/T.height,u=m>A?{width:"auto",height:"100%"}:{width:"100%",height:"auto"},C=this.getElementDimensions(b),l=T.height/2-C.height/2,r=T.width/2-C.width/2,i.css({visibility:"visible",top:l+"px",left:r+"px"}).css(u),b.animate({opacity:1},this.speed),y.css({display:"block",opacity:0}).animate({opacity:1},this.speed)):(this.pageManager.flag("mobileMediaViewer")&&(v.removeClass("mobile"),i.append(y),this.changeLoader("light")),T.height=T.height<150?150:T.height,T.width=T.width<100?100:T.width,this.$headline.css({"margin-right":0}),x>=1280&&S&&"slideshow"===this.contentType&&(T.width=x-330,this.$headline.css({"margin-right":330}),this.loadBigAd(),n.show(),A>f.imageAspectRatio&&(P="below")),"right"===P?(c=this.getImageSizeAvailable(y,k,P,T),h=this.getCaptionSize(y,k,P),_=this.getScaledImage(C,c),a=c.width/c.height,a>A?(g=_.widthh.width?(r=Math.round((T.width-_.width)/2),i.css({left:r,top:f.topMargin}),n.css({"margin-top":f.topMargin}),o=r<2*(k.width+f.basicMargin),d=f.topMargin+c.height+f.navGutter+k.height+f.basicMargin>T.height,s=o&&d?k.height+f.navGutter+f.basicMargin:f.basicMargin,y.css({bottom:s,width:h.width})):(r=Math.round((T.width-(_.width+h.width))/2),i.css({left:r,top:f.topMargin}),n.css({"margin-top":f.topMargin}),y.css({bottom:f.basicMargin,width:h.width,height:h.height}))):(l=Math.round((T.height-_.height-f.topMargin)/2),l=Math.max(l,f.topMargin),r=Math.round((T.width-(c.width+h.width+f.captionGutter))/2),g=c.width_.height&&y.css({height:_.height}))):(h=this.getCaptionSize(y,k,P),c=this.getImageSizeAvailable(y,k,P,T),_=this.getScaledImage(C,c),a=c.width/c.height,a>A?(r=Math.round((T.width-_.width)/2),i.css({height:c.height,width:_.width,left:r,top:f.topMargin}),n.css({"margin-top":f.topMargin}),y.css({"max-width":550,width:c.width-k.width,"margin-settings.topMargin-top":f.captionGutter})):(r=Math.round((T.width-c.width)/2),l=Math.round((T.height-(_.height+h.height+f.captionGutter)-f.topMargin)/2),l=Math.max(l,f.topMargin),i.css({height:_.height,width:c.width,left:r,top:l}),n.css({"margin-top":l}),y.css({width:c.width,"margin-topmargin-top":f.captionGutter}))),i.css({visibility:"visible"}),n.css({width:300,height:250,"margin-left":30,"margin-right":30,"float":"right"}),y.css({display:"block",opacity:0}).animate({opacity:1},this.speed),b.animate({opacity:1},this.speed))},isMobile:function(){return e(window).width()\n\n',_.isEmpty(e.getCrop("mediumThreeByTwo210"))?(__p+="\n",e.get("kicker")&&(__p+='\n

    '+(null==(__t=e.get("kicker"))?"":__t)+"

    \n"),__p+='

    '+(null==(__t=e.get("headline"))?"":__t)+'

    \n",(e.get("description")||e.get("summary"))&&(__p+='\n

    '+(null==(__t=e.get("description")||e.get("summary"))?"":__t)+"

    \n"),__p+=""):(__p+='\n
    \n\n
    \n',e.get("kicker")&&(__p+='\n

    '+(null==(__t=e.get("kicker"))?"":__t)+"

    \n"),__p+='

    '+(null==(__t=e.get("headline"))?"":__t)+'

    \n\n"),__p+="\n
    \n\n\n"}),__p+="";return __p},templates.relatedSlideshows=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+="",_.find(collection,function(e,t){__p+="\n",0===t&&(__p+="\n",_.isEmpty(e.getCrop("xlarge"))?(__p+='\n\n"):(__p+='\n \n"),__p+="\n"),__p+="\n"}),__p+='\n";return __p},templates.whatsNextCollection=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n
    \n
    \n

    '+(null==(__t=subject)?"":__t)+"

    \n",tagLine&&(__p+='\n

    '+(null==(__t=tagLine)?"":__t)+"

    \n"),__p+='\n
    \n\n
    \n\n
    ";return __p},templates.whatsNextSection=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n
    \n

    '+(null==(__t=headingLabel)?"":__t)+'

    \n

    '+(null==(__t=sectionLinkLabel)?"":__t)+' »

    \n
    \n
    ";return __p},templates}),define("shared/data/instances/most-emailed",["foundation/views/page-manager","shared/data/collections/most-popular"],function(e,t){"use strict";return new t([],{type:"mostemailed"})}),define("shared/data/models/lda-article",["underscore/nyt","backbone/nyt","shared/data/models/article"],function(e,t,i){"use strict";var n=i.extend({getCrop:function(e){var t,i,n=this.get("thumbs")?this.get("thumbs"):[];for(i=0;i0&&!i.is(":empty")&&(1080>t||this.pageManager.flag("simple")&&10011>t||this.adExclusive?this.hideAd():this.displayAd())},getConfiguration:function(e){var t=["top-news-6","recommendations-3"],i=["top-news-6"],n=!1,s=this.pageManager.getMeta("nyt-collection:identifier");return this.pageManager.getMeta("errorpage")?(t=["most-emailed-6","top-news-3"],i=["most-emailed-6","top-news-3"]):this.pageManager.getMeta("article:section")&&("Archives"===this.pageManager.getMeta("article:section")?(t=["top-news-6"],n=["top-news-3"]):(t=["context-6","recommendations-3"],i=["context-6","recommendations-3"],n=["context-6","top-news-3"])),this.pageManager.flag("collectionsWhatsNext")&&s&&s.length&&(t.unshift("whats-next-collection-3"),i.unshift("whats-next-collection-3"),n&&n.unshift("whats-next-collection-3")),{sections:e.sections||a.isLoggedIn()?t:i,fallback:e.fallback||n,sectionsCollections:e.sectionsCollections||[],fallbackCollections:e.fallbackCollections||[],uniqueSections:[]}},handleDomReady:function(){this.shouldLoadWhatsNext()?this.loadData():this.subscribe("nyt:page-scroll",this.handleScrollCheck)},handleScrollCheck:function(){this.shouldLoadWhatsNext()&&this.loadData()},shouldLoadWhatsNext:function(){return this.pageManager.isComponentVisible(this.$el)||this.$el.length>0&&window.pageYOffset+window.innerHeight>this.$el.position().top-200},loadData:function(){var e,t,i,n,s=this;for(this.stopSubscribing("nyt:page-scroll",this.handleScrollCheck),e=0,t=this.settings.sections.length;t>e;e+=1)i=this.settings.whatsNextFactory.createTemplate(this.settings.sections[e]),this.settings.sectionsCollections.push(i),i.collection.loadData(),this.subscribeOnce(i.collection,"sync",s.fetchSuccess),this.settings.fallback&&this.settings.fallback[e]?(n=this.settings.whatsNextFactory.createTemplate(this.settings.fallback[e]),n.collection.loadData()):n=null,this.settings.fallbackCollections.push(n);setTimeout(function(){s.settings.hasRendered||s.render()},1500)},fetchSuccess:function(){this.settings.fetchCount++,this.settings.fetchCount===this.settings.sections.length&&this.render()},render:function(){var t,i,n,s,a,o,r,l,d,c=this,h="",u=80,m=72,g=document.getElementById("applicationName"),p=g?g.getAttribute("content"):"";for(this.settings.hasRendered=!0,this.pageManager.flag("dedupeWhatsNext")&&this.doesSectionExist("recommendations-3")&&this.dedupeMultipleSections("recommendations-3",this.settings.sections,this.settings.sectionsCollections),this.pageManager.flag("dedupeWhatsNext")&&this.doesSectionExist("whats-next-collection-3")&&this.doesSectionExist("context-6")&&this.dedupeMultipleSections("context-6",this.settings.sections,this.settings.sectionsCollections),t=0,i=this.settings.sections.length;i>t;t+=1)n=this.settings.sectionsCollections[t],s=this.settings.fallbackCollections[t],n.collection.length>=n.items||this.settings.uniqueSections.length>=n.items?(h+=this.pageManager.flag("dedupeWhatsNext")&&this.settings.uniqueSections.length?this.getSectionEl(n,this.settings.uniqueSections[t]):this.getSectionEl(n),this.deferDataFeedImpression(!1,"WP-WhatsNext-Render-"+this.settings.sections[t],n.el)):s&&s.collection.length>=s.items?(h+=this.getSectionEl(s),this.deferDataFeedImpression(!0,"WP-WhatsNext-Render-Fallback-"+this.settings.fallback[t],s.el)):this.trackDataFeedImpression(!0,"WP-WhatsNext-No-Render-"+this.settings.fallback[t]);this.$el[this.settings.renderMethod](h),e(this.settings.fadeInEl).css("opacity",0),e(this.settings.fadeInEl).animate({opacity:1},400),this.$el.find("h2").each(function(t,i){var n;e(i).closest(".whats-next-collection").hasClass("whats-next-collection")||(n=e(i).height(),n>=u+1&&c.truncateText(e(i),u,!1))}),this.isCollection&&(a=this.pageManager.getMeta("nyt-collection:identifier"),o=this.pageManager.getMeta("nyt-collection:type"),this.assignRref(a,o)),this.$el.find(".summary").each(function(t,i){e(i).closest(".whats-next-collection").hasClass("whats-next-collection")||c.truncateText(e(i),m,!1)}),this.checkDeferredImpressions(),this.pageManager.getCurrentBreakpoint()>=1080&&"article"===p&&(d=this.pageManager.flag("collectionsWhatsNext")?e(".layout-6"):this.$el.find("section").eq(0),r=d.find("li"),r.last().after(''),this.broadcast("nyt:ad-library:dfp:request-placement","MoreIn",[210,218])),this.pageManager.flag("collectionsWhatsNext")&&(l=this.$el.find(".follow-button-placeholder"),this.broadcast("nyt:new-follow-button",l)),this.broadcast("nyt:whats-next-rendered")},dedupeMultipleSections:function(e,i,n){var s,a,o,r,l,d,c,h=t.indexOf(i,e),u=[];if(-1===h)return u;for(s=0;s1&&(c[n].hideImage=!0);return i={tone:"feature-tone",subject:t.getName(),collectionId:t.getID(),collectionLink:r,description:t.getDescription(),tagLine:t.getTagLine(),articles:c,numberToShow:3,pageManager:this.pageManager,contentCollection:h.pageManager.getMeta("CG")},this.trackingTriggerImpression("NextIn-Render",{action:"Impression",module:"NextInCollection",region:"Footer",pgtype:"article",eventName:"Impression",contentCollection:this.pageManager.getMeta("CG"),priority:!0}),this.templates.whatsNextCollection(i)},isVideo:function(e){var t=e.get("promotional_media")?e.get("promotional_media").data_type:null;return"video"===e.get("data_type")||"video"===t},displayAd:function(){var t,i,n,s=e("#MoreIn");n=this.pageManager.flag("collectionsWhatsNext")?e(".layout-6"):this.$el.find("section").eq(0),s.removeClass("hidden"),t=n.find("li:not(.whats-next-ad)"),6===t.length&&t.eq(t.length-1).addClass("hidden"),i=n.find("li:not(.whats-next-ad):gt(1)"),s.after(i)},hideAd:function(){var t,i,n=e("#MoreIn");t=this.pageManager.flag("collectionsWhatsNext")?e(".layout-6"):this.$el.find("section").eq(0),i=t.find("li:not(.whats-next-ad):gt(1)"),i.removeClass("hidden"),n.addClass("hidden"),n.before(i)},dedupeSection:function(e,t){var i,n,s,a=this.pageManager.getMeta("articleid"),o=this.pageManager.getCanonical(),r=e.items;return void 0!==this.settings.overrideDisplayCount&&(r=this.settings.overrideDisplayCount),n=t?r+3:r,e.collection.chain().uniq(!1,function(e){return i=e.attributes,s=i.data_id?i.data_id:i.id,s?s:i.link}).reject(function(e){return i=e.attributes,s=i.data_id?i.data_id:i.id,s&&s===a?!0:-1!==i.link.indexOf(o)?!0:!1}).first(n).value()},handleLinkClick:function(t){var i,n,s,a,o;return this.pageManager.flag("collectionsWhatsNext")&&e(t.currentTarget).closest(".whats-next-collection").hasClass("whats-next-collection")?!0:void(this.settings.enableTracking&&(a=e(t.currentTarget),o=this.trackingAppendParams(a.attr("href"),{moduleDetail:a.attr("data")}),s=a.closest("section"),i=s.attr("data-module"),i&&(o=this.trackingAppendParams(o,{module:i})),n=s.attr("data-src"),n&&(o=this.trackingAppendParams(o,{src:n})),a.attr("href",o)))},trackDataFeedImpression:function(e,t){this.settings.enableTracking&&this.trackingTriggerImpression("WP-WhatsNext-Render",{eventName:"Impression",action:"Impression",contentCollection:t,mData:{feedFailure:e},priority:!0})},deferDataFeedImpression:function(e,t,i){this.settings.enableTracking&&(this.settings.deferredImpressions[i]={name:t,hadFailure:e,el:i},this.settings.handlingDeferredImpressions||(this.settings.handlingDeferredImpressions=!0,this.subscribe("nyt:page-scroll",this.checkDeferredImpressions)),this.checkDeferredImpressions())},checkDeferredImpressions:function(){var e,i,n,s,a;if(this.settings.enableTracking){if(t.isEmpty(this.settings.deferredImpressions))return this.stopSubscribing("nyt:page-scroll",this.checkDeferredImpressions),void(this.settings.handlingDeferredImpressions=!1);a=this.pageManager.getViewport().bottom;for(i in this.settings.deferredImpressions){if(n=this.$el.find(i+" .story-link"),s=n.length?n.first():void 0,!s||s.offset().top>a)break;e=this.settings.deferredImpressions[i],this.trackDataFeedImpression(e.hadFailure,e.name),delete this.settings.deferredImpressions[i]}}},doesSectionExist:function(e){return-1!==t.indexOf(this.settings.sections,e)}}));return l}),define("shared/whatsnext/instances/whats-next",["shared/whatsnext/views/whats-next"],function(e){"use strict";new e}),define("shared/page/helpers/page-mixin",["jquery/nyt"],function(e){"use strict";var t={handleSwipe:function(e){this.broadcast("nyt:app-swipe",e,e.gesture.direction)},handleSwipeStartEnd:function(e){var t="swipestart"===e.type?"start":"end";this.broadcast("nyt:app-swipe",e,t)},handleDrag:function(t){!t||e(t.srcElement).closest(".slideshow").length>0||this.broadcast("nyt:app-drag",t,t.gesture.direction)},handleDragStartEnd:function(t){var i="dragstart"===t.type?"start":"end";!t||e(t.srcElement).closest(".slideshow").length>0||this.broadcast("nyt:app-drag",t,i)},truncateCaptionText:function(){var t=this;this.$el.find("figure").each(function(){var i,n,s=88,a=e(this);a.hasClass("layout-small-vertical")||a.hasClass("layout-small-horizontal")||a.hasClass("has-adjacency layout-large-horizontal")?(n=a.find(".caption-text"),n>=1&&n.html().indexOf("<")<0&&t.truncateText(n,s,!0)):a.hasClass("layout-large-horizontal")?(i=a.find("img").height()-s,n=a.find(".caption-text"),n>=1&&n.html().indexOf("<")<0&&t.truncateText(n,i,!0)):a.hasClass("photo")&&a.hasClass("inline")&&(n=a.find(".caption-text"),n>=1&&n.html().indexOf("<")<0&&t.truncateText(n,s,!0))})}};return t}),define("shared/page/helpers/inactivity-timer-mixin",["underscore/nyt","jquery/nyt"],function(e,t){"use strict";var i={inactivityTimerTimeout:null,inactivityTimerDuration:6e5,inactivityTimerEnabled:!1,inactivityTimerLocked:!1,preInactivityTimerEnabled:!0,bindInactivityTimerEvents:function(){e.bindAll(this,"startInactivityTimer","enableInactivityTimer","disableInactivityTimer","reenableInactivityTimer","completeInactivityTimer"),this.subscribe("nyt:inactivity-timer-enable",this.handleTimerEnable),this.subscribe("nyt:inactivity-timer-disable",this.handleTimerDisable),this.subscribe("nyt:user-activity",this.reenableInactivityTimer)},handleTimerEnable:function(){this.unlockInactivityTimer(),this.preInactivityTimerEnableDuration?setTimeout(this.enableInactivityTimer,this.preInactivityTimerEnableDuration):this.enableInactivityTimer()},handleTimerDisable:function(){this.disableInactivityTimer(),this.lockInactivityTimer()},startInactivityTimer:function(){var e=this;this.inactivityTimerTimeout&&this.stopInactivityTimer(),this.inactivityTimerTimeout=window.setTimeout(function(){e.disableInactivityTimer(),e.lockInactivityTimer(),e.completeInactivityTimer()},this.inactivityTimerDuration)},enableInactivityTimer:function(e){var t=e&&e.data?e.data:this;t.inactivityTimerEnabled||t.inactivityTimerLocked||(t.preInactivityTimerEnabled=!1,t.inactivityTimerEnabled=!0,t.startInactivityTimer())},disableInactivityTimer:function(){this.inactivityTimerEnabled&&!this.inactivityTimerLocked&&(this.inactivityTimerEnabled=!1,this.stopInactivityTimer())},reenableInactivityTimer:function(){this.inactivityTimerEnabled&&!this.inactivityTimerLocked&&(this.disableInactivityTimer(),this.enableInactivityTimer())},stopInactivityTimer:function(){window.clearTimeout(this.inactivityTimerTimeout),this.inactivityTimerTimeout=null},lockInactivityTimer:function(){this.inactivityTimerLocked=!0},unlockInactivityTimer:function(){this.inactivityTimerLocked=!1},completeInactivityTimer:t.noop};return i}),define("shared/audio/views/tracking/art19",["jquery/nyt","underscore/nyt","foundation/views/page-manager","foundation/views/base-view","shared/page/helpers/page-mixin","shared/page/helpers/inactivity-timer-mixin"],function(e,t,i,n,s,a){"use strict";var o=n.extend(s).extend(a).extend({art19Events:{play:"handlePlay",pause:"handlePause",seeked:"handleSeeked",timeupdate:"handleTimeUpdate",ended:"handleEnded",download:"handleDownload"},pageType:"show",hasPlayedOnce:!1,hasFinishedPlayingThru:!1,initialize:function(){var t,i,n,s,a,o,r,l,d=this,c=this.el.art19Events,h=e(".audio-brief .kicker");l=this.$el.attr("data-collections-name"),this.isHomePage="homepage"===this.pageManager.getApplicationName(),this.isArticle="article"===this.pageManager.getApplicationName(),this.isInteractive="interactive"===this.pageManager.getApplicationName();for(s in this.art19Events)a=this.art19Events[s],c.addListener(s,this[a].bind(d));this.isHomePage||this.isArticle||this.isInteractive?(i=h.length>0?h.text():"",n=this.$el.attr("data-episode-id"),l&&(i=l),this.isHomePage&&(o="Homepage",r=this.$el.closest(".region").attr("class").replace(" region","")),this.isInteractive&&(o="Interactive",r="inline"),this.isArticle&&(o="article",r="body"),this.trackingTriggerRaw("podcast-audio-impression",{module:"Podcasts",pgType:o,region:r,action:"impression",contentCollection:i,priority:!0},"impression")):"show"==this.pageType&&(t=this.$el.closest(".story"),n=t.find(".headline").text(),i=e("h1.page-heading").text()),this.gaBaseData={hitType:"event",eventCategory:"Podcasts",eventLabel:n,dimension85:i},this.trackingBaseData={module:"Podcast",contentId:n,contentCollection:i},this.viewPoints=[null,null,null,null],this.viewPointsReached=[!1,!1,!1,!1]},handleDownload:function(){this.sendGAEvent({eventAction:"download"}),this.trackingTrigger("click",{eventName:"download"})},handlePlay:function(e){this.hasPlayedOnce?(this.sendGAEvent({eventAction:"resume"}),this.trackingTrigger("click",{eventName:"resume"}),this.isHomePage&&this.broadcast("nyt:inactivity-timer-disable")):(this.sendGAEvent({eventAction:"play",metric18:"Audio plays"}),this.trackingTrigger("click",{eventName:"play"}),e&&e.duration&&(this.duration=e.duration,this.viewPoints[0]=.25*this.duration,this.viewPoints[1]=.5*this.duration,this.viewPoints[2]=.75*this.duration,this.viewPoints[3]=this.duration),this.isHomePage&&this.broadcast("nyt:inactivity-timer-disable"),this.hasPlayedOnce=!0)},handlePause:function(){this.hasFinishedPlayingThru||(this.sendGAEvent({eventAction:"pause"}),this.trackingTrigger("click",{eventName:"pause"})),this.isHomePage&&this.broadcast("nyt:inactivity-timer-enable")},handleSeeked:function(){this.sendGAEvent({eventAction:"seek"}),this.trackingTrigger("click",{eventName:"seek"})},handleTimeUpdate:function(e){e&&e.seconds&&(this.checkViewpoints(e.seconds),e.seconds===this.duration&&(this.hasFinishedPlayingThru=!0))},handleEnded:function(){this.hasFinishedPlayingThru=!0,this.viewPointsReached[3]||(this.viewPointsReached[3]=!0,this.fireViewed(3)),this.isHomePage&&this.broadcast("nyt:inactivity-timer-enable")},checkViewpoints:function(e){var t;for(t=0;t0&&(s.contentCollection="NYTlogoHome"),n.parents(".user-action").length>0&&(s.contentCollection="GoToHPCTA"),i=this.trackingAppendParams(n.attr("href"),s),n.attr("href",i)},getPageCount:function(t){var i=this,n=4e3,s=n/2,a=200,o=1,r=0;return t.each(function(){var t=e(this),s=t.data("para-count");r>=n&&s>a&&(o+=1,r=0,i.pageBreakLocations.push({page:o,processed:!1,location:t.data("total-count")})),r+=s}),o>1&&s>r&&(o-=1,i.pageBreakLocations.pop()),o},handleScroll:function(){var e=this.$window.scrollTop(),t=e-this.lastScrollTop;this.isKristofABTest()&&e>0&&this.firstScroll&&(this.trackingTriggerRaw("kristof-image-test",{module:"first-scroll",region:"first-scroll",action:"impression",priority:!0},"impression"),this.firstScroll=!1),100>t||(this.lastScrollTop=e,this.updateCharacterCount(),this.updateScrollDepth(e),this.notifyPageBreaks(),this.pageManager.flag("didScroll")&&!this.didScroll&&(this.didScroll=!0,this.trackingTriggerRaw("first-scroll-interaction",{module:"first-scroll",region:"first-scroll"},"interaction")))},updateCharacterCount:function(){var t,i,n,s=this;this.maxCharsViewed!==this.totalChars&&(t=this.$paragraphs.slice(this.lastParagraphIndex).filter(function(){return s.pageManager.isComponentVisible(e(this))}),i=t.size()>0?t.last():this.$paragraphs.last(),n=i.data("total-count"),n!==this.maxCharsViewed&&(this.maxCharsViewed=n,this.lastParagraphIndex=this.$paragraphs.index(i),this.trackingTriggerRaw("scroll-update-char-count",{module:"Page",numPages:this.pageCount,totalChars:this.totalChars,viewedChars:this.maxCharsViewed},"interaction")))},updateScrollDepth:function(e){var t=this.lastScrollTop/this.maxScrollTop*100,i=25*Math.floor(t/25);i>this.maxScrollDepth&&(this.maxScrollDepth=i,this.trackingTriggerRaw("scroll-depth",{module:"Page",depth:i},"interaction")),this.isKristofABTest()&&this.trackingTriggerRaw("kristof-scroll-depth",{module:e.toString(),region:this.pageManager.$document.height().toString(),action:"impression",priority:!0},"impression")},notifyPageBreaks:function(){var e,i,n,s=t.filter(this.pageBreakLocations,function(e){return e.location<=this.maxCharsViewed&&!e.processed},this);for(e=0,i=s.length;i>e;++e)n=s[e],this.trackingTriggerRaw("page-break-equiv-nyt4",{module:"Page",nyt4pg:n.page},"interaction"),n.processed=!0},handleFollowClick:function(t){var i=e(t.currentTarget),n=i.closest("#masthead-social").length>0?"Header":"Footer";this.trackingTrigger("follow-us",{module:"FollowUs",version:"Content",action:"click",contentCollection:this.pageManager.getMeta("CG"),pgtype:this.pageManager.getMeta("PT"),region:n,eventName:"FollowUs-"+t.currentTarget.className})},handleReviewDetailClick:function(t){var i=e(t.currentTarget),n=i.attr("href");this.trackingTriggerRaw("outboundLinkClick",{module:"Reviewee-Information",version:"Content",action:"click",contentCollection:this.pageManager.getMeta("CG"),contentId:n,pgtype:this.pageManager.getMeta("PT"),region:"review-details",eventName:"outboundLinkClick"},"interaction")},handleVideoModulesTracking:function(){var e=[],t=this.$body.find("figure.video");t&&t.hasClass("lede")&&e.push("lede"),t&&t.hasClass("embedded")&&(t.hasClass("inline")?e.push("inline"):e.push("embedded")),this.trackingTriggerRaw("vid_modules",{module:"Page",vid_modules:e.toString(),priority:!0},"interaction")},handleRecircAbTestButtonClick:function(t){var i=e(t.currentTarget),n={module:"HPRecircABTestButton",region:"BodyContent"},s=this.trackingAppendParams(i.attr("href"),n);i.attr("href",s)},handleMapGetDirectionsClick:function(e){this.trackingTrigger("get-directions",{module:"CriticsReviewDetailsMap",version:"Content",action:"click",contentCollection:this.pageManager.getMeta("CG"),pgtype:this.pageManager.getMeta("PT"),region:"CriticsReviewDetails",eventName:"GetDirections-click",restaurantName:e.currentTarget.className})},handleFindTicketsClick:function(t){var i=e(t.currentTarget);this.trackingTrigger("outboundLinkClick",{module:"BuyTicketsButton",action:"click",contentCollection:i.attr("href"),contentId:i[0].hostname,region:i.parent().parent().attr("class"),eventName:"outboundLinkClick",show:i.attr("title")})},handleStandardNextInClick:function(t){var i=this.pageManager.getMeta("nyt-collection:identifier"),n=this.pageManager.getMeta("nyt-collection:type"),s=e(t.currentTarget),a=this.trackingAppendParams(s.attr("href"),{contentCollection:this.pageManager.getMeta("CG"),action:"click",module:"NextInCollection",region:"Footer",pgtype:"article",version:this.pageManager.getMeta("CT").replace("-",""),rref:["collection",n,i].join("/")});s.attr("href",a)},handleSlideshowPromoImpression:function(){var t=this,i=this.$el.find(".media.slideshow.promo");i.each(function(){t.trackingTriggerImpression("slideshow-promo-impression",{module:"Slide",action:"impression",slideshowTitle:e(this).find(".headline").first().text()})})},handleFindTopMovieTicketsClick:function(t){var i=e(t.currentTarget);this.trackingTrigger("outboundLinkClick",{module:"Movie_tickets",action:"click",region:"header",contentCollection:i.attr("href"),ur:i.attr("href"),eventName:"outboundlinkClick",rref:"collection/reviews/movies",pgtype:this.pageManager.getMeta("PT"),show:i.attr("title")})},handleFindBottomMovieTicketsClick:function(t){var i=e(t.currentTarget);this.trackingTrigger("outboundLinkClick",{module:"Movie_tickets",action:"click",region:"Body",contentCollection:i.attr("href"),ur:i.attr("href"),eventName:"outboundlinkClick",rref:"collection/reviews/movies",pgtype:this.pageManager.getMeta("PT"),show:i.attr("title")})},handleReserveTableTopClick:function(){this.trackingTrigger("outboundLinkClick",{module:"Open_table",region:"header",eventName:"Reserve_table"})},handleReserveTableBottomClick:function(){this.trackingTrigger("outboundLinkClick",{module:"Open_table",region:"Body",eventName:"Reserve_table"})},handleFlexFrameImpressions:function(){},serverRibbonPerfTest:function(){var e,t,i;window.performance&&window.performance.timing&&(i=window.performance.timing,e=i.loadEventStart-i.navigationStart,t=i.domInteractive-i.navigationStart,this.trackingTriggerImpression("server-ribbon-test",{module:"pagetimeEvent",region:"pagetimeEvent",version:e+"|"+t,action:"impression"}))},isKristofABTest:function(){return e("html").hasClass("column-kristof")&&window.NYTD&&window.NYTD.Abra&&window.NYTD.Abra("www-story-kristof-test")?!0:!1},parseNewsletterModule:function(e){var i,n="",s=e.attr("class").split(" "),a=e.attr("data-newsletter-productCode"),o={newsletterTestModule:!1};return t.each(s,function(e){return-1!=e.indexOf("dropzone-")?void(i=e):void 0}),-1!=t.indexOf(["CN","TH"],a)&&(n="CN"==a?"first_draft":"todays_headlines",e.find(".subscriber").is(":visible")&&(n+="_registered"),o={version:n,dropzone:i,newsletterTestModule:!0}),o},handleSubscribeLinks:function(t){var i=e(t.currentTarget),n="iTunes",s=i.parents(".audio-brief").find(".kicker").text();"Google Play Music"===i.text()?n="Google_Play":"RSS Feed"===i.text()&&(n="RSS"),n=n+" | "+s,this.trackingTrigger("out_bound_click",{eventName:n})}});return s}),define("article/story/instances/tracking",["jquery/nyt","shared/audio/views/tracking/art19","article/story/views/tracking"],function(e,t,i){"use strict";e(".art19-web-player[data-episode-id]").each(function(){new t({el:this})}),new i}),define("article/common/views/welcome-back/welcome-back",["underscore/nyt","jquery/nyt","foundation/views/base-view","shared/page/helpers/inactivity-timer-mixin","shared/modal/views/modal","shared/data/instances/recommendations","shared/data/instances/most-emailed","article/common/templates"],function(e,t,i,n,s,a,o,r){"use strict";var l=i.extend(e.extend({},n,{assetTimeout:null,collection:null,modal:null,defaultModalSettings:{id:"welcome-back-modal",modalTitle:r.welcomeBackTitle(),modalContent:r.welcomeBack(),modalFooter:r.welcomeBackFooter(),tailDirection:"fixed",fixedOverride:!0,hasOverlay:!0,hasCloseButton:!0},initialize:function(){var i=this;this.$document.on("click","#welcome-back-modal .story-link",function(e){var n=t(e.currentTarget),s=i.trackingAppendParams(n.attr("href"),{module:"WelcomeBackModal",contentCollection:i.pageManager.getMeta("article:section"),region:"FixedCenter",action:"click",src:"recg"});n.attr("href",s)}),this.isEnabled()&&(e.bindAll(this,"readyVisibilityCheck"),this.bindInactivityTimerEvents(),this.setupFocusEvents(),this.setupVisibilityEvents())},handleDomReady:function(){this.isEnabled()&&this.readyVisibilityCheck()},isEnabled:function(){return this.pageManager.isDesktop()},readyVisibilityCheck:function(){this.isVisible()&&this.enableInactivityTimer()},isVisible:function(){var e=!1,t=document.hasFocus();return t?("undefined"!=typeof document.hidden&&!document.hidden||"undefined"!=typeof document.mozHidden&&!document.mozHidden||"undefined"!=typeof document.msHidden&&!document.msHidden||"undefined"!=typeof document.webkitHidden&&!document.webkitHidden?e=!0:t&&"undefined"==typeof document.hidden&&"undefined"==typeof document.mozHidden&&"undefined"==typeof document.hsHidden&&"undefined"==typeof document.webkitHidden&&(e=!0),e):e},setupFocusEvents:function(){var e=this;this.$window.on("focus",e,this.enableInactivityTimer),this.$html.hasClass("ie8")?this.$document.on("focusout",function(){document.hasFocus()||e.disableInactivityTimer()}):this.$window.on("blur",this.disableInactivityTimer)},setupVisibilityEvents:function(){var e=this;this.$document.on("visibilitychange webkitvisibilitychange mozvisibilitychange",function(){e.isVisible()?e.enableInactivityTimer():e.disableInactivityTimer()})},setupModal:function(){var t=this,i=e.extend({},this.defaultModalSettings,{openCallback:function(){t.prepareContent()},closeCallback:function(){t.dismantleModal(),t.broadcast("nyt:inactivity-timer-enable")}});this.modal=new s(i),this.modal.addToPage()},dismantleModal:function(){this.modal.removeFromPage()},completeInactivityTimer:function(){this.setupModal(),this.modal.open()},prepareContent:function(){this.prepareContentCollection(a),0===this.collection.length&&this.prepareFallbackContent(!0),this.broadcast("nyt:ad-library:dfp:request-placement","WelcomeBack")},prepareContentCollection:function(e){this.collection=e.loadData(),this.collection.length>0?this.renderAssets():this.subscribeOnce(this.collection,"sync",this.handleCollectionLoad)},prepareFallbackContent:function(e){var t=this;e?this.assetTimeout=window.setTimeout(function(){t.prepareContentCollection(o)},1500):this.prepareContentCollection(o)},handleCollectionLoad:function(){window.clearTimeout(this.assetTimeout),this.renderAssets()},renderAssets:function(){var e;this.collection.length>0?(e=r.welcomeBackStories({collection:this.collection}),this.modal.$el.find(".story-group").html(e)):this.prepareFallbackContent(!1)}}));return l}),define("article/common/instances/welcome-back",["foundation/views/page-manager","article/common/views/welcome-back/welcome-back"],function(e,t){"use strict";e.getMeta("errorpage")||new t}),define("shared/nextin/templates",["underscore/nyt"],function(_){var templates={};return templates.nextInCollection=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n

    '+(null==(__t=subject)?"":__t)+'

    \n

    '+(null==(__t=tagLine)?"":__t)+'

    \n
      \n',_.each(articles,function(e){__p+='\n
    1. \n\n
    2. \n"}),__p+="\n
    ";return __p},templates.nextInCollectionStandard=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n
    \n\n

    '+(null==(__t=subject)?"":__t)+"

    \n",tagLine&&(__p+='\n

    '+(null==(__t=tagLine)?"":__t)+"

    \n"),__p+='
    \n
    ";return __p},templates}),define("shared/nextin/views/next-in-collection",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/nextin/templates","shared/data/instances/nyt-collection","shared/page/helpers/nyt-collection-view-mixin"],function(e,t,i,n,s,a){"use strict";var o=i.registerView("nextincollection").extend(t.extend({},a,{el:"#next-in",events:{"click a":"handleLinkClick"},handleDomReady:function(){this.handleScrollCheck()||this.subscribe("nyt:page-scroll",this.handleScrollCheck)},handleScrollCheck:function(){return this.pageManager.isComponentVisible(this.$el)?(this.stopSubscribing("nyt:page-scroll",this.handleScrollCheck),s.length>1?this.render():(s.loadData(),this.subscribeOnce(s,"sync",this.render)),!0):!1},render:function(){var e,t=s.getTone(),i=s.getType(),n=s.getID(),a=this.pageManager.getMeta("article:section");this.$el.attr("class","next-in collection collection-type-column collection-tone-"+t),"Magazine"===a&&this.$el.addClass("collection-section-magazine"),this.$el.html(this.createTemplate()),e=this.$el.find(".follow-button-placeholder"),this.broadcast("nyt:new-follow-button",e),this.assignRref(n,i)},createTemplate:function(){var e,t,i,a,o="",r="",l=[],d=this.nextArticles(3),c=this;for(t=0;t\n\n
    ';return __p},templates.video=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n
    \n
    ';return __p},templates.videoEndCard=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='';return __p},templates.videoEndCardIcon=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+=''+(null==(__t=iconText)?"":__t)+"";return __p},templates.videoEndCardThumb=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='";return __p},templates}),define("shared/video/models/playlist-videos",["backbone/nyt","foundation/models/base-model","foundation/hosts"],function(e,t,i){"use strict";var n=t.extend({url:i.videoApiHost+"/svc/video/api/v2/playlist/",fetchData:function(e,t,i,n){var s=this,a=[],o=e.playlistId||"1194811622188";this.success=t,this.error=i,this.passThroughCallback=n,e.count&&a.push("count="+e.count),e.skip&&a.push("skip="+e.skip),this.url+=o,a.length>0&&(this.url+="?"+a.join("&")),this.fetch({success:function(e){s.success&&(s.passThroughCallback&&"function"==typeof s.passThroughCallback?s.success(e,s.passThroughCallback):s.success(e))},error:function(e){s.error&&s.error(e)}})},sync:function(t,i,n){return n.dataType="jsonp",n.timeout=1e4,n.cache=!0,n.jsonp="callback",n.jsonpCallback="hpPlaylistCallback",e.sync(t,i,n)}});return n}),define("shared/video/models/playlist-metadata",["backbone/nyt","foundation/models/base-model","foundation/hosts"],function(e,t,i){"use strict";var n=t.extend({url:i.videoApiHost+"/svc/video/api/v2/playlists",initialize:function(e){this.allPlaylistData=null,this.apiEnv=e.apiEnv||"production"},sync:function(t,i,n){return n.dataType="json",n.timeout=1e4,n.cache=!0,e.sync(t,i,n)},getPlaylistMetaData:function(e,t,i){var n=this;this.playlistId=e,this.success=t,this.error=i,this.allPlaylistData?this.findPlaylistById(this.allPlaylistData,this.playlistId,this.success,this.error):this.fetch({success:function(e){n.allPlaylistData=e,n.findPlaylistById(e,n.playlistId,n.success,n.error)},error:function(e){n.error&&n.error(e)}})},getPlaylistNode:function(e,t){var i,n;if(e)for(n in e)if(i=e[n],parseInt(i.knews_id,10)===t)return i;return{}},findPlaylistById:function(e,t,i,n){var s,a,o;if(this.playlistId=t,this.success=i,this.error=n,s=e.toJSON(),a=s.plst_all,o=this.getPlaylistNode(a,this.playlistId)){if(!this.success)return o;this.success(o)}else this.error&&this.error({message:"Could not find playlist in all playlists data."})}});return n}),define("shared/video/models/video-thumb",["backbone/nyt","foundation/models/base-model"],function(e,t){"use strict";var i=t.extend({defaults:{itemIndex:"",itemOrdinal:"",thumbLink:"",thumbImg:"",thumbDesc:"",thumbAutoPlayPaused:"",thumbAutoPlayRemainingTime:"5"}});return i}),define("shared/video/collections/video-thumbs",["backbone/nyt","underscore/nyt","foundation/collections/base-collection","shared/video/models/video-thumb"],function(e,t,i,n){"use strict";var s=i.extend({model:n});return s}),define("shared/video/views/video-thumb",["jquery/nyt","underscore/nyt","backbone/nyt","shared/video/templates","foundation/views/base-view"],function(e,t,i,n,s){"use strict";var a=s.extend({thumbTemplate:n.videoEndCardThumb,render:function(){return this.thumbTemplate(this.model.toJSON())}});return a}),function(e,t){"use strict";"function"==typeof define&&define.amd?define("shared/video/libs/countdown-timer",["jquery/nyt"],t):e.amdWeb=t(e.$)}(this,function(e){"use strict";function t(t,i){this.timeout=1e3*t,this.interval=1e3*i||1e3,this.running=!1,this.startTime=0,this.ticks=0,this.pauseTime=0,this.runTime=0,this.intervalId=null,this.resumeId=null,this.active=!0,this.$emitter=e({}),this.tick=e.proxy(this.tick,this)}return t.prototype.start=function(){var e=this,t=0;this.active&&(this.pauseTime?(t=this.interval-this.runTime%this.interval,this.pauseTime=0,this.emit("resume")):this.emit("start"),this.running=!0,this.startTime=(new Date).getTime(),this.resumeId=setTimeout(function(){t>0&&e.tick(),e.running&&(e.intervalId=setInterval(e.tick,e.interval))},t))},t.prototype.tick=function(){var e;this.ticks++,e=this.timeout-this.ticks*this.interval,0>=e?this.complete():this.emit({type:"tick",timeLeft:e/1e3})},t.prototype.on=function(e,t){this.$emitter.on(e,t)},t.prototype.emit=function(e,t){this.$emitter.trigger(e,t)},t.prototype.complete=function(){this.emit("complete"),this.stop()},t.prototype.stop=function(){clearInterval(this.intervalId),clearInterval(this.resumeId),this.emit("stop"),this.$emitter.off(),this.running=!1,this.startTime=0,this.pauseTime=0,this.runTime=0,this.ticks=0},t.prototype.pause=function(){this.running&&(clearInterval(this.intervalId),clearInterval(this.resumeId),this.emit("pause"),this.running=!1,this.pauseTime=(new Date).getTime(),this.runTime+=this.pauseTime-this.startTime)},t}),define("shared/video/views/video-end-card",["jquery/nyt","underscore/nyt","shared/video/templates","foundation/views/base-view","shared/video/models/playlist-videos","shared/video/models/playlist-metadata","shared/video/collections/video-thumbs","shared/video/views/video-thumb","shared/sharetools/views/share-tools-container","foundation/views/page-manager","shared/video/libs/countdown-timer"],function(e,t,i,n,s,a,o,r,l,d,c){"use strict";var h=n.extend({initialize:function(e){var n=window.location.host;t.bindAll(this,"processPlaylistVideos","processPlaylistVideosError","processPlaylistMetaData","processPlaylistMetaDataError","replayVideo","resumeVideo","onClickVideoOverlayHandler","onMouseEnterVideoOverlayHandler","onMouseLeaveVideoOverlayHandler","onThumbClicked","changeVideo","initializeAutoPlayCountdown","hideVideoEndCard","stopAutoPlayCountdown"),this.videoModel=this.model.videoModel,this.videoObject=this.model.videoObject,this.currentPlaylistIndex=this.model.currentPlaylistIndex,this.enableAutoPlayCountdown=e.enableAutoPlayCountdown,this.cachedPlaylist=this.model.cachedPlaylist,this.autoplayTimeout=this.model.autoplayTimeout,this.enableAutoPlayCountdown&&(this.countdown=new c(this.autoplayTimeout)),this.excludedAutoplayPlaylists=[1194812888716,0x5af310a56ca7],this.apiEnv="production",("www.dev.nytimes.com"===n||"www.stg.nytimes.com"===n||"www.sbx.nytimes.com"===n)&&(this.excludedAutoplayPlaylists=[1194812888716,0x5af310a5dfd7],this.apiEnv="staging"),this.videoEndCardTemplate=i.videoEndCard,this.iconTextTemplate=i.videoEndCardIcon,this.iconTextReplayHTML=this.iconTextTemplate({iconText:"Replay Video"}),this.iconTextResumeHTML=this.iconTextTemplate({iconText:"Resume Video"}),this.$videoInnerContainer=this.model.videoInnerContainer,this.$videoEndCard=null,this.$videoEndCardThumbsContainer=null,this.$videoEndCardVideosSectionHeading=null,this.$videoEndCardVideosSectionHeadingLink=null,this.$videoEndCardVideosReplayButton=null,this.registerListeners(),this.getVideoData(),this.listenTo(this.videoModel,this.videoModel.videoEvents.KILL_VIDEO,this.onKill),this.listenTo(this.videoModel,this.videoModel.videoEvents.HIDE_VIDEO_END_CARD,this.hideVideoEndCard), this.listenTo(this.pageManager,"nyt:page-breakpoint",this.onBreakpoint)},registerListeners:function(){var e=this.videoModel.videoEvents;this.listenTo(this.pageManager,e.VIDEO_COMPLETE,this.onVideoComplete),this.listenTo(this.pageManager,e.PLAY_CLICKED,this.onVideoPlayClicked),this.listenTo(this.pageManager,e.VIDEO_PLAY,this.onVideoPlay),this.listenTo(this.pageManager,e.VIDEO_PAUSED,this.onVideoPaused),this.listenTo(this.pageManager,e.AD_START,this.onAdStart)},unregisterListeners:function(){var e=this.videoModel.videoEvents;this.stopListening(this.pageManager,e.VIDEO_COMPLETE,this.onVideoComplete),this.stopListening(this.pageManager,e.PLAY_CLICKED,this.onVideoPlayClicked),this.stopListening(this.pageManager,e.VIDEO_PLAY,this.onVideoPlay),this.stopListening(this.pageManager,e.VIDEO_PAUSED,this.onVideoPaused),this.stopListening(this.pageManager,e.AD_START,this.onAdStart)},onVideoComplete:function(e){e===this.videoModel.get("videoObject")&&this.showVideoEndCard(this.model.COMPLETE_STATE)},onVideoPlayClicked:function(e){e===this.videoModel.get("videoObject")&&"playing"!==this.videoObject.status&&"adplaying"!==this.videoObject.status&&this.showVideoEndCard(this.model.PAUSE_STATE)},onVideoPaused:function(){},onVideoPlay:function(e){e===this.videoModel.get("videoObject")&&this.hideVideoEndCard()},onAdStart:function(e){e===this.videoModel.get("videoObject")&&this.hideVideoEndCard()},getVideoData:function(){var t,i,n="";if(this.videoObject&&(t=this.videoObject._data)){this.videoModel.get("orphanVideo")?this.model.set("permalink",e('link[rel="canonical"]').attr("href")):this.model.set("permalink",t.domain+t.publish_url),this.model.set("videoTitle",t.headline),this.model.set("videoDescription",t.summary);for(i in t.images)if("videoSmall"===t.images[i].type){n=this.model.staticBaseUrl+t.images[i].url;break}this.model.set("videoStillImgUrl",n),t.playlist&&this.model.set("playlistId",t.playlist.id||1194811622182)}},getPlaylistId:function(e){var t=/nytp_([^,]+)/.exec(e.join(","))[1];return parseInt(t,10)||1194811622182},showVideoEndCard:function(e){var t,i=this;if(t=e,!this.videoModel.isVideoFullscreen){if(!this.$videoEndCard){this.render(),this.$videoEndCard=this.$videoInnerContainer.find(".video-end-card"),this.$videoEndCardThumbsContainer=this.$videoEndCard.find(".video-end-card-thumbs"),this.$videoEndCardVideosSectionHeading=this.$videoEndCard.find(".video-end-card-section-heading"),this.$videoEndCardVideosSectionHeadingLink=this.$videoEndCardVideosSectionHeading.find("a");try{new l({el:this.$videoEndCard.find(".video-share"),modalSettings:{hasOverlay:!0,tailDirection:"fixed",hasCloseButton:!0,shares:"facebook,email,twitter,pinterest,linkedin,reddit,google,save,permalink"}})}catch(n){this.$videoEndCard.find(".video-share").hide()}}this.$videoEndCard&&(this.onSetEndCardTemplateClass(this.videoModel.get("videoOuterContainer")),this.$videoEndCardVideosReplayButton=this.$videoEndCard.find(".video-end-card-play-button"),t===this.model.COMPLETE_STATE?this.$videoEndCardVideosReplayButton.removeClass("video-end-card-resume-button").html(this.iconTextReplayHTML).on("click",this.replayVideo):t===this.model.PAUSE_STATE&&this.$videoEndCardVideosReplayButton.addClass("video-end-card-resume-button").html(this.iconTextResumeHTML).on("click",this.resumeVideo),this.videoObject.modules.controls.hide(),this.$videoEndCard.fadeIn(500),null===this.cachedPlaylist?(this.getVideoData(),this.fetchPlaylistVideos(function(){i.initializeAutoPlayCountdown(t)}),this.fetchPlaylistMetaData()):i.initializeAutoPlayCountdown(t),this.$videoEndCard.on("click",this.onClickVideoOverlayHandler),this.$videoEndCard.on("mouseenter",this.onMouseEnterVideoOverlayHandler),this.$videoEndCard.on("mouseleave",this.onMouseLeaveVideoOverlayHandler))}},onBreakpoint:function(){this.onSetEndCardTemplateClass(this.videoModel.get("videoOuterContainer"))},initializeAutoPlayCountdown:function(e){function t(e){o.text(e.timeLeft)}function i(){a.remove(),r.changeVideo(l.data("videoid"),l.data("index"),!1)}function n(){l.off("click",r.onThumbClicked),l.on("click",function(e){a.toggleClass("paused"),a.hasClass("paused")?r.countdown.pause():r.countdown.start(),e.stopPropagation(),e.preventDefault()})}function s(){l.off("click"),l.on("click",r.onThumbClicked),o.text(r.autoplayTimeout),a.addClass("off"),a.removeClass("paused")}var a,o,r=this,l=this.$videoEndCard.find(".video-end-card-thumb.first a");!this.enableAutoPlayCountdown||e===this.model.PAUSE_STATE||-1!==this.excludedAutoplayPlaylists.indexOf(this.model.get("playlistId"))||this.videoModel.get("orphanVideo")||this.videoModel.get("live")||(a=this.$videoEndCard.find(".video-end-card-thumb.first .autoplayMeta"),o=a.find(".countdown span"),a.removeClass("off"),this.countdown.on("tick",t),this.countdown.on("complete",i),this.countdown.on("start",n),this.countdown.on("stop",s),this.countdown.start())},stopAutoPlayCountdown:function(){this.enableAutoPlayCountdown&&this.countdown.stop()},onSetEndCardTemplateClass:function(e){var t,i=e,n="layout-large",s="layout-medium",a="layout-small";i&&this.$videoEndCard&&(t=i.width(),t>=720?this.$videoEndCard.removeClass("hidden").addClass(a).addClass(s).addClass(n):t>=600?this.$videoEndCard.removeClass("hidden").addClass(a).addClass(s).removeClass(n):t>=450?this.$videoEndCard.removeClass("hidden").addClass(a).removeClass(s).removeClass(n):this.$videoEndCard.addClass("hidden"),!this.videoObject||"playing"!==this.videoObject.status&&"adplaying"!==this.videoObject.status||this.hideVideoEndCard())},onClickVideoOverlayHandler:function(t){var i=this.videoModel.clickableElements,n=i.join(", "),s=e(t.target).is(n);s||t.stopPropagation()},onMouseEnterVideoOverlayHandler:function(e){e.stopPropagation(),this.$videoEndCardVideosReplayButton&&this.$videoEndCardVideosReplayButton.addClass("expand")},onMouseLeaveVideoOverlayHandler:function(){this.$videoEndCardVideosReplayButton&&this.$videoEndCardVideosReplayButton.removeClass("expand")},hideVideoEndCard:function(t,i){var n;t=t||500,this.stopAutoPlayCountdown(),this.$videoEndCard&&this.$videoEndCard.is(":visible")&&(n=this,this.$videoEndCard.fadeOut(t,function(){e(this).hide(),n.$videoEndCardVideosReplayButton.off("click"),n.$videoEndCard.off("click"),i&&i()}))},fetchPlaylistVideos:function(e){this.model.playlistVideosDataModel||(this.model.playlistVideosDataModel=new s,this.model.playlistVideosDataModel.fetchData({playlistId:this.model.get("playlistId")},this.processPlaylistVideos,this.processPlaylistVideosError,e))},processPlaylistVideos:function(t,i){var n,s,a,l,d,c,h,u,m;if(s=t.toJSON(),n=this,s)if(null===this.cachedPlaylist&&(this.cachedPlaylist=t),this.$videoEndCardThumbsContainer.empty(),s.videos){if(a=s.videos.length,this.currentPlaylistIndex>=a)return;for(l=0,this.videoThumbs=new o,c=this.currentPlaylistIndex;a>c;c++)if(d=s.videos[c],m=this.model.get("videoStillImgUrl"),parseInt(d.id,10)!==this.videoModel.get("videoId")){if(!(lThere was an error retrieving more videos.

    ')},fetchPlaylistMetaData:function(){this.model.playlistMetaDataModel||(this.model.playlistMetaDataModel=new a({apiEnv:this.apiEnv}),this.model.playlistMetaDataModel.getPlaylistMetaData(this.model.get("playlistId"),this.processPlaylistMetaData,this.processPlaylistMetaDataError))},processPlaylistMetaData:function(e){var t=e;t&&t.publish_url&&t.display_name&&(this.model.set("playlistUrl",["http://www.nytimes.com",t.publish_url].join("")),this.model.set("playlistDisplayName",t.display_name),this.$videoEndCardVideosSectionHeadingLink.attr("href",this.model.get("playlistUrl")).html("More in "+this.model.get("playlistDisplayName"))),this.$videoEndCardVideosSectionHeading.css({opacity:0}).removeClass("video-end-card-section-heading-loading").fadeTo(200,1)},processPlaylistMetaDataError:function(){this.$videoEndCardVideosSectionHeading.css({opacity:0}).removeClass("video-end-card-section-heading-loading").fadeTo(200,1)},replayVideo:function(){this.videoObject.play(),this.hideVideoEndCard()},resumeVideo:function(){this.videoObject.play(),this.hideVideoEndCard()},render:function(){var e;return this.$videoEndCard||(this.$videoInnerContainer.find(".video-end-card").remove(),e=this.videoEndCardTemplate(this.model.toJSON()),this.$videoInnerContainer.append(e)),this},onKill:function(){this.stopListening(this.videoModel,this.videoModel.videoEvents.KILL_VIDEO,this.onKill),this.unregisterListeners(),this.$videoEndCard&&this.$videoEndCard.remove(),this.model.clear(),this.remove()}});return h}),function(e,t){"use strict";"function"==typeof define&&define.amd?define("shared/video/libs/inactivity-timer-manager",[],t):e.InactvityTimerManager=t()}(this,function(){"use strict";function e(e,t){if(this.disableIntervalId=null,this.pageManager=e,this.disableInterval=t||3e4,!e)throw new Error("InactvityTimerManager:: pageManger must be provided")}return e.prototype.disable=function(e){e=e||this,e.disableIntervalId||(e.disableIntervalId=setInterval(e.disable,e.disableInterval,e)),e.pageManager.trigger("nyt:inactivity-timer-disable")},e.prototype.enable=function(){clearInterval(this.disableIntervalId),this.disableIntervalId=null,this.pageManager.trigger("nyt:inactivity-timer-enable")},e}),define("shared/video/views/video",["jquery/nyt","underscore/nyt","backbone/nyt","foundation/collections/base-collection","foundation/views/base-view","foundation/hosts","shared/video/models/video-end-card","shared/video/views/video-end-card","foundation/views/page-manager","shared/video/libs/inactivity-timer-manager","shared/video/templates","shared/video/models/video","shared/sharetools/views/share-tools-container","shared/sharetools/models/share-data"],function(e,t,i,n,s,a,o,r,l,d,c,h,u,m){"use strict";var g,p=s.extend({defaultSettings:{loadVhs:function(e){require(["vhs"],e)}},initialize:function(e){var i,n=this,s=window.location.host,a=new h,o=this.model.get("videoId"),r=this.model.get("width"),u=this.model.get("height"),p=this.model.get("videoFigure"),f=this.model.get("pagePosition")||a.playerPositions.POSITION_EMBEDDED,v=this.model.get("autoStart")===!1?!1:!0,b=this.model.get("playerType")||"article",y="video_inner_"+f+"_",w="video_outer_"+f+"_",_=this.model.get("userInitiatedPlay")||!1,k=this.model.get("orphanVideo")||!1,C=c.video,T=C({outerId:w+o,innerId:y+o});this.settings=t.extend({},this.defaultSettings,e),t.bindAll(this,"handleVHSLoad","onPlayerReady","onKillVideo","onVideoComplete","onVideoPlay","onPlayClicked","onVideoPaused","onAdStart","onAdComplete","onFullscreen","onExitFullscreen","onClickVideoHandler","onMediaChange","initializeShareTools","toggleEmbedField"),this.genericVideoModel=a,this.shareOptions=this.setShareOptions(b,k),p.prepend(T),this.vhsConfig={container:y+o,width:r,height:u,id:o,autoplay:v,cover:{mode:"article"},type:b,userInitiatedPlay:_,controlsOverlay:{mode:"article"},endSlate:!1,shareOptions:this.shareOptions,newControls:!0},"homepage"===p.data("page")?(i=p.data("collection-renderstyle"),this.inactivityTimerManager=new d(l),this.vhsConfig.endSlate=!0,this.vhsConfig.cover.mode="homepage",this.vhsConfig.cover.intro="fade",this.vhsConfig.cover.outro="fade",!p.data("headline")||"VideoEmbed"!=i&&"VideoEmbed360"!=i||(this.vhsConfig.cover.headline=p.data("headline")),"VideoEmbed360"==i&&(this.vhsConfig.ratio="1:1"),b===this.genericVideoModel.playerTypes.HOMEPAGE_SPAN_AB_TOP&&(!p.data("summary")||"VideoEmbed"!=i&&"VideoEmbed360"!=i||(this.vhsConfig.cover.summary=p.data("summary")))):this.pageManager.isDesktop()||(this.vhsConfig.cover.mode="mobile"),(s.indexOf(".dev.")>-1||s.indexOf(".stg.")>-1||s.indexOf(".sbx.")>-1)&&(this.vhsConfig.env="staging"),this.$shareToolsInline=p.find(".sharetools-video-inline"),this.shareData=new m(this.$shareToolsInline),k||(this.$shareToolsVideo=p.find(".sharetools-video-tools"),this.$shareToolsVideoEmbedBtn=this.$shareToolsVideo.find(".embed-sharetool"),this.$shareToolsVideo.show()),this.settings.loadVhs(function(e){g=e,n.handleVHSLoad()})},setShareOptions:function(t,i){var n={},s=e('link[rel="canonical"]').attr("href");return i&&s&&(n.url=s),n},handleVHSLoad:function(){var e=this.model.get("videoId"),t=this.model.get("videoFigure"),i=t.find(".video-bind"),n=t.find(".video-container");this.video=g.player(this.vhsConfig),this.video&&(this.model.set("videoObject",this.video),this.model.set("videoId",e),this.model.set("videoInnerContainer",n),this.model.set("videoOuterContainer",i),this.video.on(g.api.events.LOADED,this.onPlayerReady)),t.on("click",this.onClickVideoHandler)},initializeShareTools:function(){this.setVideoPlayerShareData(),new u({trackingRegion:"video-player-region",el:this.$shareToolsInline}),this.$shareToolsVideoEmbedBtn&&this.$shareToolsVideoEmbedBtn.length>0&&this.$shareToolsVideoEmbedBtn.on("click",this.toggleEmbedField)},toggleEmbedField:function(){var e="share-embed-open",t={module:"ShareTools",action:"click",version:"video",region:"video-player-region",pgtype:this.pageManager.getMeta("PT"),contentCollection:this.pageManager.getMeta("CG"),eventTimestamp:(new Date).getTime()};this.$shareToolsVideoEmbedField&&this.$shareToolsVideoEmbedField.length>0?this.$shareToolsVideoEmbedField.is(":visible")?(this.$shareToolsVideoEmbedField.hide(),this.$shareToolsVideo.removeClass("with-embed"),e="share-embed-close"):(this.$shareToolsVideoEmbedField.show(),this.$shareToolsVideo.addClass("with-embed"),this.focusEmbedCodeInput()):this.addEmbedField(),t.eventName=e,this.trackingTrigger(e,t)},addEmbedField:function(){var t=this.model.get("videoId"),i=c.embedCode({embedId:"nyt-video-embed-"+t,embedCode:this.video.getEmbedCode()});this.$shareToolsVideoEmbedField=e(i),this.$shareToolsVideo.prepend(this.$shareToolsVideoEmbedField),this.$shareToolsVideo.addClass("with-embed"),this.focusEmbedCodeInput()},removeEmbedField:function(){this.$shareToolsVideoEmbedField&&this.$shareToolsVideoEmbedField.length>0&&(this.$shareToolsVideoEmbedField.remove(),this.$shareToolsVideoEmbedField=null),this.$shareToolsVideo&&this.$shareToolsVideo.length>0&&this.$shareToolsVideo.removeClass("with-embed")},focusEmbedCodeInput:function(){this.$shareToolsVideoEmbedField.find("input").select().focus()},setVideoPlayerShareData:function(){var e=this.video,t=e.getVideoCanonical()||"http:"+a.www+"/video";this.shareOptions&&this.shareOptions.url&&(t=this.shareOptions.url),this.shareData.setVia("nytvideo"),this.shareData.setUrl(t),this.shareData.setDescription(e.getSummary()),this.shareData.setTitle(e.getTitle()),this.removeEmbedField()},onClickVideoHandler:function(t){var i=this.model.clickableElements,n=i.join(", "),s=e(t.target).is(n);s||t.stopPropagation()},createVideoEndCard:function(){this.vhsConfig.endSlate||(this.videoEndCardModel=new o({videoModel:this.model}),this.videoEndCardView=new r({model:this.videoEndCardModel,enableAutoPlayCountdown:this.model.get("pagePosition")===this.model.playerPositions.POSITION_LEDE}))},onPlayerReady:function(){this.initializeShareTools(),this.bindVideoEvents(),this.createVideoEndCard(),this.listenTo(this.model,this.model.videoEvents.KILL_VIDEO,this.onKillVideo)},onKillVideo:function(){var e=this.model.get("videoObject"),t=this.model.get("videoFigure"),i=this.model.get("videoOuterContainer");this.stopListening(this.model,this.model.videoEvents.KILL_VIDEO,this.onKillVideo),this.bindVideoEvents(!0),this.model.set("videoObject",null),this.model.set("videoInnerContainer",null),this.model.set("videoOuterContainer",null),e&&e.destroy(),t.off("click"),i.remove(),t.remove(),this.remove()},bindVideoEvents:function(e){var t,i={},n={};if(e=e||!1,this.video){if(i[g.api.events.ENDED]=this.onVideoComplete,i[g.api.events.PLAY]=this.onVideoPlay,i[g.api.events.PAUSE]=this.onVideoPaused,i[g.api.events.AD_STARTED]=this.onAdStart,i[g.api.events.AD_COMPLETED]=this.onAdComplete,i[g.api.events.GO_FULLSCREEN]=this.onFullscreen,i[g.api.events.EXIT_FULLSCREEN]=this.onExitFullscreen,i[g.api.events.LOAD_START]=this.onMediaChange,n[g.api.events.READY]=this.onPlayerReady,e)for(t in n)n.hasOwnProperty(t)&&(i[t]=n[t]);for(t in i)i.hasOwnProperty(t)&&(e?this.video.off(t,i[t]):this.video.on(t,i[t]))}},onVideoComplete:function(){this.broadcast(this.model.videoEvents.VIDEO_COMPLETE,this.video),this.inactivityTimerManager&&this.inactivityTimerManager.enable()},onVideoPlay:function(){this.model.isAdPlaying=!1,this.broadcast(this.model.videoEvents.VIDEO_PLAY,this.video),this.inactivityTimerManager&&this.inactivityTimerManager.disable()},onPlayClicked:function(){this.broadcast(this.model.videoEvents.PLAY_CLICKED,this.video)},onVideoPaused:function(){this.broadcast(this.model.videoEvents.VIDEO_PAUSED,this.video),this.inactivityTimerManager&&this.inactivityTimerManager.enable()},onAdStart:function(){this.model.isAdPlaying=!0,this.broadcast(this.model.videoEvents.AD_START,this.video),this.inactivityTimerManager&&this.inactivityTimerManager.disable()},onAdComplete:function(){this.model.isAdPlaying=!1,this.broadcast(this.model.videoEvents.AD_COMPLETE,this.video),this.inactivityTimerManager&&this.inactivityTimerManager.enable()},onFullscreen:function(){this.model.isVideoFullscreen=!0,this.broadcast(this.model.videoEvents.VIDEO_FULLSCREEN,this.video)},onExitFullscreen:function(){this.model.isVideoFullscreen=!1,this.broadcast(this.model.videoEvents.VIDEO_EXIT_FULLSCREEN,this.video)},onMediaChange:function(){this.broadcast(this.model.videoEvents.MEDIA_CHANGE,this.video),this.setVideoPlayerShareData()}});return p}),define("shared/video/views/embedded-videos",["jquery/nyt","underscore/nyt","backbone/nyt","foundation/collections/base-collection","foundation/views/base-view","shared/video/models/video","shared/video/views/video","shared/mediaviewer/instances/media-viewer","foundation/views/page-manager"],function(e,t,i,n,s,a,o,r){"use strict";var l=s.extend({className:"video",el:e("figure.video"),videos:new n,events:{click:"handleVideoModalClick"},videoView:null,modalVideoModel:null,initialize:function(e){this.settings=t.extend({},e),this.subscribe("nyt:mediaviewer-open",this.onMediaViewerOpen),t.bindAll(this,"onVideoMediaViewerOpen","onMediaViewerClose"),this.genericVideoModel=new a,this.pageManager.isMobile()||this.subscribe(this.genericVideoModel.videoEvents.MEDIA_CHANGE,this.onMediaChange),this.pageManager.isDomReady()?this.handlePageReady():this.subscribeOnce("nyt:page-ready",this.handlePageReady)},handlePageReady:function(){var t=this;this.$el.each(function(){t.initVideoFigure(e(this))})},initVideoFigure:function(i){var n,s,r,l,d=!1,c=!0,h=i.data("videoid"),u=i.data("embedded")||!1,m=e("body").find("figure.video.lede").eq(0),g=this.genericVideoModel.playerTypes,p=i.data("live")||!1;return h?(s=this.getPlayerPosition(i),n=this.getPlayerType(s,i),this.pageManager.isDesktop()&&-1!==[g.ARTICLE_LEDE,g.BLOG].indexOf(n)&&(i.data("autoplay")===!0||this.checkExternalReferrerAutoPlay(m))&&(d=!0,c=!1),n===g.ARTICLE_MODAL&&(d=!0,c=!0),r={videoId:h,videoFigure:i,autoStart:d,width:"100%",height:"100%",modal:n===g.ARTICLE_MODAL?!0:!1,pagePosition:s,playerType:n,userInitiatedPlay:c,orphanVideo:u,live:p},l=new a(r),this.videos.add(l),void(n!==g.ARTICLE_MODAL?this.videoView=new o(t.extend({},this.settings.videoViewOptions,{model:l})):i.find(".caption a.video-link").click(function(e){e.stopPropagation()}))):!1},checkExternalReferrerAutoPlay:function(e){var t=document.referrer,i=t&&-1===t.split(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)[4].indexOf("nytimes.com"),n=!t||i,s=e&&e.data("autoplay")===!1,a=e&&"noads"!==e.data("adsensitivity"),o="article"===this.pageManager.getMeta("PT");return o&&a&&s&&n?!0:!1},handleVideoModalClick:function(t){var i=e(t.currentTarget),n=this.videos.findWhere({videoId:i.data("videoid")});return n?"link-to"===i.data("media-action")?void t.stopPropagation():void(n.get("modal")&&(t.preventDefault(),t.stopPropagation(),this.modalVideoModel=n,this.pageManager.isMobile()||this.subscribeOnce("nyt:mediaviewer-open",this.onVideoMediaViewerOpen),r.renderForVideo(this.modalVideoModel,this.onVideoMediaViewerOpen))):void 0},getPlayerPosition:function(e){var t,i=this.genericVideoModel.playerPositions;return t=e.hasClass("lede")?i.POSITION_LEDE:e.hasClass("inline")?i.POSITION_INLINE:"photospot"===e.data("position")?i.POSITION_PHOTOSPOT:"spanabtop"===e.data("position")?i.POSITION_SPAN_AB_TOP:"secondcolumn"===e.data("position")?i.POSITION_SECOND_COLUMN:i.POSITION_EMBEDDED},getPlayerType:function(e,t){var i,n=this.genericVideoModel.playerPositions,s=this.genericVideoModel.playerTypes;return i=t.hasClass("blog-video")?s.BLOG:e===n.POSITION_INLINE?s.ARTICLE_MODAL:e===n.POSITION_LEDE?s.ARTICLE_LEDE:e===n.POSITION_PHOTOSPOT?s.HOMEPAGE_PHOTOSPOT:e===n.POSITION_SPAN_AB_TOP?s.HOMEPAGE_SPAN_AB_TOP:e===n.POSITION_SECOND_COLUMN?s.HOMEPAGE_SECOND_COLUMN:"homepage"===t.data("page")?"homepage-"+t.data("position"):s.ARTICLE_EMBEDDED},onVideoMediaViewerOpen:function(){var i=e("figure.media-viewer-video");i&&this.modalVideoModel&&(this.subscribeOnce("nyt:mediaviewer-close",this.onMediaViewerClose),this.modalVideoModel.set("videoFigure",i),this.videoView=new o(t.extend({},this.settings.videoViewOptions,{model:this.modalVideoModel})))},onMediaViewerClose:function(){this.modalVideoModel&&(this.modalVideoModel.kill(),this.modalVideoModel=null,this.videoView=null)},onMediaViewerOpen:function(){this.videos.each(function(e){e&&e.pause()})},onMediaChange:function(t){var i;t.firstPlay||(i=e(t.container)||e(".video"),i.closest("figure").find(".summary-credit").animate({opacity:0}))}});return l}),define("shared/video/instances/videos",["jquery/nyt","underscore/nyt","shared/video/views/embedded-videos"],function(e,t,i){"use strict";var n=function(){var t;t=e("figure.video"),t.length>0&&new i({el:t,videoContainerSelector:"figure.video"})};e(document).ready(function(){t.defer(n)})}),define("article/story/views/full-bleed/cover-image",["jquery/nyt","foundation/views/base-view"],function(e,t){"use strict";var i=t.extend({$story:e("#story"),imgResolution:"large",nytEvents:{"nyt:page-resize":"setBleed"},initialize:function(){var e;this.coverToLedeBreakpoint=window.magnum.responsiveImages.coverToLedeBreakpoint,this.viewportMedium50=window.magnum.responsiveImages.viewportMedium50,this.$cover=this.$story.find(".cover.photo"),this.$coverImage=this.$cover.find("img"),this.viewportWidth=window.innerWidth,e=this.$cover.data("bleed-style"),"full-bleed"===e?this.bleedType="full-bleed-lede":this.bleedType=e,this.checkImageResolution()},handleDomReady:function(){this.checkLayout()},checkLayout:function(){var t=e("#story-header").height();"headline-image-topper"!==this.bleedType&&window.magnum.responsiveImages.setStoryBodyTop(t)},setBleed:function(){this.viewportWidth=this.magnum.getWidth(),this.$coverImage.removeAttr("style"),this.viewportWidth<=this.coverToLedeBreakpoint?window.magnum.responsiveImages.setBelowCoverToLedeBreakpoint(!0):window.magnum.responsiveImages.setBelowCoverToLedeBreakpoint(!1),this.viewportWidth=1020?this.makeVerticalFullBleed():this.makeFullBleedLede()),this.checkImageResolution()},makeHeadlineImageTopper:function(){window.magnum.responsiveImages.makeHeadlineImageTopper()},makeVerticalFullBleed:function(){this.$story.addClass("has-vertical-full-bleed").removeClass("has-full-bleed-image-lede"),window.magnum.responsiveImages.makeVerticalFullBleed()},makeFullBleedCover:function(){this.$story.addClass("has-full-bleed-cover").removeClass("has-full-bleed-image-lede"),window.magnum.responsiveImages.makeFullBleedCover()},makeFullBleedLede:function(){this.$story.addClass("has-full-bleed-image-lede").removeClass("has-full-bleed-cover").removeClass("has-vertical-full-bleed"),window.magnum.responsiveImages.makeFullBleedLede()},checkImageResolution:function(){this.viewportWidth>600&&this.viewportWidth<1024&&"large"===this.imgResolution?this.swapCoverImage("jumbo"):this.viewportWidth>1024&&"superjumbo"!==this.imgResolution&&this.swapCoverImage("superjumbo")},swapCoverImage:function(e){var t=this.$coverImage,i=e+"src",n=this.$coverImage.data(i),s=new Image;this.imgResolution=e,s.onload=function(){t.attr("src",s.src)},s.src=n}});return i}),define("article/story/views/full-bleed/inline-image",["jquery/nyt","foundation/views/base-view"],function(e,t){"use strict";var i=t.extend({main:e("#main"),page:e("#page"),nytEvents:{"nyt:page-resize":"setBleed"},initialize:function(e){this.$el=e.el,e.main&&(this.main=e.main),e.page&&(this.page=e.page),this.setBleed()},setBleed:function(){var e,t,i=this.page.width(),n=this.main.width(),s=parseInt(this.main.css("margin-left"),10),a=parseInt(this.main.css("margin-right"),10),o=n+s+a,r=parseInt(this.$el.css("margin-left"),10),l=(i-n)/2;o>=i?(t=o,e=s+r):(t=i,e=l+r),this.$el.find(".image").css({width:t,"margin-left":"-"+e+"px"})}});return i}),define("article/story/views/full-bleed/inline-ad",["jquery/nyt","foundation/views/base-view"],function(e,t){"use strict";var i=t.extend({main:e("#main"),page:e("#page"),nytEvents:{"nyt:page-resize":"setBleed"},initialize:function(e){this.$el=e.el,e.main&&(this.main=e.main),e.page&&(this.page=e.page),this.setBleed()},setBleed:function(){var e=this.page.width(),t=this.main.width(),i=(e-t)/2;this.$el.css({width:e,"margin-left":"-"+i+"px"})}});return i}),define("article/story/instances/full-bleed",["jquery/nyt","foundation/views/page-manager","article/story/views/full-bleed/cover-image","article/story/views/full-bleed/inline-image","article/story/views/full-bleed/inline-ad"],function(e,t,i,n,s){"use strict";e("#story").find(".cover.photo").length>0&&new i,e(document).ready(function(){var t=e("#story").find(".layout-full-bleed-horizontal, .layout-full-bleed-vertical"),i=e("#story").find(".ad.mega-ad");t.length>0&&t.each(function(){new n({el:e(this)})}),i.length>0&&i.each(function(){new s({el:e(this)})})})}),define("shared/upshot/views/headshots",["jquery/nyt","underscore/nyt","foundation/hosts","foundation/views/base-view"],function(e,t,i,n){"use strict";var s=n.extend({imgBaseUrl:i.staticHost+"/packages/images/nytint/projects/upshot/headshots/",upshotAuthors:[],initialize:function(){"upshot"===this.pageManager.getMeta("CG")&&this.getAuthors()},getAuthors:function(){var i=this;e(".upshot-author-image").each(function(){var n=e(this).data("author-name");n&&-1===t.indexOf(i.upshotAuthors,n)&&(i.upshotAuthors.push(n),i.checkImageAsset(n))})},checkImageAsset:function(e,t){var i=this,n=this.imgBaseUrl+e+".jpg",s=this.imgBaseUrl+e+"@2x.jpg",a=t?!1:window.devicePixelRatio>=1.5,o=!1,r=new Image;r.src=a?s:n,r.onload=function(){o=!0,i.callback(e,o,a)},r.onerror=function(){o=!1,i.callback(e,o),a&&i.checkImageAsset(e,!0)}},callback:function(t,i,n){var s,a="thumb";i&&(s=n?this.imgBaseUrl+t+"@2x.jpg":this.imgBaseUrl+t+".jpg",e(".upshot-author-image-"+t).css("background-image","url("+s+")").addClass("loaded").wrap('
    '))}});return s}),define("shared/upshot/instances/headshots",["shared/upshot/views/headshots"],function(e){"use strict";new e}),define("shared/following/views/follow-button-manager",["jquery/nyt","shared/messaging/views/follow-button","foundation/views/base-view"],function(e,t,i){"use strict";var n=i.extend({initialize:function(){return this.subscribe("nyt:new-follow-button",this.createNewButton),this.pageManager.flag("followingRelease")?void this.findFollowButtons():void this.subscribe("nyt:messaging-user-has-ability-to-follow",this.findFollowButtons)},findFollowButtons:function(){var t=this;e(".follow-button-placeholder").each(function(){t.createNewButton(e(this))})},createNewButton:function(e){(this.pageManager.flag("followingRelease")||this.pageManager.getMeta("nyt:messaging-user-has-ability-to-follow"))&&new t({$el:e})}});return n}),define("shared/following/instances/follow-button",["shared/following/views/follow-button-manager"],function(e){"use strict";new e}),define("article/story/instances/scoop-loader",["foundation/views/page-manager","foundation/hosts","foundation/cookies"],function(e,t,i){"use strict";i.readCookie("nyt-scoop")&&e.flag("scoopTool")&&require([t.scoopTool+"/ui/base/nyt-scoop/init.js"])}),define("article/story/views/review-map/review-map",["jquery/nyt","underscore/nyt","foundation/views/base-view","article/story/templates"],function(e,t,i,n){"use strict";var s=i.extend({map:null,model:null,title:null,styles:null,center:null,options:null,bounds:null,infoWin:null,initialZoom:null,markers:[],events:[],initialize:function(){this.styles=[{elementType:"labels.text.fill",stylers:[{color:"#8C8676"}]},{featureType:"poi",elementType:"geometry",stylers:[{saturation:-10},{lightness:18}]},{featureType:"poi.medical",elementType:"geometry",stylers:[{color:"#D8D6D0"}]},{featureType:"poi.school",elementType:"geometry",stylers:[{color:"#D8D6D0"}]},{featureType:"poi.park",elementType:"geometry",stylers:[{color:"#CDDDBA"}]},{featureType:"poi",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit.line",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"geometry",stylers:[{color:"#ACD1E2"}]},{featureType:"landscape",elementType:"geometry",stylers:[{lightness:17},{saturation:-18}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#c7c7c7"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{color:"#ffffff"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]}]},handleDomReady:function(){this.getMap()},getMap:function(){document.getElementById("review-map-data")&&(this.model=e("#main").find("#review-map-data").get(0).innerHTML,this.model&&(this.model=JSON.parse(this.model),this.model.GoogleMapZoom&&this.model.GoogleMapOptions[0].latitude&&this.model.GoogleMapOptions[0].longtitude?this.setMap():this.hideMap()))},setMap:function(){window.google?(this.initialZoom=parseInt(this.model.GoogleMapZoom,10),this.bounds=new window.google.maps.LatLngBounds,this.center=new window.google.maps.LatLng(this.model.GoogleMapOptions[0].latitude,this.model.GoogleMapOptions[0].longtitude),this.options={clickable:!0,scrollwheel:!1,zoomControl:!0,center:this.center,styles:this.styles,zoom:parseInt(this.model.GoogleMapZoom,10),mapTypeControlOptions:{mapTypeIds:[window.google.maps.MapTypeId.SATELLITE,window.google.maps.MapTypeId.ROADMAP]}},this.map=new window.google.maps.Map(document.querySelector(".map"),this.options),this.map.setTilt(45),this.setMarkers(),this.pageManager.flag("mapDining")&&this.insertFullMapLink()):this.hideMap(); },hideMap:function(){document.getElementById(".map")&&e(".map").remove()},setMarkers:function(){var e;if(this.map){for(e=0;ee.initialZoom&&e.markers.length>1&&this.setZoom(e.initialZoom)})),s=t.after(4,t.once(function(){e.registerEvent("zoom_changed",e.title)})),a=t.once(function(){e.registerEvent("click",e.title)}),o=t.once(function(){e.registerEvent("drag",e.title)});window.google.maps.event.addListener(this.map,"bounds_changed",i),window.google.maps.event.addListener(this.map,"zoom_changed",n),window.google.maps.event.addListener(this.map,"zoom_changed",s),window.google.maps.event.addListener(this.map,"click",a),window.google.maps.event.addListener(this.map,"drag",o)},addInfoWin:function(e,i){var s,a=this,o=this.pageManager.flag("reviewsMapGetDirectionsLink"),r={title:i.title,address:i.address,criticsPick:i.criticsPick,ratingClass:i.ratingClass,rating:i.rating,linkAddr:o?encodeURIComponent(i.address):!1,attrTitle:o?t.escape(i.title):!1},l={cuisine:i.cuisine,price:i.price},d={venueName:i.venueName},c=t.once(function(){a.registerEvent("marker_click",e.title)});if(this.pageManager.flag("reviewsMapDetailsCard")){switch(i.section){case"dining":s=n.reviewsRestaurantMapInfowin(t.extend(l,r));break;case"theater":s=n.reviewsTheaterMapInfowin(t.extend(d,r));break;default:s=n.reviewsMapInfowin(r)}this.infoWin=new window.google.maps.InfoWindow}window.google.maps.event.addListener(e,"click",function(){c(),a.pageManager.flag("reviewsMapDetailsCard")&&(a.infoWin.setContent(s),a.infoWin.open(a.map,e))})},registerEvent:function(e,t){t=t||"",void 0===this.events[e]&&this.trackingTrigger("review-map",{module:"ReviewsMap",version:"Content",action:e,contentCollection:this.pageManager.getMeta("CG"),pgtype:this.pageManager.getMeta("PT"),eventName:"ReviewsMap-click",restaurantName:t})},insertFullMapLink:function(){var e=document.createElement("a");e.className="dining-map-link",e.href="/reviews/dining/map/",e.index=1,e.textContent="Visit Restaurant Review Map",this.map.controls[window.google.maps.ControlPosition.TOP_RIGHT].push(e)}});return s}),define("article/story/instances/review-map",["article/story/views/review-map/review-map"],function(e){"use strict";new e}),define("shared/onboarding/data/campaigns/default",[],function(){"use strict";return function(e,t){return{copy:{description:'Subscribe now and get your first year 50% off.

    You’ll still get the rest of your trial for free.',button:"Subscribe"},ltvCopy:{description:"Subscribe now and get your first year 40% off.",button:"Subscribe"},discoOffer:{defaultLandingPage:e+"//"+t+"nytimes.com/subscriptions/inyt/lp8H3H4.html",copy:{title:"Subscribe"},campaignIDs:{mtv1:{code:"6J4Q8"},mtv2:{code:"6J4QW"},mtv3:{code:"6J4UY"}}},"inTrialOffer-7":{defaultLandingPage:e+"//"+t+"nytimes.com/subscriptions/inyt/lp8H3H4.html",ltvLandingPage:e+"//"+t+"nytimes.com/subscriptions/Multiproduct/lp8Y6RY.html",campaignIDs:{mtv1:{code:"6J4QF"},mtv2:{code:"6J4QY"},ltv:{code:"6QFHY"}}},"inTrialOffer-14":{defaultLandingPage:e+"//"+t+"nytimes.com/subscriptions/inyt/lp8H3H4.html",ltvLandingPage:e+"//"+t+"nytimes.com/subscriptions/Multiproduct/lp8Y6RY.html",campaignIDs:{mtv1:{code:"6J4QJ"},mtv2:{code:"6J4R6"},ltv:{code:"6QFJ6"}}},"inTrialOffer-21":{defaultLandingPage:e+"//"+t+"nytimes.com/subscriptions/inyt/lp8H3H4.html",ltvLandingPage:e+"//"+t+"nytimes.com/subscriptions/Multiproduct/lp8Y6RY.html",campaignIDs:{mtv1:{code:"6J4QL"},mtv2:{code:"6J4R8"},ltv:{code:"6QFJ8"}}},postTrialOffer:{defaultLandingPage:e+"//"+t+"nytimes.com/subscriptions/inyt/lp8H3H4.html",ltvLandingPage:e+"//"+t+"nytimes.com/subscriptions/Multiproduct/lp8F7Q8.html",ltvCopy:{description:"Subscribe now and get your first year 40% off."},copy:{description:'Subscribe now and get your first year 50% off.'},campaignIDs:{mtv1:{code:"6J4UR"},mtv2:{code:"6J4UW"},ltv:{code:"6QH9R"}}},inTrialUpsellPeriods:[{startDay:7,endDay:13},{startDay:14,endDay:20},{startDay:21,endDay:27}],postTrialUpsellPeriod:{startDay:28,endDay:34}}}}),define("shared/onboarding/data/onboarding-campaign",["underscore/nyt","foundation/views/page-manager","shared/onboarding/data/campaigns/default"],function(e,t,i){"use strict";var n,s="https:"===window.location.protocol?"https:":"http:",a=window.location.host,o="www.",r=/^ltv(2[0-1]|1[0-9]|[1-9])$/,l=i;return~a.indexOf(".stg.")&&(o+="stg."),n=l(s,o),n.getOffer=function(e,t){return"string"==typeof e?(t&&(e=e+"-"+t.startDay),n[e]):e},n.getCampaign=function(e,t,i){return r.test(t)&&(t="ltv"),i||(i=t),e.campaignIDs[i]||{}},n.getUpsellCopy=function(t,i,s,a){var o=n.getOffer(t,a),l=n.getCampaign(o,i,s);return r.test(i)?e.defaults({},l.ltvCopy,o.ltvCopy,n.ltvCopy):e.defaults({},l.copy,o.copy,n.copy)},n.getUpsellUrl=function(e,t,i,s){var a,o=n.getOffer(e,s),l=n.getCampaign(o,t,i);return a=l.landingPage?l.landingPage:r.test(t)?o.ltvLandingPage:o.defaultLandingPage,a+="?return_url="+encodeURIComponent(window.location.href)+"&mtv="+encodeURIComponent(t),l.code&&(a+="&campaignId="+encodeURIComponent(l.code)),a},n}),define("shared/onboarding/collections/onboarding-discoveries",["underscore/nyt","foundation/collections/base-collection","foundation/models/base-model","shared/onboarding/data/onboarding-campaign"],function(e,t,i,n){"use strict";return t.extend({model:i.extend({defaults:{subscribed:!1,imageSquare:!1},getUrlWithTracking:function(t,i,s){var a={ft2pu:this.get("id"),action:"click",module:"sov1"!==t?"Maple":"newsub",region:"FixedTop",mediaId:t,contentCollection:"Complete",contentId:this.get("id"),version:"discovery",eventName:"Complete",pgtype:i,discoverytype:window.encodeURIComponent(s)},o="regi-upsell"!==this.get("type")?this.get("uri"):n.getUpsellUrl("discoOffer","variation"),r=~o.indexOf("?")?"&":"?";return o+r+e.map(a,function(e,t){return t+"="+e}).join("&")}}),initialize:function(e){this.options=e},reset:function(i){return i=e.isArray(i)?i:[],t.prototype.reset.call(this,i.map(this.transform.bind(this)))},getActionByType:function(e){switch(e){case"article":return"View";case"regi-upsell":case"newsletter":return"Subscribe";case"crosswords":return"Play";default:return"Go"}},transform:function(t){return"newsletter"!==t.type&&"article"!==t.type&&(t.type=t.id),t.action=this.getActionByType(t.type),e.pick(t,["image","type","code","action","imageSquare","kicker","id","summary","uri","header","collection"])}})}),define("shared/onboarding/collections/onboarding-interests",["underscore/nyt","foundation/hosts","foundation/collections/base-collection","foundation/models/base-model"],function(e,t,i,n){"use strict";return i.extend({model:n,url:t.myaccountHost+"/svc/api/v2/ft/collections",xhrOptions:{dataType:"json",cache:!1,xhrFields:{withCredentials:!0}},sync:function(t,n,s){return i.prototype.sync(t,n,e.extend(s,this.xhrOptions))}})}),define("shared/onboarding/models/onboarding",["jquery/nyt","underscore/nyt","foundation/cookies","foundation/models/base-model","foundation/models/user-data","foundation/hosts","shared/onboarding/collections/onboarding-discoveries","shared/onboarding/collections/onboarding-interests"],function(e,t,i,n,s,a,o,r){"use strict";var l="ONBOARDING_API_CALL_THROTTLING_INFO";return n.extend({url:a.myaccountHost+"/svc/api/v2/ft/onboarding",defaults:{passedDays:null,duration:null,discoveries:[],collections:[]},xhrOptions:{dataType:"json",cache:!1,xhrFields:{withCredentials:!0}},initialize:function(){this.isSynced=!1,this.shouldRenderOnboarding=!0,this.listenToOnce(this,"sync",this.markSynced),this.listenToOnce(this,"sync",this.setAdxGlobals),this.interests=new r,this.discoveries=new o,n.prototype.initialize.apply(this,arguments)},sync:function(e,i,s){return n.prototype.sync(e,i,t.extend(s,this.xhrOptions))},parse:function(e){var i;return this.shouldCallApi(e),e?(i=e.onboarding||e.regi||{},i&&i.cards&&this.discoveries.reset(i.cards),i.hasOnboarding=e.hasOnboarding,i.selectedInterests=i.collections,t.omit(i,["cards","collections"])):e},shouldCallApi:function(e){var t=JSON.parse(window.localStorage.getItem(l)),i=!1,n=s.isLoggedIn()&&s.hasEntitlement("MM"),a=s.isLoggedIn()&&!s.hasEntitlement("MM")&&this.hasBeenAllocatedToMapleTest()&&(null===t||i),o=n&&(null===t||i),r=s.isLoggedIn()&&t&&t.userId!==s.id,d=parseInt(this.pageManager.getUrlParam("onboarding"),10);return t&&t.expire&&(i=t.expire<(new Date).getTime()),1===d?(window.localStorage.removeItem(l),!0):e&&!e.hasOnboarding?(this.shouldRenderOnboarding=!1,window.localStorage.setItem(l,JSON.stringify({expire:(new Date).getTime()+216e5,userId:s.id})),this.shouldRenderOnboarding&&null===window.localStorage.getItem(l)):(n||a||o||r||!this.hasPostOnboardingEnded()?(this.shouldRenderOnboarding=!0,null!==t&&window.localStorage.removeItem(l)):(this.shouldRenderOnboarding=!1,window.localStorage.setItem(l,JSON.stringify({expire:(new Date).getTime()+216e5,userId:s.id}))),this.shouldRenderOnboarding&&null===window.localStorage.getItem(l))},onInterestsReset:function(e){this.get("selectedInterests").each(function(t){e.get(t).set("selected",!0)})},userHasOnboarding:function(){return this.get("hasOnboarding")===!0},isUpsellTaken:function(){return"upsell"===this.get("participantStatus")},isSubscriber:function(){return"subscriber"===this.get("participantStatus")},isInTrialUpsellStepCompleted:function(e){return e=e&&"-"+e||"",this.isActionCompleted("upsell"+e)},isActionCompleted:function(e){return!!~this.get("discoveries").indexOf("action-"+e)},markActionComplete:function(e){return this.isActionCompleted(e)?void 0:this.markDiscoveryComplete("action-"+e)},isStepComplete:function(e){return!!~this.get("discoveries").indexOf("step-"+e)},markStepComplete:function(e){return this.isStepComplete(e)?void 0:this.markDiscoveryComplete("step-"+e)},getDaysLeft:function(){return this.has("duration")&&this.has("passedDays")?this.get("duration")-this.get("passedDays"):null},markSynced:function(){this.isSynced=!0,this.broadcast("nyt:onboarding-status-updated")},setAdxGlobals:function(){window.NYTD||(window.NYTD={}),null===window.localStorage.getItem("mapleVariation")&&window.localStorage.setItem("mapleVariation",this.get("variation")),window.NYTD.showMapleBar1Upsell=this.userHasOnboarding()&&!this.isUpsellTaken()&&!this.get("ended")},save:function(){console.error("Save called in models/onboarding.js, use saveCards or saveDiscoveries instead")},markDiscoveryComplete:function(i){var n={url:this.url,type:"POST",data:JSON.stringify({discoveries:[i]})};return e.ajax(t.extend(n,this.xhrOptions))},saveInterests:function(){var i=t.pluck(this.interests.filter(function(e){return e.get("selected")===!0}),"id"),n={url:this.interests.url,type:"POST",data:JSON.stringify({collections:i})};return e.ajax(t.extend(n,this.xhrOptions)).done(this.parse.bind(this))},getGroup:function(){var e=this.get("group");return e||(e=this.isInMapleTest()?"Maple":/^ltv(2[0-1]|1[0-9]|[1-9])$/.test(this.get("variation"))?"liftoff":"sov1"===this.get("variation")?"newsub":"onboarding"),e},isInMapleTest:function(){return/mtv[123]/.test(this.get("variation"))},hasBeenAllocatedToMapleTest:function(){return/maple_test_2016/.test(i.readCookie("mtrab"))},hasOnboardingEnded:function(){return this.isSubscriber()?this.get("ended"):this.get("passedDays")>this.get("duration")},hasPostOnboardingEnded:function(){return this.hasOnboardingEnded()&&this.get("duration")+this.get("postOnboarding")\n
    '+(null==(__t=interests[i].name)?"":__t)+'
    \n\n
    \n';__p+='\n
    \n
    \n\n
    \n
    '}return __p},templates.onboardingCollectionsInstructions=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='
    \n
    \n
    Let us know what
    sparks your curiosity
    \n
    We’ll recommend our best stories
    based on your interests.
    \n
    \n\n
    \n
    ';return __p},templates.onboardingDiscoveries=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='
    \n\n\n\n\n\n
    ';return __p},templates.onboardingDiscovery=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n
    \n',"article"===type&&(__p+='\nYour pick: \n'),__p+="\n"+(null==(__t=kicker)?"":__t)+'\n
    \n
    \n
    \n',__p+=imageSquare?'\n\n':'\n\n',__p+='\n
    \n
    \n
    \n'+(null==(__t=header)?"":__t)+'\n
    \n
    \n'+(null==(__t=summary)?"":__t)+"\n
    \n","article"!==type&&(__p+='\n
    \n\n
    \n"),__p+="\n
    \n
    \n
    ";return __p},templates.onboardingFrame=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n
    \n\nHide\nShow\n\n
    \n',headerCopy&&(__p+='\n'+(null==(__t=headerCopy)?"":__t)+"\n"),__p+='\nGet Started\n
    \n
    \n
    \n
    ';return __p},templates.onboardingPostTrial=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='
    \n
    \n
    \nJoin us on our journey to
    understand the world.\n
    \n
    \n'+(null==(__t=copy.description)?"":__t)+'\n
    \n\n
    ";return __p},templates.onboardingRefineInterestDiscovery=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='
    \n
    \n
    \nRefine your interest
    selection?\n
    \n
    \n\n
    \n
    \n
    \n';return __p},templates.onboardingUpsell=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='\n
    \n'+(null==(__t=copy.description)?"":__t)+'\n
    \n\n\n';return __p},templates}),define("shared/onboarding/views/onboarding-frame",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/onboarding/templates"],function(e,t,i,n){"use strict";var s=i.extend({className:"onboarding-frame",$overlay:e('
    '),events:{"click #onboarding-toggle":"toggleContent","click .onboarding-frame-header":"toggleContent"},nytEvents:{"nyt:onboarding-hide":"hideContent","nyt:onboarding-show":"showContent","nyt:masthead-search-click":"hideContent"},timeHidden:parseInt(localStorage.getItem("onboarding-contentHidden")||0,10),dayInMilliseconds:864e5,render:function(){var e={headerCopy:this.model.get("kicker")};return this.$el.html(n.onboardingFrame(e)),this},replaceContent:function(e){var t=this.$("#onboarding-content");t.empty().append(e),this.timeHidden>0&&Date.now()-this.timeHidden7||!this.model.get("hasCounter"))i.text(e);else if(this.model.hasOnboardingEnded())t="Subscribe",i.addClass("onboarding-times-up"),i.text(t);else{switch(n){case 1:t="1 day left";break;case 0:t="Your trial as ended";break;default:t=n+" days left"}i.addClass("onboarding-times-up"),i.text(t)}},toggleContent:function(e){e.preventDefault(),e.stopPropagation(),this.$el.hasClass("onboarding-collapsed")?(this.broadcast("nyt:onboarding-show"),this.broadcast("nyt:onboarding-track-event","show")):(this.broadcast("nyt:onboarding-hide"),this.broadcast("nyt:onboarding-track-event","hide"))},hideContent:function(){this.hideContentElement(),localStorage.setItem("onboarding-contentHidden",Date.now())},hideContentElement:function(){this.$el.addClass("onboarding-collapsed").attr("aria-hidden",!0),this.$("#onboarding-toggle").attr("aria-expanded",!1),this.hasOverlay()&&this.hideOverlay()},showContent:function(){this.showContentElement(),localStorage.setItem("onboarding-contentHidden",0),this.timeHidden=0},showContentElement:function(){this.$el.removeClass("onboarding-collapsed").attr("aria-hidden",!1),this.$("#onboarding-toggle").attr("aria-expanded",!0),this.hasOverlay()&&this.showOverlay()},hideOverlay:function(){this.$overlay.animate({opacity:0},{always:function(){this.$overlay.removeClass("onboarding-overlay-visible").off("click")}.bind(this)})},showOverlay:function(){this.$overlay.addClass("onboarding-overlay-visible").animate({opacity:1}).on("click",function(){this.hideOverlay(),this.hideContent()}.bind(this))},hasOverlay:function(){return this.$el.hasClass("has-overlay")}});return s}),define("shared/onboarding/views/onboarding-instructions",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/onboarding/templates"],function(e,t,i,n){"use strict";var s=i.extend({className:"onboarding-instructions",events:{"click #onboarding-next-step":"nextStep"},initialize:function(e){this.options=e},render:function(){return this.$el.html(n[this.options.template]),this},nextStep:function(){this.broadcast("nyt:onboarding-track-event","add-interests"),this.broadcast("nyt:onboarding-next-step")}});return s}),define("shared/onboarding/views/onboarding-collections",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/onboarding/templates"],function(e,t,i,n){"use strict";var s=i.extend({className:"onboarding-collections",events:{"click #onboarding-next-step":"saveInterests","click .onboarding-collections-item-add":"toggleItem","click .onboarding-collections-item":"toggleItem"},initialize:function(){this.listenTo(this.model.interests,"reset",this.render),this.model.interests.fetch({reset:!0})},render:function(){return this.model.interests.length&&(this.$el.html(n.onboardingCollections({interests:this.model.interests.toJSON()})),this.updateSaveButton()),this},saveInterests:function(){this.$("#onboarding-next-step").html("Saving..."),this.model.saveInterests().done(function(){this.broadcast("nyt:onboarding-next-step")}.bind(this)),this.broadcast("nyt:onboarding-track-event","save")},toggleItem:function(e){var t=this.$(e.target).hasClass("onboarding-collections-item")?this.$(e.target):this.$(e.target).parents(".onboarding-collections-item"),i=t.data("id");e.stopPropagation(),t.toggleClass("onboarding-collections-item-added onboarding-icon-transform"),t.hasClass("onboarding-collections-item-added")?(this.model.interests.get(i).set("selected",!0),this.broadcast("nyt:onboarding-track-event","add",{id:i})):(this.model.interests.get(i).set("selected",!1),this.broadcast("nyt:onboarding-track-event","remove",{id:i})),this.updateSaveButton()},updateSaveButton:function(){var e=this.$("#onboarding-next-step");this.$(".onboarding-collections-item-added").length?e.removeAttr("disabled"):e.attr("disabled","disabled")}});return s}),define("shared/subscribenewsletter/api/newsletter",["jquery/nyt","foundation/hosts"],function(e,t){"use strict";var i=function(i,n,s,a){var o=t.myaccountHost+"/svc/account/newsletter/v1/"+n;e.ajax({type:i,url:o,data:s,xhrFields:{withCredentials:!0}}).error(function(e,t,i){a&&a(new Error("Error making request to "+o+"\n"+i+"\n"+t))}).success(function(e){a&&a(null,e.data)})};return{subscribe:function(e,t){i("POST","subscribe",{product:e},t)},unsubscribe:function(e,t){i("POST","unsubscribe",{product:e},t)},list:function(e){i("GET","list",{},function(t,i){t?e(t):e(null,i.subscriptions)})},available:function(e){i("GET","available",{},e)}}}),define("shared/subscribenewsletter/models/subscribe-newsletter",["backbone/nyt","jquery/nyt","underscore/nyt","foundation/models/base-model","shared/subscribenewsletter/api/newsletter"],function(e,t,i,n,s){"use strict";var a=n.extend({defaults:{code:!1,suggested:!1,thumb:!1,thumbClass:!1,title:"default title",description:!1,subscribed:!1,buttonText:["Subscribe","Subscribed","Unsubscribe"],saveImmediately:!0},initialize:function(){this.wasInitiallySubscribed=this.get("subscribed")},toggleSubscription:function(){this.get("subscribed")?this.unsubscribe():this.subscribe()},subscribe:function(){this.set("subscribed",!0),this.get("saveImmediately")&&this.save()},unsubscribe:function(){this.set("subscribed",!1),this.get("saveImmediately")&&this.save()},save:function(){this.get("subscribed")!==this.wasInitiallySubscribed&&(this.get("subscribed")?s.subscribe(this.get("code"),function(e){e?this.set("subscribed",this.wasInitiallySubscribed):this.wasInitiallySubscribed=!0}.bind(this)):s.unsubscribe(this.get("code"),function(e){e?this.set("subscribed",this.wasInitiallySubscribed):this.wasInitiallySubscribed=!1}.bind(this)))}});return a}),define("shared/onboarding/views/onboarding-discovery",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/onboarding/templates","shared/subscribenewsletter/models/subscribe-newsletter"],function(e,t,i,n){"use strict";var s=i.extend({className:"onboarding-discovery carousel-item",events:{"click .onboarding-discovery-action-button":"onCallToAction"},initialize:function(e){t.extend(this,e),this.listenTo(this.model,"change",this.render)},render:function(){return this.$el.html(n.onboardingDiscovery(this.model.toJSON())).addClass("onboarding-discovery-"+this.model.get("type")),this},onCallToAction:function(){switch("function"==typeof this.markDiscoveryComplete&&this.markDiscoveryComplete(this.model.get("id")),this.model.get("type")){case"newsletter":this.toggleSubscription(this.model.get("code"));break;default:window.location=this.model.getUrlWithTracking(this.variation,this.pageManager.getMeta("applicationName"),this.model.get("kicker"))}this.broadcast("nyt:onboarding-track-event","discovery",{id:this.model.get("id")})}});return s}),define("shared/onboarding/collections/onboarding-newsletters",["underscore/nyt","foundation/collections/base-collection","shared/subscribenewsletter/models/subscribe-newsletter","shared/subscribenewsletter/api/newsletter"],function(e,t,i,n){"use strict";return t.extend({model:i,fetch:function(){n.list(function(e,t){e||this.reset(t)}.bind(this))}})}),define("shared/onboarding/views/onboarding-discoveries",["jquery/nyt","underscore/nyt","foundation/views/base-view","shared/onboarding/templates","shared/onboarding/views/onboarding-discovery","shared/onboarding/collections/onboarding-newsletters"],function(e,t,i,n,s,a){"use strict";var o=i.extend({className:"onboarding-discoveries",events:{focusin:"onFocusIn",focusout:"onFocusOut","click #onboarding-next-step":"nextStep","click #carousel-scroll-left":"scrollLeft","click #carousel-scroll-right":"scrollRight","click .carousel-dots button":"onCarouselDotClick","click #onboarding-goto-interests":"goToInterests"},newsletter:new a,initialize:function(){i.prototype.initialize.apply(this,arguments),this.listenTo(this.newsletter,"reset",this.onNewsletterReset),this.$window.on("resize.onboarding",this.onResize.bind(this)),this.newsletter.fetch()},remove:function(){this.$window.off("resize.onboarding")},render:function(){var e="mtv3"!==this.model.get("variation")?this.getRenderedInterestRefinement():null;return this.$el.attr("tabindex",1).html(n.onboardingDiscoveries()),this.$("#onboarding-discoveries-items").append(this.getRenderedDiscoveries(),e),this.initializeCarousel(),this},postRender:function(){this.goToStep(0)},getRenderedDiscoveries:function(){return this.model.discoveries.map(function(e){try{return new s({variation:this.model.get("variation"),model:e,markDiscoveryComplete:this.model.markDiscoveryComplete.bind(this.model),toggleSubscription:this.toggleSubscription.bind(this)}).render().$el}catch(t){console.error("Issue with rendering discovery",t)}}.bind(this))},getRenderedInterestRefinement:function(){return e(n.onboardingRefineInterestDiscovery()).addClass("carousel-item")},goToInterests:function(){this.broadcast("nyt:onboarding-track-event","update-interests"),this.broadcast("nyt:onboarding-goto-interests")},toggleSubscription:function(e){var t=this.model.discoveries.findWhere({code:e}),i=this.newsletter.findWhere({code:e});i?(i.toggleSubscription(),t.set("subscribed",!t.get("subscribed"))):window.location.reload()},onNewsletterReset:function(e){e&&e.length>0&&this.model.discoveries.where({type:"newsletter"}).forEach(function(t){t.set("subscribed",e.findWhere({code:t.get("code")}).get("subscribed"))})},carouselScrollPosition:0,carouselCurrentStep:0,initializeCarousel:function(){this.$carouselScroll=this.$(".scroll-container"),this.$carouselViewport=this.$(".carousel-viewport"),this.renderCarouselDots()},getCarouselLength:function(){return this.$carouselScroll.find(".carousel-item").length},goToStep:function(e){var t=this.$carouselViewport.outerWidth(),i=this.$carouselScroll.find(".carousel-item:nth-child("+(e+1)+")"),n=i.outerWidth(!0),s=t/2,a=n/2,o=-1*e*n+(s-a);0>e||e>=this.getCarouselLength()||(this.checkControls(e),this.setActiveDot(e),this.$carouselScroll.find(".carousel-item-active").removeClass("carousel-item-active"),i.addClass("carousel-item-active"),this.$carouselScroll.css({transform:"translateX("+o+"px)"}),this.carouselCurrentStep=e)},scrollLeft:function(){this.goToStep(this.carouselCurrentStep-1)},scrollRight:function(){this.goToStep(this.carouselCurrentStep+1)},checkControls:function(e){0===e?this.$("#carousel-scroll-left").addClass("disabled"):this.$("#carousel-scroll-left").removeClass("disabled"),e===this.getCarouselLength()-1?this.$("#carousel-scroll-right").addClass("disabled"):this.$("#carousel-scroll-right").removeClass("disabled")},renderCarouselDots:function(){var e=this.$carouselScroll.find(".carousel-item").map(function(e){return''}).get();this.$(".carousel-dots").append(e)},onCarouselDotClick:function(t){var i=e(t.target);i.hasClass("active")||(i.parent().find(".active").removeClass("active"),i.addClass("active"),this.goToStep(parseInt(i.data("step"),10)))},setActiveDot:function(e){this.$(".carousel-dots .active").removeClass("active"),this.$(".carousel-dots button:nth-child("+(e+1)+")").addClass("active")},onFocusIn:function(){this.$document.on("keydown.onboarding-discoveries",this.onKeyDown.bind(this))},onFocusOut:function(){this.$document.off("keydown.onboarding-discoveries")},onKeyDown:function(e){switch(e.keyCode){case 37:e.preventDefault(),this.scrollLeft();break;case 39:e.preventDefault(),this.scrollRight()}},onResize:function(){this.goToStep(this.carouselCurrentStep)}});return o}),define("shared/onboarding/views/onboarding-upsell",["foundation/views/base-view","foundation/hosts","shared/onboarding/templates","shared/onboarding/data/onboarding-campaign"],function(e,t,i,n){"use strict";return e.extend({className:"onboarding-upsell",template:i.onboardingUpsell,events:{"click .close":"close","click .button-cancel":"close"},period:null,initialize:function(e){var t;this.model=e.model,this.period=e.period,t="upsell"+(this.period&&"-"+this.period.startDay+"-"+this.period.endDay)||"",this.model.markActionComplete(t)},close:function(t){t.preventDefault(),this.undelegateEvents(),this.$el.removeData().unbind(),this.remove(),e.prototype.remove.call(this)},render:function(){return this.$el.html(this.template({takeUpsellUrl:n.getUpsellUrl("inTrialOffer",this.model.get("variation"),null,this.period),copy:n.getUpsellCopy("inTrialOffer",this.model.get("variation"),null,this.period),isLastSevenDays:21==this.period.startDay})),this}})}),define("shared/onboarding/views/onboarding-post-trial",["foundation/views/base-view","foundation/hosts","shared/onboarding/templates","shared/onboarding/data/onboarding-campaign"],function(e,t,i,n){ "use strict";return e.extend({className:"onboarding-post-trial",template:i.onboardingPostTrial,render:function(){return this.$el.html(this.template({takeUpsellUrl:n.getUpsellUrl("postTrialOffer",this.model.get("variation")),copy:n.getUpsellCopy("postTrialOffer",this.model.get("variation"))})),this}})}),define("shared/onboarding/views/onboarding",["jquery/nyt","underscore/nyt","foundation/views/base-view","foundation/models/user-data","shared/onboarding/data/onboarding-campaign","shared/onboarding/models/onboarding","shared/onboarding/views/onboarding-frame","shared/onboarding/views/onboarding-instructions","shared/onboarding/views/onboarding-collections","shared/onboarding/views/onboarding-discoveries","shared/onboarding/views/onboarding-upsell","shared/onboarding/views/onboarding-post-trial"],function(e,t,i,n,s,a,o,r,l,d,c,h){"use strict";var u=[{View:r,args:{header:"Get Started",template:"onboardingCollectionsInstructions"},className:"onboarding-step-instructions",hasOverlay:!0,trackingName:"first-use-message"},{View:l,args:{header:"Get Started"},className:"onboarding-step-collections",hasOverlay:!0,trackingName:"interest-view"},{View:d,args:{header:"Discover"},className:"onboarding-step-discoveries",hasOverlay:!1,trackingName:"discovery-view"},{View:h,args:{header:"Subscribe"},className:"onboarding-step-post-trial",hasOverlay:!1,trackingName:"post-trial"}],m=i.extend({el:"body",currentStep:0,nytEvents:{"nyt:onboarding-next-step":"nextStep","nyt:onboarding-previous-step":"prevStep","nyt:onboarding-goto-interests":"goToInterests","nyt:onboarding-track-event":"onTrackEvent"},events:{},initialize:function(e){this.options=e||{},this.model=new a,this.frame=new o({model:this.model,options:e})},handleUserReady:function(){var e=this.model.shouldCallApi();this.pageManager.flag("mapleFreeTrial")&&e&&-1===window.location.href.indexOf("nytapp=true")&&(this.render(),this.listenTo(this.model,"sync",this.render),this.model.fetch())},render:function(){return this.model.userHasOnboarding()&&this.model.shouldRenderOnboarding&&!this.model.hasPostOnboardingEnded()&&(this.model.hasOnboardingEnded()?this.currentStep=3:("mtv3"===this.model.get("variation")||this.model.isStepComplete("discoveries"))&&(this.currentStep=2),this.removeRibbonIfExists(),this.unpinMasthead(),this.frame.render(),this.$el.prepend(this.frame.$el,this.frame.$overlay),this.renderStep(this.currentStep),this.model.isUpsellTaken()||"mtv3"===this.model.get("variation")||this.renderUpsell()),this},renderStep:function(e){var i=u[e],n=new i.View(t.extend({model:this.model},i.args));return this.frame.$el.attr("class",this.frame.className+" "+i.className),i.hasOverlay?(this.frame.$el.addClass("has-overlay"),this.$el.addClass("onboarding-fixed"),this.$el.removeClass("onboarding-not-fixed")):(this.$el.removeClass("onboarding-fixed"),this.$el.addClass("onboarding-not-fixed"),!this.options.defaultCollapsed||u[this.currentStep].hasOverlay||u[e].hasOverlay||this.frame.$el.addClass("onboarding-collapsed"),0===this.frame.timeHidden&&this.$body.scrollTop(0)),this.frame.replaceContent(n.render().$el),this.frame.updateHeading(i.args.header),this.currentStep=e,2===e?this.model.markStepComplete("discoveries"):3!==e||this.model.isStepComplete("post-trial")||(this.model.markStepComplete("post-trial"),this.frame.showContent()),"function"==typeof n.postRender&&n.postRender(),n},renderUpsell:function(){var e=this.model.get("passedDays"),i=s.inTrialUpsellPeriods,n=this.model.userHasOnboarding()&&(this.model.isUpsellTaken()||this.model.isSubscriber()),a=t.find(i,function(t){return!this.model.isInTrialUpsellStepCompleted(t.startDay+"-"+t.endDay)&&!n&&e>=t.startDay&&e<=t.endDay},this);a&&this.$el.prepend(new c({model:this.model,period:a}).render().$el)},onTrackEvent:function(e,t){var i,n,s=this.model.getGroup().toLowerCase()+"-";switch(e){case"add":case"remove":case"discovery":i=t.id;break;case"save":i=this.model.get("selectedInterests")}"save"===e&&(n=this.model.isStepComplete("discoveries")?"update-interests":"first-use-select-interests"),this.trackingTrigger(s+e,{action:"click",module:this.model.getGroup(),region:"fixedtop",location:n,eventName:e,version:u[this.currentStep].trackingName,mediaId:this.model.get("variation"),pageType:this.pageManager.getMeta("applicationName"),contentCollection:u[this.currentStep].trackingName,contentId:i})},nextStep:function(){this.renderStep(this.currentStep+1)},prevStep:function(){this.renderStep(this.currentStep-1)},goToInterests:function(){this.renderStep(1)},unpinMasthead:function(){this.broadcast("nyt:in-content-theme-deactivate-pinned-masthead")},removeRibbonIfExists:function(){e("#ribbon").remove()}});return m}),define("article/common/instances/onboarding",["shared/onboarding/views/onboarding"],function(e){"use strict";new e({defaultCollapsed:!0})}),define("shared/sharetools/instances/story-meta-footer",["jquery/nyt","shared/sharetools/views/share-tools-container"],function(e,t){"use strict";var i;new t({el:e("#sharetools-story-meta-footer"),trackingRegion:"Header",modalSettings:{tailDirection:"left",tailLeftOffset:0,tailTopOffset:22,positionTailSide:!0,autoPosition:!0,toggleSpeed:1,toolTypeSponsor:"Article",openCallback:function(){var e=this,t=this.pageManager.getViewport().top;i=function(){Math.abs(t-this.pageManager.getViewport().top)>300&&e.close()},this.listenTo(this.pageManager,"nyt:page-scroll",i),this.$target.addClass("active")},closeCallback:function(){this.stopListening(this.pageManager,"nyt:page-scroll",i),this.$target.removeClass("active"),this.removeFromPage()}}})}),define("article/story/views/story",["underscore/nyt","jquery/nyt","foundation/hosts","foundation/views/base-view","foundation/models/user-data","shared/page/helpers/page-mixin","shared/sharetools/instances/cross-platform-save","article/common/views/adlibrary/requirements/dfp-article-requirements-mixin","foundation/views/page-manager"],function(e,t,i,n,s,a,o,r,l){"use strict";var d=n.extend(a).extend({el:"#main",scrollToAddendum:!1,isHashWithAddendum:!1,addendumScrollTop:0,mastheadHeight:0,originalAddendumScrollTop:0,visualGapsThreshold:75,windowWidth:null,events:{dragleft:"handleDrag",dragright:"handleDrag",dragstart:"handleDragStartEnd",dragend:"handleDragStartEnd","click .story-addendum-notice-link":"handleAddendumClick"},initialize:function(){var i=this;this.pageManager.flag("newsletterSignup")&&(this.insertNewsletterModule(),e.bindAll(i,"resizeNewsletterIFrame")),this.subscribe("nyt:xps-article-status",this.setSavedState),s.isLoggedIn()&&o.getArticlesStatus(this.pageManager.getCanonical()),l.flag("headlineBalancer")&&(this.windowWidth=l.cachedViewport.width,this.headlineBalancerShouldRun()&&(this.checkTabletsForHeadlineBalancing(),t(window).on("resize",function(){i.rebalanceHeadline()})))},handleDomReady:function(){var e=this.pageManager.getMeta("ad_sensitivity");this.$addendum=this.$el.find(".theme-main .addenda"),this.mastheadHeight=t("#masthead").height(),this.pageManager.isDesktop()&&this.truncateCaptionText(),this.checkForVisualGaps(),this.pageManager.getCurrentBreakpoint()<1050&&this.checkForOtherVisualGaps(".story-ad"),this.checkForOtherVisualGaps(".layout-large-horizontal, .layout-large-vertical, .layout-horizontal-inset, .layout-sub-medium, .layout-medium, .layout-large, .layout-xlarge"),t(".dropcap").parent().not(":eq(0)").css("padding-top","20px"),this.subscribe("nyt:ribbon-rendered",this.handleUrlWithAddendumHash),this.subscribe("nyt:page-scroll",this.handleScroll),(null===r.dfp||"noads"===e||"tragedy"===e||this.$html.hasClass("section-insider"))&&(this.$html.addClass("has-no-ads"),this.$html.removeClass("has-top-ad")),this.showReaderSatisfactionSurvey()},handleUrlWithAddendumHash:function(){"addenda"===this.pageManager.getUrlHash()&&(this.isHashWithAddendum=!0,this.handleAddendumClick())},rebalanceHeadline:e.debounce(function(){l.cachedViewport.width!==self.windowWidth&&(window.magnum.headlineBalancer.rebalanceHeadline(),this.windowWidth=l.cachedViewport.width)},50),checkTabletsForHeadlineBalancing:function(){this.$html.hasClass("viewport-portrait")&&this.subscribe("nyt:page-viewportchange",function(){this.magnum.getWidth()>1020&&window.magnum.headlineBalancer.rebalanceHeadline()})},headlineBalancerShouldRun:function(){return window.magnum.headlineBalancer.shouldRun()},checkForVisualGaps:function(){var e=this,i=t(".story-interrupter");t.each(i,function(){var i,n,s=0,a=t(this).prev(".story-body-supplemental"),o=a.find(".story-body-text.story-content:last"),r=a.find("figure:last").not(".lede"),l=t(this).offset(),d=o.offset();d&&d.top&&l&&l.top&&(i=d.top+o.height(),n=l.top,s=n-i),s>e.visualGapsThreshold&&r.length>0&&r.css({"float":"none",margin:"0 auto 25px"})})},checkForOtherVisualGaps:function(e){var i=t(e),n=80;t.each(i,function(){var e,i,s=0,a=t(this).prev(),o=t(this).prevUntil("figure").not(".lede").prev(),r=t(this).offset(),l=a.offset();l&&l.top&&r&&r.top&&(e=l.top+a.height(),i=r.top,s=i-e),s>n&&o.css({"float":"none",margin:"0 auto 25px"})})},isRibbonVisible:function(){return t("#masthead").hasClass("ribbon-visible")||this.pageManager.isMobile()&&"fixed"===t("#ribbon").css("position")?!0:!1},handleAddendumClick:function(){this.$addendum.length>0&&(this.originalAddendumScrollTop=this.$addendum.offset().top,this.isRibbonVisible()?this.addendumScrollTop=this.originalAddendumScrollTop-(this.mastheadHeight+t("#ribbon").height()):this.addendumScrollTop=this.originalAddendumScrollTop-this.mastheadHeight,t("html, body").animate({scrollTop:this.addendumScrollTop},400),this.isHashWithAddendum||(this.scrollToAddendum=!0),this.isHashWithAddendum=!1)},handleScroll:function(){!this.isRibbonVisible()&&this.scrollToAddendum&&(this.addendumScrollTop=this.originalAddendumScrollTop-this.mastheadHeight,t("html, body").stop(!0).animate({scrollTop:this.addendumScrollTop},400),this.scrollToAddendum=!1)},setSavedState:function(e){e?t(".save-sharetool").addClass("is-saved"):t(".save-sharetool").removeClass("is-saved")},showReaderSatisfactionSurvey:function(){var e,i=window.NYTD&&window.NYTD.Abra&&"VariantA"===window.NYTD.Abra("www-story-reader-satisfaction"),n=l.getUrlParam("showReaderSatisfactionSurvey");0==!t(".main .vis-survey-box").length&&(e=!0),0==!t(".main .g-survey-box").length&&(e=!0),e||(i||n)&&t(".reader-satisfaction-survey").removeClass("hidden")}});return d}),define("article/story/instances/story",["article/story/views/story"],function(e){"use strict";new e}),define("article/story/views/image-mirror",["underscore/nyt","jquery/nyt","foundation/views/base-view","foundation/hosts"],function(e,t,i,n){"use strict";var s=i.extend({initialize:function(){var e,i=this,s=/static.stg/gi,a=function(n){e=n.keyCode?n.keyCode:n.which,96===e&&(i.changeImageDomain(),t(window).unbind("keypress",a))};n.image.match(s)&&t(window).bind("keypress",a)},changeImageDomain:function(){var i=t("#story img"),n=/static.stg/gi;e.each(i,function(e){0===e.naturalWidth&&(e.src=e.src.replace(n,"static"))})}});return s}),define("article/story/instances/image-mirror",["article/story/views/image-mirror"],function(e){"use strict";return new e}),define("shared/https/instances/toggle-button",["jquery/nyt","foundation/cookies"],function(e,t){"use strict";function i(){l=!l}function n(e){h.style.transition=h.style.WebkitTransition="none",h.getBoundingClientRect(),h.style.transition=h.style.WebkitTransition="fill 0.5s ease",u.style.transition=u.style.WebkitTransition="none",u.style.strokeDasharray=m+" "+m,u.style.strokeDashoffset=e,u.getBoundingClientRect(),u.style.transition=u.style.WebkitTransition="stroke-dashoffset 0.5s ease-in-out"}function s(){n(0),h.style.fill="#9C9C9C",u.style.strokeDashoffset=m-g}function a(){n(m-g),h.style.fill="#6EAB47",u.style.strokeDashoffset=0}var o,r,l,d,c,h,u,m,g,p={cookieName:"nyt.np.https-everywhere",elementId:"internal-https-menu"};o=e("#"+p.elementId),0===o.length?o=e("
    ").attr("id",p.elementId):o.empty(),o.css({bottom:"20px",cursor:"pointer",height:"60px",padding:"5px",position:"fixed",right:"5px",width:"60px"}),r=t.readCookie(p.cookieName),null!==r&&"9"!==r&&o.appendTo(e("body")),l="1"===r,d=['','','','',""].join("\n"),c=e(d),h=c.find("circle")[0],u=c.find("path")[0],m=u.getTotalLength(),g=19,c.css({boxShadow:"0 0 4px rgba(0,0,0,.14), 0 4px 8px rgba(0,0,0,.28)",borderRadius:"50%"}).on("click",function(){t.writeCookie(p.cookieName,l?"0":"1",{domain:".nytimes.com",path:"/",expires:l?7:180}),l?s(e(this)):a(e(this)),document.location.reload()}).appendTo(o),l||s(c),setInterval(function(){var n=t.readCookie(p.cookieName);null===n||"9"===n?o.detach():e.contains(document,o[0])||o.appendTo("body"),l&&"1"!==n?(s(c),i()):l||"1"!==n||(a(c),i())},1e4)}),define("shared/newsletterpromo/views/newsletter-promo",["jquery/nyt","underscore/nyt","foundation/views/base-view","foundation/models/user-data","foundation/hosts"],function(e,t,i,n,s){"use strict";var a=i.extend({el:"#newsletter-promo",country:"United States",events:{"click #submit-button":"handleFormSubmit","click #sample-newsletter-link":"handleSampleClick"},gaBaseData:{hitType:"event",eventCategory:"Newsletters",nonInteraction:0,dimension149:"Sign-up Modules"},gaCheckCount:0,autoNewsletterTest:!1,autoNewsletterTestVariant:null,autoNewsletterRules:[],initialize:function(){var e;this.$newsletterForm=this.$el.find(".newsletter-form"),this.$newsletterForm&&this.$newsletterForm.length&&(this.productCode=this.$el.attr("data-newsletter-productCode"),this.productTitle=this.$el.attr("data-newsletter-productTitle")?this.$el.attr("data-newsletter-productTitle"):this.productCode,this.$specialOffers=this.$el.find("#special-offers"),this.$sampleLink=this.$el.find(".sample"),this.$manageEmail=this.$el.find(".manage-email"),this.$viewAllLink=this.$el.find(".view-all-link"),this.$privacyLink=this.$el.find(".privacy"),e=this.pageManager.getMeta("applicationName"),e=e.charAt(0).toUpperCase()+e.slice(1),this.gaBaseData.eventLabel=this.productTitle,this.gaBaseData.dimension150=e,this.hasFiredScroll=!1,this.subscribe("nyt:page-scroll",this.handleScroll),this.configureAutoNewsletterTest())},configureAutoNewsletterTest:function(){this.pageManager.flag("autoPlaceNewsletter")&&window.NYTD&&window.NYTD.Abra&&window.NYTD.Abra("www-auto-newsletter")&&("1"===window.NYTD.Abra("www-auto-newsletter")?(this.autoNewsletterTest=!0,this.autoNewsletterTestVariant=1,this.initAutoNewsletter()):"0"===window.NYTD.Abra("www-auto-newsletter")&&(this.autoNewsletterTest=!0,this.autoNewsletterTestVariant=0,this.removeAutoNewsletter()))},initAutoNewsletter:function(){var e,i=[],n=this.$el.find("#auto-newsletter-rules").text();if(n)try{e=window.JSON.parse(n),t.isArray(e)&&(e.forEach(function(e){"string"==typeof e.headline&&"string"==typeof e["product-code"]&&i.push(e)}),this.autoNewsletterRules=i)}catch(s){throw Error("Could not parse rules, "+s)}},removeAutoNewsletter:function(){this.$el.hasClass("auto-newsletter")&&(this.$el.remove(),this.stopSubscribing("nyt:page-scroll"))},fireTagxTrackingImpression:function(){this.sendTagxEvent({eventAction:"module impression",nonInteraction:1,metric6:1})},handleSampleClick:function(){this.sendTagxEvent({eventAction:"see sample",dimension149:null,dimension150:null})},sendTagxEvent:function(e){var i="r2d2.send",n={hit:t.extend({},this.gaBaseData,e)},s=this.pageManager.trackingTriggerEvent(i,n);s||this.pageManager.trackingAddToEventQueue({action:i,data:n})},handleUserReady:function(){var t=this;this.$newsletterForm&&this.$newsletterForm.length&&(n.getCountry()?this.country=n.getCountry():e.ajax({url:s.contentApiHost+"/svc/location/v1/current.json",type:"GET",dataType:"json",async:!1,success:function(e){t.country=e.country}}),"canada"!==this.country.toLowerCase()&&this.$specialOffers.prop("checked",!0),n.isLoggedIn()?!this.autoNewsletterTest&&e.inArray(this.productCode,n.getEmailSubscriptions())>-1?(this.$el.find(".subscriber").removeClass("hidden"),this.$el.find(".logout").removeClass("hidden"),this.$viewAllLink.removeClass("hidden"),this.$newsletterForm.addClass("hidden"),this.$sampleLink.addClass("hidden")):this.autoNewsletterTest&&1===this.autoNewsletterTestVariant&&this.placeBestAutoNewsletter(n):(this.$manageEmail.addClass("hidden"),this.autoNewsletterTest&&1===this.autoNewsletterTestVariant&&this.autoNewsletterRules.length&&this.populateFormFromRulesObj(this.autoNewsletterRules[0])),this.hasFiredScroll||this.handleScroll())},placeBestAutoNewsletter:function(t){var i,n,s=!1;if(this.autoNewsletterRules.length){for(i=0;i or
    to Follow

    ':'

    Sign Up or Log In
    to Follow

    ',this.modalSettings.modalContent=t,this.modal=new n(this.modalSettings)},open:function(){this.cancelDelayedClose(),this.modal.addToPage(),this.setElement(this.modal.$modal),this.modal.open()},close:function(){this.modal.close()},handleSignUpClick:function(e){e.stopPropagation(),e.preventDefault(),this.modal.close(),this.broadcast("nyt:registrationmodal-open",{modalTitle:"Sign Up to Follow",moduleName:"Follow"})},handleLogInClick:function(e){e.stopPropagation(),e.preventDefault(),this.modal.close(),this.broadcast("nyt:loginmodal-open",{modalTitle:"Log In to Follow",moduleName:"Follow"})},cancelDelayedClose:function(){this.modalCloseTimer&&window.clearTimeout(this.modalCloseTimer)},delayedModalClose:function(){var e=this;this.modalCloseTimer=window.setTimeout(function(){e.modal.close()},300)}});return s}),define("shared/readinglistfollowtest/templates",["underscore/nyt"],function(_){var templates={};return templates.followable=function(obj){var __t,__p="";Array.prototype.join;with(obj||{})__p+='

    Want more like this?

    \n
    \n
    \n\n
    \n
    \n

    '+(null==(__t=followable.headline)?"":__t)+'

    \n

    '+(null==(__t=followable.description)?"":__t)+'

    \n
    \n
    \n
    \n\n

    New stories will appear in your Reading List.

    \n
    ';return __p},templates.generic=function(obj){var __p="";Array.prototype.join;with(obj||{})__p+='

    Never miss a story.

    \n
    \n
    \n

    Follow the columns you love.

    \n

    We’ll automatically add new stories to your\nReading List.

    \n
    \n
    \n';return __p},templates}),define("shared/readinglistfollowtest/views/follow-promo",["jquery/nyt","underscore/nyt","foundation/models/user-data","foundation/views/base-view","foundation/views/page-manager","shared/data/models/followables","shared/data/models/followed","shared/readinglistfollowtest/views/auth-modal","shared/readinglistfollowtest/templates"],function(e,t,i,n,s,a,o,r,l){"use strict";var d=n.extend({followed:null,currentFollowable:null,el:"#newsletter-promo",events:{"click .follow-button":"handleButtonClick","mouseover .follow-button":"handleButtonHover","click .start-following-link":"handleLinkClick","mouseover .start-following-link":"handleLinkHover","click .reading-list-link":"trackReadingListLink"},authModal:null,initialize:function(){var e=this.pageManager.getMeta("nyt-collection:uri");this.followed=new o,this.$el.html("").removeClass("newsletter-signup").addClass("follow-promo"),this.currentFollowable=t.find(a,function(t){return e===t.collection_uri}),this.currentFollowable?this.$el.html(l.followable({followable:{buttonClasses:this.getButtonClasses(this.currentFollowable.slug),buttonText:this.getButtonText(this.currentFollowable.slug),headline:this.currentFollowable.headline,description:this.currentFollowable.summary,thumbnail:this.currentFollowable.thumbnail}})):this.$el.html(l.generic())},handleUserReady:function(){i.isLoggedIn()||(this.authModal=new r({followable:this.currentFollowable})),this.pageManager.isComponentVisible(this.$el)?this.recordTrackingImpression():this.subscribe("nyt:page-scroll",this.handleScroll),this.$el.removeClass("hidden")},handleScroll:function(){this.pageManager.isComponentVisible(this.$el)&&(this.recordTrackingImpression(),this.stopSubscribing("nyt:page-scroll"))},getButtonClasses:function(e){return this.followed.isFollowing(e)?" following":void 0},getButtonText:function(e){return this.followed.isFollowing(e)?"Following":"Follow"},handleButtonClick:function(e){var t,n;i.isLoggedIn()?(t=this.followed.toggleFollowing(this.currentFollowable.slug),n=t?"follow":"unfollow",this.recordTrackingInteraction("click",n),t?this.$el.find(".follow-button").addClass("following").text("Following"):this.$el.find(".follow-button").removeClass("following").text("Follow")):(e.preventDefault(),e.stopPropagation(),this.authModal.close(),this.recordTrackingInteraction("click","follow"),this.broadcast("nyt:registrationmodal-open",{modalTitle:"Sign Up to Follow",moduleName:"Follow"}))},handleButtonHover:function(){i.isLoggedIn()||(this.authModal.open(),this.recordTrackingInteraction("hover","follow"))},handleLinkClick:function(e){var t;this.recordTrackingInteraction("click","start-following"),i.isLoggedIn()||(t=this.trackingAppendParams(e.currentTarget.href,{module:"follow",version:this.getTrackingVersion(),action:"click",region:"body",pgtype:"article"}),window.location.href=t)},trackReadingListLink:function(t){var i,n=e(t.currentTarget);i=this.trackingAppendParams(n.attr("href"),{module:"follow",version:this.getTrackingVersion(),action:"click",region:"body",pgtype:"article"}),n.attr("href",i)},handleLinkHover:function(){i.isLoggedIn()||(this.authModal.open(),this.recordTrackingInteraction("hover","start-following"))},getTrackingVersion:function(){return this.currentFollowable?this.currentFollowable.slug:"general"},recordTrackingImpression:function(){this.trackingTriggerImpression("following-impression",{module:"follow",pgtype:"article",region:"body",action:"impression",version:this.getTrackingVersion(),proxyEventType:"impression",timestamp:(new Date).getTime()})},recordTrackingInteraction:function(e,t){this.trackingTrigger("following-interaction",{module:"follow",eventName:t,pgtype:"article",region:"body",action:e,version:this.getTrackingVersion(),proxyEventType:"action",timestamp:(new Date).getTime()})}});return d}),define("shared/newsletterpromo/instances/newsletter-promo",["shared/newsletterpromo/views/newsletter-promo","shared/readinglistfollowtest/views/follow-promo"],function(e,t){"use strict";var i=window.magnum.getFlags().indexOf("readingListFollowTest")>0,n=window.NYTD&&window.NYTD.Abra&&"variant"===window.NYTD.Abra("www-follow-test-1");i&&window.NYTD.Abra.reportExposure("www-follow-test-1"),i&&n?new t:new e}),define("shared/bundlepayflow/views/bundle-payflow",["jquery/nyt","underscore/nyt","foundation/views/base-view","foundation/models/user-data","foundation/views/page-manager","foundation/hosts"],function(e,t,i,n,s,a){"use strict";var o=i.extend({el:".bundle-payflow",events:{"click .sub-link":"handleBundleClick","click .cta-button":"handleClick","click .learn-more":"handleClick", "click .toggle":"togglePricing"},handleUserReady:function(){var t,i,s,o,r;if(n.getCountry()?s=n.getCountry():e.ajax({url:a.contentApiHost+"/svc/location/v1/current.json",type:"GET",dataType:"json",async:!1,success:function(e){s=e.country}}),"united states"===s.toLowerCase()&&(o=!0),r=window.NYTD.Abra("Liftoff"),this.isInTest=o&&!r&&window.NYTD&&window.NYTD.Abra&&1==window.NYTD.Abra("www-STORY_3bundlePayflow-v3")&&n&&!n.isHomeDeliverySubscriber()&&!n.isWebSubscriber()&&!n.isMobileSubscriber()&&!n.isTabletSubscriber()&&this.pageManager.flag("BundlePayFlow"),this.isInTest){for(t=document.querySelectorAll(".bundle-payflow img"),i=0;i