/*1358153685,178130467*/

if (self.CavalryLogger) { CavalryLogger.start_js(["ZW\/al"]); }

/** js/flashlog.js */
__d("flashLog",["AsyncSignal","swfobject"],function(a,b,c,d,e,f){






var g=b('AsyncSignal'),
h=b('swfobject');

e.exports.logPlayerVersion=function(){
var i=
{c:'flash_version_log',
m:JSON.stringify({flashVer:h.SWFObjectUtil.getPlayerVersion()})};

new g('/common/scribe_endpoint.php',i).send();};});

/** js/home/TickerReadStateTracking.js */
__d("TickerReadStateTracking",["Style","clickRefAction"],function(a,b,c,d,e,f){








var g=b('Style'),

h=b('clickRefAction'),

i=73,
j='ticker_hover',




k=[];





function l(n){
var o=JSON.parse(n.getAttribute('data-ft'));
if(!o)
return null;

if(o.mf_story_key)
return o.mf_story_key;

if(o.fbid)
return o.fbid;

return null;}







function m(n){
var o=l(n);
if(!o||o in k)
return;

k[o]=true;
var p={evt:i};
h(j,n,null,'FORCE',{ft:p});}







e.exports.log=m;});

/** js/home/TickerRightHideController.js */







function TickerRightHideController(){}

TickerRightHideController._markAsClosedHelper=function(a){

var b=ge('pagelet_reminders');
if(b){
var c=DOM.scry(b,'div.tickerToggleWrapper')[0];
if(c)
CSS.conditionClass(c,'displayedTickerToggleWrapper',a);}





var d=ge('pagelet_moments');
if(d){
var e=DOM.scry(d,'div.tickerToggleWrapper')[0];
if(e)
CSS.conditionClass(e,'displayedTickerToggleWrapper',a);}




var f=ge('pagelet_rhc_ticker');
if(f){
var g=DOM.scry(f,'div.tickerToggleWrapper')[0];
if(g)
CSS.conditionClass(g,"displayedTickerToggleWrapper",!a);

CSS.conditionClass(f,"hidden_rhc_ticker",a);}};



TickerRightHideController.markAsClosed=function(){
TickerRightHideController._markAsClosedHelper(true);};


TickerRightHideController.markAsUnclosed=function(){
TickerRightHideController._markAsClosedHelper(false);};

