/*1358176998,173217599*/

if (self.CavalryLogger) { CavalryLogger.start_js(["7Rtt3"]); }

/** js/GenderConst.js */
__d("GenderConst",[],function(a,b,c,d,e,f){



var g=
{UNKNOWN:0,
FEMALE_SINGULAR:1,
MALE_SINGULAR:2,
FEMALE_SINGULAR_GUESS:3,
MALE_SINGULAR_GUESS:4,
MIXED_SINGULAR:5,
MIXED_PLURAL:5,
NEUTER_SINGULAR:6,
UNKNOWN_SINGULAR:7,
FEMALE_PLURAL:8,
MALE_PLURAL:9,
NEUTER_PLURAL:10,
UNKNOWN_PLURAL:11};


e.exports=g;});

/** js/chat/BlackbirdUpsell.js */
__d("BlackbirdUpsell",["Event","Arbiter","AsyncRequest","ContextualDialogX","DOM","LayerDestroyOnHide","LayerHideOnTransition","PresencePrivacy","copyProperties","BlackbirdUpsellConfig","BlackbirdUpsellConstants","BlackbirdUpsellTemplates"],function(a,b,c,d,e,f){



var g=b('Event'),

h=b('Arbiter'),
i=b('AsyncRequest'),
j=b('ContextualDialogX'),
k=b('DOM'),
l=b('LayerDestroyOnHide'),
m=b('LayerHideOnTransition'),
n=b('PresencePrivacy'),

o=b('copyProperties'),

p=b('BlackbirdUpsellConfig'),
q=b('BlackbirdUpsellConstants'),
r=b('BlackbirdUpsellTemplates'),


s='/ajax/chat/blackbird/update_clicks.php',
t='/ajax/chat/blackbird/update_impressions.php',
u='/ajax/chat/blackbird/dismiss.php',
v=235,


w=null,
x=null,
y=false,
z=false;

function aa(){}

o(aa,

{shouldShow:function(){
if(this._dialogDismissed)
return false;


if(this.isEducation()){
return !!p.EducationGK&&
!p.EducationDismissed&&
p.EducationImpressions<p.EducationImpressionLimit;}else 

return !!p.UpsellGK&&
!p.UpsellDismissed&&
p.UpsellImpressions<p.UpsellImpressionLimit&&
p.FriendCount>=p.UpsellMinFriendCount;},



isEducation:function(){
return p.TimeOffline<=p.EducationTimeOfflineThresdhold;},



getOfflineContent:function(){
if(this.isEducation()){
return this._getEducationContent();}else 

return this._getUpsellContent();},



_getEducationContent:function(){
ga();
var ka=r[':fb:chat:blackbird:offline-educate'].build(),
la=ka.getNode('chatSettingsButton');


g.listen(la,'click',function(){
h.inform('chat/advanced-settings-dialog-opened');
ja(q.CLICK_TYPE_OPEN_SETTINGS);
da();});


return ka.getRoot();},



_getUpsellContent:function(){
fa();
var ka=r[':fb:chat:blackbird:upsell'].build(),

la=ka.getNode('chatSettingsButton');

g.listen(la,'click',function(){
h.inform('chat/advanced-settings-dialog-opened');
ia(q.CLICK_TYPE_OPEN_SETTINGS);
ca();});


var ma=ka.getNode('enableChatButton');
g.listen(ma,'click',function(){
ia(q.CLICK_TYPE_ENABLE_CHAT);
ca();});


return ka.getRoot();},



getBlackbirdContent:function(ka){
ga();
switch(ka){
case n.ONLINE:
return r[':fb:chat:blackbird:most-friends-educate'].
build().getRoot();
case n.OFFLINE:
return r[':fb:chat:blackbird:some-friends-educate'].
build().getRoot();}},



showOfflineDialog:function(ka){
this.showDialog(ka,this.getOfflineContent.bind(this));},


showBlackbirdDialog:function(ka,la){
this.showDialog(ka,this.getBlackbirdContent.curry(la));},


showDialog:function(ka,la){
!w&&this._constructDialog();
k.setContent(x,la());
w.setContext(ka);
w.show();},


hide:function(){
if(w&&w.isShown())
w.hide();},



dismiss:function(){
this.hide();
if(this.isEducation()){
da();}else 

ca();},



registerDismissClick:function(){
if(this.isEducation()){
ja(q.CLICK_TYPE_DISMISS_PROMO);}else 

ia(q.CLICK_TYPE_DISMISS_PROMO);},



isVisible:function(){
return z&&!y;},


_constructDialog:function(){
var ka=r[':fb:chat:blackbird:dialog-frame'].build();
x=ka.getNode('dialogContent');
w=new j();
w.init(ka.getRoot());
w.
setPosition('above').
setWidth(v).
setFixed(true).
disableBehavior(l).
disableBehavior(m);

g.listen
(ka.getNode('dialogCloseButton'),
'click',
this.dismiss.bind(this));


g.listen
(ka.getNode('dialogCloseButton'),
'click',
this.registerDismissClick.bind(this));}});




function ba(ka,la){
if(!y&&z){
y=true;

n.inform('privacy-user-presence-changed');

var ma=new i(u);
ma.setData
({source:ka,
impressions:la,
time_offline:p.TimeOffline});

ma.setErrorHandler(function(){
y=false;});

ma.send();}}



function ca(){
ba(q.ACTION_UPSELL,p.UpsellImpressions);}


function da(){
ba(q.ACTION_EDUCATE,p.EducationImpressions);}



function ea(ka,la){
if(!z){
z=true;
var ma=new i(t);
ma.setData
({action:ka,
impressions:la,
time_offline:p.TimeOffline});

ma.setErrorHandler(function(){
z=false;});

ma.send();}}




function fa(){
ea(q.ACTION_UPSELL,p.UpsellImpressions);}



function ga(){
ea(q.ACTION_EDUCATE,p.EducationImpressions);}


function ha(ka,la,ma,na){
var oa=new i(s);
oa.setData
({action:ka,
impressions:ma,
source:la,
time_offline:na});

oa.send();}


function ia(ka){
ha
(ka,
q.ACTION_UPSELL,
p.UpsellImpressions,
p.TimeOffline);}



function ja(ka){
ha
(ka,
q.ACTION_EDUCATE,
p.EducateImpressions,
p.TimeOffline);}




h.subscribe
('chat/advanced-settings-dialog-opened',
aa.dismiss.bind(aa));



h.subscribe
('chat-visibility/go-online',
aa.dismiss.bind(aa));

h.subscribe
('chat-visibility/go-offline',
aa.dismiss.bind(aa));


e.exports=aa;});

/** js/mercury/callback_manager/AsyncLoader.js */
__d("AsyncLoader",["copyProperties","AsyncRequest","BaseAsyncLoader"],function(a,b,c,d,e,f){







var g=b('copyProperties'),

h=b('AsyncRequest'),
i=b('BaseAsyncLoader');

function j(k,l){
this._endpoint=k;
this._type=l;}


g(j.prototype,i.prototype);

j.prototype.send=
function(k,l,m,n,o){
new h(k).
setData({ids:l}).
setHandler(n).
setErrorHandler(o).
setAllowCrossPageTransition(true).
setMethod('GET').
setReadOnly(true).
send();};


e.exports=j;});

/** js/chat/ChatHovercard.js */
__d("ChatHovercard",["Arbiter","AsyncLoader","Hovercard","JSLogger","debounce"],function(a,b,c,d,e,f){





var g=b('Arbiter'),
h=b('AsyncLoader'),
i=b('Hovercard'),
j=b('JSLogger'),

k=b('debounce'),

l=5,
m=new h('/ajax/chat/hovercard/sidebar.php','hover'),

n=j.create('chat_hovercard');


g.subscribe('Hovercard/dirty',m.reset.bind(m));

function o(s,t){
m.get(s,function(u){
(function(){
if(!u){
n.error('fetch_failure',{id:s});
return;}


var v=i.getDialog(u);

if(!v){
n.error('no_hovercard',{id:s,endpoint:u});
return;}


if(s==t.getActiveID())
t.showHovercard(s,v);}).

defer();});}







function p(s,t){
var u=[];
function v(y){
if(y>=0&&y<s.length)
u.push(s[y]);}



var w=s.indexOf(t);
if(w>-1){
v(w);
for(var x=1;x<l;x++){
v(w+x);
v(w-x);}}



return u.filter(function(y){return y;});}


function q(s,t){
var u=t.getActiveID();
if(u){
var v=s.getShowingUsers(),
w=p(v,u);


m.get(w,function(){});}}



function r(s){
var t=s.getHoverController();
t.registerDefault(o);
t.subscribe
('hover',
k
(q.curry(s,t),
100));}




e.exports=r;});

/** js/chat/ChatOrderedListHover.js */
__d("ChatOrderedListHover",["Event","function-extensions","ArbiterMixin","CSS","ErrorUtils","LayerFadeOnHide","LayerHideOnBlur","Parent","ChatFavoriteList","copyProperties","cx","setTimeoutAcrossTransitions"],function(a,b,c,d,e,f){





var g=b('Event');
b('function-extensions');

var h=b('ArbiterMixin'),
i=b('CSS'),
j=b('ErrorUtils'),
k=b('LayerFadeOnHide'),
l=b('LayerHideOnBlur'),
m=b('Parent'),
n=b('ChatFavoriteList'),

o=b('copyProperties'),
p=b('cx'),
q=b('setTimeoutAcrossTransitions');

function r(u){
i.addClass(u,'fetching');}


function s(u){
i.removeClass(u,'fetching');}


function t(u){
this._orderedList=u;
this._root=u.getRoot();

g.listen(this._root,'mouseover',this._mouseOver.bind(this));
g.listen(this._root,'mouseleave',this._mouseLeave.bind(this));
u.subscribe('click',this._hide.shield(this));}


o(t.prototype,h,

{_root:null,


_activeItem:null,

_hideTimeout:null,
_showTimeout:null,


_showingDialog:null,
_showingID:null,
_alreadyShowing:false,

_handlers:{},
_defaultHandler:null,

_mouseOver:function(u){
var v=u.getTarget(),
w=m.byClass(v,"_42fz");
w&&this._setActiveItem(w);},


_mouseLeave:function(u){
this._setActiveItem(null);},


_clearTimeouts:function(){
this._showTimeout&&clearTimeout(this._showTimeout);
this._showTimeout=null;

this._hideTimeout&&clearTimeout(this._hideTimeout);
this._hideTimeout=null;},





_checkAlreadyShowing:function(){
var u=this.getActiveID();
if(!u&&!this._showingID)
this._alreadyShowing=false;},






_hide:function(){
if(this._showingDialog){
this._showingDialog.enableBehavior(k);
this._showingDialog.hide();

this._showingDialog=null;
this._showingID=null;}


this._checkAlreadyShowing();},





_show:function(){
this._alreadyShowing=true;

var u=this.getActiveID(),
v=false;
if(this._handlers[u]){
v=true;
j.applyWithGuard(this._handlers[u],{},[u,this]);}else
if(this._defaultHandler){
v=true;
j.applyWithGuard(this._defaultHandler,{},[u,this]);}


if(v&&this._showingID!=this.getActiveID())
r(this._activeItem);},



_setActiveItem:function(u){
if(n.isEditMode()){
this._clearTimeouts();
this._hide();
return;}

if(u!=this._activeItem){
this._clearTimeouts();

this._activeItem&&s(this._activeItem);
this._activeItem=null;


var v=u?0:100;
this._hideTimeout=q
(function(){
if(this.getActiveID()!=this._showingID)
this._hide();}.

bind(this),
v);



if(u){
var w=this._orderedList.getUserForNode(u);
this._activeItem=u;

var x=v+(this._alreadyShowing?75:500);
this._showTimeout=q
(function(){
this._show();}.
bind(this),
x);


this.inform('hover',w);}else 

this.inform('leave');


this._checkAlreadyShowing();}},







register:function(u,v){
if(!this._handlers[u]){
this._handlers[u]=v;


return {unregister:function(){
if(u==this._showingID)
this._hide();

delete this._handlers[u];

var w=this._orderedList.getAllNodes(),
x=w[u];
x&&s(x);}.
bind(this)};}},




registerDefault:function(u){
this._defaultHandler=u;},





getActiveID:function(){
var u=this._activeItem&&
this._orderedList.getUserForNode(this._activeItem);
return u||null;},







showHovercard:function(u,v){
if(u==this.getActiveID()&&u!=this._showingID){
this._clearTimeouts();

s(this._activeItem);

this._hide();

this._showingDialog=v;
this._showingID=u;


var w=v.subscribe
('mouseenter',
this._setActiveItem.bind(this,this._activeItem)),

x=v.subscribe
('mouseleave',
function(){

w.unsubscribe();
this._setActiveItem(null);}.
bind(this)),



y=v.subscribe
('hide',
function(){
w.unsubscribe();
x.unsubscribe();
y.unsubscribe();});



v.
enableBehavior(l).
setContext(this._activeItem).
setPosition('left').
setOffsetY(9).
show();}}});





e.exports=t;});

/** js/chat/ChatQuietLinks.js */
__d("ChatQuietLinks",["Event","DOM","UserAgent","DataStore","Parent"],function(a,b,c,d,e,f){



var g=b('Event'),

h=b('DOM'),
i=b('UserAgent'),
j=b('DataStore'),
k=b('Parent'),


l={},





m=








{silenceLinks:function(q){
n(q,this.removeEmptyHrefs.bind(this));},








nukeLinks:function(q){
n(q,this.removeAllHrefs.bind(this));},






removeEmptyHrefs:function(q){
o(q,function(r){
return !r||r==='#';});},







removeAllHrefs:function(q){
o(q);}};











































function n(q,r){




var s=!!i.chrome(),
t=!!i.chrome()||i.ie()>=9||
i.firefox()>=4;


if(l[h.getID(q)])
return;

l[h.getID(q)]=true;

if(!t)
return;



if(!s){
r&&r(q);
return;}



g.listen(q,'mouseover',
function u(v){
var w=k.byTag(v.getTarget(),'a');

if(w){
var x=w.getAttribute('href');

if(p(x)){
j.set(w,'stashedHref',w.getAttribute('href'));
w.removeAttribute('href');}}});






g.listen(q,'mouseout',
function u(v){
var w=k.byTag(v.getTarget(),'a'),
x=w&&j.remove(w,'stashedHref');

if(p(x))
w.setAttribute('href',x);});






g.listen(q,'mousedown',
function(u){
if(!u.isDefaultRequested())
return true;


var v=k.byTag(u.getTarget(),'a'),
w=v&&j.get(v,'stashedHref');

if(p(w))
v.setAttribute('href',w);});}












function o(q,r){
var s=h.scry(q,'a');

if(r)
s=s.filter(function(t){
return r(t.getAttribute('href'));});



s.forEach(function(t){
t.removeAttribute('href');
t.setAttribute('tabindex',0);});}



function p(q){
return q&&q!=='#';}


e.exports=m;});

/** js/chat/ChatOrderedList.js */
__d("ChatOrderedList",["Event","Animation","Arbiter","ArbiterMixin","AsyncDialog","AsyncRequest","AvailableList","AvailableListConstants","Bootloader","Chat","ChatConfig","ChatFavoriteList","ChatOrderedListHover","ChatQuietLinks","ChatVisibility","CSS","DataStore","DOM","HTML","JSLogger","LastMobileActiveTimes","OrderedFriendsList","Parent","PresencePrivacy","Rect","ShortProfiles","TypeaheadUtil","URI","Vector","XHPTemplate","copyProperties","createObjectFrom","cx","csx","debounceAcrossTransitions","tx","guid","MercuryConfig","ChannelImplementation"],function(a,b,c,d,e,f){



var g=b('Event'),

h=b('Animation'),
i=b('Arbiter'),
j=b('ArbiterMixin'),
k=b('AsyncDialog'),
l=b('AsyncRequest'),
m=b('AvailableList'),
n=b('AvailableListConstants'),
o=b('Bootloader'),
p=b('Chat'),
q=b('ChatConfig'),
r=b('ChatFavoriteList'),
s=b('ChatOrderedListHover'),
t=b('ChatQuietLinks'),
u=b('ChatVisibility'),
v=b('CSS'),
w=b('DataStore'),
x=b('DOM'),
y=b('HTML'),
z=b('JSLogger'),
aa=b('LastMobileActiveTimes'),
ba=b('OrderedFriendsList'),
ca=b('Parent'),
da=b('PresencePrivacy'),
ea=b('Rect'),
fa=b('ShortProfiles'),
ga=b('TypeaheadUtil'),
ha=b('URI'),
ia=b('Vector'),
ja=b('XHPTemplate'),

ka=b('copyProperties'),
la=b('createObjectFrom'),
ma=b('cx'),
na=b('csx'),
oa=b('debounceAcrossTransitions'),
pa=b('tx'),
qa=b('guid'),

ra=b('MercuryConfig'),
sa=c('ChannelImplementation').instance;

function ta(ya,za,ab,bb){
this._root=ya;
this._itemsMap={};
this._isVisible=false;
this._excludedIds={};
this._numTopFriends=5;
this._hasRendered=false;
this._preventRendering=false;
this._hoverController=null;
this._template=za;
this._messageTemplate=ab;
this._favoriteMode=q.get('divebar_favorite_list',0);
this._contextualDialog=bb;

if(this._favoriteMode){
this._favoriteSidebar=x.find
(this._root,"._42g5");

this._editButton=x.find
(this._root,"._42g6");

this._favoriteList=x.find
(this._root,"._42g7");

this._activeNowList=x.find
(this._root,"._42g8");

this._activeNowLabel=x.find
(this._root,"._42g9");}



this._orderedList=x.find(this._root,'.fbChatOrderedList');


this._scrollableOrderedList=ca.byClass
(this._root,'scrollableOrderedList');


g.listen(this._root,'click',this._onClick.bind(this));
g.listen(this._root,'mouseenter',this._mouseEnter.bind(this));
g.listen(this._root,'mouseleave',this._mouseLeave.bind(this));

if(this._editButton)
g.listen(this._editButton,'click',this._onEditButtonClick.bind(this));


m.subscribe
(n.ON_AVAILABILITY_CHANGED,
this.update.shield(this));

da.subscribe
('privacy-changed',
this.update.shield(this));


sa.subscribe
([sa.CONNECTED,
sa.RECONNECTING,
sa.SHUTDOWN,
sa.MUTE_WARNING,
sa.UNMUTE_WARNING],
this.update.shield(this));



this.inform('initialized',this,i.BEHAVIOR_PERSISTENT);

this.render();

i.subscribe(z.DUMP_EVENT,function(cb,db){
db.chat_lists=db.chat_lists||
{sorted_list:this.getSortedList(),
ordered_list:ba.getList(),
available_list:ta.getAvailableList(this._excludedIds),
excluded_list:this._excludedIds};}.

bind(this));}






function ua(ya,za){


var ab=va(ya,za);
if(ab!==0)
return ab;



var bb=wa(ya,za);
if(bb!==0)
return bb;



return ba.compare(ya,za);}


function va(ya,za){
var ab=da.allows(ya),
bb=da.allows(za);

if(ab!==bb)
return ab?-1:1;


return 0;}





function wa(ya,za){
var ab=fa.getNow(ya),
bb=fa.getNow(za),
cb=ga.flatten((ab||{}).name||'~'),
db=ga.flatten((bb||{}).name||'~');
if(cb!==db)
return cb<db?-1:1;

return 0;}





function xa(ya,za){
var ab=m.get(ya)===n.MOBILE,
bb=m.get(za)===n.MOBILE;
if(ab!==bb)
return bb?-1:1;

return wa(ya,za);}


ka(ta,






{getSortedList:function(ya,za){

var ab=ba.getList().filter(function(qb){

return !(qb in ya);});


ab=ab.filter(function(qb){
return da.getFriendVisibility(qb)!==
da.BLACKLISTED;});



var bb=[],

cb=u.isOnline();


if(cb){
if(da.getOnlinePolicy()===
da.ONLINE_TO_WHITELIST){



var db=ab,
eb={},
fb,gb;
ab=[];

for(fb=0;fb<db.length;++fb){
gb=db[fb];
if(da.allows(gb)){
eb[gb]=true;
ab.push(gb);}}



var hb=da.getWhitelist();
for(fb=0;fb<hb.length;++fb){
gb=hb[fb];
if(!(gb in eb))
ab.push(gb);}



for(fb=0;fb<db.length;++fb){
gb=db[fb];
if(!da.allows(gb))
ab.push(gb);}}




var ib=q.get('ordered_list.top_friends',0),
jb=
q.get('ordered_list.available_target',0),

kb=Math.floor(za*jb),



lb=[];
for(var fb=0,mb=ab.length;fb<mb&&kb>0;fb++){
var gb=ab[fb],

nb=m.get(gb),
ob=nb===n.ACTIVE;
if(q.get('chat_sidebar_mobile_available'))
ob=ob||(nb===n.MOBILE);


if(ob||fb<ib){
bb.push(gb);
ob&&kb--;}else 

lb.push(gb);}



if(fb<mb)
Array.prototype.push.apply(lb,ab.slice(fb));



if(bb.length<za)
Array.prototype.push.apply(bb,lb);}else 





Array.prototype.push.apply(bb,ab);



bb=bb.slice(0,za);


if(bb.length===za){

var pb=ta.getAvailableList
(bb.concat(ya)).length;


pb&&bb.splice(-1);}



bb.sort(ua);
return bb;},







getAvailableList:function(ya){

return m.getOnlineIDs().filter(function(za){

return !(za in ya);});}});




ka(ta.prototype,j,






{getAllNodes:function(){
var ya={},
za=x.scry(this._root,"li._42fz");
for(var ab=0;ab<za.length;ab++){
var bb=w.get(za[ab],'id');
if(bb)
ya[bb]=za[ab];}


return ya;},





getShowingUsers:function(){
return x.scry(this._root,"li._42fz").
map(function(ya){return w.get(ya,'id');});},


getUserForNode:function(ya){
return w.get(ya,'id');},


getHoverController:function(){
if(!this._hoverController)
this._hoverController=
new s(this,this._contextualDialog);

return this._hoverController;},







_getListItem:function(ya,za){
var ab=this._itemsMap[ya];
if(ab){

var bb=m.get(ya),

cb=
da.allows(ya)&&!sa.disconnected(),

db=
{active:false,
mobile:false,
greenphone:false};


v.conditionClass
(ab,
"_42f-",
za);


var eb=x.scry
(ab,"._42g2")[
0];

if(eb){
v.conditionClass
(eb,
"_42f_",
za);

v.conditionClass
(eb,
"_42g0",
!za);}


var fb=x.scry(ab,'.active_time')[0]||null;
fb&&x.empty(fb);

db.active=bb===n.ACTIVE;
if(q.get('sidebar_mobile_icon_green')){
db.greenphone=bb===n.MOBILE;}else 

db.mobile=bb===n.MOBILE;



if(db.mobile){
var gb=aa.getShortDisplay(ya);
fb&&x.setContent(fb,gb);}


for(var hb in db)
v.conditionClass(ab,hb,db[hb]&&cb);

v.conditionClass(ab,'invis',!cb);




x.scry(ab,'img.status').forEach(function(ib){
if(bb===n.ACTIVE&&cb){
ib.alt="Online";}else
if(bb===n.MOBILE&&cb){
ib.alt="Mobile";}else 

ib.alt='';});}




return ab;},






getRoot:function(){
return this._root;},


getSortedList:function(ya){
return ta.getSortedList
(ya||this._excludedIds,
this._numTopFriends);},


toggleFavoriteSidebar:function(ya){
if(this._favoriteSidebar)
v.conditionShow(this._favoriteSidebar,ya);

var za=x.scry
(this._scrollableOrderedList||this._root,
"._ptt");

za.forEach(function(ab){
v.conditionShow(ab,ya);


var bb=ca.byClass
(ab,
'uiContextualLayerPositioner');

bb&&v.conditionShow(bb,ya);});},






hide:function(){
if(!this._isVisible)
return;

this._isVisible=false;

v.hide(this._scrollableOrderedList||this._root);

this.inform('hide');},


_onFavoriteOrderChange:function(){
var ya=this.sortableGroup.getOrder();
r.updateList(ya);},


_getFavoriteItems:function(){
var ya=[],
za=r.get();
for(var ab=0;ab<za.length;ab++){
var bb=this._itemsMap[za[ab]];
if(bb)
ya.push(bb);}


return ya;},


_resetFavoriteBounds:function(){
var ya=r.get(),
za=ya.length;
if(za){
var ab=ya[0],
bb=ya[za-1],
cb=this._itemsMap[ab],
db=this._itemsMap[bb],
eb=new ea
(ia.getElementPosition(cb).y,
0,
ia.getElementPosition(db).y+
ia.getElementDimensions(db).y,
0);

this.sortableGroup.setBoundingBox(eb);}},



_createSortableGroup:function(){
if(this.sortableGroup)
this.sortableGroup.destroy();

o.loadModules
(['SortableGroup'],
function(ya){
this.sortableGroup=new ya().
setBeforeGrabCallback(this._resetFavoriteBounds.bind(this)).
setOrderChangeHandler(this._onFavoriteOrderChange.bind(this));
var za=this._getFavoriteItems();
for(var ab=0;ab<za.length;ab++){
var bb=za[ab];
this.sortableGroup.addSortable
(w.get(bb,'id'),
bb);}}.


bind(this));},



_onEditButtonClick:function(event){
r.toggleEditMode();
if(r.isEditMode()){
this._createSortableGroup();
x.setContent(this._editButton,"DONE");
v.addClass
(this._favoriteSidebar,
"_42g1");}else{


x.setContent(this._editButton,"EDIT");
v.removeClass
(this._favoriteSidebar,
"_42g1");

r.save();}},







_onClick:function(event){
var ya=event.getTarget(),


za=ca.byTag(ya,'li');

if(r.isEditMode()){
var ab=ca.byClass
(ya,
"_42g2");

if(ab&&za){
var bb=w.get(za,'id');
if(bb)
r.toggleID(bb);

this.update();}

event.prevent();
return false;}


if(za){

if(v.hasClass(za,'blackbirdWhitelist')){
var cb=new ha('/ajax/chat/privacy/settings_dialog.php').
addQueryData({ref:'whitelist_separator'});
k.send(new l(cb));
event.prevent();
return false;}



var db=w.get(za,'id');
if(db){

var eb='ordered_list';
while(za.previousSibling){
za=za.previousSibling;
if(v.hasClass(za,'separator')){
if(v.hasClass(za,'moreOnlineFriends')){
eb='more_online_friends';
break;}

if(v.hasClass(za,'blackbirdWhitelist')){
eb='blackbird_offline_section';
break;}}}





var fb=[];
if(q.get('chat_realtime_coefficient_impressions'))
fb=this.getSortedList();

fa.get(db,function(gb){
p.openTab(db,gb.name,'friend',eb,fb);});


this.inform('click',{id:db});}else
if(v.hasClass(za,'separator')&&
ca.byClass(ya,'inner'))
this.scrollTo(za);

return false;}},



_mouseEnter:function(){



this._preventRendering=true;},


_mouseLeave:function(){
this._preventRendering=false;},






setExcludedIds:function(ya){
this._excludedIds=la(ya||[]);},







setNumTopFriends:function(ya){
if(ya!==this._numTopFriends){
this._numTopFriends=ya;
this.render();}},



_getOfflineToSectionItems:function(){
var ya='subheader-text-'+qa(),

za=x.create
('a',
{href:'#',
'aria-describedby':ya},
x.tx._("Edit")),


ab=[],

bb=ra.ChatControlLanguageChangeGK?
x.tx._("MORE FRIENDS"):
x.tx._("OFFLINE FRIENDS");
ab.push
(y
('<li class="separator">'+
'<div class="outer">'+
'<div class="inner">'+
'<span class="text">'+
bb+
'</span>'+
'<div class="dive"><span class="bar"></span></div>'+
'</div>'+
'</div>'+
'</li>'));


ab.push
(y
('<li class="separator blackbirdWhitelist">'+
'<div class="outer">'+
'<div class="inner">'+
'<div class="subheader">'+
'<span id="'+ya+'" class="subheaderText">'+
x.tx._("These friends can't see you on chat. {=link}",{'=link':za})+
'</span>'+
'</div>'+
'</div>'+
'</li>'));


return ab;},





render:function(){
this.render=oa(function(){
if(!this._isVisible||(this._preventRendering&&this._hasRendered))
return;


this._hasRendered=true;

var ya=[],
za,
ab,

bb=false,

cb=v.hasClass(document.documentElement,'sidebarMode'),

db=da.getVisibility(),

eb=da.getOnlinePolicy()===
da.ONLINE_TO_WHITELIST,

fb=
cb&&this._favoriteMode&&db&&!eb,

gb=[];

if(fb){
this.toggleFavoriteSidebar(true);
v.hide(this._orderedList);
gb=r.get();
for(var hb=0;hb<gb.length;hb++){
za=gb[hb];
ab=this._getListItem(za,true);

if(ab){
ya.push(ab);}else{

bb=true;
this._renderListItem(za,this.update.bind(this));}}


if(gb.length){
var ib=x.create
('li',
{className:"_42g3"});

ya.push(ib);}}else{



this.toggleFavoriteSidebar(false);
v.show(this._orderedList);}



var jb=this.getSortedList
(la(gb)),

kb=
da.getVisibility()&&
da.getOnlinePolicy()==
da.ONLINE_TO_WHITELIST;


for(var lb=0,mb=jb.length;lb<mb;lb++){
za=jb[lb];

if(kb)

if(!da.allows(za)){


if(lb+2>=jb.length)
break;


kb=false;
var nb=this._getOfflineToSectionItems();
ya.push(nb[0]);
ya.push(nb[1]);

mb-=2;}



ab=this._getListItem(za);
if(ab){

ya.push(ab);}else 

this._renderListItem(za,this.render.bind(this));}



if(fb)
x.setContent(this._favoriteList,ya);



var ob=ta.getAvailableList(this._excludedIds),


pb=gb.concat(jb),
qb=la(pb);
ob=ob.filter(function(wb){
return !(wb in qb);});



ob.sort(xa);

var rb=ra.ChatControlLanguageChangeGK?
"MORE FRIENDS":
"MORE ONLINE FRIENDS";

if(fb){
ya=[];}else
if(ob.length&&ya.length)
ya.push
(y
('<li class="separator moreOnlineFriends">'+
'<div class="outer">'+
'<div class="inner">'+
'<span class="text">'+
pa._("{MORE ONLINE FRIENDS} ({=count})",
{'MORE ONLINE FRIENDS':rb,
'=count':ob.length})+

'</span>'+
'<div class="dive"><span class="bar"></span></div>'+
'</div>'+
'</div>'+
'</li>'));




for(var hb=0,sb=ob.length;hb<sb;hb++){
za=ob[hb];
ab=this._getListItem(za);
if(ab){
ya.push(ab);}else 

this._renderListItem(za,this.render.bind(this));}



if(!jb.length&&!ob.length){



var tb=this._messageTemplate.render(),
ub=ja.getNode(tb,'message');
x.setContent(ub,"No one is available to chat.");
ya.push(tb);}


if(ya.length){
if(fb){
var vb=pa._("{MORE ONLINE FRIENDS} ({=count})",
{'MORE ONLINE FRIENDS':"ACTIVE NOW",
'=count':ob.length});

x.setContent(this._activeNowLabel,vb);
x.setContent(this._activeNowList,ya);}else 

x.setContent(this._orderedList,ya);

t.nukeLinks(this.getRoot());
this.inform('render');}


if(fb&&!bb)
if(r.isEditMode()&&r.hasChanged())
this._createSortableGroup();},


300,this);

this.render();},







_renderListItem:function(ya,za){
fa.get(ya,function(ab){





if(ab.type==='friend'){
var bb=this._template.render(),

cb=ja.getNode(bb,'profile-photo');
cb.setAttribute('src',ab.thumbSrc);

var db=ja.getNode(bb,'name');
x.setContent(db,ab.name);

var eb=ja.getNode(bb,'anchor');
eb.setAttribute('href','/messages/'+ya);

w.set(bb,'id',ya);
this._itemsMap[ya]=bb;

za&&za(bb);}}.

bind(this));},





show:function(){
if(this._isVisible)
return;

this._isVisible=true;

v.show(this._scrollableOrderedList||this._root);

this.render();

this.inform('show');},





isVisible:function(){
return this._isVisible;},





update:function(){


this._hasRendered=false;

this.render();},







setScrollContainer:function(ya){
if(x.contains(ya,this._root))
this._scrollContainer=ya;},







scrollTo:function(ya){
if(!this._scrollContainer)
return;



var za=this._scrollContainer.scrollHeight,
ab=this._scrollContainer.clientHeight,

bb=this._scrollContainer.scrollTop,
cb=Math.min(ya.offsetTop,za-ab);
if(bb!==cb){
var db=
Math.abs(cb-bb)/
this._scrollContainer.clientHeight*500;

h(this._scrollContainer).
to('scrollTop',cb).
ease(h.ease.end).
duration(db).
go();}}});




e.exports=ta;});

