/*1358153967,178142491*/

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

/** js/ads/ui/boosted_posts/BoostedPostLogging.js */
__d("BoostedPostLogging",["EagleEye","AsyncRequest"],function(a,b,c,d,e,f){



var g=b('EagleEye'),
h=b('AsyncRequest'),

i=
{log:function(j,k){
k.event=j;
g.log('roe',k);},


logClickConversionTracking:function(j,k,l,m){
var n=
{page_id:j};

if(k)
n.post_id=k;

if(l)
n.campaign_id=l;

if(m)
n.campaign_placement=m;

new h('/ads/ajax/boosted/convtrack.php').
setData(n).
send();}};



e.exports=i;});

/** js/ads/ui/boosted_posts/PromotedPostConstants.js */
__d("PromotedPostConstants",[],function(a,b,c,d,e,f){



var g=




{SAVE:'boosted_post/save',
CANCEL:'boosted_post/cancel',
FLYOUT_SHOW:'promoted_post/flyout_show',
FLYOUT_HIDE:'promoted_post/flyout_hide',


CLOSE:'boosted_post/close',
SET_BUDGET:'boosted_post/set_budget',


STOP:'boosted_post/stop',
RESUME:'boosted_post/resume',


ACCOUNT_CHANGE:'boosted_post/account_change',
PAY_FOR_PROMOTION:'boosted_post/pay_for_promotion',


AUTOPROMOTE_CHANGE:'boosted_post/autopromote_change',


FOC_CHANGE:'boosted_post/foc_change',
DURATION_CHANGE:'boosted_post/duration_change'};


e.exports=g;});