/** js/home/ticker.js */
__d("TickerController",["Event","Animation","Arbiter","AsyncRequest","AsyncSignal","Bootloader","ChannelConstants","ContextualDialogX","CSS","DOM","HTML","JSLogger","Keys","LayerFadeOnHide","LiveTimer","NavigationMessage","Parent","Run","ScrollableArea","Selector","Style","TickerReadStateTracking","Toggler","UIPagelet","URI","UserActivity","UserAgent","Vector","$","clickRefAction","collectDataAttributes","copyProperties","emptyFunction","ge","goURI","throttle","userAction","TickerRHCPageletByGK"],function(a,b,c,d,e,f){



































var g=b('Event'),

h=b('Animation'),
i=b('Arbiter'),
j=b('AsyncRequest'),
k=b('AsyncSignal'),
l=b('Bootloader'),
m=b('ChannelConstants'),
n=b('ContextualDialogX'),
o=b('CSS'),
p=b('DOM'),
q=b('HTML'),
r=b('JSLogger'),
s=b('Keys'),
t=b('LayerFadeOnHide'),
u=b('LiveTimer'),
v=b('NavigationMessage'),
w=b('Parent'),
x=b('Run'),
y=b('ScrollableArea'),
z=b('Selector'),
aa=b('Style'),
ba=b('TickerReadStateTracking'),
ca=b('Toggler'),
da=b('UIPagelet'),
ea=b('URI'),
fa=b('UserActivity'),
ga=b('UserAgent'),
ha=b('Vector'),

ia=b('$'),
ja=b('clickRefAction'),
ka=b('collectDataAttributes'),
la=b('copyProperties'),
ma=b('emptyFunction'),
na=b('ge'),
oa=b('goURI'),
pa=b('throttle'),
qa=b('userAction'),

ra=1,
sa=2,
ta=3,
ua=4,

va=r.create('ticker_controller');

function wa(){}

la(wa,
{_instances:{},
_activeInstance:null,
_placeholders:{},
_logPositionChange:false,

getInstance:function(xa){
var ya=w.byClass(ia(xa),'fbFeedTicker');
return ya?wa._instances[ya.id]:null;},


isLoaded:function(xa){
var ya=wa._placeholders[xa.id];
return !ya||ya.status==ta;},


show:function(xa,ya){
ya=ya||ma;
for(var za in wa._instances){
var ab=na(za);
if(!ab||ab.parentNode.id==xa.id)
continue;

wa.hide(ab.parentNode);}


wa._doPositionChange(xa);
o.show(xa);

var bb=wa._placeholders[xa.id];
if(bb&&bb.status==ra){
wa._fetchTickerForPlaceholder(xa,ya);}else{

var cb=p.scry(xa,'.fbFeedTicker')[0],
db=
cb&&wa.getInstance(cb);
wa._activeInstance=db;
db&&db._poll();
wa._placeholders[xa.id]=
{status:ua,
callback:ya};

ya();}},



_doPositionChange:function(xa){
if(!wa._logPositionChange||o.shown(xa))
return;


new k('/common/ods_endpoint.php',
{k:'ticker.render.switch.'+xa.id}).
send();},


hide:function(xa){
var ya=p.scry(xa,'.fbFeedTicker')[0],
za=ya&&wa.getInstance(ya);
za&&za.hideActiveStory();
o.hide(xa);},


hideStoriesByClass:function(xa){
for(var ya in wa._instances)
p.scry(ia(ya),xa).forEach(o.hide);},



hideStory:function(xa){
var ya=xa&&wa.getInstance(xa);
ya&&ya.hideStory(xa);},


undoHideStory:function(xa){
var ya=xa&&wa.getInstance(xa);
ya&&ya.undoHideStory(xa);},


insertStoriesAtBottom:function(xa){
wa._activeInstance.insertStoriesAtBottom(xa);},


_fetchTickerForPlaceholder:function(xa,ya){
var za=
{handler:function(){
wa._placeholders[xa.id].status=ta;
ya();}},



ab=b('TickerRHCPageletByGK'),
bb=ab.pagelet_name;

da.loadFromEndpoint
(bb,
xa.id,
wa._placeholders[xa.id].pageletData,
za);


wa._placeholders[xa.id].status=sa;},


registerStoryDialog:function(xa,ya){


i.subscribe('ticker/init',function(){
var za=na(xa),
ab=za&&wa.getInstance(za);
ab&&ab.registerStoryDialog(za,ya);},
i.SUBSCRIBE_ALL);},


registerPlaceholder:function(xa,ya){
var za=wa._placeholders[xa];
wa._placeholders[xa]=
{status:ra,
pageletData:ya};





if(za&&za.status==ua){
wa.show(ia(xa));
za.callback();}}});




la(wa.prototype,
{ADS_IDLE_MS:300000,
FLYOUT_MAX_HEIGHT:450,
FLYOUT_OFFSET_THRESHOLD:20,
FLYOUT_COMMENT_OFFSET:15,
FLYOUT_VIEWPORT_PADDING:75,
FLYOUT_TARGET_HEIGHT_OFFSET:25,

init:function(xa,ya,za){
wa._instances[xa.id]=this;
wa._activeInstance=this;
this._root=xa;
this._content=p.find(xa,'.ticker_stream');
this._stories=p.find(this._root,'.tickerActivityStories');
this._scrollableArea=ya;
this._container=p.find(xa,'div.uiScrollableAreaWrap');
this._newestStory={};

this._storyIDs=[];
this._objectIDs=[];
this._fetchedStories={};
this._removedStoryIDs=[];
this._storiesToRemove=[];

var ab=Date.now();
this._initTime=ab;
this._lastUpdate=ab;
this._lastPull=ab;
this._lastInsert=ab;
this._lastCustomStory=0;


this._pollOnly=false;



this._needNonCustomStoryNum=0;




this._doCustomUpdate=true;





this._autoloadStoryIndex=1;

this._scrollTopThreshold=100;
this._scrollTopPrompt=p.find(this._root,'.scrollTopPrompt');
this._scrollTopPromptVisible=false;

this._maxStoriesToKeep=50;
this._minStoriesToKeep=25;

this._tickerInSidebarMode=
!!w.byClass(this._root,'fbChatSidebar');

this._loadStoriesWithActions();


ja('ticker_flyout');
ja('ticker_flyout_prefetch');
ja('ticker_flyout_loadtime');
ja('ticker_stream');


this._ua=
{flyout:qa('ticker').
uai('flyout','flyout',false),
flyout_prefetch:qa('ticker').
uai('flyout_prefetch','flyout_prefetch',false),
flyout_loadtime:qa('ticker').
uai('ticker_flyout_loadtime',
'flyout_loadtime',false),
stream:qa('ticker').
uai('ticker_stream','stream',false)};

this._uaCurStoryIDFetch=null;
this._uaCurStoryIDPrefetch=null;


var bb=p.create('div',{className:'storyQueue hidden_elem'});
this._storyQueue=bb;
p.appendContent(this._root,bb);

this._initObjectIDs();
this._initPageletCache(za);
this._initConfig(za);
this._resetMorePager();
this._initListeners();
this._initSubscriptions(za);

i.inform('ticker/init',this,i.BEHAVIOR_PERSISTENT);

this._poll();


if(this._prefetchAfterLoad){
this._logUserEvent('stream','prefetch');
this._fetchStories(this._getInsertedStories().slice(0,5));}},



_loadStoriesWithActions:function(){
var xa=na('rightCol');
if(!xa)
return;

this._toggleWrapper=p.scry(xa,'.tickerToggleWrapper')[0];
if(this._toggleWrapper){
var ya=p.scry(this._stories,'.tickerStoryWithButton');
this._storiesWithActions={};
for(var za=0;za<ya.length;za++){
var ab=ya[za];
this._storiesWithActions[
ab.getAttribute('data-story-key')]=ab;}}},




_initPageletCache:function(xa){
if(window.PageletCacheController){
this._cache=
window.PageletCacheController.registerController
(this._root.parentNode.id,
this);

if(this._cache){
la(xa,this._cache.loadData());
this._cache.registerCleanup('Ticker/cleanup');}}},




_initConfig:function(xa){
la(this,

{_newest:xa.newest,


_page_newest:xa.newest,

_timeout:xa.timeout,


_heartbeatTimeout:Math.max(15000,xa.heartbeatTimeout),


_pullTimeout:Math.max(30000,xa.pullTimeout),

_insertTimeout:xa.insertTimeout,


_friendCount:xa.friendCount,

_maxQueueLength:xa.maxQueueLength,

_heartbeatEndpoint:xa.heartbeatEndpoint,

_noPoll:xa.nopoll,

_maxCustomQueueLength:xa.maxCustomQueueLength,



_customStoryInsertTimeout:Math.max(5000,xa.customStoryInsertTimeout),

_nonCustomToCustomStoryRatio:xa.nonCustomToCustomStoryRatio,






_minForceUpdateInterval:Math.max(xa.insertTimeout,xa.minForceUpdateInterval),


_popupOnHover:xa.popupOnHover,

_priorityAppId:xa.priorityAppId,

_prefetchOnHover:xa.prefetchStoriesOnHover,


_userIdleTimeout:xa.userIdleTimeout,

_firstCustomStoryDelay:xa.firstCustomStoryDelay,
_pollOnly:xa.pollOnly,
_tickerSource:xa.tickerSource,
_prefetchAfterLoad:xa.prefetchAfterLoad,
_logFlyouts:xa.logFlyouts,
_userScrollGaurdDelay:xa.userScrollGaurdDelay,
_rescheduleScrollToTopDelay:xa.rescheduleScrollToTopDelay,
_aggressiveRegulator:xa.aggressiveRegulator});

this._queueCustomStories(xa.customStories);},


_initListeners:function(){
this._listeners=g.listen(this._root,
{click:this._handleClick.bind(this),
keydown:this._handleKeydown.bind(this),
mouseout:this._handleMouseout.bind(this),
mouseover:this._handleMouseover.bind(this),
mousedown:this._tickerDeClicker.bind(this),
mouseup:this._handleMouseup.bind(this)});


this._listeners.scroll=g.listen
(this._container,
'scroll',
pa(this._handleScroll.bind(this)));

this._initInfiniteScrollListener.bind(this).defer();},


_initSubscriptions:function(xa){
x.onLeave(this._cleanup.bind(this));

this._subscriptions=
[i.subscribe
(v.NAVIGATION_BEGIN,
this._onNavHandler.bind(this)),
i.subscribe
(m.getArbiterType('ticker_update'),
this._handleTickerPush.bind(this)),
i.subscribe
('composer/publish',
this._handleComposerPublish.bind(this)),
i.subscribe
('Ticker/storiesInserted',
this._handleStoriesInserted.bind(this)),
i.subscribe
('Ticker/fixed',
this._setFixed.bind(this,true)),
i.subscribe
('Ticker/unfixed',
this._setFixed.bind(this,false)),
i.subscribe
('Ticker/resized',
this._checkInfiniteScroll.bind(this)),
i.subscribe
('ufi/comment',
this._scrollDialogToBottom.bind(this)),
i.subscribe
('Ticker/chatOpened',
this._handleChatOpened.bind(this))];


if(xa.pushChannel)
this.setPushChannel(xa.pushChannel);},



_handleClick:function(event){
var xa=event.getTarget();
if(this._getButtonFromNode(xa)){
this._logUserAction(xa,'click',event);
this._handleActionButton(event);
return;}



var ya=this._getStoryFromNode(xa),
za=w.byClass(xa,'tickerStoryAllowClick');
if(!ya||ya==this._selectedStory||za)
return;


if(this._storyIsHidden(ya))
return;



if(ya==this._activeStory&&!this._selectedStory)
this._selecting=true;


this._clearNux();
this._logUserEvent('flyout','click');
this._logUserEvent('flyout_loadtime','open');

if(this._storyCanOpenExternally(ya)){
var ab=ya.getAttribute('data-href');
if(ab&&!xa.getAttribute('href')){
var bb={href:ab},
cb=ka(xa,['ft','gt']);

ja('click',bb,event,'FORCE',cb);
qa('ticker',bb,event).uai('click');}else 

this._logUserAction(xa,'click',event);

this._openStoryExternally(ya,event);
return;}


this._logUserAction(xa,'flyout',event);
this._activateStory(ya,'click');
this._selectStory(ya);},


_handleMouseover:function(event){
this._setLocked(true);

var xa=event.getTarget(),
ya=this._getOpenableStory(xa);
if(!ya)
return;



event.kill();


if(this._prefetchOnHover||this._popupOnHover){
if(!(ya.id in this._fetchedStories)){
this._logUserEvent('flyout_prefetch','prefetch_on_hover');
this._uaCurStoryIDPrefetch=ya.id;}


this._fetchStory(ya);}


if(this._selectedStory)
return;



if(this._popupOnHover){
this._clearHoverTimeouts();
var za=this._storyCanOpenExternally(ya)?500:1000,
ab=this._activeStory?75:za;

this._hoverShowTimeout=this._setTimeout(function(){
this._logUserEvent('flyout','hover',ab);
this._logUserEvent('flyout_loadtime','open');
this._activateStory(ya,'hover');
this._logUserAction(xa,'flyout',event);}.
bind(this),ab);}},



_handleMouseout:function(event){
var xa=event.getTarget();
this._setLocked(false);

if(xa==this._getStoryFromNode(xa)){
var ya=p.scry(xa.parentNode,'.openToggler');
for(var za=0;za<ya.length;za++)
z.toggle(ya[za]);}



this._clearClickedStory();
this._scheduleHide();},


_handleKeydown:function(event){
this._tickerDeClicker(event);

var xa=this._activeStory;
if(!xa)
return;


var ya=g.getKeyCode(event);
switch(ya){
case s.UP:
case s.DOWN:
var za=this._getInsertedStories(),
ab;
if(event.getModifiers().any){
ab=ya===s.UP?0:za.length-1;}else 

ab=za.indexOf(xa)+(ya===s.UP?-1:1);

xa=za[ab];
break;

case s.ESC:this._deactivateStory(true);return;
default:return;
}

if(!xa)
return;



event.kill();

this._activateStory(xa,'keypress');
this._selectStory(xa);},


_fadeTopmostStoryButton:function(){

var xa=0,
ya=15;

if(this._storiesWithActions)
for(var za in this._storiesWithActions){
var ab=this._storiesWithActions[za],
bb=p.scry(ab,'.tickerInlineActionButton')[0],


cb=p.scry(bb,'.tickerActionIcon')[0],
db=
ha.getElementPosition(bb).y-
ha.getElementPosition(this._toggleWrapper).y;

if(db<xa){
aa.set(bb,'opacity',0);
aa.set(cb,'opacity',0);}else
if(db>=xa&&db<ya){
var eb=(db-xa)/(ya-xa);
aa.set(bb,'opacity',eb);
aa.set(cb,'opacity',eb);
break;}else{

aa.set(bb,'opacity',1);
aa.set(cb,'opacity',1);}}},





_handleScroll:function(){
this._fadeTopmostStoryButton();

!this._preventScrollDismiss&&this._deactivateStory(true);
this._checkInfiniteScroll();
this._setIsUserScrolling();


if(!this._scrollLogged){
this._scrollLogged=true;
var xa=this._stories.childNodes.length,
ya=this._stories.getAttribute('data-gt'),
za={ticker_scroll:1,number_stories:xa,source:ya};

ja('scroll',null,null,'FORCE',{gt:za});
qa('ticker').uai('scroll');}},



_setIsUserScrolling:function(){
clearTimeout(this._userScrollingToken);


if(this._isScrolledToTop()){
this._userScrolling=false;
return;}

this._userScrolling=true;
this._userScrollingToken=setTimeout
(function(){
this._userScrolling=false;
this._userScrollingToken=null;}.
bind(this),
this._userScrollGaurdDelay);},


_isUserScrolling:function(){
return this._userScrolling;},


_handleStoriesInserted:function(){
this._initInfiniteScrollListener();
if(this._scrollableArea instanceof y){
this._scrollableArea.adjustGripper();}else 

va.error('wrong_scrollable_area',{dump:this});

this._logUserEvent('stream','insert');},


_handleActionButton:function(event){
var xa=event.getTarget(),
ya=this._getOpenableStory(xa),



za=this._getStoryDialog(ya);
if(za)
var ab=za.subscribe('beforehide',function(){
za.unsubscribe(ab);
return false;});},




_handleScrollToTopClick:function(){
this._scrollToTop(this._poll.bind(this));},


_scheduleScrollToTop:function(){
this._scrollToTopToken&&clearTimeout(this._scrollToTopToken);
this._scrollToTopToken=setTimeout(function(){

if(this._isLocked()||this._isUserScrolling()){
this._scheduleScrollToTop();}else{

this._scrollToTopToken=null;
this._scrollToTop();}}.

bind(this),
this._rescheduleScrollToTopDelay);},


_scrollToTop:function(xa){
new h(this._container).
to('scrollTop',0).
ease(h.ease.end).
ondone(xa).
go();},


_clearHoverTimeouts:function(){
clearTimeout(this._hoverShowTimeout);
clearTimeout(this._hoverHideTimeout);},


_getAllStories:function(){
return p.scry(this._root,'div.fbFeedTickerStory');},


_getInsertedStories:function(){
return this._getAllStories().filter(function(xa){
return !o.hasClass(xa,'queuedStory')&&
!o.hasClass(xa,'customStory');});},



_getQueuedStories:function(){
return p.scry(this._storyQueue,'.fbFeedTickerStory.queuedStory');},


_getQueuedCustomStories:function(){
return p.scry(this._storyQueue,'.fbFeedTickerStory.customStory');},


_getButtonFromNode:function(xa){
return w.byClass(xa,'tickerInlineOverlay');},


_getStoryFromNode:function(xa){
return w.byClass(xa,'fbFeedTickerStory');},


_getActionButtonFromStory:function(xa){
return p.scry(xa,'.tickerInlineActionButton')[0];},


_getOpenableStory:function(xa){
var ya=this._getStoryFromNode(xa);
return this._storyCanOpenDialog(ya)?ya:null;},


_getStoryDialog:function(xa){
return n.getInstance(xa);},


_getStoryDialogEndpoint:function(xa){

return xa&&
xa.getAttribute('data-rel')=='async'&&
xa.getAttribute('data-ajaxify')||
null;},


_storyCanOpenDialog:function(xa){
return !!this._getStoryDialogEndpoint(xa)&&!this._storyIsHidden(xa);},


_storyCanOpenExternally:function(xa){
return !!xa.getAttribute('data-href')||!this._storyCanOpenDialog(xa);},


_storyIsHidden:function(xa){
return o.hasClass(xa,'tickerStoryHidden');},


hideActiveStory:function(){
this._activeStory&&this.hideStory(this._activeStory);},


hideStory:function(xa){
this._deactivateStory();
if(p.getText(xa)==='')
p.remove(xa);

o.addClass(xa,'tickerStoryHidden');
o.removeClass(xa,'tickerStoryClickable');},


undoHideStory:function(xa){
o.addClass(xa,'tickerStoryClickable');
o.removeClass(xa,'tickerStoryHidden');},


insertStoriesAtBottom:function(xa){

if(!xa)
return;






var ya=p.create('div');
ya.appendChild(xa);
var za=p.scry(ya,'.fbFeedTickerStory'),
ab=p.find(ya,'.tickerMorePager'),
bb=[];

for(var cb=0;cb<za.length;cb++)
if(!this.dedupeStory(za[cb]))
bb.push(za[cb]);



if(bb.length){

bb.push(ab);
p.replace(p.find(this._root,
'.tickerMorePager'),
bb);}


i.inform('Ticker/storiesInserted');},


_scheduleHide:function(){
if(this._popupOnHover&&!this._selectedStory){

this._clearHoverTimeouts();
this._hoverHideTimeout=this._setTimeout
(this._deactivateStory.bind(this),
100);}},



_setScrollTopPromptVisible:function(xa){
this._scrollTopPromptVisible=xa;
o.conditionShow(this._scrollTopPrompt,xa);
if(xa&&!this._listeners.scrollTop){
this._listeners.scrollTop=g.listen(this._scrollTopPrompt,
{click:this._handleScrollToTopClick.bind(this)});}else

if(!xa&&this._listeners.scrollTop){
this._listeners.scrollTop.click.remove();
this._listeners.scrollTop=null;}},







_isUserIdle:function(){
return !fa.isActive(this._userIdleTimeout);},


_schedulePoll:function(){
clearTimeout(this._pollToken);
this._pollToken=this._setTimeout(this._poll.bind(this),this._timeout);},






_poll:function(){
if(!this._isTickerVisible())
return;





if(this._storiesToRemove.length>0){
if(this._isInsertingStory)
return this._schedulePoll();


var xa=this._storiesToRemove.pop();
this.removeStory(xa);}


var ya=
!this._isScrolledToTop()&&this._getQueuedStories().length;
this._setScrollTopPromptVisible(ya);



var za=Date.now(),
ab=za-this._lastInsert;
if(ab<this._insertTimeout||this._isLocked())
return this._schedulePoll();


var bb=this._getQueuedStories(),
cb=this._getQueuedCustomStories(),






db=this._isUserIdle(),
eb=bb.length>0,
fb=cb.length>0&&
!db&&
(za-this._initTime>this._firstCustomStoryDelay)&&
(this._needNonCustomStoryNum===0||(!eb&&
(za-this._lastCustomStory)>this._customStoryInsertTimeout));

if(fb){
this.insertStory(cb.shift());
this._lastCustomStory=za;
this._needNonCustomStoryNum=this._nonCustomToCustomStoryRatio;
return this._schedulePoll();}


if(eb){
this.insertStory(bb.shift());
this._needNonCustomStoryNum--;
if(this._needNonCustomStoryNum<0)
this._needNonCustomStoryNum=0;

return this._schedulePoll();}





if(db)
return fa.subscribeOnce(this._poll.bind(this));




var gb=
cb.length===0&&
this._needNonCustomStoryNum===0&&
this._nonCustomToCustomStoryRatio>0&&
fa.isActive(this.ADS_IDLE_MS)&&
((za-this._lastUpdate)>this._minForceUpdateInterval),



hb=false,
ib=false;
if(this._pollOnly){
ib=za-this._lastUpdate>this._heartbeatTimeout;}else 

hb=(za-this._lastPull>this._pullTimeout);



var jb=
(gb&&this._doCustomUpdate)||
hb||
ib;

if(!jb)
return this._schedulePoll();


if(gb)
this._doCustomUpdate=false;


this.update
({pull:hb,
fullpoll:ib,
needcustomstory:gb});},







update:function(xa){
if(this._noPoll&&!this._pollOnly)
return this._schedulePoll();

var ya=



{newest:(xa.fullpoll||xa.cache_update)?this._newest:
this._page_newest,
storyids:this._storyIDs,
friendcount:this._friendCount,
priorityappid:this._priorityAppId,
source:this._tickerSource,
needcustomstory:this._nonCustomToCustomStoryRatio>0};


la(ya,xa);

new j().
setURI(this._heartbeatEndpoint).
setReadOnly(true).
setOption('retries',0).
setData(ya).
setHandler(this._handleResponse.bind(this)).
setFinallyHandler(this._poll.bind(this)).



setAllowCrossPageTransition(true).
send();

this._lastUpdate=Date.now();

if(ya.pull)
this._lastPull=this._lastUpdate;

this._storyIDs=[];},









insertStory:function(xa,ya,za){
this._lastInsert=Date.now();
window.LiveTimer&&u.addTimeStamps(xa);

o.removeClass(xa,'queuedStory');
o.removeClass(xa,'customStory');

if(ya!==false){
var ab=za?this._fadeStoryIn:this._flyStoryIn;
if(this._isUserScrolling()){
var bb=function(){
this._container.scrollTop=
this._container.scrollTop+this._stories.firstChild.offsetHeight;
this._scheduleScrollToTop();}.
bind(this);
this._fadeStoryIn(xa,bb);}else 

this._scrollToTop(ab.bind(this,xa));}else 


p.prependContent(this._stories,xa);


if(this._storiesWithActions&&
o.hasClass(xa,'tickerStoryWithButton'))
this._storiesWithActions[
xa.getAttribute('data-story-key')]=xa;


this._removeOldStories();},





_removeOldStories:function(){
var xa=this._getInsertedStories();
if(xa.length<=this._maxStoriesToKeep)
return;

var ya=this._minStoriesToKeep,
za=xa.slice(ya);
za.forEach(p.remove);

if(this._storiesWithActions)
for(var ab=0;ab<za.length;ab++)
delete this._storiesWithActions[
za[ab].getAttribute('data-story-key')];



this._resetMorePager();},


_resetMorePager:function(){
var xa=this._getInsertedStories();
if(!xa||!xa.length)
return;

var ya=
xa[xa.length-1].getAttribute('data-ticker-timestamp'),
za=p.scry(this._root,'.tickerMorePager a')[0];
if(!za||!ya)
return;

var ab=new ea(za.getAttribute('ajaxify'));
ab.addQueryData({oldest:ya});
za.setAttribute('ajaxify',ab);},


_setLocked:function(xa){
this._locked=xa;},


_isLocked:function(){
return !!(this._locked||this._activeStory);},


informAndRemoveStory:function(xa,ya,za){
var ab=this._getStoryFromNode(xa),
bb=ab.getAttribute('data-story-key');
p.setContent(ab,ya);
o.addClass(ab,'highlightedStory');
this._setTimeout(this.removeStory.bind(this,bb),za||6000);},


_getStoryByStoryKey:function(xa){
var ya=this._getAllStories();
for(var za=0;za<ya.length;za++){
var ab=ya[za];
if(ab.getAttribute('data-story-key')==xa)
return ab;}


return null;},


removeStory:function(xa){
this._removedStoryIDs[xa]=true;
var ya=this._getStoryByStoryKey(xa);
if(!ya)
return;


if(this._storiesWithActions)
delete this._storiesWithActions[xa];


if(ya==this._activeStory)
this._deactivateStory();


var za=this._getStoryDialog(ya);
za&&za.destroy();

if(o.hasClass(ya,'queuedStory')){
p.remove(ya);
return;}


this._animateStoryOut(ya);},


_isScrolledToTop:function(){
return this._container.scrollTop<=this._scrollTopThreshold;},


_flyStoryIn:function(xa){
var ya=p.create('div',{style:{marginTop:'-1000px'}},xa);
aa.set(ya,'opacity',0);
p.prependContent(this._stories,ya);

var za=ha.getElementDimensions(ya).y;
aa.set(ya,'marginTop','-'+za+'px');

this._isInsertingStory=true;
new h(ya).
to('marginTop',0).
ease(h.ease.end).
checkpoint(.5).
to('opacity',1).
ondone(function(){
p.replace(ya,xa);
this._afterInsert(xa);
this._isInsertingStory=false;}.
bind(this)).
go();},


_fadeStoryIn:function(xa,ya){
new h(this._stories).
to('opacity',.5).
ondone(function(){
p.prependContent(this._stories,xa);
if(ya)
ya();

new h(this._stories).
to('opacity',1).
ondone(function(){
this._afterInsert(xa);}.
bind(this)).
go();}.
bind(this)).
go();},


_animateStoryOut:function(xa){
var ya=p.create
('div',
{style:{overflow:'hidden',position:'relative'}});

p.insertBefore(xa,ya);
p.appendContent(ya,xa);

new h(ya).
to('top',20).
to('height',0).
to('opacity',0).
ease(h.ease.end).
ondone(function(){
p.remove.curry(ya);
i.inform('Ticker/animateOut');}.
bind(this)).
go();},


_afterInsert:function(xa){
i.inform('Ticker/afterInsert');},


setPushChannel:function(xa){
this._pushSubscription&&this._pushSubscription.unsubscribe();
this._pushSubscription=
i.subscribe
(m.getArbiterType(xa),
this._handleTickerPush.bind(this));
d
(['ChatConfig','ChannelConnection'],
function(ya,za){
this._channelConnection=za;

this._checkChannelConnection();

this._channelConnectionSubscription=
this._channelConnection.subscribe
([this._channelConnection.CONNECTED,
this._channelConnection.RECONNECTING,
this._channelConnection.SHUTDOWN,
this._channelConnection.MUTE_WARNING,
this._channelConnection.UNMUTE_WARNING],
this._handleChannelConnection.bind(this));}.

bind(this));},



_checkChannelConnection:function(){
o.conditionClass
(this._root,
'disconnected',
this._channelConnection.disconnected());},



setCurrentAppId:function(xa){
this._priorityAppId=xa;},


_handleTickerPush:function(xa,ya){
var za=ya.obj;
if(za.delete_id){
this._storiesToRemove.push(za.delete_id);
return;}


if(za.fromups)
if(za.do_logging)
this._logDarkLaunch(za);



var ab=za.story_xhp;
if(!ab)
return;


this._newest=za.story_time;
var bb=q(ab).getRootNode();
this.queueStory(bb,za.flyout_js_cmds);
if(this._aggressiveRegulator&&za.actor==this._newestStory.actorID){
this.removeStory(this._newestStory.storyKey);
new k('/common/ods_endpoint.php',
{k:'ticker.aggr.remove'}).
send();}

this._newestStory=
{actorID:za.actor,
storyKey:bb.getAttribute('data-story-key')};},



_handleComposerPublish:function(xa,ya){
ya.tickerMarkup&&this.insertStory(ya.tickerMarkup);},


_clearNux:function(){
var xa=p.scry(document.body,'div.tickerNUXContainer');
if(xa.length){
xa.forEach(function(ya){
var za=n.getInstance(ya);
za&&za.hide();});

new j().setURI('/ajax/feed/ticker/nux.php').send();}


this._clearNux=ma;},


_logDarkLaunch:function(xa){
var ya=
{actor:xa.actor,
story_time:xa.story_time,
key:xa.story_obj_id,
dark:1};

new j().
setURI('/alite/push/log.php').
setData({msg:JSON.stringify(ya)}).
send();},


_logRender:function(){
if(this._loggedRender)return;

var xa=this._tickerInSidebarMode;
if(xa||w.byClass(this._content,'home_right_column')){
new k('/ajax/log_ticker_render.php',
{sidebar_mode:xa}).
send();
this._loggedRender=true;}},



_isTickerVisible:function(){
var xa=(wa._activeInstance==this);
xa&&this._logRender();
return xa;},






_handleResponse:function(xa){
var ya=xa.getPayload();
if(ya.newest)
this._newest=this._page_newest=ya.newest;


if(ya.content)
if(ya.cache_update&&this._cache){
this._cache.insertStory(ya.content);}else
if(ya.content instanceof Array){
for(var za=0;za<ya.content.length;za++)
this.queueStoryMarkup(ya.content[za]);}else 


this.queueStoryMarkup(ya.content);



if(ya.custom_stories&&ya.custom_stories.length){
this._queueCustomStories(ya.custom_stories);
this._doCustomUpdate=true;}},



queueStoryMarkup:function(xa){
var ya=q(xa).getRootNode();
this.queueStory(ya);},


dedupeStory:function(xa){
var ya=xa.getAttribute('data-story-key'),
za=
ya&&(!!this._objectIDs[ya]||!!this._removedStoryIDs[ya]);













ya&&(this._objectIDs[ya]=true);
return za;},


queueStory:function(xa,ya){
if(this.dedupeStory(xa))return;

o.addClass(xa,'queuedStory');
p.appendContent(this._storyQueue,xa);

var za=ya&&ya.length;
if(za)
ya.forEach(function(bb){
new Function(bb).apply();});






xa.setAttribute('id',xa.id+'_'+this._root.id);
var ab=this._getQueuedStories();
ab.slice(0,-this._maxQueueLength).forEach(p.remove);

if(za)


this._fetchedStories[xa.id]=true;},



_queueCustomStories:function(xa){
while(xa.length){
var ya=xa.shift();
ya=q(ya).getRootNode();
if(this.dedupeStory(ya))continue;
o.addClass(ya,'customStory');
p.appendContent(this._storyQueue,ya);}

var za=this._getQueuedCustomStories();
za.slice(0,-this._maxQueueLength).forEach(p.remove);},


_cleanup:function(){
wa._placeholders.pagelet_rhc_ticker=null;


if(!w.byClass(this._content,'hasRightCol'))
return;


this._objectIDs=[];
this._subscriptions.forEach(i.unsubscribe);
this._channelConnectionSubscription&&
this._channelConnection.unsubscribe(this._channelConnectionSubscription);
this._pushSubscription&&this._pushSubscription.unsubscribe();
for(var xa in this._listeners)
this._listeners[xa]&&this._listeners[xa].remove();

clearTimeout(this._pollToken);
this._pollToken=null;
this._cleanupInputFocusListener();
this._cleanupContentResizeListener();
i.inform('Ticker/cleanup');},


_onNavHandler:function(xa,ya){
var za=ya.params.key;
if(za!='lf'&&za!='h')

this._cleanup();},



registerStoryDialog:function(xa,ya){
if(this._uaCurStoryIDFetch==xa.id){
this._uaCurStoryIDFetch=null;
this._logUserEvent('flyout','fetch_success');}

if(this._uaCurStoryIDPrefetch==xa.id){
this._uaCurStoryIDPrefetch=null;
this._logUserEvent('flyout_prefetch','prefetch_success');}




this._fetchedStories[xa.id]=true;

ya.setContext(xa);
ya.subscribe('hide',this._deactivateStory.bind(this,true));
ya.subscribe('success',this._focusStory.bind(this,xa));
ya.subscribe('beforehide',function(){
if(this._selecting){
this._selecting=false;
return false;}}.

bind(this));

if(this._popupOnHover){
ya.subscribe('mouseenter',this._clearHoverTimeouts.bind(this));
ya.subscribe('mouseleave',this._scheduleHide.bind(this));
ya.subscribe('show',function(){

this._highlightDialogScrollbar.bind(this,ya).defer();

var za=g.listen(ya.getContent(),'mousedown',function(){
this._selectStory(xa);
za.remove();}.
bind(this));}.
bind(this));}


if(xa==this._activeStory){
this._logUserEvent('flyout_loadtime','show_fetched');
this._logUserEvent('flyout','show');
this._openDialog(ya);}},



_highlightDialogScrollbar:function(xa){
var ya=p.scry(xa.getContent(),'.uiScrollableArea')[0];
ya&&y.poke(ya);},


_openStoryExternally:function(xa,event){

var ya=xa.getAttribute('data-href');
if(!ya||ya=='#')
return;


var za=xa.getAttribute('data-story-rel');
switch(za){
case 'theater':
this._deactivateAndClearStory();
l.loadModules(['PhotoViewer'],function(cb){
cb.bootstrap(ya,xa);});

return;
case 'async':
this._deactivateAndClearStory();
j.bootstrap(ya,xa);
return;}




var ab=xa.getAttribute('data-target'),
bb=(event.which!=1||
event.getModifiers().any||
ab=='_blank');
bb?window.open(ya,'_blank'):oa(ya);},


_deactivateAndClearStory:function(){
this._clearHoverTimeouts();
this._deactivateStory();},


_focusStory:function(xa){


clearTimeout(this._scrollDismissal);
this._preventScrollDismiss=true;
this._scrollDismissal=this._setTimeout(function(){
this._preventScrollDismiss=false;}.
bind(this),100);


xa.focus();},


_selectStory:function(xa){
this._selectedStory=xa;
o.addClass(xa,'tickerStorySelected');
o.addClass(this._root,'tickerChildSelected');},


_activateStory:function(xa,ya){
this._clearHoverTimeouts();
if(xa==this._activeStory||!this._storyCanOpenDialog(xa))
return;


this._deactivateStory();
this._focusStory(xa);
this._activeStory=xa;
o.addClass(xa,'tickerStoryActive');


window.Toggler&&ca.hide();

if(this._logFlyouts){
ya=ya||'unknown';
new k('/ajax/feed/ticker/flyout.php',{src:ya}).send();}



ba.log(xa);

var za=this._getStoryDialog(xa);
if(za){
this._logUserEvent('flyout_loadtime','show_prefetched');
this._logUserEvent('flyout','show');
this._openDialog(za);
return;}




if(!(xa.id in this._fetchedStories)){
this._uaCurStoryIDFetch=xa.id;
this._logUserEvent('flyout','fetch');}

this._fetchStory(xa);},


_deactivateStory:function(xa){

if(this._activeStory===this._deactivatingStory)
return;


this._deactivatingStory=this._activeStory;

if(this._dialog){
if(xa===true){
this._dialog.enableBehavior(t);}else 

this._dialog.disableBehavior(t);

this._dialog.hide();
this._logUserEvent('flyout','close');}


if(this._activeStory){
o.removeClass(this._activeStory,'tickerStoryActive');
o.removeClass(this._activeStory,'tickerStorySelected');
o.removeClass(this._root,'tickerChildSelected');}


this._dialog=this._selectedStory=this._activeStory=null;

this._cleanupInputFocusListener();
this._cleanupContentResizeListener();

this._deactivatingStory=null;},


_logUserAction:function(xa,ya,event){

ja(ya,xa,event,'FORCE');
qa('ticker',xa,event).uai(ya);},


_logUserEvent:function(xa,event){
if(this._ua[xa])
this._ua[xa].add_event(event);},



_fetchStory:function(xa){
clearTimeout(this._fetchToken);

var ya=[],
za=this._getInsertedStories(),
ab=za.indexOf(xa);

[-1,0,1].forEach(function(bb){
var cb=za[ab+bb];
cb&&ya.push(cb);},
this);

this._fetchToken=setTimeout(this._fetchStories.bind(this,ya),100);},


_fetchStories:function(xa){
var ya=[],
za,
ab=function(bb){
clearTimeout(za);
xa.forEach(function(cb){
o.conditionClass(cb,'tickerStoryFetching',bb);});};



xa=xa.filter(function(bb){
if(bb.id in this._fetchedStories)return false;
this._fetchedStories[bb.id]=true;
var cb=this._getStoryDialogEndpoint(bb),
db=ea(cb).getQueryData();
if(!cb||!db)
return false;

db.uniq_id=bb.getAttribute('id');
db.referrer=this._tickerSource;
ya.push(db);
return true;},
this);

if(!ya.length)
return;


za=this._setTimeout(ab.curry(true),500);
new j('/ajax/feed/ticker/multi_story').
setFinallyHandler(ab.curry(false)).
setErrorHandler(ma).
setData({stories:ya}).
setAllowCrossPageTransition(this._tickerInSidebarMode).
send();},





_tickerDeClicker:function(event){
var xa=event.getTarget(),
ya=w.byTag(xa,'a'),
za=this._getStoryFromNode(xa),
ab=this._getButtonFromNode(xa);
if(za&&ya&&!ab&&
o.hasClass(za,'tickerStoryClickable')&&
!o.hasClass(ya,'tickerStoryAllowClick')&&
!this._storyIsHidden(za)){
ya.setAttribute('rel','ignore');
ya.removeAttribute('onclick');
ya.removeAttribute('ajaxify');
ya.removeAttribute('href');}




var bb=(event.button==2),
cb=(event.type==='keydown'),
db=za&&this._getActionButtonFromStory(za);
if(!bb&&db&&!cb)
this._setClickedStory(za);},



_handleMouseup:function(event){
this._clearClickedStory();},



_setClickedStory:function(xa){
this._clearClickedStory();
o.addClass(xa,'tickerStoryClicked');
this._clickedStory=xa;},


_clearClickedStory:function(){
if(this._clickedStory){
o.removeClass(this._clickedStory,'tickerStoryClicked');
this._clickedStory=null;}},



_initInfiniteScrollListener:function(){
var xa=this._getInsertedStories();

if(this._storiesWithActions)
for(var ya=0;ya<xa.length;ya++){
var za=xa[ya];
if(o.hasClass(za,'tickerStoryWithButton'))
this._storiesWithActions[
za.getAttribute('data-story-key')]=za;}




var ab=Math.max(0,xa.length-this._autoloadStoryIndex);
this._infiniteScrollStory=xa[ab];
this._checkInfiniteScroll();},


_checkInfiniteScroll:function(){
if(this._infiniteScrollStory){
var xa=ha.getElementPosition(this._infiniteScrollStory).y,
ya=
ha.getElementPosition(this._container).y+
ha.getElementDimensions(this._container).y;
if(xa<ya){
var za=p.scry(this._root,'.tickerMorePager a')[0];
if(za){
var ab=w.byClass(za,'stat_elem')||za;
new j(za.getAttribute('ajaxify')).
setReadOnly(true).
setRelativeTo(za).
setStatusElement(ab).
setAllowCrossPageTransition(true).
send();
this._logUserEvent('stream','scroll');}

this._infiniteScrollStory=null;



this._autoloadStoryIndex=5;}}},




_setFixed:function(xa){
if(!this._selectedStory)return;

var ya=this._getStoryDialog(this._selectedStory);
if(ya){
ya.setFixed(xa);
ya.updatePosition();}},






_setTimeout:function(xa,ya){
return setTimeout(xa,ya,!this._tickerInSidebarMode);},


_scrollDialogToBottom:function(){
var xa=this._dialog&&this._dialog.getContent(),
ya=
xa&&p.scry(xa,'.uiScrollableAreaWrap')[0],
za=
ya&&y.getInstance(ya);
za&&za.scrollToBottom();},


_openDialog:function(xa){
if(!this._tickerInSidebarMode)
o.addClass(xa.getRoot(),'tickerStoryOverlayOnTop');

this._dialog=xa.show();

this._updateDialogPosition();
this._writeSwfFrame(xa);
this._initCommentFocusListener.bind(this).defer();
this._initContentResizeListener.bind(this).defer();
this._stupidIE7VideoResizeHack(xa);},







_stupidIE7VideoResizeHack:function(xa){
if(ga.ie()===7){
var ya=
p.scry(xa.getContent(),'.uiVideoThumb .img');
ya.forEach(function(za){
aa.set(za,'width','');});}},




_updateDialogPosition:function(){
var xa=this._tickerInSidebarMode||
!!w.byClass(this._root,'fixed_elem');
this._dialog.setFixed(xa);
this._adjustFlyoutContentHeight();
this._dialog.updatePosition();},







_writeSwfFrame:function(xa){
var ya=this._dialog&&this._dialog.getContent(),
za=p.scry(ya,'.swfObject')[0];
if(!za)
return;


var ab=za.getAttribute('data-swfid');
if(ab&&window[ab]){

var bb=window[ab];
bb.write(za);}},



_initCommentFocusListener:function(){
var xa=this._dialog&&this._dialog.getContent(),
ya=
xa&&p.scry(xa,'.tickerDialogFooter textarea')[0];
if(!ya)
return;

this._listeners.inputFocus=g.listen
(ya,
'focus',
this._scrollDialogToBottom.bind(this));},



_cleanupInputFocusListener:function(){
if(this._listeners.inputFocus){
this._listeners.inputFocus.remove();
this._listeners.inputFocus=null;}},










_initContentResizeListener:function(){
var xa=this._dialog&&this._dialog.getContent();
if(!xa)
return;


this._listeners.contentResize=g.listen
(xa,
'click',
function(){
this._dialog.updatePosition.bind(this._dialog).defer();}.
bind(this));},



_cleanupContentResizeListener:function(){
if(this._listeners.contentResize){
this._listeners.contentResize.remove();
this._listeners.contentResize=null;}},







_adjustFlyoutContentHeight:function(){
var xa=this._dialog&&this._dialog.getContent(),
ya=
xa&&p.scry(xa,'.uiScrollableAreaWrap')[0];
if(!ya)
return;

var za=ha.getElementDimensions(ya),
ab=ha.getElementPosition(ya),
bb=p.scry(ya,'.uiUfi .uiUfiComment'),
cb=
ha.getViewportDimensions().y-this.FLYOUT_VIEWPORT_PADDING,
db=
Math.min(this.FLYOUT_MAX_HEIGHT,cb),
eb=db-this.FLYOUT_TARGET_HEIGHT_OFFSET;

for(var fb=0;fb<bb.length;fb++){
var gb=bb[fb],
hb=ha.getElementPosition(gb),
ib=hb.y-ab.y;

if(Math.abs(ib-eb)<=
this.FLYOUT_OFFSET_THRESHOLD){




eb=ib+this.FLYOUT_COMMENT_OFFSET;
break;}}






if(za.y>eb){
aa.set(ya,'height',eb+'px');
aa.set(ya,'max-height',null);}else{

aa.set(ya,'max-height',
db+'px');
aa.set(ya,'height',null);}},




_initObjectIDs:function(){
var xa=this._getAllStories();
for(var ya=0;ya<xa.length;++ya){
var za=xa[ya].getAttribute('data-story-key');
za&&(this._objectIDs[za]=true);}},







_handleChatOpened:function(){
this._deactivateStory(true);},


_handleChannelConnection:function(){
this._checkChannelConnection();},


getNewest:function(){
return this._newest;}});



e.exports=wa;});