/** js/chat/TypingIndicator.js */
__d("TypingIndicator",["AsyncRequest","AvailableList","AvailableListConstants","ChannelConnection","ChatVisibility","Keys","PresencePrivacy","ShortProfiles","TypingDetector","copyProperties","emptyFunction"],function(a,b,c,d,e,f){



var g=b('AsyncRequest'),
h=b('AvailableList'),
i=b('AvailableListConstants'),
j=b('ChannelConnection'),
k=b('ChatVisibility'),
l=b('Keys'),
m=b('PresencePrivacy'),
n=b('ShortProfiles'),
o=b('TypingDetector'),

p=b('copyProperties'),
q=b('emptyFunction');

function r(t){
if(!k.isOnline())
return false;




if(t){
var u=n.getNow(t);
return u&&u.type=="friend"&&
m.allows(t);}


return true;}














function s(t,u,v,w,x){
this.userID=t;
this.input=u;
this.source=v;
this.threadID=x;


this.remoteState=o.INACTIVE;

this.notifyTimer=null;


w=w||{};
this.notifyDelay=w.notifyDelay||this.notifyDelay;

this._typingDetector=new o(u);
this._typingDetector.init(w);
this._typingDetector.subscribe('change',this._stateChange.bind(this));}


p(s.prototype,


{notifyDelay:1000,

setUserAndThread:function(t,u){
if(this.userID!==t||this.threadID!==u){
this.resetState();
this.userID=t;
this.threadID=u;}},







setIgnoreEnter:function(t){
var u=t?[l.RETURN]:[];
this._typingDetector.setIgnoreKeys(u);},


resetState:function(){
this.remoteState=s.INACTIVE;
this._typingDetector.reset();
clearTimeout(this.notifyTimer);
this.notifyTimer=null;},


_stateChange:function(t,u){
if(u!=o.QUITTING){

clearTimeout(this.notifyTimer);
this.notifyTimer=this._notifyState.
shield(this,u).
defer(this.notifyDelay,false);}else 


this._notifyState(u,true);},



_notifyState:function(t,u){
if(!this.userID&&!this.threadID)
return;


var v=this.userID,


w=r(v);
if(w&&t!=this.remoteState){
this.remoteState=t;


if(j.disconnected())
return;


var x={typ:t,
to:v,
source:this.source,
thread:this.threadID};


new g().
setHandler(this._onTypResponse.bind(this,v)).
setErrorHandler(q).
setData(x).
setURI('/ajax/messaging/typ.php').
setAllowCrossPageTransition(true).
setOption('asynchronous',!u).
send();}},



_onTypResponse:function(t,u){
var v=u.getPayload()||{};

if(v.offline)

h.set(t,
i.OFFLINE,
'typing_response');}});




e.exports=s;});

/** js/chat/sidebar/ChatSidebarSheet.js */
__d("ChatSidebarSheet",["Event","function-extensions","ArbiterMixin","BlackbirdUpsell","ChannelConnection","ChannelConstants","ChatBehavior","ChatConfig","ChatVisibility","CSS","DOM","JSLogger","PresencePrivacy","copyProperties","tx","MercuryConfig"],function(a,b,c,d,e,f){



var g=b('Event');
b('function-extensions');

var h=b('ArbiterMixin'),
i=b('BlackbirdUpsell'),
j=b('ChannelConnection'),
k=b('ChannelConstants'),
l=b('ChatBehavior'),
m=b('ChatConfig'),
n=b('ChatVisibility'),
o=b('CSS'),
p=b('DOM'),
q=b('JSLogger'),
r=b('PresencePrivacy'),

s=b('copyProperties'),
t=b('tx'),

u=b('MercuryConfig'),

v=q.create('sidebar_sheet');

function w(z){
switch(z){
case k.HINT_AUTH:
return "Your session has timed out. Please log in.";
case k.HINT_CONN:
return t._("Facebook {Chat} is currently unavailable.",{Chat:"Chat"});
case k.HINT_MAINT:
return t._("Facebook {Chat} is currently down for maintenance.",{Chat:"Chat"});

default:return t._("Facebook {Chat} is currently unavailable.",{Chat:"Chat"});
}}


function x(z){
var aa;

if(z===null){

aa="Unable to connect to chat. Check your Internet connection.";}else
if(z>m.get('warning_countdown_threshold_msec')){

var ba=p.create
('a',
{href:'#',className:'fbChatReconnectLink'},
"Try again");

aa=p.tx._("Unable to connect to chat. {try-again-link}",
{'try-again-link':ba});}else

if(z>1000){

aa=t._("Unable to connect to chat. Reconnecting in {seconds}...",
{seconds:Math.floor(z/1000)});}else 



aa="Unable to connect to chat. Reconnecting...";


return aa;}


function y(z){
this._root=z;
this._message=p.find(z,'div.fbChatSidebarMessage div.message');

j.subscribe
([j.CONNECTED,
j.SHUTDOWN,
j.RECONNECTING],
this._handleConnectionChange.bind(this));

j.subscribe
([j.MUTE_WARNING,j.UNMUTE_WARNING],
this._render.bind(this));


r.subscribe('privacy-user-presence-changed',
this._render.bind(this));

l.subscribe(l.ON_CHANGED,this._render.bind(this));

this._render();}


s(y.prototype,h,


{_channelStatus:null,
_channelData:null,
_handleConnectionChange:function(z,aa){
this._channelStatus=z;
this._channelData=aa;
this._render();},


_showWarningTimeout:null,
_warningMsgEventListener:null,
_renderChannelDisconnect:function(){
if(this._channelStatus===j.SHUTDOWN){

return p.setContent(this._message,
w(this._channelData));}else
if(this._channelStatus===j.RECONNECTING){
var z=this._channelData;
p.setContent(this._message,x(z));

if(z>1000){
if(z>m.get('warning_countdown_threshold_msec'))
this._warningMsgEventListener=
g.listen(this._message,'click',function(event){
if(o.hasClass(event.getTarget(),'fbChatReconnectLink')){

j.reconnect();
return false;}});




this._showWarningTimeout=setTimeout
(this._handleConnectionChange.bind
(this,
j.RECONNECTING,
z-1000),

1000,
false);}}},





_goOnlineEventListener:null,
_renderOffline:function(){
var z='fbChatGoOnlineLink',
aa=u.ChatControlLanguageChangeGK?
"Turn on chat":
"Go online",
ba=
p.create('a',{href:'#',className:z},aa),

ca;
if(u.ChatControlLanguageChangeGK){
ca=p.tx._("{=Go online} to see who's available.",{'=Go online':ba});}else 

ca=p.tx._("{=Go online} to see who's online to chat.",{'=Go online':ba});

p.setContent(this._message,ca);
this._goOnlineEventListener=g.listen
(this._message,
'click',
function(event){

if(o.hasClass(event.getTarget(),z)){
v.log('sidebar_go_online');
n.goOnline();
return false;}});},





_renderBlackbirdUpsell:function(){
p.setContent(this._message,i.getOfflineContent());},


_renderBlackbird:function(z){
p.setContent
(this._message,
i.getBlackbirdContent(z));},



_clear:function(){
if(this._showWarningTimeout){
clearTimeout(this._showWarningTimeout);
this._showWarningTimeout=null;}

if(this._warningMsgEventListener){
this._warningMsgEventListener.remove();
this._warningMsgEventListener=null;}

if(this._goOnlineEventListener){
this._goOnlineEventListener.remove();
this._goOnlineEventListener=null;}


o.removeClass(this._root,'upsell');
o.removeClass(this._root,'offline');
o.removeClass(this._root,'blackbird');
o.removeClass(this._root,'error');
o.removeClass(this._root,'notice');
p.empty(this._message);},


_render:function(){
this._clear();

if(i.shouldShow()){
if(n.hasBlackbirdEnabled()){

var z=n.isOnline()?'blackbird':'upsell';
o.addClass(this._root,z);
this._renderBlackbird(r.getVisibility());}else
if(!n.isOnline()){

o.addClass(this._root,'upsell');
this._renderBlackbirdUpsell();}}else

if(!n.isOnline()){

o.addClass(this._root,'offline');
this._renderOffline();}else
if(j.disconnected()){

o.addClass(this._root,'error');
this._renderChannelDisconnect();}else
if(!l.notifiesUserMessages()){

o.addClass(this._root,'notice');
p.setContent(this._message,"Alerts are off while you use another client to chat.");}


this.inform('updated');}});




e.exports=y;});

/** js/chat/sidebar/ChatSidebar.js */
__d("ChatSidebar",["JSXDOM","ChatOrderedList","ChatTypeaheadBehavior","ChatTypeaheadCore","ChatTypeaheadDataSource","ChatTypeaheadRenderer","Event","Typeahead","Arbiter","ArbiterMixin","AsyncRequest","ChatConfig","ChatHovercard","ChatOptions","ChatSidebarSheet","CSS","DOM","DOMDimensions","FBDesktopPlugin","JSLogger","OrderedFriendsList","PresencePrivacy","ScrollableArea","Style","UserAgent","ViewportBounds","copyProperties","createArrayFrom","cx","debounce","emptyFunction"],function(a,b,c,d,e,f){var g=b('JSXDOM');




b('ChatOrderedList');
b('ChatTypeaheadBehavior');
b('ChatTypeaheadCore');
b('ChatTypeaheadDataSource');
b('ChatTypeaheadRenderer');
var h=b('Event');
b('Typeahead');

var i=b('Arbiter'),
j=b('ArbiterMixin'),
k=b('AsyncRequest'),
l=b('ChatConfig'),
m=b('ChatHovercard'),
n=b('ChatOptions'),
o=b('ChatSidebarSheet'),
p=b('CSS'),
q=b('DOM'),
r=b('DOMDimensions'),
s=b('FBDesktopPlugin'),
t=b('JSLogger'),
u=b('OrderedFriendsList'),
v=b('PresencePrivacy'),
w=b('ScrollableArea'),
x=b('Style'),
y=b('UserAgent'),
z=b('ViewportBounds'),

aa=b('copyProperties'),
ba=b('createArrayFrom'),
ca=b('cx'),
da=b('debounce'),
ea=b('emptyFunction'),

fa,
ga=false,
ha=false,
ia=false,
ja=false,
ka=false,
la,
ma,
na,
oa,
pa=null,

qa=t.create('chat_sidebar'),

ra=32;

function sa(){






p.removeClass(document.documentElement,'sidebarMode');

if(!ja||!ya.isVisible()){




i.inform('reflow');
return;}

ia=false;
pa=null;

p.hide(ma);

la.hide();
na.getCore().reset();

qa.rate('sidebar_hide',ja);
ya.inform('sidebar/hide',ya);
i.inform('sidebar/hide',ya);
i.inform('reflow');}


function ta(){
var za=ya.shouldShowSidebar();
p.conditionClass(document.documentElement,
'sidebarCapable',
za);

if(ya.isEnabled()&&za){
ua();

var ab=oa.height;
ba(ma.childNodes).forEach(function(bb){
if(bb!==fa&&

!p.hasClass(bb,"_4aoz"))
ab-=r.getElementDimensions(bb).height;});





ab=Math.max(0,ab);

x.set(fa,'height',ab+'px');


this._maxItems=Math.floor((ab-8)/ra);

la.setNumTopFriends(this._maxItems);
na.getData().setMaxResults(this._maxItems);

ya.inform('sidebar/resized',ya);
i.inform('sidebar/resized',ya);
i.inform('reflow');}else 

sa();


if(!ja){

xa();

ja=true;}

pa=null;}


function ua(){


if(ya.isVisible())
return;

ia=true;
pa=null;

p.show(ma);
p.addClass(document.documentElement,'sidebarMode');

la.show();

qa.rate('sidebar_show',ja);
ya.inform('sidebar/show',ya);
i.inform('sidebar/show',ya);}


function va(){
n.setSetting('sidebar_mode',ya.isEnabled(),'sidebar');

new k('/ajax/chat/settings.php').
setHandler(ea).
setErrorHandler(ea).
setData({sidebar_mode:ya.isEnabled()}).
setAllowCrossPageTransition(true).
send();}


function wa(){
return u.getList().length<=
l.get('sidebar.min_friends');}



function xa(){
var za=true;

if(!ya.isEnabled()){
qa.log('state_not_enabled');
za=false;}


if(!ya.isViewportCapable()){
qa.log('state_not_shown_viewport');
za=false;}


if(ha){
qa.log('state_not_shown_hidden');
za=false;}


if(wa()){
qa.log('state_not_shown_num_friends');
za=false;}


if(s.shouldSuppressSidebar()){
qa.log('state_not_shown_fbdesktop');
za=false;}


qa.log(za?'state_shown':'state_not_shown');}


var ya=
{init:function(za,ab,bb){
ya.init=ea;

ka=true;

ma=za;
la=ab;
na=bb;

fa=q.find(za,'div.fbChatSidebarBody');

new m(ab);

var cb=new o(za);
cb.subscribe('updated',ta);

i.subscribe('sidebar/invalidate',ta);


ab.setScrollContainer
(q.find(fa,'div.uiScrollableAreaWrap'));



ab.subscribe
(['render','show','hide'],
da(function(){
var db=ab.getRoot(),
eb=
w.getInstance(db);
eb&&eb.adjustGripper();}));



h.listen(window,'resize',ta);

if(y.firefox()>=17)
h.listen(window,'storage',function(db){
if(db.key=='_socialfox_active'&&
db.oldValue!=db.newValue)
ta();});




i.subscribe('chat/option-changed',function(db,eb){
if(eb.name=="sidebar_mode"){
ga=!!n.getSetting('sidebar_mode');
ta();}});




bb.subscribe(['respond','reset'],function(db,eb){
if(ia)
if(eb&&
eb.value&&
eb.value===bb.getCore().getValue()&&
bb.getView().isVisible()){
la.hide();}else 

la.show();});




bb.getData().subscribe('beforeQuery',ta);


i.subscribe
('buddylist-nub/initialized',
function(db,eb){


h.listen(eb.getButton(),'click',function(event){
ya.enable();
return !ya.shouldShowSidebar();});});



ga=!!n.getSetting('sidebar_mode');

v.subscribe
('privacy-user-presence-changed',
ta);


ta();


z.addRight(ya.getVisibleWidth);

ya.inform
('sidebar/initialized',
ya,
i.BEHAVIOR_PERSISTENT);

i.inform
('sidebar/initialized',
ya,
i.BEHAVIOR_PERSISTENT);},


isInitialized:function(){
return ja;},


disable:function(){
if(!ya.isEnabled())
return;

ga=false;
va();

sa();},


enable:function(){
if(ya.isEnabled())
return;

ga=true;
va();

ta();



!function(){
if(ya.isVisible())
na.getCore().getElement().focus();}.

defer();},


ensureLoaded:function(){
if(ka)
return;


d(['UIPagelet'],function(za){
var ab=g.div({id:"pagelet_sidebar"});
q.appendContent(document.body,ab);

za.loadFromEndpoint('SidebarPagelet','pagelet_sidebar');});


ka=true;},


hide:function(){
if(ha)
return;

ha=true;
sa();},


unhide:function(){
if(!ha)
return;

ha=false;
ta();},


getBody:function(){
return fa;},


getRoot:function(){
return ma;},


getVisibleWidth:function(){
if(!ia||!ma)
return 0;







if(pa===null)
pa=ma.offsetWidth;


return pa;},


isEnabled:function(){
return ga;},


isViewportCapable:function(){
oa=r.getViewportWithoutScrollbarDimensions();
var za=l.get('sidebar.minimum_width');
return oa.width>za;},


shouldShowSidebar:function(){
return ya.isViewportCapable()&&
!ha&&
!wa()&&
!s.shouldSuppressSidebar();},


isVisible:function(){
return ia;},


resize:ta,

toggle:function(){
ya.isEnabled()?ya.disable():ya.enable();}};



aa(ya,j);

e.exports=ya;});

/** js/chat/VideoCallingTour.js */
__d("VideoCallingTour",["Arbiter","ArbiterMixin","Chat","ChatSidebar","ChatVisibility","CSS","DOM","PresencePrivacy","Run","Toggler","Vector","copyProperties"],function(a,b,c,d,e,f){












var g=b('Arbiter'),
h=b('ArbiterMixin'),
i=b('Chat'),
j=b('ChatSidebar'),
k=b('ChatVisibility'),
l=b('CSS'),
m=b('DOM'),
n=b('PresencePrivacy'),
o=b('Run'),
p=b('Toggler'),
q=b('Vector'),

r=b('copyProperties'),

s,
t,
u,
v,
w=[],

x=function(){};




function y(){
if(j.isVisible()){
z();}else
if(u)
aa();}



function z(){
s.setContext(t.getBody());
ba();
s.show();
ca();}


function aa(){
if(!v)
v=p.createInstance(u.getRoot());


var fa=m.scry(u.getRoot(),'div.fbNubFlyout')[0];
if(fa){
s.setContext(fa);
ba();
s.show();
ca();}}



function ba(){
var fa=q.getElementDimensions(s.getContext()).y;
s.setOffsetY(fa*.6);
s.updatePosition();}







function ca(){
if(u)
w.push
(u.subscribe('hide',function(){
da();
if(!j.isVisible())
s.hide();}),



u.subscribe('show',function(){
s.show();}),


u.subscribe('resize',function(){
ba();
s.updatePosition();}));




w.push
(g.subscribe('sidebar/show',z),
g.subscribe('sidebar/hide',aa),
g.subscribe('sidebar/resized',ba));}



function da(){
if(v){
v.setSticky(false);
v=null;}}



function ea(){
while(w.length)
w.pop().unsubscribe();

if(u)
da();

s.hide();
l.show('fbVideoCallingGetStarted');}


r(x,h,




{start:function(fa){
s=fa;

l.hide('fbVideoCallingGetStarted');

k.goOnline(function(){
w.push
(n.subscribe('privacy-user-presence-changed',ea));


o.onLeave(ea);

i.openBuddyList();
var ga=null;
w.push
(j.subscribe('sidebar/initialized',function(ha,ia){
t=ia;
clearTimeout(ga);
ga=y.defer();}),

x.subscribe('videocallingtour/end',ea));

w.push
(g.subscribe('buddylist-nub/initialized',function(ha,ia){
u=ia;
clearTimeout(ga);
ga=y.defer();}));});



x.inform('videocallingtour/start');}});



e.exports=x;});

/** js/dock/Dock.js */
__d("Dock",["Event","function-extensions","Arbiter","ArbiterMixin","ChatQuietLinks","CSS","DataStore","DOM","Parent","Style","Toggler","Vector","copyProperties","emptyFunction","ge"],function(a,b,c,d,e,f){




var g=b('Event');
b('function-extensions');

var h=b('Arbiter'),
i=b('ArbiterMixin'),
j=b('ChatQuietLinks'),
k=b('CSS'),
l=b('DataStore'),
m=b('DOM'),
n=b('Parent'),
o=b('Style'),
p=b('Toggler'),
q=b('Vector'),

r=b('copyProperties'),
s=b('emptyFunction'),
t=b('ge');






function u(){}

r(u,i,


{MIN_HEIGHT:140,


INITIAL_FLYOUT_HEIGHT_OFFSET:10,






init:function(v){
this.init=s;

this.rootEl=v;


this.calculateViewportDimensions();
this.calculateFlyoutHeightOffset();


j.removeEmptyHrefs(this.rootEl);


g.listen(v,'click',this._onClick.bind(this));


g.listen(window,'resize',this._onWindowResize.bind(this));


p.subscribe(['show','hide'],function(w,x){
var y=x.getActive();
if(!m.contains(v,y))
return;


if(k.hasClass(y,'fbNub')){

this.notifyNub(y,w);
if(w==='show')
this._resizeNubFlyout(y);}else{



var z=n.byClass(y,'fbNubFlyout');
if(z)
k.conditionClass(z,'menuOpened',w==='show');}}.


bind(this));

this.inform('init',{},h.BEHAVIOR_PERSISTENT);},





calculateViewportDimensions:function(){
return (this.viewportDimensions=q.getViewportDimensions());},






calculateFlyoutHeightOffset:function(){


this.flyoutHeightOffset=
this.INITIAL_FLYOUT_HEIGHT_OFFSET+
q.getElementDimensions(this.rootEl).y;

var v=t('blueBar');
if(v){
var w=o.isFixed(v)?'viewport':'document';
this.flyoutHeightOffset+=
q.getElementPosition(v,w).y+
q.getElementDimensions(v).y;}},








toggle:function(v){

var w=this._findFlyout(v);
if(!w)
return;



this.subscribe('init',function(){
p.toggle(v);});},








show:function(v){
this.subscribe('init',function(){
p.show(v);});},








showNub:function(v){
k.show(v);},







hide:function(v){
this.subscribe('init',function(){


var w=p.getInstance(v);
m.contains(v,w.getActive())&&w.hide();});},








hideNub:function(v){
k.hide(v);


this.hide(v);},







setUseMaxHeight:function(v,w){
k.conditionClass(v,'maxHeight',w!==false);
this._resizeNubFlyout(v);},










_resizeNubFlyout:function(v){
var w=this._findFlyout(v);
if(!w||
!(k.hasClass(v,'openToggler')||k.hasClass(v,'opened')))
return;








var x=m.find(w,'div.fbNubFlyoutOuter'),

y=m.find(x,'div.fbNubFlyoutInner'),

z=m.find(y,'div.fbNubFlyoutBody'),


aa=z.scrollTop,
ba=z.offsetHeight;


o.set(z,'height','auto');


var ca=q.getElementPosition(w,'viewport'),


da=q.getElementDimensions(w),
ea=q.getElementDimensions(z),


fa=this.getMaxFlyoutHeight(v);
o.set(w,'max-height',fa+'px');
o.set(x,'max-height',fa+'px');


da=q.getElementDimensions(w);


var ga=q.getElementDimensions(y),
ha=ga.y-ea.y;


if(da.y>ha)
o.set(z,'height',(da.y-ha)+'px');










k.removeClass(w,'swapDirection');
var ia=q.getElementPosition(w).x;
k.conditionClass(w,'swapDirection',function(){
if(ia<0)
return true;

return (ia+da.x>this.viewportDimensions.x);}.
bind(this)());



if(aa+ba>=ea.y){
z.scrollTop=z.scrollHeight;}else 

z.scrollTop=aa;


this.notifyNub(v,'resize');},


getMaxFlyoutHeight:function(v){
var w=this._findFlyout(v),

x=q.getElementPosition(w,'viewport'),
y=q.getElementDimensions(w),

z=Math.max
(this.MIN_HEIGHT,
this.viewportDimensions.y-this.flyoutHeightOffset)-
(this.viewportDimensions.y-x.y-y.y);




return Math.max(z,0);},





resizeAllFlyouts:function(){
var v=m.scry(this.rootEl,'div.fbNub.openToggler');
v=v.concat(m.scry(this.rootEl,'div.fbNub.opened'));

var w=v.length;
while(w--)
this._resizeNubFlyout(v[w]);},








_onClick:function(event){
var v=event.getTarget(),
w=n.byClass(v,'fbNub');

if(w){
if(n.byClass(v,'fbNubFlyoutTitlebar')){
var x=n.byTag(v,'a');
if(!x){

this.hide(w);
return false;}}



this.notifyNub(w,'click');}},








_onWindowResize:function(event){

this.calculateViewportDimensions();
this.resizeAllFlyouts();},









_findFlyout:function(v){
return k.hasClass(v,'fbNubFlyout')?
v:
m.scry(v,'div.fbNubFlyout')[0]||null;},








registerNubController:function(v,w){
l.set(v,'dock:nub:controller',w);


w.subscribe
('nub/button/content-changed',
this.inform.shield(this,'resize',v));


w.subscribe
('nub/flyout/content-changed',
this._resizeNubFlyout.shield(this,v));},







unregisterNubController:function(v){
l.remove(v,'dock:nub:controller');},










notifyNub:function(v,w,x){
var y=l.get(v,'dock:nub:controller');
y&&y.inform(w,x);}});



e.exports=a.Dock||u;});

