code-challenge-7geese
Version:
This is a revised solution for the 7Geese JavaScript Challenge.
2 lines • 129 kB
JavaScript
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.sGeese=e()}}(function(){var e;return function t(e,n,r){function i(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[s]={exports:{}};e[s][0].call(l.exports,function(t){var n=e[s][1][t];return i(n?n:t)},l,l.exports,t,e,n,r)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(t,n,r){(function(n){!function(i){var o="object"==typeof self&&self.self==self&&self||"object"==typeof n&&n.global==n&&n;if("function"==typeof e&&e.amd)e(["underscore","jquery","exports"],function(e,t,n){o.Backbone=i(o,n,e,t)});else if("undefined"!=typeof r){var s,a=t("underscore");try{s=t("jquery")}catch(u){}i(o,r,a,s)}else o.Backbone=i(o,{},o._,o.jQuery||o.Zepto||o.ender||o.$)}(function(e,t,n,r){var i=e.Backbone,o=Array.prototype.slice;t.VERSION="1.2.3",t.$=r,t.noConflict=function(){return e.Backbone=i,this},t.emulateHTTP=!1,t.emulateJSON=!1;var s=function(e,t,r){switch(e){case 1:return function(){return n[t](this[r])};case 2:return function(e){return n[t](this[r],e)};case 3:return function(e,i){return n[t](this[r],u(e,this),i)};case 4:return function(e,i,o){return n[t](this[r],u(e,this),i,o)};default:return function(){var e=o.call(arguments);return e.unshift(this[r]),n[t].apply(n,e)}}},a=function(e,t,r){n.each(t,function(t,i){n[i]&&(e.prototype[i]=s(t,i,r))})},u=function(e,t){return n.isFunction(e)?e:n.isObject(e)&&!t._isModel(e)?c(e):n.isString(e)?function(t){return t.get(e)}:e},c=function(e){var t=n.matches(e);return function(e){return t(e.attributes)}},l=t.Events={},f=/\s+/,h=function(e,t,r,i,o){var s,a=0;if(r&&"object"==typeof r){void 0!==i&&"context"in o&&void 0===o.context&&(o.context=i);for(s=n.keys(r);a<s.length;a++)t=h(e,t,s[a],r[s[a]],o)}else if(r&&f.test(r))for(s=r.split(f);a<s.length;a++)t=e(t,s[a],i,o);else t=e(t,r,i,o);return t};l.on=function(e,t,n){return p(this,e,t,n)};var p=function(e,t,n,r,i){if(e._events=h(d,e._events||{},t,n,{context:r,ctx:e,listening:i}),i){var o=e._listeners||(e._listeners={});o[i.id]=i}return e};l.listenTo=function(e,t,r){if(!e)return this;var i=e._listenId||(e._listenId=n.uniqueId("l")),o=this._listeningTo||(this._listeningTo={}),s=o[i];if(!s){var a=this._listenId||(this._listenId=n.uniqueId("l"));s=o[i]={obj:e,objId:i,id:a,listeningTo:o,count:0}}return p(e,t,r,this,s),this};var d=function(e,t,n,r){if(n){var i=e[t]||(e[t]=[]),o=r.context,s=r.ctx,a=r.listening;a&&a.count++,i.push({callback:n,context:o,ctx:o||s,listening:a})}return e};l.off=function(e,t,n){return this._events?(this._events=h(g,this._events,e,t,{context:n,listeners:this._listeners}),this):this},l.stopListening=function(e,t,r){var i=this._listeningTo;if(!i)return this;for(var o=e?[e._listenId]:n.keys(i),s=0;s<o.length;s++){var a=i[o[s]];if(!a)break;a.obj.off(t,r,this)}return n.isEmpty(i)&&(this._listeningTo=void 0),this};var g=function(e,t,r,i){if(e){var o,s=0,a=i.context,u=i.listeners;if(t||r||a){for(var c=t?[t]:n.keys(e);s<c.length;s++){t=c[s];var l=e[t];if(!l)break;for(var f=[],h=0;h<l.length;h++){var p=l[h];r&&r!==p.callback&&r!==p.callback._callback||a&&a!==p.context?f.push(p):(o=p.listening,o&&0===--o.count&&(delete u[o.id],delete o.listeningTo[o.objId]))}f.length?e[t]=f:delete e[t]}return n.size(e)?e:void 0}for(var d=n.keys(u);s<d.length;s++)o=u[d[s]],delete u[o.id],delete o.listeningTo[o.objId]}};l.once=function(e,t,r){var i=h(v,{},e,t,n.bind(this.off,this));return this.on(i,void 0,r)},l.listenToOnce=function(e,t,r){var i=h(v,{},t,r,n.bind(this.stopListening,this,e));return this.listenTo(e,i)};var v=function(e,t,r,i){if(r){var o=e[t]=n.once(function(){i(t,o),r.apply(this,arguments)});o._callback=r}return e};l.trigger=function(e){if(!this._events)return this;for(var t=Math.max(0,arguments.length-1),n=Array(t),r=0;t>r;r++)n[r]=arguments[r+1];return h(m,this._events,e,void 0,n),this};var m=function(e,t,n,r){if(e){var i=e[t],o=e.all;i&&o&&(o=o.slice()),i&&y(i,r),o&&y(o,[t].concat(r))}return e},y=function(e,t){var n,r=-1,i=e.length,o=t[0],s=t[1],a=t[2];switch(t.length){case 0:for(;++r<i;)(n=e[r]).callback.call(n.ctx);return;case 1:for(;++r<i;)(n=e[r]).callback.call(n.ctx,o);return;case 2:for(;++r<i;)(n=e[r]).callback.call(n.ctx,o,s);return;case 3:for(;++r<i;)(n=e[r]).callback.call(n.ctx,o,s,a);return;default:for(;++r<i;)(n=e[r]).callback.apply(n.ctx,t);return}};l.bind=l.on,l.unbind=l.off,n.extend(t,l);var x=t.Model=function(e,t){var r=e||{};t||(t={}),this.cid=n.uniqueId(this.cidPrefix),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(r=this.parse(r,t)||{}),r=n.defaults({},r,n.result(this,"defaults")),this.set(r,t),this.changed={},this.initialize.apply(this,arguments)};n.extend(x.prototype,l,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(e){return n.clone(this.attributes)},sync:function(){return t.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return n.escape(this.get(e))},has:function(e){return null!=this.get(e)},matches:function(e){return!!n.iteratee(e,this)(this.attributes)},set:function(e,t,r){if(null==e)return this;var i;if("object"==typeof e?(i=e,r=t):(i={})[e]=t,r||(r={}),!this._validate(i,r))return!1;var o=r.unset,s=r.silent,a=[],u=this._changing;this._changing=!0,u||(this._previousAttributes=n.clone(this.attributes),this.changed={});var c=this.attributes,l=this.changed,f=this._previousAttributes;for(var h in i)t=i[h],n.isEqual(c[h],t)||a.push(h),n.isEqual(f[h],t)?delete l[h]:l[h]=t,o?delete c[h]:c[h]=t;if(this.id=this.get(this.idAttribute),!s){a.length&&(this._pending=r);for(var p=0;p<a.length;p++)this.trigger("change:"+a[p],this,c[a[p]],r)}if(u)return this;if(!s)for(;this._pending;)r=this._pending,this._pending=!1,this.trigger("change",this,r);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,n.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var r in this.attributes)t[r]=void 0;return this.set(t,n.extend({},e,{unset:!0}))},hasChanged:function(e){return null==e?!n.isEmpty(this.changed):n.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?n.clone(this.changed):!1;var t=this._changing?this._previousAttributes:this.attributes,r={};for(var i in e){var o=e[i];n.isEqual(t[i],o)||(r[i]=o)}return n.size(r)?r:!1},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return n.clone(this._previousAttributes)},fetch:function(e){e=n.extend({parse:!0},e);var t=this,r=e.success;return e.success=function(n){var i=e.parse?t.parse(n,e):n;return t.set(i,e)?(r&&r.call(e.context,t,n,e),void t.trigger("sync",t,n,e)):!1},$(this,e),this.sync("read",this,e)},save:function(e,t,r){var i;null==e||"object"==typeof e?(i=e,r=t):(i={})[e]=t,r=n.extend({validate:!0,parse:!0},r);var o=r.wait;if(i&&!o){if(!this.set(i,r))return!1}else if(!this._validate(i,r))return!1;var s=this,a=r.success,u=this.attributes;r.success=function(e){s.attributes=u;var t=r.parse?s.parse(e,r):e;return o&&(t=n.extend({},i,t)),t&&!s.set(t,r)?!1:(a&&a.call(r.context,s,e,r),void s.trigger("sync",s,e,r))},$(this,r),i&&o&&(this.attributes=n.extend({},u,i));var c=this.isNew()?"create":r.patch?"patch":"update";"patch"!==c||r.attrs||(r.attrs=i);var l=this.sync(c,this,r);return this.attributes=u,l},destroy:function(e){e=e?n.clone(e):{};var t=this,r=e.success,i=e.wait,o=function(){t.stopListening(),t.trigger("destroy",t,t.collection,e)};e.success=function(n){i&&o(),r&&r.call(e.context,t,n,e),t.isNew()||t.trigger("sync",t,n,e)};var s=!1;return this.isNew()?n.defer(e.success):($(this,e),s=this.sync("delete",this,e)),i||o(),s},url:function(){var e=n.result(this,"urlRoot")||n.result(this.collection,"url")||P();if(this.isNew())return e;var t=this.get(this.idAttribute);return e.replace(/[^\/]$/,"$&/")+encodeURIComponent(t)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(e){return this._validate({},n.defaults({validate:!0},e))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=n.extend({},this.attributes,e);var r=this.validationError=this.validate(e,t)||null;return r?(this.trigger("invalid",this,r,n.extend(t,{validationError:r})),!1):!0}});var b={keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1};a(x,b,"attributes");var w=t.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,n.extend({silent:!0},t))},T={add:!0,remove:!0,merge:!0},C={add:!0,remove:!1},k=function(e,t,n){n=Math.min(Math.max(n,0),e.length);for(var r=Array(e.length-n),i=t.length,o=0;o<r.length;o++)r[o]=e[o+n];for(o=0;i>o;o++)e[o+n]=t[o];for(o=0;o<r.length;o++)e[o+i+n]=r[o]};n.extend(w.prototype,l,{model:x,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return t.sync.apply(this,arguments)},add:function(e,t){return this.set(e,n.extend({merge:!1},t,C))},remove:function(e,t){t=n.extend({},t);var r=!n.isArray(e);e=r?[e]:n.clone(e);var i=this._removeModels(e,t);return!t.silent&&i&&this.trigger("update",this,t),r?i[0]:i},set:function(e,t){if(null!=e){t=n.defaults({},t,T),t.parse&&!this._isModel(e)&&(e=this.parse(e,t));var r=!n.isArray(e);e=r?[e]:e.slice();var i=t.at;null!=i&&(i=+i),0>i&&(i+=this.length+1);for(var o,s=[],a=[],u=[],c={},l=t.add,f=t.merge,h=t.remove,p=!1,d=this.comparator&&null==i&&t.sort!==!1,g=n.isString(this.comparator)?this.comparator:null,v=0;v<e.length;v++){o=e[v];var m=this.get(o);if(m){if(f&&o!==m){var y=this._isModel(o)?o.attributes:o;t.parse&&(y=m.parse(y,t)),m.set(y,t),d&&!p&&(p=m.hasChanged(g))}c[m.cid]||(c[m.cid]=!0,s.push(m)),e[v]=m}else l&&(o=e[v]=this._prepareModel(o,t),o&&(a.push(o),this._addReference(o,t),c[o.cid]=!0,s.push(o)))}if(h){for(v=0;v<this.length;v++)o=this.models[v],c[o.cid]||u.push(o);u.length&&this._removeModels(u,t)}var x=!1,b=!d&&l&&h;if(s.length&&b?(x=this.length!=s.length||n.some(this.models,function(e,t){return e!==s[t]}),this.models.length=0,k(this.models,s,0),this.length=this.models.length):a.length&&(d&&(p=!0),k(this.models,a,null==i?this.length:i),this.length=this.models.length),p&&this.sort({silent:!0}),!t.silent){for(v=0;v<a.length;v++)null!=i&&(t.index=i+v),o=a[v],o.trigger("add",o,this,t);(p||x)&&this.trigger("sort",this,t),(a.length||u.length)&&this.trigger("update",this,t)}return r?e[0]:e}},reset:function(e,t){t=t?n.clone(t):{};for(var r=0;r<this.models.length;r++)this._removeReference(this.models[r],t);return t.previousModels=this.models,this._reset(),e=this.add(e,n.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,n.extend({at:this.length},t))},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e)},unshift:function(e,t){return this.add(e,n.extend({at:0},t))},shift:function(e){var t=this.at(0);return this.remove(t,e)},slice:function(){return o.apply(this.models,arguments)},get:function(e){if(null!=e){var t=this.modelId(this._isModel(e)?e.attributes:e);return this._byId[e]||this._byId[t]||this._byId[e.cid]}},at:function(e){return 0>e&&(e+=this.length),this.models[e]},where:function(e,t){return this[t?"find":"filter"](e)},findWhere:function(e){return this.where(e,!0)},sort:function(e){var t=this.comparator;if(!t)throw new Error("Cannot sort a set without a comparator");e||(e={});var r=t.length;return n.isFunction(t)&&(t=n.bind(t,this)),1===r||n.isString(t)?this.models=this.sortBy(t):this.models.sort(t),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return n.invoke(this.models,"get",e)},fetch:function(e){e=n.extend({parse:!0},e);var t=e.success,r=this;return e.success=function(n){var i=e.reset?"reset":"set";r[i](n,e),t&&t.call(e.context,r,n,e),r.trigger("sync",r,n,e)},$(this,e),this.sync("read",this,e)},create:function(e,t){t=t?n.clone(t):{};var r=t.wait;if(e=this._prepareModel(e,t),!e)return!1;r||this.add(e,t);var i=this,o=t.success;return t.success=function(e,t,n){r&&i.add(e,n),o&&o.call(n.context,e,t,n)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(e){return e[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(this._isModel(e))return e.collection||(e.collection=this),e;t=t?n.clone(t):{},t.collection=this;var r=new this.model(e,t);return r.validationError?(this.trigger("invalid",this,r.validationError,t),!1):r},_removeModels:function(e,t){for(var n=[],r=0;r<e.length;r++){var i=this.get(e[r]);if(i){var o=this.indexOf(i);this.models.splice(o,1),this.length--,t.silent||(t.index=o,i.trigger("remove",i,this,t)),n.push(i),this._removeReference(i,t)}}return n.length?n:!1},_isModel:function(e){return e instanceof x},_addReference:function(e,t){this._byId[e.cid]=e;var n=this.modelId(e.attributes);null!=n&&(this._byId[n]=e),e.on("all",this._onModelEvent,this)},_removeReference:function(e,t){delete this._byId[e.cid];var n=this.modelId(e.attributes);null!=n&&delete this._byId[n],this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,r){if("add"!==e&&"remove"!==e||n===this){if("destroy"===e&&this.remove(t,r),"change"===e){var i=this.modelId(t.previousAttributes()),o=this.modelId(t.attributes);i!==o&&(null!=i&&delete this._byId[i],null!=o&&(this._byId[o]=t))}this.trigger.apply(this,arguments)}}});var E={forEach:3,each:3,map:3,collect:3,reduce:4,foldl:4,inject:4,reduceRight:4,foldr:4,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:3,includes:3,contains:3,invoke:0,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3,groupBy:3,countBy:3,sortBy:3,indexBy:3};a(w,E,"models");var j=t.View=function(e){this.cid=n.uniqueId("view"),n.extend(this,n.pick(e,_)),this._ensureElement(),this.initialize.apply(this,arguments)},S=/^(\S+)\s*(.*)$/,_=["model","collection","el","id","attributes","className","tagName","events"];n.extend(j.prototype,l,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.$el.remove()},setElement:function(e){return this.undelegateEvents(),this._setElement(e),this.delegateEvents(),this},_setElement:function(e){this.$el=e instanceof t.$?e:t.$(e),this.el=this.$el[0]},delegateEvents:function(e){if(e||(e=n.result(this,"events")),!e)return this;this.undelegateEvents();for(var t in e){var r=e[t];if(n.isFunction(r)||(r=this[r]),r){var i=t.match(S);this.delegate(i[1],i[2],n.bind(r,this))}}return this},delegate:function(e,t,n){return this.$el.on(e+".delegateEvents"+this.cid,t,n),this},undelegateEvents:function(){return this.$el&&this.$el.off(".delegateEvents"+this.cid),this},undelegate:function(e,t,n){return this.$el.off(e+".delegateEvents"+this.cid,t,n),this},_createElement:function(e){return document.createElement(e)},_ensureElement:function(){if(this.el)this.setElement(n.result(this,"el"));else{var e=n.extend({},n.result(this,"attributes"));this.id&&(e.id=n.result(this,"id")),this.className&&(e["class"]=n.result(this,"className")),this.setElement(this._createElement(n.result(this,"tagName"))),this._setAttributes(e)}},_setAttributes:function(e){this.$el.attr(e)}}),t.sync=function(e,r,i){var o=N[e];n.defaults(i||(i={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON});var s={type:o,dataType:"json"};if(i.url||(s.url=n.result(r,"url")||P()),null!=i.data||!r||"create"!==e&&"update"!==e&&"patch"!==e||(s.contentType="application/json",s.data=JSON.stringify(i.attrs||r.toJSON(i))),i.emulateJSON&&(s.contentType="application/x-www-form-urlencoded",s.data=s.data?{model:s.data}:{}),i.emulateHTTP&&("PUT"===o||"DELETE"===o||"PATCH"===o)){s.type="POST",i.emulateJSON&&(s.data._method=o);var a=i.beforeSend;i.beforeSend=function(e){return e.setRequestHeader("X-HTTP-Method-Override",o),a?a.apply(this,arguments):void 0}}"GET"===s.type||i.emulateJSON||(s.processData=!1);var u=i.error;i.error=function(e,t,n){i.textStatus=t,i.errorThrown=n,u&&u.call(i.context,e,t,n)};var c=i.xhr=t.ajax(n.extend(s,i));return r.trigger("request",r,c,i),c};var N={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var A=t.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},D=/\((.*?)\)/g,O=/(\(\?)?:\w+/g,q=/\*\w+/g,L=/[\-{}\[\]+?.,\\\^$|#\s]/g;n.extend(A.prototype,l,{initialize:function(){},route:function(e,r,i){n.isRegExp(e)||(e=this._routeToRegExp(e)),n.isFunction(r)&&(i=r,r=""),i||(i=this[r]);var o=this;return t.history.route(e,function(n){var s=o._extractParameters(e,n);o.execute(i,s,r)!==!1&&(o.trigger.apply(o,["route:"+r].concat(s)),o.trigger("route",r,s),t.history.trigger("route",o,r,s))}),this},execute:function(e,t,n){e&&e.apply(this,t)},navigate:function(e,n){return t.history.navigate(e,n),this},_bindRoutes:function(){if(this.routes){this.routes=n.result(this,"routes");for(var e,t=n.keys(this.routes);null!=(e=t.pop());)this.route(e,this.routes[e])}},_routeToRegExp:function(e){return e=e.replace(L,"\\$&").replace(D,"(?:$1)?").replace(O,function(e,t){return t?e:"([^/?]+)"}).replace(q,"([^?]*?)"),new RegExp("^"+e+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(e,t){var r=e.exec(t).slice(1);return n.map(r,function(e,t){return t===r.length-1?e||null:e?decodeURIComponent(e):null})}});var I=t.History=function(){this.handlers=[],this.checkUrl=n.bind(this.checkUrl,this),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},H=/^[#\/]|\s+$/g,F=/^\/+|\/+$/g,M=/#.*$/;I.started=!1,n.extend(I.prototype,l,{interval:50,atRoot:function(){var e=this.location.pathname.replace(/[^\/]$/,"$&/");return e===this.root&&!this.getSearch()},matchRoot:function(){var e=this.decodeFragment(this.location.pathname),t=e.slice(0,this.root.length-1)+"/";return t===this.root},decodeFragment:function(e){return decodeURI(e.replace(/%25/g,"%2525"))},getSearch:function(){var e=this.location.href.replace(/#.*/,"").match(/\?.+/);return e?e[0]:""},getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getPath:function(){var e=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return"/"===e.charAt(0)?e.slice(1):e},getFragment:function(e){return null==e&&(e=this._usePushState||!this._wantsHashChange?this.getPath():this.getHash()),e.replace(H,"")},start:function(e){if(I.started)throw new Error("Backbone.history has already been started");if(I.started=!0,this.options=n.extend({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._hasHashChange="onhashchange"in window&&(void 0===document.documentMode||document.documentMode>7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(F,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var t=this.root.slice(0,-1)||"/";return this.location.replace(t+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var r=document.body,i=r.insertBefore(this.iframe,r.firstChild).contentWindow;i.document.open(),i.document.close(),i.location.hash="#"+this.fragment}var o=window.addEventListener||function(e,t){return attachEvent("on"+e,t)};return this._usePushState?o("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?o("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.options.silent?void 0:this.loadUrl()},stop:function(){var e=window.removeEventListener||function(e,t){return detachEvent("on"+e,t)};this._usePushState?e("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&e("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),I.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();return t===this.fragment&&this.iframe&&(t=this.getHash(this.iframe.contentWindow)),t===this.fragment?!1:(this.iframe&&this.navigate(t),void this.loadUrl())},loadUrl:function(e){return this.matchRoot()?(e=this.fragment=this.getFragment(e),n.some(this.handlers,function(t){return t.route.test(e)?(t.callback(e),!0):void 0})):!1},navigate:function(e,t){if(!I.started)return!1;t&&t!==!0||(t={trigger:!!t}),e=this.getFragment(e||"");var n=this.root;(""===e||"?"===e.charAt(0))&&(n=n.slice(0,-1)||"/");var r=n+e;if(e=this.decodeFragment(e.replace(M,"")),this.fragment!==e){if(this.fragment=e,this._usePushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,r);else{if(!this._wantsHashChange)return this.location.assign(r);if(this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getHash(this.iframe.contentWindow)){var i=this.iframe.contentWindow;t.replace||(i.document.open(),i.document.close()),this._updateHash(i.location,e,t.replace)}}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,n){if(n){var r=e.href.replace(/(javascript:|#).*$/,"");e.replace(r+"#"+t)}else e.hash="#"+t}}),t.history=new I;var R=function(e,t){var r,i=this;r=e&&n.has(e,"constructor")?e.constructor:function(){return i.apply(this,arguments)},n.extend(r,i,t);var o=function(){this.constructor=r};return o.prototype=i.prototype,r.prototype=new o,e&&n.extend(r.prototype,e),r.__super__=i.prototype,r};x.extend=w.extend=A.extend=j.extend=I.extend=R;var P=function(){throw new Error('A "url" property or function must be specified')},$=function(e,t){var n=t.error;t.error=function(r){n&&n.call(t.context,e,r,t),e.trigger("error",e,r,t)}};return t})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{jquery:2,underscore:3}],2:[function(t,n,r){!function(e,t){"object"==typeof n&&"object"==typeof n.exports?n.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(t,n){function r(e){var t=!!e&&"length"in e&&e.length,n=se.type(e);return"function"===n||se.isWindow(e)?!1:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function i(e,t,n){if(se.isFunction(t))return se.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return se.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(ve.test(t))return se.filter(t,e,n);t=se.filter(t,e)}return se.grep(e,function(e){return ee.call(t,e)>-1!==n})}function o(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function s(e){var t={};return se.each(e.match(Te)||[],function(e,n){t[n]=!0}),t}function a(){Y.removeEventListener("DOMContentLoaded",a),t.removeEventListener("load",a),se.ready()}function u(){this.expando=se.expando+u.uid++}function c(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(Ne,"-$&").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:_e.test(n)?se.parseJSON(n):n}catch(i){}Se.set(e,t,n)}else n=void 0;return n}function l(e,t,n,r){var i,o=1,s=20,a=r?function(){return r.cur()}:function(){return se.css(e,t,"")},u=a(),c=n&&n[3]||(se.cssNumber[t]?"":"px"),l=(se.cssNumber[t]||"px"!==c&&+u)&&De.exec(se.css(e,t));if(l&&l[3]!==c){c=c||l[3],n=n||[],l=+u||1;do o=o||".5",l/=o,se.style(e,t,l+c);while(o!==(o=a()/u)&&1!==o&&--s)}return n&&(l=+l||+u||0,i=n[1]?l+(n[1]+1)*n[2]:+n[2],r&&(r.unit=c,r.start=l,r.end=i)),i}function f(e,t){var n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&se.nodeName(e,t)?se.merge([e],n):n}function h(e,t){for(var n=0,r=e.length;r>n;n++)je.set(e[n],"globalEval",!t||je.get(t[n],"globalEval"))}function p(e,t,n,r,i){for(var o,s,a,u,c,l,p=t.createDocumentFragment(),d=[],g=0,v=e.length;v>g;g++)if(o=e[g],o||0===o)if("object"===se.type(o))se.merge(d,o.nodeType?[o]:o);else if(Me.test(o)){for(s=s||p.appendChild(t.createElement("div")),a=(Ie.exec(o)||["",""])[1].toLowerCase(),u=Fe[a]||Fe._default,s.innerHTML=u[1]+se.htmlPrefilter(o)+u[2],l=u[0];l--;)s=s.lastChild;se.merge(d,s.childNodes),s=p.firstChild,s.textContent=""}else d.push(t.createTextNode(o));for(p.textContent="",g=0;o=d[g++];)if(r&&se.inArray(o,r)>-1)i&&i.push(o);else if(c=se.contains(o.ownerDocument,o),s=f(p.appendChild(o),"script"),c&&h(s),n)for(l=0;o=s[l++];)He.test(o.type||"")&&n.push(o);return p}function d(){return!0}function g(){return!1}function v(){try{return Y.activeElement}catch(e){}}function m(e,t,n,r,i,o){var s,a;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(a in t)m(e,a,n,r,t[a],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),i===!1)i=g;else if(!i)return this;return 1===o&&(s=i,i=function(e){return se().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=se.guid++)),e.each(function(){se.event.add(this,t,i,r,n)})}function y(e,t){return se.nodeName(e,"table")&&se.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e:e}function x(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function b(e){var t=Ue.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function w(e,t){var n,r,i,o,s,a,u,c;if(1===t.nodeType){if(je.hasData(e)&&(o=je.access(e),s=je.set(t,o),c=o.events)){delete s.handle,s.events={};for(i in c)for(n=0,r=c[i].length;r>n;n++)se.event.add(t,i,c[i][n])}Se.hasData(e)&&(a=Se.access(e),u=se.extend({},a),Se.set(t,u))}}function T(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Le.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function C(e,t,n,r){t=Q.apply([],t);var i,o,s,a,u,c,l=0,h=e.length,d=h-1,g=t[0],v=se.isFunction(g);if(v||h>1&&"string"==typeof g&&!ie.checkClone&&ze.test(g))return e.each(function(i){var o=e.eq(i);v&&(t[0]=g.call(this,i,o.html())),C(o,t,n,r)});if(h&&(i=p(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(s=se.map(f(i,"script"),x),a=s.length;h>l;l++)u=i,l!==d&&(u=se.clone(u,!0,!0),a&&se.merge(s,f(u,"script"))),n.call(e[l],u,l);if(a)for(c=s[s.length-1].ownerDocument,se.map(s,b),l=0;a>l;l++)u=s[l],He.test(u.type||"")&&!je.access(u,"globalEval")&&se.contains(c,u)&&(u.src?se._evalUrl&&se._evalUrl(u.src):se.globalEval(u.textContent.replace(Xe,"")))}return e}function k(e,t,n){for(var r,i=t?se.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||se.cleanData(f(r)),r.parentNode&&(n&&se.contains(r.ownerDocument,r)&&h(f(r,"script")),r.parentNode.removeChild(r));return e}function E(e,t){var n=se(t.createElement(e)).appendTo(t.body),r=se.css(n[0],"display");return n.detach(),r}function j(e){var t=Y,n=Je[e];return n||(n=E(e,t),"none"!==n&&n||(Ve=(Ve||se("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=Ve[0].contentDocument,t.write(),t.close(),n=E(e,t),Ve.detach()),Je[e]=n),n}function S(e,t,n){var r,i,o,s,a=e.style;return n=n||Ke(e),n&&(s=n.getPropertyValue(t)||n[t],""!==s||se.contains(e.ownerDocument,e)||(s=se.style(e,t)),!ie.pixelMarginRight()&&Ye.test(s)&&Ge.test(t)&&(r=a.width,i=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=s,s=n.width,a.width=r,a.minWidth=i,a.maxWidth=o)),void 0!==s?s+"":s}function _(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function N(e){if(e in it)return e;for(var t=e[0].toUpperCase()+e.slice(1),n=rt.length;n--;)if(e=rt[n]+t,e in it)return e}function A(e,t,n){var r=De.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function D(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,s=0;4>o;o+=2)"margin"===n&&(s+=se.css(e,n+Oe[o],!0,i)),r?("content"===n&&(s-=se.css(e,"padding"+Oe[o],!0,i)),"margin"!==n&&(s-=se.css(e,"border"+Oe[o]+"Width",!0,i))):(s+=se.css(e,"padding"+Oe[o],!0,i),"padding"!==n&&(s+=se.css(e,"border"+Oe[o]+"Width",!0,i)));return s}function O(e,n,r){var i=!0,o="width"===n?e.offsetWidth:e.offsetHeight,s=Ke(e),a="border-box"===se.css(e,"boxSizing",!1,s);if(Y.msFullscreenElement&&t.top!==t&&e.getClientRects().length&&(o=Math.round(100*e.getBoundingClientRect()[n])),0>=o||null==o){if(o=S(e,n,s),(0>o||null==o)&&(o=e.style[n]),Ye.test(o))return o;i=a&&(ie.boxSizingReliable()||o===e.style[n]),o=parseFloat(o)||0}return o+D(e,n,r||(a?"border":"content"),i,s)+"px"}function q(e,t){for(var n,r,i,o=[],s=0,a=e.length;a>s;s++)r=e[s],r.style&&(o[s]=je.get(r,"olddisplay"),n=r.style.display,t?(o[s]||"none"!==n||(r.style.display=""),""===r.style.display&&qe(r)&&(o[s]=je.access(r,"olddisplay",j(r.nodeName)))):(i=qe(r),"none"===n&&i||je.set(r,"olddisplay",i?n:se.css(r,"display"))));for(s=0;a>s;s++)r=e[s],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[s]||"":"none"));return e}function L(e,t,n,r,i){return new L.prototype.init(e,t,n,r,i)}function I(){return t.setTimeout(function(){ot=void 0}),ot=se.now()}function H(e,t){var n,r=0,i={height:e};for(t=t?1:0;4>r;r+=2-t)n=Oe[r],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function F(e,t,n){for(var r,i=(P.tweeners[t]||[]).concat(P.tweeners["*"]),o=0,s=i.length;s>o;o++)if(r=i[o].call(n,t,e))return r}function M(e,t,n){var r,i,o,s,a,u,c,l,f=this,h={},p=e.style,d=e.nodeType&&qe(e),g=je.get(e,"fxshow");n.queue||(a=se._queueHooks(e,"fx"),null==a.unqueued&&(a.unqueued=0,u=a.empty.fire,a.empty.fire=function(){a.unqueued||u()}),a.unqueued++,f.always(function(){f.always(function(){a.unqueued--,se.queue(e,"fx").length||a.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],c=se.css(e,"display"),l="none"===c?je.get(e,"olddisplay")||j(e.nodeName):c,"inline"===l&&"none"===se.css(e,"float")&&(p.display="inline-block")),n.overflow&&(p.overflow="hidden",f.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],at.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(d?"hide":"show")){if("show"!==i||!g||void 0===g[r])continue;d=!0}h[r]=g&&g[r]||se.style(e,r)}else c=void 0;if(se.isEmptyObject(h))"inline"===("none"===c?j(e.nodeName):c)&&(p.display=c);else{g?"hidden"in g&&(d=g.hidden):g=je.access(e,"fxshow",{}),o&&(g.hidden=!d),d?se(e).show():f.done(function(){se(e).hide()}),f.done(function(){var t;je.remove(e,"fxshow");for(t in h)se.style(e,t,h[t])});for(r in h)s=F(d?g[r]:0,r,f),r in g||(g[r]=s.start,d&&(s.end=s.start,s.start="width"===r||"height"===r?1:0))}}function R(e,t){var n,r,i,o,s;for(n in e)if(r=se.camelCase(n),i=t[r],o=e[n],se.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),s=se.cssHooks[r],s&&"expand"in s){o=s.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],
t[n]=i)}else t[r]=i}function P(e,t,n){var r,i,o=0,s=P.prefilters.length,a=se.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=ot||I(),n=Math.max(0,c.startTime+c.duration-t),r=n/c.duration||0,o=1-r,s=0,u=c.tweens.length;u>s;s++)c.tweens[s].run(o);return a.notifyWith(e,[c,o,n]),1>o&&u?n:(a.resolveWith(e,[c]),!1)},c=a.promise({elem:e,props:se.extend({},t),opts:se.extend(!0,{specialEasing:{},easing:se.easing._default},n),originalProperties:t,originalOptions:n,startTime:ot||I(),duration:n.duration,tweens:[],createTween:function(t,n){var r=se.Tween(e,c.opts,t,n,c.opts.specialEasing[t]||c.opts.easing);return c.tweens.push(r),r},stop:function(t){var n=0,r=t?c.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)c.tweens[n].run(1);return t?(a.notifyWith(e,[c,1,0]),a.resolveWith(e,[c,t])):a.rejectWith(e,[c,t]),this}}),l=c.props;for(R(l,c.opts.specialEasing);s>o;o++)if(r=P.prefilters[o].call(c,e,l,c.opts))return se.isFunction(r.stop)&&(se._queueHooks(c.elem,c.opts.queue).stop=se.proxy(r.stop,r)),r;return se.map(l,F,c),se.isFunction(c.opts.start)&&c.opts.start.call(e,c),se.fx.timer(se.extend(u,{elem:e,anim:c,queue:c.opts.queue})),c.progress(c.opts.progress).done(c.opts.done,c.opts.complete).fail(c.opts.fail).always(c.opts.always)}function $(e){return e.getAttribute&&e.getAttribute("class")||""}function B(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(Te)||[];if(se.isFunction(n))for(;r=o[i++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function W(e,t,n,r){function i(a){var u;return o[a]=!0,se.each(e[a]||[],function(e,a){var c=a(t,n,r);return"string"!=typeof c||s||o[c]?s?!(u=c):void 0:(t.dataTypes.unshift(c),i(c),!1)}),u}var o={},s=e===jt;return i(t.dataTypes[0])||!o["*"]&&i("*")}function z(e,t){var n,r,i=se.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&se.extend(!0,e,r),e}function U(e,t,n){for(var r,i,o,s,a=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in a)if(a[i]&&a[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}s||(s=i)}o=o||s}return o?(o!==u[0]&&u.unshift(o),n[o]):void 0}function X(e,t,n,r){var i,o,s,a,u,c={},l=e.dataTypes.slice();if(l[1])for(s in e.converters)c[s.toLowerCase()]=e.converters[s];for(o=l.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=l.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(s=c[u+" "+o]||c["* "+o],!s)for(i in c)if(a=i.split(" "),a[1]===o&&(s=c[u+" "+a[0]]||c["* "+a[0]])){s===!0?s=c[i]:c[i]!==!0&&(o=a[0],l.unshift(a[1]));break}if(s!==!0)if(s&&e["throws"])t=s(t);else try{t=s(t)}catch(f){return{state:"parsererror",error:s?f:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}function V(e,t,n,r){var i;if(se.isArray(t))se.each(t,function(t,i){n||At.test(e)?r(e,i):V(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==se.type(t))r(e,t);else for(i in t)V(e+"["+i+"]",t[i],n,r)}function J(e){return se.isWindow(e)?e:9===e.nodeType&&e.defaultView}var G=[],Y=t.document,K=G.slice,Q=G.concat,Z=G.push,ee=G.indexOf,te={},ne=te.toString,re=te.hasOwnProperty,ie={},oe="2.2.0",se=function(e,t){return new se.fn.init(e,t)},ae=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,ue=/^-ms-/,ce=/-([\da-z])/gi,le=function(e,t){return t.toUpperCase()};se.fn=se.prototype={jquery:oe,constructor:se,selector:"",length:0,toArray:function(){return K.call(this)},get:function(e){return null!=e?0>e?this[e+this.length]:this[e]:K.call(this)},pushStack:function(e){var t=se.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e){return se.each(this,e)},map:function(e){return this.pushStack(se.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(K.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:Z,sort:G.sort,splice:G.splice},se.extend=se.fn.extend=function(){var e,t,n,r,i,o,s=arguments[0]||{},a=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[a]||{},a++),"object"==typeof s||se.isFunction(s)||(s={}),a===u&&(s=this,a--);u>a;a++)if(null!=(e=arguments[a]))for(t in e)n=s[t],r=e[t],s!==r&&(c&&r&&(se.isPlainObject(r)||(i=se.isArray(r)))?(i?(i=!1,o=n&&se.isArray(n)?n:[]):o=n&&se.isPlainObject(n)?n:{},s[t]=se.extend(c,o,r)):void 0!==r&&(s[t]=r));return s},se.extend({expando:"jQuery"+(oe+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===se.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){var t=e&&e.toString();return!se.isArray(e)&&t-parseFloat(t)+1>=0},isPlainObject:function(e){return"object"!==se.type(e)||e.nodeType||se.isWindow(e)?!1:e.constructor&&!re.call(e.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?te[ne.call(e)]||"object":typeof e},globalEval:function(e){var t,n=eval;e=se.trim(e),e&&(1===e.indexOf("use strict")?(t=Y.createElement("script"),t.text=e,Y.head.appendChild(t).parentNode.removeChild(t)):n(e))},camelCase:function(e){return e.replace(ue,"ms-").replace(ce,le)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var n,i=0;if(r(e))for(n=e.length;n>i&&t.call(e[i],i,e[i])!==!1;i++);else for(i in e)if(t.call(e[i],i,e[i])===!1)break;return e},trim:function(e){return null==e?"":(e+"").replace(ae,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(r(Object(e))?se.merge(n,"string"==typeof e?[e]:e):Z.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:ee.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;n>r;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,s=e.length,a=!n;s>o;o++)r=!t(e[o],o),r!==a&&i.push(e[o]);return i},map:function(e,t,n){var i,o,s=0,a=[];if(r(e))for(i=e.length;i>s;s++)o=t(e[s],s,n),null!=o&&a.push(o);else for(s in e)o=t(e[s],s,n),null!=o&&a.push(o);return Q.apply([],a)},guid:1,proxy:function(e,t){var n,r,i;return"string"==typeof t&&(n=e[t],t=e,e=n),se.isFunction(e)?(r=K.call(arguments,2),i=function(){return e.apply(t||this,r.concat(K.call(arguments)))},i.guid=e.guid=e.guid||se.guid++,i):void 0},now:Date.now,support:ie}),"function"==typeof Symbol&&(se.fn[Symbol.iterator]=G[Symbol.iterator]),se.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){te["[object "+t+"]"]=t.toLowerCase()});var fe=function(e){function t(e,t,n,r){var i,o,s,a,u,c,f,p,d=t&&t.ownerDocument,g=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==g&&9!==g&&11!==g)return n;if(!r&&((t?t.ownerDocument||t:P)!==O&&D(t),t=t||O,L)){if(11!==g&&(c=me.exec(e)))if(i=c[1]){if(9===g){if(!(s=t.getElementById(i)))return n;if(s.id===i)return n.push(s),n}else if(d&&(s=d.getElementById(i))&&M(t,s)&&s.id===i)return n.push(s),n}else{if(c[2])return Q.apply(n,t.getElementsByTagName(e)),n;if((i=c[3])&&w.getElementsByClassName&&t.getElementsByClassName)return Q.apply(n,t.getElementsByClassName(i)),n}if(w.qsa&&!U[e+" "]&&(!I||!I.test(e))){if(1!==g)d=t,p=e;else if("object"!==t.nodeName.toLowerCase()){for((a=t.getAttribute("id"))?a=a.replace(xe,"\\$&"):t.setAttribute("id",a=R),f=E(e),o=f.length,u=he.test(a)?"#"+a:"[id='"+a+"']";o--;)f[o]=u+" "+h(f[o]);p=f.join(","),d=ye.test(e)&&l(t.parentNode)||t}if(p)try{return Q.apply(n,d.querySelectorAll(p)),n}catch(v){}finally{a===R&&t.removeAttribute("id")}}}return S(e.replace(ae,"$1"),t,n,r)}function n(){function e(n,r){return t.push(n+" ")>T.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[R]=!0,e}function i(e){var t=O.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=n.length;r--;)T.attrHandle[n[r]]=t}function s(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||V)-(~e.sourceIndex||V);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function a(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function u(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function c(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),s=o.length;s--;)n[i=o[s]]&&(n[i]=!(r[i]=n[i]))})})}function l(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function f(){}function h(e){for(var t=0,n=e.length,r="";n>t;t++)r+=e[t].value;return r}function p(e,t,n){var r=t.dir,i=n&&"parentNode"===r,o=B++;return t.first?function(t,n,o){for(;t=t[r];)if(1===t.nodeType||i)return e(t,n,o)}:function(t,n,s){var a,u,c,l=[$,o];if(s){for(;t=t[r];)if((1===t.nodeType||i)&&e(t,n,s))return!0}else for(;t=t[r];)if(1===t.nodeType||i){if(c=t[R]||(t[R]={}),u=c[t.uniqueID]||(c[t.uniqueID]={}),(a=u[r])&&a[0]===$&&a[1]===o)return l[2]=a[2];if(u[r]=l,l[2]=e(t,n,s))return!0}}}function d(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function g(e,n,r){for(var i=0,o=n.length;o>i;i++)t(e,n[i],r);return r}function v(e,t,n,r,i){for(var o,s=[],a=0,u=e.length,c=null!=t;u>a;a++)(o=e[a])&&(!n||n(o,r,i))&&(s.push(o),c&&t.push(a));return s}function m(e,t,n,i,o,s){return i&&!i[R]&&(i=m(i)),o&&!o[R]&&(o=m(o,s)),r(function(r,s,a,u){var c,l,f,h=[],p=[],d=s.length,m=r||g(t||"*",a.nodeType?[a]:a,[]),y=!e||!r&&t?m:v(m,h,e,a,u),x=n?o||(r?e:d||i)?[]:s:y;if(n&&n(y,x,a,u),i)for(c=v(x,p),i(c,[],a,u),l=c.length;l--;)(f=c[l])&&(x[p[l]]=!(y[p[l]]=f));if(r){if(o||e){if(o){for(c=[],l=x.length;l--;)(f=x[l])&&c.push(y[l]=f);o(null,x=[],c,u)}for(l=x.length;l--;)(f=x[l])&&(c=o?ee(r,f):h[l])>-1&&(r[c]=!(s[c]=f))}}else x=v(x===s?x.splice(d,x.length):x),o?o(null,s,x,u):Q.apply(s,x)})}function y(e){for(var t,n,r,i=e.length,o=T.relative[e[0].type],s=o||T.relative[" "],a=o?1:0,u=p(function(e){return e===t},s,!0),c=p(function(e){return ee(t,e)>-1},s,!0),l=[function(e,n,r){var i=!o&&(r||n!==_)||((t=n).nodeType?u(e,n,r):c(e,n,r));return t=null,i}];i>a;a++)if(n=T.relative[e[a].type])l=[p(d(l),n)];else{if(n=T.filter[e[a].type].apply(null,e[a].matches),n[R]){for(r=++a;i>r&&!T.relative[e[r].type];r++);return m(a>1&&d(l),a>1&&h(e.slice(0,a-1).concat({value:" "===e[a-2].type?"*":""})).replace(ae,"$1"),n,r>a&&y(e.slice(a,r)),i>r&&y(e=e.slice(r)),i>r&&h(e))}l.push(n)}return d(l)}function x(e,n){var i=n.length>0,o=e.length>0,s=function(r,s,a,u,c){var l,f,h,p=0,d="0",g=r&&[],m=[],y=_,x=r||o&&T.find.TAG("*",c),b=$+=null==y?1:Math.random()||.1,w=x.length;for(c&&(_=s===O||s||c);d!==w&&null!=(l=x[d]);d++){if(o&&l){for(f=0,s||l.ownerDocument===O||(D(l),a=!L);h=e[f++];)if(h(l,s||O,a)){u.push(l);break}c&&($=b)}i&&((l=!h&&l)&&p--,r&&g.push(l))}if(p+=d,i&&d!==p){for(f=0;h=n[f++];)h(g,m,s,a);if(r){if(p>0)for(;d--;)g[d]||m[d]||(m[d]=Y.call(u));m=v(m)}Q.apply(u,m),c&&!r&&m.length>0&&p+n.length>1&&t.uniqueSort(u)}return c&&($=b,_=y),g};return i?r(s):s}var b,w,T,C,k,E,j,S,_,N,A,D,O,q,L,I,H,F,M,R="sizzle"+1*new Date,P=e.document,$=0,B=0,W=n(),z=n(),U=n(),X=function(e,t){return e===t&&(A=!0),0},V=1<<31,J={}.hasOwnProperty,G=[],Y=G.pop,K=G.push,Q=G.push,Z=G.slice,ee=function(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1},te="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ne="[\\x20\\t\\r\\n\\f]",re="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ie="\\["+ne+"*("+re+")(?:"+ne+"*([*^$|!~]?=)"+ne+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+re+"))|)"+ne+"*\\]",oe=":("+re+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ie+")*)|.*)\\)|)",se=new RegExp(ne+"+","g"),ae=new RegExp("^"+ne+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ne+"+$","g"),ue=new RegExp("^"+ne+"*,"+ne+"*"),ce=new RegExp("^"+ne+"*([>+~]|"+ne+")"+ne+"*"),le=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),fe=new RegExp(oe),he=new RegExp("^"+re+"$"),pe={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re+"|[*])"),ATTR:new RegExp("^"+ie),PSEUDO:new RegExp("^"+oe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},de=/^(?:input|select|textarea|button)$/i,ge=/^h\d$/i,ve=/^[^{]+\{\s*\[native \w/,me=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ye=/[+~]/,xe=/'|\\/g,be=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),we=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},Te=function(){D()};try{Q.apply(G=Z.call(P.childNodes),P.childNodes),G[P.childNodes.length].nodeType}catch(Ce){Q={apply:G.length?function(e,t){K.apply(e,Z.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}w=t.support={},k=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},D=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:P;return r!==O&&9===r.nodeType&&r.documentElement?(O=r,q=O.documentElement,L=!k(O),(n=O.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Te,!1):n.attachEvent&&n.attachEvent("onunload",Te)),w.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),w.getElementsByTagName=i(function(e){return e.appendChild(O.createComment("")),!e.getElementsByTagName("*").length}),w.getElementsByClassName=ve.test(O.getElementsByClassName),w.getById=i(function(e){return q.appendChild(e).id=R,!O.getElementsByName||!O.getElementsByName(R).length}),w.getById?(T.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&L){var n=t.getElementById(e);return n?[n]:[]}},T.filter.ID=function(e){var t=e.replace(be,we);return function(e){return e.getAttribute("id")===t}}):(delete T.find.ID,T.filter.ID=function(e){var t=e.replace(be,we);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),T.find.TAG=w.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):w.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},T.find.CLASS=w.getElementsByClassName&&function(e,t){return"undefined"!=typeof t.getElementsByClassName&&L?t.getElementsByClassName(e):void 0},H=[],I=[],(w.qsa=ve.test(O.querySelectorAll))&&(i(function(e){q.appendChild(e).innerHTML="<a id='"+R+"'></a><select id='"+R+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&I.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||I.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+R+"-]").length||I.push("~="),e.querySelectorAll(":checked").length||I.push(":checked"),e.querySelectorAll("a#"+R+"+*").length||I.push(".#.+[+~]")}),i(function(e){var t=O.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&I.push("name"+ne+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||I.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),I.push(",.*:")})),(w.matchesSelector=ve.test(F=q.matches||q.webkitMatchesSelector||q.mozMatchesSelector||q.oMatchesSelector||q.msMatchesSelector))&&i(function(e){w.disconnectedMatch=F.call(e,"div"),F.call(e,"[s!='']:x"),H.push("!=",oe)}),I=I.length&&new RegExp(I.join("|")),H=H.length&&new RegExp(H.join("|")),t=ve.test(q.compareDocumentPosition),M=t||ve.test(q.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},X=t?function(e,t){if(e===t)return A=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!w.sortDetached&&t.compareDocumentPosition(e)===n?e===O||e.ownerDocument===P&&M(P,e)?-1:t===O||t.ownerDocument===P&&M(P,t)?1:N?ee(N,e)-ee(N,t):0:4&n?-1:1)}:function(e,t){if(e===t)return A=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],u=[t];if(!i||!o)return e===O?-1:t===O?1:i?-1:o?1:N?ee(N,e)-ee(N,t):0;if(i===o)return s(e,t);for(n=e;n=n.parentNode;)a.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;a[r]===u[r];)r++;return r?s(a[r],u[r]):a[r]===P?-1:u[r]===P?1:0},O):O},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==O&&D(e),n=n.replace(le,"='$1']"),w.matchesSelector&&L&&!U[n+" "]&&(!H||!H.test(n))&&(!I||!I.test(n)))try{var r=F.call(e,n);if(r||w.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return t(n,O,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==O&&D(e),M(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==O&&D(e);var n=T.attrHandle[t.toLowerCase()],r=n&&J.call(T.attrHandle,t.toLowerCase())?n(e,t,!L):void 0;return void 0!==r?r:w.attributes||!L?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(A=!w.detectDuplicates,N=!w.sor