/** js/home/tickerControllerLegacyProvider.js */
__d("legacy:TickerController",["TickerController"],function(a,b,c,d){



a.TickerController=b('TickerController');},

3);

/** js/home/ticker_cache.js */









function TickerCache(a,b){
this.parent.construct
(this,
a,
b,

['Ticker/storiesInserted',
'Ticker/resized',
'Ticker/afterInsert',
'Ticker/animateOut']);


this._numStoriesToKeep=15;}


Class.extend(TickerCache,'PageletCacheController');

copyProperties(TickerCache.prototype,
{handlePageletDOMOnSnapshot:function(a){

var b=DOM.scry(a,'div.storyQueue')[0];
b&&DOM.remove(b);


var c=DOM.scry(a,'div.fbFeedTickerStory');
if(c.length>this._numStoriesToKeep)
c.slice(this._numStoriesToKeep).forEach(DOM.remove);


var d=['tickerStoryActive','tickerStorySelected',
'tickerStoryFetching'];
c.forEach(function(g){

d.forEach(function(h){
CSS.removeClass(g,h);});



if(CSS.hasClass(g,'tickerSponsoredStory'))
DOM.remove(g);});




CSS.removeClass(a,'tickerChildSelected');
var e=DOM.scry(a,'div.uiScrollableAreaTrack')[0];
e&&Style.set(e,'opacity',0);



var f=DOM.scry(a,'div.fbFeedTicker')[0];
if(f){
Style.set(f,'top','');
CSS.removeClass(f,'fixed_elem');}},



getControllerDataOnSnapshot:function(a){

return {newest:a.getNewest(),



customStories:[]};},



insertStory:function(a){
var b=HTML(a).getRootNode(),
c=DOM.scry(b,'div.fbFeedTickerStory');
for(var d=0;d<c.length;d++)
if(this._controller.dedupeStory(c[d]))
c[d].parentNode.removeChild(c[d]);


this._controller.insertStory(b,true,c.length>3);},


updateAfterload:function(a){
a.update({cache_update:1});}});

