/*1358552216,173217629*/

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

/** js/modules/FullScreen.js */
__d("FullScreen",["Event","Arbiter","CSS","UserAgent","copyProperties","throttle"],function(a,b,c,d,e,f){




var g=b('Event'),

h=b('Arbiter'),
i=b('CSS'),
j=b('UserAgent'),

k=b('copyProperties'),
l=b('throttle'),

m=k(new h(),
{listenForEvent:function(n){
var o=l(this.onChange,0,this);
g.listen
(n,

{webkitfullscreenchange:o,
mozfullscreenchange:o,
fullscreenchange:o});






g.listen
(document,

{webkitfullscreenchange:o,
mozfullscreenchange:o,
fullscreenchange:o});},




enableFullScreen:function(n){
this.listenForEvent(n);
if(n.webkitRequestFullScreen){

if(j.chrome()){
n.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);}else 

n.webkitRequestFullScreen();}else

if(n.mozRequestFullScreen){

n.mozRequestFullScreen();}else
if(n.requestFullScreen){

n.requestFullScreen();}else 


return false;


return true;},


disableFullScreen:function(){
if(document.webkitCancelFullScreen){
document.webkitCancelFullScreen();}else
if(document.mozCancelFullScreen){
document.mozCancelFullScreen();}else
if(document.cancelFullScreen){
document.cancelFullScreen();}else
if(document.exitFullScreen){
document.exitFullScreen();}else 

return false;

return true;},


isFullScreen:function(){
return (document.webkitIsFullScreen||
document.fullScreen||
document.mozFullScreen);},






toggleFullScreen:function(n){
if(this.isFullScreen()){
this.disableFullScreen();
return false;}else 

return this.enableFullScreen(n);

return false;},


onChange:function(){
var n=this.isFullScreen();
i.conditionClass(document.body,'fullScreen',n);
this.inform('changed');},


isSupported:function(){
return (document.webkitCancelFullScreen&&j.chrome())||
document.mozCancelFullScreen||
document.cancelFullScreen||
document.exitFullScreen;}});



e.exports=m;});

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



var g=b('UserAgent'),





























































h=





{hasLoaded:function(i){

if(i.naturalWidth!==undefined){

return i.complete&&i.width!==0;}else
if(i.height==20&&i.width==20&&i.complete){

return false;}else
if(i.complete===undefined&&g.webkit()<500){


var j=new Image();
j.src=i.src;
return j.complete;}

return i.complete;}};




e.exports=h;});

/** js/photos/album/PhotoMultiPhotosThumb.js */
__d("PhotoMultiPhotosThumb",["Event","function-extensions","Style"],function(a,b,c,d,e,f){



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

var h=b('Style'),

i=1200,

j=
{init:function(k,l){
var m=null,
n=0;

function o(q){
n=q;
l.forEach(function(r,s){
h.set(r,'opacity',s===q?1:0);});}



function p(){
o((n+1)%l.length);
m=p.defer(i);}


g.listen(k,'mouseenter',function(){
if(m)
return;



n=0;
p();});


g.listen(k,'mouseleave',function(){
o(0);
window.clearTimeout(m);
m=null;});}};




e.exports=j;});

/** js/photos/modules/PhotoEverstoreLogger.js */
__d("PhotoEverstoreLogger",["Event","AsyncRequest","copyProperties","ImageUtils"],function(a,b,c,d,e,f){






var g=b('Event'),
h=b('AsyncRequest'),
i=b('copyProperties'),
j=b('ImageUtils'),



k=

{BATCH_WINDOW_MS:500,

storedLog:[]};


function l(){}

i(l,







{_log:function(n){
k.storedLog.push(n);

if(k.storedLog.length==1)
setTimeout(m,k.BATCH_WINDOW_MS,false);},













logImmediately:function(n){
l._log(n);},









registerForLogging:function(n){
if(j.hasLoaded(n)){
l._log(n.src);}else 

g.listen
(n,
'load',
function(event){
l._log(n.src);});}});






function m(){
var n=k.storedLog;
k.storedLog=[];

var o=JSON.stringify(n);
new h().
setURI('/ajax/photos/logging/everstore_logging.php').
setData({loggedUrls:o}).
setMethod('POST').
setOption('suppressErrorHandlerWarning',true).
setOption('suppressErrorAlerts',true).
send();}


e.exports=l;});

/** js/photos/modules/PhotoSessionLog.js */
__d("PhotoSessionLog",["AsyncRequest","Run","Vector","copyProperties"],function(a,b,c,d,e,f){



var g=b('AsyncRequest'),
h=b('Run'),
i=b('Vector'),

j=b('copyProperties');

function k(){}

j(k,

{UNKNOWN:0,
ESC:1,
X:2,
OUTSIDE:3,
UNLOAD:4,
NAVIGATE:5,
AGGREGATE:6,
LEAVE:7,


PERMALINK:0,
SNOWLIFT:6,

AGGREGATION_COUNT:20,

set:null,
time:null,
views:0,
fbidList:[],
details:{},
width:0,
height:0,
first:false,
last:false,
logIds:false,
version:null,

buttonLikes:0,
pagingAction:'',
faceTagImpressions:0,
cycle:false,
endOfRelevant:false,
relevantCount:0,

initLogging:function(l){
this.set=null;
this.time=new Date();
this.views=0;
this.hiResLoads=0;
this.fullScreenViews={};
this.first=true;
this.last=false;
this.logIds=false;
this.version=l;
this.buttonLikes=0;
this.pagingAction='';
this.faceTagImpressions=0;
this.cycle=false;
this.endOfRelevant=false;
this.relevantCount=0;

if(l===k.SNOWLIFT){
var m=i.getViewportDimensions();
this.width=m.x;
this.height=m.y;}},



setLogFbids:function(l){
this.logIds=l;},


setPhotoSet:function(l){
this.set=l;},


addButtonLike:function(){
this.buttonLikes++;},


setPagingAction:function(l){
this.pagingAction=l;},


addFaceTagImpression:function(){
this.faceTagImpressions++;},


setCycle:function(l){
this.cycle=l;},


setEndOfRelevant:function(l){
this.endOfRelevant=l;},


setRelevantCount:function(l){
this.relevantCount=l;},


setEndMetrics:function(l){
this.endMetrics=l;},


addPhotoView:function(l,m,n){


if(this.logIds&&this.views>=this.AGGREGATION_COUNT)
this.logPhotoViews(this.AGGREGATE);

this.views++;
if(l)
this.fbidList.push([l.fbid,l.owner,Date.now()]);

if(m)
this.hiResLoads++;

if(n)
this.fullScreenViews[l.fbid]=true;},



logEnterFullScreen:function(l){
this.fullScreenViews[l]=true;},


addDetailData:function(l,m){

if(!this.details[l])
this.details[l]=
{t:m.num_tags,
l:m.has_location,
c:m.has_caption,
cm:m.comment_count,
lk:m.like_count,
w:m.width,
h:m.height,
ad:'{}',
p:this.pagingAction};},




updateAdData:function(l,m){
if(this.details[l])
this.details[l].ad=JSON.stringify(m);},



logPhotoViews:function(l){


if((!this.views)||

(this.version===k.SNOWLIFT&&
l==k.LEAVE))

return;




if(l!=this.AGGREGATE)
this.last=true;


var m=
{set:this.set,
time:new Date()-this.time,
fbids:this.logIds?this.fbidList:[],
details:this.logIds?this.details:{},
first:this.first,
last:this.last,
close:l?l:this.UNKNOWN,
button_likes:this.buttonLikes,
version:this.version,
face_imp:this.faceTagImpressions,
endmetric:this.endMetrics,
cycle:this.cycle,
end_relev:this.endOfRelevant,
relev_count:this.relevantCount};


if(this.version===k.SNOWLIFT){




var n=i.getViewportDimensions();
m.width=n.x||this.width;
m.height=n.y||this.height;

if(this.hiResLoads>0)
m.hires_loads=this.hiResLoads;

if(this.last){
var o=Object.keys(this.fullScreenViews).length;
if(o>0)
m.fullscreen=o;}}




new g().
setURI('/ajax/photos/logging/session_logging.php').
setAllowCrossPageTransition(true).
setOption('asynchronous',(l!=k.UNLOAD)).
setOption('suppressErrorHandlerWarning',true).
setData(m).
send();

this.views=0;
this.hiResLoads=0;
this.fbidList=[];
this.details={};
this.first=false;
this.buttonLikes=0;

if(this.last){
this.set=null;
this.logIds=false;
this.fullScreenViews={};}}});




h.onUnload(function(){
k.logPhotoViews(k.UNLOAD);});


h.onLeave(function(){
k.logPhotoViews(k.LEAVE);});


e.exports=k;});

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



var g=

{VIEWER_PERMALINK:0,
VIEWER_SNOWLIFT:6,
VIEWER_VAULTBOX:8,


BULK_EDITOR:3,


FLASH_UPLOADER:4,
HTML5_UPLOADER:10,


SIZE_NORMAL:'n',
PIC_NORMAL_FBX_SIZE:180};


e.exports=g;});

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



var g=b('copyProperties'),
h=b('Vector');

function i(){}

g(i,
{getNearestBox:function(j,k){
var l=Infinity,
m=null;

for(var n in j){
var o=j[n];
if(o.contains(k)){
var p=k.distanceTo(o.getCenter());
if(p<l){
l=p;
m=n;}}}




return m;},






absoluteToNormalizedPosition:function(j,k){
var l=h.getElementPosition(j),
m=h.getElementDimensions(j),

n=k.
sub(l).
mul(100/m.x,100/m.y);

n.domain='pure';
return n;},




normalizedToAbsolutePosition:function(j,k){
var l=h.getElementPosition(j),
m=h.getElementDimensions(j),

n=k.
mul(m.x/100,m.y/100).
add(l);

n.domain='document';
return n;},


isFacebox:function(j){
return j.match(/^face:/);}});



e.exports=i;});