/** js/ads/ui/boosted_posts/BoostedPostPostWidget.js */
__d("BoostedPostPostWidget",["Event","Arbiter","ArbiterMixin","AsyncRequest","CSS","DOM","DOMScroll","DOMQuery","BoostedPostLogging","PromotedPostConstants","copyProperties"],function(a,b,c,d,e,f){



var g=b('Event'),

h=b('Arbiter'),
i=b('ArbiterMixin'),
j=b('AsyncRequest'),
k=b('CSS'),
l=b('DOM'),
m=b('DOMScroll'),
n=b('DOMQuery'),

o=b('BoostedPostLogging'),
p=b('PromotedPostConstants'),

q=b('copyProperties'),

r={},
s=0;

function t
(u,
v,
w,
x,
y,
z,
aa,
ba,
ca,
da,
ea,
fa){
this._popover=u;
this._popoverButton=v;
this._loadingMenu=w;
this._pageId=x;
this._postId=y;
this._isBoosted=z;
this._campaignId=aa;
this._campaignPlacement=ba;
this._createLogWaitingForFlyout=false;
this._placement=fa;

this._instanceId=s++;
r[this._instanceId]=this;

this._flyout=ea;
this._statusThrobber=null;

this._autoOpenPopover=ca;
this._additionalLoggingData=da;

this._initialize();}


t.setFlyout=function(u,v,
w){
r[u].setFlyout(v,w);};


q(t.prototype,i,
{_fetched:false,
_mouseoverListener:null,
_firstClickListener:null,

_initialize:function(){
this.loggingData=
{page_id:this._pageId,
post_id:this._postId};



if(this._flyout){
this._setFlyoutInstance(this._flyout);}else 

this._mouseoverListener=
g.listen
(this._popoverButton,
'mouseover',
this._fetchFlyout.bind(this));


this._firstClickListener=
g.listen
(this._popoverButton,
'click',
this._onFirstClick.bind(this));

this._popover.subscribe('show',function(){
h.inform(p.FLYOUT_SHOW);
if(this._autoOpenPopover)
return;




if(!this._flyout&&!this._isBoosted){
this._createLogWaitingForFlyout=true;
return;}

this._logOnFlyoutOpen();}.
bind(this));

this._popover.subscribe('hide',function(){
h.inform(p.FLYOUT_HIDE);
this.inform(p.FLYOUT_HIDE);}.
bind(this));

this._maybeAutoOpen();},


_fromComposerAutoOpen:function(){

var u=false;
h.subscribe
('TimelineComposer/on_after_publish',
function(v,w){
if(!n.contains(w,this._popoverButton))
return;


if(u)
return;

u=true;

var x=false;
this._popover.subscribe
('show',
function(){
if(x)
return;

x=true;

m.ensureVisible
(this._flyout.getRoot(),
null,
25,
750);}.

bind(this),
h.SUBSCIBE_NEW);


this._popover.showLayer();}.
bind(this));},



_maybeAutoOpen:function(){
if(!this._autoOpenPopover)
return;


if(this._placement=='from_composer'){
this._fromComposerAutoOpen();
return;}


if(this._placement=='permalink'){
this.loggingData.campaign_id=this._campaignId;
this.loggingData.budget_remaining=
this._additionalLoggingData.budget_remaining;
o.log
('clicked_after_budget_notification',
this.loggingData);}


this._popoverButton.click();
m.scrollTo(this._popoverButton,1000);},


_createListener:function(u,v){
this._showThrobberAndDisableFlyoutButtons();

this.loggingData.budget=v.formData.boosted_post_budget;
o.log('timeline_create_save',this.loggingData);
new j('/ads/ajax/boosted/edit.php').
setData
({status:true,
account_id:v.formData.boosted_post_account_id,
budget:v.formData.boosted_post_budget,
campaign_length:v.formData.boosted_post_campaign_length,
currency:v.formData.boosted_post_currency,
foc_enabled:v.formData.boosted_post_enable_foc,
page_id:this._pageId,
post_id:this._postId}).
setMethod('POST').
setHandler(this._changeStatusHandler.bind(this)).
send();},


_stopLinkListener:function(u,v){
if(v===this._flyout._flyout.id){
o.log('timeline_stop_boosting',this.loggingData);
this._changeStatus(false);}},



_resumeLinkListener:function(u,v){
if(v===this._flyout._flyout.id){
o.log('timeline_resume_boosting',this.loggingData);
this._changeStatus(true);}},



_cancelButtonListener:function(u,v){
this._popover.hideLayer();},


_setBudgetListener:function(u,v){
this._changeStatusHandler(v);},


_payForPromotionListener:function(u,v){
this._showThrobberAndDisableFlyoutButtons();

new j('/ads/ajax/boosted/edit.php').
setData
({page_id:this._pageId,
post_id:this._postId,
account_id:this._flyout.getAccountID(),
create_ads:true}).

setMethod('POST').
setHandler(this._changeStatusHandler.bind(this)).
send();},


_showThrobberAndDisableFlyoutButtons:function(){
this._statusThrobber&&k.show(this._statusThrobber);


this._flyout.setButtonsEnabled(false);},


_changeStatus:function(u){
this._statusThrobber&&k.show(this._statusThrobber);
new j('/ads/ajax/boosted/edit.php').
setData
({status:u,
page_id:this._pageId,
post_id:this._postId}).
setMethod('POST').
setHandler(this._changeStatusHandler.bind(this)).
send();},


_initializeFlyoutListeners:function(){
this._flyout.subscribe(p.SAVE,
this._createListener.bind(this));
this._flyout.subscribe(p.CANCEL,
this._cancelButtonListener.bind(this));

h.subscribe(p.STOP,
this._stopLinkListener.bind(this));
h.subscribe(p.RESUME,
this._resumeLinkListener.bind(this));

this._flyout.subscribe(p.CLOSE,
this._cancelButtonListener.bind(this));
this._flyout.subscribe(p.SET_BUDGET,
this._setBudgetListener.bind(this));
this._flyout.subscribe(p.PAY_FOR_PROMOTION,
this._payForPromotionListener.bind(this));},


_onFirstClick:function(){
if(this._firstClickListener){
this._firstClickListener.remove();
this._firstClickListener=null;}


if(!this._flyout){
this._popover.setLayerContent(this._loadingMenu.getRoot());
this._fetchFlyout();}


if(!this._isBoosted&&!this._autoOpenPopover)
o.logClickConversionTracking
(this._pageId,
this._postId,
this._campaignId,
this._campaignPlacement);},




_fetchFlyout:function(){
if(this._fetched)
return;


new j('/ads/ajax/boosted/post_widget.php').
setData
({pmid:this._instanceId,
page_id:this._pageId,
post_id:this._postId}).

send();
this._fetched=true;

if(this._mouseoverListener){
this._mouseoverListener.remove();
this._mouseoverListener=null;}},



_changeStatusHandler:function(u){


this._popover.hideLayer();
l.empty(this._flyout);
l.replace(this._popoverButton,u.payload);
this._popoverButton=u.payload;},





_setFlyoutInstance:function(u){
this._flyout=u;
this._initializeFlyoutListeners();
this._popover.subscribe
('init',
function(){
var v=this._popover.getLayer().getRoot();
this._statusThrobber=l.scry(v,'.statusThrobber')[0];}.
bind(this));




if(this._createLogWaitingForFlyout){
this._logOnFlyoutOpen();
this._createLogWaitingForFlyout=false;}},



setFlyout:function(u,v){
this._popover.setLayerContent(u);
this._setFlyoutInstance(v);},


_logOnFlyoutOpen:function(){
var u=!this._isBoosted?
'timeline_create_flyout_open':
'timeline_edit_flyout_open';

if(!this._isBoosted)
this.loggingData.has_credit_card=
this._flyout.userHasPaymentInfo();

o.log(u,this.loggingData);}});



e.exports=t;});

