YUI.add("curation-photomappings-model",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-licensing-curation-photomappings"].run(t,this.appContext)}},attributes:{status:{},ownerStatus:{},category:{},collection:{},useType:{},technical:{},legal:{}}})},"@VERSION@",{requires:["flickr-model-registry","flickr-promise","flickr-licensing-curation-photomappings-fetcher"]});
YUI.add("flickr-licensing-curation-photomappings-fetcher",function(e,t){"use strict";function n(e){var t={};return t}function r(e,t){var n,r,i,s,o,u,a,f,l,c=e[0];r=c.status?c.status.item:null,i=c.ownerStatus?c.ownerStatus:null,s=c.category?c.category.item:null,o=c.collection?c.collection.item:null,a=c.technical?c.technical.item:null,f=c.legal?c.legal.item:null,u=c.useType?c.useType.item:null,n={id:t.id,status:r,ownerStatus:i,category:s,collection:o,useType:u,technical:a,legal:f},l=e[1],l.addOrUpdate(n)}function i(n,r){var i=this;return e.Promise.all([r.callAPI("flickr.licensing.curation.getPhotoMappings",this._processParams(n)),r.getModelRegistry("curation-photomappings-model")]).then(function(e){return i._processResponse(e,n)},e.FetcherErrorLogger(t))}e.namespace("ListFetchers")["flickr-licensing-curation-photomappings"]={run:i,_processResponse:r,_processParams:n}},"@VERSION@",{requires:["flickr-promise","api-helper"],optional:["curation-photomappings-model"]});
YUI.add("hermes-template-curator-tool-photo-metadata-form",function(e,t){var n=e.Template.Handlebars.revive({compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a="function",f=e.escapeExpression;return'<div id="curator-photo-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'">\n <div class="photo-preview">\n <img src="'+f((s=(s=n.imgUrl||(t!=null?t.imgUrl:t))!=null?s:u,typeof s===a?s.call(o,{name:"imgUrl",hash:{},data:i}):s))+'" alt="" />\n </div>\n <div class="photo-metadata">\n \n <div class="category-collection">\n <div class="category">\n <label for="photo-category-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'">Category *</label>\n <div class="field-wrapper">\n <div class="selectbox">\n <div class="select-fade"></div>\n <div class="select-arrow"></div>\n <select class="photo-category-select" id="photo-category-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'" name="photo-category-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+"\" required><option value='0'>None</option>"+f((n.renderTrustedMarkup||t&&t.renderTrustedMarkup||u).call(o,t!=null?t.categoryOptions:t,{name:"renderTrustedMarkup",hash:{},data:i}))+'</select>\n </div>\n </div>\n </div>\n <div class="collection">\n <label for="photo-collection-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'">Collection</label>\n <div class="field-wrapper">\n <div class="selectbox">\n <div class="select-fade"></div>\n <div class="select-arrow"></div>\n <select class="photo-collection-select" id="photo-collection-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'" name="photo-collection-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'">'+f((n.renderTrustedMarkup||t&&t.renderTrustedMarkup||u).call(o,t!=null?t.collectionOptions:t,{name:"renderTrustedMarkup",hash:{},data:i}))+'</select>\n </div>\n </div>\n </div>\n </div>\n \n <div class="use-type-releases">\n \n <div class="use-type">\n <label for="photo-use-type-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'">Use Type *</label>\n <div class="field-wrapper">\n <div class="selectbox">\n <div class="select-fade"></div>\n <div class="select-arrow"></div>\n <select class="photo-use-type-select" id="photo-use-type-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'" name="photo-use-type-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+"\" required><option value='0'>None</option>"+f((n.renderTrustedMarkup||t&&t.renderTrustedMarkup||u).call(o,t!=null?t.useTypeOptions:t,{name:"renderTrustedMarkup",hash:{},data:i}))+'</select>\n </div>\n </div>\n </div>\n <div class="model-releases">\n <label for="photo-model-releases-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'">Model Releases</label>\n <div class="field-wrapper">\n <div class="selectbox">\n <div class="select-fade"></div>\n <div class="select-arrow"></div>\n <select class="photo-model-releases-select" id="photo-model-releases-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'" name="photo-model-releases-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'">'+f((n.renderTrustedMarkup||t&&t.renderTrustedMarkup||u).call(o,t!=null?t.modelReleasesOptions:t,{name:"renderTrustedMarkup",hash:{},data:i}))+'</select>\n </div>\n </div>\n </div>\n <div class="property-releases">\n <label for="photo-property-releases-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'">Property Releases</label>\n <div class="field-wrapper">\n <div class="selectbox">\n <div class="select-fade"></div>\n <div class="select-arrow"></div>\n <select class="photo-property-releases-select" id="photo-property-releases-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'" name="photo-property-releases-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'">'+f((n.renderTrustedMarkup||t&&t.renderTrustedMarkup||u).call(o,t!=null?t.propertyReleasesOptions:t,{name:"renderTrustedMarkup",hash:{},data:i}))+'</select>\n </div>\n </div>\n </div>\n </div>\n \n <div class="technical">\n <label for="photo-technical-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'">Technical</label>\n <div class="field-wrapper">\n <div class="selectbox">\n <div class="select-fade"></div>\n <div class="select-arrow"></div>\n <select class="photo-technical-select" id="photo-technical-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'" name="photo-technical-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'">'+f((n.renderTrustedMarkup||t&&t.renderTrustedMarkup||u).call(o,t!=null?t.technicalOptions:t,{name:"renderTrustedMarkup",hash:{},data:i}))+'</select>\n </div>\n </div>\n </div>\n \n <div class="legal">\n <label for="photo-legal-'+f((s=(s=n.photoId||(t!=null?t.photoId
:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'">Legal</label>\n <div class="field-wrapper">\n <div class="selectbox">\n <div class="select-fade"></div>\n <div class="select-arrow"></div>\n <select class="photo-legal-select" id="photo-legal-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+'" name="photo-legal-'+f((s=(s=n.photoId||(t!=null?t.photoId:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoId",hash:{},data:i}):s))+"\"><option value='0'>None</option>"+f((n.renderTrustedMarkup||t&&t.renderTrustedMarkup||u).call(o,t!=null?t.legalOptions:t,{name:"renderTrustedMarkup",hash:{},data:i}))+"</select>\n </div>\n </div>\n </div>\n </div>\n</div>\n"},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/curator-tool-photo-metadata-form",function(t,i){return i=i||{},i.partials=i.partials?e.merge(r,i.partials):r,n(t,i)})},"@VERSION@",{requires:["template-base","handlebars-base"]});
YUI.add("hermes-template-curator-control-panel",function(e,t){var n=e.Template.Handlebars.revive({1:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a="function",f=e.escapeExpression;return" <p>Photographer status: <strong>"+f((s=(s=n.photographerStatus||(t!=null?t.photographerStatus:t))!=null?s:u,typeof s===a?s.call(o,{name:"photographerStatus",hash:{},data:i}):s))+'</strong></p>\n <p>\n <a href="/god/licensing/curation/editor_1/accounts/'+f((s=(s=n.ownerId||(t!=null?t.ownerId:t))!=null?s:u,typeof s===a?s.call(o,{name:"ownerId",hash:{},data:i}):s))+'/">'+f((s=(s=n.photographerStatusString||(t!=null?t.photographerStatusString:t))!=null?s:u,typeof s===a?s.call(o,{name:"photographerStatusString",hash:{},data:i}):s))+"</a>\n </p>\n"},3:function(e,t,n,r,i){var s,o=t!=null?t:{},u=e.lambda,a=e.escapeExpression;return((s=n["if"].call(o,t!=null?t.ownerLocked:t,{name:"if",hash:{},fn:e.program(4,i,0),inverse:e.program(6,i,0),data:i}))!=null?s:"")+'\n <div id="curator-photo-status">\n <p>\n Photo status:\n <strong>\n '+a(u((s=t!=null?t.children:t)!=null?s.photoStatus:s,t))+'\n </strong>\n </p>\n </div>\n\n <div id="photographer-claimed-by">\n <p>Claimed by: '+a(u((s=t!=null?t.children:t)!=null?s.photographerClaimedBy:s,t))+"</p>\n </div>\n\n"+((s=n["if"].call(o,(s=t!=null?t.children:t)!=null?s.ownerClaimedByMe:s,{name:"if",hash:{},fn:e.program(11,i,0),inverse:e.noop,data:i}))!=null?s:"")},4:function(e,t,n,r,i){return" <p>\n LOCKED\n </p>\n"},6:function(e,t,n,r,i){var s;return(s=n["if"].call(t!=null?t:{},t!=null?t.addPhotoButton:t,{name:"if",hash:{},fn:e.program(7,i,0),inverse:e.program(9,i,0),data:i}))!=null?s:""},7:function(e,t,n,r,i){return' <button id="curator-photo-submit">\n Add this photo\n </button>\n'},9:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a="function",f=e.escapeExpression;return' <p>\n <a href="'+f((s=(s=n.updateUrl||(t!=null?t.updateUrl:t))!=null?s:u,typeof s===a?s.call(o,{name:"updateUrl",hash:{},data:i}):s))+'">'+f((s=(s=n.updateString||(t!=null?t.updateString:t))!=null?s:u,typeof s===a?s.call(o,{name:"updateString",hash:{},data:i}):s))+"</a>\n </p>\n"},11:function(e,t,n,r,i){var s;return' <div id="curator-photo-count">\n <p>\n Photo count: <strong>'+e.escapeExpression(e.lambda((s=t!=null?t.children:t)!=null?s.photosCount:s,t))+"</strong>\n </p>\n </div>\n"},13:function(e,t,n,r,i){return' <!--<img src="https://s.yimg.com/g/images/3mp.gif" alt=""/> -->\n <div id="photo-is-three-mp"></div>\n'},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var s,o=t!=null?t:{};return'<div id="curator-control-panel">\n'+((s=n.unless.call(o,t!=null?t.ownerEnrolled:t,{name:"unless",hash:{},fn:e.program(1,i,0),inverse:e.program(3,i,0),data:i}))!=null?s:"")+"\n"+((s=n["if"].call(o,(s=t!=null?t.children:t)!=null?s.is3Megapixels:s,{name:"if",hash:{},fn:e.program(13,i,0),inverse:e.noop,data:i}))!=null?s:"")+" \n</div>\n \n"},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/curator-control-panel",function(t,i){return i=i||{},i.partials=i.partials?e.merge(r,i.partials):r,n(t,i)})},"@VERSION@",{requires:["template-base","handlebars-base"]});
YUI.add("curator-photo-tools-view",function(e){e.namespace("Views")[this.name]=e.Base.create("curator-photo-tools-view",e.FlickrView,[],{initializer:function(e){return this.nsid=e.nsid,this.photoId=e.photoId,this.isModalOpen=!1,this.modal=null,this.photoStatusId=null,this.photoStatusMap=null,this.photoCount=0,this},subviewConfig:{},loadState:function(){var t=this,n;return n={curationPhotomappingsModel:this.appContext.getModel("curation-photomappings-model",this.nsid),photoModel:this.appContext.getModel("photo-models",this.photoId),nsid:this.nsid,photoStatus:this.getPhotoStatus()},(new e.FlickrPromise(n)).then(function(n){var r,i;t.curationPhotomappingsModel=n.curationPhotomappingsModel,t.photoStatusMap=t.curationPhotomappingsModel.getValue("status"),t.photographerStatusMap=t.curationPhotomappingsModel.getValue("owner_status"),t.photoModel=n.photoModel,t.photoStatusId=n.photoStatusId,t.photoStatusId=parseInt(n.photoStatus.status,10),t.is3Megapixels=n.photoStatus.is3Megapixels?!!n.photoStatus.is3Megapixels:!1,t.ownerAddedForCuration=n.photoStatus.ownerAddedForCuration?!!n.photoStatus.ownerAddedForCuration:!1,t.ownerEnrolled=n.photoStatus.ownerEnrolled?!!n.photoStatus.ownerEnrolled:!1,t.ownerLocked=n.photoStatus.ownerLocked?!!n.photoStatus.ownerLocked:!1,t.ownerClaimedByMe=n.photoStatus.ownerClaimedByMe?!!n.photoStatus.ownerClaimedByMe:!1,t.photoAddedForCuration=n.photoStatus.photoAddedForCuration?!!n.photoStatus.photoAddedForCuration:!1,t.ownerId=n.photoStatus.ownerId?n.photoStatus.ownerId:0,t.ownerStatusId=n.photoStatus.ownerStatus?n.photoStatus.ownerStatus:"None",t.photographerClaimedBy=n.photoStatus.ownerClaimedByByid?n.photoStatus.ownerClaimedByByid:"Who Knows?!",t.photographerStatus=n.photoStatus.ownerStatus?n.photoStatus.ownerStatus:"None",r=e.StorageHelper.getItem("curationPhotoCount_"+n.nsid),n.photoStatus.photosCount?(t.photosCount=n.photoStatus.photosCount,t.addPhotoCount(t.photosCount)):r?t.photosCount=r:t.photosCount=0,i=e.one("#curator-control-panel"),i&&i.remove(!0)},function(e){console.log("Error getting photomapping model or photo model",e)})},getPhotoStatus:function(){var e={photo_id:this.photoId,fetch_photos_count:this.getCountStatus()};return this.appContext.callAPI("flickr.licensing.curation.getPhotoStatus",e).then(function(e){return e.photos.photo.curation[0]},function(){console.error("Error calling API method: flickr.licensing.curation.getPhotoStatus",arguments)})},getCountStatus:function(){var t,n,r,i,s,o=!1,u=900;return i=Math.round((new Date).getTime()/1e3),n="curationPhotoCount_"+this.nsid,s="curationPhotoCountUpdateTime_"+this.nsid,r=e.StorageHelper.getItem(n),r||(o=!0),o||(t=parseInt(e.StorageHelper.getItem(s)),o=i-t>u),o},addPhotoCount:function(t){var n,r,i;return n="curationPhotoCount_"+this.nsid,r="curationPhotoCountUpdateTime_"+this.nsid,i=Math.round((new Date).getTime()/1e3),e.StorageHelper.setItem(r,i),e.StorageHelper.setItem(n,t),!0},buildContainer:function(){return this},activate:function(){var e,t=this;return e=this.appContext.getViewer().prefs.keyboardShortcutsEnabled,this.setupCuratorTools(),e&&this.registerEventHandler(this.attachKeyEvent("down:87",function(e){e.preventDefault(),t.handleAddPhotoClick(e)})),this},destructor:function(){e.one("#curator-control-panel")&&e.one("#curator-control-panel").remove(!0)},setupCuratorTools:function(){if(this.get("destroyed"))return;var t,n=this;e.Array.find(this.photoStatusMap,function(e){if(e.id===n.photoStatusId)return t=e.name,!0}),e.one("#content").appendChild(e.Node.create(this.templates("curator-control-panel")({ownerAddedForCuration:this.ownerAddedForCuration,photographerStatus:this.ownerAddedForCuration?this.photographerStatus:"none",photographerStatusString:this.ownerAddedForCuration?"Update this photographer":"Add this photographer",ownerId:this.ownerId,ownerEnrolled:this.ownerEnrolled,ownerLocked:this.ownerLocked,addPhotoButton:!this.photoAddedForCuration&&this.ownerClaimedByMe,photoClaimedByMe:this.ownerClaimedByMe&&this.photoAddedForCuration,updateUrl:this.ownerClaimedByMe&&this.photoAddedForCuration?"/god/licensing/curation/editor_2/accounts/"+this.ownerId+"/photos/":"/god/licensing/curation/editor_2/accounts/"+this.ownerId,updateString:this.ownerClaimedByMe&&this.photoAddedForCuration?"Update this photographer's photos":"Update this photographer",children:{ownerClaimedByMe:this.ownerClaimedByMe,photoAddedForCuration:this.photoAddedForCuration,photoStatus:this.photoAddedForCuration?t:"none",photosCount:this.photosCount,photographerClaimedBy:this.ownerClaimedByMe?"YOU!":this.photographerClaimedBy,is3Megapixels:this.is3Megapixels}}))),this.registerEventHandler(e.one("#curator-photo-submit").on("click",this.handleAddPhotoClick,this))},updateStatus:function(){var t,n=this;t={photo_id:this.photoId,fetch_photos_count:this.getCountStatus()},this.appContext.callAPI("flickr.licensing.curation.getPhotoStatus",t).then(function(t){var r,i,s=t.photos.photo.curation[0];n.photoStatusId=parseInt(s.status,10),n.is3Megapixels=s.is3Megapixels?!!s.is3Megapixels:!1,n.ownerAddedForCuration=s.ownerAddedForCuration?!!s.ownerAddedForCuration:!1,n.ownerEnrolled=s.ownerEnrolled?!!s.ownerEnrolled:!1,n.ownerLocked=s.ownerLocked?!!s.ownerLocked:!1,n.ownerClaimedByMe=s.ownerClaimedByMe?!!s.ownerClaimedByMe:!1,n.photoAddedForCuration=s.photoAddedForCuration?!!s.photoAddedForCuration:!1,n.ownerId=s.ownerId?s.ownerId:0,n.ownerStatusId=s.ownerStatus?s.ownerStatus:"None",n.photographerClaimedBy=s.ownerClaimedByByid?s.ownerClaimedByByid:"Who Knows?!",n.photographerStatus=s.ownerStatus?s.ownerStatus:"None",n.photosCount=s.photosCount?s.photosCount:0,r=e.StorageHelper.getItem("curationPhotoCount_"+n.nsid),s.photosCount?n.photosCount=s.photosCount:r?n.photosCount=parseInt(r,10)+1:n.photosCount=1,n.addPhotoCount(n.photosCount),i=e.one("#curator-control-panel"),i&&i.remove(!0),n.setupCuratorTools()})},handleAddPhotoClick:function(t){t.preventDefault();var n="",r=this;if(this.isModalOpen&&this.modal){this.modal.close(),this.isModalOpen=!1,this
.modal=null;return}n='<form id="curator-photo-selection-form">',n+=this.buildPhotoCurationForm(this.photoId,this.getImageUrl(this.photoModel)),n+="</form>",this.modal=(new e.Views.FluidModal({appContext:r.appContext,title:"Submit this photo",htmlMessage:n,width:840,height:600,dismissOnActionClick:!1})).show(),this.registerEventHandler(this.modal.on("activated",function(t){this.isModalOpen=!0,e.one("#curator-photo-selection-form .photo-category-select").focus()},this)),this.registerEventHandler(this.modal.on("actionClick",this.handlePhotoSubmission,this)),this.registerEventHandler(this.modal.on("cancelClick",function(e){this.isModalOpen=!1,this.modal=null},this))},buildPhotoCurationForm:function(e,t){var n;return this.photoFormState=this.getPhotoMetadata("curator-photo-form-state"),n=this.templates("curator-tool-photo-metadata-form")({categoryOptions:this.buildOptions("category"),collectionOptions:this.buildOptions("collection"),modelReleasesOptions:this.buildOptions("model-releases"),propertyReleasesOptions:this.buildOptions("property-releases"),technicalOptions:this.buildOptions("technical"),legalOptions:this.buildOptions("legal"),useTypeOptions:this.buildOptions("useType"),photoId:e,imgUrl:t}),n},buildOptions:function(t){var n="",r,i,s,o=this;if(this.photoFormState)try{s=e.JSON.parse(this.photoFormState)}catch(u){console.error("Error parsing JSON from local storage",u)}if(t==="model-releases"||t==="property-releases")for(r=0;r<=20;r++)n+='<option value="'+r+'">'+r+"</option>";else i=this.curationPhotomappingsModel.getValue(t),t==="technical"&&i.unshift({id:0,name:"None"}),e.Array.each(i,function(e){if(t==="technical")if(o.is3Megapixels)switch(parseInt(e.id,10)){case 4:case 5:case 6:case 7:case 9:return}else switch(parseInt(e.id,10)){case 0:case 1:case 2:case 3:case 9:return}if(t==="collection"&&e.name==="Flickr Prime (RM)")return;t==="category"||t==="collection"?s&&s[t]&&parseInt(s[t],10)===e.id?n+='<option value="'+e.id+'" selected>'+e.name+"</option>":n+='<option value="'+e.id+'">'+e.name+"</option>":n+='<option value="'+e.id+'">'+e.name+"</option>"});return n},getImageUrl:function(e){var t=e.getValue("ascendingSizes"),n=Math.min(5,t.length-1);return t[n].url},handlePhotoSubmission:function(t){var n,r,i=this.photoId,s,o=this;n={photos:{photo:[]}},r=e.one("#curator-photo-selection-form");if(!r)return;r.one(".photo-use-type-select").removeClass("error"),r.one(".photo-category-select").removeClass("error"),(r.one(".photo-category-select").get("value")===""||r.one(".photo-category-select").get("value")==="0")&&r.one(".photo-category-select").addClass("error"),(r.one(".photo-use-type-select").get("value")===""||r.one(".photo-use-type-select").get("value")==="0")&&r.one(".photo-use-type-select").addClass("error");if(r.one(".photo-category-select").get("value")===""||r.one(".photo-category-select").get("value")==="0"||r.one(".photo-use-type-select").get("value")===""||r.one(".photo-use-type-select").get("value")==="0")return!1;n.photos.photo.push({id:i,category:r.one(".photo-category-select").get("value"),collection:r.one(".photo-collection-select").get("value"),model_releases:r.one(".photo-model-releases-select").get("value"),property_releases:r.one(".photo-property-releases-select").get("value"),technical_review:r.one(".photo-technical-select").get("value"),legal_review:r.one(".photo-legal-select").get("value"),use_type:r.one(".photo-use-type-select").get("value")}),s={category:r.one(".photo-category-select").get("value"),collection:r.one(".photo-collection-select").get("value")},window&&window.localStorage&&window.localStorage.clear&&e.Object.some(window.localStorage,function(e,t){return t.indexOf("curator-photo-metadata")>-1?(window.localStorage.clear(),!0):!1}),this.savePhotoMetadata("curator-photo-form-state",e.JSON.stringify(s)),n.photos.photo.length>0&&this.appContext.callAPI("flickr.licensing.curation.addPhotos",{json:e.JSON.stringify(n)}).then(function(){o.isModalOpen=!1,o.modal.close(),o.updateStatus(),o.modal=null},function(){o.isModalOpen=!1,o.modal.close(),o.modal=null,console.error("flickr.licensing.curation.addPhotos error",arguments)})},savePhotoMetadata:function(t,n){try{return e.StorageHelper.setItem(t,n),!0}catch(r){return!1}},getPhotoMetadata:function(t){try{return e.StorageHelper.getItem(t)}catch(n){return!1}}},{ATTRS:{}})},"@VERSION@",{requires:["flutil","flickr-view","flickr-promise","fluid-modal-view","fluid-css","products-form-css","products-new-payment-form-css","curator-tools-css","curation-photomappings-model","hermes-template-curator-tool-photo-metadata-form","hermes-template-curator-control-panel"],optional:[]});
/*
YUI 3.16.0 (build 76f0e08)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add("yui-throttle",function(e,t){
/*! Based on work by Simon Willison: http://gist.github.com/292562 */
;e.throttle=function(t,n){n=n?n:e.config.throttleTime||150;if(n===-1)return function(){t.apply(this,arguments)};var r=e.Lang.now();return function(){var i=e.Lang.now();i-r>n&&(r=i,t.apply(this,arguments))}}},"3.16.0",{requires:["yui-base"]});
YUI.add("hermes-template-photo-well-scrappy",function(e,t){var n=e.Template.Handlebars.revive({1:function(e,t,n,r,i){return" enable-zoom"},3:function(e,t,n,r,i){return" no-click"},5:function(e,t,n,r,i){return" is-hidden"},7:function(e,t,n,r,i){var s;return e.escapeExpression((s=(s=n["prev-url"]||(t!=null?t["prev-url"]:t))!=null?s:n.helperMissing,typeof s=="function"?s.call(t!=null?t:{},{name:"prev-url",hash:{},data:i}):s))},9:function(e,t,n,r,i){return"#"},11:function(e,t,n,r,i){var s;return e.escapeExpression((s=(s=n["prev-title"]||(t!=null?t["prev-title"]:t))!=null?s:n.helperMissing,typeof s=="function"?s.call(t!=null?t:{},{name:"prev-title",hash:{},data:i}):s))},13:function(e,t,n,r,i){var s;return e.escapeExpression((s=(s=n["next-url"]||(t!=null?t["next-url"]:t))!=null?s:n.helperMissing,typeof s=="function"?s.call(t!=null?t:{},{name:"next-url",hash:{},data:i}):s))},15:function(e,t,n,r,i){var s;return e.escapeExpression((s=(s=n["next-title"]||(t!=null?t["next-title"]:t))!=null?s:n.helperMissing,typeof s=="function"?s.call(t!=null?t:{},{name:"next-title",hash:{},data:i}):s))},17:function(e,t,n,r,i){var s=t!=null?t:{},o=n.helperMissing,u=e.escapeExpression;return" "+u((n.outlet||t&&t.outlet||o).call(s,t!=null?t["photo-sidebar-toggle-view"]:t,{name:"outlet",hash:{},data:i}))+"\n "+u((n.outlet||t&&t.outlet||o).call(s,t!=null?t["photo-sidebar-actions-view"]:t,{name:"outlet",hash:{},data:i}))+"\n "+u((n.outlet||t&&t.outlet||o).call(s,t!=null?t["attribution-view"]:t,{name:"outlet",hash:{},data:i}))+"\n "+u((n.outlet||t&&t.outlet||o).call(s,t!=null?t["people-notes-view"]:t,{name:"outlet",hash:{},data:i}))+"\n "+u((n.outlet||t&&t.outlet||o).call(s,t!=null?t["photo-engagement-view"]:t,{name:"outlet",hash:{},data:i}))+"\n"},19:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a="function",f=e.escapeExpression;return" <a class='entry-type do-not-evict' href='"+f((s=(s=n.entryURL||(t!=null?t.entryURL:t))!=null?s:u,typeof s===a?s.call(o,{name:"entryURL",hash:{},data:i}):s))+'\'><div class="icon"></div> '+f((s=(s=n.backToLabel||(t!=null?t.backToLabel:t))!=null?s:u,typeof s===a?s.call(o,{name:"backToLabel",hash:{},data:i}):s))+"</a>\n"},compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var s,o,u=t!=null?t:{},a=n.helperMissing,f="function",l=e.escapeExpression;return'<div class="height-controller'+((s=n["if"].call(u,t!=null?t.enableZoom:t,{name:"if",hash:{},fn:e.program(1,i,0),inverse:e.noop,data:i}))!=null?s:"")+'" style="height: '+l((o=(o=n.height||(t!=null?t.height:t))!=null?o:a,typeof o===f?o.call(u,{name:"height",hash:{},data:i}):o))+'px;">\n\n <a class="navigate-target navigate-prev'+((s=n["if"].call(u,t!=null?t["prev-is-not-clickable"]:t,{name:"if",hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i}))!=null?s:"")+((s=n["if"].call(u,t!=null?t["is-hidden"]:t,{name:"if",hash:{},fn:e.program(5,i,0),inverse:e.noop,data:i}))!=null?s:"")+'" href="'+((s=n["if"].call(u,t!=null?t["prev-url"]:t,{name:"if",hash:{},fn:e.program(7,i,0),inverse:e.program(9,i,0),data:i}))!=null?s:"")+'" title="'+((s=n["if"].call(u,t!=null?t["prev-url"]:t,{name:"if",hash:{},fn:e.program(11,i,0),inverse:e.noop,data:i}))!=null?s:"")+'" data-track="prevPhotoButtonClick" data-action="ad" style="height: '+l((o=(o=n.navHeight||(t!=null?t.navHeight:t))!=null?o:a,typeof o===f?o.call(u,{name:"navHeight",hash:{},data:i}):o))+'px;"><span class="hide-text">←</span></a>\n\n '+l((n.outlet||t&&t.outlet||a).call(u,t!=null?t["photo-well-media-view"]:t,{name:"outlet",hash:{},data:i}))+"\n "+l((n.outlet||t&&t.outlet||a).call(u,t!=null?t["photo-notes-scrappy-view"]:t,{name:"outlet",hash:{},data:i}))+'\n\n <a class="navigate-target navigate-next'+((s=n["if"].call(u,t!=null?t["next-is-not-clickable"]:t,{name:"if",hash:{},fn:e.program(3,i,0),inverse:e.noop,data:i}))!=null?s:"")+((s=n["if"].call(u,t!=null?t["is-hidden"]:t,{name:"if",hash:{},fn:e.program(5,i,0),inverse:e.noop,data:i}))!=null?s:"")+'" href="'+((s=n["if"].call(u,t!=null?t["next-url"]:t,{name:"if",hash:{},fn:e.program(13,i,0),inverse:e.program(9,i,0),data:i}))!=null?s:"")+'" title="'+((s=n["if"].call(u,t!=null?t["next-url"]:t,{name:"if",hash:{},fn:e.program(15,i,0),inverse:e.noop,data:i}))!=null?s:"")+'" data-track="nextPhotoButtonClick" data-action="ad" style="height: '+l((o=(o=n.navHeight||(t!=null?t.navHeight:t))!=null?o:a,typeof o===f?o.call(u,{name:"navHeight",hash:{},data:i}):o))+'px;"><span class="hide-text">→</span></a>\n\n'+((s=n.unless.call(u,t!=null?t["is-ad"]:t,{name:"unless",hash:{},fn:e.program(17,i,0),inverse:e.noop,data:i}))!=null?s:"")+"\n"+((s=n.unless.call(u,t!=null?t.hideBackToLink:t,{name:"unless",hash:{},fn:e.program(19,i,0),inverse:e.noop,data:i}))!=null?s:"")+"\n "+l((n.outlet||t&&t.outlet||a).call(u,t!=null?t["context-slider-view"]:t,{name:"outlet",hash:{},data:i}))+"\n\n</div>"},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/photo-well-scrappy",function(t,i){return i=i||{},i.partials=i.partials?e.merge(r,i.partials):r,n(t,i)})},"@VERSION@",{requires:["template-base","handlebars-base"]});
YUI.add("hermes-template-photo-page-right-size-express",function(e,t){var n=e.Template.Handlebars.revive({compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){var s,o=t!=null?t:{},u=n.helperMissing,a="function",f=e.escapeExpression;return'\n<script type="text/javascript">\n\n (function(){\n\n var PADDING_HORIZONTAL = 40;\n\n window.getPhotoWellHeight = function () {\n\n var minHeight = 500,\n winWidth = window.innerWidth,\n winHeight = window.innerHeight - 50,\n ratioNarrow = 1,\n ratioRegular = 2.3,\n ratioTransitional = 2.75,\n idealSubphotoHeight = 120,\n breakHeightNarrow = (winWidth / ratioNarrow) + idealSubphotoHeight,\n breakHeightRegular = (winWidth / ratioRegular) + idealSubphotoHeight,\n breakHeightTransitional = winWidth / ratioTransitional,\n newPhotoWellHeight;\n\n if (winHeight > breakHeightNarrow) {\n\n newPhotoWellHeight = winWidth / ratioNarrow;\n\n } else if (winHeight > breakHeightRegular) {\n\n newPhotoWellHeight = winHeight - idealSubphotoHeight;\n\n } else if (winHeight > breakHeightTransitional) {\n\n newPhotoWellHeight = winHeight - idealSubphotoHeight + idealSubphotoHeight * (winHeight - breakHeightRegular) / (breakHeightTransitional - breakHeightRegular);\n\n } else {\n\n newPhotoWellHeight = winHeight;\n\n }\n\n return Math.max(minHeight, Math.round(newPhotoWellHeight));\n\n }\n\n function domReady () {\n\n try {\n\n if (document.getElementsByClassName("low-res-photo")[0]) {\n\n var photoWellView = document.getElementsByClassName("photo-well-scrappy-view")[0],\n heightController = photoWellView.getElementsByClassName("height-controller")[0],\n photoWellMediaView = document.getElementsByClassName("photo-well-media-scrappy-view")[0],\n lowResImageElement = photoWellMediaView.getElementsByClassName("low-res-photo")[0],\n photoWidth = '+f((s=(s=n.photoWidth||(t!=null?t.photoWidth:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoWidth",hash:{},data:i}):s))+",\n photoHeight = "+f((s=(s=n.photoHeight||(t!=null?t.photoHeight:t))!=null?s:u,typeof s===a?s.call(o,{name:"photoHeight",hash:{},data:i}):s))+',\n photoAspectRatio = photoWidth / photoHeight,\n photoWellHeight = window.getPhotoWellHeight(),\n photoWellMediaViewPadding = {\n top: parseInt(getComputedStyle(photoWellMediaView)[\'paddingTop\'].match(/[0-9]+/)[0], 10),\n right: PADDING_HORIZONTAL,\n bottom: parseInt(getComputedStyle(photoWellMediaView)[\'paddingBottom\'].match(/[0-9]+/)[0], 10),\n left: PADDING_HORIZONTAL\n },\n canvasSize = {\n height: photoWellHeight - photoWellMediaViewPadding.top - photoWellMediaViewPadding.bottom,\n width: window.innerWidth - photoWellMediaViewPadding.left - photoWellMediaViewPadding.right\n };\n\n heightController.style.height = photoWellHeight + "px";\n\n if (photoWidth <= canvasSize.width && photoHeight <= canvasSize.height) {\n lowResImageElement.style.height = photoHeight + "px";\n lowResImageElement.style.width = photoWidth + "px";\n } else {\n if (photoAspectRatio < 1 || Math.round(canvasSize.width / photoAspectRatio) > canvasSize.height) {\n lowResImageElement.style.height = canvasSize.height + "px";\n lowResImageElement.style.width = Math.round(canvasSize.height * photoAspectRatio) + "px";\n } else {\n lowResImageElement.style.height = Math.round(canvasSize.width / photoAspectRatio) + "px";\n lowResImageElement.style.width = canvasSize.width + "px";\n }\n }\n\n }\n\n } catch (e) {\n if (window.sendRequest) {\n window.sendRequest(\'flickr.hermes.photoDimensionCorrectionError\', \'There was a JS error when trying to correct a server rendered photo.\');\n }\n }\n\n }\n\n if (document.readyState != \'loading\'){\n domReady();\n } else {\n document.addEventListener(\'DOMContentLoaded\', domReady);\n }\n\n }());\n\n</script>'},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/photo-page-right-size-express",function(t,i){return i=i||{},i.partials=i.partials?e.merge(r,i.partials):r,n(t,i)})},"@VERSION@",{requires:["template-base","handlebars-base"]});
YUI.add("flickr-video-player",function(e,t){var n=require("lib/flog")(t),r={playlistUrl:e.url("/video_playlist.gne",{protocol:!1}),lang:e.config.lang,comscoreC4:"",defaultResolution:"1080p",atlas:{maxBitrate:4e3,domain:"video.yahoo.com"},css:{processing:"processing"},messages:{processing:"This video is being processed"}};e.FlickrVideoPlayer=function(e){this.container=e.container,this.model=e.model,this.appContext=e.appContext,this.currentStream=null,this.HTML5=e.forceHTML5||this.appContext.flipper.isFlipped("enable-html5-video-2016"),this.videoNode=e.videoNode,this.showControls=typeof e.showControls!="undefined"?e.showControls:!0,this.autoplay=e.autoplay||!1,this.loop=e.loop||!1,this.muted=e.muted||!1},e.FlickrVideoPlayer.prototype={render:function(){var t,i,s=this;this.setCurrentStream(r.defaultResolution,"noop");if(this.HTML5){this.player.on("error",function(){var e=s.getStream(s.currentStream.resolution,!0);s.setCurrentStream(e.resolution,"noop"),s.player.src(s.currentStream.url),s.player.play()}),this.player.src(this.currentStream.url);return}s.appContext.flipper.isFlipped("enable-nextgen-videoplayer")?t={playlist:{mediaItems:[{images:s.getThumbnails(),streams:[{url:this.currentStream.url}]}]},pageSpaceId:this.appContext.flapp.get("activeView").get("spaceid").toString(),comscoreC4:"flickr",settingscreen:!1,pausescreen:!1,html5:s.appContext.flipper.isFlipped("enable-html5-videoplayer")?!0:!1}:(t={playlist:{mediaItems:[]},pageSpaceId:this.appContext.flapp.get("activeView").get("spaceid"),comscoreC4:r.comscoreC4,lang:r.lang,autoplay:!1},t.playlist.mediaItems.push(this.toMediaItem(this.currentStream))),t.region="US",t.site="flickr",this.player=new e.VideoPlatform.VideoPlayer(t),this.player.render(this.container),i=e.VideoPlatform.API_Events,this.player.on(i.PLAYER_RENDERED,function(e){var t=s.container.one(".yvp-html5-video");s.appContext.flipper.isFlipped("enable-nextgen-videoplayer")&&t&&t.on("contextmenu",function(e){return e.preventDefault(),!1})}),this.player.on(i.PLAYER_ERROR,function(e){var t;s.appContext.flipper.isFlipped("enable-nextgen-videoplayer")?t=s.container.one(".yvp-content"):t=s.container.one(".yui3-videoplayer-content"),n.error({err:e});if(s.__retry){t.removeClass("retrying");return}s.__retry=!0,t.addClass("retrying"),s.loadStreams().then(function(){s.setCurrentStream(s.currentStream.resolution),s.play()})}),this.player.on(i.PLAYBACK_ERROR,function(e){n.error({err:e})})},hasHdStream:function(){return this.streams["1080p"]||this.streams["720p"]||this.streams.appletv},isHdStream:function(e){return["1080p","720p","appletv"].indexOf(this.currentStream.resolution)>=0},play:function(){this.player&&(this.HTML5?this.player.play():this.player.controls.play())},pause:function(){this.player&&(this.HTML5?this.player.pause():this.player.controls.pause())},resize:function(e,t){this.container.setStyles({width:e+"px",height:t+"px"})},setCurrentStream:function(e,t){this.currentStream&&this.quality&&this.quality.removeClass("q"+this.currentStream.resolution),this.currentStream=this.getStream(e),this.quality&&this.quality.addClass("q"+this.currentStream.resolution);if(t)return;this.player.playlist.clear(),this.player.playlist.addItem(this.toMediaItem(this.currentStream)),this.player.playlist.setPosition(0)},toMediaItem:function(e){return{streamUrl:e.url,images:this.getThumbnails()}},init:function(){var t,n=this;return t=new e.FlickrPromise({script:this.loadScript(),streams:this.loadStreams(),domLive:this._waitDomLive()}),t.then(function(e){n.render()},function(e){console.warn("Error:"+e)})},_waitDomLive:function(){var t=this.container.getDOMNode().parentElement;return new e.Promise(function(e,n){var r=50,i;i=function(){var n=t.parentElement;while(n&&n!==document.body)n=n.parentElement;if(n)return e();if(r--<0)return;setTimeout(i,100)},i()})},getStream:function(e,t){var n,r,i;n=["1080p","720p","appletv","360p","700","300","100","iphone_wifi","288p"],e&&(i=n.indexOf(e)+(t?1:0),n=i>0?n.slice(i):n);while(n.length){r=this.streams[n.shift()];if(r)return r}return{}},getThumbnails:function(){var e,t;return t={width:parseInt(this.container.getComputedStyle("width"),10)||800,height:parseInt(this.container.getComputedStyle("height"),10)||600},e=this.model.getSizeToFit(t,{excludeSizes:[]}),{large:e.url,medium:e.url,small:e.url}},loadScript:function(){var t=this;return new e.Promise(function(n,i){var s,o;if(e.VideoPlatform){n();return}if(t.HTML5){e.use("videojs",function(){window.videojs(t.videoNode,{controls:t.showControls,poster:t.getThumbnails().large,autoplay:t.autoplay,loop:t.loop,muted:t.muted},function(){t.player=this,n()})});return}o=function(){e.use("videoplayer",n)},t.appContext.flipper.isFlipped("enable-nextgen-videoplayer")?(r.yepSourceUrl="//yep.video.yahoo.com/js/3/videoplayer-min.js?r=nextgen-flash",r.yepMobileSourceUrl="//yep.video.yahoo.com/js/3/videoplayer-min.js?r=nextgen"):r.yepSourceUrl="//yep.video.yahoo.com/js/3/videoplayer-min.js?lang="+r.lang,s=document.createElement("script"),s.onload=o,e.UA&&e.UA.mobile&&r.yepMobileSourceUrl?s.src=r.yepMobileSourceUrl:s.src=r.yepSourceUrl,document.head.appendChild(s)})},loadStreams:function(){var t=this;return new e.Promise(function(e,r){var i;i={photo_id:t.model.getValue("id"),secret:t.model.getValue("secret")},t.appContext.callAPI("flickr.video.getStreamInfo",i).then(function(r){try{t.streams=r.streams.stream.reduce(function(e,t){var n=t.type+"";return e[n]={resolution:n,url:t.content},e},{})}catch(i){t.streams={}}Object.keys(t.streams).length||n.error("no streams available"),e()},function(e){if(e&&e.code&&e.code.toString()==="1")return t.setProcessing();n.error("error fetching playlist")})})},loadXmlStreams:function(){var t=this;return new e.Promise(function(i,s){var o,u;o={nsid:t.model.getValue("owner").getValue("nsid"),video_id:t.model.getValue("id"),bitrate:r.atlas.maxBitrate,secret:t.model.getValue("secret"),rd:r.atlas.domain,noad:1},u=new XMLHttpRequest,u.open("GET",e.flutil.buildHttpQuery(r.playlistUrl,o)),u.onload=function(){var e,
r,s;e=document.createElement("div"),e.innerHTML=u.responseText,s=e.getElementsByTagName("duration")[0],s=s?parseInt(s.textContent,10):0;var o=e.getElementsByTagName("stream");o||(o=[]),r=Array.prototype.slice.call(o),t.streams=r.reduce(function(e,t){var n=Array.prototype.reduce.call(t.attributes,function(e,t){return e[t.name]=t.value,e},{});return n.url=n.app+n.fullpath,n.resolution=(n.path.match(/_([^\.\_]+)\./)||[])[1],n.duration=s,e[n.resolution]=n,e},{}),Object.keys(t.streams).length||n.error("no streams available"),i()},u.onerror=function(){n.error("error fetching playlist XML",{url:e.flutil.buildHttpQuery(r.playlistUrl,o)})},u.send()})},_cleanup:function(e){e=e.getDOMNode();var t=function(e){if(!e.firstChild)return;while(e.firstChild)t(e.firstChild),e.removeChild(e.firstChild)};t(e)},setProcessing:function(){var t=e.Node.create("<img/>");t.set("src",this.getThumbnails().large),this.container.appendChild(t)},destroy:function(){var e=this;try{if(this.HTML5&&window.videojs&&window.videojs.getPlayers){var t=window.videojs.getPlayers();Object.keys(t).forEach(function(n){t[n]===e.player&&(t[n].dispose(),window.videojs.players[n]&&delete window.videojs.players[n])})}this.player&&this.player.destroy&&this.player.destroy(),this.player=null,this.quality&&this.quality.detach(),this.quality=null,this._cleanup(this.container),this.container=null,this.model=null,this.appContext=null,this.streams=null}catch(n){}}}},"@VERSION@",{requires:["flickr-promise","flutil","flickr-video-player-css","videojs-css","flickr-video-player","url"],optional:[]});
YUI.add("hermes-template-vr-overlay",function(e,t){var n=e.Template.Handlebars.revive({compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){return'<a class="close"><span></span></a>'},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/vr-overlay",function(t,i){return i=i||{},i.partials=i.partials?e.merge(r,i.partials):r,n(t,i)})},"@VERSION@",{requires:["template-base","handlebars-base"]});
YUI.add("hermes-template-flickr-balls",function(e,t){var n=e.Template.Handlebars.revive({compiler:[7,">= 4.0.0"],main:function(e,t,n,r,i){return'<div class="balls">\n <div class="blue ball"></div><div class="pink ball"></div>\n</div>'},useData:!0}),r={};e.Array.each([],function(t){var n=e.Template.get("hermes/"+t);n&&(r[t]=n)}),e.Template.register("hermes/flickr-balls",function(t,i){return i=i||{},i.partials=i.partials?e.merge(r,i.partials):r,n(t,i)})},"@VERSION@",{requires:["template-base","handlebars-base"]});
YUI.add("flickr-favorites-add-updater",function(e,t){"use strict";function n(n,r){var i={};return i.photo_id=n.photoId,r.callAPI("flickr.favorites.add",i).then(null,e.FetcherErrorLogger(t))}e.namespace("ModelUpdaters")["flickr-favorites-add"]={run:n}},"@VERSION@",{requires:["flickr-promise"],optional:[]});
YUI.add("flickr-favorites-remove-updater",function(e,t){"use strict";function n(n,r){var i={};return i.photo_id=n.photoId,i.user_id=n.userId,r.callAPI("flickr.favorites.remove",i).then(null,e.FetcherErrorLogger(t))}e.namespace("ModelUpdaters")["flickr-favorites-remove"]={run:n}},"@VERSION@",{requires:["flickr-promise"],optional:[]});
YUI.add("photo-model-helper",function(e,t){var n=require("lib/flog")(t);e.PhotoModelHelper={updateEngagement:function(t,n){var r=[],i;return e.Lang.isObject(n,!0)&&"isFaved"in n&&(i=n.isFaved.newVal?"flickr-favorites-add":"flickr-favorites-remove",r.push(e.ModelUpdaters[i].run({photoId:t},this.appContext))),e.Promise.all(r)},toggleFave:function(e){var t=this.getValue(e,"faveCount"),n=this.getValue(e,"isFaved"),r=!n,i="photo-engagement-models",s=t+(r?1:-1);this.setValues(e,{isFaved:r,faveCount:s}),this.name!==i&&this.appContext.getModelRegistry(i).then(function(t){t.exists(e)&&t.toggleFave(e)})},addAsFave:function(e){var t=this.getValue(e,"faveCount"),n=this.getValue(e,"isFaved"),r="photo-engagement-models";return n||this.setValues(e,{isFaved:!0,faveCount:t+1}),this.name!==r&&this.appContext.getModelRegistry(r).then(function(t){t.exists(e)&&t.toggleFave(e)}),!n},getLargestSize:function(e,t){return this.getSizeToFit(e,{width:Number.MAX_VALUE,height:Number.MAX_VALUE},t)},getSizeToFit:function(t,r,i){i=i||{};var s=this,o,u=r.width,a=r.height,f=!!i.cropToFit,l=i.includeSquare,c=i.sizes||this.getValue(t,"sizes"),h=i.excludeSizes||["o"],p=i.includeSizes,d,v,m;if(typeof i.includeSizes=="undefined")try{p=Object.keys(c)}catch(g){n.warn("getSizeToFit with invalid sizes",{err:g,sizes:c})}return this._getSizeToFitMemo=this._getSizeToFitMemo||{},o=[t,u,a,f,h.sort().join(""),p.sort().join("")].join("_"),this._getSizeToFitMemo[o]||(e.Object.each(c,function(e,n){var r,i,s,o,c,g;if(e&&h.indexOf(n)===-1&&p.indexOf(n)>-1)if(l||!this.isSizeSquare(n)||this.isPhotoSquare(t)){r=parseInt(e.width,10),i=parseInt(e.height,10),f&&r>=u&&i>=a?s=!0:!f&&(r>=u||i>=a)&&(s=!0),s&&(d?(o=parseInt(d.height,10),i<o&&(d=e)):d=e);if(v){c=parseInt(v.width,10),g=parseInt(v.height,10);if(r>c||i>g)v=e}else v=e}m=d||v},this),this._getSizeToFitMemo[o]=m,this._getSizeToFitMemoTimer||(this._getSizeToFitMemoTimer=setTimeout(function(){delete s._getSizeToFitMemo,delete s._getSizeToFitMemoTimer},1e4))),e.clone(this._getSizeToFitMemo[o],!0)},getSizeIfExact:function(e,t){var n=this.getValue(e,"sizes"),r,i;return Object.keys(n).some(function(e){return e==="o"?!1:(i=n[e],t.height===i.height&&t.width===i.width?(r=i,!0):!1)}),r},isSizeSquare:function(e){var t={sq:"sq",q:"q"};return!!t[e]},isPhotoSquare:function(t){var n;return this._isPhotoSquareMemo=this._isPhotoSquareMemo||{},typeof this._isPhotoSquareMemo[t]!="undefined"?n=this._isPhotoSquareMemo[t]:(n=!0,e.Object.some(this.getValue(t,"sizes"),function(e,t){var r;if(e&&e.width&&e.height&&!this.isSizeSquare(t)){r=parseInt(e.width,10)/parseInt(e.height,10);if(r!==1)return n=!1,!0}},this),this._isPhotoSquareMemo[t]=n),n},getSizeForCanvas:function(e,t,n,r){r=r||1;var i=this.getSizeToFit(e,{width:t*r,height:n*r}),s,o;return s=Math.min(n/r,i.height),o=Math.min(t/r,i.width/i.height*s),s=Math.min(s,i.height/i.width*o),{width:Math.round(o),height:Math.round(s),url:i.url,pixelRatio:i.width/o}},attributes:{title:{validator:function(t,n){return e.AttributeHelpers.validateString(t)},setter:function(t){return e.AttributeHelpers.coerceString(t)},defaultValue:""},description:{validator:function(t,n){return e.AttributeHelpers.validateString(t)},setter:function(t){return e.AttributeHelpers.coerceString(t)},defaultValue:""},mediaType:{validator:function(t,n){return e.AttributeHelpers.validateString(t)},setter:function(t){return e.AttributeHelpers.coerceString(t)},defaultValue:"photo"},license:{validator:function(t){return e.AttributeHelpers.validateInteger(t)},setter:function(t){return e.AttributeHelpers.coerceInteger(t)}},isVideo:{readOnly:!0,derivedBy:["mediaType"],getter:function(e,t){var n=this.getValue(t,"mediaType");return n==="video"}},isOwner:{readOnly:!0,derivedBy:["owner"],getter:function(e,t){var n=this.getValue(t,"owner"),r=this.appContext.getViewer();return!!r.signedIn&&n.getValue("id")===r.nsid}},sizes:{},descendingSizes:{readOnly:!0,derivedBy:["sizes"],defaultFn:function(e){var t,n,r=[];this._descendingSizesMemo=this._descendingSizesMemo||{};if(this._descendingSizesMemo[e])return this._descendingSizesMemo[e];t=this.getValue(e,"sizes");for(n in t)r.push(t[n]),r[r.length-1].key=n;return r.sort(function(e,t){return e.width<t.width?1:e.width===t.width?e.height<t.height?1:e.height===t.height?e.key==="o"?-1:1:-1:-1}),this._descendingSizesMemo[e]=r,r}},ascendingSizes:{readOnly:!0,derivedBy:["descendingSizes"],defaultFn:function(e){return this.getValue(e,"descendingSizes").reverse()}},aspectRatio:{readOnly:!0,derivedBy:["descendingSizes","rotation"],defaultFn:function(e){var t=this.getValue(e,"descendingSizes")[0];return t.key==="o"&&this.getValue(e,"rotation")%180!==0?t.height/t.width:t.width/t.height}},needsInterstitial:{validator:function(t){return e.AttributeHelpers.validateBoolean(t)},setter:function(t){return e.AttributeHelpers.coerceBoolean(t)},defaultValue:!1},canComment:{validator:function(t){return e.AttributeHelpers.validateBoolean(t)},setter:function(t){return e.AttributeHelpers.coerceBoolean(t)},defaultValue:!0},canPublicComment:{validator:function(t){return e.AttributeHelpers.validateBoolean(t)},setter:function(t){return e.AttributeHelpers.coerceBoolean(t)},defaultValue:!1},url:{readOnly:!0,derivedBy:["owner"],defaultFn:function(e){var t=this.getValue(e,"owner");return t?"/photos/"+t.getValue("pathAlias")+"/"+e:undefined}},rotation:{validator:function(t){return e.AttributeHelpers.validateInteger(t)},setter:function(t){return e.AttributeHelpers.coerceInteger(t)}},ownerNsid:{},isFaved:{validator:function(t){return e.AttributeHelpers.validateBoolean(t)},setter:function(t){return e.AttributeHelpers.coerceBoolean(t)},defaultValue:!1},faveCount:{validator:function(t){return e.AttributeHelpers.validateInteger(t)},setter:function(t){return t=e.AttributeHelpers.coerceInteger(t),t<0&&(t=0),t},defaultValue:0},commentCount:{validator:function(t){return e.AttributeHelpers.validateInteger(t)},setter:function(t){return t=e.AttributeHelpers.coerceInteger(t),t<0&&(t=0),t},defaultValue:0},canFave:{readOnly:!0
,derivedBy:["is_owner"],getter:function(e,t){return!this.getValue(t,"isOwner")}},is3MP:{validator:function(t){return e.AttributeHelpers.validateBoolean(t)},setter:function(t){return e.AttributeHelpers.coerceBoolean(t)},defaultValue:!1},ownerCountryApproved:{validator:function(t){return e.AttributeHelpers.validateBoolean(t)},setter:function(t){return e.AttributeHelpers.coerceBoolean(t)},defaultValue:!1},ownerFollowedByCurators:{validator:function(t){return e.AttributeHelpers.validateBoolean(t)},setter:function(t){return e.AttributeHelpers.coerceBoolean(t)},defaultValue:!1},ownerAdded:{validator:function(t){return e.AttributeHelpers.validateBoolean(t)},setter:function(t){return e.AttributeHelpers.coerceBoolean(t)},defaultValue:!1},ownerPassedOver:{validator:function(t){return e.AttributeHelpers.validateBoolean(t)},setter:function(t){return e.AttributeHelpers.coerceBoolean(t)},defaultValue:!1},statusColor:{defaultValue:""},isMarketplaceLicensable:{defaultFn:function(e){return!1}},marketplaceLicensingUrl:{setter:function(e){return e&&e.indexOf("http")<0&&(e="http://"+e),e},defaultFn:function(e){return""}}}}},"@VERSION@",{requires:["flickr-favorites-add-updater","flickr-favorites-remove-updater"]});
YUI.add("flickr-licensing-curation-passOverUser-updater",function(e,t){"use strict";function n(n,r){return r.callAPI("flickr.licensing.curation.passOverUser",n).then(null,e.FetcherErrorLogger(t))}e.namespace("ModelUpdaters")["flickr-licensing-curation-passOverUser"]={run:n}},"@VERSION@",{requires:["flickr-promise"]});
YUI.add("photo-curation-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-getInfo"].run(t,this.appContext)}},attributes:{is3MP:e.PhotoModelHelper.attributes.is3MP,ownerCountryApproved:e.PhotoModelHelper.attributes.ownerCountryApproved,ownerFollowedByCurators:e.PhotoModelHelper.attributes.ownerFollowedByCurators,ownerAdded:e.PhotoModelHelper.attributes.ownerAdded,ownerPassedOver:e.PhotoModelHelper.attributes.ownerPassedOver,statusColor:e.PhotoModelHelper.attributes.statusColor}})},"@VERSION@",{requires:["flickr-model-registry","flickr-licensing-curation-passOverUser-updater","attribute-helpers"]});
YUI.add("flickr-photos-geo-setLocation-updater",function(e,t){"use strict";e.namespace("ModelUpdaters")["flickr-photos-geo-setLocation"]={run:function(n,r){return r.callAPI("flickr.photos.geo.setLocation",n).then(null,e.FetcherErrorLogger(t))}}},"@VERSION@");
YUI.add("photo-location-models",function(e){function t(e){t.superclass.constructor.call(this,e)}t.SUPPORTED_WOE_LEVELS=["neighbourhood","locality","county","region","country","continent"],e.Models[this.name]=t,e.extend(t,e.FlickrModelRegistry,{name:this.name,remote:{read:function(t){return e.ModelFetchers["flickr-photos-getInfo"].run(t,this.appContext).then(function(e){return e},function(){})}},attributes:{geo:{isModel:!0},hasGeo:{readOnly:!0,derivedBy:["geo"],defaultFn:function(e){var t=this.getValue(e,"geo");return t?t.getValue("hasGeo"):!1}},latitude:{readOnly:!0,derivedBy:["geo"],defaultFn:function(e){var t=this.getValue(e,"geo");return t?t.getValue("latitude"):null}},longitude:{readOnly:!0,derivedBy:["geo"],defaultFn:function(e){var t=this.getValue(e,"geo");return t?t.getValue("longitude"):null}},levels:{},text:{},mostSpecificWoeId:{readOnly:!0,derivedBy:["levels"],defaultFn:function(e){var n=this.getValue(e,"levels"),r;return t.SUPPORTED_WOE_LEVELS.some(function(e){if(n[e]&&n[e].woeId)return r=n[e].woeId,!0}),r}},mostSpecificLevelIndex:{readOnly:!0,derivedBy:["levels"],defaultFn:function(e){var n=this.getValue(e,"levels"),r;return t.SUPPORTED_WOE_LEVELS.some(function(e,t){if(n[e]&&n[e].woeId)return r=t,!0}),r}},staticMaps:{}}})},"@VERSION@",{requires:["flickr-model-registry","flickr-promise","flickr-photos-getInfo-fetcher","attribute-helpers"]});
YUI.add("flickr-photos-getLocation-fetcher",function(e,t){"use strict";function n(t,n){var i=t.photo||{},s=i.location||null,o,u=i.staticMaps&&i.staticMaps.staticMap||null,a=i.venues?i.venues.venue:null,f,l=[];return f={id:i.id,levels:{}},s?(o={id:i.id,hasGeo:!0,latitude:s.latitude,longitude:s.longitude,accuracy:s.accuracy},e.Models["photo-location-models"].SUPPORTED_WOE_LEVELS.forEach(function(e){if(!s[e])return;f.levels[e]={name:s[e].content||null,woeId:s[e].woeid||null}}),i.geoperms&&(o.isPublic=i.geoperms.ispublic,o.isContact=i.geoperms.iscontact,o.isFriend=i.geoperms.isfriend,o.isFamily=i.geoperms.isfamily)):o={id:i.id,hasGeo:!1},f.geo=n.addOrUpdate(o),a&&(f.levels.venue={name:a.content||a.address||null,woeId:a.woe_id,source:a.source,venueId:a.id,venueLat:a.latitude,venueLong:a.longitude},a.content&&l.push(a.content),a.city&&l.push(a.city),a.country&&l.push(a.country),f.text=l.join(", ")),f.text||(f.text=r(f.levels)),e.Lang.isArray(u)&&(f.staticMaps={},u.forEach(function(e){f.staticMaps["zoom"+e.zoom]=e})),f}function r(e){var t=[],n,r,i;n=[["venue","locality","region"],["neighbourhood","locality","region"],["locality","region","country"],["county","region","country"]];while(n.length&&t.length<3){r=n.shift(),t=[];while(r.length&&t.length<3)i=r.shift(),e[i]&&e[i].name&&t.push(e[i].name)}return t.join(", ")}function i(n,r){var i=n.id,s={photo_id:i,extras:"venue"},o=this;return e.APIHelper.request.addStaticMapsParams(s),e.Promise.all([r.callAPI("flickr.photos.geo.getLocation",s),r.getModelRegistry("photo-location-models"),r.getModelRegistry("photo-geo-models")]).then(function(e){var t=e[0],n=e[1],r=e[2],i=o.mapResponse(t,r);return n.addOrUpdate(i),i},e.FetcherErrorLogger(t))}e.namespace("ModelFetchers")["flickr-photos-getLocation"]={run:i,mapResponse:n}},"@VERSION@",{requires:["flickr-promise","api-helper"],optional:["photo-geo-models","photo-location-models"]});
YUI.add("flickr-contacts-add-updater",function(e,t){"use strict";function n(n,r){return r.callAPI("flickr.contacts.add",n).then(null,e.FetcherErrorLogger(t))}e.namespace("ModelUpdaters")["flickr-contacts-add"]={run:n}},"@VERSION@",{requires:["flickr-promise"]});
YUI.add("flickr-contacts-remove-updater",function(e,t){"use strict";function n(n,r){return r.callAPI("flickr.contacts.remove",n).then(null,e.FetcherErrorLogger(t))}e.namespace("ModelUpdaters")["flickr-contacts-remove"]={run:n}},"@VERSION@",{requires:["flickr-promise"]});