/** js/photos/photostream/modules/PhotoStreamCache.js */
__d("PhotoStreamCache",["array-extensions","HTML","PhotosConst","PhotoEverstoreLogger","Rect","UIPagelet","URI","Vector","copyProperties","createArrayFrom"],function(a,b,c,d,e,f){







b('array-extensions');

var g=b('HTML'),
h=b('PhotosConst'),
i=b('PhotoEverstoreLogger'),
j=b('Rect'),
k=b('UIPagelet'),
l=b('URI'),
m=b('Vector'),

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

function p(){}

n(p,

{ERROR:'error',
HTML:'html',
IMAGE_DATA:'image',
EXTRA:'extra',


BUFFER_SIZE:3,
INIT_BUCKET_SIZE:4,
FULL_BUCKET_SIZE:12,


ERROR_ID:-1,

INIT_PLACEHOLDER:1});



n(p.prototype,

{init:function(q,r){
this.version=q;
this.pageletName=r;

this.bufferSize=p.BUFFER_SIZE;
this.fullBucketSize=p.FULL_BUCKET_SIZE;
this.initError=false;
this.isActive=true;


this.leftLock=false;
this.rightLock=false;

this.useAjaxPipe=true;

this.reset();},



setUseAjaxPipe:function(q){
this.useAjaxPipe=q;},


reset:function(){
this.cache={image:{},extra:{},html:{}};
this.fbidList=[];
this.loaded=false;
this.allLoaded=false;
this.permalinkMap={};

this.position=0;

this.totalCount=null;
this.firstCursor=null;
this.firstCursorIndex=null;},


waitForInitData:function(){
this.fbidList.push(p.INIT_PLACEHOLDER);},


destroy:function(){
this.reset();
this.isActive=false;},


isLoaded:function(){
return this.loaded;},


canPage:function(){
if(!this.isLoaded())
return false;

if(this.totalCount!==null)
return this.totalCount>1;

return this.getLength()>1;},


errorInCurrent:function(){
if(this.initError){
return true;}else
if(!this.isLoaded())

return false;

return this.checkErrorAt(this.getCursor());},


getLength:function(){
return this.fbidList.length;},


getPhotoSet:function(){
return this.photoSetQuery.set;},


getPhotoSetQuery:function(){
return this.photoSetQuery;},



getCurrentImageData:function(){
return this.getImageData(this.getCursor());},


getImageData:function(q){
return this.getCacheContent(q,p.IMAGE_DATA);},


getCurrentHtml:function(){
return this.getCacheContent(this.getCursor(),p.HTML);},


getCurrentExtraData:function(){
return this.getCacheContent(this.getCursor(),p.EXTRA);},


getCacheContent:function(q,r){
if(!q||
q===p.ERROR_ID||
q===p.INIT_PLACEHOLDER)
return null;

return this.cache[r][q];},


getCursorPos:function(){
return this.position;},





getCursor:function(){
if(this.position>=0&&this.position<this.getLength())
return this.fbidList[this.position];


return null;},


getCursorForURI:function(q){
return this.permalinkMap[q];},


calculatePositionForMovement:function(q){
var r=this.position+q;
if(this.allLoaded){
var s=this.getLength();
r=(s+r%s)%s;}

return r;},


isValidMovement:function(q){
if(!this.isLoaded()||!this.canPage())
return false;


var r=this.calculatePositionForMovement(q);




return this.getCursor()>0||
(r>=0&&r<this.getLength());},



moveCursor:function(q){
if(!this.isValidMovement(q))
return;

this.position=this.calculatePositionForMovement(q);


if(q!==0)
this.loadMoreIfNeccessary(q>0);},



checkErrorAt:function(q){
if(!this.isLoaded())
return false;

if(q===p.ERROR_ID)
return true;

return false;},


getRelativeMovement:function(q){
for(var r=0;r<this.getLength();r++)


if(this.fbidList[r]==q)
return r-this.position;


return null;},


preloadImages:function(q){
var r,s,
t=this.getLength(),
u=this.cache.image,
v=p.BUFFER_SIZE;

if(t>v*2){
r=(this.position+t-v%t)%t;
s=(this.position+v)%t;}else{

r=0;
s=t-1;}


while(r!=s){
var w=this.fbidList[r];
if(u[w]&&u[w].url)
if(q&&!u[w].resource){
u[w].resource=new Image();
u[w].resource.src=u[w].url;


if(u[w].everstoreLogThis===true)
i.logImmediately(u[w].resource.src);}else

if(!q&&!u[w].small){
u[w].small=new Image();
u[w].small.src=u[w].smallurl||u[w].url;


if(u[w].everstoreLogThis===true)
i.logImmediately(u[w].small.src);}



r=(r+1)%t;}},



loadMoreIfNeccessary:function(q){
if(this.allLoaded||
(q&&this.rightLock)||
(!q&&this.leftLock))


return;


var r=q?1:-1,
s=this.position+this.bufferSize*r;
if(s<0&&!this.checkErrorAt(this.getEndCursor(false))){
this.leftLock=true;
this.fetch(this.fullBucketSize,false);}else
if(s>this.getLength()&&
!this.checkErrorAt(this.getEndCursor(true))){
this.rightLock=true;
this.fetch(this.fullBucketSize,true);}},



getEndCursor:function(q){
return q?this.fbidList[this.getLength()-1]:this.fbidList[0];},







calculateRelativeIndex:function(q,r,s){
if(!this.totalCount)
return null;


var t=this.fbidList.indexOf(r),
u=this.fbidList.indexOf(s);
if(t===-1||u===-1)
return null;

var v=u-t;

return (q+v+this.totalCount)%this.totalCount;},





calculateDistance:function(q,r){
var s=this.fbidList.indexOf(q),
t=this.fbidList.indexOf(r);
if(s===-1||t===-1)
return null;

return (t-s+this.getLength())%this.getLength();},


fetch:function(q,r){
var s=this.getEndCursor(r),
t=n

({cursor:s,
version:this.version,
end:this.getEndCursor(!r),
fetchSize:r?q:-1*q,
relevant_count:this.relevantCount},

this.photoSetQuery);





if(this.totalCount&&this.firstCursorIndex!==null){
t.total=this.totalCount;
t.cursorIndex=this.calculateRelativeIndex
(this.firstCursorIndex,this.firstCursor,s);}


k.loadFromEndpoint
(this.pageletName,
null,
t,




{usePipe:this.useAjaxPipe,
jsNonblock:true,
crossPage:true});




if(!this.useAjaxPipe)
this.setUseAjaxPipe(true);},



storeToCache:function(q){
var r={};

if(!this.isActive)
return r;


if('error' in q){
this.processErrorResult(q.error);
r.error=true;
return r;}



if('init' in q){
this.processInitResult(q.init);
r.init=
{logids:q.init.logids,
fbid:q.init.fbid,
loggedin:q.init.loggedin,
fromad:q.init.fromad,
disablesessionads:q.init.disablesessionads};}



if('image' in q){
this.processImageResult(q.image);
r.image=true;}


if('data' in q){
this.processDataResult(q.data);
r.data=true;}


return r;},


processInitResult:function(q){
if(this.loaded)
return;


this.loaded=true;
this.photoSetQuery=q.query;
if(q.bufferSize)
this.bufferSize=q.bufferSize;

if(q.fullBucketSize)
this.fullBucketSize=q.fullBucketSize;

if(this.fbidList.length===0){
this.fbidList.push(q.fbid);





this.rightLock=true;}else{

var r=this.fbidList.indexOf(p.INIT_PLACEHOLDER);
if(r!=-1)
this.fbidList[r]=q.fbid;}


this.firstCursor=q.fbid;



if('initIndex' in q&&'totalCount' in q){
this.firstCursorIndex=q.initIndex;
this.totalCount=q.totalCount;}


if(this.version==h.VIEWER_PERMALINK)
this.fetch(p.INIT_BUCKET_SIZE,true);},



processImageResult:function(q){
for(var r in q){










if(r===this.firstCursor&&q[r].everstoreLogThis)
i.logImmediately(q[r].url);


this.cache.image[r]=q[r];
if(q[r].dimensions)
this.cache.image[r].dimensions=
m.deserialize(q[r].dimensions);

if(q[r].smalldims)
this.cache.image[r].smalldims=
m.deserialize(q[r].smalldims);

this.permalinkMap[
l(q[r].info.permalink).getUnqualifiedURI().toString()]=
r;}},






attachToFbidsList:function(q,r,s){
if(this.allLoaded)
return;

if(r===-1){
for(var t=q.length-1;t>=0;t--){
this.fbidList.unshift(q[t]);
this.position++;}

this.leftLock=false;}else{

for(var u=0;u<q.length;u++)
this.fbidList.push(q[u]);

this.rightLock=false;}

if(s)
this.setAllLoaded();},






setAllLoaded:function(){
this.allLoaded=true;
if(this.getCursor()===null)

this.position=this.calculatePositionForMovement(0);},



processDataResult:function(q){
for(var r in q){



if(!this.cache.html[r])
this.cache.html[r]={};

for(var s in q[r].html){
var t=q[r].html[s];

if(typeof t==='string')
t=g(t).getRootNode();

this.cache.html[r][s]=o(t.childNodes);}




if(!('extra' in q[r])){
this.cache.extra[r]=null;
continue;}



this.cache.extra[r]=
{tagRects:{}};





if(!Array.isArray(q[r].extra.tagRects))
for(var u in q[r].extra.tagRects)
if(q[r].extra.tagRects[u])
this.cache.extra[r].tagRects[u]=
j.deserialize(q[r].extra.tagRects[u]);





Object.keys(q[r].extra).forEach(function(v){
if(v=='tagRects')

return;

this.cache.extra[r][v]=q[r].extra[v];}.
bind(this));}},



processErrorResult:function(q){

if(!this.isLoaded()){
this.initError=true;
return;}

var r=q.side,
s=[p.ERROR_ID];
this.attachToFbidsList(s,r);},


setTotalCount:function(q){
this.totalCount=q;},


setFirstCursorIndex:function(q){
this.firstCursorIndex=q;}});



e.exports=p;});

/** js/photos/viewer/modules/PhotoSnowliftAds.js */
__d("PhotoSnowliftAds",["array-extensions","Event","copyProperties","CSS","csx","DataStore","DOM","PhotoSessionLog","UIPagelet","URI","Vector"],function(a,b,c,d,e,f){



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

h=b('copyProperties'),
i=b('CSS'),
j=b('csx'),
k=b('DataStore'),
l=b('DOM'),
m=b('PhotoSessionLog'),
n=b('UIPagelet'),
o=b('URI'),
p=b('Vector'),

q=

{DEFAULT_UNITS_REFRESH_RATE:30000,

UNITS_REGISTER_DELAY:1000,

root:null,
availableDimensions:null,
loadQuery:null,
lastLoadTime:0,
minAds:100,
units:null,
isLogAdData:null,

refreshUnitsRate:null,


adsStatus:'null',
adsEvents:{},

resetEvents:function(){
this.adsStatus='reset';
this.adsEvents={};},


addEvent:function(r,s){
if(s)
this.adsStatus=r;

var t=Date.now();
this.adsEvents[r+'_'+t]=t;},


init:function(r,s,t){
this.reset();
this.root=r;
this.snowlift=s;
this.minAds=t.min_ads;
this.addEvent('init',true);

this.refreshUnitsRate=q.DEFAULT_UNITS_REFRESH_RATE;
if(t.refresh_fast)
this.refreshUnitsRate=t.refresh_rate;},



reset:function(){
this.lastLoadTime=0;
this.units=[];
this.resetEvents();
this.addEvent('reset',true);},


resize:function(r){
this.availableDimensions=r;
this.loadQuery=this.snowlift.getLoadQuery();
this.processResize();},


calculateUnitSizes:function(r,s){
var t={};
r.forEach(function(u){
var v=u.root.firstChild.offsetHeight;


u.units.forEach(function(x){
if(!i.hasClass(x,'hidden')){
var y=this.getHeight(x.firstChild,s);
v-=y;}}.

bind(this));

var w=

{height:v,
visible:false};


u.units.forEach(function(x){
var y=this.getIsAds(x),
z=this.getHeight(x.firstChild,s),
aa=this.getUnitId(x);
t[aa]=

{height:z,
visible:false,
priority:0,
is_ads:y,
section_ref:w};}.

bind(this));}.
bind(this));
return t;},


calculateVisibleUnits:
function(r,s,t){
var u=0,
v=this.getUnitPriority(s);
v.forEach(function(w){

if(s.hasOwnProperty(w)){
var x=s[w],
y=x.height;
if(!x.section_ref.visible)
y+=x.section_ref.height;

x.height_below=t-y;


x.visible=
x.height_below>=0&&y>0;
if(x.visible){
x.section_ref.visible=true;
t-=y;
u++;}}}.


bind(this));
return s;},


displayUnits:function(r,s){
r.forEach(function(t){
var u=false;

t.units.forEach(function(v){
var w=this.getUnitId(v),
x=s[w],
y=x.visible,
z=x.height_below,
aa=x.is_ads;

i.conditionClass(v,'hidden',!y);
u=u||y;
this.calcUnitStats
(this.units[aa][w],y,z);}.
bind(this));

i.conditionClass(t.root,'hidden',!u);}.
bind(this));},


getUnitPriority:function(r){
var s=[],
t=0,
u=0;
for(var v in r){
var w=r[v];
s.push(v);
var x=this.minAds+t+u;
if(w.is_ads){
if(u<this.minAds)
x=u;

u++;}else 

t++;

w.priority=x;}


s=s.sort
(function(y,z){
var aa=r[y],
ba=r[z];
return aa.priority-ba.priority;}.
bind(this));
return s;},


updateUnitsStatus:function(){
var r=this.availableDimensions.x,
s=this.availableDimensions.y,
t=this.calculateUnitSizes(this.sections,r);
t=this.calculateVisibleUnits
(this.sections,t,s);
this.displayUnits(this.sections,t);},


calcUnitStats:function(r,s,t){
var u=Date.now();
if(r.visible)
r.totalTime+=u-r.lastShowTime;

if(r.trackingCode!==null&&r.totalTime>=
this.UNITS_REGISTER_DELAY){
var v=r.trackingCode;
r.trackingCode=null;
this.registerImpression(v,r.registerUrl);}

r.visible=s;
r.heightBelow=t;
r.lastShowTime=u;},


prepareResize:function(){

var r=function(s){
var t=l.create('div',{className:'inner'}),
u=l.create('div',{className:'wrapper'},t);
l.replace(s,u);
l.setContent(t,s);
return u;};


this.sections=
l.scry(this.root,'div.ego_section').map(function(s){

return {root:r(s),
units:l.scry(s,'div.ego_unit').map(r)};});},




processResize:function(){
if(this.isLoading||this.lastLoadTime===0||
this.availableDimensions===null){
this.setLogData();
return;}

this.updateUnitsStatus();
this.setLogData();
var r=this.nextRegisterTime();
if(r!==Infinity)
this.processResize.bind(this).defer(r,true);},



setIsLogAdData:function(r){
this.isLogAdData=r;
this.addEvent('setIsLogAdData',false);
this.setLogData();},


setLogData:function(){
var r=this.snowlift.getImageId();
if(this.isLogAdData&&r){
var s=p.getElementDimensions(this.snowlift.getImage()),
t=p.getElementDimensions
(this.snowlift.getRHCHeader()),
u=p.getElementDimensions(this.snowlift.getRHCBody()),
v=p.getElementDimensions
(this.snowlift.getRHCFooter()),
w=

{query_set:this.snowlift.getLoadQuery().set,
window_x:window.innerWidth,
window_y:window.innerHeight,
image_x:s.x,
image_y:s.y,
header_x:t.x,
header_y:t.y,
body_x:u.x,
body_y:u.y,
footer_x:v.x,
footer_y:v.y,
ads_below_space:this.getAdsBelowSpace(),
time:Date.now(),
adsStatus:this.adsStatus,
adsEvents:this.adsEvents};

m.updateAdData(r,w);}},



getAdsBelowSpace:function(){
var r=[],
s=this.units[1];
for(var t in s)
if(s.hasOwnProperty(t))
r.push(s[t].heightBelow);


return r;},


getIsAds:function(r){
var s=l.scry(r,"div._4u8");
return s.length;},


getUnitId:function(r){
if(this.getIsAds(r)){
return this.getAdId(r);}else 

return this.getEgoId(r);},



getEgoId:function(r){
var s=l.find(r,'div.ego_unit');
return s.getAttribute('data-ego-fbid');},


getAdId:function(r){
var s=l.find(r,"div._4u8"),
t=s.getAttribute('data-ad'),
u=JSON.parse(t).adid;
return u;},


nextRegisterTime:function(){
var r=Infinity,
s=h
(h({},this.units[0]),
this.units[1]);
for(var t in s)
if(s.hasOwnProperty(t)){
var u=s[t];
if(u.trackingCode!==null&&u.visible)
r=Math.min
(r,this.UNITS_REGISTER_DELAY-u.totalTime);}



return r;},


getHeight:function(r,s){
var t=k.get(r,'height');
if(t&&t.x===s)
return t.y;

return this.cacheHeight(r,s);},


cacheHeight:function(r,s){
var t=
{x:s,
y:r.offsetHeight};

k.set(r,'height',t);
return t.y;},


loadAdsAndEgo:function(){
this.resetEvents();
this.addEvent('adsRequested',true);


n.loadFromEndpoint
('WebEgoPane',
this.root,

{pid:34,
data:[this.loadQuery.set,true]},


{crossPage:true,
bundle:false});},




unitsLoaded:function(r,s){
var t;
if(s){
t='/ai.php';
this.addEvent('adsLoaded',true);}else{

t='/ajax/ei.php';
this.addEvent('egoLoaded',true);}

var u={};
for(var v in r)
if(r.hasOwnProperty(v))
u[v]=
{trackingCode:r[v],
totalTime:0,
lastShowTime:0,
heightBelow:-10000,
visible:false,
registerUrl:t};



this.units[s]=u;



if(s)
this.waitForImages(this.imagesLoaded.bind(this));},



imagesLoaded:function(){
this.prepareResize();
this.addEvent('imagesLoaded',true);
this.lastLoadTime=Date.now();
this.isLoading=false;
this.processResize();
i.removeClass(this.root,'loading');},


loadAdsFromUserActivity:function(){
var r=Date.now(),
s=this.refreshUnitsRate;
if(!this.isLoading&&r-this.lastLoadTime>s){
i.addClass(this.root,'loading');
this.isLoading=true;
this.loadAdsAndEgo();}},






registerImpression:function(r,s){
var t=l.create('iframe',
{src:o(s).addQueryData({aed:r}),
width:0,
height:0,
frameborder:0,
scrolling:'no',
className:'fbEmuTracking'});

t.setAttribute('aria-hidden','true');

l.appendContent(this.root,t);},


waitForImages:function(r){
var s=l.scry(this.root,'img.img'),

t=s.length,
u=t;


if(u===0)
r();


var v=function(){
u--;
if(u===0)
r.defer();};


for(var w=0;w<t;w++){
var x=s[w];


if(x.complete){
v();}else 







g.listen(x,{load:v,error:v,abort:v});}}};





e.exports=q;});

