YUI.add("flickr-galleries-getContext-fetcher",function(e,t){"use strict";function n(t){var n={gallery_id:t.compoundId,photo_id:t.photoId,extras:e.APIHelper.request.getRebootPhotoExtras(),num_prev:t.numPrev,num_next:t.numNext};return n}function r(t,n){var r=t[0],i=t[1],s=t[2],o=t[3],u=t[4],a=t[5],f=t[6],l=[],c=[],h=s.proxy(n.photoId),p,d,v,m,g,y,b=[];return p=r.nextphotos,d=r.prevphotos,c=e.APIHelper.response.parsePhotos({photos:p.photo,personModelRegistry:o,photoModelRegistry:s,photoEngagementModelRegistry:u,photoStatsModelRegistry:a,photoCurationModelRegistry:f}),l=e.APIHelper.response.parsePhotos({photos:d.photo,personModelRegistry:o,photoModelRegistry:s,photoEngagementModelRegistry:u,photoStatsModelRegistry:a,photoCurationModelRegistry:f}),y=i.getValue(n.id,"photoContextList"),m=y.hasMinBoundary?y.hasMinBoundary():!1,g=y.hasMaxBoundary?y.hasMaxBoundary():!1,v=y.getList(),b=e.APIHelper.response.addOrReplaceListByContext({model:h,next:c,prev:l.reverse(),current:v,hasMin:m,hasMax:g,numNext:n.numNext,numPrev:n.numPrev}),i.setValue(n.id,"photoContextList",b),{next:c,previous:l.reverse()}}function i(n,r){var i=this;return e.Promise.all([r.callAPI("flickr.galleries.getContext",this._processParams(n),!0),r.getModelRegistry("gallery-models"),r.getModelRegistry("photo-models"),r.getModelRegistry("person-models"),r.getModelRegistry("photo-engagement-models"),r.getModelRegistry("photo-stats-models"),r.getModelRegistry("photo-curation-models")]).then(function(e){return i._processResponse(e,n)},function(e){throw e.code===3&&e.message==="Photo not in gallery"&&(e.notInContext=!0),e}).then(null,e.FetcherErrorLogger(t))}e.namespace("ListFetchers")["flickr-galleries-getContext"]={run:i,_processParams:n,_processResponse:r}},"@VERSION@",{requires:["flickr-promise","api-helper"],optional:["gallery-models","photo-models","person-models","photo-engagement-models","photo-stats-models","photo-curation-models"]});
YUI.add("photo-galleries-models",function(e){function t(e){t.superclass.constructor.call(this,e)}e.Models[this.name]=t,e.extend(t,e.FlickrModelRegistry,{name:this.name,remote:{read:function(t){return e.ModelFetchers["flickr-photos-getAllContexts"].run(t,this.appContext)}},attributes:{id:{},galleries:{isListProxy:!0},total:{validator:function(t){return e.AttributeHelpers.validateInteger(t)},setter:function(t){return e.AttributeHelpers.coerceInteger(t)},defaultValue:0}}})},"@VERSION@",{requires:["api-helper","flickr-model-registry","flickr-promise","flickr-photos-getAllContexts-fetcher"]});
YUI.add("flickr-galleries-addPhoto-creator",function(e,t){"use strict";function n(n,r){var i={},s=n.galleryCompoundID.split("-").pop();return i.photo_id=n.photoID,i.gallery_id=n.galleryCompoundID,e.Promise.all([r.callAPI("flickr.galleries.addPhoto",i),r.getModel("gallery-models",s),r.getModel("photo-models",n.photoID),r.getModelRegistry("photo-galleries-models"),r.getModelRegistry("photo-contexts-models")]).then(function(t){var r=t[0],i=t[1],o=t[2],u=t[3],a=t[4],f,l;if(r.stat==="ok")return i&&!i.hasPhoto(o.getValue("id"))&&(i.addPhoto(o),o.getValue("isVideo")?i.setValue("videoCount",i.getValue("videoCount")+1):i.setValue("photoCount",i.getValue("photoCount")+1),1===i.getValue("photoCount")+i.getValue("videoCount")&&(f=o.getValue("sizes"),l={},e.Object.each(f,function(e,t){["m","s","sq","t"].indexOf(t)>-1&&(l[t]={width:e.width,height:e.height,src:e.url})}),i.setValue("primary",s),i.setValue("primaryPhotoSizes",l))),u.exists(n.photoID)&&!u.getValue(n.photoID,"galleries").getFromListByID(i.getValue("id"))&&(u.getValue(n.photoID,"galleries").prependToList(i),u.setValue(n.photoID,"total",u.getValue(n.photoID,"total")+1)),a.exists(n.photoID)&&!a.getValue(n.photoID,"contexts").getFromListByID(i.getValue("id"))&&(a.setValue(n.photoID,"totalGalleries",a.getValue(n.photoID,"totalGalleries")+1),a.getValue(n.photoID,"contexts").appendToList(i)),i},e.FetcherErrorLogger(t))}e.namespace("ModelCreators")["flickr-galleries-addPhoto"]={run:n}},"@VERSION@",{requires:["flickr-promise"],optional:["gallery-models","photo-models","photo-galleries-models","photo-contexts-models"]});
YUI.add("flickr-galleries-removePhoto-deletor",function(e,t){"use strict";function n(n,r){var i={},s=n.galleryCompoundID.split("-").pop();return i.photo_id=n.photoID,i.gallery_id=n.galleryCompoundID,e.Promise.all([r.callAPI("flickr.galleries.removePhoto",i),r.getModel("gallery-models",s),r.getModel("photo-models",n.photoID),r.getModelRegistry("photo-galleries-models"),r.getModelRegistry("photo-contexts-models")]).then(function(e){var t=e[0],r=e[1],i=e[2],o=e[3],u=e[4];if(t.stat==="ok")return u.exists(n.photoID)&&u.getValue(n.photoID,"contexts").getFromListByID(s)&&(u.setValue(n.photoID,"totalGalleries",u.getValue(n.photoID,"totalGalleries")-1),u.getValue(n.photoID,"contexts").removeFromList(s)),o.exists(n.photoID)&&o.getValue(n.photoID,"galleries").getFromListByID(s)&&(o.setValue(n.photoID,"total",o.getValue(n.photoID,"total")-1),o.getValue(n.photoID,"galleries").removeFromList(s)),r&&(r.hasPhoto(i.getValue("id"))&&r.removePhoto(i),i.getValue("isVideo")?r.setValue("videoCount",r.getValue("videoCount")-1):r.setValue("photoCount",r.getValue("photoCount")-1),0===r.getValue("photoCount")+r.getValue("videoCount")&&(r.setValue("primary",null),r.setValue("primaryPhotoSizes",{}))),r},e.FetcherErrorLogger(t))}e.namespace("ModelCreators")["flickr-galleries-removePhoto"]={run:n}},"@VERSION@",{requires:["flickr-promise"],optional:["gallery-models","photo-models","photo-galleries-models","photo-contexts-models"]});
YUI.add("flickr-galleries-getList-fetcher",function(e,t){"use strict";function n(t,n){var r=t[0],i=t[1],s=t[2],o=t[3],u=r.galleries,a=n.id,f,l={},c=[];u&&(f=o.exists(a)?o.proxy(a):o.add(a),u.gallery&&e.Array.each(u.gallery,function(t,n){var r,i;r=t.id.split("-")[1],i={id:r,compoundId:t.id,title:t.title.content,description:t.description.content,owner:f,primary:t.primaryPhotoId,primaryPhotoSizes:e.APIHelper.response.parsePrimaryPhotoSizes(t),photoCount:t.countPhotos,videoCount:t.countVideos},c.push(s.addOrUpdate(i))}),l={id:a,galleries:c},i.exists(a)?i.setValues(a,l):i.add(l))}function r(n,r){var i=this,s={user_id:n.id,primary_photo_extras:"url_sq, url_t, url_s, url_m"};return e.Promise.all([r.callAPI("flickr.galleries.getList",s),r.getModelRegistry("person-galleries-models"),r.getModelRegistry("gallery-models"),r.getModelRegistry("person-models")]).then(function(e){i._processResponse(e,n)},e.FetcherErrorLogger(t))}e.namespace("ListFetchers")["flickr-galleries-getList"]={run:r,_processResponse:n}},"@VERSION@",{requires:["flickr-promise","api-helper"],optional:["person-galleries-models","gallery-models","person-models"]});
YUI.add("person-galleries-models",function(e){function t(e){t.superclass.constructor.call(this,e)}e.Models[this.name]=t,e.extend(t,e.FlickrModelRegistry,{name:this.name,remote:{read:function(t){return e.ListFetchers["flickr-galleries-getList"].run(t,this.appContext)}},attributes:{id:{},galleries:{isListProxy:!0}}})},"@VERSION@",{requires:["flickr-model-registry","flickr-promise","flickr-galleries-getList-fetcher"]});
YUI.add("flickr-galleries-create-creator",function(e,t){"use strict";function n(n,r){var i={};return i.title=n.title,i.description=n.description,i.primary_photo_id=n.photoID,i.full_result=1,e.Promise.all([r.callAPI("flickr.galleries.create",i),r.getModelRegistry("gallery-models"),r.getModel("photo-models",n.photoID),r.getModel("person-models",r.getViewer().nsid),r.getModel("person-galleries-models",r.getViewer().nsid),r.getModelRegistry("photo-galleries-models"),r.getModelRegistry("photo-contexts-models")]).then(function(t){var r=t[0],i=t[1],s=t[2],o=t[3],u=t[4],a=t[5],f=t[6],l,c=r.gallery.id,h=c.split("-")[1];return h?(l=i.add({id:h,compoundId:c,title:r.gallery.title.content,description:r.gallery.description.content,photoPageList:[s],photoContextList:[s],owner:o,primary:n.photoID,primaryPhotoSizes:e.APIHelper.response.parsePrimaryPhotoSizes(r.gallery),photoCount:s.getValue("isVideo")?0:1,videoCount:s.getValue("isVideo")?1:0}),u.getValue("galleries").prependToList(l),a.exists(n.photoID)&&!a.getValue(n.photoID,"galleries").getFromListByID(l.getValue("id"))&&(a.getValue(n.photoID,"galleries").prependToList(l),a.setValue(n.photoID,"total",a.getValue(n.photoID,"total")+1)),f.exists(n.photoID)&&!f.getValue(n.photoID,"contexts").getFromListByID(l.getValue("id"))&&(f.setValue(n.photoID,"totalGalleries",f.getValue(n.photoID,"totalGalleries")+1),f.getValue(n.photoID,"contexts").appendToList(l)),l):!1},e.FetcherErrorLogger(t))}e.namespace("ModelCreators")["flickr-galleries-create"]={run:n}},"@VERSION@",{requires:["flickr-promise","api-helper"],optional:["gallery-models","photo-models","person-models","person-galleries-models","photo-galleries-models","photo-contexts-models"]});
YUI.add("gallery-models",function(e){function t(e){t.superclass.constructor.call(this,e)}e.Models[this.name]=t,e.extend(t,e.FlickrModelRegistry,{langBundles:this.details.langBundles,name:this.name,remote:{read:function(t){return e.ListFetchers["flickr-galleries-getPhotos"].run(t,this.appContext)},create:function(t,n){return e.ModelCreators["flickr-galleries-create"].run(t,n)},addPhoto:function(t,n){return e.ModelCreators["flickr-galleries-addPhoto"].run(t,n)},removePhoto:function(t,n){return e.ModelCreators["flickr-galleries-removePhoto"].run(t,n)}},addPhoto:function(e,t){return this.getValue(e,"photoPageList").hasMaxBoundary()&&this.getValue(e,"photoPageList").appendToList(t),this.getValue(e,"photoContextList").hasMaxBoundary()&&this.getValue(e,"photoContextList").appendToList(t),this},removePhoto:function(e,t){return this.getValue(e,"photoPageList").removeFromList(t.getValue("id")),this.getValue(e,"photoContextList").removeFromList(t.getValue("id")),this},hasPhoto:function(e,t){return this.getValue(e,"photoPageList").getFromListByID(t)||this.getValue(e,"photoContextList").getFromListByID(t)},attributes:{compoundId:{validator:function(t,n){return e.Lang.isString(t)&&t.indexOf("-")>-1}},displayType:{readOnly:!0,defaultFn:function(){return"gallery"}},title:{validator:function(t,n){return e.AttributeHelpers.validateString(t)},setter:function(t){var n=e.AttributeHelpers.coerceString(t);return n=n.replace(/\\'/,"'").replace(/\\"/,'"').replace(/\\\\/,"\\"),n},defaultValue:""},description:{validator:function(t,n){return e.AttributeHelpers.validateString(t)},setter:function(t){return e.AttributeHelpers.coerceString(t)},defaultValue:""},owner:{isModel:!0},photoPageList:{isListProxy:!0,pageFetch:{listFetcher:e.ListFetchers["flickr-galleries-getPhotos"]}},photoContextList:{isListProxy:!0,contextFetch:{listFetcher:e.ListFetchers["flickr-galleries-getContext"],listItemIdField:"photoId"}},photoCount:{validator:function(t,n){return e.AttributeHelpers.validateInteger(t)},setter:function(t,n){return e.AttributeHelpers.coerceInteger(t)}},videoCount:{validator:function(t){return e.AttributeHelpers.validateInteger(t)},setter:function(t){return e.AttributeHelpers.coerceInteger(t)}},photoCountDisplay:{readOnly:!0,derivedBy:["owner"],defaultFn:function(e){var t=this.getValue(e,"photoCount"),n=this.getValue(e,"videoCount"),r="";return t-=n,t===0&&n===0?r=this.intlMessage({intlName:"models.ZERO_PHOTOS"}):t===1&&n===0?r=this.intlMessage({intlName:"models.ONE_PHOTO"}):t>1&&n===0?r=this.intlMessage({intlName:"models.MULTIPLE_PHOTOS",photos:t}):t===0&&n===1?r=this.intlMessage({intlName:"models.ONE_VIDEO"}):t===1&&n===1?r=this.intlMessage({intlName:"models.ONE_PHOTO_AND_ONE_VIDEO"}):t>1&&n===1?r=this.intlMessage({intlName:"models.MULTIPLE_PHOTOS_AND_ONE_VIDEO",photos:t}):t===0&&n>1?r=this.intlMessage({intlName:"models.MULTIPLE_VIDEOS",videos:n}):t===1&&n>1?r=this.intlMessage({intlName:"models.ONE_PHOTO_AND_MULTIPLE_VIDEOS",videos:n}):t>1&&n>1&&(r=this.intlMessage({intlName:"models.MULTIPLE_PHOTOS_AND_MULTIPLE_VIDEOS",photos:t,videos:n})),r}},primary:{},primaryPhotoSizes:{},bestIconURL:{readOnly:!0,derivedBy:["primaryPhotoSizes"],defaultFn:function(e){var t=this.getValue(e,"primaryPhotoSizes");return t&&t.sq?t.sq.src:undefined}},url:{readOnly:!0,derivedBy:["owner"],defaultFn:function(e){var t=this.getValue(e,"owner");return t?"/photos/"+t.getValue("pathAlias")+"/galleries/"+e+"/":undefined}},urlSuffix:{readOnly:!0,derivedBy:["owner"],defaultFn:function(e){var t=this.getValue(e,"owner"),n=t.getValue("pathAlias");return"gallery-"+n+"-"+e}}}})},"@VERSION@",{requires:["flickr-model-registry","flickr-promise","flickr-galleries-getPhotos-fetcher","flickr-galleries-getContext-fetcher","flickr-galleries-addPhoto-creator","flickr-galleries-removePhoto-deletor","flickr-galleries-create-creator"],langBundles:["models"]});
YUI.add("hermes-lang-shared-entity",function(e,t){e.Intl.add("hermes/shared-entity","en-US",{USERNAME_HAS_SHARED_PHOTOS_ONLY:["${username}"," has shared ",{type:"plural",valueName:"photoCount",options:{one:"${#} photo",other:"${#} photos"}}," with you!"],USERNAME_HAS_SHARED_VIDEOS_ONLY:["${username}"," has shared ",{type:"plural",valueName:"videoCount",options:{one:"${#} video",other:"${#} videos"}}," with you!"],USERNAME_HAS_SHARED_PHOTOS_VIDEOS:["${username}"," has shared ",{type:"plural",valueName:"photoCount",options:{one:"${#} photo",other:"${#} photos"}}," ",{type:"plural",valueName:"videoCount",options:{one:"and ${#} video",other:"and ${#} videos"}}," with you!"],OWNER_HAS_SHARED_PHOTOS_ONLY:["You have shared ",{type:"plural",valueName:"photoCount",options:{one:"${#} photo",other:"${#} photos"}},"."],OWNER_HAS_SHARED_VIDEOS_ONLY:["You have shared ",{type:"plural",valueName:"videoCount",options:{one:"${#} video",other:"${#} videos"}},"."],OWNER_HAS_SHARED_PHOTOS_VIDEOS:["You have shared ",{type:"plural",valueName:"photoCount",options:{one:"${#} photo",other:"${#} photos"}}," ",{type:"plural",valueName:"videoCount",options:{one:"and ${#} video",other:"and ${#} videos"}},"."],VIEW_YOUR_SHARING_HISTORY:["View your sharing history"]})},"@VERSION@",{requires:["intl"]});
YUI.add("photo-sets-models",function(e){function t(e){t.superclass.constructor.call(this,e)}e.Models[this.name]=t,e.extend(t,e.FlickrModelRegistry,{name:this.name,remote:{read:function(t){return e.ModelFetchers["flickr-photos-getAllContexts"].run(t,this.appContext)}},attributes:{id:{},sets:{isListProxy:!0},total:{validator:function(t){return e.AttributeHelpers.validateInteger(t)},setter:function(t){return e.AttributeHelpers.coerceInteger(t)},defaultValue:0}}})},"@VERSION@",{requires:["api-helper","flickr-model-registry","flickr-promise","flickr-photos-getAllContexts-fetcher"]});
YUI.add("flickr-photosets-addPhoto-creator",function(e,t){"use strict";function n(n,r){var i={full_response:1},s=[],o=n.isMultiplePhotos?"photo_ids":"photo_id",u=n.photoID.split(",").length;return i[o]=n.photoID,i.photoset_id=n.setID,n.gpCode&&(i.gp_code=n.gpCode),n.gpOwner&&(i.gp_owner=n.gpOwner),n.shareCode&&(i.share_code=n.shareCode),s=[r.callAPI("flickr.photosets.addPhoto",i),r.getModel("set-models",n.setID),r.getModelRegistry("photo-sets-models"),r.getModelRegistry("photo-contexts-models")],n.isMultiplePhotos||s.push(r.getModel("photo-models",n.photoID)),e.Promise.all(s).then(function(e){var t=e[0],r=e[1],i=e[2],s=e[3],o,a=t.errors,f=t.errors?t.errors.length:0;u-=f;if(t.stat==="ok")return n.isMultiplePhotos?r&&n.updateItemCounts&&(r.setValue("photoCount",r.getValue("photoCount")+n.numberOfPhotosSelected),r.setValue("videoCount",r.getValue("videoCount")+n.numberOfVideosSelected)):(o=e[4],r&&!r.hasPhoto(o.getValue("id"))&&(r.addPhoto(o),o.getValue("isVideo")?r.setValue("videoCount",r.getValue("videoCount")+1):r.setValue("photoCount",r.getValue("photoCount")+1))),i.exists(n.photoID)&&!i.getValue(n.photoID,"sets").getFromListByID(r.getValue("id"))&&(i.getValue(n.photoID,"sets").prependToList(r),i.setValue(n.photoID,"total",i.getValue(n.photoID,"total")+u)),s.exists(n.photoID)&&!s.getValue(n.photoID,"contexts").getFromListByID(r.getValue("id"))&&(s.setValue(n.photoID,"totalSets",s.getValue(n.photoID,"totalSets")+u),s.getValue(n.photoID,"contexts").push(r)),n.isMultiplePhotos?(f&&a.forEach(function(e){n.photosSelectedIds.indexOf(e.photo_id)!==-1?r.setValue("photoCount",r.getValue("photoCount")-1):r.setValue("videoCount",r.getValue("videoCount")-1)}),{errors:a,setModel:r}):r},e.FetcherErrorLogger(t))}e.namespace("ModelCreators")["flickr-photosets-addPhoto"]={run:n}},"@VERSION@",{requires:["flickr-promise"],optional:["set-models","photo-models","photo-sets-models","photo-contexts-models"]});
YUI.add("flickr-photosets-getList-fetcher",function(e,t){"use strict";function n(t){var n={primary_photo_extras:e.APIHelper.request.getRebootAlbumsListExtras(),page:t.page||1,per_page:t.perPage||500,get_user_info:1,extras:"can_share,can_download"};if(t.id)n.user_id=t.id;else{if(!t.pathAlias)throw new Error("[flickr-favorites-getList-fetcher] `id` or `pathAlias` is required.");n.path_alias=t.pathAlias}return n}function r(t,n){var r=t[0],i=t[1],s=t[2],o=t[3],u=r.photosets,a={},f=o.getValue("id"),l=[];if(u)return u.photoset&&e.Array.each(u.photoset,function(t,n){if(t.visibilityCanSeeSet!==0){var r={id:t.id,title:t.title.content,description:t.description.content,owner:o,primary:t.primary,primaryPhotoSizes:e.APIHelper.response.parsePrimaryPhotoSizes(t),isAutoUploadSet:t.autoUpload,primaryNeedsInterstitial:t.needsInterstitial,photoCount:t.photos,videoCount:t.videos,totalCount:parseInt(t.photos,10)+parseInt(t.videos,10),viewCount:t.countViews,canShare:t.canShare,canDownload:t.canDownload};l.push(s.addOrUpdate(r))}}),a={id:f,pathAlias:o.getValue("pathAlias"),totalItems:r.photosets.total},a.albumsList={perPage:n.perPage,page:n.page,pageContent:l,totalItems:r.photosets.total},i.addOrUpdate(a),l}function i(n,r){var i=this,s=this._processParams(n);return e.Promise.all([r.callAPI("flickr.photosets.getList",s,!0),r.getModelRegistry("sets-models"),r.getModelRegistry("set-models"),r.getModel("person-models",n.id||{pathAlias:n.pathAlias})]).then(function(e){return n.perPage=s.per_page,n.page=s.page,i._processResponse(e,n)},e.FetcherErrorLogger(t))}e.namespace("ListFetchers")["flickr-photosets-getList"]={run:i,_processParams:n,_processResponse:r}},"@VERSION@",{requires:["flickr-promise","api-helper"],optional:["sets-models","set-models","person-models"]});
YUI.add("sets-models",function(e){function t(e){t.superclass.constructor.call(this,e)}e.Models[this.name]=t,e.extend(t,e.FlickrModelRegistry,{name:this.name,remote:{read:function(t){return e.ListFetchers["flickr-photosets-getList"].run(t,this.appContext)}},attributes:{id:{},pathAlias:{},albumsList:{isCollection:!0,pageFetch:{listFetcher:e.ListFetchers["flickr-photosets-getList"]}},totalItems:{validator:function(t){return e.AttributeHelpers.validateInteger(t)},setter:function(t){return e.AttributeHelpers.coerceInteger(t)}}}})},"@VERSION@",{requires:["flickr-model-registry","flickr-promise","flickr-photosets-getList-fetcher"]});
YUI.add("flickr-photosets-removePhoto-deletor",function(e,t){"use strict";function n(n,r){var i={full_response:1},s=[],o=n.isMultiplePhotos?"photo_ids":"photo_id",u=n.photoID.split(",").length;return i[o]=n.photoID,i.photoset_id=n.setID,s=[r.callAPI("flickr.photosets.removePhoto",i),r.getModel("set-models",n.setID),r.getModel("sets-models",r.getViewer().nsid,{page:1,perPage:r.flipper.isFlipped("enable-sets-list-loading-fix")?10:500}),r.getModelRegistry("photo-sets-models"),r.getModelRegistry("photo-contexts-models")],n.isMultiplePhotos||s.push(r.getModel("photo-models",n.photoID)),e.Promise.all(s).then(function(e){var t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a;if(t.stat==="ok"){o.exists(n.photoID)&&o.getValue(n.photoID,"contexts").getFromListByID(n.setID)&&(o.setValue(n.photoID,"totalSets",o.getValue(n.photoID,"totalSets")-u),o.getValue(n.photoID,"contexts").removeFromList(n.setID)),s.exists(n.photoID)&&s.getValue(n.photoID,"sets").getFromListByID(n.setID)&&(s.setValue(n.photoID,"total",s.getValue(n.photoID,"total")-u),s.getValue(n.photoID,"sets").removeFromList(n.setID));if(r){n.isMultiplePhotos?r&&n.updateItemCounts&&(r.setValue("photoCount",r.getValue("photoCount")-n.numberOfPhotosSelected),r.setValue("videoCount",r.getValue("videoCount")-n.numberOfVideosSelected)):(a=e[5],r.hasPhoto(a.getValue("id"))&&r.removePhoto(a),a.getValue("isVideo")?r.setValue("videoCount",r.getValue("videoCount")-u):r.setValue("photoCount",r.getValue("photoCount")-u));if(r.getValue("totalCount")<1)return i.getValue("albumsList").remove(n.setID),r.registry.remove(n.setID),null}return r}},e.FetcherErrorLogger(t))}e.namespace("ModelCreators")["flickr-photosets-removePhoto"]={run:n}},"@VERSION@",{requires:["flickr-promise"],optional:["set-models","photo-models","sets-models","photo-sets-models","photo-contexts-models"]});
YUI.add("flickr-photosets-delete-deletor",function(e,t){"use strict";function n(n,r){return n.photoset_id=n.setID,n.gpCode&&(n.gp_code=n.gpCode),n.gpOwner&&(n.gp_owner=n.gpOwner),n.shareCode&&(n.share_code=n.shareCode),r.callAPI("flickr.photosets.delete",n).then(function(e){if(e.code===1)throw new Error(e)}).catch(e.FetcherErrorLogger(t))}e.namespace("ModelDeletors")["flickr-photosets-delete-deletor"]={run:n}},"@VERSION@",{requires:["flickr-promise"]});
YUI.add("flickr-photosets-getPhotos-fetcher",function(e,t){"use strict";function n(t){t.page=t.page||1,t.perPage=t.perPage||100;var n={extras:e.APIHelper.request.getRebootPhotoExtras(),per_page:t.perPage,page:t.page,get_user_info:1,primary_photo_extras:"url_c, url_h, url_k, url_l, url_m, url_n, url_o, url_q, url_s, url_sq, url_t, url_z, needs_interstitial, can_share",jump_to:t.withPhotoId||""};return t.gpCode&&t.gpCode!==null?(n.gp_code=t.gpCode,n.share_code=t.gpCode,n.gp_owner=t.gpOwner):n.photoset_id=t.id.split("-")[0],t.viewAs&&(n.view_as=t.viewAs),t.filter&&(n.privacy_filter=t.filter),n}function r(t,n){var r=t[0],i=t[1],s=t[2],o=t[3],u=t[4],a=t[5],f=t[6],l=t[7],c,h,p,d,v,m=[],g=!1,y=!1,b=n.id;c=e.APIHelper.response.parsePerson(r.user),h=s.addOrUpdate(c),p={id:n.id,title:r.photoset.title,description:r.photoset.description,owner:h,primary:r.photoset.primary,primaryPhotoSizes:e.APIHelper.response.parsePrimaryPhotoSizes(r.photoset),isAutoUploadSet:r.photoset.isAutoUploadSet,isSharedEntity:r.photoset.hidden&&r.photoset.hidden===1?!0:!1,photoCount:r.photoset.photoCount,videoCount:r.photoset.videoCount,primaryNeedsInterstitial:r.photoset.needsInterstitial,totalCount:parseInt(r.photoset.photoCount,10)+parseInt(r.photoset.videoCount,10),photoList:[],viewCount:r.photoset.countViews,canShare:r.photoset.canShare,canDownload:r.photoset.canDownload},b&&b!==r.photoset.id&&(p.id=b),r.photoset.isAutoUploadSet==="1"&&(p.canShare=!1),o.exists(n.id)&&(d=o.getValue(n.id,"photoPageList"),g=d.hasMinBoundary?d.hasMinBoundary():!1,y=d.hasMaxBoundary?d.hasMaxBoundary():!1,m=d.getList()),v=e.APIHelper.response.parsePhotos({photos:r.photoset.photo,ownerID:r.photoset.owner,personModelRegistry:s,photoModelRegistry:i,photoEngagementModelRegistry:u,photoStatsModelRegistry:a,photoCurationModelRegistry:f}),p.photoPageList=e.APIHelper.response.addOrReplaceListByPage({current:m,perPage:n.perPage,pageNum:n.page,hasMax:y,hasMin:g,totalItems:r.photoset.total,newPages:v}),p.photoPageList={perPage:r.photoset.perPage,page:r.photoset.page,pageContent:v,totalItems:r.photoset.total},p.photoList.length&&(p.primary=r.photoset.primary);var w={id:p.id,countPhotosFamily:r.photoset.countPhotosFamily,countPhotosFriend:r.photoset.countPhotosFriend,countPhotosPublic:r.photoset.countPhotosPublic,countPhotosFriendFamily:r.photoset.countPhotosFriendFamily,totalCount:r.photoset.countPhotosAll};return l.exists(w.id)?l.setValues(n.id,w):l.add(w),o.exists(p.id)?o.setValue(n.id,"photoPageList",p.photoPageList):o.add(p),v}function i(n,r){var i=this;return e.Promise.all([r.callAPI("flickr.photosets.getPhotos",this._processParams(n),!0),r.getModelRegistry("photo-models"),r.getModelRegistry("person-models"),r.getModelRegistry("set-models"),r.getModelRegistry("photo-engagement-models"),r.getModelRegistry("photo-stats-models"),r.getModelRegistry("photo-curation-models"),r.getModelRegistry("album-privacy-models")]).then(function(e){return i._processResponse(e,n)},e.FetcherErrorLogger(t))}e.namespace("ListFetchers")["flickr-photosets-getPhotos"]={run:i,_processParams:n,_processResponse:r}},"@VERSION@",{requires:["flickr-promise","api-helper"],optional:["photo-models","person-models","set-models","photo-engagement-models","photo-stats-models","photo-curation-models"]});
YUI.add("flickr-photosets-getContext-fetcher",function(e,t){"use strict";function n(t,n){var r={extras:e.APIHelper.request.getRebootPhotoExtras(),photo_id:t.photoId,num_prev:t.numNext,num_next:t.numPrev,get_photoset_info:1};return t.gpCode?(r.share_code=t.gpCode,r.share_owner=t.gpOwner,r.gp_code=t.gpCode,r.gp_owner=t.gpOwner):r.photoset_id=t.id,r}function r(t,n){var r=t[0],i=t[1],s=t[2],o=t[3],u=t[4],a=t[5],f=t[6],l=[],c=[],h=s.proxy(n.photoId),p,d,v,m,g,y,b=[];return p=r.prevphotos,d=r.nextphotos,c=e.APIHelper.response.parsePhotos({photos:p.photo,personModelRegistry:o,photoModelRegistry:s,photoEngagementModelRegistry:u,photoStatsModelRegistry:a,photoCurationModelRegistry:f}),l=e.APIHelper.response.parsePhotos({photos:d.photo,personModelRegistry:o,photoModelRegistry:s,photoEngagementModelRegistry:u,photoStatsModelRegistry:a}),g=i.getValue(n.id,"photoContextList"),v=g.hasMinBoundary?g.hasMinBoundary():!1,m=g.hasMaxBoundary?g.hasMaxBoundary():!1,y=g.getList(),b=e.APIHelper.response.addOrReplaceListByContext({model:h,next:c,prev:l.reverse(),current:y,hasMin:v,hasMax:m,numNext:n.numNext,numPrev:n.numPrev}),i.setValue(n.id,"photoContextList",b),{next:c,previous:l.reverse()}}function i(n,r){var i=this;return e.Promise.all([r.callAPI("flickr.photosets.getContext",this._processParams(n,r),!0),r.getModelRegistry("set-models"),r.getModelRegistry("photo-models"),r.getModelRegistry("person-models"),r.getModelRegistry("photo-engagement-models"),r.getModelRegistry("photo-stats-models"),r.getModelRegistry("photo-curation-models")]).then(function(e){return i._processResponse(e,n)},function(e){throw e.code===2&&e.message==="Photo not in set"&&(e.notInContext=!0),e}).then(null,e.FetcherErrorLogger(t))}e.namespace("ListFetchers")["flickr-photosets-getContext"]={run:i,_processParams:n,_processResponse:r}},"@VERSION@",{requires:["flickr-promise","api-helper"],optional:["set-models","photo-models","person-models","photo-engagement-models","photo-stats-models","photo-curation-models"]});
YUI.add("flickr-photosets-create-creator",function(e,t){"use strict";function n(n,r){var i={},s=[];return i.title=n.title,i.description=n.description,i.primary_photo_id=n.photoID,i.full_result=1,s=[r.callAPI("flickr.photosets.create",i),r.getModelRegistry("set-models"),r.getModel("person-models",r.getViewer().nsid),r.getModel("sets-models",r.getViewer().nsid,{page:1,perPage:r.flipper.isFlipped("enable-sets-list-loading-fix")?10:500}),r.getModelRegistry("photo-sets-models"),r.getModelRegistry("photo-contexts-models")],n.isMultiplePhotos||s.push(r.getModel("photo-models",n.photoID)),e.Promise.all(s).then(function(t){var r=t[0],i=t[1],s=t[2],o=t[3],u=t[4],a=t[5],f,l,c,h,p,d=1;return r.photoset.id?(n.isMultiplePhotos?n.numberOfPhotosSelected+n.numberOfVideosSelected===1?(h=r.photoset.photos,p=r.photoset.videos):r.photoset.photos?(h=r.photoset.photos,p=0):(p=r.photoset.videos,h=0):(l=t[6],h=r.photoset.photos,p=r.photoset.videos),f={id:r.photoset.id,title:r.photoset.title.content,photoPageList:n.isMultiplePhotos?[]:[l],photoContextList:n.isMultiplePhotos?[]:[l],owner:s,primary:r.photoset.primary,primaryPhotoSizes:e.APIHelper.response.parsePrimaryPhotoSizes(r.photoset),isAutoUploadSet:!1,photoCount:h,videoCount:p,totalCount:d,viewCount:r.countViews||0},i.add(f),c=i.proxy(r.photoset.id),o.getValue("albumsList").unshift(c),u.exists(n.photoID)&&!u.getValue(n.photoID,"sets").getFromListByID(c.getValue("id"))&&(u.getValue(n.photoID,"sets").prependToList(c),u.setValue(n.photoID,"total",u.getValue(n.photoID,"total")+1)),a.exists(n.photoID)&&!a.getValue(n.photoID,"contexts").getFromListByID(c.getValue("id"))&&(a.setValue(n.photoID,"totalSets",a.getValue(n.photoID,"totalSets")+1),a.getValue(n.photoID,"contexts").appendToList(c)),c):!1},e.FetcherErrorLogger(t))}e.namespace("ModelCreators")["flickr-photosets-create"]={run:n}},"@VERSION@",{requires:["flickr-promise","api-helper"],optional:["set-models","photo-models","person-models","sets-models","photo-sets-models","photo-contexts-models"]});
YUI.add("flickr-photosets-createHidden-creator",function(e,t){"use strict";function n(n,r){var i={},s=[];return i.photo_ids=n.photoIds,s=[r.callAPI("flickr.photosets.createHidden",i),r.getModelRegistry("set-models"),r.getModel("person-models",r.getViewer().nsid)],e.Promise.all(s).then(function(e){var t=e[0],n=e[1],r=e[2],i,s;return t.stat==="ok"&&t.photoset.share_code?(i={id:t.photoset.share_code,shareCode:t.photoset.share_code,owner:r,gpCode:t.photoset.share_code,gpOwner:r.getValue("pathAlias")||r.getValue("nsid"),url:t.photoset.url,isAutoUploadSet:!1,isSharedEntity:!0,totalCount:t.photoset.count},n.add(i),s=n.proxy(i.id),s):!1},e.FetcherErrorLogger(t))}e.namespace("ModelCreators")["flickr-photosets-createHidden"]={run:n}},"@VERSION@",{requires:["flickr-promise","api-helper"],optional:["set-models","photo-models","person-models","sets-models","photo-sets-models","photo-contexts-models"]});
YUI.add("flickr-photosets-editMeta-updater",function(e,t){"use strict";function r(e,t,r){var i=e[0],s=e[1];if(!i.photoset||!i.photoset.title||!i.photoset.description)n.warn("No updated data returned from API.");else{if(!s.exists(t.photosetId))throw new Error("[flickr-photosets-editMeta-updater] - Set model cannot be updated if it does not exist");s.setValues(t.photosetId,{title:i.photoset.title.content,description:i.photoset.description.content})}}function i(n,r){var i={},s=this;return i.photoset_id=n.photosetId,i.title=n.title,i.description=n.description,e.Promise.all([r.callAPI("flickr.photosets.editMeta",i),r.getModelRegistry("set-models")]).then(function(e){s._processResponse(e,n,r)},e.FetcherErrorLogger(t))}var n=require("lib/flog")(t);e.namespace("ModelUpdaters")["flickr-photosets-editMeta"]={run:i,_processResponse:r}},"@VERSION@",{requires:["flickr-promise"]});
YUI.add("flickr-photosets-setPrimaryPhoto-updater",function(e,t){"use strict";function n(n,r){var i={};return i.photoset_id=n.albumId,i.photo_id=n.photoId,r.callAPI("flickr.photosets.setPrimaryPhoto",i).then(null,e.FetcherErrorLogger(t))}e.namespace("ModelUpdaters")["flickr-photosets-setPrimaryPhoto"]={run:n}},"@VERSION@",{requires:["flickr-promise"]});