/** js/dock/nub/NubController.js */
__d("NubController",["ArbiterMixin","Dock","copyProperties"],function(a,b,c,d,e,f){



var g=b('ArbiterMixin'),
h=b('Dock'),

i=b('copyProperties');






function j(){}

i(j.prototype,g,



{init:function(k){
this.el=k;
h.registerNubController(k,this);
return this;},





buttonContentChanged:function(){
this.inform('nub/button/content-changed');},





flyoutContentChanged:function(){
this.inform('nub/flyout/content-changed');},





hide:function(){
h.hide(this.el);},





show:function(){
h.show(this.el);}});



e.exports=j;});

/** js/help/DropdownContextualHelpLink.js */
__d("DropdownContextualHelpLink",["DOM","ge"],function(a,b,c,d,e,f){



var g=b('DOM'),
h=b('ge'),







i=
{set:function(j){
var k=h('navHelpCenter');
if(k!==null)
g.replace(k,j);}};




e.exports=i;});

/** js/mercury/clients/chat/ChatActivity.js */
__d("ChatActivity",["Event","Arbiter","AvailableList","AvailableListConstants","JSLogger","MercuryConfig","PresenceState","UserActivity","copyProperties"],function(a,b,c,d,e,f){











var g=b('Event'),

h=b('Arbiter'),
i=b('AvailableList'),
j=b('AvailableListConstants'),
k=b('JSLogger'),
l=b('MercuryConfig'),
m=b('PresenceState'),
n=b('UserActivity'),

o=b('copyProperties'),

p=l.activity_limit||60000,
q=l.idle_limit||1800000,
r=l.idle_poll_interval||300000,

s=k.create('chat_activity'),

t=Date.now(),
u=t,

v=true;

function w(){

var aa=Date.now();
return !!(v&&(aa-t<p));}


var x=o(new h(),
{isActive:w});


function y(){



var aa=t;
t=Date.now();


if(t-aa>q){
s.debug('idle_to_active',aa);

m.doSync();}


x.inform('activity');}


i.subscribe
(j.ON_AVAILABILITY_CHANGED,
function(){
if(!i.isUserIdle())

u=Date.now();});




g.listen(window,'focus',function(){

v=true;
y();});


g.listen(window,'blur',function(){
v=false;});


n.subscribe(function(){
y();});


function z(aa){
var ba=aa&&aa.at&&m.verifyNumber(aa.at);

if(typeof ba!=='number')
ba=null;


return ba||0;}



setInterval
(function(){
var aa=Date.now(),
ba=z(m.get()),
ca=Math.max
(t,
ba,
u);

if(aa-ca>q){
s.debug('idle',
{cookie:ba,
local:t,
presence:u});

x.inform('idle',aa-ca);}},


r);


m.registerStateStorer(function(aa){
var ba=z(aa);
if(ba<t)
aa.at=t;

return aa;});


h.subscribe(k.DUMP_EVENT,function(aa,ba){
ba.chat_activity=
{activity_limit:p,
idle_limit:q,
idle_poll_interval:r,
last_active_time:t,
last_global_active_time:u};});



e.exports=x;});

/** js/mercury/renderers/MercuryNotificationRenderer.js */
__d("MercuryNotificationRenderer",["MercuryAssert","MercuryMessages","MercuryParticipants","MercuryThreads","tx"],function(a,b,c,d,e,f){



var g=b('MercuryAssert'),
h=b('MercuryMessages').get(),
i=b('MercuryParticipants'),
j=b('MercuryThreads').get(),
k=b('tx');

function l(m,n){
g.isThreadID(m);

j.getThreadMeta(m,function(o){
h.getThreadMessagesRange(m,0,1,function(p){
var q=p.length&&p[p.length-1];

if(q&&q.author!=i.user){
i.get(q.author,function(r){

if(o.name){

n(k._("{senderName} messaged {groupName}",
{senderName:r.short_name,
groupName:o.name}));}else 



n(k._("{name} messaged you",{name:r.short_name}));});}else 





n("New message!");});});}





e.exports=





{renderDocumentTitle:l};});

/** js/mercury/models/MercuryTimestampTracker.js */
__d("MercuryTimestampTracker",["MercuryConstants","MercuryServerRequests"],function(a,b,c,d,e,f){



var g=b('MercuryConstants'),
h=b('MercuryServerRequests'),

i=0;

e.exports=


{getLastUserMessageTimestamp:function(){
return i;}};



h.subscribe('update-messages',function(j,k){
if(!k.actions||!k.actions.length)
return;




var l=g.MercuryPayloadSource;
if(k.payload_source==l.CLIENT_SEND_MESSAGE||
k.payload_source==l.UNKNOWN)
return;


for(var m=0;m<k.actions.length;m++){
var n=k.actions[m],
o=n.action_type;



if(o==g.MercuryActionType.USER_GENERATED_MESSAGE&&
n.thread_id&&
n.timestamp>i)
i=n.timestamp;}});});

/** js/mercury/clients/chat/ChatTitleBarBlinker.js */
__d("ChatTitleBarBlinker",["MercuryUnseenState","ChatActivity","DocumentTitle","JSLogger","MercuryThreadInformer","MercuryNotificationRenderer","PresenceState","MercuryTimestampTracker"],function(a,b,c,d,e,f){





b('MercuryUnseenState');

var g=b('ChatActivity'),
h=b('DocumentTitle'),
i=b('JSLogger'),
j=b('MercuryThreadInformer'),
k=b('MercuryNotificationRenderer'),
l=b('PresenceState'),
m=b('MercuryTimestampTracker'),

n=i.create('chat_title'),

o=null,
p=0,
q=false;




function r(){
if(o){
o.stop();
o=null;
return true;}


return false;}


function s(x){



var y=x||m.getLastUserMessageTimestamp();
if(p<=y){
p=y;



if(r()||q)
l.doSync();}}




var t=
{blink:function(x,y){


if(!o&&p<y)
k.renderDocumentTitle(x,function(z){
if(!o)
o=h.blink(z);});},





stopBlinking:function(){
s();},





blinkingElsewhere:function(){
q=true;}};












function u(x){
var y=l.verifyNumber(x.sb2);
if(!y||y<=p)
return null;


return y;}






function v(x){
var y=x&&u(x);
if(y){
p=y;
n.debug('load',p);
r();


q=false;}}



function w(x){
var y=u(x);
if(!y){
n.debug('store',p);
x.sb2=p;


q=false;}


return x;}


l.registerStateStorer(w);
l.registerStateLoader(v);





j.subscribe('thread-read-changed',function(x,y){
var z=m.getLastUserMessageTimestamp(),
aa=0;

for(var ba in y)


if(y[ba].mark_as_read&&
y[ba].timestamp>=z&&
y[ba].timestamp>aa)
aa=y[ba].timestamp;



aa&&s(aa);});






g.subscribe('activity',function(){
s();});


(function(){
var x=l.getInitial();
if(x)
p=u(x)||0;})

();

e.exports=t;});

/** js/si/controlled_referer.js */
__d("ControlledReferer",["Event","URI"],function(a,b,c,d,e,f){



















var g=b('Event'),
h=b('URI'),

i=





{useFacebookReferer:function(j,k,l){
var m=false;
function n(){


if(m)
return;

m=true;



j.contentWindow.document.body.style.margin=0;
k();}





var o;
if(document.domain!=='facebook.com'){



o='/intern/common/referer_frame.php';}else
if(h().isSecure()){
o='https://s-static.ak.facebook.com/common/referer_frame.php';}else 

o='http://static.ak.facebook.com/common/referer_frame.php';



if(l)
o+='?fb_source='+l;



g.listen(j,'load',n);
j.src=o;},






useFacebookRefererHtml:function(j,k,l){
i.useFacebookReferer
(j,
function(){j.contentWindow.document.body.innerHTML=k;},
l);}};



e.exports=i;});

/** js/swfobject.js */
__d("swfobject",["AsyncRequest","Bootloader","ControlledReferer","copyProperties","CSS","DOM","function-extensions","ge","htmlSpecialChars"],function(a,b,c,d,e,f){








var g=b('AsyncRequest'),
h=b('Bootloader'),
i=b('ControlledReferer'),
j=b('copyProperties'),
k=b('CSS'),
l=b('DOM');
b('function-extensions');
var m=b('ge'),
n=b('htmlSpecialChars');

if(typeof o=="undefined")var o={};
if(typeof o.util=="undefined")o.util={};
if(typeof o.SWFObjectUtil=="undefined")o.SWFObjectUtil={};
o.SWFObject=function(u,v,w,x,y,z,aa,ba,ca,da){
if(!document.getElementById)return;
this.DETECT_KEY=da?da:'detectflash';
this.skipDetect=o.util.getRequestParameter(this.DETECT_KEY);
this.params={};
this.variables={};
this.attributes=[];
this.fallback_html='';
this.fallback_js_fcn=function(){};
if(u)this.setAttribute('swf',u);
if(v)this.setAttribute('id',v);
if(w)this.setAttribute('width',w);
if(x)this.setAttribute('height',x);
this.installedVer=o.SWFObjectUtil.getPlayerVersion();

if(y){

if(!(y instanceof Array))
y=[y];












var ea;
y.forEach(function(ha){
ea=new o.PlayerVersion(ha.toString().split('.'));
if(ea.major==this.installedVer.major){
this.setAttribute('version',ea);
return;}else
if(!this.getAttribute('version')||ea.major<this.getAttribute('version').major)
this.setAttribute('version',ea);}.

bind(this));}

if(!window.opera&&document.all&&this.installedVer.major>7)


if(!o.unloadSet){
o.SWFObjectUtil.prepUnload=function(){
var ha=function(){},
ia=function(){};
window.attachEvent("onunload",o.SWFObjectUtil.cleanupSWFs);};

window.attachEvent("onbeforeunload",o.SWFObjectUtil.prepUnload);
o.unloadSet=true;}


if(z)this.addParam('bgcolor',z);
var fa=aa?aa:'high';
this.addParam('quality',fa);
this.setAttribute('useExpressInstall',false);
this.setAttribute('doExpressInstall',false);
var ga=(ba)?ba:window.location;
this.setAttribute('xiRedirectUrl',ga);
this.setAttribute('redirectUrl','');
if(ca)this.setAttribute('redirectUrl',ca);


this.setAttribute('useIframe',false);};

o.SWFObject.ieWorkaroundApplied=false;


o.SWFObject.ensureIEWorkaroundAttached=function(){
if(!o.SWFObject.ieWorkaroundApplied&&document.attachEvent){
o.SWFObject.ieWorkaroundApplied=true;
document.attachEvent('onpropertychange',
o.SWFObject.onDocumentPropertyChange);}};




o.SWFObject.onDocumentPropertyChange=function(event){
if(event.propertyName=="title"){
var u=document.title;


if(u!=null&&u.indexOf('#!')!=-1){
u=u.substring(0,u.indexOf('#!'));
document.title=u;}}};




j(o.SWFObject.prototype,
{useExpressInstall:function(u){
this.xiSWFPath=!u?"/swf/expressinstall.swf":u;
this.setAttribute('useExpressInstall',true);},

setAttribute:function(u,v){
this.attributes[u]=v;},

getAttribute:function(u){
return this.attributes[u]||"";},

addParam:function(u,v){
this.params[u]=v;},

getParams:function(){
return this.params;},



addVariable:function(u,v){
this.variables[u]=v;},

getVariable:function(u){
return this.variables[u]||"";},

getVariables:function(){
return this.variables;},

getVariablePairs:function(){
var u=[],
v,
w=this.getVariables();
for(v in w)
u[u.length]=
v+"="+w[v];

return u.join('&');},

getSWFHTML:function(){
var u,v,w;
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");
this.setAttribute('swf',this.xiSWFPath);}

v=
{type:'application/x-shockwave-flash',
src:this.getAttribute('swf'),
width:this.getAttribute('width'),
height:this.getAttribute('height'),
style:this.getAttribute('style')||'display: block;',
id:this.getAttribute('id'),
name:this.getAttribute('id')};

var x=this.getParams();
for(var y in x)
v[y]=x[y];

w=this.getVariablePairs();
if(w)
v.flashvars=w;

u=t('embed',v,null);}else{

if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","ActiveX");
this.setAttribute('swf',this.xiSWFPath);}

v=
{id:this.getAttribute('id'),
classid:'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',
width:this.getAttribute('width'),
height:this.getAttribute('height'),
style:this.getAttribute('style')||'display: block;'};

var z=t
('param',
{name:'movie',value:this.getAttribute('swf')},
null),

x=this.getParams();
for(var y in x)
z+=t
('param',
{name:y,value:x[y]},
null);


w=this.getVariablePairs();
if(w)
z+=t
('param',
{name:'flashvars',value:w},
null);


u=t('object',v,z);}

return u;},

write:function(u){
if(this.getAttribute('useExpressInstall')){

var v=new o.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(v)&&!this.installedVer.versionIsValid(this.getAttribute('version'))){
this.setAttribute('doExpressInstall',true);
this.addVariable("MMredirectURL",escape(this.getAttribute('xiRedirectUrl')));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}



var w=(typeof u=='string')?
document.getElementById(u):u;
if(!w)
return false;



k.addClass(w,'swfObject');
w.setAttribute('data-swfid',this.getAttribute('id'));

if(this.skipDetect||
this.getAttribute('doExpressInstall')||
this.installedVer.versionIsValid(this.getAttribute('version'))){

if(!this.getAttribute('useIframe')){





o.SWFObject.ensureIEWorkaroundAttached();

w.innerHTML=this.getSWFHTML();}else 

this._createIframe(w);


return true;}else{

if(this.getAttribute('redirectUrl')!="")
document.location.replace(this.getAttribute('redirectUrl'));



var x=this.getAttribute('version').major+'.'+
this.getAttribute('version').minor+'.'+
this.getAttribute('version').release+'.'+
this.getAttribute('version').build,
y=this.installedVer.major+'.'+
this.installedVer.minor+'.'+this.installedVer.release+'.'+
this.installedVer.build;
this.fallback_js_fcn(y,x);


w.innerHTML=this.fallback_html;}

return false;},






_createIframe:function(u){
var v=l.create('iframe',{width:this.getAttribute('width'),
height:this.getAttribute('height'),
frameBorder:0});
l.empty(u);
u.appendChild(v);


i.useFacebookRefererHtml.bind
(null,
v,
this.getSWFHTML(),
this.getAttribute('iframeSource')).
defer();}});




o.SWFObjectUtil.getPlayerVersion=function(){
var u=new o.PlayerVersion([0,0,0,0]),
v;
if(navigator.plugins&&navigator.mimeTypes.length){



for(var w=0;w<navigator.plugins.length;w++)

try{var y=navigator.plugins[w];
if(y.name=='Shockwave Flash'){
v=new o.PlayerVersion
(y.description.replace(/([a-zA-Z]|\s)+/,"").replace
(/(\s+(r|d)|\s+b[0-9]+)/,".").split("."));
if(typeof u=='undefined'||
v.major>u.major||
(v.major==u.major&&
(v.minor>u.minor||
(v.minor==u.minor&&
(v.release>u.release||
(v.release==u.release&&
v.build>u.build))))))






u=v;}}catch(


x){}}else

if(navigator.userAgent&&
navigator.userAgent.indexOf("Windows CE")>=0){
var z=1,
aa=3;
while(z)

try{aa++;
z=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+aa);
u=new o.PlayerVersion([aa,0,0]);}catch(
ba){
z=null;}}else{






try{var z=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(
ca){

try{var z=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
u=new o.PlayerVersion([6,0,21]);
z.AllowScriptAccess="always";}catch(
da){
if(u.major==6)
return u;}



try{z=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(
ea){}}

if(z!=null)
u=new o.PlayerVersion(z.GetVariable("$version").split(" ")[1].split(","));}


return u;};

o.PlayerVersion=function(u){
this.major=u[0]!=null?parseInt(u[0],10):0;
this.minor=u[1]!=null?parseInt(u[1],10):0;
this.release=u[2]!=null?parseInt(u[2],10):0;
this.build=u[3]!=null?parseInt(u[3],10):0;};

o.PlayerVersion.prototype.versionIsValid=function(u){
if(this.major<u.major)return false;
if(this.major>u.major)return true;
if(this.minor<u.minor)return false;
if(this.minor>u.minor)return true;
if(this.release<u.release)return false;
if(this.release>u.release)return true;
if(this.build<u.build)return false;
return true;};


o.util=
{getRequestParameter:function(u){
var v=document.location.search||document.location.hash;
if(u==null)return v;
if(v){
var w=v.substring(1).split("&");
for(var x=0;x<w.length;x++)
if(w[x].substring(0,w[x].indexOf("="))==u)
return w[x].substring((w[x].indexOf("=")+1));}



return "";}};



o.SWFObjectUtil.cleanupSWFs=function(){
var u=document.getElementsByTagName("OBJECT");
for(var v=u.length-1;v>=0;v--){
u[v].style.display='none';
for(var w in u[v])
if(typeof u[v][w]=='function')
u[v][w]=function(){};}};





if(!document.getElementById&&document.all)document.getElementById=function(u){return document.all[u];};


var p=o.util.getRequestParameter,
q=o.SWFObject,
r=o.SWFObject;




o.spawn_flash_update_dialog=function(){
new g().
setURI('/ajax/flash_update_dialog.php').
setMethod('GET').
setReadOnly(true).
send();};


function s(u,v){
var w=m(u),
x=o.SWFObjectUtil.getPlayerVersion(),

y;
v.forEach(function(ba){
ba=new o.PlayerVersion(ba.toString().split('.'));
if(ba.major==x.major){
y=ba;
return;}else
if(typeof y=='undefined'||ba.major<y.major)
y=ba;}.

bind(this));

if(w&&x.major>0){
var z=
x.major+'.'+x.minor+'.'+
x.release+'.'+x.build,
aa=
y.major+'.'+y.minor+'.'+
y.release+'.'+y.build;
l.setContent(w,l.tx._("Flash {required-version} is required to view this content. Your current version is {current-version}. Please download the latest Flash Player.",{'required-version':aa,
'current-version':z}));}}



o.showFlashErrorDialog=function(u,v){
h.loadModules(['ErrorDialog'],function(w){
w.show(u,v);});};














function t(u,v,w){
var x=/^[A-Za-z0-9\-]+$/;
if(!u.match(x))
throw new Error('Invalid tag '+u);

var y='<'+u;
for(var z in v){
if(!z.match(x))
throw new Error('Invalid attr '+z);

y+=' '+z+'="'+n(v[z])+'"';}

if(w===null){
return y+'/>';}else 

return y+'>'+w+'</'+u+'>';}



e.exports=a.deconcept||o;});