/** js/photos/viewer/modules/PhotoViewer.js */
__d("PhotoViewer",["Bootloader","copyProperties","emptyFunction"],function(a,b,c,d,e,f){






var g=b('Bootloader'),

h=b('copyProperties'),
i=b('emptyFunction');

function j(){
this.image=null;
this.root=null;
this.stream=null;}


h(j,
{bootstrap:function(k,l){
g.loadModules(['PhotoSnowlift'],function(m){
m.bootstrap(k,l);});}});




h(j.prototype,
{getEventPrefix:i.thatReturnsNull,

getEventString:function(k){
var l=this.getEventPrefix();
if(l)
return l+'.'+k;

return null;},


getImage:function(){
return this.image;},


getPosition:function(){
return this.stream?this.stream.getCursor():null;},


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


getSourceString:i.thatReturnsNull,

getVersionConst:i.thatReturnsNull});


e.exports=j;});

/** js/photos/viewer/modules/PhotoSnowlift.js */
__d("PhotoSnowlift",["array-extensions","function-extensions","Arbiter","AsyncDialog","AsyncRequest","Bootloader","Class","CSS","Dialog","DOM","DOMControl","Event","FullScreen","ImageUtils","Keys","LinkController","Locale","PageTransitions","Parent","PhotosConst","PhotoSessionLog","PhotoSnowliftAds","PhotoStreamCache","PhotosUtils","PhotoViewer","Rect","ScrollableArea","Style","Toggler","UIPagelet","URI","UserAgent","Vector","$","computeRelativeURI","copyProperties","createArrayFrom","csx","emptyFunction","ge","goURI","tx","userAction"],function(a,b,c,d,e,f){



b('array-extensions');
b('function-extensions');

var g=b('Arbiter'),
h=b('AsyncDialog'),
i=b('AsyncRequest'),
j=b('Bootloader'),
k=b('Class'),
l=b('CSS'),
m=b('Dialog'),
n=b('DOM'),
o=b('DOMControl'),
p=b('Event'),
q=b('FullScreen'),
r=b('ImageUtils'),
s=b('Keys'),
t=b('LinkController'),
u=b('Locale'),
v=b('PageTransitions'),
w=b('Parent'),
x=b('PhotosConst'),
y=b('PhotoSessionLog'),
z=b('PhotoSnowliftAds'),
aa=b('PhotoStreamCache'),
ba=b('PhotosUtils'),
ca=b('PhotoViewer'),
da=b('Rect'),
ea=b('ScrollableArea'),
fa=b('Style'),
ga=b('Toggler'),
ha=b('UIPagelet'),
ia=b('URI'),
ja=b('UserAgent'),
ka=b('Vector'),

la=b('$'),
ma=b('computeRelativeURI'),
na=b('copyProperties'),
oa=b('createArrayFrom'),
pa=b('csx'),
qa=b('emptyFunction'),
ra=b('ge'),
sa=b('goURI'),
ta=b('tx'),
ua=b('userAction');

function va(){
this.parent.construct(this);}


na(va,

{STATE_ERROR:'error',
STATE_HTML:'html',
STATE_IMAGE_PIXELS:'image_pixels',
STATE_IMAGE_DATA:'image',


LOADING_TIMEOUT:2000,


PAGER_FADE:3000,

FULL_SCREEN_PADDING:10,


STAGE_HIRES_MAX:{x:2048,y:2048},
STAGE_NORMAL_MAX:{x:960,y:960},


STAGE_MIN:{x:520,y:520},


SIDEBAR_SIZE_MAX:360,


STAGE_CHROME:{x:82,y:42},


VIDEO_BOTTOM_BAR_SPACE:40,



GOPREV_AREA:120,


TIMELINE_STRETCH_WIDTH:843,
TIMELINE_STRETCH_MIN:480,


MIN_TAG_DISTANCE:83,


PADDING_MIN:40,

MIN_UFI_HEIGHT:250,


_instance:null,
getInstance:function(){
if(!va._instance)
va._instance=new va();

return va._instance;},


initWithSpotlight:function(wa,xa){
va.getInstance().init(wa,xa);},


touch:qa,

addPhotoFbids:function(wa,xa,ya,za){
va.getInstance().addPhotoFbids
(wa,xa,ya,za);},


attachFollowFlyout:function(wa){
n.insertAfter(la('fbPhotoSnowliftSubscribe'),wa);},


attachSubscribeFlyout:function(wa){
n.insertAfter(la('fbPhotoSnowliftSubscribe'),wa);},


attachTagger:function(wa){
va.getInstance().attachTagger(wa);},


preload:function(wa,xa){
va.getInstance().preload(wa,xa);},


bootstrap:function(wa,xa){

if(wa&&ia(wa).getQueryData().hasOwnProperty('share_id')){
j.loadModules
(['SpotlightShareViewer'],
function(ya){
ya.bootstrap(wa,xa);});


return;}

va.getInstance().bootstrap(wa,xa);},


closeRefresh:function(){
va.getInstance().closeRefresh();},


deletePhoto:function(wa){
va.getInstance().deletePhoto(wa);},


getImage:function(){
return va.getInstance().getImage();},


getImageId:function(){
return va.getInstance().getImageId();},


getLoadQuery:function(){
return va.getInstance().getLoadQuery();},


getRHCBody:function(){
return va.getInstance().getRHCBody();},


getRHCFooter:function(){
return va.getInstance().getRHCFooter();},


getRHCHeader:function(){
return va.getInstance().getRHCHeader();},


getRoot:function(){
return va.getInstance().getRoot();},


likePhotoSkipConfirmation:function(wa){
va.getInstance().likePhotoSkipConfirmation(wa);},


saveTagsFromPayload:function(wa){
va.getInstance().saveTagsFromPayload(wa);},


saveTagsFromPayloadDelayed:function(wa){
va.saveTagsFromPayload.curry(wa).defer(2000);},


handleServerError:function(wa,xa){
va.getInstance().handleServerError
(wa,xa);},


storeFromData:function(wa){
va.getInstance().storeFromData(wa);},


swapData:function(){
va.getInstance().swapData();},


touchMarkup:qa,

updateTotalCount:function(wa,xa,ya){
va.getInstance().updateTotalCount(wa,xa,ya);}});



k.extend(va,ca);

na(va.prototype,

{switchTimer:null,
imageRefreshTimer:null,
imageLoadingTimer:null,
lastPage:0,


currentMinSize:null,
currentImageSize:null,
resetUriStack:true,
thumbSrc:null,
shouldStretch:false,
stageMax:va.STAGE_NORMAL_MAX,
stageChrome:va.STAGE_CHROME,
stagePagerPrev:null,
ua:null,
PhotoTagger:null,




showHover:false,



skipLikePhotoConfirmation:false,



isShowingLikePhotoConfirmation:false,

preload:function(wa,xa){

j.loadModules
(['PhotoTagger',
'fb-photos-snowlift-css',
'Live',
'PhotoTagApproval',
'PhotoTags',
'TagTokenizer',
'fb-photos-snowlift-fullscreen-css'],
function(za){
this.PhotoTagger=za;}.
bind(this));


var ya=this.getImageSrc(ia(wa).getQueryData());
if(ya)
(new Image()).src=ya;},



bootstrap:function(wa,xa){
if(wa&&ia(wa).getQueryData().makeprofile){
this.enableCropperOnInit=true;
this.isUserProfilePic=ia(wa).getQueryData().makeuserprofile;
this.isInProfilePicAlbum=ia(wa).getQueryData().inprofilepicalbum;}



this.preload(wa,xa);





if(this.closeDirty){
this.bootstrap.bind(this,wa,xa).defer();
return;}


z.reset();
this.resetUriStack=true;
if(this.isOpen)
if(this.openExplicitly){





this.closeCleanup();
this.resetUriStack=false;}else 




return;



this.ua=ua('snowlift',xa).uai('open');
this.returningToStart=false;
this.loading&&l.removeClass(this.loading,'loading');
if(xa){
l.addClass((this.loading=xa),'loading');
this.getThumbAndSize(xa);}else 

this.loading=null;


g.inform('PhotoSnowlift.GO',wa,g.BEHAVIOR_STATE);
this.loadFrameIfUninitialized();},



getCurrentImageServerSizeDimensions:function(){
return this.stream.getCurrentImageData().dimensions;},


getEventPrefix:function(){
return 'PhotoSnowlift';},


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


getSourceString:function(){
return 'snowlift';},


getVersionConst:function(){
return x.VIEWER_SNOWLIFT;},


getImage:function(){
return this.image;},


getImageId:function(){
return this.stream.getCursor();},


getRHCHeader:function(){
return this.rhcHeader;},


getRHCBody:function(){
return this.ufiForm;},


getRHCFooter:function(){
return this.rhcFooter;},


getLoadQuery:function(){
return this.loadQuery;},


getCurrentPhotoInfo:function(){
var wa=this.stream.getCurrentImageData();
if(wa)
return wa.info;

return null;},


getOwnerId:function(){
var wa=this.stream.getCurrentImageData();
if(wa)
return wa.info.owner;

return null;},















getThumbAndSize:function(wa){

this.currentImageSize=null;
this.thumbSrc=null;

var xa=ia(wa.getAttribute('ajaxify')).getQueryData();

if(!xa.size)
return;


var ya=ka.deserialize(xa.size);
if(!ya.x||!ya.y)
return;


this.currentImageSize=ya;



if(!l.hasClass(wa,'uiMediaThumb')&&
!l.hasClass(wa,'uiPhotoThumb')&&
!l.hasClass(wa,'uiScaledThumb'))
return;



if(wa.getAttribute('data-cropped'))
return;


var za=n.scry(wa,'img')[0],
ab=n.scry(wa,'i')[0],



bb=w.byAttribute(wa,'data-size');
this.shouldStretch=
bb&&this.currentImageSize&&za&&
bb.getAttribute('data-size')==="2"&&
this.currentImageSize.x>this.currentImageSize.y&&
this.currentImageSize.x<=va.TIMELINE_STRETCH_WIDTH&&
za.offsetWidth===va.TIMELINE_STRETCH_WIDTH;

var cb;
if(za){
cb=za.src;}else
if(ab){
cb=fa.
get(ab,'backgroundImage').
replace(/.*url\("?([^"]*)"?\).*/,'$1');}else 

return;



this.thumbSrc=cb;},


loadFrameIfUninitialized:function(){
if(this.root)
return;




new i('/ajax/photos/snowlift/init.php').
setAllowCrossPageTransition(true).
setMethod('GET').
setReadOnly(true).
send();},


init:function(wa,xa){
this.init=qa;

this.showHover=xa.pivot_hover;
y.setEndMetrics(xa.pivot_end_metric);
this.showEndPivot=xa.pivot_end;
this.enableSnowliftProfilePicCropper=
xa.snowlift_profile_pic_cropper;
this.pagersOnKeyboardNav=xa.pagers_on_keyboard_nav;

this.fullscreen=q.isSupported();
this.showOGVideos=xa.og_videos;

this.stageMax=va.STAGE_HIRES_MAX;

this.spotlight=wa;

this.spotlight.subscribe('blur',function(){
this.closingAction=y.OUTSIDE;}.
bind(this));

this.spotlight.subscribe('hide',this.closeHandler.shield(this));

this.spotlight.subscribe('key',this.keyHandler.bind(this));

this.initializeNodes(this.spotlight.getRoot());

z.init(this.sideAdUnit,this,xa);

if(!this.subscription){
t.registerHandler(this.handleNavigateAway.bind(this));

this.subscription=g.subscribe
('PhotoSnowlift.GO',
function(ya,za){
this.openExplicitly=true;
this.loading&&l.removeClass(this.loading,'loading');
this.open(za);}.
bind(this));}



this.transitionHandlerRegistered=false;






this.returningToStart=false;
v.registerHandler(this.openHandler.bind(this));
this.openHandlerRegistered=true;

g.subscribe
('PhotoTagApproval.HILITE_TAG',
this.onHiliteTag.bind(this));

g.subscribe
('PhotoTagApproval.UPDATE_TAG_BOX',
this.onUpdateTagBox.bind(this));




if(this.fullscreen)
q.subscribe('changed',this.onFullScreenChange.bind(this));},



onFullScreenChange:function(){
var wa=q.isFullScreen();
l.conditionClass
(document.body,
'fbPhotoSnowliftFullScreenMode',
wa);


if(wa){
if(!l.hasClass(this.root,'fbPhotoSnowliftEditMode'))
this.collapseRHC();

var xa=this.stream.getCurrentImageData();

if(xa&&xa.url&&this.image.src!==xa.url&&
this.shouldShowHiRes(xa))
this.switchImage(xa.url);


this.adjustForResize();}else{

this.uncollapseRHC();
if(ja.chrome()&&
!l.hasClass(this.root,'fbPhotoSnowliftEditMode'))


this.page(0,false);

g.inform('reflow');}

ga.hide();

if(this.cropper)

this.cropper.resetPhoto();},



initializeNodes:function(wa){
this.root=wa;

this.container=n.find(wa,'div.fbPhotoSnowliftContainer');
this.snowliftPopup=n.find(this.container,'div.fbPhotoSnowliftPopup');

this.rhc=n.find(this.snowliftPopup,'div.rhc');
this.rhcHeader=n.find(this.rhc,'div.rhcHeader');
this.rhcFooter=n.find(this.rhc,'div.rhcFooter');

this.ufiForm=n.find(this.rhc,'form.fbPhotosSnowliftFeedbackForm');
this.ufiInputContainer=
n.find(this.rhc,'div.fbPhotosSnowboxFeedbackInput');

this.scroller=n.find(this.ufiForm,'div.rhcScroller');
this.scrollerBody=n.find(this.scroller,'div.uiScrollableAreaBody');

this.stageWrapper=n.find(this.snowliftPopup,'div.stageWrapper');
this.overlay=n.find(this.snowliftPopup,'div.snowliftOverlay');
this.errorBox=n.find(this.stageWrapper,'div.stageError');
this.image=n.find(this.stageWrapper,'img.spotlight');
this.stage=n.find(this.stageWrapper,'div.stage');
this.videoStage=n.find(this.stageWrapper,'div.videoStage');

this.prevPager=n.find(this.snowliftPopup,'a.snowliftPager.prev');
this.nextPager=n.find(this.snowliftPopup,'a.snowliftPager.next');

this.stageActions=n.find(wa,'div.stageActions');
this.buttonActions=n.find(this.stageActions,'div.fbPhotosPhotoButtons');

this.productMetadata=
n.scry(this.rhc,'div.fbPhotosSnowliftProductMetadata').pop();

this.sideAdUnit=n.find(wa,"._24q");

g.inform('Amoeba/instrumentMulti',
[[this.container,'snowlift'],
[this.rhc,'rhc'],
[this.rhcHeader,'rhc_header'],
[this.ufiForm,'ufi_form'],
[this.ufiInputContainer,'ufi_input'],
[this.prevPager,'prev_pager'],
[this.nextPager,'next_pager'],
[this.stageActions,'stage_actions'],
[this.sideAdUnit,'side_ads']],

g.BEHAVIOR_PERSISTENT);


l.conditionClass
(this.root,
'fullScreenAvailable',
this.fullscreen);},




initializeScroller:function(){
this.initializeScroller=qa;

this.scrollableArea=ea.fromNative(this.scroller,
{fade:true,
persistent:true});




var wa=function(event){
var xa=p.$E(event).getTarget();
if(n.contains(this.ufiInputContainer,xa)){


var ya=o.getInstance(xa);
if(ya){

this.scrollableArea.scrollToBottom();


var za=ya.subscribe('resize',function(){
var bb=this.scrollableArea.isScrolledToBottom();
this.adjustScroller();
bb&&this.scrollableArea.scrollToBottom();}.
bind(this)),


ab=p.listen(xa,'blur',function(){
ya.unsubscribe(za);
ab.remove();});}}}.



bind(this);









g.subscribe('ufi/changed',function(xa,ya){
if(this.ufiForm===ya.form)
this.adjustScrollerIfNecessary();}.

bind(this));




g.subscribe('ufi/comment',function(xa,ya){
if(this.ufiForm===ya.form)
if(ya.isranked){
this.scrollableArea.scrollToTop();}else 

this.scrollableArea.scrollToBottom();}.


bind(this));




p.listen(this.rhc,'click',function(event){
var xa=event.getTarget();
if(w.byTag(xa,'a')||
w.byTag(xa,'button')||
n.isNodeOfType(xa,'input'))
this.adjustScrollerIfNecessary();}.

bind(this));



g.subscribe(['reflow','CommentUFI.Pager'],function(){
if(this.isOpen)
this.adjustScroller();}.

bind(this));

p.listen(this.ufiForm,'focusin',wa);},


openHandler:function(wa){
if(this.isOpen||wa.getPath()!='/photo.php'||
this.returningToStart||
wa.getQueryData().closeTheater||
wa.getQueryData().permPage||
wa.getQueryData().makeprofile){
this.openHandlerRegistered=false;
return false;}


this.open(wa);
this._uriStack.push(ia(wa).getQualifiedURI().toString());
v.transitionComplete(true);

return true;},


getImageSrc:function(wa){
if(wa.smallsrc){
if(!wa.size)
return wa.smallsrc;

var xa=ka.deserialize(wa.size),
ya=this.getStageSize(xa);
if(ya.x<=va.STAGE_NORMAL_MAX.x&&
ya.y<=va.STAGE_NORMAL_MAX.y)
return wa.smallsrc;}


return wa.src;},




open:function(wa){
var xa=ia(wa).getQueryData(),
ya=this.getImageSrc(xa);


if(ya){
delete xa.src;
delete xa.smallsrc;}


if(this.resetUriStack)
this._uriStack=[];


if(!this.initialLoad){
xa.firstLoad=true;
this.initialLoad=true;}


this.sessionID=Date.now();
this.loadQuery=na(xa,
{ssid:this.sessionID});


this.isOpen=true;
this.pagersShown=false;
this.refreshOnClose=false;
this.hilitedTag=null;
this.loadingStates={image:false,html:false};
this.replaceUrl=false;



this.stream=new aa();
this.stream.init(x.VIEWER_SNOWLIFT,'PhotoViewerPagelet');
this.fetchInitialData();
this.setLoadingState(va.STATE_HTML,true);

this.rhcCollapsed=false;

j.loadModules
(['fb-photos-snowlift-css'],
this._open.bind(this,wa,ya));

if(this.showEndPivot)
j.loadModules
(['PhotoPivot'],
function(za){
this.pivots=za.getInstance();
if(xa.relevant_count)
this.pivots.setRelevantCount(xa.relevant_count);}.

bind(this));



if(this.enableSnowliftProfilePicCropper)
j.loadModules
(['SnowliftPicCropper'],
function(za){
this.cropper=za.getInstance(this);
this.cropper.init();
if(this.enableCropperOnInit){
var ab=g.subscribe
('PhotoSnowlift.SWITCH_IMAGE',
function(){
if(this.isInProfilePicAlbum){
this.cropper.showPicInProfileAlbumDialog();}else 

this.cropper.enableCropping(this.isUserProfilePic);

g.unsubscribe(ab);}.
bind(this));

this.enableCropperOnInit=false;}}.

bind(this));




j.loadModules
(['PhotosButtonTooltips'],
function(za){
za.init();});},




_open:function(wa,xa){

this.createLoader(xa);

this.spotlight.show();

this.ua&&this.ua.add_event('frame');



g.inform('layer_shown',{type:'PhotoSnowlift'});
g.inform('PhotoSnowlift.OPEN');


this.stageHandlers=
[p.listen(window,'resize',this.adjustForResize.bind(this)),
p.listen(this.stageWrapper,'click',this.buttonListener.bind(this)),
p.listen
(this.stageWrapper,
'mouseleave',
function(event){





this.hidePagers();}.
bind(this)),
p.listen
(this.stageWrapper,
'mousemove',
this.hilitePagerOnMouseMove.bind(this)),
p.listen
(this.stageWrapper,
'mousemove',
this.hiliteTagsOnMouseMove.bind(this)),
p.listen
(this.overlay,
'mouseenter',
this.unhiliteAllTags.bind(this))];


this.stageHandlers.push
(p.listen
(this.container,
'click',
function(event){
var ab=event.getTarget();
if(w.byClass(ab,'rotateRight')){
this.rotate('right');}else
if(w.byClass(ab,'rotateLeft')){
this.rotate('left');}else
if(w.byClass(ab,'closeTheater')){
if(q.isFullScreen()){

q.toggleFullScreen();
return;}

this.closingAction=y.X;
this.closeHandler();
return false;}else
if(this.fullscreen)
if(w.byClass(ab,'fbPhotoSnowliftFullScreen')){
this.toggleFullScreen();}else

if(w.byClass(ab,'fbPhotoSnowliftCollapse'))
this.toggleCollapse();}.


bind(this)));



var ya=ra('fbPhotoSnowliftFeedback');
if(ya)
this.stageHandlers.push
(p.listen
(ya,
'click',
function(event){


if(w.byClass(event.getTarget(),'like_link')||
w.byClass(event.getTarget(),'UFILikeLink'))
this.toggleLikeButton();

var ab=
w.byClass(event.getTarget(),'uiUfiCollapsedComment');
if(ab)
l.addClass(ab,'uiUfiCollapsedCommentToggle');}.

bind(this)));




var za=ra('fbPhotoSnowliftOnProfile');
if(za)
this.stageHandlers.push
(p.listen
(za,
'click',
function(event){
if(w.byClass(event.getTarget(),
'fbPhotoRemoveFromProfileLink'))
this.refreshOnClose=true;}.

bind(this)));








if(this.resetUriStack)
this.startingURI=ia.
getMostRecentURI().
addQueryData({closeTheater:1}).
getUnqualifiedURI();


if(!xa)


this.setLoadingState(va.STATE_IMAGE_DATA,true);


if(!this.transitionHandlerRegistered){
v.registerHandler(this.transitionHandler.bind(this));

this.transitionHandlerRegistered=true;}


y.initLogging(y.SNOWLIFT);

if(this.pivots)
y.setRelevantCount(this.pivots.relevantCount);},



toggleFullScreen:function(){
var wa=q.toggleFullScreen(document.documentElement);
if(wa){
var xa=this.stream.getCurrentImageData();
if(xa&&xa.url&&this.image.src!==xa.url&&
this.shouldShowHiRes(xa))

(new Image()).src=xa.url;

y.logEnterFullScreen(this.stream.getCursor());}},



getStream:function(){
return this.stream;},


fetchInitialData:function(){
this.ua&&this.ua.add_event('init_data');
this.stream.waitForInitData();
ha.loadFromEndpoint
('PhotoViewerInitPagelet',
null,
this.loadQuery,

{usePipe:true,
jsNonblock:true,
crossPage:true});},




toggleCollapse:function(){
if(this.rhcCollapsed){
this.uncollapseRHC();}else 

this.collapseRHC();},



collapseRHC:function(){
this.rhcCollapsed=true;
l.addClass(this.root,'collapseRHC');
this.adjustForResize();},


uncollapseRHC:function(){
this.rhcCollapsed=false;
l.removeClass(this.root,'collapseRHC');
this.adjustForResize();},


closeHandler:function(){
if(!this.isOpen)
return;





this.closingAction=this.closingAction||y.ESC;




if(ia.getMostRecentURI().
addQueryData({closeTheater:1}).
getUnqualifiedURI().
toString()==this.startingURI.toString()){
this.close();
return;}


this.returnToStartingURI(this.refreshOnClose);
this.close();},


returnToStartingURI:function(wa,xa){
if(!wa)
if(xa){
this.squashNextTransition(sa.curry(xa));}else 

this.squashNextTransition();








this.returningToStart=true;

var ya=g.subscribe('page_transition',(function(){
this.returningToStart=false;
ya.unsubscribe();}).
bind(this)),





za=wa||isNaN(ja.opera()),




ab=this._uriStack.length;
if(za&&ab<window.history.length){
window.history.go(-ab);}else{

var bb=this.startingURI,
cb=new ia(bb).removeQueryData('closeTheater');

if(bb.getQueryData().sk=='approve'&&
bb.getPath()=='/profile.php'){
cb.removeQueryData('highlight');
cb.removeQueryData('notif_t');}

sa(cb);}},



squashNextTransition:function(wa){


this.squashNext=true;

v.registerHandler(function xa(){
if(this.squashNext){
this.squashNext=false;
if(wa)
wa.defer();

v.transitionComplete(true);

return true;}


return false;}.


bind(this),7);},


handleNavigateAway:function(wa){

var xa=ma
(v._most_recent_uri.getQualifiedURI(),
wa.getAttribute('href'));



if(this.isOpen&&
(xa instanceof ia)&&
xa.getUnqualifiedURI().toString()!=
this.startingURI.toString()&&
xa.getPath()!='/photo.php'){

if(!this.closingAction)
this.closingAction=y.NAVIGATE;


this.returnToStartingURI(false,xa);
this.close();

return false;}


return true;},


close:function(){
if(!this.isOpen)
return;


this.isOpen=false;

if(this.fullscreen)
q.disableFullScreen();


ua('snowlift').uai('close');

this.cropper&&this.cropper.disableCropping();

this.spotlight.hide();

this.openExplicitly=false;

this.closeDirty=true;
this.closeCleanup.bind(this).defer();},


closeCleanup:function(){
this.closeDirty=false;

l.removeClass(this.root,'dataLoading');


y.logPhotoViews(this.closingAction);

this.destroy();


l.hide(this.errorBox);
l.hide(this.image);
this.currentImageSize=null;
this.thumbSrc=null;
this.shouldStretch=false;
this.resetUriStack=true;

l.removeClass(this.stageWrapper,'showVideo');
n.empty(this.videoStage);

this.uncollapseRHC();



this.currentMinSize=null;
this.rhcMinHeight=null;
this.setStagePagersState('reset');


this.recacheData();
n.empty(this.sideAdUnit);
this.stream.destroy();

var wa=this.closingAction===y.NAVIGATE;
this.closingAction=null;
if(!this.openHandlerRegistered){
v.registerHandler(this.openHandler.bind(this));
this.openHandlerRegistered=true;}

g.inform('layer_hidden',{type:'PhotoSnowlift'});
g.inform('PhotoSnowlift.CLOSE',wa);
this.root.setAttribute('aria-busy','true');},


createLoader:function(wa){
if(this.currentImageSize===null){



this.adjustStageSize(va.STAGE_MIN);}else{



var xa=this.getStageSize(this.currentImageSize);

xa=new ka
(Math.max(xa.x,va.STAGE_MIN.x),
Math.max(xa.y,va.STAGE_MIN.y));


var ya=this.getImageSizeInStage(this.currentImageSize,xa);
if(this.thumbSrc===null){
this.adjustStageSize(ya);}else 

this.useImage
(n.create('img',
{className:'spotlight',
alt:'',
src:this.thumbSrc,
style:
{width:ya.x+'px',
height:ya.y+'px'}}),


ya,
false);}




this.setLoadingState(this.STATE_IMAGE_PIXELS,true);



if(wa)


(function(){



var za=new Image();
za.onload=a.async_callback
(function(){
if(!this.isOpen||this.pendingImageUrl!=wa)
return;




if(!this.stream||!this.stream.errorInCurrent()){
this.switchImage(wa,this.currentImageSize);
this.ua&&this.ua.add_event('image');
this.setLoadingState(va.STATE_IMAGE_DATA,false);}}.

bind(this),
'photo_theater');


za.src=this.pendingImageUrl=wa;}).
bind(this).defer();


l.hide(this.stageActions);
this.setStagePagersState('disabled');},



initDataFetched:function(wa){
y.setPhotoSet(this.stream.getPhotoSet());
y.setLogFbids(wa.logids);

var xa=this.stream.getCurrentImageData();

y.addPhotoView
(xa.info,
this.shouldShowHiRes(xa),
this.fullscreen&&q.isFullScreen());


if(!this.pageHandlers)
this.pageHandlers=
[p.listen
(this.root,'click',this.pageListener.bind(this)),
p.listen
(this.root,'mouseleave',this.mouseLeaveListener.bind(this))];



l.show(this.stageActions);
this.root.setAttribute('aria-busy','false');

this.isLoggedInViewer=wa.loggedin;
this.disableAdsForSession=
wa.disablesessionads||!this.isLoggedInViewer;

this.disableAds=this.disableAdsForSession||wa.fromad;

this.loadAds();},



adjustScrollerIfNecessary:function(){
clearTimeout(this.scrollerTimeout);
this.scrollerTimeout=this.adjustScroller.bind(this).defer();},


adjustScroller:function(){
clearTimeout(this.scrollerTimeout);

this.initializeScroller();
this.scrollableArea.resize();

var wa=ka.getElementDimensions(this.rhc),




xa=wa.y;
xa-=ka.getElementDimensions(this.rhcHeader).y;
xa-=ka.getElementDimensions(this.ufiInputContainer).y;
if(this.productMetadata)
xa-=ka.getElementDimensions(this.productMetadata).y;


this.rhcMinHeight=
wa.y-(xa-va.MIN_UFI_HEIGHT);

xa=Math.max(0,xa);



var ya=ka.getElementDimensions(this.scrollerBody).y;
if(ya>=xa){
fa.set(this.scroller,'height',xa+'px');
l.addClass(this.rhc,'pinnedUfi');
xa=0;}else{

fa.set(this.scroller,'height','auto');
l.removeClass(this.rhc,'pinnedUfi');
xa-=ya;}






var za=ka.getElementDimensions(this.ufiInputContainer).y;
fa.set(this.ufiForm,'padding-bottom',za+'px');


z.resize(new ka(wa.x,xa));

this.scrollableArea.adjustGripper();},


adjustForResize:function(){
this.currentMinSize=null;
this.adjustStageSize();
this.adjustForNewData();},



shouldShowHiRes:function(wa){
if(!wa||!wa.smallurl)
return false;

var xa=this.getStageSize(wa.dimensions),
ya=this.getImageSizeInStage(wa.dimensions,xa);

return (ya.x>va.STAGE_NORMAL_MAX.x||
ya.y>va.STAGE_NORMAL_MAX.y);},




getImageURL:function(wa){
if(wa.video){
return null;}else
if(wa.smallurl&&!this.shouldShowHiRes(wa))


return wa.smallurl;

return wa.url;},


getImageDimensions:function(wa){



if(wa.smalldims&&
(!this.shouldShowHiRes(wa)||
this.image.src===wa.smallurl))
return wa.smalldims;

return wa.dimensions;},




getStageSize:function(wa,xa){
var ya=ka.getViewportDimensions(),


za=new ka(wa.x,wa.y);
if(xa)
za=new ka
(Math.max(wa.x,xa.x),
Math.max(wa.y,xa.y));



var ab,bb;

if(this.fullscreen&&q.isFullScreen()){
return new ka
((this.rhcCollapsed?screen.width:
screen.width-va.SIDEBAR_SIZE_MAX),
screen.height-va.FULL_SCREEN_PADDING*2);}else{




ab=Math.min
(za.x,
this.stageMax.x,
(ya.x-
va.SIDEBAR_SIZE_MAX-va.STAGE_CHROME.x));





bb=Math.min
(za.y,
this.stageMax.y,
ya.y-va.STAGE_CHROME.y);}






if(ab===0&&bb===0)
return new ka(0,0);




var cb=ab/bb,
db=za.x/za.y;
if(cb<db)
return new ka(ab,Math.round(ab/db));



return new ka(Math.round(bb*db),bb);},


getImageSizeInStage:function(wa,xa){
var ya=wa.x,
za=wa.y;

if(ya>=xa.x||za>=xa.y){
var ab=xa.x/xa.y,
bb=ya/za;
if(ab<bb){
ya=xa.x;
za=Math.round(ya/bb);}else
if(ab>bb){
za=xa.y;
ya=Math.round(za*bb);}else{

ya=xa.x;
za=xa.y;}}



return new ka(ya,za);},








adjustStageSize:function(wa){
var xa=this.currentImageSize;


if(wa){
xa=wa;}else{

var ya=this.stream&&this.stream.getCurrentImageData();
if(ya)
xa=this.getImageDimensions(ya);}


if(!xa)
return;

this.currentImageSize=xa;
var za=0;


if(this.shouldStretch&&
!this.getVideoOnStage()&&
xa.x>xa.y&&
xa.x<=va.TIMELINE_STRETCH_WIDTH&&
xa.x>=va.TIMELINE_STRETCH_MIN){
xa.y=Math.round
(xa.y*va.TIMELINE_STRETCH_WIDTH/xa.x);
xa.x=va.TIMELINE_STRETCH_WIDTH;}else
if(this.getVideoOnStage()){


za=va.VIDEO_BOTTOM_BAR_SPACE*2;
xa.y+=za;}



var ab=this.getStageSize(xa,this.currentMinSize);


if(!this.currentMinSize)
this.currentMinSize=new ka(0,0);


if(!this.rhcMinHeight)
this.rhcMinHeight=0;


this.currentMinSize=new ka
(Math.max(ab.x,va.STAGE_MIN.x,this.currentMinSize.x),
Math.max(ab.y,va.STAGE_MIN.y,this.currentMinSize.y));


var bb=this.getImageSizeInStage
(xa,this.currentMinSize),



cb=this.currentMinSize.x-bb.x,
db=this.currentMinSize.y-bb.y;
if(cb>0&&cb<va.PADDING_MIN){
this.currentMinSize.x-=cb;}else
if(db>0&&db<va.PADDING_MIN)
this.currentMinSize.y-=db;


var eb=
n.scry(this.productMetadata,'#fbPhotoSnowliftTaggedProducts .taggee');

if(eb.length)
this.currentMinSize.y=
Math.max(this.currentMinSize.y,this.rhcMinHeight);


var fb=this.currentMinSize.x+va.SIDEBAR_SIZE_MAX;
if(this.rhcCollapsed)
fb=this.currentMinSize.x;



this.snowliftPopup.style.cssText=
'width:'+
fb+'px;'+
'height:'+this.currentMinSize.y+'px;';






var gb=this.currentMinSize.y-za+'px';
if(ja.firefox()||ja.ie()<8){
var hb=fa.get(this.stageWrapper,'font-size');
if(ja.ie()&&hb.indexOf('px')<0){

var ib=n.create('div');
ib.style.fontSize=hb;
ib.style.height='1em';
hb=ib.style.pixelHeight;}

gb=
((this.currentMinSize.y-za)/
parseFloat(hb))+'em';}

this.stageWrapper.style.cssText=
'width:'+this.currentMinSize.x+'px;'+
'line-height:'+gb+';';






if(ja.ie()<8){
fa.set
(this.root,
'height',
ka.getViewportDimensions().y+'px');
fa.set
(this.container,
'min-height',
(this.currentMinSize.y+va.STAGE_CHROME.y)+'px');}


this.image.style.cssText=
'width:'+bb.x+'px;'+
'height:'+bb.y+'px;';

this.adjustScrollerIfNecessary();},


adjustForNewData:function(){
if(!this.image)
return;








var wa=n.scry(this.stage,'div.tagsWrapper')[0],
xa=ka.getElementDimensions(this.image);
if(wa){
fa.set(wa,'width',xa.x+'px');
fa.set(wa,'height',xa.y+'px');

if(ja.ie()<=7){
var ya=n.scry(this.root,'div.tagContainer')[0];
if(ya)
l.conditionClass
(wa,
'ie7VerticalFix',
ka.getElementDimensions(ya).y>xa.y);}}},






setLoadingState:function(wa,xa){
switch(wa){
case va.STATE_IMAGE_PIXELS:
l.conditionClass(this.root,'imagePixelsLoading',xa);
break;

case va.STATE_IMAGE_DATA:
this.loadingStates[wa]=xa;
l.conditionClass(this.root,'imageLoading',xa);
break;

case va.STATE_HTML:
this.loadingStates[wa]=xa;
l.conditionClass(this.root,'dataLoading',xa);
this.rhc.setAttribute('aria-busy',xa?'true':'false');
break;}},



destroy:function(){
this.stageHandlers.forEach(function(wa){
wa.remove();});


if(this.pageHandlers){
this.pageHandlers.forEach(function(wa){
wa.remove();});

this.pageHandlers=null;}},







checkState:function(wa){
if(wa!=va.STATE_ERROR&&!this.loadingStates[wa])
return;


switch(wa){
case va.STATE_IMAGE_DATA:
var xa=this.stream.getCurrentImageData();
if(xa){
var ya=this.getImageURL(xa);
if(ya){
this.switchImage(ya,null,true);}else
if(xa.video)
this.switchVideo(xa.video,true);

this.setLoadingState(wa,false);}

break;

case va.STATE_HTML:
if(this.stream.getCurrentHtml()){
this.swapData();
this.showPagers(va.PAGER_FADE);
this.setLoadingState(wa,false);}

break;



default:if(this.stream.errorInCurrent()){
l.hide(this.image);
l.show(this.errorBox);}

break;
}},


buttonListener:function(event){
var wa=event.getTarget(),
xa=Date.now();
if(w.byClass(wa,'fbPhotoTagApprovalBox'))
return;



if(xa-this.lastPage<350)

return;


if(w.byClass(wa,'fbPhotosPhotoLike')){
this.likePhoto();}else
if(w.byClass(wa,'tagApproveIgnore'))
this.updateTagBox(event,wa);},



likePhoto:function(){
y.addButtonLike();
var wa=la('fbPhotoSnowliftFeedback'),





xa=n.scry(wa,'button.like_link')[0];
if(!xa)


xa=n.scry(wa,'a.UFILikeLink')[0];

var ya=xa.getAttribute('href');
if(q.isFullScreen())


if(ja.chrome())
xa.setAttribute('href','javascript:;');


xa.click();
xa.setAttribute('href',ya);},


toggleLikeButton:function(){
var wa=
n.scry(this.buttonActions,'a.fbPhotosPhotoLike')[0];
if(wa){
l.toggleClass(wa,'viewerLikesThis');
l.removeClass(wa,'viewerAlreadyLikedThis');}},



likePhotoWithKey:function(){
if(this.isShowingLikePhotoConfirmation)
return;

if(this.skipLikePhotoConfirmation){
this.likePhoto();}else 

h.send
(new i('/photos/confirm_like.php'),
function(wa){
this.isShowingLikePhotoConfirmation=true;
wa.subscribe
('confirm',this.onCloseLikePhotoConfirmDialog.bind(this));
wa.subscribe
('cancel',this.onCloseLikePhotoConfirmDialog.bind(this));}.
bind(this));


return false;},


likePhotoSkipConfirmation:function(wa){
this.skipLikePhotoConfirmation=wa;
this.likePhoto();},


onCloseLikePhotoConfirmDialog:function(){
this.isShowingLikePhotoConfirmation=false;},


updateTagBox:function(wa,xa){
this.unhiliteAllTags();

var ya=ra(wa);
if(!ya)
return;


l.addClass(ya,'tagBox');
l.addClass(ya,'tagBoxPendingResponse');
l.removeClass(ya,'tagBoxPending');
l.hide(n.find(ya,'span.tagForm'));

if(xa){
l.show(n.find(ya,'span.tagApproved'));}else 

l.show(n.find(ya,'span.tagIgnored'));},






rotate:function(wa){
var xa=this.stream.getCursor();

if(this.getVideoOnStage()){
var ya=(wa=='left')?270:90;
j.loadModules(['VideoRotate'],function(ab){
new ab(xa).motionRotate(ya);});

return;}


var za=na
({fbid:xa,
cs_ver:x.VIEWER_SNOWLIFT},
this.stream.getPhotoSetQuery());
za[wa]=1;

this.setLoadingState(va.STATE_IMAGE_DATA,true);
this.setLoadingState(this.STATE_IMAGE_PIXELS,true);
l.hide(this.image);

new i('/ajax/photos/photo/rotate/').
setAllowCrossPageTransition(true).
setData(za).
setErrorHandler(this.rotationError.bind(this,xa)).
setFinallyHandler(this.rotationComplete.bind(this,xa)).
setMethod('POST').
setReadOnly(false).
send();},


rotationComplete:function(wa,xa){
if(wa==this.stream.getCursor()){


this.setLoadingState(va.STATE_IMAGE_DATA,false);



this.switchImage(this.getImageURL(this.stream.getCurrentImageData()));
this.swapData();}},



rotationError:function(wa,xa){

if(wa==this.stream.getCursor()){
this.setLoadingState(va.STATE_IMAGE_DATA,false);
this.switchImage(this.getImageURL(this.stream.getCurrentImageData()));


j.loadModules(['AsyncResponse'],function(ya){
ya.defaultErrorHandler(xa);});}},






saveTagsFromPayload:function(wa){
this.storeFromData(wa);

if('data' in wa&&this.stream.getCursor() in wa.data)
this.swapData();},



saveEdit:function(){
if(!l.hasClass(this.root,'fbPhotoSnowliftEditMode'))
return;

j.loadModules
(['PhotoInlineEditor','Form'],
function(wa,xa){
var ya=wa.getInstance(this.getViewerConst());
ya&&xa.bootstrap(ya.getForm().controller);}.
bind(this));},



mouseLeaveListener:function(event){
this.unhiliteAllTags();
this.reHilitePendingTag();},


hilitePagerOnMouseMove:function(event){
var wa=ka.getEventPosition(event),
xa=ka.getElementPosition(this.stage);



if(u.isRTL()){
var ya=ka.getElementDimensions(this.stage);
this.stagePagerPrev=
ya.x-(wa.x-xa.x)<
va.GOPREV_AREA;}else 

this.stagePagerPrev=wa.x-xa.x<
va.GOPREV_AREA;

l.conditionClass(this.prevPager,'hilightPager',this.stagePagerPrev);
l.conditionClass(this.nextPager,'hilightPager',!this.stagePagerPrev);



var za,
ab=event.getTarget();
if(!w.byClass(ab,'snowliftOverlay')&&
!w.byClass(ab,'bottomBarActions')&&
!w.byClass(ab,'snowliftPager'))
za=va.PAGER_FADE;

this.showPagers(za);},


showPagers:function(wa){
clearTimeout(this.fadePagerTimer);
this.setStagePagersState('active');

if(typeof wa!=='undefined')
this.fadePagerTimer=this.hidePagers.bind(this).defer(wa);},



hidePagers:function(){

var wa=n.scry
(this.getRoot(),'.fbPhotosPhotoActionsMenu')[0];
if(wa)
return;


clearTimeout(this.fadePagerTimer);
this.setStagePagersState('inactive');},


getTagger:function(){
if(!this.PhotoTagger)
return null;


var wa=this.PhotoTagger.getInstance(x.VIEWER_SNOWLIFT);
if(!wa||!wa.tagHoverFacebox)
return null;


return wa;},


unhiliteAllTags:function(){
n.scry(this.stage,'div.tagsWrapper div.hover').forEach
(function(xa){
l.removeClass(xa,'hover');});


this.hilitedTag=null;

if(!l.hasClass(this.root,'taggingMode')){
var wa=this.getTagger();
if(wa){
wa.hideTagger();
wa.setCurrentFacebox(null);}}},




switchHilitedTags:function(wa,xa){
if(this.switchTimer!==null){
clearTimeout(this.switchTimer);
this.switchTimer=null;}



this.unhiliteAllTags();

var ya=ra(wa);
if(ya){
this.hilitedTag=wa;

if(!l.hasClass(this.root,'taggingMode')&&
ba.isFacebox(this.hilitedTag)){
var za=this.getTagger();
if(za){
l.addClass(ya,'hover');
var ab=za.getFacebox(wa);
za.setCurrentFacebox(ab);
if(ab)
za.addTagFromFacebox(ab);}}else 



l.addClass(ya,'hover');



if(l.hasClass(ya,'tagBoxPending')&&
!l.hasClass(ya,'showPendingTagName')&&
xa===true){
n.scry(this.stage,'div.tagsWrapper div.showPendingTagName').forEach
(function(bb){
l.removeClass(bb,'showPendingTagName');});


l.addClass(ya,'showPendingTagName');}}},




reHilitePendingTag:function(){

var wa=ra(this.hilitedTag);
if(wa&&l.hasClass(wa,'showPendingTagName'))
return;



var xa=n.scry
(this.stage,'div.tagsWrapper div.showPendingTagName')[0];
if(xa)
this.switchHilitedTags(xa.id);},



hiliteTagsOnMouseMove:function(event){
if(!this.stream.getCurrentExtraData()||this.getVideoOnStage())
return;



if(this.switchTimer!==null)
return;


var wa=event.getTarget();
if(w.byClass(wa,'snowliftOverlay')||
w.byClass(wa,'fbPhotoSnowliftTagApproval')||
w.byClass(wa,'tagPointer')||
w.byClass(wa,'photoTagTypeahead'))
return;





var xa=w.byClass(wa,'tagBoxPending'),
ya=false;
if(this.hilitedTag){
var za=ra(this.hilitedTag);
ya=za&&
l.hasClass(za,'tagBoxPending');}


var ab=
((!this.hilitedTag&&xa)||
(!ya&&xa));


if(ab){
this.switchHilitedTags(xa.id);
return;}


if(xa&&(xa.id==this.hilitedTag))
return;



var bb=250,


cb=ba.absoluteToNormalizedPosition
(this.image,ka.getEventPosition(event));

if(this.currentTagHasPrecedence(cb))
return;


var db=ba.getNearestBox
(this.stream.getCurrentExtraData().tagRects,cb);


if(!db){

if(!ya){
this.unhiliteAllTags();
this.reHilitePendingTag();}


return;}





var eb=null;

if(ya){
var fb={};
fb[this.hilitedTag]=
this.stream.getCurrentExtraData().tagRects[this.hilitedTag];

eb=ba.getNearestBox(fb,cb);}





if(eb!==null&&ya)
return;






if(this.hilitedTag!=db)

if(ya){
this.switchTimer=this.switchHilitedTags.
bind(this,db).
defer(bb);}else{


if(this.showHover){
if(!this.seenTags)
this.seenTags=[];



if(!this.seenTags[db]){
y.addFaceTagImpression();
this.seenTags[db]=true;}}


this.switchHilitedTags(db);}},







currentTagHasPrecedence:function(wa){
if(!this.hilitedTag)
return false;


var xa=
this.stream.getCurrentExtraData().tagRects[this.hilitedTag],


ya=new da
(xa.t+(xa.h()/2),
xa.r,
xa.b+
(ba.isFacebox(this.hilitedTag)?10:0),
xa.l,
xa.domain);

return ya.contains(wa);},


getVideoOnStage:function(){
var wa=this.stream&&this.stream.getCurrentImageData();
return wa&&wa.video;},


shouldPageOnAction:function(wa,xa){
if(!this.isOpen||this.isShowingLikePhotoConfirmation)
return false;


var ya=n.isNode(xa)&&
(w.byClass(xa,'snowliftPager')||
w.byClass(xa,'stagePagers')||
w.byClass(xa,'pivotPageColumn')),
za=n.isNode(xa)&&w.byClass(xa,'stage'),
ab=l.hasClass(xa,'faceBox'),


bb=
((za&&l.hasClass(this.root,'taggingMode'))||
w.byClass(xa,'tagBoxPending')||
w.byClass(xa,'tagBoxPendingResponse')||
w.byClass(xa,'fbPhotoTagApprovalBox')||
w.byClass(xa,'tag')||
(this.cropper&&this.cropper.croppingMode));


if(bb)
return false;



return wa==s.LEFT||
wa==s.RIGHT||
(!l.hasClass(this.root,'taggingMode')&&ab)||
ya||
za;},


keyHandler:function(wa,event){
if(event.getModifiers().any)
return true;

switch(p.getKeyCode(event)){
case s.LEFT:
case s.RIGHT:
if(!this.pagersOnKeyboardNav)
this.showPagers(va.PAGER_FADE);

this.pageListener(event);
return false;
case 76:
return this.likePhotoWithKey();}},



pageListener:function(event){
var wa=p.getKeyCode(event),
xa=event.getTarget();

if(!this.shouldPageOnAction(wa,xa))
return;


var ya=0;

if(wa==s.RIGHT){
ya=1;
y.setPagingAction('key_right');}else
if(wa==s.LEFT){
ya=-1;
y.setPagingAction('key_left');}else
if(w.byClass(xa,'next')){
ya=1;
y.setPagingAction('click_next');}else
if(w.byClass(xa,'prev')){
ya=-1;
y.setPagingAction('click_prev');}else
if(!this.stagePagerPrev){
ya=1;
y.setPagingAction('click_stage');}else{

ya=-1;
y.setPagingAction('click_stage_back');}


if(l.hasClass(this.root,'fbPhotoSnowliftEditMode')||
(this.cropper&&this.cropper.croppingMode)){
this.warnLeavePage(ya);}else{



this.page
(ya,
ja.chrome()&&q.isFullScreen());

ua('snowlift',xa,event).uai(y.pagingAction);}},





warnLeavePage:function(wa){
new m().
setTitle("Are you sure you want to leave this page?").
setBody("You have unsaved changes that will be lost if you leave the page.").
setButtons


([{name:'leave_page',
label:"Leave this Page",
handler:this.page.bind(this,wa)},


{name:'continue_editing',
label:"Stay on this Page",
className:'inputaux'}]).



setModal(true).
show();},


page:function(wa,xa){
if(!this.stream.isValidMovement(wa)){
this.showPagers(va.PAGER_FADE);
return;}


this.lastPage=Date.now();
this.unhiliteAllTags();
this.seenTags=[];


var ya=this.getVideoOnStage();
if(ya)
this.switchVideo(ya,false);



if(this.pivots&&this.pivots.page(wa))


return;



g.inform('PhotoSnowlift.PAGE');
ga.hide();
this.recacheData();


this.stream.moveCursor(wa);

l.hide(this.image);

if(this.stream.errorInCurrent()){


this.setLoadingState(va.STATE_HTML,true);
l.show(this.errorBox);
return;}


var za=this.stream.getCurrentImageData();
if(za){
var ab=this.getImageURL(za);
if(ab){
this.switchImage(ab,null,true);}else
if(za.video)
this.switchVideo(za.video,true);


if(!xa){
this.replaceUrl=true;
sa(za.info.permalink);}

this.setLoadingState(va.STATE_IMAGE_DATA,false);}else{

this.setLoadingState(va.STATE_IMAGE_PIXELS,true);
this.setLoadingState(va.STATE_IMAGE_DATA,true);}


if(this.stream.getCurrentHtml()){
this.swapData();}else 

this.setLoadingState(va.STATE_HTML,true);


this.disableAds=this.disableAdsForSession;

this.loadAds();



if(this.cropper)
this.cropper.resetPhoto();},



logImpressionDetailsForPhoto:function(){
var wa=[].concat
(n.scry(la('fbPhotoSnowliftTagList'),'input.photoImpressionDetails'),
n.scry(la('fbPhotoSnowliftFeedback'),'input.photoImpressionDetails'));

if(wa.length===0)
return;

var xa={};
for(var ya=0;ya<wa.length;ya++)
xa[wa[ya].name]=wa[ya].value;

if(this.getVideoOnStage()){

xa.width=0;
xa.height=0;}else{

var za=this.getImageDimensions
(this.stream.getCurrentImageData());
xa.width=za.x;
xa.height=za.y;}

y.addDetailData(this.stream.getCursor(),xa);
z.setIsLogAdData(true);},


loadAds:function(){
if(this.disableAds)
return;


z.loadAdsFromUserActivity();},


transitionHandler:function(wa){
if(wa.getQueryData().closeTheater||
wa.getQueryData().permPage||
wa.getQueryData().makeprofile||
this.returningToStart){
if(this.isOpen)
this.close();


this.transitionHandlerRegistered=false;
return false;}




if(this.replaceUrl){
this.replaceUrl=false;
this._uriStack.push(wa.getQualifiedURI().toString());
v.transitionComplete(true);
return true;}




var xa=this._uriStack.length;
if(xa>=2&&this._uriStack[xa-2]==
wa.getQualifiedURI().toString())
this._uriStack.pop();




var ya=this.stream.getCursorForURI
(wa.getUnqualifiedURI().toString());
if(ya){
var za=this.stream.getRelativeMovement(ya);

this.page(za,true);
v.transitionComplete(false);
return true;}





if(this.isOpen){
v.transitionComplete(true);
this.close();
return true;}


this.transitionHandlerRegistered=false;
return false;},


recacheData:function(){
if(!this.loadingStates.html){
var wa=this.stream.getCurrentHtml();
for(var xa in wa){
wa[xa]=oa(la(xa).childNodes);
n.empty(la(xa));}}},




reloadIfTimeout:function(){
if(!r.hasLoaded(this.image)){
var wa=this.makeNewImage(this.image.src,true);




p.listen
(wa,
'load',
this.useImage.bind(this,wa,null,true));}},




useImage:function(wa,xa,ya){

if(ya&&r.hasLoaded(this.image))
return;


n.replace(this.image,wa);
this.image=wa;
g.inform('Amoeba/instrument',
[this.image,'image'],
g.BEHAVIOR_PERSISTENT);


this.adjustStageSize(xa);},


makeNewImage:function(wa,xa){
if(this.imageLoadingTimer){
clearTimeout(this.imageLoadingTimer);
this.imageLoadingTimer=null;}else
if(!xa)
this.imageRefreshTimer=setTimeout
(this.reloadIfTimeout.bind(this),
va.LOADING_TIMEOUT);



var ya=
n.create('img',
{className:'spotlight',
alt:''});



ya.setAttribute('aria-describedby','fbPhotosSnowliftCaption');
ya.setAttribute('aria-busy','true');

p.listen(ya,'load',
a.async_callback
(function(){
clearTimeout(this.imageRefreshTimer);
this.image.setAttribute('aria-busy','false');
this.setLoadingState(this.STATE_IMAGE_PIXELS,false);
(function(){
if(this.isOpen){
this.adjustStageSize();

this.adjustForNewData();}}).

bind(this).defer();}.
bind(this),
'photo_theater'));





ya.src=wa;

return ya;},


switchImage:function(wa,xa,ya){
l.hide(this.image);
l.hide(this.errorBox);
this.setLoadingState(this.STATE_IMAGE_PIXELS,true);

var za=this.stream&&this.stream.getCurrentImageData();
if(za)
y.addPhotoView
(za.info,
this.shouldShowHiRes(za),
this.fullscreen&&q.isFullScreen());



this.useImage
(this.makeNewImage(wa,false),
xa,
false);

if(ya)
this.stream.preloadImages
(this.shouldShowHiRes(za));


if(this.cropper&&this.cropper.croppingMode)
this.cropper.resetPhoto();

g.inform('PhotoSnowlift.SWITCH_IMAGE');},










switchVideo:function(wa,xa){
var ya='swf_'+wa;
if(xa){
l.addClass(this.stageWrapper,'showVideo');
var za=n.create
('div',{className:'videoStageContainer'});
n.appendContent(this.videoStage,za);
za.id=wa;
if(window[ya]&&!ra(ya))
window[ya].write(wa);




this.adjustStageSizeForVideo.bind(this,ya).defer();}else{

window[ya]&&window[ya].addVariable('video_autoplay',0);
this.videoLoadTimer&&clearTimeout(this.videoLoadTimer);
n.empty(this.videoStage);
l.removeClass(this.stageWrapper,'showVideo');}},



checkVideoStatus:function(wa){
if(this.videoLoadTimer)
clearTimeout(this.videoLoadTimer);

var xa=this.getVideoOnStage();
if(!xa){

return;}else{

var ya='swf_'+xa;

if(wa!==ya)
return;

this.adjustStageSizeForVideo(wa);}},



adjustStageSizeForVideo:function(wa){
var xa=ra(wa);


if(!xa){
this.videoLoadTimer=setTimeout
(this.checkVideoStatus.bind(this,wa),200);}else 

this.adjustStageSize
(new ka(xa.width,xa.height));},



handleServerError:function(wa,xa){
n.setContent(this.errorBox,wa);
this.storeFromData(xa);},


swapData:function(){
var wa,xa=this.stream.getCurrentHtml();

if(xa){







this.setLoadingState(va.STATE_HTML,false);

for(var ya in xa){
wa=ra(ya);
wa&&n.setContent(wa,xa[ya]);}





g.inform
('PhotoSnowlift.DATA_CHANGE',
this.stream.getCurrentImageData().info,
g.BEHAVIOR_STATE);

if(this.stream.getCurrentExtraData())
g.inform
('PhotoSnowlift.EXTRA_DATA_CHANGE',
this.stream.getCurrentExtraData(),
g.BEHAVIOR_STATE);}




this.adjustScroller();
this.adjustStageSize();
this.scrollableArea.showScrollbar(false);
this.adjustForNewData();
this.logImpressionDetailsForPhoto();},


updateTotalCount:function(wa,xa,ya){

var za=this.stream.getCurrentHtml();
if(za){
var ab=la('fbPhotoSnowliftPositionAndCount');
n.replace(ab,ya);
ab=ya;
l.show(ab);

var bb='fbPhotoSnowliftPositionAndCount';
za[bb]=oa(ab.childNodes);}

this.stream.setTotalCount(wa);
this.stream.setFirstCursorIndex(xa);},


addPhotoFbids:function(wa,xa,ya,za){



if(za&&this.sessionID&&za!=this.sessionID)
return;








var ab=this.stream.getCursor()===null;
this.stream.attachToFbidsList(wa,xa,ya);
if(ya&&ab)
this.page(0,true);


if(this.pivots&&ya)


this.pivots.setCycleCount(this.stream.calculateDistance
(this.stream.getCursor(),
this.stream.firstCursor));





if(!this.pagersShown&&this.stream.canPage())
this.setStagePagersState('ready');},



attachTagger:function(wa){
n.appendContent(this.stageActions,wa);},


storeFromData:function(wa){
if(!this.isOpen)
return;






if(wa.ssid&&this.sessionID&&this.sessionID!=wa.ssid)
return;



var xa=this.stream.storeToCache(wa);

if('error' in xa){
this.checkState(va.STATE_ERROR);
return;}



if('init' in xa){
this.initDataFetched(xa.init);
if(this.openExplicitly){
this.replaceUrl=true;
sa(this.stream.getCurrentImageData().info.permalink);}

if(this.stream.canPage())


this.setStagePagersState('ready');

this.ua&&this.ua.add_event('ufi');}


if('image' in xa)
this.checkState(va.STATE_IMAGE_DATA);


if('data' in xa)
this.checkState(va.STATE_HTML);},



setStagePagersState:function(wa){
switch(wa){
case 'ready':
l.addClass(this.root,'pagingReady');
this.pagersShown=true;

this.ua&&this.ua.add_event('arrows');
return;

case 'active':
l.addClass(this.root,'pagingActivated');
return;

case 'inactive':
l.removeClass(this.root,'pagingActivated');
return;

case 'disabled':
case 'reset':
l.removeClass(this.root,'pagingReady');
return;}},



deletePhoto:function(wa){
this.closeRefresh();},


closeRefresh:function(){
this.refreshOnClose=true;




this.closeHandler();},


onHiliteTag:function(wa,xa){
if(xa.version!=x.VIEWER_SNOWLIFT)
return;

var ya=xa.tag;
if(ya)
this.switchHilitedTags(ya,true);},



onUpdateTagBox:function(wa,xa){
if(xa.version==x.VIEWER_SNOWLIFT)
this.updateTagBox(xa.id,xa.approve);}});




e.exports=va;});

/** js/ui/xhp/button/ButtonGroup.js */
__d("ButtonGroup",["function-extensions","copyProperties","createArrayFrom","CSS","DataStore","Parent"],function(a,b,c,d,e,f){





b('function-extensions');
var g=b('copyProperties'),
h=b('createArrayFrom'),
i=b('CSS'),
j=b('DataStore'),
k=b('Parent'),

l='firstItem',
m='lastItem';


function n(s,t){
var u=k.byClass(s,t);
if(!u)
throw new Error('invalid use case');

return u;}



function o(s){
return i.shown(s)&&h(s.childNodes).some(i.shown);}



function p(s){
var t,u,v;
h(s.childNodes).forEach(function(w){
v=o(w);

i.removeClass(w,l);
i.removeClass(w,m);
i.conditionShow(w,v);

if(v){
t=t||w;
u=w;}});



t&&i.addClass(t,l);
u&&i.addClass(u,m);
i.conditionShow(s,t);}



function q(s,t){
var u=n(t,'uiButtonGroupItem');
s(u);
p(u.parentNode);}







function r(s){
this._root=n(s,'uiButtonGroup');
j.set(this._root,'ButtonGroup',this);
p(this._root);}










r.getInstance=function(s){
var t=n(s,'uiButtonGroup'),
u=j.get(t,'ButtonGroup');
return u||new r(t);};


g(r.prototype,





{hideItem:q.curry(i.hide),






showItem:q.curry(i.show),






toggleItem:q.curry(i.toggle)});


e.exports=r;});

/** js/profile/timeline/modules/TimelineStickyHeaderNav.js */
__d("TimelineStickyHeaderNav",["array-extensions","Event","function-extensions","Arbiter","ButtonGroup","CSS","DOM","Parent","Selector","Style","TimelineConstants","TimelineController","TimelineLegacySections","URI","UserAgent","Vector","ge","tx"],function(a,b,c,d,e,f){



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

var h=b('Arbiter'),
i=b('ButtonGroup'),
j=b('CSS'),
k=b('DOM'),
l=b('Parent'),
m=b('Selector'),
n=b('Style'),
o=b('TimelineConstants'),
p=b('TimelineController'),
q=b('TimelineLegacySections'),
r=b('URI'),
s=b('UserAgent'),
t=b('Vector'),

u=b('ge'),
v=b('tx'),

w=false,
x,
y,



z,

aa,
ba,
ca,
da,
ea,
fa,
ga,
ha,
ia={},
ja={},
ka=[],
la=false,
ma=[],
na=[],

oa=[],
pa=[],
qa=[],

ra=
["January","February","March","April",
"May","June","July","August",
"September","October","November","December"];


function sa(event){
var hb=l.byTag(event.getTarget(),'a');
if(hb){
p.navigateToSection(hb.getAttribute('data-key'));
event.prevent();}}



function ta(hb,ib){
var jb=m.getValue(ib);
if(jb==='allStories')
q.get(hb).expandSubSections();

if(jb!=='activityLog')
ua(ib);}








function ua(hb){
eb(hb,'highlights');
eb(hb,'allStories');
var ib=k.find(hb,'li.separator');
j.conditionShow(ib,ib.previousSibling);}


function va(hb){
if(fa[hb]&&!y.custom_subsection_menu){
bb(hb);}else 

ya();

p.adjustStickyHeaderWidth();}


function wa(hb,ib){
var jb=ib.key;
if(ga[jb]){
cb(jb);
va(jb);}}



function xa(hb,ib){
var jb=ib.scrubberKey;
cb(jb);
if(z===jb)







va(jb);}



function ya(){
aa.hideItem(da);}


function za(hb){
var ib=hb.split('_');
return ra[ib.pop()-1];}


function ab(hb){
var ib=ea[hb],
jb=fa[hb];
if(!ib&&jb){
ib=ea[hb]=da.cloneNode(true);
var kb=k.scry(ib,'li.activityLog a')[0];
if(kb)
kb.href=
r(kb.href).addQueryData({key:hb});


var lb=p.getCurrentScrubber();
if(jb.length)
j.show(k.find(ib,'li.separator'));

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

ob=lb?
lb.getLabelForSubnav(jb[mb].parentKey,nb):
ob=za(nb);

if(ob)
db(ib,{key:nb,label:ob});}



if(fb()){
ua(ib);

m.setSelected(ib,k.scry(ib,'option')[1].value,true);}


qa.push
(m.listen
(ib,
'change',
ta.curry(hb,ib)));


oa.push(g.listen(ib,'click',sa));}

return ib;}


function bb(hb){
var ib=ab(hb);

k.insertAfter(da,ib);

j.hide(da);
for(var jb in ea){
var kb=ea[jb];
j.conditionShow(kb,kb===ib);}


aa.showItem(da);}


function cb(hb){
fa[hb]=
q.get(hb).subSections;}





function db(hb,ib){
var jb=k.create('a',
{href:'#',rel:'ignore',className:'itemAnchor',tabIndex:0},
k.create('span',{className:'itemLabel fsm'},ib.label));

jb.setAttribute('data-key',ib.key);
jb.setAttribute('aria-checked',false);
var kb=k.create('li',
{className:'uiMenuItem uiMenuItemRadio uiSelectorOption'},
jb);

kb.setAttribute('data-label',ib.label);
var lb=k.find(hb,'ul.uiMenuInner'),

mb=k.create('option',{value:ib.key},ib.label),
nb=k.find(hb,'select');

if(ib.key==='recent'){

k.prependContent(lb,kb);

k.insertAfter(nb.options[0],mb);}else{

k.appendContent(lb,kb);
k.appendContent(nb,mb);}}



function eb(hb,ib){
var jb=k.scry(hb,'li.uiMenuItem');
if(!jb)
return;

for(var kb=0;kb<jb.length;kb++){
var lb=jb[kb];
if(j.hasClass(lb,ib)||
lb.firstChild.getAttribute('data-key')==ib){
k.remove(lb);
break;}}



var mb=k.find(hb,'select'),
nb=k.scry(mb,'option');
for(kb=0;kb<nb.length;kb++)
if(nb[kb].value===ib){
k.remove(nb[kb]);
return;}}




function fb(){
return p.getCurrentKey()==='allactivity'||
p.getCurrentKey()==='approve';}


var gb=
{init:function(hb,ib){
if(w)
return;

w=true;
x=hb;
y=ib||{};
ba=k.find(x,'div.pageMenu');
ca=k.find(x,'div.sectionMenu');
da=k.find(x,'div.subsectionMenu');
ha=k.find(ba,'li.uiMenuSeparator');
aa=i.getInstance(ba);

ea={};
fa={};
ga={};
gb.adjustMenuHeights();

p.register
(p.STICKY_HEADER_NAV,
gb);


na.forEach(function(jb){
jb();});},



reset:function(){
w=false;
y={};
ka=[];
ia={};
ja={};
la=false;
ma=[];
x=null;
ba=null;
ca=null;
da=null;
ha=null;
ea={};
fa={};
ga={};

while(oa.length)
oa.pop().remove();

pa.forEach(h.unsubscribe);
qa.forEach(m.unsubscribe.bind(m));},



addTimePeriods:function(hb){
if(!hb.length)
return;


if(y.pull_from_scrubber){

k.setContent(k.find(ca,'ul.uiMenuInner'),'');
k.remove(k.find(ca,'select').children[1]);

while(hb.length){
var ib=hb.shift();
ib&&gb.addTimePeriod(ib);}

aa.showItem(ca);}


var jb=m.getSelectorMenu(ca);
oa.push(g.listen(jb,'click',sa));

var kb=fb()?
o.SECTION_REGISTERED:
o.SECTION_LOADED,

lb=fb()?
xa:
wa;

pa.push(h.subscribe
(kb,
lb));},



addTimePeriod:function(hb){
var ib=p.getCurrentScrubber();
if(!ib)
return;

var jb=ib.getLabelForNav(hb);
if(!jb)
return;


db(ca,{key:hb,label:jb});

var kb=k.find(ca,'ul.uiMenuInner');
if(hb==='recent'||kb.children.length<2)
m.setSelected(ca,hb,true);},



updateSection:function(hb,ib){
if(ib){



var jb=ab(hb);
if(jb){
m.setSelected(jb,ib);
ua(jb);}else 

z=hb;}else{


ga[hb]=true;
cb(hb);}


m.setSelected(ca,hb,true);
va(hb);},


adjustMenuHeights:function(){
if(s.ie()<=7)
return;

[ba,ca].forEach(function(hb){
var ib='';
if(!j.hasClass(document.documentElement,'tinyViewport')){
ib=
t.getViewportDimensions().y-
t.getElementDimensions(u('blueBar')).y-
80;
ib+='px';}

n.set(k.find(hb,'ul.uiMenuInner'),'maxHeight',ib);});},



initPageMenu:function(hb,ib){
if(!w){
na.push
(gb.initPageMenu.curry(hb,ib));

return;}


function jb(kb,lb){
kb.forEach(function(mb){
var nb=ja[mb]=k.create('li');
j.hide(nb);
lb?
k.insertBefore(ha,nb):
k.appendContent(k.find(ba,'ul.uiMenuInner'),nb);});}



jb(hb,true);
jb(ib,false);

ia.info=k.scry(ba,'li')[0];
ka=ib;

la=true;
if(ma.length)
ma.forEach(function(kb){
gb.registerPageMenuItem(kb.key,kb.item);});},




registerPageMenuItem:function(hb,ib){
if(!la){
ma.push({key:hb,item:ib});
return;}

if(ja[hb]){
k.replace(ja[hb],ib);
ia[hb]=ib;
delete ja[hb];

if(ka.indexOf(hb)>=0)
j.show(ha);}},




removeTimePeriod:function(hb){
eb(ca,hb);}};



e.exports=gb;});