/** js/home/ticker_first_right_col.js */
__d("HomeTickerFirstRightColumnController",["$","ge","debounceAcrossTransitions","throttle","UIPagelet","Arbiter","Style","csx","CSS","DOM","Vector","Run","ContextualDialogX","TickerController","UIIntentionalStreamMessage","Event"],function(a,b,c,d,e,f){




var g=b('$'),
h=b('ge'),
i=b('debounceAcrossTransitions'),
j=b('throttle'),

k=b('UIPagelet'),
l=b('Arbiter'),
m=b('Style'),
n=b('csx'),
o=b('CSS'),
p=b('DOM'),
q=b('Vector'),
r=b('Run'),

s=b('ContextualDialogX'),
t=b('TickerController'),
u=b('UIIntentionalStreamMessage'),

v=b('Event'),


w=null,
x=75,
y=50,
z=15,


aa=false,
ba=false,
ca,
da,
ea,
fa,
ga,
ha,

ia,
ja,
ka,
la=y,


ma=[],
na=[],
oa,


pa,
qa,
ra,
sa,
ta,
ua,
va,
wa,


xa,
ya,
za,
ab;

function bb(){




var sb=ob;

function tb(){
sb.defer();}


var ub=p.scry(ra,'img.img');

ub.forEach(function(vb){
if(!vb.complete)
v.listen(vb,{load:tb,error:tb,abort:tb});});



tb();}


function cb(){
na=


[l.subscribe
('page_transition',
fb),
l.subscribe
('netego_loaded',
ob),
l.subscribe
('Ticker/storiesInserted',
ob),
l.subscribe
('concierge/load',
ob),
l.subscribe
(u.INSERT_STORIES,
ob)];


if(w.enableSidebar){
na.push(l.subscribe
('sidebar/hide',
pb));
na.push(l.subscribe
('sidebar/show',
qb));}}



function db(){
if(ra){
var sb=p.scry(ra,"div._4u8");
for(var tb=0;tb<sb.length;tb++){
var ub=JSON.parse(sb[tb].getAttribute('data-ad')).segment;
if(ub==='premium')
return true;}}



return false;}


function eb(){




ab=p.scry(document,'div.fbRemindersContent');
va=p.scry(h('rightCol'),'div.home_right_column')[0];
wa=
p.find(va,'div.rightColumnWrapper');

ra=h('pagelet_ego_pane_w')||h('pagelet_ego_pane_m');
fa=w.refreshPremiumAds||!db();


v.listen(ra,'mouseenter',function(){
aa=true;});

v.listen(ra,'mouseleave',function(){
aa=false;});


sa=h('pagelet_rhc_ticker');
if(!sa)
return false;


ta=p.scry(sa,'.ticker_container')[0];
ua=p.scry(sa,'.ticker_stream')[0];
return ta&&ua;}


function fb(sb,tb){





if(sb==='page_transition'&&tb&&tb.uri){
var ub=tb.uri;

if(ub.path==='/photo.php'){
ba=true;
return;}



if(ba&&ub.path==='/'){
ba=false;
return;}}


na.forEach(l.unsubscribe);
na=[];

ma.forEach(function(vb){
vb.remove();});

ma=[];
oa.reset();}


function gb(){
if(ja||!ca)
ka=
q.getElementPosition(ra,'viewport').y-
q.getElementPosition(wa,'viewport').y;}



function hb(){
gb();
var sb=la;
lb();
if(sb!=la){
ja=true;
mb();}


za=xa+
q.getElementPosition(qa,'viewport').y;

var tb=za,
ub=q.getElementPosition(va,'viewport').y;


for(var vb=0;vb<ab.length;vb++){
var wb=s.getInstance(ab[vb]);
wb.hide();}


if(da||!ua){
if(ia!==null){
var xb=ub+ka,
yb=xb<=tb-ia;




if(ja||yb!==ca){
ja=false;

var zb=tb-ia-
ka;
nb(yb,zb);}}


return;}


var ac=ub<=tb+z;
if(ac!==ca)
nb(ac);}



function ib(){
var sb=Date.now();
if(fa&&!aa&&w.adsRefreshInterval&&
sb-ga>=w.adsRefreshInterval)
jb();}



function jb(){
ga=Date.now();
k.loadFromEndpoint
('WebEgoPane',
ra,

{pid:27,
data:
{organic_only:false,
ads_only:false,
refresh_num:++ha}},



{bundle:false,
crossPage:false,
handler:bb});}




function kb(){
ja=true;
gb();
lb();
mb();
hb();}







function lb(){
var sb=q.getDocumentDimensions().y-
(q.getScrollPosition('document').y+
q.getViewportDimensions().y);
la=sb>ya?
y:
x;}








function mb(){


var sb=q.getViewportDimensions().y-
xa-la,



tb=
q.getElementDimensions(wa).y;

if(tb<=sb){


ia=0-ka-
z;
return;}


var ub=
tb-ka,

vb=p.scry(ra,'div.egoOrganicColumn')[0];

if(ub<=sb&&vb){


ia=0;}else{




var wb=p.scry(ra,'div.ego_unit').reverse(),
xb=
p.scry(ra,"div._4u8").length,

yb=w.maxFixedAds;
if(xb<=w.maxFixedAds)
yb=wb.length;

var zb=null;
for(var ac=0;ac<yb;ac++){
var bc=wb[ac],
cc=
q.getElementPosition(bc,'viewport').y-
q.getElementPosition(wa,'viewport').y,
dc=
q.getElementDimensions(wa).y-
cc;
if(dc>sb){
if(ac>0)
zb=wb[ac-1];

break;}

if(ac==yb-1)
zb=bc;}


if(zb==null){

ia=null;}else 

ia=
q.getElementPosition(zb,'viewport').y-
q.getElementPosition(ra,'viewport').y;}}




function nb(sb,tb){
ca=sb;
tb=tb||za;
var ub=sb?tb+'px':'';
m.set(wa,'top',ub);
o.conditionClass(wa,'fixed_elem',sb);



var vb=p.scry(wa,
'div.displayedTickerToggleWrapper')[0];
vb&&
o.conditionClass(vb,'toggleWrapperWithoutMargin',
sb&&!ua);


if(ea){
var wb=sb?'Ticker/fixed':'Ticker/unfixed';
l.inform(wb);}}



function ob(){
if(!ea||
!ua||
o.hasClass(document.documentElement,'tinyViewport')){
kb();
return;}




hb();

var sb=q.getViewportDimensions().y,
tb=61,



ub=
q.getElementDimensions(wa).y-
q.getElementDimensions(ta).y,


vb=q.getElementDimensions(ua).y,

wb=
sb-
ub-
x-
za-
tb,

xb=w.tickerAbsMinHeight||120,
yb=w.tickerMinHeight||225;


da=false;



if(wb<xb){
da=true;
nb(false);
wb=xb;}else






if(wb<yb)
if(wb>(yb-tb)){
wb=yb;}else 

wb+=tb;



var zb=Math.min
(wb,
vb,
w.tickerMaxHeight||425);


m.set(ta,'height',zb+'px');}


function pb(){
ea=true;
eb();
var sb=function(){
if(eb()){
da=false;
hb();
ob();}};


sa&&t.show
(sa,
sb);}



function qb(){
ea=false;
eb();
kb();
sa&&t.hide(sa);}


var rb=
{init:function(sb){
w=sb;

pa=g('contentCol');
qa=g('blueBar');
ha=0;
ga=Infinity;


ga=Date.now();
oa=
i(ib,w.adsRefreshDelay);

if(w.adsRefreshOnmove)
ma.push(v.listen
(window,'mousemove',oa));


ma.push(v.listen
(window,'scroll',oa));
ma.push(v.listen
(window,'resize',oa));

ma.push(v.listen
(window,'resize',j(ob)));


xa=q.getElementDimensions(qa).y;
ya=q.getElementDimensions(g('pageFooter')).y;

eb();
cb();


r.onLeave(fb);

ma.push(v.listen
(window,'scroll',j(hb)));


if(!o.hasClass(document.documentElement,'sidebarMode')){
pb();}else
if(w.enableSidebar)
qb();


bb();}};









e.exports=rb;});
