function arraysMatch(e,t){var n;if(!$.isArray(e)||!$.isArray(t))return e==t;n=[];if(e.length!=t.length)return!1;for(var r=0;r0},this.couldNotLoadAssetsFitting=function(e){return typeof t.assets_by_body_id[e.body_id]!="undefined"&&t.assets_by_body_id[e.body_id].length==0},this.update=function(e){for(var n in e)e.hasOwnProperty(n)&&n!="id"&&(t[n]=e[n]);r.apply(this),this.loaded=!0},this.getURL=function(){return"/items/"+i()},s.cache[e]=this}function u(e){this.name=e}function a(e){function u(e){t.color_id=e.color_id,t.id=e.id,t.name=e.name,t.pet_state_id=e.pet_state_id,t.starred=e.starred,t.species_id=e.species_id,t.image_versions=e.image_versions,t.image_enqueued=e.image_enqueued,t.image_layers_hash=e.image_layers_hash,t.setWornAndUnwornItemIds(e.worn_and_unworn_item_ids),o=!1}function f(){var e={};return e.name=t.name,e.starred=t.starred,e.worn_and_unworn_item_ids=t.getWornAndUnwornItemIds(),t.pet_state&&(e.pet_state_id=t.pet_state.id),e.anonymous=t.anonymous,e}function h(){var e=[],n=t.worn_items;return t.pet_state&&(n=n.concat(t.pet_state.assets)),$.each(n,function(){e=e.concat(this.restricted_zones)}),e}function p(e){return $.inArray(e,t.closet_items)!=-1}function d(e){return $.inArray(e,t.worn_items)!=-1}function v(e,n,i){var s,o,u,a,f,l=[],c=[];if(e){s=e.getAssetsFitting(t.pet_type).mapProperty("zone_id"),o=s.length;for(var h=0;h0?s.image_enqueued?(log("Outfit image still enqueued; will try again soon",s),setTimeout(function(){i(e)},n)):(delete t[e],r.events.trigger("imageReady",s)):(log("Outfit was unsubscribed",s),delete t[e])})})}var t={},n=5e3,r=this;this.subscribe=function(e){return e.image_enqueued?(e.id in t?t[e.id]+=1:(t[e.id]=1,i(e.id)),r.events.trigger("imageEnqueued",e)):setTimeout(function(){r.events.trigger("imageReady",e)},0),e},this.unsubscribe=function(e){e&&e.id in t&&(t[e.id]>1?t[e.id]-=1:delete t[e.id])}},h.all.BasePet=function(){var t=this;this.setName=function(e){t.name=e,t.events.trigger("updateName",e)}},h.all.PetAttributes=function(){function n(e){t.events.trigger("update",e)}var t=this;this.load=function(){f.loadAll(n)}},h.all.ItemZoneSets=function(){function n(e){t.events.trigger("update",e)}var t=this;this.load=function(){u.loadAll(n)}},h.all.Search=function(){function n(e,n,r){t.events.trigger("updateItems",e),t.events.trigger("updatePagination",r,n)}function r(e){t.events.trigger("error",e)}var t=this;this.request={},this.setItemsByQuery=function(e,i){var o=typeof i.offset!="undefined"?i.offset:s.PER_PAGE*(i.page-1);t.request={query:e,offset:o},t.events.trigger("updateRequest",t.request),e?(s.loadByQuery(e,o,n,r),t.events.trigger("startRequest")):(t.events.trigger("updateItems",[]),t.events.trigger("updatePagination",0,0))},this.setPerPage=function(e){s.PER_PAGE=e}};var p;for(var d in h.all)h.all.hasOwnProperty(d)&&(p=d.replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").toLowerCase(),e[p]=new h.all[d],h.apply(e[p]));this.initialize=function(){var t;for(var n in e.views)e.views.hasOwnProperty(n)&&(t=e.views[n],typeof t.initialize=="function"&&t.initialize())},this.registerViews=function(t){e.views={},$.each(t,function(t){e.views[t]=new this(e)})}}window.log=window.SWFLog=$.noop,Array.prototype.mapProperty=function(e){return $.map(this,function(t){return t[e]})},DeepObject.prototype.deepGet=function(){var e=this,t;return $.each(arguments,function(){e=e[this];if(typeof e=="undefined")return!1}),e},DeepObject.prototype.deepSet=function(){var e=$.proxy(Array.prototype.pop,"apply"),t=e(arguments),n=e(arguments),r=this;$.each(arguments,function(){typeof r[this]=="undefined"&&(r[this]={}),r=r[this]}),r[n]=t},Wardrobe.IMAGE_CONFIG={base_url:"https://s3.amazonaws.com/impress-asset-images/",sizes:[[600,600],[300,300],[150,150]]},Wardrobe.StandardPreview={views_by_swf_id:{}},Wardrobe.getStandardView=function(e){function n(){var t,n=[],r=e;for(var i=0;it)return n=e,!1});var r=$("",{css:{zIndex:t},src:e.imageURL(b())});n?r.insertBefore(n):r.appendTo(a)}function b(){var e=d,t=r.width(),n=r.height();for(var i in e)if(e[i][0]>t&&e[i][1]>n)return y=e[i];return y=e[e.length-1]}function w(){a.children("img").remove()}function E(){var e={biology:[],object:[]},t;for(var r in n)n.hasOwnProperty(r)&&e[n[r].type].push(n[r].id);$.getJSON("/swf_assets.json",{ids:e},function(e){var t,r;for(var i in e)t=e[i],t.has_image&&n.hasOwnProperty(t.id)&&(r=n[t.id],r.update(t),delete n[t.id],o--,h(r));T()})}function S(){o?s==null&&(s=setInterval(E,f)):s!=null&&(clearInterval(s),s=null)}function x(){u.text("Waiting on "+o+" images").attr("className","waiting-on-"+o)}function T(){S(),x()}var n={},i=[],s,o=0,u=$("",{id:"preview-images-pending"}),a=$(e.Preview.image_container),f=5e3;r.removeClass("swf-adapter").addClass("image-adapter"),u.appendTo(a);var l=this,c=$("#preview-export-iframe");c.length==0&&(c=$("