/** js/ui/xhp/button/ButtonGroupMonitor.js */
__d("ButtonGroupMonitor",["ContextualDialog","ContextualLayer","CSS","Layer","Parent","Selector"],function(a,b,c,d,e,f){



var g=b('ContextualDialog'),
h=b('ContextualLayer'),
i=b('CSS'),
j=b('Layer'),
k=b('Parent'),
l=b('Selector');

function m(n){
var o=
k.byClass(n,'bg_stat_elem')||
k.byClass(n,'uiButtonGroup');

o&&i.toggleClass(o,'uiButtonGroupActive');}


j.subscribe
(['hide','show'],
function(n,o){
if(o instanceof h||o instanceof g)
m(o.getCausalElement());});




l.subscribe
(['close','open'],
function(n,o){
m(o.selector);});});

/** js/ui/xhp/layer/spotlight/Spotlight.js */
__d("Spotlight",["JSXDOM","Arbiter","ArbiterMixin","Class","DOM","Layer","LayerAutoFocus","LayerTabIsolation","ModalLayer","Vector","copyProperties","csx","cx"],function(a,b,c,d,e,f){var g=b('JSXDOM'),




h=b('Arbiter'),
i=b('ArbiterMixin'),
j=b('Class'),
k=b('DOM'),
l=b('Layer'),
m=b('LayerAutoFocus'),
n=b('LayerTabIsolation'),
o=b('ModalLayer'),
p=b('Vector'),

q=b('copyProperties'),
r=b('csx'),
s=b('cx');

function t(v,w){
this.parent.construct(this,v,w);
this.stageMinSize=new p(0,0);
this.stagePadding=new p(0,0);}


j.extend(t,l);

q(t.prototype,i,
{stageMinSize:null,
stagePadding:null,

_buildWrapper:function(v,w){

return (g.div({className:"_n8 _3qx",children:
g.div({className:"_n9",children:
w})}));},





_getDefaultBehaviors:function(){
return this.parent._getDefaultBehaviors().concat
([u,
m,
n,
o]);},



getContentRoot:function(){
if(!this._content)
this._content=k.find(this.getRoot(),"div._n3");

return this._content;},


configure:function(v){
if(v.stageMinSize)
this.stageMinSize=v.stageMinSize;

if(v.stagePadding)
this.stagePadding=v.stagePadding;},



onContentLoaded:function(){
this.inform('content-load');},


updatePermalink:function(v){
this.inform('permalinkchange',v);}});







function u(v){
this._layer=v;}


q(u.prototype,
{_subscription:null,
enable:function(){
this._subscription=this._layer.subscribe
(['show','hide'],
function(v,w){
if(v==='show'){
h.inform('layer_shown',{type:'Spotlight'});}else 

h.inform('layer_hidden',{type:'Spotlight'});});},




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



e.exports=t;});