/** js/insights/ui/post_insights_flyout.js */
__d("PostInsightsFlyout",["Event","AsyncRequest","copyProperties","HoverFlyout"],function(a,b,c,d,e,f){



var g=b('Event'),

h=b('AsyncRequest'),
i=b('copyProperties'),
j=b('HoverFlyout'),

k={},

l=200;

function m
(n,
o,
p){

this._pageID=n;
this._postID=o;
this._node=p;

this._pending=false;
this._mouseOn=false;
this._flyout=null;

this._mouseEnterListener=g.listen
(this._node,
'mouseenter',
this._fetchFlyout.bind(this));

this._mouseLeaveListener=g.listen
(this._node,
'mouseleave',
this._onMouseLeave.bind(this));


k[this._postID]=this;}


i(m,

{setFlyout:function(n,o){
this._pending=false;
var p=k[n];
p&&p.onFlyoutSet(o);}});



i(m.prototype,

{_fetchFlyout:function(){
this._mouseOn=true;
if(this._pending||this._flyout)
return;

this._pending=true;
var n=
{context_id:this._node.id,
page_id:this._pageID,
post_id:this._postID};

new h().
setURI('/insights/ajax/post_insights_widget.php').
setData(n).
send();},


_onMouseLeave:function(){
this._mouseOn=false;},


onFlyoutSet:function(n){
if(!this._flyout){
this._mouseEnterListener&&this._mouseEnterListener.remove();
this._mouseLeaveListener&&this._mouseLeaveListener.remove();
this._flyout=new j
(n,
this._node,
l,
l);

if(this._mouseOn)

this._flyout.showFlyout(this._node,true);}}});






e.exports=m;});

/** js/messaging/modules/Messaging.js */
__d("Messaging",["AsyncRequest","DOM","Env","HTML","MercuryEmoji","MessagingEvents","URI","createArrayFrom","emptyFunction"],function(a,b,c,d,e,f){



var g=b('AsyncRequest'),
h=b('DOM'),
i=b('Env'),
j=b('HTML'),
k=b('MercuryEmoji'),
l=b('MessagingEvents'),
m=b('URI'),

n=b('createArrayFrom'),
o=b('emptyFunction');

function p(r,s){
if(!h.isTextNode(r)){
var t=n(r.childNodes);
for(var u=0;u<t.length;u++)
p(t[u],s);

return;}


var v=r.nodeValue;

if(s)
v=r.nodeValue.replace(/\n/g,' ');


var w=k.htmlEmojiAndEmote(v);
if(!w||w==r.nodeValue)
return;


var x=j(w).getNodes();
if(!x||!x.length)
return;


for(var y=x.length;y--;)
h.insertAfter(r,x[y]);


h.remove(r);}


var q=






{getUserThreadURI:function(r){
return m(i.www_base).setPath('/messages/'+r);},







getInboxThreadURI:function(r){
return m(i.www_base).
setPath('/messages/?action=read&tid='+r);},






markAsRead:function(r){
r=n(r);

new g().
setURI('/ajax/messaging/async.php').
setData({action:'markRead',tids:r}).
setMethod('POST').
setHandler(o).
setErrorHandler(o).
send();

l.inform('mark-as-read',{tids:r});},






markUserThreadAsRead:function(r){
new g().
setURI('/ajax/messaging/async.php').
setData({action:'chatMarkRead',other_user:r}).
setMethod('POST').
setHandler(o).
setErrorHandler(o).
send();

l.inform('mark-as-read',{chat_ids:[r]});},







unsubscribeFromThread:function(r){
new g().
setURI('/ajax/messaging/async.php').
setData({action:'unsubscribe',tids:r}).
setMethod('POST').
setHandler(o).
setErrorHandler(o).
send();},






emojiAndEmoteContent:function(r,s){
for(var t=0;t<r.length;t++)
p(r[t],s);}};




e.exports=q;});