/** js/third_party/swfobject2.js */
__d("swfobject2",[],function(a,b,c,d,e,f){









var g=function(){

var h="undefined",
i="object",
j="Shockwave Flash",
k="ShockwaveFlash.ShockwaveFlash",
l="application/x-shockwave-flash",
m="SWFObjectExprInst",
n="onreadystatechange",

o=window,
p=document,
q=navigator,

r=false,
s=[ka],
t=[],
u=[],
v=[],
w,
x,
y,
z,
aa=false,
ba=false,
ca,
da,
ea=true,





fa=function(){
var eb=typeof p.getElementById!=h&&typeof p.getElementsByTagName!=h&&typeof p.createElement!=h,
fb=q.userAgent.toLowerCase(),
gb=q.platform.toLowerCase(),
hb=gb?/win/.test(gb):/win/.test(fb),
ib=gb?/mac/.test(gb):/mac/.test(fb),
jb=/webkit/.test(fb)?parseFloat(fb.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,
kb=!+"\v1",
lb=[0,0,0],
mb=null;
if(typeof q.plugins!=h&&typeof q.plugins[j]==i){
mb=q.plugins[j].description;
if(mb&&!(typeof q.mimeTypes!=h&&q.mimeTypes[l]&&!q.mimeTypes[l].enabledPlugin)){
r=true;
kb=false;
mb=mb.replace(/^.*\s+(\S+\s+\S+$)/,"$1");
lb[0]=parseInt(mb.replace(/^(.*)\..*$/,"$1"),10);
lb[1]=parseInt(mb.replace(/^.*\.(.*)\s.*$/,"$1"),10);
lb[2]=/[a-zA-Z]/.test(mb)?parseInt(mb.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0;}}else


if(typeof o.ActiveXObject!=h)

try{var ob=new ActiveXObject(k);
if(ob){
mb=ob.GetVariable("$version");
if(mb){
kb=true;
mb=mb.split(" ")[1].split(",");
lb=[parseInt(mb[0],10),parseInt(mb[1],10),parseInt(mb[2],10)];}}}catch(



nb){}

return {w3:eb,pv:lb,wk:jb,ie:kb,win:hb,mac:ib};}
(),






ga=function(){
if(!fa.w3)return;
if((typeof p.readyState!=h&&p.readyState=="complete")||(typeof p.readyState==h&&(p.getElementsByTagName("body")[0]||p.body)))
ha();

if(!aa){
if(typeof p.addEventListener!=h)
p.addEventListener("DOMContentLoaded",ha,false);

if(fa.ie&&fa.win){
p.attachEvent(n,function(){
if(p.readyState=="complete"){
p.detachEvent(n,arguments.callee);
ha();}});


if(o==top)
(function(){
if(aa)return;

try{p.documentElement.doScroll("left");}catch(

eb){
setTimeout(arguments.callee,0);
return;}

ha();})
();}


if(fa.wk)
(function(){
if(aa)return;
if(!/loaded|complete/.test(p.readyState)){
setTimeout(arguments.callee,0);
return;}

ha();})
();

ja(ha);}}

();

function ha(){
if(aa)return;

try{var fb=p.getElementsByTagName("body")[0].appendChild(xa("span"));
fb.parentNode.removeChild(fb);}catch(

eb){return;}
aa=true;
var gb=s.length;
for(var hb=0;hb<gb;hb++)
s[hb]();}



function ia(eb){
if(aa){
eb();}else 


s[s.length]=eb;}







function ja(eb){
if(typeof o.addEventListener!=h){
o.addEventListener("load",eb,false);}else

if(typeof p.addEventListener!=h){
p.addEventListener("load",eb,false);}else

if(typeof o.attachEvent!=h){
ya(o,"onload",eb);}else

if(typeof o.onload=="function"){
var fb=o.onload;
o.onload=function(){
fb();
eb();};}else 



o.onload=eb;}






function ka(){
if(r){
la();}else 


ma();}










function la(){
var eb=p.getElementsByTagName("body")[0],
fb=xa(i);
fb.setAttribute("type",l);
fb.setAttribute
('style',
'visibility: hidden; position: absolute; top: -1000px;');

var gb=eb.appendChild(fb);
if(gb){
var hb=0;
(function(){
if(typeof gb.GetVariable!=h){
var ib=gb.GetVariable("$version");
if(ib){
ib=ib.split(" ")[1].split(",");
fa.pv=[parseInt(ib[0],10),parseInt(ib[1],10),parseInt(ib[2],10)];}}else


if(hb<10){
hb++;
setTimeout(arguments.callee,10);
return;}



gb=null;
ma();})
();}else 


ma();}





function ma(){
var eb=t.length;
if(eb>0)
for(var fb=0;fb<eb;fb++){
var gb=t[fb].id,
hb=t[fb].callbackFn,
ib={success:false,id:gb};
if(fa.pv[0]>0){
var jb=wa(gb);
if(jb)
if(za(t[fb].swfVersion)&&!(fa.wk&&fa.wk<312)){
bb(gb,true);
if(hb){
ib.success=true;
ib.ref=na(gb);
hb(ib);}}else


if(t[fb].expressInstall&&oa()){
var kb={};
kb.data=t[fb].expressInstall;
kb.width=jb.getAttribute("width")||"0";
kb.height=jb.getAttribute("height")||"0";
if(jb.getAttribute("class"))kb.styleclass=jb.getAttribute("class");
if(jb.getAttribute("align"))kb.align=jb.getAttribute("align");

var lb={},
mb=jb.getElementsByTagName("param"),
nb=mb.length;
for(var ob=0;ob<nb;ob++)
if(mb[ob].getAttribute("name").toLowerCase()!="movie")
lb[mb[ob].getAttribute("name")]=mb[ob].getAttribute("value");


pa(kb,lb,gb,hb);}else{


qa(jb);
if(hb)hb(ib);}}else{




bb(gb,true);
if(hb){
var pb=na(gb);
if(pb&&typeof pb.SetVariable!=h){
ib.success=true;
ib.ref=pb;}

hb(ib);}}}}






function na(eb){
var fb=null,
gb=wa(eb);
if(gb&&gb.nodeName=="OBJECT")
if(typeof gb.SetVariable!=h){
fb=gb;}else{


var hb=gb.getElementsByTagName(i)[0];
if(hb)
fb=hb;}



return fb;}








function oa(){
return !ba&&za("6.0.65")&&(fa.win||fa.mac)&&!(fa.wk&&fa.wk<312);}





function pa(eb,fb,gb,hb){
ba=true;
y=hb||null;
z={success:false,id:gb};
var ib=wa(gb);
if(ib){
if(ib.nodeName=="OBJECT"){
w=ra(ib);
x=null;}else{


w=ib;
x=gb;}

eb.id=m;
if(typeof eb.width==h||(!/%$/.test(eb.width)&&parseInt(eb.width,10)<310))eb.width="310";
if(typeof eb.height==h||(!/%$/.test(eb.height)&&parseInt(eb.height,10)<137))eb.height="137";
p.title=p.title.slice(0,47)+" - Flash Player Installation";
var jb=fa.ie&&fa.win?"ActiveX":"PlugIn",
kb="MMredirectURL="+o.location.toString().replace(/&/g,"%26")+"&MMplayerType="+jb+"&MMdoctitle="+p.title;
if(typeof fb.flashvars!=h){
fb.flashvars+="&"+kb;}else 


fb.flashvars=kb;



if(fa.ie&&fa.win&&ib.readyState!=4){
var lb=xa("div");
gb+="SWFObjectNew";
lb.setAttribute("id",gb);
ib.parentNode.insertBefore(lb,ib);
ib.style.display="none";
(function(){
if(ib.readyState==4){
ib.parentNode.removeChild(ib);}else 


setTimeout(arguments.callee,10);})

();}

sa(eb,fb,gb);}}





function qa(eb){
if(fa.ie&&fa.win&&eb.readyState!=4){


var fb=xa("div");
eb.parentNode.insertBefore(fb,eb);
fb.parentNode.replaceChild(ra(eb),fb);
eb.style.display="none";
(function(){
if(eb.readyState==4){
eb.parentNode.removeChild(eb);}else 


setTimeout(arguments.callee,10);})

();}else 


eb.parentNode.replaceChild(ra(eb),eb);}



function ra(eb){
var fb=xa("div");
if(fa.win&&fa.ie){
fb.innerHTML=eb.innerHTML;}else{


var gb=eb.getElementsByTagName(i)[0];
if(gb){
var hb=gb.childNodes;
if(hb){
var ib=hb.length;
for(var jb=0;jb<ib;jb++)
if(!(hb[jb].nodeType==1&&hb[jb].nodeName=="PARAM")&&!(hb[jb].nodeType==8))
fb.appendChild(hb[jb].cloneNode(true));}}}





return fb;}




function sa(eb,fb,gb){
var hb,ib=wa(gb);
if(fa.wk&&fa.wk<312)return hb;
if(ib){
if(typeof eb.id==h)
eb.id=gb;

if(fa.ie&&fa.win){
var jb="";
for(var kb in eb)
if(eb[kb]!=Object.prototype[kb])
if(kb.toLowerCase()=="data"){
fb.movie=eb[kb];}else

if(kb.toLowerCase()=="styleclass"){
jb+=' class="'+eb[kb]+'"';}else

if(kb.toLowerCase()!="classid")
jb+=' '+kb+'="'+eb[kb]+'"';



var lb="";
for(var mb in fb)
if(fb[mb]!=Object.prototype[mb])
lb+='<param name="'+mb+'" value="'+fb[mb]+'" />';


ib.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+jb+'>'+lb+'</object>';
u[u.length]=eb.id;
hb=wa(eb.id);}else{


var nb=xa(i);
nb.setAttribute("type",l);
for(var ob in eb)
if(eb[ob]!=Object.prototype[ob])
if(ob.toLowerCase()=="styleclass"){
nb.setAttribute("class",eb[ob]);}else

if(ob.toLowerCase()!="classid")
nb.setAttribute(ob,eb[ob]);



for(var pb in fb)
if(fb[pb]!=Object.prototype[pb]&&pb.toLowerCase()!="movie")
ta(nb,pb,fb[pb]);


ib.parentNode.replaceChild(nb,ib);
hb=nb;}}


return hb;}


function ta(eb,fb,gb){
var hb=xa("param");
hb.setAttribute("name",fb);
hb.setAttribute("value",gb);
eb.appendChild(hb);}





function ua(eb){
var fb=wa(eb);
if(fb&&fb.nodeName=="OBJECT")
if(fa.ie&&fa.win){
fb.style.display="none";
(function(){
if(fb.readyState==4){
va(eb);}else 


setTimeout(arguments.callee,10);})

();}else 


fb.parentNode.removeChild(fb);}




function va(eb){
var fb=wa(eb);
if(fb){
for(var gb in fb)
if(typeof fb[gb]=="function")
fb[gb]=null;


fb.parentNode.removeChild(fb);}}





function wa(eb){
var fb=null;

try{fb=p.getElementById(eb);}catch(

gb){}
return fb;}


function xa(eb){
return p.createElement(eb);}





function ya(eb,fb,gb){
eb.attachEvent(fb,gb);
v[v.length]=[eb,fb,gb];}




function za(eb){
var fb=fa.pv,gb=eb.split(".");
gb[0]=parseInt(gb[0],10);
gb[1]=parseInt(gb[1],10)||0;
gb[2]=parseInt(gb[2],10)||0;
return (fb[0]>gb[0]||(fb[0]==gb[0]&&fb[1]>gb[1])||(fb[0]==gb[0]&&fb[1]==gb[1]&&fb[2]>=gb[2]))?true:false;}





function ab(eb,fb,gb,hb){
if(fa.ie&&fa.mac)return;
var ib=p.getElementsByTagName("head")[0];
if(!ib)return;
var jb=(gb&&typeof gb=="string")?gb:"screen";
if(hb){
ca=null;
da=null;}

if(!ca||da!=jb){

var kb=xa("style");
kb.setAttribute("type","text/css");
kb.setAttribute("media",jb);
ca=ib.appendChild(kb);
if(fa.ie&&fa.win&&typeof p.styleSheets!=h&&p.styleSheets.length>0)
ca=p.styleSheets[p.styleSheets.length-1];

da=jb;}


if(fa.ie&&fa.win){
if(ca&&typeof ca.addRule==i)
ca.addRule(eb,fb);}else 



if(ca&&typeof p.createTextNode!=h)
ca.appendChild(p.createTextNode(eb+" {"+fb+"}"));}




function bb(eb,fb){
if(!ea)return;
var gb=fb?"visible":"hidden";
if(aa&&wa(eb)){
wa(eb).style.visibility=gb;}else 


ab("#"+eb,"visibility:"+gb);}





function cb(eb){
var fb=/[\\\"<>\.;]/,
gb=fb.exec(eb)!=null;
return gb&&typeof encodeURIComponent!=h?encodeURIComponent(eb):eb;}




var db=function(){
if(fa.ie&&fa.win)
window.attachEvent("onunload",function(){

var eb=v.length;
for(var fb=0;fb<eb;fb++)
v[fb][0].detachEvent(v[fb][1],v[fb][2]);


var gb=u.length;
for(var hb=0;hb<gb;hb++)
ua(u[hb]);


for(var ib in fa)
fa[ib]=null;

fa=null;
for(var jb in g)
g[jb]=null;

g=null;});}


();





return {registerObject:function(eb,fb,gb,hb){
if(fa.w3&&eb&&fb){
var ib={};
ib.id=eb;
ib.swfVersion=fb;
ib.expressInstall=gb;
ib.callbackFn=hb;
t[t.length]=ib;
bb(eb,false);}else

if(hb)
hb({success:false,id:eb});},



getObjectById:function(eb){
if(fa.w3)
return na(eb);},



embedSWF:function(eb,fb,gb,hb,ib,jb,kb,lb,mb,nb){
var ob={success:false,id:fb};
if(fa.w3&&!(fa.wk&&fa.wk<312)&&eb&&fb&&gb&&hb&&ib){
bb(fb,false);
ia(function(){
gb+="";
hb+="";
var pb={};
if(mb&&typeof mb===i)
for(var qb in mb)
pb[qb]=mb[qb];


pb.data=eb;
pb.width=gb;
pb.height=hb;
var rb={};
if(lb&&typeof lb===i)
for(var sb in lb)
rb[sb]=lb[sb];


if(kb&&typeof kb===i)
for(var tb in kb)
if(typeof rb.flashvars!=h){
rb.flashvars+="&"+tb+"="+kb[tb];}else 


rb.flashvars=tb+"="+kb[tb];



if(za(ib)){
var ub=sa(pb,rb,fb);
if(pb.id==fb)
bb(fb,true);

ob.success=true;
ob.ref=ub;}else

if(jb&&oa()){
pb.data=jb;
pa(pb,rb,fb,nb);
return;}else 


bb(fb,true);

if(nb)nb(ob);});}else


if(nb)nb(ob);},


switchOffAutoHideShow:function(){
ea=false;},


ua:fa,

getFlashPlayerVersion:function(){
return {major:fa.pv[0],minor:fa.pv[1],release:fa.pv[2]};},


hasFlashPlayerVersion:za,

createSWF:function(eb,fb,gb){
if(fa.w3){
return sa(eb,fb,gb);}else 


return undefined;},



showExpressInstall:function(eb,fb,gb,hb){
if(fa.w3&&oa())
pa(eb,fb,gb,hb);},



removeSWF:function(eb){
if(fa.w3)
ua(eb);},



createCSS:function(eb,fb,gb,hb){
if(fa.w3)
ab(eb,fb,gb,hb);},



addDomLoadEvent:ia,

addLoadEvent:ja,

getQueryParamValue:function(eb){
var fb=p.location.search||p.location.hash;
if(fb){
if(/\?/.test(fb))fb=fb.split("?")[1];
if(eb==null)
return cb(fb);

var gb=fb.split("&");
for(var hb=0;hb<gb.length;hb++)
if(gb[hb].substring(0,gb[hb].indexOf("="))==eb)
return cb(gb[hb].substring((gb[hb].indexOf("=")+1)));}



return "";},



expressInstallCallback:function(){
if(ba){
var eb=wa(m);
if(eb&&w){
eb.parentNode.replaceChild(w,eb);
if(x){
bb(x,true);
if(fa.ie&&fa.win)w.style.display="block";}

if(y)y(z);}

ba=false;}}};}



();

e.exports=g;});

/** js/modules/SoundPlayer.js */
__d("SoundPlayer",["Arbiter","ChatConfig","swfobject","swfobject2","URI","createArrayFrom"],function(a,b,c,d,e,f){









var g=b('Arbiter'),
h=b('ChatConfig'),
i=b('swfobject').SWFObject,
j=b('swfobject2'),
k=b('URI'),

l=b('createArrayFrom'),

m={},
n=null,
o=false,
p='so_sound_player',
q='/swf/SoundPlayerHater.swf',
r='10.0.22.87',

s=null,

t=h.get('sound.useswfobject_2',false),
u=h.get('sound.force_flash',false);

function v(da){
var ea=k(da);
if(!ea.getDomain())
return k().setPath(ea.getPath()).toString();

return da;}


function w(da){
var ea=k(da).getPath();
if(/\.mp3$/.test(ea))
return 'audio/mpeg';

if(/\.og[ga]$/.test(ea))
return 'audio/ogg';

return '';}


function x(){
if(!s&&!u){
var da=document.createElement('audio');
if(!da||!da.canPlayType)

return null;

da.setAttribute('preload','auto');
document.body.appendChild(da);
s=da;}

return s;}


function y(){
var da=document[p]||window[p];

if(da)




if(!da.playSound&&da.length)
da=da[0];










return (da&&da.playSound&&da.loopSound)?da:null;}


function z(){
return o;}


function aa(da,ea,fa){
n=
{path:da,
sync:ea,
loop:fa};}



function ba(){
o=true;
if(n){
var da=y();
if(n.loop){
da.loopSound(n.path,n.sync);}else 

da.playSound(n.path,n.sync);}}




var ca=














{init:function(da){
da=l(da);
var ea;
for(var fa=0;fa<da.length;++fa){
ea=da[fa];
if(m[ea])
return;}




var ga=x();
for(fa=0;ga&&fa<da.length;++fa){
ea=da[fa];
if(ga.canPlayType(ea)){
m[ea]=true;
return;}}




m['audio/mpeg']=true;


if(y())
return;



try{g.registerCallback(ba,
['sound/player_ready','sound/ready']);
var ia=document.createElement('div');
ia.id='sound_player_holder';
document.body.appendChild(ia);
if(t){
j.embedSWF
(q,
ia.id,
'1px',
'1px',
r,
null,

{swf_id:p},


{allowscriptaccess:'always',
wmode:'transparent'},

null,
function(ka){
window[p]=ka.ref;
g.inform('sound/player_ready');});}else{



var ja=new i(q,
p,
'1px',
'1px',
[r],
'#ffffff');
ja.addParam('allowscriptaccess','always');
ja.addParam('wmode','transparent');
ja.addVariable('swf_id',p);
ja.fallback_html=' ';
ja.write(ia.id);
window[p]=ja;
g.inform('sound/player_ready');}}catch(

ha){}},





























play:function(da,ea){
da=l(da);

var fa=x(),
ga,ha;
for(var ia=0;fa&&ia<da.length;++ia){
ga=da[ia];

ha=w(ga);
if(!fa.canPlayType(ha))
continue;


ca.init([ha]);

fa.src=v(ga);
if(ea){
fa.setAttribute('loop','');}else 

fa.removeAttribute('loop');

fa.play();
return;}



for(ia=0;ia<da.length;++ia){
ga=v(da[ia]);
ha=w(ga);
if(ha!='audio/mpeg')
continue;

ca.init([ha]);
var ja=y();



if(!z()){
aa(ga,true,ea);
return;}else
if(ja){

if(ea){
ja.loopSound(ga,true);}else 

ja.playSound(ga,true);

return;}}},













stop:function(da){
da=l(da);
for(var ea=0;ea<da.length;++ea){
var fa=v(da[ea]),
ga=x(),
ha=y();

if(ga&&ga.src==fa){

ga.pause();
ga.src=undefined;}else 


ha&&ha.stopSound(fa);}}};






e.exports=ca;});

/** js/modules/SoundSynchronizer.js */
__d("SoundSynchronizer",["hasArrayNature","SoundPlayer","createArrayFrom"],function(a,b,c,d,e,f){







var g=b('hasArrayNature'),
h=b('SoundPlayer'),

i=b('createArrayFrom'),

j='fb_sounds_playing3';




function k(){
if(window.localStorage)

try{var p=window.localStorage[j];
if(p){
p=JSON.parse(p);
if(g(p))
return p;}}catch(


o){}


return [];}


function l(o){
if(window.localStorage){
var p=k();
p.push(o);
while(p.length>5)
p.shift();



try{window.localStorage[j]=JSON.stringify(p);}catch(
q){}}}



function m(o){
return k().some
(function(p){return p===o;});}



var n=





{play:function(o,p,q){
o=i(o);

p=p||(o[0]+Math.floor(Date.now()/1000));

if(m(p))
return;


h.play(o,q);

l(p);},





isSupported:function(){
return !!window.localStorage;}};




e.exports=n;});

/** js/modules/SoundRPC.js */
__d("SoundRPC",["Event","SoundSynchronizer"],function(a,b,c,d,e,f){






var g=b('Event'),
h=b('SoundSynchronizer');

function i(k,l,m){
h.play(k,l,m);}


var j=

{playLocal:i,

playRemote:function(k,l,m,n){
var o=
{paths:l,
sync:m,
loop:n};

k.postMessage(JSON.stringify(o),'*');},


supportsRPC:function(){
return !!window.postMessage;},





_listen:function(){
g.listen(window,'message',function(k){
if(!/\.facebook.com$/.test(k.origin))
return;


var l=JSON.parse(k.data);
i(l.paths,l.sync,l.loop);});}};





e.exports=j;});

/** js/modules/Sound.js */
__d("Sound",["SoundPlayer","SoundRPC","SoundSynchronizer","UserAgent"],function(a,b,c,d,e,f){















var g=b('SoundPlayer'),
h=b('SoundRPC'),
i=b('SoundSynchronizer'),
j=b('UserAgent'),

k=null,

l=

{init:function(o){

if(!k)
g.init(o);},



play:function(o,p,q){
if(k){


h.playRemote(k.contentWindow,o,p,false);}else 

h.playLocal(o,p,q);},



stop:function(o){

if(!k)
g.stop(o);}},





m=location.host.replace(/^[^.]+/,'www');

function n(){
if(j.ie()<9)

return false;



return i.isSupported()&&h.supportsRPC();}


if(location.host!==m&&n()){

k=document.createElement('iframe');
k.setAttribute('src','//'+m+'/sound_iframe.php');
k.style.display='none';
document.body.appendChild(k);}


e.exports=l;});

/** js/mercury/clients/browser/MercuryBrowserAlerts.js */
__d("MercuryBrowserAlerts",["ArbiterMixin","ChatActivity","ChatConfig","ChatOptions","ChatTitleBarBlinker","MercuryConstants","MercuryParticipants","Sound","copyProperties"],function(a,b,c,d,e,f){




var g=b('ArbiterMixin'),
h=b('ChatActivity'),
i=b('ChatConfig'),
j=b('ChatOptions'),
k=b('ChatTitleBarBlinker'),
l=b('MercuryConstants'),
m=b('MercuryParticipants'),
n=b('Sound'),

o=b('copyProperties');


n.init(['audio/ogg','audio/mpeg']);

function p(r){
if(j.getSetting('sound'))
n.play
([i.get('sound.notif_ogg_url'),
i.get('sound.notif_mp3_url')],
r,
false);}



var q=
{messageReceived:function(r){
var s=l.MessagingTag;

if(r.author==m.user||
!r.is_unread||
(r.folder!=s.INBOX&&r.folder!=s.ARCHIVED))
return;


var t=h.isActive(),
u=r.thread_id,
v=r.timestamp;

if(t){
var w=false;



q.inform('before-alert',
{threadID:u,
cancelAlert:function(){
w=true;}});





!w&&p(v);}else{



k.blink(u,v);
p(v);}







k.blinkingElsewhere();}};



e.exports=o(q,g);});

/** js/modules/ActiveXSupport.js */
__d("ActiveXSupport",[],function(a,b,c,d,e,f){


var g=null,

h=
{isSupported:function(){
if(g!==null)
return g;




try{g=!!window.ActiveXObject&&!!new ActiveXObject("htmlfile");}catch(
i){
g=false;}

return g;}};



e.exports=h;});

/** js/mercury/clients/call/VideoCallRecordMessageDialog.js */
__d("VideoCallRecordMessageDialog",["AsyncDialog","AsyncRequest","Dialog","MercuryConfig","URI","tx"],function(a,b,c,d,e,f){





var g=b('AsyncDialog'),
h=b('AsyncRequest'),
i=b('Dialog'),
j=b('MercuryConfig'),
k=b('URI'),

l=b('tx'),

m=



{get:function(n,o){
var p=j.MessagesMercuryIntegrationGK?
"Would you like to leave a message?":
"Would you like to leave a video message?",
q=j.MessagesMercuryIntegrationGK?
"New Message":
"Record Message";

return new i().
setTitle(l._("{firstname} is Unavailable",
{firstname:o})).
setBody(p).
setButtons
([{name:'record-message',
label:q},
i.CANCEL]).

setHandler(function(){
var r=k('/ajax/messaging/composer.php').
setQueryData({ids:[n],autoloadvideo:true}).
toString();
g.send(new h(r));});}};




e.exports=m;});

/** js/mercury/clients/call/VideoCallCore.js */
__d("VideoCallCore",["Event","ActiveXSupport","Arbiter","AsyncRequest","AvailableList","AvailableListConstants","Bootloader","ChannelConstants","Cookie","CSS","Dialog","MercuryConfig","UserAgent","emptyFunction","ge","ShortProfiles","VideoCallRecordMessageDialog"],function(a,b,c,d,e,f){









var g=b('Event'),

h=b('ActiveXSupport'),
i=b('Arbiter'),
j=b('AsyncRequest'),
k=b('AvailableList'),
l=b('AvailableListConstants'),
m=b('Bootloader'),
n=b('ChannelConstants'),
o=b('Cookie'),
p=b('CSS'),
q=b('Dialog'),
r=b('MercuryConfig'),
s=b('UserAgent'),

t=b('emptyFunction'),
u=b('ge'),




v=[],

w=



{isSupported:function(){
if(s.windows()){
if(s.ie()>=9&&!s.ie64()){


return h.isSupported();}else 

return (s.ie()>=7&&!s.ie64())||
s.firefox()>=3.6||
s.chrome()>=5||
s.opera()>=12;}else

if(s.osx()>10.4)
return (s.firefox()>=3.6||
s.chrome()>=5||
s.webkit()>=500||
s.opera()>=12);

return false;},





isInstalled:function(){
var aa=false;

if(this.isSupported())
if(x()){
var ba=null;

try{ba=new ActiveXObject('SkypeLimited.SkypeWebPlugin');
aa=!!ba;}catch(
ca){

}
ba=null;}else{

aa=y();



if(r.VideoCallingNoJavaGK)
if(aa&&s.osx()>=10.8)
if(aa.description&&
aa.description.charAt(0)!='v')




aa=false;}





return aa;},









mightReloadPostInstall:function(){
return s.windows();},













onVideoMessage:function(aa){
v.push(aa);



m.loadModules(['VideoCallController'],t);},







setMessageHandler:function(aa){
this.onVideoMessage=aa;
if(aa)
while(v.length)
aa(v.shift());},









availableForCall:function(aa){
var ba=k.get(aa);

return ba==l.ACTIVE||
ba==l.IDLE;},







onProfileButtonClick:function(aa){
w.startCallOrLeaveMessage(aa,'profile_button_click');},


attachListenerToProfileButton:function(aa){
var ba=u('videoCallProfileButton');
if(ba){
if(!w.isSupported()){



p.hide(ba);
return;}

g.listen(ba,'click',function(event){
w.startCallOrLeaveMessage
(aa,
'profile_button_click_timeline');});}},







startCallOrLeaveMessage:function(aa,ba){
if(this.availableForCall(aa)){
w.showOutgoingCallDialog(aa,ba);}else 

b('ShortProfiles').get(aa,function(ca){
b('VideoCallRecordMessageDialog').
get(aa,ca.firstName).
show();});},








showOutgoingCallDialog:function(aa,ba){
var ca=ba||'unknown';
w.logClick(aa,ca);

var da=
w.isInstalled()?'outgoing_dialog.php':'intro.php',
ea='/ajax/chat/video/'+da+'?idTarget='+aa;

new q().
setAllowCrossPageTransition(true).
setAsync(new j(ea)).
show();},


logClick:function(aa,ba){
new j().
setURI('/ajax/chat/video/log_click.php').
setData
({targetUserID:aa,
clickSource:ba}).
setAllowCrossPageTransition(true).
setErrorHandler(t).
send();}};




function x(){
return s.ie()&&s.windows()&&!s.opera();}






function y(){
if(!navigator)
return null;

navigator.plugins.refresh(false);
var aa=navigator.mimeTypes['application/skypesdk-plugin'];
return aa&&aa.enabledPlugin;}

















function z(){
if(!w.mightReloadPostInstall())
return;


var aa=o.get('vcpwn');

if(aa){
o.clear('vcpwn');

var ba=o.get('vctid');

if(ba){
o.clear('vctid');






if(o.get('vctid'))
return;







if(ba&&w.isInstalled()){
var ca='/ajax/chat/video/outgoing_dialog.php?idTarget='+ba;

new q().
setAllowCrossPageTransition(true).
setAsync(new j(ca)).
show();}}}}





i.subscribe
(n.getArbiterType('video'),
function(aa,ba){
w.onVideoMessage(ba.obj);});


i.subscribe
(n.getArbiterType('chat_event'),
function(aa,ba){
if(ba.obj.event_name=="missed-call")
m.loadModules(['VideoCallController'],
function(ca){
ca.onMissedCallEvent(ba.obj);});});







z();

e.exports=w;});

/** js/mercury/clients/chat/ChatApp.js */
__d("ChatApp",["CSS","JSLogger"],function(a,b,c,d,e,f){



var g=b('CSS'),
h=b('JSLogger'),

i=false,
j=false,
k=false,

l=null,

m=

{init:function(n,o,p){
if(l){
h.create('chat_app').error('repeated_init');
return;}

l=n;




d
(['TabsViewport',
'ChatTabController',
'ChatTabViewCoordinator',
'MercuryServerRequests',
'MercuryChannelHandler',
'MercuryStateCheck'],

function(q,
r,
s,
t,
u,
v){



t.handleUpdate(p);

this.tabsViewport=new q(o);
this.tabController=new r(this.tabsViewport);
this.tabViewCoordinator=new s
(o,
this.tabsViewport);


i=j=true;}.
bind(this));},


hide:function(){
if(!i||k)
return;

g.hide(l);
k=true;},


unhide:function(){
if(i){
if(k){
g.show(l);

this.tabsViewport.checkWidth();
d(['Dock'],function(n){
n.resizeAllFlyouts();});


k=false;}}else

if(!j){
d(['UIPagelet'],function(n){
n.loadFromEndpoint('DockChatPagelet','pagelet_chat');});

j=true;}}};




e.exports=m;});

/** js/mercury/clients/chat/ChatTabModel.js */
__d("ChatTabModel",["function-extensions","Arbiter","ArbiterMixin","ChatBehavior","ChatConfig","JSLogger","MercuryAssert","MercuryServerRequests","MercuryThreads","MercuryTimestampTracker","PresenceInitialData","PresenceState","PresenceUtil","areObjectsEqual","copyProperties"],function(a,b,c,d,e,f){















b('function-extensions');

var g=b('Arbiter'),
h=b('ArbiterMixin'),
i=b('ChatBehavior'),
j=b('ChatConfig'),
k=b('JSLogger'),
l=b('MercuryAssert'),
m=b('MercuryServerRequests'),
n=b('MercuryThreads').get(),
o=b('MercuryTimestampTracker'),
p=b('PresenceInitialData'),
q=b('PresenceState'),
r=b('PresenceUtil'),

s=b('areObjectsEqual'),
t=b('copyProperties'),

u=[],
v=null,
w=null,





x=null,





y=null;

function z(){
return parseInt(p.serverTime,10);}



var aa=j.get('tab_max_load_age')||3600000,
ba=z()-aa,






ca=0,


da=20,

ea=k.create('chat_tab_model'),

fa=false;












function ga(xa){
var ya=q.verifyNumber(xa.uct2);
if(!ya||typeof ya!=='number'){
ea.warn('bad_cookie_version',xa.uct2);
return null;}


if(ya<=ca||ya<ba)
return null;


return ya;}


function ha(xa){
var ya=ga(xa);
if(!ya){
var za={};
za.old_tabs=xa&&xa.t2&&JSON.stringify(xa.t2);
za.old_promoted=xa&&xa.lm2;
za.old_time=xa&&xa.uct2;
za.old_reason=xa&&xa.tr;
za.old_window=xa&&xa.tw;



var ab;
if(w&&xa.t2)
for(var bb=0;bb<xa.t2.length;bb++){
var cb=xa.t2[bb];
if(cb.i===w)
ab=cb.r;}




var db=[];
u.forEach(function(eb){
if(!eb.fragile){
var fb={i:eb.id,si:eb.server_id};



if(eb.raised||(eb.id===w&&ab))
fb.r=1;


db.push(fb);}});





xa.t2=db;
xa.uct2=ca;
xa.lm2=v;
xa.tr=y;
xa.tw=r.getSessionID();

za.new_tabs=JSON.stringify(xa.t2);
za.new_promoted=xa.lm2;
za.new_time=xa.uct2;
za.new_reason=xa.tr;
za.new_window=xa.tw;

ea.debug('store',za);}


return xa;}


function ia(xa){
if(xa){
var ya=ga(xa);
if(ya){
var za={};
za.old_tabs=JSON.stringify(u);
za.old_promoted=v;
za.old_time=ca;
za.old_reason=y;
za.window_id=r.getSessionID();

za.cookie_tabs=xa&&xa.t2&&JSON.stringify(xa.t2);
za.cookie_promoted=xa&&xa.lm2;
za.cookie_time=xa&&xa.uct2;
za.cookie_reason=xa&&xa.tr;
za.cookie_window=xa&&xa.tw;

ca=ya;
y='load';
var ab=ja(xa.t2,xa.lm2||null);

za.load_result=ab;
za.new_tabs=JSON.stringify(u);
za.new_promoted=v;
za.new_time=ca;
za.new_reason=y;

var event='load';
if(!fa)
event+='_init';


ea.log(event,za);


return ab;}}



return false;}


function ja(xa,ya){
if(ka(xa,ya)){

var za=u.filter(function(cb){return cb.fragile;}),

ab={};
v=null;
u=xa.map(function(cb){
var db={id:cb.i,server_id:cb.si};

if(db.id==ya)
v=db.id;



if(w==cb.i){
var eb=pa(w);
if(eb!=-1){
db.raised=u[eb].raised;
return db;}else 


return null;}



if(cb.r)
db.raised=true;


ab[db.id]=db;

return db;});



u=u.filter(function(cb){
return cb!=null;});



if(x)
for(var bb in x)
if(!ab[bb]||!ab[bb].raised)
delete x[bb];





za=za.filter
(function(cb){return !ab[cb.id];});


u=u.concat(za);

oa();

return true;}


return false;}


function ka(xa,ya){
if(ya!=v)
return true;



var za=u.filter(function(cb){
return !cb.fragile;});


if(xa.length!=za.length)
return true;


for(var ab=0,bb=xa.length;ab<bb;ab++){

if(xa[ab].id===w)
continue;


if(!s(xa[ab],za[ab]))
return true;}



return false;}













function la(xa,ya,za){

var ab=ia(q.get());


if(ya===undefined||ya>ca){
if(xa()){
ab=true;
y=za||null;
na(ya);}}else 


ea.error('rejected',{change_time:ya,
state_time:ca});


ab&&ma();}


function ma(){
if(fa)
va.inform
('chat/tabs-changed',
va.get());}




function na(xa){
if(xa===undefined)
xa=Math.max
(o.getLastUserMessageTimestamp()||1,
ca+1);



ca=xa;
q.doSync();}


function oa(){


var xa=u.length-da;
if(xa>0)
u=u.filter(function(ya){
return ya.raised||xa--<=0;});}




function pa(xa){
for(var ya=0;ya<u.length;ya++)
if(u[ya].id==xa)
return ya;



return -1;}






function qa(xa){
var ya=n.getThreadMetaNow(xa);
if(!ya)
return false;


if(ya.is_canonical_user){



return sa(xa);}else{



var za=ra(xa);
if(za)
m.getServerThreadID(xa,function(ab){
if(ta(xa,ab)){
na();
ma();}});



return za;}}






function ra(xa){
if(pa(xa)===-1){
u.push({id:xa,fragile:true});

ea.log('open_fragile_tab',
{tabs:JSON.stringify(u),
opened:xa,
window_id:r.getSessionID()});


return true;}


return false;}





function sa(xa){
var ya=pa(xa);

if(ya!=-1)
if(u[ya].fragile){

u.splice(ya,1);}else 


return false;




for(var za=0;za<=u.length;za++)
if(za==u.length||u[za].fragile){
u.splice(za,0,{id:xa});
oa();

ea.log('open_tab',
{tabs:JSON.stringify(u),
opened:xa,
window_id:r.getSessionID()});


return true;}}







function ta(xa,ya){
var za=pa(xa);

if(za!=-1&&u[za].fragile){
var ab=u[za];
ab.fragile=false;
ab.server_id=ya;



var bb=[];
u.forEach(function(cb){
if(cb.id!=xa){
if(ab&&cb.fragile){

bb.push(ab);
ab=null;}

bb.push(cb);}});



if(ab)
bb.push(ab);


u=bb;

ea.log('make_permanent',
{tabs:JSON.stringify(u),
tab_id:xa,
window_id:r.getSessionID()});


return true;}


return false;}


function ua(xa){
var ya=pa(xa);
if(xa==v)
v=null;


if(ya!=-1){
u.splice(ya,1);

ea.log('close_tab',
{tabs:JSON.stringify(u),
closed:xa,
window_id:r.getSessionID()});


return true;}


return false;}


q.registerStateStorer(ha);
q.registerStateLoader(function(xa){
if(ia(xa))
ma();});



function va(){}

t(va,h,
{indexOf:function(xa){
return pa(xa);},


getTab:function(xa){
l.isThreadID(xa);
var ya=this.indexOf(xa);
if(ya>-1){
var za=u[ya];
return t({},za);}

return null;},


closeAllTabs:function(){
if(u.length){
ea.log('close_all_tabs',
{closed_tabs:JSON.stringify(u),
window_id:r.getSessionID()});


u=[];
v=null;

if(x)
x={};


na();
ma();}},



closeFragileTabs:function(){
var xa=[];

for(var ya=0;ya<u.length;ya++)
if(u[ya].fragile){
xa.push(u[ya]);

u.splice(ya);
ma();
break;}




ea.log('close_fragile_tabs',
{tabs:JSON.stringify(u),
fragile_closed:xa,
window_id:r.getSessionID()});},



closeTab:function(xa,ya){
l.isThreadID(xa);

var za=false;

if(x){
delete x[xa];
za=true;}


la(function(){
if(ua(xa))
za=true;

return za;},
undefined,ya);},






closeTabAndDemote:function(xa,ya,za){
l.isThreadID(xa);
var ab=false;

if(x){
delete x[xa];
ab=true;}


la(function(){
if(ua(xa)){
if(v){
var bb=pa(v);
if(bb>ya){
var cb=u.splice(bb,1)[0];
u.splice(ya,0,cb);
v=null;}}


ab=true;}


return ab;},
undefined,za);},


raiseTab:function(xa,ya){
l.isThreadID(xa);

var za=false;

if(x&&ya){
x[xa]=true;
za=true;}



if(!ya&&xa===w){
za&&ma();
return;}


la(function(){
if(qa(xa))
za=true;


var ab=pa(xa);
if(ab!=-1&&!u[ab].raised){
u[ab].raised=true;
za=true;

ea.log('raise_tab',
{tabs:JSON.stringify(u),
raised:xa,
window_id:r.getSessionID()});}



return za;});},



get:function(){
var xa=u.map(function(ya){

var za=t({},ya);
delete za.fragile;

if(x)
za.raised=x[za.id];


return za;});


return {tabs:xa,promoted:v};},


openFragileTab:function(xa){
l.isThreadID(xa);
if(ra(xa))
ma();},



openTab:function(xa){
l.isThreadID(xa);

la(qa.curry(xa));},


lowerTab:function(xa){
l.isThreadID(xa);

var ya=false;

if(x){
delete x[xa];
ya=true;}


la(function(){
var za=pa(xa);
if(za!=-1&&u[za].raised){
delete u[za].raised;

ea.log('lower_tab',
{tabs:JSON.stringify(u),
lowered:xa,
window_id:r.getSessionID()});


ya=true;}


return ya;});},



raiseAndPromoteTab:function(xa,ya,za,ab){
l.isThreadID(xa);

var bb=false;

if(x&&ya){
x[xa]=true;
bb=true;}



if(!ya&&xa===w){
bb&&ma();
return;}


la(function(){
if(qa(xa))
bb=true;


var cb=pa(xa);
if(cb!=-1&&(!u[cb].raised||v!=xa)){
u[cb].raised=true;
v=xa;
bb=true;

ea.log('raise_and_promote_tab',
{tabs:JSON.stringify(u),
promoted:xa,
window_id:r.getSessionID()});}



return bb;},
za,ab);},


squelchTab:function(xa){
l.isThreadID(xa);

w=xa;
this.lowerTab(xa);

ea.log('squelch_tab',
{squelched:xa,
tabs:JSON.stringify(u),
window_id:r.getSessionID()});},



clearSquelchedTab:function(){
if(w)
ea.log('unsquelch_tab',
{squelched:w,
tabs:JSON.stringify(u),
window_id:r.getSessionID()});



w=null;},









persistLocalRaised:function(){
if(x){

la(function(){
var xa=false;

u.forEach(function(ya){
if(ya.raised!=x[ya.id]){
xa=true;

if(x[ya.id]){
ya.raised=true;}else 

delete ya.raised;}});



return xa;});


ea.log('persist_local_raise',
{tabs:JSON.stringify(u),
window_id:r.getSessionID()});}}});






g.subscribe(k.DUMP_EVENT,function(xa,ya){
ya.chat_tabs=
{promoted:v,
tabs:u.map(function(za){return t({},za);}),
time:ca,
max_load_age:aa};});



function wa(){
var xa=i.ignoresRemoteTabRaise();
if(xa&&!x){
ea.log('start_ignore_remote_raise');
x={};
ma();}else
if(!xa&&x){
ea.log('stop_ignore_remote_raise');
x=null;
ma();}}



i.subscribe(i.ON_CHANGED,wa);
wa();


ia(q.getInitial(),true);
if(ca===0)


ca=z()-600000;

fa=true;

e.exports=va;});

/** js/mercury/clients/chat/dialogs/VideoCallPromo.js */
__d("VideoCallPromo",["ArbiterMixin","AsyncRequest","ChatConfig","ChatVisibility","ContextualDialogX","CSS","MercuryParticipants","MercuryThreads","ChatTabTemplates","VideoCallCore","copyProperties","emptyFunction"],function(a,b,c,d,e,f){



var g=b('ArbiterMixin'),
h=b('AsyncRequest'),
i=b('ChatConfig'),
j=b('ChatVisibility'),
k=b('ContextualDialogX'),
l=b('CSS'),
m=b('MercuryParticipants'),
n=b('MercuryThreads').get(),
o=b('ChatTabTemplates'),
p=b('VideoCallCore'),

q=b('copyProperties'),
r=b('emptyFunction');

function s(){
this._dialog=null;}


function t(v){
if(!(p.isSupported()&&i.get('video.show_promo')))
return false;

var w=
n.getCanonicalUserInThread(v);
if(!w)

return false;


return j.isOnline()&&p.availableForCall(w);}


function u(v){
new h().
setURI('/ajax/chat/video/log_promo.php').
setData({viewedUserID:v}).
setAllowCrossPageTransition(true).
setErrorHandler(r).
send();}


q(s.prototype,g);
q(s.prototype,

{render:function(v,w){
var x=t(w);
if(!x)
return;

var y=n.getCanonicalUserInThread(w);
m.get('fbid:'+y,function(z){


if(!z.call_promo)
return;


var aa=
o[':fb:mercury:call:promo'].build();
this._dialog=new k();


this._dialog.init(aa.getRoot()).
setWidth(250).
setAlignH('center').
setContext(v).
show();
l.addClass(this._dialog.getRoot(),
'uiContextualDialogWithFooterArrowBottom');

l.addClass(v,'video_call_promo');
u(n.getCanonicalUserInThread(w));
this.inform('chat/dialog-rendered',
{dialog:this,thread_id:w});}.
bind(this));},


updatePosition:function(){
if(this._dialog&&this._dialog.isShown())
this._dialog.updatePosition();},



hide:function(){
if(this._dialog&&this._dialog.isShown()){
this._dialog.hide();
this._dialog=null;}}});




e.exports=s;});

/** js/mercury/clients/chat/dialogs/VideoCallTourDialog.js */
__d("VideoCallTourDialog",["ArbiterMixin","ContextualDialogX","CSS","MercuryThreads","ChatTabTemplates","VideoCallCore","VideoCallingTour","copyProperties"],function(a,b,c,d,e,f){



var g=b('ArbiterMixin'),
h=b('ContextualDialogX'),
i=b('CSS'),
j=b('MercuryThreads').get(),
k=b('ChatTabTemplates'),
l=b('VideoCallCore'),
m=b('VideoCallingTour'),

n=b('copyProperties');

function o(){
this._dialog=null;}


n(o.prototype,g);
n(o.prototype,

{render:function(p,q){

var r=j.getCanonicalUserInThread(q);
if(!r||!l.availableForCall(r))
return;

var s=
k[':fb:mercury:call:tour'].build();
this._dialog=new h();


this._dialog.init(s.getRoot()).
setWidth(250).
setAlignH('center').
setContext(p).
show();
i.addClass(this._dialog.getRoot(),
'uiContextualDialogWithFooterArrowBottom');

i.addClass(p,'video_call_tour');
this.inform('chat/dialog-rendered',
{dialog:this,thread_id:q});
m.inform('videocallingtour/end');},


updatePosition:function(){
if(this._dialog&&this._dialog.isShown())
this._dialog.updatePosition();},



hide:function(){
if(this._dialog&&this._dialog.isShown()){
this._dialog.hide();
this._dialog=null;}}});




e.exports=o;});

/** js/mercury/clients/chat/dialogs/ChatContextualDialogController.js */
__d("ChatContextualDialogController",["Event","ArbiterMixin","ChatTabModel","VideoCallingTour","VideoCallPromo","VideoCallTourDialog","copyProperties","setTimeoutAcrossTransitions"],function(a,b,c,d,e,f){


var g=b('Event'),

h=b('ArbiterMixin'),
i=b('ChatTabModel'),
j=b('VideoCallingTour'),
k=b('VideoCallPromo'),
l=b('VideoCallTourDialog'),

m=b('copyProperties'),
n=b('setTimeoutAcrossTransitions'),


o=60000,
p=false,
q=false,

r=
function(y,
z){
this._videoCallPromo=new k();
this._videoCallTour=new l();

this._threadID=y;
this._tabMainElement=z;
this._openDialog=null;
this._subscriptionTokens=[];
this._scrollListener=null;
this._timeout=null;};


function s(y,event,z){


if(y._openDialog)
y._openDialog.updatePosition();}



function t(y){
if(y._openDialog)
y._openDialog.updatePosition();}



function u(y){
if(y._openDialog){
y._openDialog.hide();
y._openDialog=null;}

if(y._timeout){
clearTimeout(y._timeout);
y._timeout=null;}

while(y._subscriptionTokens.length)
y._subscriptionTokens.pop().unsubscribe();

if(y._scrollListener){
y._scrollListener.remove();
y._scrollListener=null;}}



function v(y,event,z){
if(z.thread_id===y._threadID){
y._openDialog=z.dialog;
p=true;
x(y);

y._timeout=n
(y.destroy.bind(y,y._threadID),
o);

y._scrollListener=
g.listen(window,'scroll',t.curry(y));}}



function w(y,z){


if(!y._openDialog){
y._subscriptionTokens.push
(z.subscribe
('chat/dialog-rendered',
v.curry(y)));


z.render
(y._tabMainElement,y._threadID);}}



function x(y){
y._subscriptionTokens.push
(i.subscribe
('chat/tabs-changed',
s.curry(y)),

r.subscribe
('dialog/close-all',
u.curry(y)));}




m(r,h);
m(r.prototype,

{destroy:function(){
u(this);},


tabFocused:function(){



if(q){
w(this,this._videoCallTour);
return;}

if(!p)
w(this,this._videoCallPromo);},



tabNotActive:function(){
u(this);},


hideVideoCallouts:function(){
u(this);}});




j.subscribe('videocallingtour/start',function(){
q=true;
r.inform('dialog/close-all');});

j.subscribe('videocallingtour/end',function(){
q=false;});


e.exports=r;});

/** js/mercury/clients/chat/ChatPrivacyActionController.js */
__d("ChatPrivacyActionController",["ChatVisibility","JSLogger","PresencePrivacy","copyProperties"],function(a,b,c,d,e,f){



var g=b('ChatVisibility'),
h=b('JSLogger'),
i=b('PresencePrivacy'),

j=b('copyProperties'),

k=function(l,m){
this._userID=l;
this._logger=h.create('blackbird');

this._getState=function(){
if(g.isOnline())
return i.allows(this._userID)?
k.NORMAL:
k.BLOCKED;


return k.OFFLINE;};


this._togglePrivacy=function(){
var n=this._getState();

switch(this._getState()){
case k.OFFLINE:
if(g.isOnline()){
this._logger.error('tabs_already_online');
break;}


this._logger.log('tabs_go_online',{tab_id:this._userID});
g.goOnline(function(){




if(!i.allows(this._userID)){
if(this._getState()!==k.BLOCKED)
this._logger.error
('privacy_action_controller_blocked_inconsistency');

this._togglePrivacy();}}.

bind(this));
break;

case k.BLOCKED:
i.allow(this._userID);
this._logger.log('tabs_unblock',{tab_id:this._userID});
break;

case k.NORMAL:
i.disallow(this._userID);
this._logger.log('tabs_block',{tab_id:this._userID});
break;}};





(function(){
var n=function(){
m&&m(this._getState());}.
bind(this);
n();

this._subscribeToken=i.subscribe
('privacy-changed',
n);}.
bind(this)).defer();};


k.OFFLINE='offline';
k.BLOCKED='blocked';
k.NORMAL='normal';

j(k.prototype,






{togglePrivacy:function(){
this._logger.log
('gear_menu_toggle_privacy',
{tab_id:this._userID});
this._togglePrivacy();},


destroy:function(){
i.unsubscribe(this._subscribeToken);}});



e.exports=k;});

/** js/mercury/clients/chat/ChatTabMessagesView.js */
__d("ChatTabMessagesView",["date-extensions","Event","Arbiter","ArbiterMixin","MercuryAttachment","MercuryAttachmentRenderer","ChannelConstants","ChatConfig","ChatTabIndicatorLine","ChatVisibility","MercuryConfig","MercuryConstants","CSS","DOM","Env","MercuryMessages","MercuryThreadMetadataRawRenderer","MercuryThreadMetadataRenderer","MercuryThreads","MercuryMessageRenderer","MercuryParticipants","React","ChatTabTemplates","MercuryThreadInformer","Tooltip","VideoCallCore","copyProperties","isRTL","throttle","tx"],function(a,b,c,d,e,f){




b('date-extensions');
var g=b('Event'),

h=b('Arbiter'),
i=b('ArbiterMixin'),
j=b('MercuryAttachment'),
k=b('MercuryAttachmentRenderer'),
l=b('ChannelConstants'),
m=b('ChatConfig'),
n=b('ChatTabIndicatorLine'),
o=b('ChatVisibility'),
p=b('MercuryConfig'),
q=b('MercuryConstants'),
r=b('CSS'),
s=b('DOM'),
t=b('Env'),
u=b('MercuryMessages').get(),
v=
b('MercuryThreadMetadataRawRenderer'),
w=b('MercuryThreadMetadataRenderer'),
x=b('MercuryThreads').get(),
y=b('MercuryMessageRenderer'),
z=b('MercuryParticipants'),
aa=b('React'),
ba=b('ChatTabTemplates'),
ca=b('MercuryThreadInformer'),
da=b('Tooltip'),
ea=b('VideoCallCore'),

fa=b('copyProperties'),
ga=b('isRTL'),
ha=b('throttle'),
ia=b('tx');

function ja(sa){
return Date.format
(m.get('24h_times')?'H:i':'g:ia',
sa/1000);}


function ka(sa){
var ta=ba[':fb:chat:conversation:message-group'].build();

ta.setNodeContent('timestamp',ja(sa.timestamp));

z.get(sa.author,function(ua){
var va=ta.getNode('profileLink');
va.href=ua.href;

var wa=ua.fbid==t.user?"You":ua.name;
da.set(va,wa,'left');

ta.setNodeProperty('profilePhoto','src',ua.image_src);});


return ta;}


function la(sa){
var ta=ba[':fb:chat:conversation:message:event'].build();

ta.setNodeContent('timestamp',ja(sa.timestamp));

y.renderLogMessage
(ta.getNode('icon'),
ta.getNode('message'),
ta.getNode('attachment'),
sa);


var ua=ma(sa);
if(ua)
s.appendContent(ta.getNode('message'),ua);


return ta.getRoot();}






function ma(sa){
var ta,ua;

if(sa.log_message_type==q.MercuryLogMessageType.VIDEO_CALL)
if(sa.log_message_data.event_name=='install_canceled'){
ta=s.tx._("Retry setup and call back.");
ua='callback_cancelinstall_link';
return na
(ta,
sa.thread_id,
sa.log_message_data.to,
ua);}else
if(!sa.log_message_data.event_name&&
sa.log_message_data.callee==z.user&&
!sa.log_message_data.answered){
ta=s.tx._("Call Back");
ua='callback_link';
return na
(ta,
sa.thread_id,

sa.log_message_data.caller.split(':')[1],
ua);}


return null;}


function na(sa,ta,ua,va){
if(ea.isSupported()){
var wa=
!o.isOnline()||!ea.availableForCall(ua),
xa=s.create
('a',

{href:'#',
className:'callBackLink'},

sa);
if(wa)




r.hide(xa);

xa.setAttribute
('data-gt',
JSON.stringify({videochat:'clicked_callback_link'}));
g.listen(xa,'click',function(){
qa.inform('video-call-clicked',
{userID:ua,
threadID:ta,
clickSource:va});});


return xa;}

return null;}


function oa(sa){
var ta=ba[':fb:mercury:chat:message:forward'].build(),


ua=ta.getNode('forwardText');
if(ua){
r.hide(ta.getRoot());
w.renderTitanLink
(sa.thread_id,
ta.getNode('forwardLink'),
r.show.bind(r,ta.getRoot()));


if(sa.forward_count>1){
s.appendContent
(ua,
ia._("{count} forwarded messages",{count:sa.forward_count}));}else 


s.appendContent(ua,"1 forwarded message");}



return ta.getRoot();}


var pa=[];

function qa
(sa,
ta,
ua,
va,
wa,
xa){

this.loadingIcon=wa;
this.threadID=sa;
this.sheetController=ta;
this.scrollContainer=ua;
this.conversationElem=va;
this.messageElements={};



this.messageGroup=null;
this.prevMessage=null;


this._fetchMultiplier=1;
this._oldestMessageDisplayedTimestamp=null;
this._loadingMoreMessages=false;
this._currentMessageCount=0;
this._hasReachedClearedMessages=false;
var ya=
q.MercuryThreadlistConstants.MESSAGE_TIMESTAMP_THRESHOLD;
this._oldestMessageDisplayedTimestamp=Date.now()-ya;
pa.push(this);

this._subscription=h.subscribe
('overflow-applied-to-body',
this.scrollToBottom.bind(this));


g.listen
(this.scrollContainer,
'scroll',
ha(this.scrolling,50,this));



if(xa)
this.indicatorLine=new n
(this.threadID,
xa,
this);




var za=p.InfiniteScrollChatTabGK?
this._updateTimestamp.bind(this):function(){};
u.getThreadMessagesRange
(this.threadID,
0,
q.MercuryThreadlistConstants.RECENT_MESSAGES_LIMIT,
za);

this.rerender();}


fa(qa,i);

fa(qa.prototype,
{scrolling:function(){
if(p.InfiniteScrollChatTabGK&&
!this._loadingMoreMessages&&
this.isScrolledNearTop()&&
!this.isScrolledToBottom()&&
!this._hasReachedClearedMessages)
this.loadMoreMessages();

if(!this._newMessagesSheetOpened)

return;

if(this.isScrolledToBottom()){
this.sheetController.closeNewMessagesSheet();
this._newMessagesSheetOpened=false;}},



destroy:function(){
s.empty(this.conversationElem);
this._subscription.unsubscribe();
pa.remove(this);
this.indicatorLine&&this.indicatorLine.destroy();
this.destroyed=true;},


_appendMessage:function(sa){

if(sa==this.prevMessage)
return;


var ta=q.MercuryThreadlistConstants,
ua=ta.GROUPING_THRESHOLD,


va=
sa.action_type==q.MercuryActionType.LOG_MESSAGE&&
sa.log_message_type==q.MercuryLogMessageType.SERVER_ERROR;


if(sa.is_cleared){
this._hasReachedClearedMessages=true;
return;}


var wa=null;
if(this.prevMessage)
wa=new Date(this.prevMessage.timestamp);

var xa=new Date(sa.timestamp);

if(!va&&
(!wa||
wa.getDate()!=xa.getDate()||
wa.getMonth()!=xa.getMonth()||
wa.getFullYear()!=xa.getFullYear())){
var ya=ba[':fb:chat:conversation:date-break'].
build();
s.setContent(ya.getRoot(),
y.renderDate(xa));
s.appendContent(this.conversationElem,ya.getRoot());
this.messageGroup=null;}


if(sa.action_type==q.MercuryActionType.LOG_MESSAGE){
s.appendContent(this.conversationElem,la(sa));
this.messageGroup=null;
this.prevMessage=sa;
return;}


if(!this.messageGroup||
this.prevMessage.author!=sa.author||
this.prevMessage.timestamp<sa.timestamp-ua){
this.messageGroup=ka(sa);
s.appendContent(this.conversationElem,this.messageGroup.getRoot());}


var za=this._renderSingleMessage(sa);
this.messageElements[sa.message_id]=za;

s.appendContent(this.messageGroup.getNode('messages'),za);
this.prevMessage=sa;},


rerender:function(){
if(!this._oldestMessageDisplayedTimestamp)
return;




var sa=
this._finishedFetchingMoreMessages&&this.scrollContainer.scrollHeight,
ta=
this._finishedFetchingMoreMessages&&this.scrollContainer.scrollTop,
ua=this.isScrolledToBottom();
s.empty(this.conversationElem);
this.messageElements={};
this.messageGroup=null;
this.prevMessage=null;
var va=u.getThreadMessagesSinceTimestamp
(this.threadID,
this._oldestMessageDisplayedTimestamp);

this._renderOlderMessages
(va,
sa,
ta,
ua);
this._finishedFetchingMoreMessages=false;},


update:function(sa){
for(var ta in sa){
var ua=this.messageElements[ta];
if(ua){


var va=this.isScrolledToBottom(),

wa=this._renderSingleMessage
(u.getMessagesFromIDs([ta])[0]);
this.messageElements[ta]=wa;
s.replace(ua,wa);



if(va)
this.scrollToBottom();}}},





_getLoadingHeight:function(){
return this.loadingHeight||this.loadingIcon.clientHeight;},


_appendMessages:function(sa){
sa.forEach(this._appendMessage.bind(this));
this.indicatorLine&&this.indicatorLine.setLastMessage(this.prevMessage);
this.sheetController.displayMessengerPromoTabSheet(this.prevMessage);},


_appendNewMessages:function(sa){
var ta=this.isScrolledToBottom(),
ua=this._messagesOnlySentFromSelf(sa);
this._appendMessages(sa);
if(ta){
this.scrollToBottom();}else
if(!ua){
this.sheetController.openNewMessagesSheet();
this._newMessagesSheetOpened=true;}},



_messagesOnlySentFromSelf:function(sa){
for(var ta=0;ta<sa.length;ta++)
if(sa[ta].author!==z.user)
return false;


return true;},


_renderOlderMessages:
function(sa,
ta,
ua,
va){
if(!sa)
return;

this._appendMessages(sa);
if(va){
this.scrollToBottom();}else
if(this._finishedFetchingMoreMessages)










this.scrollToPosition(this.scrollContainer.scrollHeight-
ta-this.loadingHeight+ua);},



_updateTimestamp:function(sa){
if(sa&&sa.length){
this._oldestMessageDisplayedTimestamp=sa[0].timestamp;
this._currentMessageCount=sa.length;}

this._loadingMoreMessages=false;
this._finishedFetchingMoreMessages=true;
r.hide(this.loadingIcon);},


isScrolledToBottom:function(){
var sa=this.scrollContainer;

return sa.scrollTop+sa.clientHeight>=sa.scrollHeight-1;},


isScrolledNearTop:function(){
return this.scrollContainer.scrollTop<this.scrollContainer.clientHeight;},


scrollToBottom:function(){
this.scrollToPosition(this.scrollContainer.scrollHeight);},


scrollToPosition:function(sa){
this.scrollContainer.scrollTop=sa;},


loadMoreMessages:function(){
if(u.hasLoadedExactlyNMessages
(this.threadID,this._currentMessageCount)&&
u.hasLoadedAllMessages(this.threadID))
return;

r.show(this.loadingIcon);
this.loadingHeight=this._getLoadingHeight();
this._loadingMoreMessages=true;
if(this._fetchMultiplier<10)
this._fetchMultiplier+=1;

var sa=
q.MercuryThreadlistConstants.RECENT_MESSAGES_LIMIT*
this._fetchMultiplier,
ta=this._currentMessageCount+sa,
ua=
u.hasLoadedNMessages(this.threadID,ta);
u.getThreadMessagesRange
(this.threadID,
0,
ta,
this._updateTimestamp.bind(this),
null,
q.MercuryAPIArgsSource.CHAT);

if(ua)
this.rerender();},



_renderSingleMessage:function(sa){
var ta=ba[':fb:chat:conversation:message'].render();

if(sa.subject){
var ua=ba[':fb:chat:conversation:message:subject'].render();
s.setContent(ua,sa.subject);
s.appendContent(ta,ua);}




if(sa.body.substr(0,4)=='?OTR'){
s.setContent(ta,"[encrypted message]");
r.addClass(ta,'cyphertext');}else{

r.addClass
(ta,
ga(sa.body)?'direction_rtl':'direction_ltr');


s.appendContent
(ta,
y.formatMessageBody(sa.body));}



if(sa.has_attachment)
this._appendMessageAttachments(ta,sa);


if(sa.forward_count)
s.appendContent
(ta,
oa(sa));



if(sa.is_spoof_warning){
var va=
ba[':fb:chat:conversation:message:undertext'].build();
s.appendContent(va.getNode('message'),ta);
z.get(sa.author,function(ya){
w.renderChatSpoofWarning
(va.getNode('status'),
sa.is_spoof_warning,
ya);});


return va.getRoot();}


var wa=v.renderStatusIndicator
(sa.status,
sa.error_data,
u.resendMessage.shield(u,sa));



if(wa){

r.addClass(ta,'errorStatus');

var xa=
ba[':fb:chat:conversation:message:status'].build();
s.appendContent(xa.getNode('message'),ta);
s.appendContent(xa.getNode('status'),wa);

return xa.getRoot();}


return ta;},


_appendMessageAttachments:function(sa,ta){
var ua=q.MercuryAttachmentType,
va=ta.attachments;

if(ta.raw_attachments&&ta.raw_attachments.length>0)

va=j.convertRaw(ta.raw_attachments);


for(var wa=0,xa=va.length;wa<xa;++wa){
var ya=va[wa],
za=ya.attach_type,
ab=ya.share_data_type;

if(za==ua.ERROR){
s.appendContent(sa,k.renderError(ya));}else
if(za==ua.FILE)
if(ya.metadata&&!ya.preview_url&&
ya.metadata.type==q.MercuryAttachmentAudioClip){
var bb=k.renderAudioClip
(ya,
q.ChatAudioAttachmentConstants.PLAYER_MIN_WIDTH,
q.ChatAudioAttachmentConstants.PLAYER_MAX_WIDTH);


if(bb){
var cb=s.create('div');
s.appendContent(sa,cb);
aa.renderComponent
(bb,
cb);}else 


s.appendContent(sa,
k.renderFileLink(ya));}else 


s.appendContent(sa,
k.renderFileLink(ya));



var db=null,
eb,
fb=
q.MercurySupportedShareType.FB_SOCIAL_REPORT_PHOTO;

if(za==ua.SHARE&&
ab==q.MercurySupportedShareType.FB_VIDEO){
db=k.renderVideoThumb(ya);
eb=s.find(db,'img');
g.listen(eb,'load',this._thumbLoaded.shield(this,eb));}else
if(za==ua.SHARE&&
(ab==q.MercurySupportedShareType.FB_MUSIC_ALBUM||
ab==q.MercurySupportedShareType.FB_SONG)){
db=k.renderMusic(ya);
eb=s.find(db,'img');
g.listen(eb,'load',this._thumbLoaded.shield(this,eb));}else
if(za==ua.SHARE&&
(ab==q.MercurySupportedShareType.EXTERNAL||
ab==q.MercurySupportedShareType.FB_TEMPLATE||
ab==q.MercurySupportedShareType.FB_COUPON)){
db=k.renderExternalLink(ya);
eb=s.find(db,'img');
g.listen(eb,'load',this._thumbLoaded.shield(this,eb));}else
if(ab==fb){




db=k.renderExternalLink(ya);
eb=s.find(db,'img');
g.listen(eb,'load',this._thumbLoaded.shield(this,eb));}else
if(ya.preview_url){
z.get
(ta.author,
function(gb){
var hb=z.getUserID(gb.id);

db=k.renderPreview
(ya,
0,
null,
ta,
gb,
hb);

eb=s.find(db,'img');
g.listen(eb,'load',this._thumbLoaded.shield(this,eb));}.
bind(this));}else
if(za==ua.SHARE)

db=k.renderShareLink(ya);


if(db)
s.appendContent(sa,db);}},




_thumbLoaded:function(sa){
var ta=this.scrollContainer.scrollTop+
this.scrollContainer.clientHeight;


if(ta+sa.offsetHeight>=this.scrollContainer.scrollHeight)
this.scrollToBottom();}});




ca.subscribe('messages-reordered',function(sa,ta){
pa.forEach(function(ua){
ta[ua.threadID]&&ua.rerender();});});



ca.subscribe('messages-updated',function(sa,ta){
pa.forEach(function(ua){
ta[ua.threadID]&&ua.update(ta[ua.threadID]);});});



ca.subscribe('messages-received',function(sa,ta){
pa.forEach(function(ua){
var va=ta[ua.threadID];
if(p.InfiniteScrollChatTabGK&&
va&&
va.length)
ua._currentMessageCount+=va.length;

va&&ua._appendNewMessages(va);});});



h.subscribe
(l.getArbiterType('chat_event'),
function(sa,ta){
if(ra(ta.obj)){
var ua=
(t.user==ta.obj.from)?ta.obj.to:ta.obj.from,
va=x.getThreadIdForUser(ua),
wa=pa.filter(function(za){
return za.threadID===va;});

if(wa.length>0){
var xa=wa[0],
ya=
u.constructLogMessageObject
(q.MercurySourceType.CHAT_WEB,
va,
q.MercuryLogMessageType.VIDEO_CALL,
ta.obj);
ya.author='fbid:'+ta.obj.from;
xa._appendNewMessages([ya]);}}});





function ra(sa){
return (sa.event_name==='installing'||
sa.event_name==='install_canceled');}


e.exports=qa;});

/** js/mercury/clients/chat/sheet/raw_renderers/ChatAddFriendsTabSheetRawRenderer.js */
__d("ChatAddFriendsTabSheetRawRenderer",["ContextualTypeaheadView","DOM","Event","MercuryTypeahead","ChatTabTemplates","tx","MercuryDataSourceWrapper"],function(a,b,c,d,e,f){


var g=b('ContextualTypeaheadView'),
h=b('DOM'),
i=b('Event'),
j=b('MercuryTypeahead'),
k=b('ChatTabTemplates'),

l=b('tx'),

m=b('MercuryDataSourceWrapper').source,

n=
{render:

function(o,
p,
q,
r,
s){
var t=
k[':fb:mercury:chat:tab-sheet:add-friends'].build(),

u=new j
(m,
g);

u.setExcludedParticipants(r.participants);
u.setPlaceholder("Enter a friend's name");
u.build();
h.replace
(t.getNode('participantsTypeahead'),
u.getElement());

h.setContent(q,t.getRoot());
u.focus();

var v=
function(){
var w=u.getSelectedParticipantIDs();


if(w.length)
s(w);

p.close(o);};

i.listen
(t.getNode('doneButton'),
'click',
v);}};



e.exports=n;});

/** js/mercury/clients/chat/MultiChatController.js */
__d("MultiChatController",["Arbiter","AsyncSignal","copyProperties","Form","MercuryMessages","MercuryServerRequests","MercuryThreads"],function(a,b,c,d,e,f){



var g=b('Arbiter'),
h=b('AsyncSignal'),
i=b('copyProperties'),
j=b('Form'),
k=b('MercuryMessages').get(),
l=b('MercuryServerRequests'),
m=b('MercuryThreads').get();

function n(){}

i(n,
{subscribe:function(o,p){
o.subscribe('confirm',function(){
this.createGroupThreadFromChooserDialog(o,p);}.
bind(this));},


createGroupThreadFromChooserDialog:function(o,p){
var q=j.serialize(o.getRoot()),
r=JSON.parse(q.profileChooserItems),
s=[];
for(var t in r)
if(r[t])
s.push(t);


var u=n.createThreadForFBIDs(s);



l.subscribe('update-thread-ids',function(v,w){
for(var x in w)
if(w[x]==u)
new h
('/ajax/groups/chat/log',
{group_id:p,message_id:x}).
send();});




o.hide();},


createThreadForTokens:function(o){
if(!o.length)
return;


var p;
if(o.length==1){
p='user:'+o[0].split(':')[1];}else 

p='root:'+k.generateNewClientMessageID
(Date.now());


m.createNewLocalThread(p,o);
g.inform('chat/open-tab',{thread_id:p});
return p;},


createThreadForFBIDs:function(o){
var p=[];
for(var q=0;q<o.length;q++)
p.push("fbid:"+o[q]);

return n.createThreadForTokens(p);}});



e.exports=n;});

/** js/mercury/clients/chat/sheet/ChatAddFriendsTabSheet.js */
__d("ChatAddFriendsTabSheet",["ChatAddFriendsTabSheetRawRenderer","MercuryConstants","MercuryMessages","MultiChatController","MercuryThreads","copyProperties"],function(a,b,c,d,e,f){



var g=
b('ChatAddFriendsTabSheetRawRenderer'),
h=b('MercuryConstants'),
i=b('MercuryMessages').get(),
j=b('MultiChatController'),
k=b('MercuryThreads').get(),

l=b('copyProperties');

function m
(p,
q,
r){
this._threadID=p;
this._rootElement=q;
this._sheetView=r;}


l(m.prototype,
{render:function(){
k.getThreadMeta(this._threadID,function(p){
var q=p.is_canonical_user?
n:
o;
g.render
(this,
this._sheetView,
this._rootElement,
p,
q.curry(p));}.
bind(this));},



isPermanent:function(){
return true;},


getType:function(){
return 'add_friends_type';},



open:function(){
this._sheetView.open(this);}});



function n(p,q){
var r=p.participants;
j.createThreadForTokens
(r.concat(q));}



function o(p,q){
var r=p.thread_id;
if(k.isEmptyLocalThread(r)){



k.addParticipantsToThreadLocally
(r,q);}else 

i.sendMessage(i.constructLogMessageObject
(h.MercurySourceType.CHAT_WEB,
r,
h.MercuryLogMessageType.SUBSCRIBE,
{added_participants:q}));}




e.exports=m;});

/** js/mercury/clients/chat/sheet/raw_renderers/ChatAvailabilityTabSheetRawRenderer.js */
__d("ChatAvailabilityTabSheetRawRenderer",["AvailableListConstants","CSS","cx","DOM","GenderConst","MercuryConfig","ChatTabTemplates"],function(a,b,c,d,e,f){



var g=b('AvailableListConstants'),
h=b('CSS'),
i=b('cx'),
j=b('DOM'),
k=b('GenderConst'),
l=b('MercuryConfig'),
m=b('ChatTabTemplates'),

n=

{render:function(r,s,t){
var u=
m[':fb:mercury:chat:tab-sheet:message-icon-sheet'].build(),
v=null;

switch(r){
case g.ACTIVE:
h.addClass(u.getRoot(),"_1sk2");
v=o(t);
break;

case g.MOBILE:
h.addClass(u.getRoot(),"_1sk3");
v=p(t);
break;
case g.OFFLINE:
v=q(t);
break;}


j.setContent(u.getNode('text'),v);
j.setContent(s,u.getRoot());}};



function o(r){
return j.tx._("{name} is now available.",{name:r.firstName});}


function p(r){
return j.tx._("Your messages will be sent to {name}'s phone.",{name:r.firstName});}


function q(r){
switch(r.gender){
case k.FEMALE_SINGULAR:
case k.FEMALE_SINGULAR_GUESS:
if(l.ChatControlLanguageChangeGK){
return j.tx._("{name} isn't on chat, but you can still send her a message.",
{name:r.firstName});}else 


return j.tx._("{name} is offline, but you can still send her a message.",
{name:r.firstName});


case k.MALE_SINGULAR:
case k.MALE_SINGULAR_GUESS:
if(l.ChatControlLanguageChangeGK){
return j.tx._("{name} isn't on chat, but you can still send him a message.",
{name:r.firstName});}else 


return j.tx._("{name} is offline, but you can still send him a message.",
{name:r.firstName});



default:if(l.ChatControlLanguageChangeGK){
return j.tx._("{name} isn't on chat, but you can still send them a message.",
{name:r.firstName});}else 


return j.tx._("{name} is offline, but you can still send them a message.",
{name:r.firstName});


}}






e.exports=n;});

/** js/mercury/clients/chat/sheet/ChatAvailabilityTabSheet.js */
__d("ChatAvailabilityTabSheet",["Arbiter","AvailableList","AvailableListConstants","ChatAvailabilityTabSheetRawRenderer","ChatConfig","MercuryThreads","ShortProfiles","copyProperties"],function(a,b,c,d,e,f){





var g=b('Arbiter'),
h=b('AvailableList'),
i=b('AvailableListConstants'),
j=
b('ChatAvailabilityTabSheetRawRenderer'),
k=b('ChatConfig'),
l=b('MercuryThreads').get(),
m=b('ShortProfiles'),

n=b('copyProperties');








function o
(p,q,r,s){
this._handledAvailability=q;
this._sheetView=s;
this._rootElement=r;

this._canonicalUser=l.getCanonicalUserInThread(p);


if(this._canonicalUser){
this._currentAvailability=i.ACTIVE;



this._handleAvailabilityChange();

g.subscribe
(i.ON_AVAILABILITY_CHANGED,
this._handleAvailabilityChange.bind(this));}}






o.createSheets=
function(p,q,r){

var s={};


if(k.get('roger.ui')){
s[i.OFFLINE]=new o
(p,i.OFFLINE,q,r);
return s;}


[i.ACTIVE,
i.OFFLINE,
i.MOBILE].
forEach(function(t){
s[t]=new o
(p,t,q,r);});



return s;};


n(o.prototype,
{render:function(){
!this._canonicalUser;





m.get
(this._canonicalUser,
j.
render.
curry(this._currentAvailability,this._rootElement));},




isPermanent:function(){
return false;},


getType:function(){
switch(this._handledAvailability){
case i.ACTIVE:
return 'availability_active_type';
case i.MOBILE:
return 'availability_mobile_type';
case i.OFFLINE:
return 'availability_offline_type';


default:throw new Error("Invalid handled availability");
}},


getCloseTimeout:function(){
return 5000;},


_handleAvailabilityChange:function(){
var p=h.get(this._canonicalUser);

if(p==this._currentAvailability)

return;


this._currentAvailability=p;
if(p==this._handledAvailability)
this._sheetView.open(this);}});





e.exports=o;});

/** js/mercury/clients/chat/sheet/ChatMessengerUpsellConfig.js */
__d("ChatMessengerUpsellConfig",["AsyncRequest","KeyedCallbackManager"],function(a,b,c,d,e,f){



var g=b('AsyncRequest'),
h=b('KeyedCallbackManager'),

i=new h(),

j=
{get:function(k,l){
var m=i.executeOrEnqueue(k,l),
n=
i.getUnavailableResources(m);
if(n.length)
new g().
setURI('/ajax/chat/messenger_upsell/config.php').
setHandler(this._setPromoConfig.bind(this)).
send();},



_setPromoConfig:function(k){
var l=k.payload;
if(l){
i.setResource
('impression_count',l.number_of_impressions);
i.setResource
('max_impressions',l.max_impressions);
i.setResource('promo_timeout',l.promo_timeout);
i.setResource
('post_click_timeout',l.post_click_timeout);
i.setResource('should_show_orca_promotion',true);}else 

i.setResource('should_show_orca_promotion',false);},



getNow:function(k){
return i.getResource(k);},


setImpressionCount:function(k,l){
new g().
setURI('/ajax/chat/messenger_upsell/update_impressions.php').
setData({impressions:l,friend_id:k}).
send();
i.setResource
('impression_count',l);
if(l>=
i.getResource('max_impressions'))
i.setResource('should_show_orca_promotion',false);}};




e.exports=j;});

/** js/mercury/clients/chat/sheet/ChatMessengerPromoTabSheet.js */
__d("ChatMessengerPromoTabSheet",["Event","AsyncRequest","MercuryConstants","DOM","MercuryParticipants","MercuryThreads","ChatTabTemplates","ChatMessengerUpsellConfig","URI","copyProperties","tx"],function(a,b,c,d,e,f){



var g=b('Event'),

h=b('AsyncRequest'),
i=b('MercuryConstants'),
j=b('DOM'),
k=b('MercuryParticipants'),
l=b('MercuryThreads').get(),
m=b('ChatTabTemplates'),
n=b('ChatMessengerUpsellConfig'),
o=b('URI'),

p=b('copyProperties'),
q=b('tx');

function r
(s,
t,
u){
this._threadID=s;
this._rootElement=t;
this._sheetView=u;
this._sheetHasBeenDisplayed=false;
this._canonicalUser=l.getCanonicalUserInThread(s);
this._timeoutResetCallback=null;
this._template;}


p(r.prototype,
{render:function(){
this._template=
m[':fb:mercury:chat:tab-sheet:promo-sheet'].build();

var s=k.getIDForUser(this._canonicalUser);
k.get(s,function(t){
j.setContent
(this._template.getNode('text'),
q._("{name} is using Messenger. Get the app to chat on the go.",{name:t.short_name}));}.

bind(this));
this._button=this._template.getNode('installButton');
g.listen
(this._template.getNode('installButton'),
'click',
this.installButtonClickHandler.bind(this));

j.setContent(this._rootElement,this._template.getRoot());},




rerender:function(){
j.empty(this._rootElement);
j.setContent
(this._template.getNode('text'),
"A link has been sent to your phone to install Messenger");

j.remove(this._template.getNode('installButton'));
j.setContent(this._rootElement,this._template.getRoot());


n.get('post_click_timeout',function(s){
this._timeoutResetCallback
(this,
s);}.

bind(this));},


installButtonClickHandler:function(){

var s=new o('/ajax/marketing/messenger_send_to_mobile').
setQueryData({fb_source:'web_chat_upsell'});
new h().
setURI(s).
setMethod('POST').
setHandler(function(v){
this.rerender();}.
bind(this)).

send();



var t=n.getNow('impression_count'),
u=t*100;
n.setImpressionCount(this._canonicalUser,u);},



isPermanent:function(){
return false;},


timeoutCanBeReset:function(){
return true;},


setResetTimeoutCallback:function(s){
this._timeoutResetCallback=s;},


getType:function(){
return 'messenger_promo_type';},


getCloseTimeout:function(){
return n.getNow('promo_timeout');},


_displayUpsellCallback:function(s){
if(!s)
return;

this._sheetView.open(this);
this._sheetHasBeenDisplayed=true;

var t=n.getNow('impression_count');
n.setImpressionCount
(this._canonicalUser,t+1);

return;},


displayPromo:function(s){
var t=i.MercurySourceType;
if(!s||
(s.source!=t.CHAT_ORCA&&
s.source!=t.TITAN_ORCA)||
k.getUserID(s.author)!=this._canonicalUser||
this._sheetHasBeenDisplayed)
return;

n.get('should_show_orca_promotion',function(u){
this._displayUpsellCallback(u);}.
bind(this));}});



e.exports=r;});

/** js/mercury/clients/chat/sheet/ChatNewMessageTabSheet.js */
__d("ChatNewMessagesTabSheet",["Event","ArbiterMixin","DOM","ChatTabTemplates","copyProperties"],function(a,b,c,d,e,f){



var g=b('Event'),

h=b('ArbiterMixin'),
i=b('DOM'),
j=b('ChatTabTemplates'),

k=b('copyProperties');

function l
(m,
n,
o){
this._threadID=m;
this._rootElement=n;
this._sheetView=o;}


k(l.prototype,h,
{render:function(){
var m=
j[':fb:mercury:chat:tab-sheet:clickable-message-icon-sheet'].
build();
i.setContent
(m.getNode('text'),
i.tx._("Scroll down to see new messages."));

i.setContent(this._rootElement,m.getRoot());

g.listen(m.getRoot(),'click',function(){
this.inform('clicked',this._threadID);}.
bind(this));},


isPermanent:function(){
return true;},


getType:function(){
return 'new_messages_type';},


open:function(){
this._sheetView.open(this);},


close:function(){
this._sheetView.close(this);}});



e.exports=l;});

/** js/mercury/clients/chat/sheet/ChatNoRecipientsTabSheet.js */
__d("ChatNoRecipientsTabSheet",["DOM","MercuryParticipants","ChatTabTemplates","MercuryThreadInformer","MercuryThreads","copyProperties"],function(a,b,c,d,e,f){



var g=b('DOM'),
h=b('MercuryParticipants'),
i=b('ChatTabTemplates'),
j=b('MercuryThreadInformer'),
k=b('MercuryThreads').get(),

l=b('copyProperties');

function m
(n,
o,
p){
this._threadID=n;
this._rootElement=o;
this._sheetView=p;

j.subscribe
('threads-updated',
this._handleThreadsUpdated.bind(this));}



l(m.prototype,
{render:function(){
var n=
i[':fb:mercury:chat:tab-sheet:message-icon-sheet'].build();
g.setContent(n.getNode('text'),g.tx._("All recipients have left this conversation. Please close the stale tab."));
g.setContent(this._rootElement,n.getRoot());},



isPermanent:function(){
return true;},


getType:function(){
return 'no_recipients_type';},


_handleThreadsUpdated:function(){
k.getThreadMeta(this._threadID,function(n){
var o=h.user,
p=n.participants.filter(function(q){
return q!=o;});

if(p.length<1){


this._sheetView.open(this);}else 


this._sheetView.close(this);}.

bind(this));}});



e.exports=m;});

/** js/mercury/clients/chat/sheet/ChatOfflineTabSheet.js */
__d("ChatOfflineTabSheet",["ChatPrivacyActionController","ChatVisibility","CSS","DOM","Event","JSLogger","MercuryConfig","MercuryParticipants","MercuryThreads","ChatTabTemplates","copyProperties","cx"],function(a,b,c,d,e,f){



var g=b('ChatPrivacyActionController'),
h=b('ChatVisibility'),
i=b('CSS'),
j=b('DOM'),
k=b('Event'),
l=b('JSLogger'),
m=b('MercuryConfig'),
n=b('MercuryParticipants'),
o=b('MercuryThreads').get(),
p=b('ChatTabTemplates'),

q=b('copyProperties'),
r=b('cx');

function s
(t,
u,
v){
this._rootElement=u;
this._sheetView=v;

this._logger=l.create('blackbird');
this._canonicalUser=o.getCanonicalUserInThread(t);


if(this._canonicalUser)
this._privacyActionController=new g
(this._canonicalUser,
this._handlePrivacyChange.bind(this));}




q(s.prototype,
{render:function(){
if(!this._canonicalUser){
this._logger.error('offline_sheet_open_with_non_friend');
return;}


var t=
p[':fb:mercury:chat:tab-sheet:message-icon-sheet'].build(),

u='fbid:'+this._canonicalUser;
n.get(u,function(v){
var w='fbChatGoOnlineLink',
x=m.ChatControlLanguageChangeGK?
j.tx._("turn on chat"):
j.tx._("go online"),
y=j.create
('a',
{href:'#',className:w},
x),


z;
if(m.ChatControlLanguageChangeGK){
z=j.tx._("To chat with {name} and other friends, {link}.",
{name:v.short_name,link:y});}else 


z=j.tx._("You are now offline. To chat with {name} and other friends, {link}.",
{name:v.short_name,link:y});


j.setContent(t.getNode('text'),z);

i.addClass(t.getRoot(),"_1sk1");
j.setContent(this._rootElement,t.getRoot());

k.listen(this._rootElement,'click',function(event){
if(i.hasClass(event.getTarget(),w)){
if(h.isOnline())
this._logger.error('tab_sheet_already_online');





this._privacyActionController.togglePrivacy();
this._logger.log('tab_sheet_go_online',
{tab_id:this._canonicalUser});
return false;}}.

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


_handlePrivacyChange:function(t){
if(!this._canonicalUser)
this._logger.error('user_blocked_sheet_privacy_changed_non_friend');


switch(t){
case g.OFFLINE:
this._sheetView.open(this);
break;
case g.NORMAL:
case g.BLOCKED:
this._sheetView.close(this);
break;}},




isPermanent:function(){
return true;},


getType:function(){
return 'offline_type';},


destroy:function(){
this._privacyActionController&&this._privacyActionController.destroy();}});



e.exports=s;});

/** js/mercury/clients/chat/sheet/ChatUploadWarningTabSheet.js */
__d("ChatUploadWarningTabSheet",["DOM","ChatTabTemplates","copyProperties"],function(a,b,c,d,e,f){



var g=b('DOM'),
h=b('ChatTabTemplates'),

i=b('copyProperties');

function j
(k,
l,
m){
this._threadID=k;
this._rootElement=l;
this._sheetView=m;}


i(j.prototype,
{render:function(){
var k=
h[':fb:mercury:chat:tab-sheet:message-icon-sheet'].build();
g.setContent
(k.getNode('text'),
g.tx._("Please wait until the upload is complete before you send your message."));

g.setContent(this._rootElement,k.getRoot());},


isPermanent:function(){
return false;},


getType:function(){
return 'upload_warning_type';},


open:function(){
this._sheetView.open(this);},


close:function(){
this._sheetView.close(this);}});



e.exports=j;});

/** js/mercury/clients/chat/sheet/ChatThreadIsMutedTabSheet.js */
__d("ChatThreadIsMutedTabSheet",["Event","ArbiterMixin","DOM","ChatTabTemplates","copyProperties"],function(a,b,c,d,e,f){



var g=b('Event'),

h=b('ArbiterMixin'),
i=b('DOM'),
j=b('ChatTabTemplates'),

k=b('copyProperties');

function l
(m,
n,
o){
this._threadID=m;
this._rootElement=n;
this._sheetView=o;}


k(l.prototype,h,
{render:function(){
var m=
j[':fb:mercury:chat:tab-sheet:message-mute-sheet'].
build();
i.setContent
(m.getNode('text'),
i.tx._("Conversation is muted."));

i.setContent(this._rootElement,m.getRoot());

g.listen(m.getNode('unmuteButton'),'click',function(){
this.inform('clicked',this._threadID);}.
bind(this));},


isPermanent:function(){
return false;},


getType:function(){
return 'chat-thread-is-muted';},


open:function(){
this._sheetView.open(this);},


close:function(){
this._sheetView.close(this);}});



e.exports=l;});

/** js/mercury/clients/chat/sheet/ChatUserBlockedTabSheet.js */
__d("ChatUserBlockedTabSheet",["ChatPrivacyActionController","CSS","DOM","Event","GenderConst","JSLogger","MercuryConfig","MercuryParticipants","MercuryThreads","ChatTabTemplates","copyProperties","cx","tx"],function(a,b,c,d,e,f){



var g=b('ChatPrivacyActionController'),
h=b('CSS'),
i=b('DOM'),
j=b('Event'),
k=b('GenderConst'),
l=b('JSLogger'),
m=b('MercuryConfig'),
n=b('MercuryParticipants'),
o=b('MercuryThreads').get(),
p=b('ChatTabTemplates'),

q=b('copyProperties'),
r=b('cx'),
s=b('tx');

function t
(u,
v,
w){
this._rootElement=v;
this._sheetView=w;

this._logger=l.create('blackbird');
this._canonicalUser=o.getCanonicalUserInThread(u);


if(this._canonicalUser)
this._privacyActionController=new g
(this._canonicalUser,
this._handlePrivacyChange.bind(this));}




q(t.prototype,
{render:function(){
if(!this._canonicalUser){
this._logger.error('user_blocked_sheet_open_with_non_friend');
return;}


var u=
p[':fb:mercury:chat:tab-sheet:user-blocked'].build(),

v='fbid:'+this._canonicalUser;
n.get(v,function(w){
var x=null;

switch(w.gender){
case k.FEMALE_SINGULAR:
case k.FEMALE_SINGULAR_GUESS:
x=m.ChatControlLanguageChangeGK?
s._("You turned off chat for {name} but you can still send her a message. ",{name:w.short_name}):
s._("{name} sees you as offline on chat, but you can still send her a message. ",{name:w.short_name});
break;
case k.MALE_SINGULAR:
case k.MALE_SINGULAR_GUESS:
x=m.ChatControlLanguageChangeGK?
s._("You turned off chat for {name} but you can still send him a message. ",{name:w.short_name}):
s._("{name} sees you as offline on chat, but you can still send him a message. ",{name:w.short_name});
break;

default:x=m.ChatControlLanguageChangeGK?
s._("You turned off chat for {name} but you can still send them a message. ",{name:w.short_name}):
s._("{name} sees you as offline on chat, but you can still send them a message. ",{name:w.short_name});
}

i.setContent(u.getNode('text'),x);

var y=m.ChatControlLanguageChangeGK?
s._("Turn on chat for {name}?",
{name:w.short_name}):

s._("Go Online to {name}",{name:w.short_name});
i.setContent(u.getNode('actionLink'),y);

h.addClass(u.getRoot(),"_1sk0");
i.setContent(this._rootElement,u.getRoot());

j.listen
(u.getNode('actionLink'),
'click',
this._privacyActionController.togglePrivacy.bind
(this._privacyActionController));}.
bind(this));},


_handlePrivacyChange:function(u){
if(!this._canonicalUser)
this._logger.error('user_blocked_sheet_privacy_changed_non_friend');


switch(u){
case g.BLOCKED:
this._sheetView.open(this);
break;
case g.NORMAL:
case g.OFFLINE:
this._sheetView.close(this);
break;}},




isPermanent:function(){
return true;},


getType:function(){
return 'user_blocked_type';},


destroy:function(){
this._privacyActionController&&this._privacyActionController.destroy();}});



e.exports=t;});

/** js/mercury/clients/chat/sheet/ChatTabSheetController.js */
__d("ChatTabSheetController",["ChatAddFriendsTabSheet","ChatAvailabilityTabSheet","ChatMessengerPromoTabSheet","ChatNewMessagesTabSheet","ChatNoRecipientsTabSheet","ChatOfflineTabSheet","ChatUploadWarningTabSheet","ChatThreadIsMutedTabSheet","ChatUserBlockedTabSheet","copyProperties","MercurySheetView","MercuryThreads"],function(a,b,c,d,e,f){






var g=b('ChatAddFriendsTabSheet'),
h=b('ChatAvailabilityTabSheet'),
i=b('ChatMessengerPromoTabSheet'),
j=b('ChatNewMessagesTabSheet'),
k=b('ChatNoRecipientsTabSheet'),
l=b('ChatOfflineTabSheet'),
m=b('ChatUploadWarningTabSheet'),
n=b('ChatThreadIsMutedTabSheet'),
o=b('ChatUserBlockedTabSheet'),
p=b('copyProperties'),
q=b('MercurySheetView'),
r=b('MercuryThreads').get(),

s=
function(t,
u,
v){

this._sheetView=new q
(t,
u,
v);


this._addFriendsTabSheet=new g
(t,
u,
this._sheetView);

this._userBlockedTabSheet=new o
(t,
u,
this._sheetView);

this._offlineTabSheet=new l
(t,
u,
this._sheetView);


this._messengerPromoTabSheet=new i
(t,
u,
this._sheetView);


this._newMessagesTabSheet=new j
(t,
u,
this._sheetView);


this._availabilityTabSheets=h.createSheets
(t,
u,
this._sheetView);


this._uploadWarningTabSheet=new m
(t,
u,
this._sheetView);


this._threadIsMutedTabSheet=new n
(t,
u,
this._sheetView);



if(!r.getCanonicalUserInThread(t))
this._noRecipientsTabSheet=new k
(t,
u,
this._sheetView);};




p(s.prototype,
{openAddFriendsSheet:function(){
this._addFriendsTabSheet.open();},


openNewMessagesSheet:function(){
this._newMessagesTabSheet.open();},


openUploadWarningTabSheet:function(){
this._uploadWarningTabSheet.open();},


openThreadIsMutedTabSheet:function(){
this._threadIsMutedTabSheet.open();},


closeThreadIsMutedTabSheet:function(){
this._threadIsMutedTabSheet.close();},


closeNewMessagesSheet:function(){
this._newMessagesTabSheet.close();},


displayMessengerPromoTabSheet:function(t){
this._messengerPromoTabSheet.displayPromo(t);},


closeUploadWarningTabSheet:function(){
this._uploadWarningTabSheet.close();},


onClickNewMessagesSheet:function(t){
this._newMessageClickSub=
this._newMessagesTabSheet.subscribe('clicked',t);},


onClickThreadIsMutedSheet:function(t){
this._threadIsMutedClickSub=
this._threadIsMutedTabSheet.subscribe('clicked',t);},


destroy:function(){
this._sheetView.destroy();
this._offlineTabSheet.destroy();
this._userBlockedTabSheet.destroy();
this._newMessageClickSub&&this._newMessageClickSub.unsubscribe();
this._threadIsMutedClickSub&&this._threadIsMutedClickSub.unsubscribe();}});



e.exports=s;});

/** js/mercury/clients/chat/ChatTabView.js */
__d("ChatTabView",["Event","function-extensions","Arbiter","ArbiterMixin","AsyncDialog","AsyncRequest","AvailableList","AvailableListConstants","ChatBehavior","ChatConfig","ChatContextualDialogController","ChatPrivacyActionController","ChatQuietLinks","ChatTabMessagesView","ChatTabSheetController","ChatVisibility","MercuryConfig","CSS","Dialog","Dock","DOM","JSLogger","Keys","MercuryConstants","MercuryFileUploader","MercuryMessages","MercuryParticipants","MercuryServerRequests","MercuryThreadInformer","MercuryThreadMetadataRawRenderer","MercuryThreadMetadataRenderer","MercuryThreadMuter","MercuryThreads","MercuryTypingReceiver","MessagesEmoticonView","NubController","Parent","PresencePrivacy","SubscriptionsHandler","ChatTabTemplates","TextAreaControl","Tooltip","TypingIndicator","URI","UserAgent","VideoCallCore","copyProperties","setIntervalAcrossTransitions","tx"],function(a,b,c,d,e,f){





var g=b('Event');
b('function-extensions');

var h=b('Arbiter'),
i=b('ArbiterMixin'),
j=b('AsyncDialog'),
k=b('AsyncRequest'),
l=b('AvailableList'),
m=b('AvailableListConstants'),
n=b('ChatBehavior'),
o=b('ChatConfig'),
p=b('ChatContextualDialogController'),
q=b('ChatPrivacyActionController'),
r=b('ChatQuietLinks'),
s=b('ChatTabMessagesView'),
t=b('ChatTabSheetController'),
u=b('ChatVisibility'),
v=b('MercuryConfig'),
w=b('CSS'),
x=b('Dialog'),
y=b('Dock'),
z=b('DOM'),
aa=b('JSLogger'),
ba=b('Keys'),
ca=b('MercuryConfig'),
da=b('MercuryConstants'),
ea=b('MercuryFileUploader'),
fa=b('MercuryMessages').get(),
ga=b('MercuryParticipants'),
ha=b('MercuryServerRequests'),
ia=b('MercuryThreadInformer'),
ja=
b('MercuryThreadMetadataRawRenderer'),
ka=b('MercuryThreadMetadataRenderer'),
la=b('MercuryThreadMuter'),
ma=b('MercuryThreads').get(),
na=b('MercuryTypingReceiver'),
oa=b('MessagesEmoticonView'),
pa=b('NubController'),
qa=b('Parent'),
ra=b('PresencePrivacy'),
sa=b('SubscriptionsHandler'),
ta=b('ChatTabTemplates'),
ua=b('TextAreaControl'),
va=b('Tooltip'),
wa=b('TypingIndicator'),
xa=b('URI'),
ya=b('UserAgent'),
za=b('VideoCallCore'),

ab=b('copyProperties'),
bb=b('setIntervalAcrossTransitions'),
cb=b('tx'),

db=aa.create('tab_view'),

eb={};

function fb(ub,vb){
var wb=z.create('div');


vb=vb.filter(function(xb){
return xb!=ga.user;});


ga.getMulti(vb,function(xb){
for(var yb in xb){
var zb=xb[yb],

ac=
ta[':fb:mercury:chat:multichat-tooltip-item'].build();

z.setContent(ac.getNode('name'),zb.name);

var bc=ga.getUserID(yb),
cc=bc&&
l.get(bc)==m.ACTIVE;
w.conditionShow(ac.getNode('icon'),cc);
w.conditionClass
(ac.getNode('name'),
'tooltipItemWithIcon',
cc);


z.appendContent(wb,ac.getRoot());}


va.set(ub,wb,'above','center');});}



var gb={},
hb=null,
ib=false;
function jb(ub,vb,wb){
if(wb){
gb[ub]=vb;
if(!hb)
hb=bb(kb,600);}else{


w.removeClass(vb,'highlightTitle');
delete gb[ub];}}



function kb(){
for(var ub in gb){
var vb=gb[ub];
if(vb.parentNode){
w.conditionClass(vb,'highlightTitle',ib);}else 

delete gb[ub];}


ib=!ib;


if(!Object.keys(gb).length){
clearInterval(hb);
hb=null;}}



function lb(ub){
var vb=ha.tokenizeThreadID(ub);
switch(vb.type){
case 'user':
return ta[':fb:mercury:chat:user-tab'].build();
case 'group':
return ta[':fb:mercury:chat:group-tab'].build();}


return ta[':fb:mercury:chat:multichat-tab'].build();}


function mb(ub){
var vb=ub._fileUploader&&
ub._fileUploader.getAttachments();
return vb&&vb.length;}


function nb(ub){
var vb=ub._tabTemplate.getNode('input'),
wb=vb.value||'';

if(!/^\s*$/.test(wb)||mb(ub))
ma.getThreadMeta(ub._threadID,function(xb){
var yb=fa.constructUserGeneratedMessageObject
(wb,
da.MercurySourceType.CHAT_WEB,
ub._threadID);

if(o.get('send_files_from_chat')){
var zb=ub._fileUploader.getAttachments();
if(zb&&zb.length){
yb.has_attachment=true;
yb.raw_attachments=zb;}}


if(ma.isEmptyLocalThread(ub._threadID)){



var ac=
ha.tokenizeThreadID(ub._threadID);
yb.message_id=ac.value;
yb.specific_to_list=xb.participants;}


fa.sendMessage(yb);
if(o.get('send_files_from_chat'))
ob(ub);

ub._getNode('input').value='';
ub._typingIndicator&&ub._typingIndicator.resetState();
ub._messagesView&&ub._messagesView.scrollToBottom();}.
bind(ub));}



function ob(ub){
ub._fileUploader.removeAttachments();}


function pb(ub){
ub._blocked=true;
ub._sheetController.openUploadWarningTabSheet();}


function qb(){
if(this._blocked){


if(this._fileUploader.isUploading())
return;


this._blocked=false;
nb(this);
this._sheetController.closeUploadWarningTabSheet();}}



function rb(){
d(['Dock'],function(ub){
ub.resizeAllFlyouts();});

this._attachmentsDiv.scrollTop=this._attachmentsDiv.scrollHeight;}


function sb(ub,vb){
if(vb)
ha.ensureThreadIsFetched(vb);


this._threadID=ub;
this._eventListeners=[];

this._tabTemplate=lb(ub);
this._tabElem=this._tabTemplate.getRoot();


if(!(this._getNode instanceof Function))
db.log('getnode_undefined',
{is_getnode_set:!!this._getNode,
is_prototype_set:!!sb.prototype,
is_window:window==this,
is_chat_tab_view:this instanceof sb,
ctor_name:this.constructor&&this.constructor.name});



this._subscriptionsHandler=new sa();

if(o.get('send_files_from_chat')){
this._fileUploader=new ea
(this._tabTemplate.getNode('attachmentShelf'),
this._tabTemplate.getNode('attachButtonForm'),
this._tabTemplate.getNode('fileInput'),
this._tabTemplate.getNode('attachID'));

this._subscriptionsHandler.addSubscriptions
(this._fileUploader.subscribe
(['all-uploads-completed','upload-canceled'],
qb.bind(this)),

this._fileUploader.subscribe
('dom-updated',
rb.bind(this)));


this._attachmentsDiv=this._getNode('attachmentShelf');}else 


if(this._tabTemplate.getNode('uploadFilesLink'))
w.hide(this._tabTemplate.getNode('uploadFilesLink'));



this._sheetController=new t
(this._threadID,
this._getNode('sheet'),
this._tabElem);


this._sheetController.onClickNewMessagesSheet(function(){
this._messagesView&&this._messagesView.scrollToBottom();
this.focus();}.
bind(this));

this._sheetController.onClickThreadIsMutedSheet(function(){
la.showMuteChangeDialog(0,this._threadID);
this.focus();}.
bind(this));

this._contextualDialogController=new p
(this._threadID,
this._getNode('videoCallLink'));


this._messagesView=null;



var wb=this._getNode('conversationLink');
if(wb){
w.hide(wb);
ka.renderTitanLink
(ub,
wb,
w.show.bind(w,wb));}






if(!ma.getCanonicalUserInThread(this._threadID))
this._titlebarTooltipAnchor=this._getNode('titlebarText');


var xb=this._getCanonicalUserID();

if(this._isTitleTextLinked())
ga.get('fbid:'+xb,function(ac){
if(ac.href){
var bc=this._getNode('titlebarText');
bc.setAttribute('href',ac.href);
bc.removeAttribute('rel');
w.removeClass(bc,'noLink');}}.

bind(this));



this._nubController=new pa().init(this._tabElem);

ua.getInstance(this._getNode('input')).
subscribe('resize',function(){
this._nubController.flyoutContentChanged();}.
bind(this));
this._nubController.subscribe('resize',function(){
this._emoticonsNode.style.left=
(this._getNode('input').clientWidth+3)+'px';
ua.getInstance(this._getNode('input')).update();}.
bind(this));


this._listen('closeButton','click',this._closeClicked);
this._listen('titlebarCloseButton','click',this._closeClicked);
this._listen('dockButton','click',this._nubClicked);
this._listen('dockButton','keydown',this._dockKeyDown);
this._listen('nubFlyoutTitlebar','click',this._titleClicked);
this._listen('chatConv','click',this._chatConvClicked);
this._listen('uploadFilesLink','click',this._uploadFilesLinkClicked,true);
this._listen('addFriendLink','click',this._addFriendLinkClicked,true);
this._listen('addToThreadLink','click',this._addFriendLinkClicked,true);
this._listen('clearWindowLink','click',this._clearHistory,true);
this._listen('unsubscribeLink','click',this._unsubscribeLinkClicked,true);
this._listen('videoCallLink','click',this._callClicked,true);
this._listen('reportSpamLink','click',this._reportSpamClicked,true);
this._listen('muteThreadLink','click',
this._showMuteSettingDialog.bind(this,-1),true);
this._listen('unmuteThreadLink','click',
this._showMuteSettingDialog.bind(this,0),true);
this._listen('input','focus',this._focusTab);
this._listen('input','blur',this._blurTab);

this._emoticonsNode=this._getNode('emoticons');
this._emoticonView=
new oa(this._emoticonsNode,this._getNode('input'));

if(ya.firefox()){



this._listen('input','keypress',this._inputKeyDown);}else 

this._listen('input','keydown',this._inputKeyDown);



this._privacyLink=this._getNode('privacyLink');

if(this._privacyLink){
this._privacyActionController=new q
(xb,this._updatePrivacyLink.bind(this));


this._eventListeners.push
(g.listen
(this._privacyLink,
'click',
this._privacyActionController.togglePrivacy.bind
(this._privacyActionController)));}



ma.getThreadMeta(this._threadID,function(ac){
var bc=xb||
(o.get('chat_multi_typ_send')&&!ac.is_canonical);
if(bc)
ha.getServerThreadID
(this._threadID,
function(cc){
this._typingIndicator=new wa
(xb,
this._getNode('input'),
'mercury-chat',
null,
cc);}.

bind(this));


this._setUpMutingSettings(ac);}.
bind(this));


var yb=this._getNode('muteGroupLink');
if(yb){
var zb=ma.getCanonicalGroupInThread(this._threadID);
if(zb)
yb.setAttribute
('ajaxify',
xa(yb.getAttribute('ajaxify')).addQueryData({id:zb}));}




r.removeEmptyHrefs(this._tabElem);

eb[ub]=this;
this.updateAvailableStatus();
this.updateTab();}


function tb(){
for(var ub in eb){
eb[ub].updateAvailableStatus();
eb[ub].updateMultichatTooltip();}}



h.subscribe
(['buddylist/availability-changed'],
tb);

ra.subscribe
(['privacy-changed','privacy-availability-changed'],
tb);


n.subscribe(n.ON_CHANGED,function(){
for(var ub in eb)
ma.getThreadMeta(ub,function(vb){
eb[ub]._updateUnreadCount(vb);});});




na.subscribe('state-changed',function(ub,vb){
for(var wb in vb){
var xb=vb[wb]&&vb[wb].length,
yb=eb[wb];
yb&&yb.showTypingIndicator(xb);}});



ia.subscribe('threads-updated',function(ub,vb){
for(var wb in eb)
vb[wb]&&eb[wb].updateTab();});



ia.subscribe('threads-deleted',function(ub,vb){
for(var wb in eb)
vb[wb]&&sb.inform('thread-deleted',wb);});



ab(sb,i,
{get:function(ub){
return eb[ub];}});



ab(sb.prototype,
{getThreadID:function(){
return this._threadID;},


isVisible:function(){
return w.shown(this._tabElem);},


setVisibleState:function(ub,vb){
var wb=w.shown(this._tabElem),
xb=w.hasClass(this._tabElem,'opened');
w.conditionShow(this._tabElem,ub);
w.conditionClass(this._tabElem,'opened',vb);



if(!(wb&&xb)&&ub&&vb){
if(!this._messagesView)
this._messagesView=new s
(this._threadID,
this._sheetController,
this._getNode('chatConv'),
this._getNode('conversation'),
this._getNode('loadingIndicator'),
this._getNode('typingIndicator'));



this._nubController.flyoutContentChanged();
this._messagesView.scrollToBottom();}


if(wb&&xb&&!(ub&&vb))
this._contextualDialogController.tabNotActive();},



focus:function(){
var ub=w.hasClass(this._tabElem,'opened')?'input':'dockButton';
this._getNode(ub).focus();},


isFocused:function(){
var ub=document.activeElement;
return qa.byClass(ub,'fbMercuryChatTab')===this._tabElem;},


setInput:function(ub){
this._getNode('input').value=ub;},


insertBefore:function(ub){
z.insertBefore(ub._tabElem,this._tabElem);},


appendTo:function(ub){
z.appendContent(ub,this._tabElem);},


nextTabIs:function(ub){
var vb=ub&&ub._tabElem;
return this._tabElem.nextSibling==vb;},


destroy:function(){
z.remove(this._tabElem);
this._emoticonView&&this._emoticonView.destroy();
while(this._eventListeners.length)
this._eventListeners.pop().remove();


this._messagesView&&this._messagesView.destroy();
this._sheetController.destroy();
if(o.get('send_files_from_chat'))
this._fileUploader.destroy();

this._subscriptionsHandler.release();
this._contextualDialogController.destroy();
this._privacyActionController&&this._privacyActionController.destroy();

delete eb[this._threadID];
y.unregisterNubController(this._nubController);},


updateAvailableStatus:function(){
var ub=
{active:false,
mobile:false,
greenphone:false},


vb=this._getCanonicalUserID(),
wb=true,
xb=false;

if(vb){
var yb=l.get(vb);

wb=!u.isOnline();
xb=!ra.allows(vb);

ub.active=(yb===m.ACTIVE);
if(o.get('sidebar_mobile_icon_green')){
ub.greenphone=yb===m.MOBILE;}else 

ub.mobile=yb===m.MOBILE;


this._updateCallLink(yb);}


w.conditionClass(this._tabElem,'chatOffline',wb);
w.conditionClass(this._tabElem,'blocked',!wb&&xb);
for(var zb in ub)
w.conditionClass
(this._tabElem,
zb,
!wb&&!xb&&ub[zb]);},




updateTab:function(){
ma.getThreadMeta(this._threadID,function(ub){
if(!ub.is_subscribed){
sb.inform('unsubscribed',this._threadID);
return;}


ka.renderAndSeparatedParticipantList
(this._threadID,
[this._getNode('name'),this._getNode('titlebarText')],

{names_renderer:ja.renderShortNames,
check_length:true});


this._updateMutingSettings(ub);
this._updateUnreadCount(ub);
this.updateMultichatTooltip();
this._updateArchiveWarning(ub);}.
bind(this));},


_setUpMutingSettings:function(ub){
var vb=la.isThreadMuted(ub);
if(vb&&v.MuteThreadsOnDesktopGK)
this._sheetController.openThreadIsMutedTabSheet();

this._updateActionMenu(vb);},


_updateMutingSettings:function(ub){
if(!v.MuteThreadsOnDesktopGK)
return;

var vb=la.isThreadMuted(ub);
if(vb&&w.shown(this._getNode('muteThreadLink').parentNode)){
this._sheetController.openThreadIsMutedTabSheet();}else
if(!vb&&
w.shown(this._getNode('unmuteThreadLink').parentNode))
this._sheetController.closeThreadIsMutedTabSheet();

this._updateActionMenu(vb);},


_updateActionMenu:function(ub){
w.conditionShow
(this._getNode('muteThreadLink').parentNode,
v.MuteThreadsOnDesktopGK&&!ub);

w.conditionShow
(this._getNode('unmuteThreadLink').parentNode,
v.MuteThreadsOnDesktopGK&&ub);},



_updateArchiveWarning:function(ub){
var vb=false;
ga.get(ga.user,function(wb){
vb=wb.employee;
if(vb)
ga.getMulti
(ub.participants,
this._showArchiveWarningIfAllParticipantsAreEmployees.bind(this));}.

bind(this));},


_showArchiveWarningIfAllParticipantsAreEmployees:function(ub){
var vb=true;
for(var wb in ub)
vb=vb&&ub[wb].employee;

var xb=this._getNode('titanArchiveWarning');
if(xb){
if(this._titlebarTooltipAnchor)

w.conditionClass(this._titlebarTooltipAnchor,
'narrowTitleBar',
vb);

w.conditionShow(xb,vb);}},



updateMultichatTooltip:function(){
ma.getThreadMeta(this._threadID,function(ub){
if(!ub.is_canonical)
fb
(this._titlebarTooltipAnchor,
ub.participants);}.


bind(this));},





_getNode:function(ub){
return this._tabTemplate.getNode(ub);},





_getCanonicalUserID:function(){
return ma.getCanonicalUserInThread(this._threadID);},






_listen:function(ub,event,vb,wb){
var xb=this._getNode(ub);
if(xb){
this._eventListeners.push(g.listen(xb,event,vb.bind(this)));}else
if(!wb)
throw new Error('Could not find node "'+ub+'"');},



_closeClicked:function(ub){
sb.inform('closed-tab',this._threadID);
ub.prevent();},


_nubClicked:function(){
return sb.inform('nub-activated',this._threadID);},


_dockKeyDown:function(event){
if(event.keyCode===ba.RETURN||event.keyCode===ba.SPACE){
sb.inform('nub-activated',this._threadID);
event.kill();}else 

this._handleHotkeyPressed(event);},











_handleHotkeyPressed:function(event){
if(event.keyCode===ba.ESC){
sb.inform('esc-pressed',this._threadID);
event.kill();}else
if(event.keyCode===ba.TAB&&!event.ctrlKey){
var ub=sb.inform
('tab-pressed',
{id:this._threadID,shiftPressed:event.shiftKey});
!ub&&event.kill();}},



_isTitleTextLinked:function(){
var ub=this._getCanonicalUserID();
return ub&&o.get('chat_tab_title_link_timeline');},


_titleClicked:function(event){
var ub=event.getTarget(),

vb=qa.byClass(ub,'titlebarText'),
wb=vb&&this._isTitleTextLinked();

if(!wb&&
!qa.byClass(ub,'uiSelector')&&
!qa.byClass(ub,'addToThread'))
sb.inform('lower-activated',this._threadID);},



_callClicked:function(ub){
var vb=this._getCanonicalUserID();






if(za.availableForCall(vb)){
var wb='chat_tab_icon';
if(ub.target&&w.hasClass(ub.target,'video_call_promo')){
wb='chat_tab_icon_promo';}else
if(ub.target&&w.hasClass(ub.target,'video_call_tour'))
wb='chat_tab_icon_tour';

sb.inform
('video-call-clicked',

{threadID:this._threadID,
userID:vb,
clickSource:wb});}


return false;},


_uploadFilesLinkClicked:function(){
this._tabTemplate.getNode('fileInput').click();},


_addFriendLinkClicked:function(){
this._sheetController.openAddFriendsSheet();},


_clearHistory:function(){
var ub=ma.getThreadMetaNow(this._threadID);
if(ub){
var vb=this._getCanonicalUserID();
ha.clearChat(this._threadID,
vb,
ub.timestamp);}},



_unsubscribeLinkClicked:function(){
var ub=[];
ub.push
({name:'unsubscribe',
label:"Leave Conversation",
handler:this._unsubscribeToThread.bind(this)});

ub.push(x.CANCEL);

new x().
setTitle("Leave Conversation?").
setBody("You will stop receiving messages from this conversation and people will see that you left.").
setButtons(ub).
show();},


_reportSpamClicked:function(){
var ub=this._getCanonicalUserID(),

vb=xa('/ajax/chat/report.php').
addQueryData({id:ub}).
addQueryData({src:'top_report_link'});
j.send(new k(vb));},


_showMuteSettingDialog:function(ub){
la.showMuteChangeDialog(ub,this._threadID);},


_focusTab:function(){
w.addClass(this._tabElem,'focusedTab');
sb.inform('focused',this._threadID);
this._contextualDialogController.tabFocused();},


_blurTab:function(){
w.removeClass(this._tabElem,'focusedTab');},


_inputKeyDown:function(event){
if(event.keyCode===ba.RETURN&&!event.shiftKey){

if(o.get('send_files_from_chat')){
var ub=this._fileUploader.isUploading();
if(ub){
pb(this);
return;}}


nb(this);
event.kill();}


if(event.keyCode===ba.DOWN&&
event.shiftKey&&
this._getNode('input').value===''){
sb.inform('lower-activated',this._threadID);
event.kill();
return;}


this._handleHotkeyPressed(event);},






_chatConvClicked:function(ub){
if(qa.byTag(ub.getTarget(),'a')||z.getSelection())
return;

this.focus();},


showTypingIndicator:function(ub){

var vb=ma.getThreadMetaNow(this._threadID),
wb=this._getCanonicalUserID()||
(o.get('chat_multi_typ')&&vb&&!vb.is_canonical);
if(wb)
w.conditionClass(this._tabElem,'typing',ub);},



_updateUnreadCount:function(ub){
var vb=ub.unread_count;



if(typeof vb!='undefined'){
var wb=!!vb&&
(!n.showsTabUnreadUI||n.showsTabUnreadUI()),

xb=this._getNode('numMessages');
w.conditionShow(xb,wb);
w.conditionClass(this._tabElem,'highlightTab',wb);
jb(this._threadID,this._tabElem,wb);
z.setContent(xb,vb);}},







_updateCallLink:function(ub){
var vb=this._getNode('videoCallLink');

if(u.isOnline()){
var wb=this._getCanonicalUserID(),
xb='fbid:'+wb;







ga.get(xb,function(yb){
if(za.availableForCall(wb)){
va.set
(vb,
cb._("Start a video call with {firstname}",{firstname:yb.short_name}));
this._updateCallBackLinks(this._tabElem,true);}else{

va.set
(vb,
cb._("{firstname} is currently unavailable for video calling",{firstname:yb.short_name}));
this._hideVideoCallouts();
this._updateCallBackLinks(this._tabElem,false);}}.

bind(this));}else{

va.set(vb,"You must be online to make a call.");
this._hideVideoCallouts();
this._updateCallBackLinks(document.body,false);}},



_updateCallBackLinks:function(ub,vb){
var wb=z.scry(ub,'a.callBackLink');
if(vb){
wb.forEach(w.show);}else 

wb.forEach(w.hide);},



_hideVideoCallouts:function(){
this._contextualDialogController.hideVideoCallouts();},


_updatePrivacyLink:function(ub){
if(ub==q.OFFLINE){
z.setContent(this._privacyLink,"Go online");}else{

var vb=this._getCanonicalUserID(),
wb='fbid:'+vb;

ga.get(wb,function(xb){
var yb=null;
if(ub==q.BLOCKED){
if(ca.ChatControlLanguageChangeGK){

yb=cb._("Turn On Chat for {name}",
{name:xb.short_name});}else 



yb=cb._("Go Online to {name}",
{name:xb.short_name});}else 



if(ca.ChatControlLanguageChangeGK){

yb=cb._("Turn Off Chat for {name}",
{name:xb.short_name});}else 



yb=cb._("Go Offline to {name}",
{name:xb.short_name});




z.setContent(this._privacyLink,yb);}.
bind(this));}},



_unsubscribeToThread:function(){
if(ma.isEmptyLocalThread(this._threadID)){

sb.inform('unsubscribed',this._threadID);}else{

var ub=fa.constructLogMessageObject
(da.MercurySourceType.CHAT_WEB,
this._threadID,
da.MercuryLogMessageType.UNSUBSCRIBE,
{});

fa.sendMessage(ub);}


return true;},


_emoticonView:null});



e.exports=sb;});

/** js/mercury/clients/chat/ChatNewMessageHandler.js */
__d("ChatNewMessageHandler",["ChatActivity","ChatTabModel","ChatTabView","JSLogger","MercuryAssert","MercuryBrowserAlerts","MercuryThreads","MercuryUnseenState"],function(a,b,c,d,e,f){






var g=b('ChatActivity'),
h=b('ChatTabModel'),
i=b('ChatTabView'),
j=b('JSLogger'),
k=b('MercuryAssert'),
l=b('MercuryBrowserAlerts'),
m=b('MercuryThreads').get(),
n=b('MercuryUnseenState'),

o=j.create('chat_new_message'),

p=

{_raiseTab:function(q,r){
var s=h.getTab(q),

t=false;
if(s){
t=s.raised;}else{

h.raiseTab(q,false);
t=true;}


r.to_new_tab=!s;
r.to_raised_tab=!!t;},


_notify:function(q,r,s){
var t=i.get(q);
s.view_is_visible=t&&t.isVisible();
s.view_is_focused=t&&t.isFocused();
if(!s.view_is_visible)
o.log('message_to_hidden');


s.is_active=g.isActive();

l.messageReceived(r);},


newMessage:function(q,r){
k.isThreadID(q);


var s={thread_id:q,message_id:r.message_id};

this._raiseTab(q,s);
this._notify(q,r,s);

o.log('message',s);}};



l.subscribe('before-alert',function(q,event){
var r=event.threadID,

s=i.get(r),
t=h.getTab(r);
if(t&&t.raised&&s&&s.isVisible()&&s.isFocused()){



m.changeThreadReadStatus(r,true);
n.markThreadSeen(r);
event.cancelAlert();}});



e.exports=p;});

/** js/mercury/clients/chat/ChatTabPresence.js */
__d("ChatTabPresence",["AvailableList","ChatTabModel","MercuryThreads"],function(a,b,c,d,e,f){








var g=b('AvailableList'),
h=b('ChatTabModel'),
i=b('MercuryThreads').get(),

j={};

function k(l){
var m=i.getCanonicalUserInThread(l);
if(m)
g.updateForID(m);}





h.subscribe('chat/tabs-changed',function(event,l){
l.tabs.forEach(function(m){
if(m.raised&&!j[m.id])
k(m.id);});




j={};
l.tabs.forEach(function(m){
if(m.raised)
j[m.id]=true;});});




e.exports={};});

/** js/mercury/clients/chat/ChatTabPolicy.js */
__d("ChatTabPolicy",["ChatBehavior","MercuryConfig","FBDesktopPlugin","JSLogger","MercuryAssert","MercuryConstants","MercuryParticipants","MercuryThreadMuter","MercuryUnseenState","PresencePrivacy","ShortProfiles"],function(a,b,c,d,e,f){







var g=b('ChatBehavior'),
h=b('MercuryConfig'),
i=b('FBDesktopPlugin'),
j=b('JSLogger'),
k=b('MercuryAssert'),
l=b('MercuryConstants'),
m=b('MercuryParticipants'),
n=b('MercuryThreadMuter'),
o=b('MercuryUnseenState'),
p=b('PresencePrivacy'),
q=b('ShortProfiles'),

r=j.create('tab_policy');

function s(t,u){
o.markThreadSeen(t,u);}


e.exports=

{messageIsAllowed:function(t,u,v){
var w=t.thread_id,
x=u.message_id;

k.isThreadID(w);
k.isParticipantID(u.author);
var y;


if(h.MuteThreadsOnDesktopGK&&
n.isThreadMuted(t)){
y=
{thread_id:w,
message_id:x,
mute_settings:t.mute_settings};

r.log('message_thread_muted',y);
return;}



if(t.mode==
l.MercuryThreadMode.OBJECT_ORIGINATED){
y=
{thread_id:w,
message_id:x,
mode:t.mode};

r.log('message_object_originated',y);
return;}





var z=l.MercurySourceType;
if(u.source==z.EMAIL||
u.source==z.TITAN_EMAIL_REPLY){
y=
{thread_id:w,
message_id:x,
source:u.source};

r.log('message_source_not_allowed',y);
return;}



var aa=m.getUserID(u.author);
if(!aa){
r.log('message_bad_author',{thread_id:w,
message_id:x,
user:aa});
return;}



if(u.action_type!=
l.MercuryActionType.USER_GENERATED_MESSAGE){
y=
{thread_id:w,
message_id:x,
type:u.action_type};

r.log('message_non_user_generated',y);
return;}


if(t.is_canonical_user&&!g.notifiesUserMessages()){
r.log('message_jabber',{thread_id:w,
message_id:x});

s(w,true);
return;}


if(i.shouldSuppressMessages()){
r.log('message_desktop',{thread_id:w,
message_id:x});
return;}


if(t.folder!=l.MessagingTag.INBOX){
r.log('message_folder',{thread_id:w,
message_id:x,
folder:t.folder});
return;}


q.get(aa,function(ba){

if(!p.allows(aa)){
r.log('message_privacy',{thread_id:w,
message_id:x,
user:aa});
return;}




if(ba.type!='friend'){
r.log('message_non_friend',
{thread_id:w,
message_id:x,
user:aa});
return;}


v();});}};});

/** js/mercury/clients/chat/ChatTabViewSelector.js */
__d("ChatTabViewSelector",["Event","Arbiter","CSS","DataStore","DOM","Menu","MercuryThreadInformer","MercuryThreads","NubController","ChatTabTemplates","MercuryThreadMetadataRenderer","Toggler","copyProperties"],function(a,b,c,d,e,f){





var g=b('Event'),

h=b('Arbiter'),
i=b('CSS'),
j=b('DataStore'),
k=b('DOM'),
l=b('Menu'),
m=b('MercuryThreadInformer'),
n=b('MercuryThreads').get(),
o=b('NubController'),
p=b('ChatTabTemplates'),
q=b('MercuryThreadMetadataRenderer'),
r=b('Toggler'),

s=b('copyProperties');

function t(u){
var v=p[':fb:chat:tab:selector'].build(),
w=v.getRoot(),
x=v.getNode('menu'),
y=k.find(x,'.uiMenuInner'),
z={},
aa=new o().init(w);

i.hide(w);
k.insertBefore(u,w);

function ba(ea){
var fa=0;

for(var ga in z){
var ha=z[ga],
ia=n.getThreadMetaNow(ga),
ja=ha.getNode('unreadCount'),
ka=(ia&&ia.unread_count)||0;



fa+=ka;

if(ka>9)
ka='+';


i.conditionClass(ja,'invisible_elem',!ka);
k.setContent(ja,ka);}


var la=v.getNode('numMessages');
i.conditionShow(la,fa);
k.setContent(la,fa);}


this.setTabData=function(ea){
z={};

if(ea.length<1){
i.hide(w);
return;}


i.show(w);
k.empty(y);

ea.forEach(function(fa){
var ga=p[':fb:chat:tab:selector:item'].build();
z[fa.id]=ga;

var ha=ga.getNode('content');
q.renderAndSeparatedParticipantList(fa.id,ha);

k.prependContent(y,ga.getRoot());

j.set(ga.getRoot(),'threadID',fa.id);

var ia=ga.getNode('closeButton');
g.listen(ia,'click',function(event){
t.inform('selector/close-tab',fa.id);
event.kill();});});



aa.flyoutContentChanged();
k.setContent(v.getNode('numTabs'),ea.length);
ba();};


function ca(event,ea){
if(ea.menu!=x)
return;


var fa=j.get(ea.item,'threadID');
t.inform('selected',fa);
r.hide(w);}


function da(event,ea){
l.register(x);}


l.subscribe('select',ca.bind(this));
r.listen('show',w,function(){
h.inform('layer_shown',{type:'ChatTabSelector'});
da();});

r.listen('hide',w,function(){
h.inform('layer_hidden',{type:'ChatTabSelector'});});

m.subscribe('threads-updated',ba);}



s(t,new h());
e.exports=t;});

/** js/mercury/clients/chat/ChatTabController.js */
__d("ChatTabController",["ChatTabPresence","ChatTypeaheadBehavior","Arbiter","ChatActivity","ChatBehavior","ChatConfig","ChatNewMessageHandler","ChatTabMessagesView","ChatTabModel","ChatTabPolicy","ChatTabView","ChatTabViewSelector","JSLogger","MercuryParticipants","MercuryServerRequests","MercuryThreadInformer","MercuryThreads","MercuryUnseenState","Style","UserAgent","VideoCallCore"],function(a,b,c,d,e,f){









b('ChatTabPresence');
b('ChatTypeaheadBehavior');

var g=b('Arbiter'),
h=b('ChatActivity'),
i=b('ChatBehavior'),
j=b('ChatConfig'),
k=b('ChatNewMessageHandler'),
l=b('ChatTabMessagesView'),
m=b('ChatTabModel'),
n=b('ChatTabPolicy'),
o=b('ChatTabView'),
p=b('ChatTabViewSelector'),
q=b('JSLogger'),
r=b('MercuryParticipants'),
s=b('MercuryServerRequests'),
t=b('MercuryThreadInformer'),
u=b('MercuryThreads').get(),
v=b('MercuryUnseenState'),
w=b('Style'),
x=b('UserAgent'),
y=b('VideoCallCore'),

z=j.get('tab_auto_close_timeout')||7200000,

aa=q.create('tab_controller');

function ba(la){
u.changeThreadReadStatus(la,true);
ca(la);}


function ca(la){
v.markThreadSeen(la);}




function da(){
var la=m.get();
la.tabs.forEach(function(ma){
if(ma.raised||i.showsTabUnreadUI())
ca(ma.id);});}









function ea(la,ma,na){
var oa=m.get().tabs;

la+=ma?1:-1;
while(la>=0&&la<oa.length){
var pa=oa[la],
qa=o.get(pa.id);

if(qa&&qa.isVisible()&&(!na||pa.raised)){
qa.focus();
return true;}


la+=ma?1:-1;}


return false;}


function fa(la){




function ma(pa){
var qa=la.shouldPromoteOnRaise(pa);
g.inform("chat/promote-tab",pa);

if(qa){
m.raiseAndPromoteTab(pa,true);}else 

m.raiseTab(pa,true);


var ra=o.get(pa);
ra&&ra.focus();}


function na(pa,qa){
var ra=la.getMaxTabsToShow(),
sa=m.indexOf(pa);





m.closeTabAndDemote(pa,ra-2,qa);
return sa;}


p.subscribe('selected',function(pa,qa){
ma(qa);});


g.subscribe('chat/open-tab',function(pa,qa){
ma(qa.thread_id);});


g.subscribe('page_transition',function(pa,qa){
m.closeFragileTabs();});


s.subscribe('model-update-completed',da);

o.subscribe('focused',function(event,pa){
ba(pa);});


h.subscribe('idle',function(pa,qa){
if(qa>z){

var ra=m.get().tabs;
ra.forEach(function(sa){
var ta=sa.id;
u.getThreadMeta(ta,function(ua){
if(!ua.unread_count){
aa.log('autoclose_idle_seen',
{thread_id:ta,idleness:qa});
m.closeTab(ta,'autoclose_idle_seen');}});});}});






o.subscribe('nub-activated',function(pa,qa){
ma(qa);});


o.subscribe('lower-activated',function(pa,qa){
m.lowerTab(qa);
var ra=o.get(qa);
ra&&ra.focus();});


function oa(pa,qa){
y.showOutgoingCallDialog(qa.userID,qa.clickSource);
m.lowerTab(qa.threadID);}


o.subscribe('video-call-clicked',oa);
l.subscribe('video-call-clicked',oa);

o.subscribe
('closed-tab',
function(pa,qa){
aa.log('close_view',{thread_id:qa});
na(qa,'close_view');
return false;});



o.subscribe
('thread-deleted',
function(pa,qa){
aa.log('close_thread_deleted',{thread_id:qa});
na(qa,'close_thread_deleted');
return false;});



o.subscribe
('unsubscribed',
function(pa,qa){
aa.log('close_view_unsubscribed',{thread_id:qa});
na(qa,'close_view_unsubscribed');
return false;});



o.subscribe('esc-pressed',function(pa,qa){
aa.log('close_esc',{thread_id:qa});
var ra=na(qa,'close_esc');



(function(){
ea(ra-1,true,true)||ea(ra,false,true);}).
defer();});

p.subscribe
('selector/close-tab',
function(pa,qa){
aa.log('close_chat_from_selector',{thread_id:qa});
na(qa,'close_chat_from_selector');});


t.subscribe('messages-received',function(pa,qa){
for(var ra in qa){
var sa=qa[ra];

for(var ta=0;ta<sa.length;ta++){
var ua=sa[ta];


if(ua.author!=r.user){
if(!ua.is_unread){
aa.log('message_already_read',
{action_id:ua.action_id,
thread_id:ua.thread_id});
continue;}


u.getThreadMeta(ra,function(va){
n.messageIsAllowed
(va,
ua,
function(){
k.newMessage(ra,ua);});});}}}});







t.subscribe('thread-read-changed',function(pa,qa){
for(var ra in qa)
if(!qa[ra].mark_as_read){
aa.log('autoclose_marked_unread',{thread_id:ra});
m.closeTab(ra,'autoclose_marked_unread');}});




o.subscribe('tab-pressed',function(pa,qa){


return !ea(m.indexOf(qa.id),qa.shiftPressed);});


g.subscribe(q.DUMP_EVENT,function(pa,qa){
qa.chat_controller=
{auto_close_timeout:z};});}












if(x.firefox()){

var ga=function(){
return w.get(document.body,'overflowX')+' '+
w.get(document.body,'overflowY');},

ha=ga(),
ia=function(){


var la=ga();
if(la!==ha){
ha=la;
g.inform('overflow-applied-to-body');}};





if('MutationObserver' in window){
var ja=new MutationObserver(ia),
ka={attributes:true,attributeFilter:['class','style']};
ja.observe(document.documentElement,ka);}else 


document.documentElement.addEventListener('DOMAttrModified',
function(event){
if(event.getTarget()===document.documentElement&&
(event.attrName==='class'||event.attrName==='style'))
ia();},

false);}



e.exports=fa;});

/** js/mercury/clients/chat/ChatTabViewCoordinator.js */
__d("ChatTabViewCoordinator",["Arbiter","ChatTabModel","ChatTabView","ChatTabViewSelector","CSS","VideoCallCore"],function(a,b,c,d,e,f){





var g=b('Arbiter'),
h=b('ChatTabModel'),
i=b('ChatTabView'),
j=b('ChatTabViewSelector'),
k=b('CSS'),
l=b('VideoCallCore');

function m(n,o){
var p=new j(n),
q={},
r=false;

function s(){
var x=h.get(),

y={};
x.tabs.forEach(function(aa){
y[aa.id]=1;});



for(var z in q)
if(!y[z]){
q[z].destroy();
delete(q[z]);}




t(x);

u(x);}






function t(x){
var y=null;

x.tabs.forEach(function(z){
var aa=z.id,
ba=false;


if(!q[aa]){
q[aa]=new i(aa,z.server_id);
ba=true;}




if(ba||!q[aa].nextTabIs(y))
if(y){

q[aa].insertBefore(y);}else 


q[aa].appendTo(n);



y=q[aa];});}



function u(x){
var y=o.getTabsToShow(x),




z=[],
aa=false;
x.tabs.forEach(function(ba){
if(!y[ba.id]){
q[ba.id].setVisibleState(false,ba.raised);
z.push(ba);}});


x.tabs.forEach(function(ba){
if(y[ba.id]){
q[ba.id].setVisibleState(true,ba.raised);
aa|=ba.raised;}});



p.setTabData(z);

w(aa);}


function v(x){
for(var y=0,z=x.tabs.length;y<z;y++){
var aa=x.tabs[y];
if(aa.raised)
if(aa.id===x.promoted||
y<o.getMaxTabsToShow()-1)
return true;}



return false;}













function w(x){
if(!x&&r){
g.inform('layer_hidden',{type:'ChatTab'});
r=false;}else
if(x&&!r){
g.inform('layer_shown',{type:'ChatTab'});
r=true;}}





if(l.isSupported())
k.addClass(n,'videoCallEnabled');


o.subscribe('tabs-changed',s);

s();}


e.exports=m;});

/** js/mercury/clients/chat/TabsViewport.js */
__d("TabsViewport",["Event","ArbiterMixin","ChatTabModel","Dock","Parent","Vector","areObjectsEqual","copyProperties"],function(a,b,c,d,e,f){






var g=b('Event'),

h=b('ArbiterMixin'),
i=b('ChatTabModel'),
j=b('Dock'),
k=b('Parent'),
l=b('Vector'),

m=b('areObjectsEqual'),
n=b('copyProperties');

function o(p){
this._root=p;

g.listen(window,'resize',this._recalculateWidth.bind(this));
j.subscribe('resize',this._recalculateWidth.bind(this));

i.subscribe
('chat/tabs-changed',
this._recalculateTabs.shield(this,true));


this._recalculateWidth();
this._initialized=true;}






n(o.prototype,h,

{_root:null,
_initialized:false,
_availableWidth:0,
_maxShown:1,
_viewState:null,

_recalculateWidth:function(){
var p=o._getAvailableDockWidth(this._root),

q=Math.max(1,Math.floor(p/264)),
r=q!=this._maxShown;

if(!this._viewState||
r||
p<=this._viewState.usedWidth||
p>this._viewState.widthToShowNext){
this._availableWidth=p;
this._maxShown=q;
this._viewState=null;

this._recalculateTabs(r);}},



_onTabsChanged:function(){
if(this._initialized){
this.inform('tabs-changed');
this.inform('max-to-show-changed',this._maxShown);
this.inform('max-to-show-change-completed');}},



_recalculateTabs:function(p){
var q=
o._getTabsToShow(i.get(),this._availableWidth);

if(p||!m(this._viewState,q)){
this._viewState=q;

this._onTabsChanged();}},



getMaxTabsToShow:function(){
return this._maxShown;},


checkWidth:function(){
this._recalculateWidth();},


getTabsToShow:function(){
return JSON.parse(JSON.stringify(this._viewState.tabsToShow));},






shouldPromoteOnRaise:function(p){
if(!this._viewState.tabsToShow[p])

return true;


if(this._viewState.nextToHide!=p)

return false;


var q=i.getTab(p),
r=q&&q.raised;
return !r&&
(this._availableWidth-this._viewState.usedWidth<100);}});



n(o,







{_getAvailableDockWidth:function(p){
var q=l.getViewportDimensions().x;


q-=230;


q-=50;


var r=k.byClass(p,'fbDock'),
s=l.getElementDimensions(r),
t=k.byClass(p,'fbDockChat'),
u=l.getElementDimensions(t),
v=s.x-u.x;
q-=v;


q-=20;

return Math.max(q,0);},


















_getTabsToShow:function(p,q){
var r=164,
s=264;

q=Math.max(q,s+1);

function t(ia){
return ia.raised?s:r;}


var u=JSON.parse(JSON.stringify(p.tabs)),

v=-1,
w=null;
if(p.promoted)
u.forEach(function(ia,ja){
if(ia.id===p.promoted){
v=ja;
w=ia;}});






var x=0,
y=0,
z=!w;
u.forEach(function(ia,ja){
var ka=t(ia);
ia.leftmostOffset=x+s;
x+=ka;

if(ia.leftmostOffset<q)
y++;


z|=ja==v;
ia.alreadyPlacedPromoted=z;});


function aa(ia,ja,ka){
var la={};
for(var ma=0;ma<ja;ma++){
var na=ia[ma];
if(!na.alreadyPlacedPromoted&&ma==ja-1){

la[ka]=true;}else 

la[na.id]=true;}


return la;}


var ba=aa(u,y,p.promoted),

ca=
aa(u,y-1,p.promoted),
da=null;
for(var ea in ba)
if(!ca[ea])
da=ea;



var fa=u[y-1],
ga=fa?fa.leftmostOffset:0,


ha=Infinity;
if(y<u.length)
ha=u[y].leftmostOffset;



return {nextToHide:da,
tabsToShow:ba,
usedWidth:ga,
widthToShowNext:ha};}});





e.exports=o;});

/** js/modules/linkshim/LinkshimHandler.js */
__d("LinkshimHandler",["Event","LinkshimAsyncLink","URI","LinkshimHandlerConfig"],function(a,b,c,d,e,f){



var g=b('Event'),
h=b('LinkshimAsyncLink'),
i=b('URI'),

j=b('LinkshimHandlerConfig'),

k=
{setUpLinkshimHandling:function(q){
var r=i(q.getAttribute('href')),
s=l(r);
if(s&&m(r)){
g.listen
(q,
'mouseover',
h.swap.shield(null,q,s));





var t=o(r);
g.listen
(q,
'click',
function(){
if(j.supports_meta_referrer){
h.referrer_log
(q,
t,
n(r).toString());}else 


h.swap(q,r);});}}};







function l(q){
return q.getQueryData().u?
new i(q.getQueryData().u):
null;}


function m(q){
return q.getQueryData().hasOwnProperty('s');}


function n(q){
return i('/si/ajax/l/render_linkshim_log/').
setSubdomain('www').
setQueryData(q.getQueryData());}


function o(q){
var r;
if(p()){
r=i(q).addQueryData({render_verification:true});}else 

r=l(q);


return r;}


function p(){
var q=j.render_verification_rate||0;
return Math.floor(Math.random()*q+1)===q;}


e.exports=k;});
