YUI.add("search-photos-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-photos-search"].run(t,this.appContext)}},attributes:{photos:{isCollection:!0,pageFetch:{listFetcher:e.ListFetchers["flickr-photos-search"],listItemIdField:"photoId"}},totalItems:{setter:function(t){return(t=e.AttributeHelpers.coerceInteger(t))<0&&(t=0),t},defaultValue:0},apiParams:{writeOnce:"initOnly"},emptyQuery:{defaultValue:!1}}})},"@VERSION@",{requires:["flickr-model-registry","flickr-photos-search-fetcher"]});YUI.add("photo-selector-limited-rows-photolist-view",function(e){e.namespace("Views")[this.name]=e.Base.create(this.name,e.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(t){return t.photolistViewClasses&&(t.additionalViewClasses=t.photolistViewClasses),t.photoListConfig=e.merge(t.primaryPhotoListConfig),this.searchUrl=t.searchUrl,this.listId=t.listId,""===this.get("container").get("innerHTML")&&this.setContainerHTML(""),this},subviewConfig:{"photo-list-view":{requiredToShowOnClient:!0,requiredToShowOnServer:!0}},loadState:function(){return this.appContext.getModel("search-photos-lite-models",this.searchUrl.getId(),{}).then(function(e){this.searchModel=e,e.getValue("totalItems")<=0&&this.set("emptySearch",!0)}.bind(this))},buildContainer:function(){var e="search.YOUR_PHOTOS";return"contacts"===this.listId?e="search.FROM_YOUR_CONTACTS":"everyone"===this.listId&&(e="search.EVERYONES_PHOTOS"),this.setContainerWithTemplate("search-photos-single-row",{emptySearch:this.get("emptySearch"),total:this.searchModel.getValue("totalItems"),singleResult:1===this.searchModel.getValue("totalItems"),viewAll:"#"+this.listId,"photo-list-view":this.subviews["photo-list-view"].get("container"),title:this.intlMessage({intlName:e})}),this},activate:function(){return this.registerEventHandler(this.get("container").on("click",this.handleClick.bind(this))),this},handleClick:function(e){e.halt();var t,i=e.target;i.hasClass("view-more-link")&&(t=i.getDOMNode().href.split("#")[1],this.fire("subviewViewEvent","viewEntireSearchList",{list:t,searchUrl:this.searchUrl}))}},{ATTRS:{emptySearch:{value:!1}}})},"@VERSION@",{requires:["flickr-view","photo-list-view","hermes-template-search-photos-single-row","search-photos-lite-models"],langBundles:["common","search"]});YUI.add("hermes-template-photo-selector-photo-list-photo-interaction",function(e,a){var t=e.Template.Handlebars.revive({1:function(e,a,t,l,n){var s,o=e.escapeExpression;return''+o((t.intlMessage||a&&a.intlMessage||t.helperMissing).call(null!=a?a:{},{name:"intlMessage",hash:{user:null!=(s=null!=(s=null!=a?a.photo:a)?s.owner:s)?s.displayname:s,intlName:"common.BY_USER"},data:n}))+""},compiler:[7,">= 4.0.0"],main:function(e,a,t,l,n){var s,o,i=null!=a?a:{},r=e.escapeExpression;return'
\n\n'},useData:!0}),l={};e.Array.each([],function(a){var t=e.Template.get("hermes/"+a);t&&(l[a]=t)}),e.Template.register("hermes/photo-selector-photo-list-photo-interaction",function(a,n){return n=n||{},n.partials=n.partials?e.merge(l,n.partials):l,t(a,n)})},"@VERSION@",{requires:["template-base","handlebars-base"]});YUI.add("photo-selector-photolist-interaction-view",function(t){var e=require("hermes-core/type-validator");t.namespace("Views")[this.name]=t.Base.create(this.name,t.FlickrView,[],{langBundles:this.details.langBundles,initializer:function(t){return""===this.get("container").get("innerHTML")&&this.setContainerHTML(""),this.hasMultiSelect=t.primaryPhotoListConfig&&t.primaryPhotoListConfig.hasMultiSelect,this.multiSelectLimit=void 0===t.primaryPhotoListConfig.multiSelectLimit?1:t.primaryPhotoListConfig.multiSelectLimit,this.listType=t.primaryPhotoListConfig.type,this.galleryId=t.primaryPhotoListConfig.galleryId,this.isDisabled=!1,this.isDisabledSelected=!1,this},loadState:function(){var e=this,i=[];return"galleryFaves"===this.listType&&this.galleryId&&(i.push(this.appContext.getModelRegistry("gallery-photo-association-models").then(function(t){t.exists(e.galleryId+"-"+e.get("id"))&&(e.isDisabled=!0,e.isDisabledSelected=!0)})),i.push(this.appContext.getModel("gallery-faves-models",this.appContext.getViewer().nsid+"-"+e.galleryId).then(function(t){var i=t.getValue("nonGalleryAddablePhotos").getList(),s=!1;i&&(s=i.some(function(t){return t.id===e.get("model").id})),s&&(e.isDisabled=!0)}))),i.push(this.appContext.getModel("profile-selected-photos-models",this.appContext.getViewer().nsid).then(function(t){t.getValue("photos").getFromListByID(this.get("model").getValue("id"))&&this.set("isActive",!0)}.bind(this))),t.Promise.all(i)},buildContainer:function(){var t=this.get("model");return this.setContainerWithTemplate("photo-selector-photo-list-photo-interaction",{photo:t.toJSON(),photoPageUrl:this.get("photoPageUrl")}),this},activate:function(){var e,i,s=this.get("container"),o=s.one(".disabled-overlay");return this.galleryId&&(e=this.intlMessage({intlName:"gallery.PHOTO_CANT_ADD_TO_GALLERY",mediaType:this.get("model").getValue("mediaType")}),i=this.intlMessage({intlName:"gallery.PHOTO_ALREADY_IN_GALLERY",mediaType:this.get("model").getValue("mediaType")})),this.registerEventHandler(s.on("click",this.selectPhoto.bind(this))),this.hasMultiSelect||this.registerEventHandler(t.on("photoSelector:subviewEvent",this.handleOtherPhotoSelected,this)),this.get("isActive")?this.get("isActive")&&s.addClass("active"):s.removeClass("active"),this.isDisabled&&(s.addClass("disabled"),o.setAttribute("title",e)),this.isDisabledSelected&&(s.addClass("disabled-selected"),o.setAttribute("title",i)),this},selectPhoto:function(e){if(e.halt(),!this.isDisabled)if(this.get("isActive")&&this.hasMultiSelect)this.set("isActive",!1),this.get("container").removeClass("active"),t.fire("photoSelector:subviewEvent",{eventName:"unselectPhotoFromPhotoList",id:this.get("id")});else{if(this.hasMultiSelect)return this.appContext.getModel("profile-selected-photos-models",this.appContext.getViewer().nsid).then(function(e){e.getValue("photos").size()+1<=this.multiSelectLimit&&(this.set("isActive",!0),this.get("container").addClass("active"),t.fire("photoSelector:subviewEvent",{eventName:"selectPhotoFromPhotoList",id:this.get("id")}))}.bind(this));this.set("isActive",!0),this.get("container").addClass("active"),t.fire("photoSelector:subviewEvent",{eventName:"selectPhotoFromPhotoList",id:this.get("id")})}},handleOtherPhotoSelected:function(t){if("selectPhotoFromPhotoList"===t.eventName&&this.get("isActive")){if(t.id===this.get("id"))return;this.set("isActive",!1),this.get("container")._node&&this.get("container").removeClass("active")}}},{ATTRS:{id:{writeOnce:"initOnly",validator:function(t,i){return e.photoId(t)}},model:{writeOnce:"initOnly"},photoPageUrl:{writeOnce:"initOnly"}}})},"@VERSION@",{requires:["flickr-view","hermes-template-photo-selector-photo-list-photo-interaction","attribute-helpers"],optionalRequires:["fluid"],langBundles:["common","gallery"]});YUI.add("hermes-lang-gallery",function(e,o){e.Intl.add("hermes/gallery","en-US",{VIEW_YOUR_GALLERIES:["View your galleries"],GALLERIES_WITH_YOUR_ITEMS:["Galleries with your items"],GALLERY_CURATED_BY:['a gallery curated by ',"${ownerName}",""],GALLERY_CURATED_BY_YOU:['a gallery curated by YOU!'],PRIVATE_GALLERY_CURATED_BY:['a private gallery curated by ',"${ownerName}",""],YOU_ATTRIBUTION:["YOU!"],DESCRIPTION_READ_MORE:["read more"],DESCRIPTION_READ_LESS:["read less"],BACK_TO_GALLERIES_LIST:["Back to galleries list"],ADD_COMMENT:["Add comment"],EDIT_GALLERY:["Edit gallery"],ADD_A_TITLE:["Add a title"],ADD_A_DESCRIPTION:["Add a description"],COVER_PHOTO:["Cover photo"],CHOOSE_A_COVER_PHOTO:["Choose a cover photo"],CHANGE_COVER_PHOTO:["Change cover photo"],PRIVATE_GALLERY:["Private gallery"],DELETE_GALLERY:["Delete gallery"],GALLERY_CONFIRM_DELETE_MESSAGE:["Are you sure you want to delete this gallery?"],MAKE_GALLERY_PUBLIC:["Make this gallery public?"],GALLERY_PUBLIC_EXPLANATION:["This gallery will be visible to others, and notifications will be sent when you add photos."],LARGE_VIEW_LAYOUT_TITLE:["Large view"],REORDER_PHOTOS_LAYOUT_TITLE:["Reorder photos"],GALLERY_PHOTO_REMOVE_MESSAGE:["This photo will be removed from the gallery."],GALLERY_PHOTO_REMOVE_TITLE:["Remove this photo from the gallery?"],PHOTO_REMOVED:[{type:"select",valueName:"mediaType",options:{photo:["Photo"],video:["Video"],other:["Photo"]}}," removed"],REMOVE_FROM_GALLERY:["Remove from gallery"],GALLERY_REMARK_OWNER_SAYS:["${ownerName}"," says:"],GALLERY_REMARK_WHY:["Why did you choose this ",{type:"select",valueName:"mediaType",options:{photo:["photo"],video:["video"],other:["photo"]}},"?"],IN_THIS_GALLERY:["In this gallery:"],AND_COUNT_MORE:["and ","${count}"," more"],NEW_GALLERY:["New Gallery"],NOTHING_HERE_YET:["Nothing here yet."],NOTHING_HERE_YET_DETAILS:["You can save a photo or video to a gallery from its detail page, or choose from your faves here."],ADD_PHOTOS_AND_VIDEOS:["Add photos and videos"],REMOVING:["Removing..."],ARE_YOU_SURE_REMOVE_PHOTO:["Are you sure you want to remove this ",{type:"select",valueName:"mediaType",options:{photo:["photo"],video:["video"],other:["photo"]}},"?"],ARE_YOU_SURE_REMOVE_VIDEO:["Are you sure you want to remove this video?"],GALLERY_ADD:["Add"],GALLERY_CHOOSE_PHOTOS_LIMIT:[{type:"plural",valueName:"limit",options:{one:"Choose up to ${#} more photo to add to your gallery.",other:"Choose up to ${#} more photos to add to your gallery."}}],GALLERY_FULL_CANT_ADD:["Your gallery is full! To add new photos, you need to remove some first."],GALLERY_EDIT_REMARK_TOOLTIP:["Edit remark"],GALLERY_VIEW_REMARK_TOOLTIP:["View remark"],GALLERY_FEATURED_BANNER_MESSAGE:['You’re looking at the new Flickr galleries. Learn more. Share feedback.'],GALLERY_FEATURED_TITLE:["New Galleries"],GALLERY_FEATURED_DESCRIPTION:["Now with more features and up to 500 photos."],GALLERY_FEATURED_LEARN_MORE:["Learn More"],GALLERY_FEATURED_SUBMIT_FEEDBACK:["Submit Feedback"],PHOTO_CANT_ADD_TO_GALLERY:["This ",{type:"select",valueName:"mediaType",options:{photo:["photo"],video:["video"],other:["photo"]}}," can’t be added to the gallery."],PHOTO_ALREADY_IN_GALLERY:["This ",{type:"select",valueName:"mediaType",options:{photo:["photo"],video:["video"],other:["photo"]}}," is already in the gallery."],USER_HASNT_CREATED_GALLERIES:["${ownerName}"," hasn’t created any galleries yet."],GALLERIES_COUNT:[{type:"plural",valueName:"count",options:{one:["${countString}"," gallery"],other:["${countString}"," galleries"]}}]})},"@VERSION@",{requires:["intl"]});YUI.add("hermes-template-photo-selector-sets-photolist-set-interaction",function(e,t){var a=e.Template.Handlebars.revive({1:function(e,t,a,l,n){var s;return'\t\t\t\t'+e.escapeExpression((a.intlMessage||t&&t.intlMessage||a.helperMissing).call(null!=t?t:{},{name:"intlMessage",hash:{selectedCount:null!=(s=null!=t?t.album:t)?s.publicPhotosCount:s,intlName:"album-page.PUBLIC_ITEMS_COUNT"},data:n}))+"\n"},3:function(e,t,a,l,n){var s;return'\t\t\t'+e.escapeExpression((a.intlMessage||t&&t.intlMessage||a.helperMissing).call(null!=t?t:{},{name:"intlMessage",hash:{selectedCount:null!=(s=null!=t?t.album:t)?s.totalCount:s,intlName:"album-page.PHOTOS_COUNT"},data:n}))+"\n"},compiler:[7,">= 4.0.0"],main:function(e,t,a,l,n){var s;return'\n\t
\n\t\t
'+e.escapeExpression(e.lambda(null!=(s=null!=t?t.album:t)?s.title:s,t))+"
\n"+(null!=(s=a.if.call(null!=t?t:{},null!=t?t.publicOnlyPhotos:t,{name:"if",hash:{},fn:e.program(1,n,0),inverse:e.program(3,n,0),data:n}))?s:"")+"\t\n
\n"},useData:!0}),l={};e.Array.each([],function(t){var a=e.Template.get("hermes/"+t);a&&(l[t]=a)}),e.Template.register("hermes/photo-selector-sets-photolist-set-interaction",function(t,n){return n=n||{},n.partials=n.partials?e.merge(l,n.partials):l,a(t,n)})},"@VERSION@",{requires:["template-base","handlebars-base"]});