YUI.add("flickr-photos-people-delete-deletor",function(e,o){"use strict";e.namespace("ModelDeletors")["flickr-photos-people-delete"]={run:function(r,s){return s.callAPI("flickr.photos.people.delete",this._processParams(r)).then(null,e.FetcherErrorLogger(o))},_processParams:function(e){var o={};return"photoId"in e&&"userId"in e?o={photo_id:e.photoId,user_id:e.userId,email:e.email}:"photoIds"in e&&"userIds"in e&&(o={photo_ids:e.photoIds,user_ids:e.userIds}),o},_processResponse:function(e){return e}}},"@VERSION@",{requires:["flickr-promise"],optional:[]});YUI.add("person-in-photo-models",function(e){function o(e){o.superclass.constructor.call(this,e)}e.Models[this.name]=o,e.extend(o,e.FlickrModelRegistry,{name:this.name,remote:{create:function(o){return e.ModelCreators["flickr-photos-people-add"].run(o,this.appContext)},delete:function(o){return e.ModelDeletors["flickr-photos-people-delete"].run(o,this.appContext)}},attributes:{id:{},person:{isModel:!0},email:{},addedBy:{},coords:{setter:function(o){var t={x:NaN,y:NaN,w:NaN,h:NaN};return o&&e.merge(t,o),t}},personX:{readOnly:!0,getter:function(o,t){return e.flutil.photoCoords.denormX(this.getValue(t,"coords"))}},personY:{readOnly:!0,getter:function(o,t){return e.flutil.photoCoords.denormY(this.getValue(t,"coords"))}},personW:{readOnly:!0,getter:function(o,t){return e.flutil.photoCoords.denormW(this.getValue(t,"coords"))}},personH:{readOnly:!0,getter:function(o,t){return e.flutil.photoCoords.denormH(this.getValue(t,"coords"))}}}})},"@VERSION@",{requires:["flickr-model-registry","flickr-promise","flickr-photos-people-add-creator","flickr-photos-people-delete-deletor","flutil"]});YUI.add("flickr-photos-people-getList-fetcher",function(e,o){"use strict";e.namespace("ListFetchers")["flickr-photos-people-getList"]={run:function(p,s){var r=p.id,t={photo_id:r,extras:"icon_urls, paid_products"},i=this;return e.Promise.all([s.callAPI("flickr.photos.people.getList",t,!0),s.getModelRegistry("person-models"),s.getModelRegistry("photo-people-models"),s.getModelRegistry("person-in-photo-models")]).then(function(e){return i._processResponse(e,r,s.flipper)},e.FetcherErrorLogger(o))},_processResponse:function(o,p,s){var r,t,i,l=o[0],d=o[1],n=o[2],a=o[3],c=[];return(l.people&&l.people.person?l.people.person.length:0)>0&&l.people.person.forEach(function(o){i=o.nsid,o.nsid&&(r=d.addOrUpdate(e.APIHelper.response.parsePerson(o))),t={addedBy:o.added_by,coords:e.flutil.photoCoords.normalize(o.x,o.y,o.w,o.h)},o.nsid?(t.id=o.nsid,t.person=r,i=o.nsid):o.email&&(i=e.guid(),t.email=o.email,t.id=i),c.push(a.addOrUpdate(t))}),n.exists(p)?n.setValue(p,"people",c):n.add({id:p,people:c}),n.proxy(p)}}},"@VERSION@",{requires:["flickr-promise","api-helper","flutil"],optional:["photo-people-models","person-in-photo-models"]});YUI.add("photo-people-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-people-getList"].run(t,this.appContext)}},attributes:{id:{},people:{isListProxy:!0}}})},"@VERSION@",{requires:["flickr-model-registry","flickr-promise","flickr-photos-people-getList-fetcher"]});YUI.add("flickr-photos-people-add-creator",function(o,e){"use strict";o.namespace("ModelCreators")["flickr-photos-people-add"]={run:function(s,r){var p=this;return s.fullResponse?o.Promise.all([r.callAPI("flickr.photos.people.add",this._processParams(s))]).then(function(o){return p._processResponse(o,s)},function(o){throw o.photoIds=s.photoId,o}):o.Promise.all([r.callAPI("flickr.photos.people.add",this._processParams(s)),r.getModel("person-models",s.userId)]).then(function(o){return p._processResponse(o,s)},o.FetcherErrorLogger(e))},_processParams:function(e){var s,r={};return e.fullResponse?(r.photo_ids=e.photoId,r.user_ids=e.userId,r.full_response=1):(r.photo_id=e.photoId,r.user_id=e.userId),s=o.flutil.photoCoords.denormalize(e.coords),r.person_x=s.x,r.person_y=s.y,r.person_w=s.w,r.person_h=s.h,r},_processResponse:function(o,e){var s,r=o[1];return s=o[0].errors,e.fullResponse?s||void 0:{person:r,id:e.userId,addedBy:e.addedBy,coords:{}}}}},"@VERSION@",{requires:["flickr-promise","flutil"],optional:["photo-people-models","person-in-photo-models"]});