/** js/messaging/Messaging.js */
__d("legacy:Messaging",["Messaging"],function(a,b,c,d){



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

3);

/** js/modules/MenuXSeparator.js */
__d("MenuXSeparator",["Class","copyProperties","DOM","MenuXItemInterface"],function(a,b,c,d,e,f){




var g=b('Class'),
h=b('copyProperties'),
i=b('DOM'),
j=b('MenuXItemInterface');

function k(l){
this.parent.construct(this,l);
this._data=l;}


g.extend(k,j);

h(k.prototype,
{render:function(){
var l='uiMenuXSeparator';
if(this._data.className)
l+=' '+this._data.className;

return i.create('li',{className:l,role:'separator'});}});



e.exports=k;});

/** js/pages/admin_tip/InlineFriendInviter.js */
__d("InlineFriendInviter",["Event","AsyncRequest","CSS","$","DOM","DataStore","ge"],function(a,b,c,d,e,f){




var g=b('Event'),
h=b('AsyncRequest'),
i=b('CSS'),
j=b('$'),
k=b('DOM'),
l=b('DataStore'),
m=b('ge'),

n=

{sendInvite:function(o,p,q,r){
new h().
setURI('/ajax/pages/invite/send_single/').
setData
({page_id:o,
invitee:p,
elem_id:q,
action:r}).

send();
i.addClass(q,'yellow');
i.hide(k.find(j(q),'.button'));},

setupScrollEvents:function(o,p){
var q=k.find(o,'div.uiScrollableAreaWrap');
g.listen(q,'scroll',function(event){
this.onScrollEvent(o,p);}.
bind(this));},

onScrollEvent:function(o,p){

var q=l.get(o,'ScrollableArea');


if(q&&
!q.requestPending&&
!q.noMoreResults&&
q.isScrolledToBottom()){
q.requestPending=true;

var r=m(o,'.uiMorePager'),
s=k.find(o,'.inlineFriendInviterList'),
t=s.getAttribute('meta');

new h().
setURI('/ajax/pages/invite/get.php').
setData
({pageID:p,
offset:t}).

setStatusElement(r).
setHandler(this.onRequestFinished.bind(this,o)).
setErrorHandler(this.onRequestFinished.bind(this,o)).
send();}},


onRequestFinished:function(o,p){
var q=l.get(o,'ScrollableArea');
q.requestPending=false;

var r=p.getPayload();
q.noMoreResults=r.noMoreResults;

if(r.offset){
var s=k.find(o,'.inlineFriendInviterList');
s.setAttribute('meta',r.offset);}}};




e.exports=n;});

/** js/pages/timeline/anchor_dialog.js */
__d("PagesAnchorDialogEnforcer",["array-extensions","Event","AsyncRequest","Button","DOM","URI"],function(a,b,c,d,e,f){



b('array-extensions');
var g=b('Event'),

h=b('AsyncRequest'),
i=b('Button'),
j=b('DOM'),
k=b('URI'),


l=

{LOCATION_COMPOSER:1,
LOCATION_MILESTONE:2,
LOCATION_SPINE:3,
LOCATION_EDIT_MENU:4,
LOCATION_HIDE_JOINED:5},


m=[];

function n(t,u,v){
var w=j.find(document,t);
o(w,u,v);}


function o(t,u,v){


m.push
(g.listen(t,'click',function(w){
new h().
setURI('/ajax/timeline/pages/anchor_dialog.php').
setData
({profile_id:u,
location:v}).

send();
return false;},
g.Priority.URGENT));}



function p(t){
t.subscribe('changed',function(){
i.setEnabled
(j.find(document,'label.anchorDialogSaveButton'),
'year' in t.getValues());});}




function q(t,u){
r();
switch(u){
case l.LOCATION_COMPOSER:

case l.LOCATION_MILESTONE:
case l.LOCATION_SPINE:
case l.LOCATION_EDIT_MENU:
case l.LOCATION_HIDE_JOINED:
k.getRequestURI().go();
break;




default:}}


function r(){
m.forEach(function(t){t.remove();});
m=[];}


var s=
{enforceDialogOnNode:o,
enforceDialogOnSelector:n,
enableSaveButtonOnDateChanged:p,
onSuccessForLocation:q};

e.exports=s;});

/** js/profile/edit/HubsTypeaheadView.js */
__d("HubsTypeaheadView",["Class","ContextualTypeaheadView","copyProperties"],function(a,b,c,d,e,f){







var g=b('Class'),
h=b('ContextualTypeaheadView'),
i=b('copyProperties');

function j(k,l){
this.parent.construct(this,k,l);}


g.extend(j,h);

i(j.prototype,





{render:function(k,l,m){
if(this.alwaysRender&&k!=='')
if(this.allowFreeformEntry){
l.push
({uid:'0',
text:k,
type:'calltoaction'});}else{



var n=k.toLowerCase().trim(),
o=false;

for(var p=0;p<l.length;p++)
if(n==l[p].text.toLowerCase()){
o=true;
break;}



if(!o)
l.push
({text:k,
type:'calltoaction'});}





return this.parent.render(k,l,m);}});




e.exports=j;});

/** js/ui/xhp/typeahead/behaviors/TypeaheadPreventSubmitOnEnter.js */
__d("TypeaheadPreventSubmitOnEnter",["Event","Keys","copyProperties"],function(a,b,c,d,e,f){



var g=b('Event'),
h=b('Keys'),
i=b('copyProperties');

function j(k){
this._typeahead=k;}


i(j.prototype,
{_listener:null,

enable:function(){
var k=this._typeahead.getCore().getElement();
this._listener=g.listen(k,'keypress',function(l){
if(g.getKeyCode(l)==h.RETURN)
l.kill();});},




disable:function(){
this._listener.remove();
this._listener=null;}});




e.exports=j;});

/** js/ui/xhp/typeahead/behaviors/LegacyPreventSubmitOnEnterTypeaheadBehavior.js */
__d("legacy:PreventSubmitOnEnterTypeaheadBehavior",["TypeaheadPreventSubmitOnEnter"],function(a,b,c,d){



var e=b('TypeaheadPreventSubmitOnEnter');

if(!a.TypeaheadBehaviors)a.TypeaheadBehaviors={};
a.TypeaheadBehaviors.preventSubmitOnEnter=function(f){
f.enableBehavior(e);};},


3);

/** js/ui/xhp/typeahead/behaviors/TypeaheadSetPhotoOnSelect.js */
__d("TypeaheadSetPhotoOnSelect",["Event","function-extensions","CSS","DOM","copyProperties"],function(a,b,c,d,e,f){



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

var h=b('CSS'),
i=b('DOM'),

j=b('copyProperties');

function k(l){
this._typeahead=l;}


j(k.prototype,
{_eventListener:null,
_subscription:null,

enable:function(){
var l=i.scry(this._typeahead.getElement(),'.photo')[0];
if(l){


if(!i.isNodeOfType(l,'img')){
var m=i.create('img',{className:l.className});
i.replace(l,m);
l=m;}


var n=h.hide.curry(l),
o=h.show.curry(l);

this._eventListener=g.listen
(l,
{load:o,error:n,abort:n});

this._subscription=
this._typeahead.subscribe('select',function(p,q){
var r=q.selected.photo||this._typeahead.view.fallbackPhoto;
r?l.setAttribute('src',r):n();}.
bind(this));}},



disable:function(){
this._eventListener.remove();
this._eventListener=null;
this._typeahead.unsubscribe(this._subscription);
this._subscription=null;}});




e.exports=k;});

/** js/ui/xhp/typeahead/behaviors/LegacySetPhotoOnSelectTypeaheadBehavior.js */
__d("legacy:SetPhotoOnSelectTypeaheadBehavior",["TypeaheadSetPhotoOnSelect"],function(a,b,c,d){



var e=b('TypeaheadSetPhotoOnSelect');

if(!a.TypeaheadBehaviors)a.TypeaheadBehaviors={};
a.TypeaheadBehaviors.setPhotoOnSelect=function(f){
f.enableBehavior(e);};},


3);
