-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchiropractor.min.js
6 lines (5 loc) · 80.6 KB
/
chiropractor.min.js
1
2
3
4
5
6
/*! chiropractor 0.1.15 (2014-04-16) */
!function(){!function(a,b){"undefined"!=typeof exports?b(a,exports,require("underscore")):"function"==typeof define&&define.amd?define("backbone",["underscore","jquery","exports"],function(c,d,e){a.Backbone=b(a,e,c,d)}):a.Backbone=b(a,{},a._,a.jQuery||a.Zepto||a.ender||a.$)}(this,function(a,b,c,d){{var e=a.Backbone,f=[],g=(f.push,f.slice);f.splice}b.VERSION="1.1.0",b.$=d,b.noConflict=function(){return a.Backbone=e,this},b.emulateHTTP=!1,b.emulateJSON=!1;var h=b.Events={on:function(a,b,c){if(!j(this,"on",a,[b,c])||!b)return this;this._events||(this._events={});var d=this._events[a]||(this._events[a]=[]);return d.push({callback:b,context:c,ctx:c||this}),this},once:function(a,b,d){if(!j(this,"once",a,[b,d])||!b)return this;var e=this,f=c.once(function(){e.off(a,f),b.apply(this,arguments)});return f._callback=b,this.on(a,f,d)},off:function(a,b,d){var e,f,g,h,i,k,l,m;if(!this._events||!j(this,"off",a,[b,d]))return this;if(!a&&!b&&!d)return this._events={},this;for(h=a?[a]:c.keys(this._events),i=0,k=h.length;k>i;i++)if(a=h[i],g=this._events[a]){if(this._events[a]=e=[],b||d)for(l=0,m=g.length;m>l;l++)f=g[l],(b&&b!==f.callback&&b!==f.callback._callback||d&&d!==f.context)&&e.push(f);e.length||delete this._events[a]}return this},trigger:function(a){if(!this._events)return this;var b=g.call(arguments,1);if(!j(this,"trigger",a,b))return this;var c=this._events[a],d=this._events.all;return c&&k(c,b),d&&k(d,arguments),this},stopListening:function(a,b,d){var e=this._listeningTo;if(!e)return this;var f=!b&&!d;d||"object"!=typeof b||(d=this),a&&((e={})[a._listenId]=a);for(var g in e)a=e[g],a.off(b,d,this),(f||c.isEmpty(a._events))&&delete this._listeningTo[g];return this}},i=/\s+/,j=function(a,b,c,d){if(!c)return!0;if("object"==typeof c){for(var e in c)a[b].apply(a,[e,c[e]].concat(d));return!1}if(i.test(c)){for(var f=c.split(i),g=0,h=f.length;h>g;g++)a[b].apply(a,[f[g]].concat(d));return!1}return!0},k=function(a,b){var c,d=-1,e=a.length,f=b[0],g=b[1],h=b[2];switch(b.length){case 0:for(;++d<e;)(c=a[d]).callback.call(c.ctx);return;case 1:for(;++d<e;)(c=a[d]).callback.call(c.ctx,f);return;case 2:for(;++d<e;)(c=a[d]).callback.call(c.ctx,f,g);return;case 3:for(;++d<e;)(c=a[d]).callback.call(c.ctx,f,g,h);return;default:for(;++d<e;)(c=a[d]).callback.apply(c.ctx,b)}},l={listenTo:"on",listenToOnce:"once"};c.each(l,function(a,b){h[b]=function(b,d,e){var f=this._listeningTo||(this._listeningTo={}),g=b._listenId||(b._listenId=c.uniqueId("l"));return f[g]=b,e||"object"!=typeof d||(e=this),b[a](d,e,this),this}}),h.bind=h.on,h.unbind=h.off,c.extend(b,h);var m=b.Model=function(a,b){var d=a||{};b||(b={}),this.cid=c.uniqueId("c"),this.attributes={},b.collection&&(this.collection=b.collection),b.parse&&(d=this.parse(d,b)||{}),d=c.defaults({},d,c.result(this,"defaults")),this.set(d,b),this.changed={},this.initialize.apply(this,arguments)};c.extend(m.prototype,h,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(){return c.clone(this.attributes)},sync:function(){return b.sync.apply(this,arguments)},get:function(a){return this.attributes[a]},escape:function(a){return c.escape(this.get(a))},has:function(a){return null!=this.get(a)},set:function(a,b,d){var e,f,g,h,i,j,k,l;if(null==a)return this;if("object"==typeof a?(f=a,d=b):(f={})[a]=b,d||(d={}),!this._validate(f,d))return!1;g=d.unset,i=d.silent,h=[],j=this._changing,this._changing=!0,j||(this._previousAttributes=c.clone(this.attributes),this.changed={}),l=this.attributes,k=this._previousAttributes,this.idAttribute in f&&(this.id=f[this.idAttribute]);for(e in f)b=f[e],c.isEqual(l[e],b)||h.push(e),c.isEqual(k[e],b)?delete this.changed[e]:this.changed[e]=b,g?delete l[e]:l[e]=b;if(!i){h.length&&(this._pending=!0);for(var m=0,n=h.length;n>m;m++)this.trigger("change:"+h[m],this,l[h[m]],d)}if(j)return this;if(!i)for(;this._pending;)this._pending=!1,this.trigger("change",this,d);return this._pending=!1,this._changing=!1,this},unset:function(a,b){return this.set(a,void 0,c.extend({},b,{unset:!0}))},clear:function(a){var b={};for(var d in this.attributes)b[d]=void 0;return this.set(b,c.extend({},a,{unset:!0}))},hasChanged:function(a){return null==a?!c.isEmpty(this.changed):c.has(this.changed,a)},changedAttributes:function(a){if(!a)return this.hasChanged()?c.clone(this.changed):!1;var b,d=!1,e=this._changing?this._previousAttributes:this.attributes;for(var f in a)c.isEqual(e[f],b=a[f])||((d||(d={}))[f]=b);return d},previous:function(a){return null!=a&&this._previousAttributes?this._previousAttributes[a]:null},previousAttributes:function(){return c.clone(this._previousAttributes)},fetch:function(a){a=a?c.clone(a):{},void 0===a.parse&&(a.parse=!0);var b=this,d=a.success;return a.success=function(c){return b.set(b.parse(c,a),a)?(d&&d(b,c,a),void b.trigger("sync",b,c,a)):!1},L(this,a),this.sync("read",this,a)},save:function(a,b,d){var e,f,g,h=this.attributes;if(null==a||"object"==typeof a?(e=a,d=b):(e={})[a]=b,d=c.extend({validate:!0},d),e&&!d.wait){if(!this.set(e,d))return!1}else if(!this._validate(e,d))return!1;e&&d.wait&&(this.attributes=c.extend({},h,e)),void 0===d.parse&&(d.parse=!0);var i=this,j=d.success;return d.success=function(a){i.attributes=h;var b=i.parse(a,d);return d.wait&&(b=c.extend(e||{},b)),c.isObject(b)&&!i.set(b,d)?!1:(j&&j(i,a,d),void i.trigger("sync",i,a,d))},L(this,d),f=this.isNew()?"create":d.patch?"patch":"update","patch"===f&&(d.attrs=e),g=this.sync(f,this,d),e&&d.wait&&(this.attributes=h),g},destroy:function(a){a=a?c.clone(a):{};var b=this,d=a.success,e=function(){b.trigger("destroy",b,b.collection,a)};if(a.success=function(c){(a.wait||b.isNew())&&e(),d&&d(b,c,a),b.isNew()||b.trigger("sync",b,c,a)},this.isNew())return a.success(),!1;L(this,a);var f=this.sync("delete",this,a);return a.wait||e(),f},url:function(){var a=c.result(this,"urlRoot")||c.result(this.collection,"url")||K();return this.isNew()?a:a+("/"===a.charAt(a.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(a){return a},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},isValid:function(a){return this._validate({},c.extend(a||{},{validate:!0}))},_validate:function(a,b){if(!b.validate||!this.validate)return!0;a=c.extend({},this.attributes,a);var d=this.validationError=this.validate(a,b)||null;return d?(this.trigger("invalid",this,d,c.extend(b,{validationError:d})),!1):!0}});var n=["keys","values","pairs","invert","pick","omit"];c.each(n,function(a){m.prototype[a]=function(){var b=g.call(arguments);return b.unshift(this.attributes),c[a].apply(c,b)}});var o=b.Collection=function(a,b){b||(b={}),b.model&&(this.model=b.model),void 0!==b.comparator&&(this.comparator=b.comparator),this._reset(),this.initialize.apply(this,arguments),a&&this.reset(a,c.extend({silent:!0},b))},p={add:!0,remove:!0,merge:!0},q={add:!0,remove:!1};c.extend(o.prototype,h,{model:m,initialize:function(){},toJSON:function(a){return this.map(function(b){return b.toJSON(a)})},sync:function(){return b.sync.apply(this,arguments)},add:function(a,b){return this.set(a,c.extend({merge:!1},b,q))},remove:function(a,b){var d=!c.isArray(a);a=d?[a]:c.clone(a),b||(b={});var e,f,g,h;for(e=0,f=a.length;f>e;e++)h=a[e]=this.get(a[e]),h&&(delete this._byId[h.id],delete this._byId[h.cid],g=this.indexOf(h),this.models.splice(g,1),this.length--,b.silent||(b.index=g,h.trigger("remove",h,this,b)),this._removeReference(h));return d?a[0]:a},set:function(a,b){b=c.defaults({},b,p),b.parse&&(a=this.parse(a,b));var d=!c.isArray(a);a=d?a?[a]:[]:c.clone(a);var e,f,g,h,i,j,k,l=b.at,n=this.model,o=this.comparator&&null==l&&b.sort!==!1,q=c.isString(this.comparator)?this.comparator:null,r=[],s=[],t={},u=b.add,v=b.merge,w=b.remove,x=!o&&u&&w?[]:!1;for(e=0,f=a.length;f>e;e++){if(i=a[e],g=i instanceof m?h=i:i[n.prototype.idAttribute],j=this.get(g))w&&(t[j.cid]=!0),v&&(i=i===h?h.attributes:i,b.parse&&(i=j.parse(i,b)),j.set(i,b),o&&!k&&j.hasChanged(q)&&(k=!0)),a[e]=j;else if(u){if(h=a[e]=this._prepareModel(i,b),!h)continue;r.push(h),h.on("all",this._onModelEvent,this),this._byId[h.cid]=h,null!=h.id&&(this._byId[h.id]=h)}x&&x.push(j||h)}if(w){for(e=0,f=this.length;f>e;++e)t[(h=this.models[e]).cid]||s.push(h);s.length&&this.remove(s,b)}if(r.length||x&&x.length)if(o&&(k=!0),this.length+=r.length,null!=l)for(e=0,f=r.length;f>e;e++)this.models.splice(l+e,0,r[e]);else{x&&(this.models.length=0);var y=x||r;for(e=0,f=y.length;f>e;e++)this.models.push(y[e])}if(k&&this.sort({silent:!0}),!b.silent){for(e=0,f=r.length;f>e;e++)(h=r[e]).trigger("add",h,this,b);(k||x&&x.length)&&this.trigger("sort",this,b)}return d?a[0]:a},reset:function(a,b){b||(b={});for(var d=0,e=this.models.length;e>d;d++)this._removeReference(this.models[d]);return b.previousModels=this.models,this._reset(),a=this.add(a,c.extend({silent:!0},b)),b.silent||this.trigger("reset",this,b),a},push:function(a,b){return this.add(a,c.extend({at:this.length},b))},pop:function(a){var b=this.at(this.length-1);return this.remove(b,a),b},unshift:function(a,b){return this.add(a,c.extend({at:0},b))},shift:function(a){var b=this.at(0);return this.remove(b,a),b},slice:function(){return g.apply(this.models,arguments)},get:function(a){return null==a?void 0:this._byId[a.id]||this._byId[a.cid]||this._byId[a]},at:function(a){return this.models[a]},where:function(a,b){return c.isEmpty(a)?b?void 0:[]:this[b?"find":"filter"](function(b){for(var c in a)if(a[c]!==b.get(c))return!1;return!0})},findWhere:function(a){return this.where(a,!0)},sort:function(a){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return a||(a={}),c.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(c.bind(this.comparator,this)),a.silent||this.trigger("sort",this,a),this},pluck:function(a){return c.invoke(this.models,"get",a)},fetch:function(a){a=a?c.clone(a):{},void 0===a.parse&&(a.parse=!0);var b=a.success,d=this;return a.success=function(c){var e=a.reset?"reset":"set";d[e](c,a),b&&b(d,c,a),d.trigger("sync",d,c,a)},L(this,a),this.sync("read",this,a)},create:function(a,b){if(b=b?c.clone(b):{},!(a=this._prepareModel(a,b)))return!1;b.wait||this.add(a,b);var d=this,e=b.success;return b.success=function(a,b,c){c.wait&&d.add(a,c),e&&e(a,b,c)},a.save(null,b),a},parse:function(a){return a},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(a,b){if(a instanceof m)return a.collection||(a.collection=this),a;b=b?c.clone(b):{},b.collection=this;var d=new this.model(a,b);return d.validationError?(this.trigger("invalid",this,d.validationError,b),!1):d},_removeReference:function(a){this===a.collection&&delete a.collection,a.off("all",this._onModelEvent,this)},_onModelEvent:function(a,b,c,d){("add"!==a&&"remove"!==a||c===this)&&("destroy"===a&&this.remove(b,d),b&&a==="change:"+b.idAttribute&&(delete this._byId[b.previous(b.idAttribute)],null!=b.id&&(this._byId[b.id]=b)),this.trigger.apply(this,arguments))}});var r=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain"];c.each(r,function(a){o.prototype[a]=function(){var b=g.call(arguments);return b.unshift(this.models),c[a].apply(c,b)}});var s=["groupBy","countBy","sortBy"];c.each(s,function(a){o.prototype[a]=function(b,d){var e=c.isFunction(b)?b:function(a){return a.get(b)};return c[a](this.models,e,d)}});var t=b.View=function(a){this.cid=c.uniqueId("view"),a||(a={}),c.extend(this,c.pick(a,v)),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},u=/^(\S+)\s*(.*)$/,v=["model","collection","el","id","attributes","className","tagName","events"];c.extend(t.prototype,h,{tagName:"div",$:function(a){return this.$el.find(a)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(a,c){return this.$el&&this.undelegateEvents(),this.$el=a instanceof b.$?a:b.$(a),this.el=this.$el[0],c!==!1&&this.delegateEvents(),this},delegateEvents:function(a){if(!a&&!(a=c.result(this,"events")))return this;this.undelegateEvents();for(var b in a){var d=a[b];if(c.isFunction(d)||(d=this[a[b]]),d){var e=b.match(u),f=e[1],g=e[2];d=c.bind(d,this),f+=".delegateEvents"+this.cid,""===g?this.$el.on(f,d):this.$el.on(f,g,d)}}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_ensureElement:function(){if(this.el)this.setElement(c.result(this,"el"),!1);else{var a=c.extend({},c.result(this,"attributes"));this.id&&(a.id=c.result(this,"id")),this.className&&(a["class"]=c.result(this,"className"));var d=b.$("<"+c.result(this,"tagName")+">").attr(a);this.setElement(d,!1)}}}),b.sync=function(a,d,e){var f=x[a];c.defaults(e||(e={}),{emulateHTTP:b.emulateHTTP,emulateJSON:b.emulateJSON});var g={type:f,dataType:"json"};if(e.url||(g.url=c.result(d,"url")||K()),null!=e.data||!d||"create"!==a&&"update"!==a&&"patch"!==a||(g.contentType="application/json",g.data=JSON.stringify(e.attrs||d.toJSON(e))),e.emulateJSON&&(g.contentType="application/x-www-form-urlencoded",g.data=g.data?{model:g.data}:{}),e.emulateHTTP&&("PUT"===f||"DELETE"===f||"PATCH"===f)){g.type="POST",e.emulateJSON&&(g.data._method=f);var h=e.beforeSend;e.beforeSend=function(a){return a.setRequestHeader("X-HTTP-Method-Override",f),h?h.apply(this,arguments):void 0}}"GET"===g.type||e.emulateJSON||(g.processData=!1),"PATCH"===g.type&&w&&(g.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var i=e.xhr=b.ajax(c.extend(g,e));return d.trigger("request",d,i,e),i};var w=!("undefined"==typeof window||!window.ActiveXObject||window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent),x={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};b.ajax=function(){return b.$.ajax.apply(b.$,arguments)};var y=b.Router=function(a){a||(a={}),a.routes&&(this.routes=a.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},z=/\((.*?)\)/g,A=/(\(\?)?:\w+/g,B=/\*\w+/g,C=/[\-{}\[\]+?.,\\\^$|#\s]/g;c.extend(y.prototype,h,{initialize:function(){},route:function(a,d,e){c.isRegExp(a)||(a=this._routeToRegExp(a)),c.isFunction(d)&&(e=d,d=""),e||(e=this[d]);var f=this;return b.history.route(a,function(c){var g=f._extractParameters(a,c);e&&e.apply(f,g),f.trigger.apply(f,["route:"+d].concat(g)),f.trigger("route",d,g),b.history.trigger("route",f,d,g)}),this},navigate:function(a,c){return b.history.navigate(a,c),this},_bindRoutes:function(){if(this.routes){this.routes=c.result(this,"routes");for(var a,b=c.keys(this.routes);null!=(a=b.pop());)this.route(a,this.routes[a])}},_routeToRegExp:function(a){return a=a.replace(C,"\\$&").replace(z,"(?:$1)?").replace(A,function(a,b){return b?a:"([^/]+)"}).replace(B,"(.*?)"),new RegExp("^"+a+"$")},_extractParameters:function(a,b){var d=a.exec(b).slice(1);return c.map(d,function(a){return a?decodeURIComponent(a):null})}});var D=b.History=function(){this.handlers=[],c.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},E=/^[#\/]|\s+$/g,F=/^\/+|\/+$/g,G=/msie [\w.]+/,H=/\/$/,I=/[?#].*$/;D.started=!1,c.extend(D.prototype,h,{interval:50,getHash:function(a){var b=(a||this).location.href.match(/#(.*)$/);return b?b[1]:""},getFragment:function(a,b){if(null==a)if(this._hasPushState||!this._wantsHashChange||b){a=this.location.pathname;var c=this.root.replace(H,"");a.indexOf(c)||(a=a.slice(c.length))}else a=this.getHash();return a.replace(E,"")},start:function(a){if(D.started)throw new Error("Backbone.history has already been started");D.started=!0,this.options=c.extend({root:"/"},this.options,a),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var d=this.getFragment(),e=document.documentMode,f=G.exec(navigator.userAgent.toLowerCase())&&(!e||7>=e);this.root=("/"+this.root+"/").replace(F,"/"),f&&this._wantsHashChange&&(this.iframe=b.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(d)),this._hasPushState?b.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!f?b.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=d;var g=this.location,h=g.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!h)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._hasPushState&&h&&g.hash&&(this.fragment=this.getHash().replace(E,""),this.history.replaceState({},document.title,this.root+this.fragment+g.search))}return this.options.silent?void 0:this.loadUrl()},stop:function(){b.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),D.started=!1},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(){var a=this.getFragment();return a===this.fragment&&this.iframe&&(a=this.getFragment(this.getHash(this.iframe))),a===this.fragment?!1:(this.iframe&&this.navigate(a),void this.loadUrl())},loadUrl:function(a){return a=this.fragment=this.getFragment(a),c.any(this.handlers,function(b){return b.route.test(a)?(b.callback(a),!0):void 0})},navigate:function(a,b){if(!D.started)return!1;b&&b!==!0||(b={trigger:!!b});var c=this.root+(a=this.getFragment(a||""));if(a=a.replace(I,""),this.fragment!==a){if(this.fragment=a,""===a&&"/"!==c&&(c=c.slice(0,-1)),this._hasPushState)this.history[b.replace?"replaceState":"pushState"]({},document.title,c);else{if(!this._wantsHashChange)return this.location.assign(c);this._updateHash(this.location,a,b.replace),this.iframe&&a!==this.getFragment(this.getHash(this.iframe))&&(b.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,a,b.replace))}return b.trigger?this.loadUrl(a):void 0}},_updateHash:function(a,b,c){if(c){var d=a.href.replace(/(javascript:|#).*$/,"");a.replace(d+"#"+b)}else a.hash="#"+b}}),b.history=new D;var J=function(a,b){var d,e=this;d=a&&c.has(a,"constructor")?a.constructor:function(){return e.apply(this,arguments)},c.extend(d,e,b);var f=function(){this.constructor=d};return f.prototype=e.prototype,d.prototype=new f,a&&c.extend(d.prototype,a),d.__super__=e.prototype,d};m.extend=o.extend=y.extend=t.extend=D.extend=J;var K=function(){throw new Error('A "url" property or function must be specified')},L=function(a,b){var c=b.error;b.error=function(d){c&&c(a,d,b),a.trigger("error",a,d,b)}};return b}),function(a){"function"==typeof define&&define.amd?define("backbone.subroute",["underscore","backbone"],a):"object"==typeof exports?a(require("underscore"),require("backbone")):a(_,Backbone)}(function(a,b){return b.SubRoute=b.Router.extend({constructor:function(c,d){this.routes=a.clone(this.routes)||{},this.prefix=c=c||"",this.separator="/"===c.slice(-1)?"":"/",this.createTrailingSlashRoutes=d&&d.createTrailingSlashRoutes,b.Router.prototype.constructor.call(this,d);var e;e=b.history.fragment?b.history.getFragment():b.history.getHash(),a.every(this.routes,function(a,c){return e.match(b.Router.prototype._routeToRegExp(c))?(b.history.loadUrl(e),!1):!0},this),this.postInitialize&&this.postInitialize(d)},navigate:function(a,c){"/"!=a.substr(0,1)&&0!==a.indexOf(this.prefix.substr(0,this.prefix.length-1))&&(a=this.prefix+(a?this.separator:"")+a),b.Router.prototype.navigate.call(this,a,c)},route:function(a,c,d){"/"===a.substr(0)&&(a=a.substr(1,a.length));var e=this.prefix;return a&&a.length>0&&(this.prefix.length>0&&(e+=this.separator),e+=a),this.createTrailingSlashRoutes&&(this.routes[e+"/"]=c,b.Router.prototype.route.call(this,e+"/",c,d)),delete this.routes[a],this.routes[e]=c,b.Router.prototype.route.call(this,e,c,d)}}),b.SubRoute}),"object"!=typeof JSON&&(JSON={}),define("json-ie7",["require"],function(require){function f(a){return 10>a?"0"+a:a}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g,h=gap,i=b[a];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(a)),"function"==typeof rep&&(i=rep.call(b,a,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";if(gap+=indent,g=[],"[object Array]"===Object.prototype.toString.apply(i)){for(f=i.length,c=0;f>c;c+=1)g[c]=str(c,i)||"null";return e=0===g.length?"[]":gap?"[\n"+gap+g.join(",\n"+gap)+"\n"+h+"]":"["+g.join(",")+"]",gap=h,e}if(rep&&"object"==typeof rep)for(f=rep.length,c=0;f>c;c+=1)"string"==typeof rep[c]&&(d=rep[c],e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));else for(d in i)Object.prototype.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));return e=0===g.length?"{}":gap?"{\n"+gap+g.join(",\n"+gap)+"\n"+h+"}":"{"+g.join(",")+"}",gap=h,e}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(a,b,c){var d;if(gap="",indent="","number"==typeof c)for(d=0;c>d;d+=1)indent+=" ";else"string"==typeof c&&(indent=c);if(rep=b,b&&"function"!=typeof b&&("object"!=typeof b||"number"!=typeof b.length))throw new Error("JSON.stringify");return str("",{"":a})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&"object"==typeof e)for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),void 0!==d?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}),define("chiropractor/views/base",["require","underscore","json-ie7","jquery","backbone","handlebars"],function(a){var b,c=a("underscore"),d=(a("json-ie7"),a("jquery")),e=a("backbone"),f=a("handlebars"),g=d("<span></span>"),h=!1;return g.on("remove",function(){h=!0}),g.remove(),h||(d.event.special.remove={remove:function(a){if(a.handler){var b=d(this);b.hasClass("removedEventFired")||(b.addClass("removedEventFired"),a.handler.call(this,new d.Event("remove",{target:this})))}}}),b=function(a){return"chiropractorId"+a.cid},e.View.extend({initialize:function(a){a=a||{},e.View.prototype.initialize.call(this,a),c.bindAll(this,"remove"),this._childViews=[],this._context=a.context||{},this.$el.on("remove",this.remove)},_addChild:function(a){return this._childViews.push(a),"<"+a.el.tagName+' id="'+b(a)+'"></div>'},context:function(){return{model:this.model,collection:this.collection}},render:function(){var a="string"==typeof this.template?f.compile(this.template):this.template,d="function"==typeof this.context?this.context():this.context;return d.declaringView=this,c.defaults(d,this._context),a&&this.$el.html(a(d)),c(this._childViews).each(function(a){this.$("#"+b(a)).replaceWith(a.el)},this),this},remove:function(){this.$el.addClass("removedEventFired"),this.$el.off("remove",this.remove),c(this._childViews).each(function(a){a.remove()}),this._childViews=[],e.View.prototype.remove.apply(this,arguments)}})}),define("chiropractor/views/form",["require","underscore","json-ie7","jquery","backbone","./base"],function(a){var b=a("underscore"),c=(a("json-ie7"),a("jquery")),d=a("backbone"),e=a("./base");return e.extend({initialize:function(){e.prototype.initialize.apply(this,arguments),this.listenForErrors(this.model),this.listenForErrors(this.collection)},listenForErrors:function(a){if(a)if(a instanceof d.Model)this.listenTo(a,"invalid",this.renderFormErrors),this.listenTo(a,"change",this.clearFormErrors);else{if(!(a instanceof d.Collection))throw new Error("Invalid object to associate errors with.");a.each(function(a){this.listenTo(a,"invalid",this.renderFormErrors),this.listenTo(a,"change",this.clearFormErrors)},this)}},clearFormErrors:function(a){b(a.changed).each(function(b,c){this.$("#container-"+a.fieldId(c)).find(".help-inline").html("")},this)},renderFormErrors:function(a,d){b(d).each(function(b,d){var e;b="string"==typeof b?[b]:b,"__all__"===d?(e=c('<div class="errors"></div>'),this.$el.prepend(e)):e=this.$("#container-"+a.fieldId(d)).find(".help-inline"),e.html(b.join(", "))},this)}})}),define("hbs!chiropractor/views/templates/fields/label",["hbs","handlebars"],function(a,b){var c=b.template(function(a,b,c){c=c||a.helpers;var d,e,f="function",g=this.escapeExpression;return e=c.value,e?d=e.call(b,{hash:{}}):(d=b.value,d=typeof d===f?d():d),g(d)});return b.registerPartial("chiropractor_views_templates_fields_label",c),c}),define("chiropractor/views/field",["require","json-ie7","jquery","underscore","handlebars","hbs!./templates/fields/label"],function(a){var b=(a("json-ie7"),a("jquery"),a("underscore")),c=a("handlebars"),d={},e=a("hbs!./templates/fields/label");return d={defaults:e},c.registerHelper("field",function(a,e,f){var g=d[a],h=arguments[arguments.length-1],i=h.hash||{},j=i.field,k="",l="";return g||(g=d.defaults),e&&(k=e.fieldId(f),j&&(l=e.get(j.id))),b.defaults(i,{id:k,label:f,name:f,options:[],blank:!1,value:l,help:"",model:e}),new c.SafeString(g(i))}),{Templates:d,addTemplate:function(a,b){d[a]=b}}}),define("hbs!chiropractor/views/templates/row/row",["hbs","handlebars"],function(a,b){var c=b.template(function(a,b,c,d,e){function f(a,b,d){var e,f,g,h,i="";return i+="\r\n <td>",e=d.model,f=a.fieldtype,g={},g.field=a,h=c.field,e=h?h.call(a,f,e,{hash:g}):j.call(a,"field",f,e,{hash:g}),i+=k(e)+"</td>\r\n "}c=c||a.helpers;var g,h,i="",j=c.helperMissing,k=this.escapeExpression,l="function",m=this;return i+='<tr class="',h=c.rowclass,h?g=h.call(b,{hash:{}}):(g=b.rowclass,g=typeof g===l?g():g),i+=k(g)+'">\r\n ',g=b.options,g=null==g||g===!1?g:g.fields,g=c.each.call(b,g,{hash:{},inverse:m.noop,fn:m.programWithDepth(f,e,b)}),(g||0===g)&&(i+=g),i+="\r\n</tr>"});return b.registerPartial("chiropractor_views_templates_row_row",c),c}),define("hbs!chiropractor/views/templates/row/error_messagebox",["hbs","handlebars"],function(a,b){var c=b.template(function(a,b,c){c=c||a.helpers;var d,e="",f="function",g=this.escapeExpression;return e+='<div id="chiropractor-error-box" style="color: #a94442;background-color: #f2dede;border-color: #ebccd1;padding: 15px;border: 1px solid transparent;border-radius: 4px;">\r\n<div aria-hidden="true" style="float:right;" onClick="javascript:var element = document.getElementById(\'chiropractor-error-box\');element.parentNode.removeChild(element);">×</div>\r\n<div style="font-weight:bold">',d=b.model,d=null==d||d===!1?d:d.errorMessage,d=typeof d===f?d():d,e+=g(d)+"</div>\r\n<div>Message: ",d=b.model,d=null==d||d===!1?d:d.response,d=null==d||d===!1?d:d.responseText,d=typeof d===f?d():d,e+=g(d)+"</div>\r\n<div>Status: ",d=b.model,d=null==d||d===!1?d:d.response,d=null==d||d===!1?d:d.statusText,d=typeof d===f?d():d,e+=g(d)+"</div>\r\n<div>StatusCode: ",d=b.model,d=null==d||d===!1?d:d.response,d=null==d||d===!1?d:d.status,d=typeof d===f?d():d,e+=g(d)+'</div>\r\n<div>Url: <a href="',d=b.model,d=null==d||d===!1?d:d.url,d=typeof d===f?d():d,e+=g(d)+'">',d=b.model,d=null==d||d===!1?d:d.url,d=typeof d===f?d():d,e+=g(d)+"</a></div>\r\n</div>"});return b.registerPartial("chiropractor_views_templates_row_error_messagebox",c),c}),define("chiropractor/views/row",["require","json-ie7","jquery","underscore","handlebars","hbs!./templates/row/row","hbs!./templates/row/error_messagebox"],function(a){var b=(a("json-ie7"),a("jquery"),a("underscore"),a("handlebars")),c={},d=a("hbs!./templates/row/row"),e=a("hbs!./templates/row/error_messagebox");return c={row:d,error:e},b.registerHelper("row",function(a,d){var e=c[a],f=arguments[arguments.length-1],g=f.hash||{};if(!e)throw new Error("Unregistered field template: "+a);return new b.SafeString(e({model:d,options:g}))}),{Templates:c,addTemplate:function(a,b){c[a]=b}}}),define("chiropractor/hbs/view",["require","underscore","backbone","handlebars"],function(a){var b,c=a("underscore"),d=(a("backbone"),a("handlebars"));return b=function(){var b,e,f,g,h,i,j,k,l={};return f=arguments[arguments.length-1],i=arguments[1]||{},c.defaults(i,f.hash||{}),4===arguments.length&&(l=arguments[2]),c.defaults(this,l),"string"==typeof arguments[0]?(j=arguments[0].split("|"),g=j[0],h=j[1],b=a(g),"string"==typeof h&&(b=b[h])):b=arguments[0],f.fn&&(b=b.extend({template:f.fn})),e=new b(i).render(),k=this.declaringView._addChild(e),f.fn?k:new d.SafeString(k)},d.registerHelper("view",b),b}),define("hbs!chiropractor/views/templates/formfield/text",["hbs","handlebars"],function(a,b){var c=b.template(function(a,b,c){c=c||a.helpers;var d,e,f="",g="function",h=this.escapeExpression;return f+='<div class="control-group" id="container-',e=c.id,e?d=e.call(b,{hash:{}}):(d=b.id,d=typeof d===g?d():d),f+=h(d)+'">\r\n <label class="control-label ',e=c.labelclass,e?d=e.call(b,{hash:{}}):(d=b.labelclass,d=typeof d===g?d():d),f+=h(d)+'" for="',e=c.id,e?d=e.call(b,{hash:{}}):(d=b.id,d=typeof d===g?d():d),f+=h(d)+'">',e=c.label,e?d=e.call(b,{hash:{}}):(d=b.label,d=typeof d===g?d():d),f+=h(d)+'</label>\r\n <div class="controls">\r\n <input type="text" placeholder="',e=c.placeholder,e?d=e.call(b,{hash:{}}):(d=b.placeholder,d=typeof d===g?d():d),f+=h(d)+'" id="',e=c.id,e?d=e.call(b,{hash:{}}):(d=b.id,d=typeof d===g?d():d),f+=h(d)+'" name="',e=c.name,e?d=e.call(b,{hash:{}}):(d=b.name,d=typeof d===g?d():d),f+=h(d)+'" value="',e=c.value,e?d=e.call(b,{hash:{}}):(d=b.value,d=typeof d===g?d():d),f+=h(d)+'" class="',e=c["class"],e?d=e.call(b,{hash:{}}):(d=b["class"],d=typeof d===g?d():d),f+=h(d)+'" />\r\n <span class="description">',e=c.description,e?d=e.call(b,{hash:{}}):(d=b.description,d=typeof d===g?d():d),f+=h(d)+'</span>\r\n <span class="help-inline">',e=c.help,e?d=e.call(b,{hash:{}}):(d=b.help,d=typeof d===g?d():d),f+=h(d)+"</span>\r\n </div>\r\n</div>\r\n"});return b.registerPartial("chiropractor_views_templates_formfield_text",c),c}),define("hbs!chiropractor/views/templates/formfield/textarea",["hbs","handlebars"],function(a,b){var c=b.template(function(a,b,c){c=c||a.helpers;var d,e,f="",g="function",h=this.escapeExpression;return f+='<div class="control-group" id="container-',e=c.id,e?d=e.call(b,{hash:{}}):(d=b.id,d=typeof d===g?d():d),f+=h(d)+'">\r\n <label class="control-label" for="',e=c.id,e?d=e.call(b,{hash:{}}):(d=b.id,d=typeof d===g?d():d),f+=h(d)+'">',e=c.label,e?d=e.call(b,{hash:{}}):(d=b.label,d=typeof d===g?d():d),f+=h(d)+'</label>\r\n <div class="controls">\r\n <textarea id="',e=c.id,e?d=e.call(b,{hash:{}}):(d=b.id,d=typeof d===g?d():d),f+=h(d)+'" name="',e=c.name,e?d=e.call(b,{hash:{}}):(d=b.name,d=typeof d===g?d():d),f+=h(d)+'">',e=c.value,e?d=e.call(b,{hash:{}}):(d=b.value,d=typeof d===g?d():d),f+=h(d)+'</textarea>\r\n <span class="help-inline">',e=c.help,e?d=e.call(b,{hash:{}}):(d=b.help,d=typeof d===g?d():d),f+=h(d)+"</span>\r\n </div>\r\n</div>\r\n"
});return b.registerPartial("chiropractor_views_templates_formfield_textarea",c),c}),define("hbs!chiropractor/views/templates/formfield/select",["hbs","handlebars"],function(a,b){var c=b.template(function(a,b,c,d,e){function f(a){var b,d,e="";return e+='\r\n <option value="">',d=c.blank,d?b=d.call(a,{hash:{}}):(b=a.blank,b=typeof b===l?b():b),e+=m(b)+"</option>\r\n "}function g(a,b,d){var e,f,g,i="";return i+='\r\n <option value="',g=c.value,g?e=g.call(a,{hash:{}}):(e=a.value,e=typeof e===l?e():e),i+=m(e)+'"',e=d.value,f=a.value,g=c.ifequal,e=g?g.call(a,f,e,{hash:{},inverse:n.noop,fn:n.program(4,h,b)}):o.call(a,"ifequal",f,e,{hash:{},inverse:n.noop,fn:n.program(4,h,b)}),(e||0===e)&&(i+=e),i+=">",g=c.label,g?e=g.call(a,{hash:{}}):(e=a.label,e=typeof e===l?e():e),i+=m(e)+"</option>\r\n "}function h(){return' selected="selected"'}c=c||a.helpers;var i,j,k="",l="function",m=this.escapeExpression,n=this,o=c.helperMissing;return k+='<div class="control-group" id="container-',j=c.id,j?i=j.call(b,{hash:{}}):(i=b.id,i=typeof i===l?i():i),k+=m(i)+'">\r\n <label class="control-label ',j=c.labelclass,j?i=j.call(b,{hash:{}}):(i=b.labelclass,i=typeof i===l?i():i),k+=m(i)+'" for="',j=c.id,j?i=j.call(b,{hash:{}}):(i=b.id,i=typeof i===l?i():i),k+=m(i)+'">',j=c.label,j?i=j.call(b,{hash:{}}):(i=b.label,i=typeof i===l?i():i),k+=m(i)+'</label>\r\n <div class="controls">\r\n <select id="',j=c.id,j?i=j.call(b,{hash:{}}):(i=b.id,i=typeof i===l?i():i),k+=m(i)+'" name="',j=c.name,j?i=j.call(b,{hash:{}}):(i=b.name,i=typeof i===l?i():i),k+=m(i)+'">\r\n ',i=b.blank,i=c["if"].call(b,i,{hash:{},inverse:n.noop,fn:n.program(1,f,e)}),(i||0===i)&&(k+=i),k+="\r\n ",i=b.options,i=c.each.call(b,i,{hash:{},inverse:n.noop,fn:n.programWithDepth(g,e,b)}),(i||0===i)&&(k+=i),k+='\r\n </select>\r\n <span class="description">',j=c.description,j?i=j.call(b,{hash:{}}):(i=b.description,i=typeof i===l?i():i),k+=m(i)+'</span>\r\n <span class="help-inline">',j=c.help,j?i=j.call(b,{hash:{}}):(i=b.help,i=typeof i===l?i():i),k+=m(i)+"</span>\r\n </div>\r\n</div>\r\n"});return b.registerPartial("chiropractor_views_templates_formfield_select",c),c}),define("hbs!chiropractor/views/templates/formfield/checkbox",["hbs","handlebars"],function(a,b){var c=b.template(function(a,b,c,d,e){function f(a){var b,d,e="";return e+=' \r\n <input type="checkbox" id="',d=c.id,d?b=d.call(a,{hash:{}}):(b=a.id,b=typeof b===j?b():b),e+=k(b)+'" name="',d=c.name,d?b=d.call(a,{hash:{}}):(b=a.name,b=typeof b===j?b():b),e+=k(b)+'" value="',d=c.value,d?b=d.call(a,{hash:{}}):(b=a.value,b=typeof b===j?b():b),e+=k(b)+'" /> ',d=c.label,d?b=d.call(a,{hash:{}}):(b=a.label,b=typeof b===j?b():b),e+=k(b)+"\r\n "}c=c||a.helpers;var g,h,i="",j="function",k=this.escapeExpression,l=this;return i+='<div class="control-group" id="container-',h=c.id,h?g=h.call(b,{hash:{}}):(g=b.id,g=typeof g===j?g():g),i+=k(g)+'">\r\n <label class="control-label" for="',h=c.id,h?g=h.call(b,{hash:{}}):(g=b.id,g=typeof g===j?g():g),i+=k(g)+'">',h=c.label,h?g=h.call(b,{hash:{}}):(g=b.label,g=typeof g===j?g():g),i+=k(g)+'</label>\r\n <div class="controls">\r\n ',g=b.options,g=c.each.call(b,g,{hash:{},inverse:l.noop,fn:l.program(1,f,e)}),(g||0===g)&&(i+=g),i+='\r\n <span class="help-inline">',h=c.help,h?g=h.call(b,{hash:{}}):(g=b.help,g=typeof g===j?g():g),i+=k(g)+"</span>\r\n </div>\r\n</div>\r\n"});return b.registerPartial("chiropractor_views_templates_formfield_checkbox",c),c}),define("hbs!chiropractor/views/templates/formfield/radio",["hbs","handlebars"],function(a,b){var c=b.template(function(a,b,c,d,e){function f(a){var b,d,e="";return e+=' \r\n <input type="radio" id="',d=c.id,d?b=d.call(a,{hash:{}}):(b=a.id,b=typeof b===j?b():b),e+=k(b)+'" name="',d=c.name,d?b=d.call(a,{hash:{}}):(b=a.name,b=typeof b===j?b():b),e+=k(b)+'" value="',d=c.value,d?b=d.call(a,{hash:{}}):(b=a.value,b=typeof b===j?b():b),e+=k(b)+'" /> ',d=c.label,d?b=d.call(a,{hash:{}}):(b=a.label,b=typeof b===j?b():b),e+=k(b)+"\r\n "}c=c||a.helpers;var g,h,i="",j="function",k=this.escapeExpression,l=this;return i+='<div class="control-group" id="container-',h=c.id,h?g=h.call(b,{hash:{}}):(g=b.id,g=typeof g===j?g():g),i+=k(g)+'">\r\n <label class="control-label" for="',h=c.id,h?g=h.call(b,{hash:{}}):(g=b.id,g=typeof g===j?g():g),i+=k(g)+'">',h=c.label,h?g=h.call(b,{hash:{}}):(g=b.label,g=typeof g===j?g():g),i+=k(g)+'</label>\r\n <div class="controls">\r\n ',g=b.options,g=c.each.call(b,g,{hash:{},inverse:l.noop,fn:l.program(1,f,e)}),(g||0===g)&&(i+=g),i+='\r\n <span class="help-inline">',h=c.help,h?g=h.call(b,{hash:{}}):(g=b.help,g=typeof g===j?g():g),i+=k(g)+"</span>\r\n </div>\r\n</div>\r\n"});return b.registerPartial("chiropractor_views_templates_formfield_radio",c),c}),define("chiropractor/views/formfield",["require","json-ie7","jquery","underscore","handlebars","../hbs/view","./base","hbs!./templates/formfield/text","hbs!./templates/formfield/textarea","hbs!./templates/formfield/select","hbs!./templates/formfield/checkbox","hbs!./templates/formfield/radio"],function(a){var b,c,d=(a("json-ie7"),a("jquery"),a("underscore")),e=a("handlebars"),f=a("../hbs/view"),g=a("./base"),h={};return b=g.extend({events:{"change input":"inputChanged","blur input":"inputChanged","change select":"inputChanged","blur select":"inputChanged","change textarea":"inputChanged","blur textarea":"inputChanged"},initialize:function(a){g.prototype.initialize.apply(this,arguments),this.config=a.context,this.field=a.field},inputChanged:function(){var a=this.$("[name="+this.field+"]").val();this.model.set(this.field,a,{validate:!0}),this.model.set(this.field,a,{silent:!0})}}),b.register=c=function(a,b){var d=h[a]=this.extend(b);return d.register=c,d},b.unregister=function(a){h[a]&&delete h[a]},b.register("text",{template:a("hbs!./templates/formfield/text")}),b.register("textarea",{template:a("hbs!./templates/formfield/textarea")}),b.register("select",{template:a("hbs!./templates/formfield/select")}),b.register("checkbox",{template:a("hbs!./templates/formfield/checkbox")}),b.register("radio",{template:a("hbs!./templates/formfield/radio")}),e.registerHelper("formfield",function(a,b,c){var e=h[a],g=arguments[arguments.length-1],i=g.hash||{};if(!e)throw new Error("Unregistered formfield template: "+a);return d.defaults(i,{id:b.fieldId(c),label:c,name:c,options:[],blank:!1,value:b.get(c)||"",help:""}),f.call(this,e,{field:c,model:b,context:i},g)}),b}),define("chiropractor/views",["require","./views/base","./views/form","./views/field","./views/row","./views/formfield"],function(a){var b=a("./views/base"),c=a("./views/form"),d=a("./views/field"),e=a("./views/row"),f=a("./views/formfield");return{Base:b,Form:c,Row:e,Field:d,FormField:f}}),function(){var bind=function(a,b){var c=Array.prototype.slice.call(arguments,2);return function(){var d=c.concat(Array.prototype.slice.call(arguments,0));a.apply(b,d)}};window.console||(window.console={});var console=window.console;if(!console.log)if(window.log4javascript){var log=log4javascript.getDefaultLogger();console.log=bind(log.info,log),console.debug=bind(log.debug,log),console.info=bind(log.info,log),console.warn=bind(log.warn,log),console.error=bind(log.error,log)}else console.log=function(){};if(console.debug||(console.debug=console.log),console.info||(console.info=console.log),console.warn||(console.warn=console.log),console.error||(console.error=console.log),null!=window.__consoleShimTest__||eval("/*@cc_on @_jscript_version <= 9@*/")){var wrap=function(a){var b,c,d,e;if(a=Array.prototype.slice.call(arguments,0),e=a.shift(),c=a.length,c>1&&window.__consoleShimTest__!==!1)for("string"!=typeof a[0]&&(a.unshift("%o"),c+=1),d=a[0].match(/%[a-z]/g),b=d?d.length+1:1;c>b;b+=1)a[0]+=" %o";Function.apply.call(e,console,a)};console.log=bind(wrap,window,console.log),console.debug=bind(wrap,window,console.debug),console.info=bind(wrap,window,console.info),console.warn=bind(wrap,window,console.warn),console.error=bind(wrap,window,console.error)}if(console.assert||(console.assert=function(){var a=Array.prototype.slice.call(arguments,0),b=a.shift();b||(a[0]="Assertion failed: "+a[0],console.error.apply(console,a))}),console.dir||(console.dir=console.log),console.dirxml||(console.dirxml=console.log),console.exception||(console.exception=console.error),!console.time||!console.timeEnd){var timers={};console.time=function(a){timers[a]=(new Date).getTime()},console.timeEnd=function(a){var b=timers[a];b&&(console.log(a+": "+((new Date).getTime()-b)+"ms"),delete timers[a])}}console.table||(console.table=function(a,b){var c,d,e,f,g,h;if(a&&a instanceof Array&&a.length){if(!(b&&b instanceof Array)){b=[];for(h in a[0])a[0].hasOwnProperty(h)&&b.push(h)}for(c=0,d=a.length;d>c;c+=1){for(e=[],f=0,g=b.length;g>f;f+=1)e.push(a[c][b[f]]);Function.apply.call(console.log,console,e)}}}),console.clear||(console.clear=function(){}),console.trace||(console.trace=function(){}),console.group||(console.group=function(){}),console.groupCollapsed||(console.groupCollapsed=function(){}),console.groupEnd||(console.groupEnd=function(){}),console.timeStamp||(console.timeStamp=function(){}),console.profile||(console.profile=function(){}),console.profileEnd||(console.profileEnd=function(){}),console.count||(console.count=function(){})}(),define("console-shim",function(a){return function(){var b;return b||a.console}}(this)),define("jquery.cors/easyxdm/easyxdm",["require","json2"],function(a){function b(a,b){var c=typeof a[b];return"function"==c||!("object"!=c||!a[b])||"unknown"==c}function c(a,b){return!("object"!=typeof a[b]||!a[b])}function d(a){return"[object Array]"===Object.prototype.toString.call(a)}function e(){var a="Shockwave Flash",b="application/x-shockwave-flash";if(!o(navigator.plugins)&&"object"==typeof navigator.plugins[a]){var c=navigator.plugins[a].description;c&&!o(navigator.mimeTypes)&&navigator.mimeTypes[b]&&navigator.mimeTypes[b].enabledPlugin&&(x=c.match(/\d+/g))}if(!x){var d;try{d=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"),x=Array.prototype.slice.call(d.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/),1),d=null}catch(e){}}if(!x)return!1;var f=parseInt(x[0],10),g=parseInt(x[1],10);return y=f>9&&g>0,!0}function f(){if(!O){O=!0;for(var a=0;a<P.length;a++)P[a]();P.length=0}}function g(a,b){return O?void a.call(b):void P.push(function(){a.call(b)})}function h(){var a=parent;if(""!==I)for(var b=0,c=I.split(".");b<c.length;b++)a=a[c[b]];return a.easyXDM}function i(a){return window.easyXDM=K,I=a,I&&(L="easyXDM_"+I.replace(".","_")+"_"),J}function j(a){return a.match(F)[3]}function k(a){return a.match(F)[4]||""}function l(a){var b=a.toLowerCase().match(F),c=b[2],d=b[3],e=b[4]||"";return("http:"==c&&":80"==e||"https:"==c&&":443"==e)&&(e=""),c+"//"+d+e}function m(a){if(a=a.replace(H,"$1/"),!a.match(/^(http||https):\/\//)){var b="/"===a.substring(0,1)?"":location.pathname;"/"!==b.substring(b.length-1)&&(b=b.substring(0,b.lastIndexOf("/")+1)),a=location.protocol+"//"+location.host+b+a}for(;G.test(a);)a=a.replace(G,"");return a}function n(a,b){var c="",d=a.indexOf("#");-1!==d&&(c=a.substring(d),a=a.substring(0,d));var e=[];for(var f in b)b.hasOwnProperty(f)&&e.push(f+"="+encodeURIComponent(b[f]));return a+(M?"#":-1==a.indexOf("?")?"?":"&")+e.join("&")+c}function o(a){return"undefined"==typeof a}function p(a,b,c){var d;for(var e in b)b.hasOwnProperty(e)&&(e in a?(d=b[e],"object"==typeof d?p(a[e],d,c):c||(a[e]=b[e])):a[e]=b[e]);return a}function q(){var a=document.body.appendChild(document.createElement("form")),b=a.appendChild(document.createElement("input"));b.name=L+"TEST"+D,w=b!==a.elements[b.name],document.body.removeChild(a)}function r(a){o(w)&&q();var b;w?b=document.createElement('<iframe name="'+a.props.name+'"/>'):(b=document.createElement("IFRAME"),b.name=a.props.name),b.id=b.name=a.props.name,delete a.props.name,"string"==typeof a.container&&(a.container=document.getElementById(a.container)),a.container||(p(b.style,{position:"absolute",top:"-2000px",left:"0px"}),a.container=document.body);var c=a.props.src;if(a.props.src="javascript:false",p(b,a.props),b.border=b.frameBorder=0,b.allowTransparency=!0,a.container.appendChild(b),a.onLoad&&z(b,"load",a.onLoad),a.usePost){var d,e=a.container.appendChild(document.createElement("form"));if(e.target=b.name,e.action=c,e.method="POST","object"==typeof a.usePost)for(var f in a.usePost)a.usePost.hasOwnProperty(f)&&(w?d=document.createElement('<input name="'+f+'"/>'):(d=document.createElement("INPUT"),d.name=f),d.value=a.usePost[f],e.appendChild(d));e.submit(),e.parentNode.removeChild(e)}else b.src=c;return a.props.src=c,b}function s(a,b){"string"==typeof a&&(a=[a]);for(var c,d=a.length;d--;)if(c=a[d],c=new RegExp("^"==c.substr(0,1)?c:"^"+c.replace(/(\*)/g,".$1").replace(/\?/g,".")+"$"),c.test(b))return!0;return!1}function t(a){var c,d=a.protocol;if(a.isHost=a.isHost||o(R.xdm_p),M=a.hash||!1,a.props||(a.props={}),a.isHost)a.remote=m(a.remote),a.channel=a.channel||"default"+D++,a.secret=Math.random().toString(16).substring(2),o(d)&&(d=l(location.href)==l(a.remote)?"4":b(window,"postMessage")||b(document,"postMessage")?"1":a.swf&&b(window,"ActiveXObject")&&e()?"6":"Gecko"===navigator.product&&"frameElement"in window&&-1==navigator.userAgent.indexOf("WebKit")?"5":a.remoteHelper?"2":"0");else if(a.channel=R.xdm_c.replace(/["'<>\\]/g,""),a.secret=R.xdm_s,a.remote=R.xdm_e.replace(/["'<>\\]/g,""),d=R.xdm_p,a.acl&&!s(a.acl,a.remote))throw new Error("Access denied for "+a.remote);switch(a.protocol=d,d){case"0":if(p(a,{interval:100,delay:2e3,useResize:!0,useParent:!1,usePolling:!1},!0),a.isHost){if(!a.local){for(var f,g=location.protocol+"//"+location.host,h=document.body.getElementsByTagName("img"),i=h.length;i--;)if(f=h[i],f.src.substring(0,g.length)===g){a.local=f.src;break}a.local||(a.local=window)}var j={xdm_c:a.channel,xdm_p:0};a.local===window?(a.usePolling=!0,a.useParent=!0,a.local=location.protocol+"//"+location.host+location.pathname+location.search,j.xdm_e=a.local,j.xdm_pa=1):j.xdm_e=m(a.local),a.container&&(a.useResize=!1,j.xdm_po=1),a.remote=n(a.remote,j)}else p(a,{channel:R.xdm_c,remote:R.xdm_e,useParent:!o(R.xdm_pa),usePolling:!o(R.xdm_po),useResize:a.useParent?!1:a.useResize});c=[new J.stack.HashTransport(a),new J.stack.ReliableBehavior({}),new J.stack.QueueBehavior({encode:!0,maxLength:4e3-a.remote.length}),new J.stack.VerifyBehavior({initiate:a.isHost})];break;case"1":c=[new J.stack.PostMessageTransport(a)];break;case"2":a.remoteHelper=m(a.remoteHelper),c=[new J.stack.NameTransport(a),new J.stack.QueueBehavior,new J.stack.VerifyBehavior({initiate:a.isHost})];break;case"3":c=[new J.stack.NixTransport(a)];break;case"4":c=[new J.stack.SameOriginTransport(a)];break;case"5":c=[new J.stack.FrameElementTransport(a)];break;case"6":x||e(),c=[new J.stack.FlashTransport(a)]}return c.push(new J.stack.QueueBehavior({lazy:a.lazy,remove:!0})),c}function u(a){for(var b,c={incoming:function(a,b){this.up.incoming(a,b)},outgoing:function(a,b){this.down.outgoing(a,b)},callback:function(a){this.up.callback(a)},init:function(){this.down.init()},destroy:function(){this.down.destroy()}},d=0,e=a.length;e>d;d++)b=a[d],p(b,c,!0),0!==d&&(b.down=a[d-1]),d!==e-1&&(b.up=a[d+1]);return b}function v(a){a.up.down=a.down,a.down.up=a.up,a.up=a.down=null}var w,x,y,z,A,B=a("json2"),C=this,D=Math.floor(1e4*Math.random()),E=Function.prototype,F=/^((http.?:)\/\/([^:\/\s]+)(:\d+)*)/,G=/[\-\w]+\/\.\.\//,H=/([^:])\/\//g,I="",J={},K=window.easyXDM,L="easyXDM_",M=!1;if(b(window,"addEventListener"))z=function(a,b,c){a.addEventListener(b,c,!1)},A=function(a,b,c){a.removeEventListener(b,c,!1)};else{if(!b(window,"attachEvent"))throw new Error("Browser not supported");z=function(a,b,c){a.attachEvent("on"+b,c)},A=function(a,b,c){a.detachEvent("on"+b,c)}}var N,O=!1,P=[];if("readyState"in document?(N=document.readyState,O="complete"==N||~navigator.userAgent.indexOf("AppleWebKit/")&&("loaded"==N||"interactive"==N)):O=!!document.body,!O){if(b(window,"addEventListener"))z(document,"DOMContentLoaded",f);else if(z(document,"readystatechange",function(){"complete"==document.readyState&&f()}),document.documentElement.doScroll&&window===top){var Q=function(){if(!O){try{document.documentElement.doScroll("left")}catch(a){return void setTimeout(Q,1)}f()}};Q()}z(window,"load",f)}var R=function(a){a=a.substring(1).split("&");for(var b,c={},d=a.length;d--;)b=a[d].split("="),c[b[0]]=decodeURIComponent(b[1]);return c}(/xdm_e=/.test(location.search)?location.search:location.hash),S=function(){var a={},b={a:[1,2,3]},c='{"a":[1,2,3]}';return"undefined"!=typeof B&&"function"==typeof B.stringify&&B.stringify(b).replace(/\s/g,"")===c?B:(Object.toJSON&&Object.toJSON(b).replace(/\s/g,"")===c&&(a.stringify=Object.toJSON),"function"==typeof String.prototype.evalJSON&&(b=c.evalJSON(),b.a&&3===b.a.length&&3===b.a[2]&&(a.parse=function(a){return a.evalJSON()})),a.stringify&&a.parse?(S=function(){return a},a):null)};return p(J,{version:"2.4.17.1",query:R,stack:{},apply:p,getJSONObject:S,whenReady:g,noConflict:i}),J.DomHelper={on:z,un:A,requiresJSON:function(a){c(window,"JSON")||document.write('<script type="text/javascript" src="'+a+'"></script>')}},function(){var a={};J.Fn={set:function(b,c){a[b]=c},get:function(b,c){var d=a[b];return c&&delete a[b],d}}}(),J.Socket=function(a){var b=u(t(a).concat([{incoming:function(b,c){a.onMessage(b,c)},callback:function(b){a.onReady&&a.onReady(b)}}])),c=l(a.remote);this.origin=l(a.remote),this.destroy=function(){b.destroy()},this.postMessage=function(a){b.outgoing(a,c)},b.init()},J.Rpc=function(a,b){if(b.local)for(var c in b.local)if(b.local.hasOwnProperty(c)){var d=b.local[c];"function"==typeof d&&(b.local[c]={method:d})}var e=u(t(a).concat([new J.stack.RpcBehavior(this,b),{callback:function(b){a.onReady&&a.onReady(b)}}]));this.origin=l(a.remote),this.destroy=function(){e.destroy()},e.init()},J.stack.SameOriginTransport=function(a){var b,c,d,e;return b={outgoing:function(a,b,c){d(a),c&&c()},destroy:function(){c&&(c.parentNode.removeChild(c),c=null)},onDOMReady:function(){e=l(a.remote),a.isHost?(p(a.props,{src:n(a.remote,{xdm_e:location.protocol+"//"+location.host+location.pathname,xdm_c:a.channel,xdm_p:4}),name:L+a.channel+"_provider"}),c=r(a),J.Fn.set(a.channel,function(a){return d=a,setTimeout(function(){b.up.callback(!0)},0),function(a){b.up.incoming(a,e)}})):(d=h().Fn.get(a.channel,!0)(function(a){b.up.incoming(a,e)}),setTimeout(function(){b.up.callback(!0)},0))},init:function(){g(b.onDOMReady,b)}}},J.stack.FlashTransport=function(a){function b(a){setTimeout(function(){d.up.incoming(a,f)},0)}function c(b){var c=a.swf+"?host="+a.isHost,d="easyXDM_swf_"+Math.floor(1e4*Math.random());J.Fn.set("flash_loaded"+b.replace(/[\-.]/g,"_"),function(){J.stack.FlashTransport[b].swf=h=i.firstChild;for(var a=J.stack.FlashTransport[b].queue,c=0;c<a.length;c++)a[c]();a.length=0}),a.swfContainer?i="string"==typeof a.swfContainer?document.getElementById(a.swfContainer):a.swfContainer:(i=document.createElement("div"),p(i.style,y&&a.swfNoThrottle?{height:"20px",width:"20px",position:"fixed",right:0,top:0}:{height:"1px",width:"1px",position:"absolute",overflow:"hidden",right:0,top:0}),document.body.appendChild(i));var e="callback=flash_loaded"+b.replace(/[\-.]/g,"_")+"&proto="+C.location.protocol+"&domain="+j(C.location.href)+"&port="+k(C.location.href)+"&ns="+I;i.innerHTML="<object height='20' width='20' type='application/x-shockwave-flash' id='"+d+"' data='"+c+"'><param name='allowScriptAccess' value='always'></param><param name='wmode' value='transparent'><param name='movie' value='"+c+"'></param><param name='flashvars' value='"+e+"'></param><embed type='application/x-shockwave-flash' FlashVars='"+e+"' allowScriptAccess='always' wmode='transparent' src='"+c+"' height='1' width='1'></embed></object>"}var d,e,f,h,i;return d={outgoing:function(b,c,d){h.postMessage(a.channel,b.toString()),d&&d()},destroy:function(){try{h.destroyChannel(a.channel)}catch(b){}h=null,e&&(e.parentNode.removeChild(e),e=null)},onDOMReady:function(){f=a.remote,J.Fn.set("flash_"+a.channel+"_init",function(){setTimeout(function(){d.up.callback(!0)})}),J.Fn.set("flash_"+a.channel+"_onMessage",b),a.swf=m(a.swf);var g=j(a.swf),i=function(){J.stack.FlashTransport[g].init=!0,h=J.stack.FlashTransport[g].swf,h.createChannel(a.channel,a.secret,l(a.remote),a.isHost),a.isHost&&(y&&a.swfNoThrottle&&p(a.props,{position:"fixed",right:0,top:0,height:"20px",width:"20px"}),p(a.props,{src:n(a.remote,{xdm_e:l(location.href),xdm_c:a.channel,xdm_p:6,xdm_s:a.secret}),name:L+a.channel+"_provider"}),e=r(a))};J.stack.FlashTransport[g]&&J.stack.FlashTransport[g].init?i():J.stack.FlashTransport[g]?J.stack.FlashTransport[g].queue.push(i):(J.stack.FlashTransport[g]={queue:[i]},c(g))},init:function(){g(d.onDOMReady,d)}}},J.stack.PostMessageTransport=function(a){function b(a){if(a.origin)return l(a.origin);if(a.uri)return l(a.uri);if(a.domain)return location.protocol+"//"+a.domain;throw"Unable to retrieve the origin of the event"}function c(c){var e=b(c);e==h&&c.data.substring(0,a.channel.length+1)==a.channel+" "&&d.up.incoming(c.data.substring(a.channel.length+1),e)}var d,e,f,h;return d={outgoing:function(b,c,d){f.postMessage(a.channel+" "+b,c||h),d&&d()},destroy:function(){A(window,"message",c),e&&(f=null,e.parentNode.removeChild(e),e=null)},onDOMReady:function(){if(h=l(a.remote),a.isHost){var b=function(g){g.data==a.channel+"-ready"&&(f="postMessage"in e.contentWindow?e.contentWindow:e.contentWindow.document,A(window,"message",b),z(window,"message",c),setTimeout(function(){d.up.callback(!0)},0))};z(window,"message",b),p(a.props,{src:n(a.remote,{xdm_e:l(location.href),xdm_c:a.channel,xdm_p:1}),name:L+a.channel+"_provider"}),e=r(a)}else z(window,"message",c),f="postMessage"in window.parent?window.parent:window.parent.document,f.postMessage(a.channel+"-ready",h),setTimeout(function(){d.up.callback(!0)},0)},init:function(){g(d.onDOMReady,d)}}},J.stack.FrameElementTransport=function(a){var b,c,d,e;return b={outgoing:function(a,b,c){d.call(this,a),c&&c()},destroy:function(){c&&(c.parentNode.removeChild(c),c=null)},onDOMReady:function(){e=l(a.remote),a.isHost?(p(a.props,{src:n(a.remote,{xdm_e:l(location.href),xdm_c:a.channel,xdm_p:5}),name:L+a.channel+"_provider"}),c=r(a),c.fn=function(a){return delete c.fn,d=a,setTimeout(function(){b.up.callback(!0)},0),function(a){b.up.incoming(a,e)}}):(document.referrer&&l(document.referrer)!=R.xdm_e&&(window.top.location=R.xdm_e),d=window.frameElement.fn(function(a){b.up.incoming(a,e)}),b.up.callback(!0))},init:function(){g(b.onDOMReady,b)}}},J.stack.NameTransport=function(a){function b(b){var c=a.remoteHelper+(h?"#_3":"#_2")+a.channel;i.contentWindow.sendMessage(b,c)}function c(){h?2!==++k&&h||f.up.callback(!0):(b("ready"),f.up.callback(!0))}function d(a){f.up.incoming(a,q)}function e(){o&&setTimeout(function(){o(!0)},0)}var f,h,i,j,k,o,q,s;return f={outgoing:function(a,c,d){o=d,b(a)},destroy:function(){i.parentNode.removeChild(i),i=null,h&&(j.parentNode.removeChild(j),j=null)},onDOMReady:function(){h=a.isHost,k=0,q=l(a.remote),a.local=m(a.local),h?(J.Fn.set(a.channel,function(b){h&&"ready"===b&&(J.Fn.set(a.channel,d),c())}),s=n(a.remote,{xdm_e:a.local,xdm_c:a.channel,xdm_p:2}),p(a.props,{src:s+"#"+a.channel,name:L+a.channel+"_provider"}),j=r(a)):(a.remoteHelper=a.remote,J.Fn.set(a.channel,d));var b=function(){var d=i||this;A(d,"load",b),J.Fn.set(a.channel+"_load",e),function f(){"function"==typeof d.contentWindow.sendMessage?c():setTimeout(f,50)}()};i=r({props:{src:a.local+"#_4"+a.channel},onLoad:b})},init:function(){g(f.onDOMReady,f)}}},J.stack.HashTransport=function(a){function b(b){if(o){var c=a.remote+"#"+m++ +"_"+b;(h||!q?o.contentWindow:o).location=c}}function c(a){k=a,f.up.incoming(k.substring(k.indexOf("_")+1),s)}function d(){if(n){var a=n.location.href,b="",d=a.indexOf("#");-1!=d&&(b=a.substring(d)),b&&b!=k&&c(b)}}function e(){i=setInterval(d,j)}var f,h,i,j,k,m,n,o,q,s;return f={outgoing:function(a){b(a)},destroy:function(){window.clearInterval(i),(h||!q)&&o.parentNode.removeChild(o),o=null},onDOMReady:function(){if(h=a.isHost,j=a.interval,k="#"+a.channel,m=0,q=a.useParent,s=l(a.remote),h){if(p(a.props,{src:a.remote,name:L+a.channel+"_provider"}),q)a.onLoad=function(){n=window,e(),f.up.callback(!0)};else{var b=0,c=a.delay/50;!function d(){if(++b>c)throw new Error("Unable to reference listenerwindow");try{n=o.contentWindow.frames[L+a.channel+"_consumer"]}catch(g){}n?(e(),f.up.callback(!0)):setTimeout(d,50)}()}o=r(a)}else n=window,e(),q?(o=parent,f.up.callback(!0)):(p(a,{props:{src:a.remote+"#"+a.channel+new Date,name:L+a.channel+"_consumer"},onLoad:function(){f.up.callback(!0)}}),o=r(a))},init:function(){g(f.onDOMReady,f)}}},J.stack.ReliableBehavior=function(){var a,b,c=0,d=0,e="";return a={incoming:function(f,g){var h=f.indexOf("_"),i=f.substring(0,h).split(",");f=f.substring(h+1),i[0]==c&&(e="",b&&(b(!0),b=null)),f.length>0&&(a.down.outgoing(i[1]+","+c+"_"+e,g),d!=i[1]&&(d=i[1],a.up.incoming(f,g)))},outgoing:function(f,g,h){e=f,b=h,a.down.outgoing(d+","+ ++c+"_"+f,g)}}},J.stack.QueueBehavior=function(a){function b(){if(a.remove&&0===e.length)return void v(c);if(!f&&0!==e.length&&!d){f=!0;var g=e.shift();c.down.outgoing(g.data,g.origin,function(a){f=!1,g.callback&&setTimeout(function(){g.callback(a)},0),b()})}}var c,d,e=[],f=!0,g="",h=0,i=!1,j=!1;return c={init:function(){o(a)&&(a={}),a.maxLength&&(h=a.maxLength,j=!0),a.lazy?i=!0:c.down.init()},callback:function(a){f=!1;var d=c.up;b(),d.callback(a)},incoming:function(b,d){if(j){var e=b.indexOf("_"),f=parseInt(b.substring(0,e),10);g+=b.substring(e+1),0===f&&(a.encode&&(g=decodeURIComponent(g)),c.up.incoming(g,d),g="")}else c.up.incoming(b,d)},outgoing:function(d,f,g){a.encode&&(d=encodeURIComponent(d));var k,l=[];if(j){for(;0!==d.length;)k=d.substring(0,h),d=d.substring(k.length),l.push(k);for(;k=l.shift();)e.push({data:l.length+"_"+k,origin:f,callback:0===l.length?g:null})}else e.push({data:d,origin:f,callback:g});i?c.down.init():b()},destroy:function(){d=!0,c.down.destroy()}}},J.stack.VerifyBehavior=function(a){function b(){d=Math.random().toString(16).substring(2),c.down.outgoing(d)}var c,d,e;return c={incoming:function(f,g){var h=f.indexOf("_");-1===h?f===d?c.up.callback(!0):e||(e=f,a.initiate||b(),c.down.outgoing(f)):f.substring(0,h)===e&&c.up.incoming(f.substring(h+1),g)},outgoing:function(a,b,e){c.down.outgoing(d+"_"+a,b,e)},callback:function(){a.initiate&&b()}}},J.stack.RpcBehavior=function(a,b){function c(a){a.jsonrpc="2.0",g.down.outgoing(h.stringify(a))}function e(a,b){var d=Array.prototype.slice;return function(){var e,f=arguments.length,g={method:b};f>0&&"function"==typeof arguments[f-1]?(f>1&&"function"==typeof arguments[f-2]?(e={success:arguments[f-2],error:arguments[f-1]},g.params=d.call(arguments,0,f-2)):(e={success:arguments[f-1]},g.params=d.call(arguments,0,f-1)),j[""+ ++i]=e,g.id=i):g.params=d.call(arguments,0),a.namedParams&&1===g.params.length&&(g.params=g.params[0]),c(g)}}function f(a,b,e,f){if(!e)return void(b&&c({id:b,error:{code:-32601,message:"Procedure not found."}}));var g,h;b?(g=function(a){g=E,c({id:b,result:a})},h=function(a,d){h=E;var e={id:b,error:{code:-32099,message:a}};d&&(e.error.data=d),c(e)}):g=h=E,d(f)||(f=[f]);try{var i=e.method.apply(e.scope,f.concat([g,h]));o(i)||g(i)}catch(j){h(j.message)}}var g,h=b.serializer||S(),i=0,j={};return g={incoming:function(a){var d=h.parse(a);if(d.method)b.handle?b.handle(d,c):f(d.method,d.id,b.local[d.method],d.params);else{var e=j[d.id];d.error?e.error&&e.error(d.error):e.success&&e.success(d.result),delete j[d.id]}},init:function(){if(b.remote)for(var c in b.remote)b.remote.hasOwnProperty(c)&&(a[c]=e(b.remote[c],c));g.down.init()},destroy:function(){for(var c in b.remote)b.remote.hasOwnProperty(c)&&a.hasOwnProperty(c)&&delete a[c];g.down.destroy()}}},window.easyXDM=J,J}),define("jquery.cors/jquery.cors",["require","underscore","jquery","json2","console-shim","jquery.cors/easyxdm/easyxdm"],function(a){var b=(a("underscore"),a("jquery")),c=(a("json2"),a("console-shim")),d=a("jquery.cors/easyxdm/easyxdm"),e="/static-optimized/js/lib/jquery.cors/0.1/",f=e+"/easyxdm/",g={},h={};return b.ajaxSetup({xhrFields:{withCredentials:!0}}),b.ajaxTransport("+*",function(a,d){if(a.crossDomain&&!b.support.cors){var e="",f=a.url.match(/^(https?:\/\/[^\/]*)\/?.*/);return f&&(e=f[1]),g.hasOwnProperty(e)||(c.log("creating easyXDM pool entry for "+e),g[e]={callbackQueue:[],connection:void 0,error:void 0,state:"before"}),c.log("jquery.cors easyXDM request for "+a.url+" using "+e),""===e?null:{send:function(b,f){h.getConnection(e,{success:function(b){function g(b){c.log("easyXDM connection for "+a.url+" via "+e+" continuation proxy excecuting"),f(b.status,b.statusText,b.responses,b.headers)}d.context=null,b.jquery_proxy(d,g),c.log("easyXDM connection for "+a.url+" via "+e+" initialized")},error:function(){c.log("easyXDM connection for "+e+" failed to initialize")}})},abort:function(){c.log("easyXDM connection for "+e+" aborted")}}}}),h.doRequests=function(a,b){var i=d.noConflict("jquery_easyXDM"+a),j=a+e+"jquery.easyxdm.provider.html";c.log("doRequests for "+a),h.easyXDM=i,g[a].connection=new h.easyXDM.Rpc({channel:a,remote:j,swf:a+f+"easyxdm.swf",onReady:function(){b.success(g[a].connection)}},{remote:{jquery_proxy:function(){c.log("jquery_proxy")}}})},h.getConnection=function(a,b){var d;switch(g[a].state){case"before":c.log("before: "+a),g[a].state="working",g[a].callbackQueue.push(b),h.doRequests(a,{success:function(b){for(c.log("doRequests.success for "+a),g[a].state="success",g[a].connection=b,d=0;d<g[a].callbackQueue.length;d++)g[a].callbackQueue[d].success(g[a].connection);g[a].callbackQueue=[]},failure:function(b){for(c.log("doRequests.failure for "+a),g[a].state="failure",g[a].error=b,d=0;d<g[a].callbackQueue.length;d++)g[a].callbackQueue[d].failure(b);g[a].callbackQueue=[]}});break;case"working":c.log("working: "+a),g[a].callbackQueue.push(b);break;case"success":c.log("success: "+a),b.success(g[a].connection);break;case"failure":c.log("failure: "+a),b.failure(g[a].error);break;default:throw c.log("invalid state: "+a),new Error("Invalid state: "+g[a].state)}},window.$=b,window.jquery_cors=h,h}),define("chiropractor/models/auth",["require","backbone","jquery","json-ie7","underscore","jquery.cookie"],function(a){var b,c,d,e,f,g,h=a("backbone"),i=a("jquery"),j=(a("json-ie7"),a("underscore")),k="wttoken",l=2,m=!1;return a("jquery.cookie"),c=function(){h.Events.trigger("authentication:expiration"),m=!0,b=setTimeout(function(){h.Events.trigger("authentication:failure")},60*l*1e3)},e=function(){return"undefined"==typeof d&&(d=i.cookie(k)),d},f=function(a){var e=a.split("::"),f=e[1],g=e[2],j=1e3*Math.max(0,g-f-60*l);d=a,i.cookie(k,a),b&&clearTimeout(b),m&&(h.Events.trigger("authentication:renewal"),m=!1),b=setTimeout(c,j)},g=function(){d=void 0,i.removeCookie(k),b&&clearTimeout(b)},h.Events.on("authentication:logout authentication:failure",g),{sync:function(a,b,c){var d=c.beforeSend,g=c.error,i=c.success,k=this,l=j(c).clone();c.success=function(a,b,c){var d=c.getResponseHeader("Authorization");return d&&f(d),i.apply(k,arguments)},c.error=function(c){return 400===c.status&&h.Events.trigger("authentication:failure",k,c),401===c.status&&(h.Events.trigger("authentication:failure",k,c),k.listenToOnce(h.Events,"authentication:success",function(){k.sync(a,b,l)})),g?g.apply(k,arguments):void 0},c.beforeSend=function(a){var b=e();return!k.disableAuthToken&&b&&a.setRequestHeader("Authorization",b),d?d.apply(this,arguments):void 0}},cleanup:g}}),define("underscore.mixin.deepextend",["require","underscore"],function(a){var b,c,d,e,f,g,h=a("underscore"),i=[].slice;d=function(a){var b,c;return!h.isObject(a)||h.isFunction(a)?a:a instanceof Backbone.Collection||a instanceof Backbone.Model?a:h.isDate(a)?new Date(a.getTime()):h.isRegExp(a)?new RegExp(a.source,a.toString().replace(/.*\//,"")):(c=h.isArray(a||h.isArguments(a)),b=function(a,b,e){return c?a.push(d(b)):a[e]=d(b),a
},h.reduce(a,b,c?[]:{}))},g=function(a){return null===a||void 0===a?!1:!(a.prototype!=={}.prototype&&a.prototype!==Object.prototype||!h.isObject(a)||h.isArray(a)||h.isFunction(a)||h.isDate(a)||h.isRegExp(a)||h.isArguments(a))},c=function(a){return h.filter(h.keys(a),function(b){return g(a[b])})},b=function(a){return h.filter(h.keys(a),function(b){return h.isArray(a[b])})},f=function(a,d,e){var g,i,j,k,l,m,n,o,p,q;if(null===e&&(e=20),0>=e)return console.warn("_.deepExtend(): Maximum depth of recursion hit."),h.extend(a,d);for(m=h.intersection(c(a),c(d)),i=function(b){return d[b]=f(a[b],d[b],e-1),d[b]},n=0,p=m.length;p>n;n+=1)l=m[n],i(l);for(k=h.intersection(b(a),b(d)),g=function(b){return d[b]=h.union(a[b],d[b]),d[b]},o=0,q=k.length;q>o;o+=1)j=k[o],g(j);return h.extend(a,d)},e=function(){var a,b,c,e;if(c=2<=arguments.length?i.call(arguments,0,e=arguments.length-1):(e=0,[]),b=arguments[e++],h.isNumber(b)||(c.push(b),b=20),c.length<=1)return c[0];if(0>=b)return h.extend.apply(this,c);for(a=c.shift();c.length>0;)a=f(a,d(c.shift()),b);return a},h.mixin({deepClone:d,isBasicObject:g,basicObjects:c,arrays:b,deepExtend:e})}),function(a){"function"==typeof define&&define.amd?define("backbone.deep.model",["underscore","backbone"],a):a(_,Backbone)}(function(a,b){function c(b){var d={},e=g.keyPathSeparator;for(var f in b){var h=b[f];if(h&&h.constructor===Object&&!a.isEmpty(h)){var i=c(h);for(var j in i){var k=i[j];d[f+e+j]=k}}else d[f]=h}return d}function d(b,c,d){for(var e=g.keyPathSeparator,f=c.split(e),h=b,i=0,j=f.length;j>i;i++){if(d&&!a.has(h,f[i]))return!1;if(h=h[f[i]],null==h&&j-1>i&&(h={}),"undefined"==typeof h)return d?!0:h}return d?!0:h}function e(b,c,d,e){e=e||{};for(var f=g.keyPathSeparator,h=c.split(f),i=b,j=0,k=h.length;k>j&&void 0!==i;j++){var l=h[j];j===k-1?e.unset?delete i[l]:i[l]=d:("undefined"!=typeof i[l]&&a.isObject(i[l])||(i[l]={}),i=i[l])}}function f(a,b){e(a,b,null,{unset:!0})}var g=b.Model.extend({constructor:function(b,c){var d,e=b||{};this.cid=a.uniqueId("c"),this.attributes={},c&&c.collection&&(this.collection=c.collection),c&&c.parse&&(e=this.parse(e,c)||{}),(d=a.result(this,"defaults"))&&(e=a.deepExtend({},d,e)),this.set(e,c),this.changed={},this.initialize.apply(this,arguments)},toJSON:function(){return a.clone(this.attributes,!0)},get:function(a){return d(this.attributes,a)},set:function(b,h,i){var j,k,l,m,n,o,p,q;if(null==b)return this;if("object"==typeof b?(k=b,i=h||{}):(k={})[b]=h,i||(i={}),!this._validate(k,i))return!1;l=i.unset,n=i.silent,m=[],o=this._changing,this._changing=!0,o||(this._previousAttributes=a.clone(this.attributes,!0),this.changed={}),q=this.attributes,p=this._previousAttributes,this.idAttribute in k&&(this.id=k[this.idAttribute]),k=c(k);for(j in k)h=k[j],a.isEqual(d(q,j),h)||m.push(j),a.isEqual(d(p,j),h)?f(this.changed,j):e(this.changed,j,h),l?f(q,j):e(q,j,h);if(!n){m.length&&(this._pending=!0);for(var r=g.keyPathSeparator,s={},t=0,u=m.length;u>t;t++){var b=m[t];s.hasOwnProperty(b)&&s[b]||(s[b]=!0,this.trigger("change:"+b,this,d(q,b),i));for(var v=b.split(r),w=v.length-1;w>0;w--){var x=a.first(v,w).join(r),y=x+r+"*";s.hasOwnProperty(y)&&s[y]||(s[y]=!0,this.trigger("change:"+y,this,d(q,x),i)),s.hasOwnProperty(x)&&s[x]||(s[x]=!0,this.trigger("change:"+x,this,d(q,x),i))}}}if(o)return this;if(!n)for(;this._pending;)this._pending=!1,this.trigger("change",this,i);return this._pending=!1,this._changing=!1,this},clear:function(b){var d={},e=c(this.attributes);for(var f in e)d[f]=void 0;return this.set(d,a.extend({},b,{unset:!0}))},hasChanged:function(b){return null==b?!a.isEmpty(this.changed):void 0!==d(this.changed,b)},changedAttributes:function(b){if(!b)return this.hasChanged()?c(this.changed):!1;var d=this._changing?this._previousAttributes:this.attributes;b=c(b),d=c(d);var e,f=!1;for(var g in b)a.isEqual(d[g],e=b[g])||((f||(f={}))[g]=e);return f},previous:function(a){return null!=a&&this._previousAttributes?d(this._previousAttributes,a):null},previousAttributes:function(){return a.clone(this._previousAttributes,!0)}});return g.keyPathSeparator=".",b.DeepModel=g,"undefined"!=typeof module&&(module.exports=g),b}),function(a){"object"==typeof exports?module.exports=a(require("backbone"),require("underscore")):"function"==typeof define&&define.amd&&define("backbone.validation",["backbone","underscore"],a)}(function(a,b){return a.Validation=function(b){var c={forceUpdate:!1,selector:"name",labelFormatter:"sentenceCase",valid:Function.prototype,invalid:Function.prototype},d={formatLabel:function(a,b){return j[c.labelFormatter](a,b)},format:function(){var a=Array.prototype.slice.call(arguments),b=a.shift();return b.replace(/\{(\d+)\}/g,function(b,c){return"undefined"!=typeof a[c]?a[c]:b})}},e=function(c,d,f){return d=d||{},f=f||"",b.each(c,function(b,g){c.hasOwnProperty(g)&&(b&&"object"==typeof b&&!(b instanceof Array||b instanceof Date||b instanceof RegExp||b instanceof a.Model||b instanceof a.Collection)?e(b,d,f+g+"."):d[f+g]=b)}),d},f=function(){var a=function(a){return b.reduce(b.keys(b.result(a,"validation")||{}),function(a,b){return a[b]=void 0,a},{})},f=function(a,c){var d=a.validation?b.result(a,"validation")[c]||{}:{};return(b.isFunction(d)||b.isString(d))&&(d={fn:d}),b.isArray(d)||(d=[d]),b.reduce(d,function(a,c){return b.each(b.without(b.keys(c),"msg"),function(b){a.push({fn:k[b],val:c[b],msg:c.msg})}),a},[])},h=function(a,c,e,g){return b.reduce(f(a,c),function(f,h){var i=b.extend({},d,k),j=h.fn.call(i,e,c,h.val,a,g);return j===!1||f===!1?!1:j&&!f?b.result(h,"msg")||j:f},"")},i=function(a,c){var d,f={},g=!0,i=b.clone(c),j=e(c);return b.each(j,function(b,c){d=h(a,c,b,i),d&&(f[c]=d,g=!1)}),{invalidAttrs:f,isValid:g}},j=function(c,d){return{preValidate:function(a,c){var d,e=this,f={};return b.isObject(a)?(b.each(a,function(a,b){d=e.preValidate(b,a),d&&(f[b]=d)}),b.isEmpty(f)?void 0:f):h(this,a,c,b.extend({},this.attributes))},isValid:function(a){var c=e(this.attributes);return b.isString(a)?!h(this,a,c[a],b.extend({},this.attributes)):b.isArray(a)?b.reduce(a,function(a,d){return a&&!h(this,d,c[d],b.extend({},this.attributes))},!0,this):(a===!0&&this.validate(),this.validation?this._isValid:!0)},validate:function(f,g){var h=this,j=!f,k=b.extend({},d,g),l=a(h),m=b.extend({},l,h.attributes,f),n=e(f||m),o=i(h,m);return h._isValid=o.isValid,b.each(l,function(a,b){var d=o.invalidAttrs.hasOwnProperty(b);d||k.valid(c,b,k.selector)}),b.each(l,function(a,b){var d=o.invalidAttrs.hasOwnProperty(b),e=n.hasOwnProperty(b);d&&(e||j)&&k.invalid(c,b,o.invalidAttrs[b],k.selector)}),b.defer(function(){h.trigger("validated",h._isValid,h,o.invalidAttrs),h.trigger("validated:"+(h._isValid?"valid":"invalid"),h,o.invalidAttrs)}),!k.forceUpdate&&b.intersection(b.keys(o.invalidAttrs),b.keys(n)).length>0?o.invalidAttrs:void 0}}},l=function(a,c,d){b.extend(c,j(a,d))},m=function(a){delete a.validate,delete a.preValidate,delete a.isValid},n=function(a){l(this.view,a,this.options)},o=function(a){m(a)};return{version:"0.8.2",configure:function(a){b.extend(c,a)},bind:function(a,d){d=b.extend({},c,g,d);var e=d.model||a.model,f=d.collection||a.collection;if("undefined"==typeof e&&"undefined"==typeof f)throw"Before you execute the binding your view must have a model or a collection.\nSee http://thedersen.com/projects/backbone-validation/#using-form-model-validation for more information.";e?l(a,e,d):f&&(f.each(function(b){l(a,b,d)}),f.bind("add",n,{view:a,options:d}),f.bind("remove",o))},unbind:function(a,c){c=b.extend({},c);var d=c.model||a.model,e=c.collection||a.collection;d&&m(d),e&&(e.each(function(a){m(a)}),e.unbind("add",n),e.unbind("remove",o))},mixin:j(null,c)}}(),g=f.callbacks={valid:function(a,b,c){a.$("["+c+'~="'+b+'"]').removeClass("invalid").removeAttr("data-error")},invalid:function(a,b,c,d){a.$("["+d+'~="'+b+'"]').addClass("invalid").attr("data-error",c)}},h=f.patterns={digits:/^\d+$/,number:/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/,email:/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,url:/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i},i=f.messages={required:"{0} is required",acceptance:"{0} must be accepted",min:"{0} must be greater than or equal to {1}",max:"{0} must be less than or equal to {1}",range:"{0} must be between {1} and {2}",length:"{0} must be {1} characters",minLength:"{0} must be at least {1} characters",maxLength:"{0} must be at most {1} characters",rangeLength:"{0} must be between {1} and {2} characters",oneOf:"{0} must be one of: {1}",equalTo:"{0} must be the same as {1}",pattern:"{0} must be a valid {1}"},j=f.labelFormatters={none:function(a){return a},sentenceCase:function(a){return a.replace(/(?:^\w|[A-Z]|\b\w)/g,function(a,b){return 0===b?a.toUpperCase():" "+a.toLowerCase()}).replace(/_/g," ")},label:function(a,b){return b.labels&&b.labels[a]||j.sentenceCase(a,b)}},k=f.validators=function(){var a=String.prototype.trim?function(a){return null===a?"":String.prototype.trim.call(a)}:function(a){var b=/^\s+/,c=/\s+$/;return null===a?"":a.toString().replace(b,"").replace(c,"")},c=function(a){return b.isNumber(a)||b.isString(a)&&a.match(h.number)},d=function(c){return!(b.isNull(c)||b.isUndefined(c)||b.isString(c)&&""===a(c)||b.isArray(c)&&b.isEmpty(c))};return{fn:function(a,c,d,e,f){return b.isString(d)&&(d=e[d]),d.call(e,a,c,f)},required:function(a,c,e,f,g){var h=b.isFunction(e)?e.call(f,a,c,g):e;return h||d(a)?h&&!d(a)?this.format(i.required,this.formatLabel(c,f)):void 0:!1},acceptance:function(a,c,d,e){return"true"===a||b.isBoolean(a)&&a!==!1?void 0:this.format(i.acceptance,this.formatLabel(c,e))},min:function(a,b,d,e){return!c(a)||d>a?this.format(i.min,this.formatLabel(b,e),d):void 0},max:function(a,b,d,e){return!c(a)||a>d?this.format(i.max,this.formatLabel(b,e),d):void 0},range:function(a,b,d,e){return!c(a)||a<d[0]||a>d[1]?this.format(i.range,this.formatLabel(b,e),d[0],d[1]):void 0},length:function(b,c,e,f){return d(b)&&a(b).length===e?void 0:this.format(i.length,this.formatLabel(c,f),e)},minLength:function(b,c,e,f){return!d(b)||a(b).length<e?this.format(i.minLength,this.formatLabel(c,f),e):void 0},maxLength:function(b,c,e,f){return!d(b)||a(b).length>e?this.format(i.maxLength,this.formatLabel(c,f),e):void 0},rangeLength:function(b,c,e,f){return!d(b)||a(b).length<e[0]||a(b).length>e[1]?this.format(i.rangeLength,this.formatLabel(c,f),e[0],e[1]):void 0},oneOf:function(a,c,d,e){return b.include(d,a)?void 0:this.format(i.oneOf,this.formatLabel(c,e),d.join(", "))},equalTo:function(a,b,c,d,e){return a!==e[c]?this.format(i.equalTo,this.formatLabel(b,d),this.formatLabel(c,d)):void 0},pattern:function(a,b,c,e){return d(a)&&a.toString().match(h[c]||c)?void 0:this.format(i.pattern,this.formatLabel(b,e),c)}}}();return f}(b),a.Validation}),define("hbs!chiropractor/views/templates/error/modelfetch",["hbs","handlebars"],function(a,b){var c=b.template(function(a,b,c){c=c||a.helpers;var d,e,f,g=c.helperMissing,h=this.escapeExpression;return d={},e=b.response,d.response=e,e=b.url,d.url=e,f=c.row,d=f?f.call(b,"error",b,{hash:d}):g.call(b,"row","error",b,{hash:d}),h(d)});return b.registerPartial("chiropractor_views_templates_error_modelfetch",c),c}),define("chiropractor/models",["require","jquery.cors/jquery.cors","backbone","underscore","json-ie7","jquery","./models/auth","backbone.deep.model","backbone.validation","hbs!./views/templates/error/modelfetch","underscore.mixin.deepextend"],function(a){a("jquery.cors/jquery.cors");var b,c,d=a("backbone"),e=a("underscore"),f=(a("json-ie7"),a("jquery")),g=a("./models/auth"),h=a("backbone.deep.model"),i=a("backbone.validation"),j=a("hbs!./views/templates/error/modelfetch");return c=window&&window.Wiser&&window.Wiser.ASSETS_BASE_URL?window.Wiser.ASSETS_BASE_URL:"",a("underscore.mixin.deepextend"),b=h.DeepModel.extend({errorHandler:function(a){var b;switch(a.status){case 0:b="The API was unreachable";break;case 503:b="There was an Error Communicating with the API"}f("body").before(j({url:this.url,errorMessage:b,response:a}))},successHandler:function(){},sync:function(a,b,c){switch(g.sync.call(this,a,b,c),a){case"read":f("#chiropractor-error-box").empty(),this.enableErrorHandler&&(c.error=this.errorHandler,c.timeout=3e4);break;case"update":b.unset("Wiser")}return d.Model.prototype.sync.call(this,a,b,c)},parse:function(a,b){return b=b||{},a.data&&a.meta?parseInt(a.meta.status,10)>=400?(b.legacyError=!0,a.meta.errors&&a.meta.errors.form?(this.validationError=a.meta.errors.form,this.trigger("invalid",this,this.validationError,e.extend(b||{},{validationError:this.validationError}))):(this.trigger("error",this,a.data,b),b.error&&b.error(this,a.data,b)),{}):(a.Wiser={},a.Wiser.ASSETS_BASE_URL=c,a.data):(a.Wiser={},a.Wiser.ASSETS_BASE_URL=c,d.Model.prototype.parse.apply(this,arguments))},fieldId:function(a,b){return b=b||"formfield",[b,a,this.cid].join("-")},set:function(a,b){return b&&b.legacyError?(delete b.legacyError,!1):h.DeepModel.prototype.set.apply(this,arguments)}}),e.extend(b.prototype,i.mixin),{Base:b,cleanup:g.cleanup}}),define("chiropractor/collections",["require","jquery.cors/jquery.cors","backbone","underscore","jquery","hbs!./views/templates/error/modelfetch","underscore.mixin.deepextend"],function(a){a("jquery.cors/jquery.cors");var b,c,d=a("backbone"),e=(a("underscore"),a("jquery")),f=a("hbs!./views/templates/error/modelfetch");return c=window&&window.Wiser&&window.Wiser.ASSETS_BASE_URL?window.Wiser.ASSETS_BASE_URL:"",a("underscore.mixin.deepextend"),b=d.Collection.extend({errorHandler:function(a){var b;switch(a.status){case 0:b="The API was unreachable";break;case 503:b="There was an Error Communicating with the API"}e("body").before(f({url:this.url,errorMessage:b,response:a}))},sync:function(a,b,c){switch(a){case"read":e("#chiropractor-error-box").empty(),this.enableErrorHandler&&(c.error=this.errorHandler,c.timeout=3e4);break;case"update":b.unset("Wiser")}return d.Collection.prototype.sync.call(this,a,b,c)},parse:function(a){return a.Wiser={},a.Wiser.ASSETS_BASE_URL=c,d.Collection.prototype.parse.apply(this,arguments)}}),{Base:b}}),define("chiropractor/routers",["require","backbone"],function(a){var b,c=a("backbone");return b=c.Router.extend({}),{Base:b}}),function(a){define("chiropractor/browser",["require"],function(){var b=function(){var b=-1;if("Microsoft Internet Explorer"===a.navigator.appName){var c=a.navigator.userAgent,d=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");null!==d.exec(c)&&(b=parseFloat(RegExp.$1))}return b}();return{isOldIE:-1!==b&&9>b,window:a,navigator:a.navigator,document:a.document}})}(this),define("chiropractor/debug",["require","exports","module","chiropractor/browser"],function(a,b,c){var d=a("chiropractor/browser").window,e=d.console;a.specified("console")&&a(["console"],function(a){e=a}),c.config().enabled&&(d.onerror=function(a,b,c){alert("JavaScript error: "+a+" on line "+c+" for "+b)})}),define("chiropractor/hbs/ifequal",["require","handlebars"],function(a){var b=a("handlebars");b.registerHelper("ifequal",function(a,b,c){return a===b?c.fn(this):c.inverse(this)})}),define("chiropractor/hbs/log",["require","handlebars","json-ie7"],function(a){function b(a){console.log(d.stringify(a))}var c=a("handlebars"),d=a("json-ie7");return c.registerHelper("log",b),b}),define("chiropractor/hbs",["require","./hbs/view","./hbs/ifequal","./hbs/log"],function(a){a("./hbs/view"),a("./hbs/ifequal"),a("./hbs/log")}),define("chiropractor/main",["require","backbone","underscore","backbone.subroute","./views","./models","./collections","./routers","./debug","./hbs"],function(a){var b,c,d=a("backbone"),e=a("underscore"),f=a("backbone.subroute"),g=a("./views"),h=a("./models"),i=a("./collections"),j=a("./routers"),k={};return a("./debug"),a("./hbs"),b=function(a,b){k[a]||(k[a]=[]),k[a].push(b)},c=function(a,b){if(k[a]){var c=k[a];e.each(c,function(c){c.trigger(a,b)})}},{Subscribe:b,Publish:c,Channels:k,Collection:i.Base,Collections:i,Events:d.Events,history:d.history,Model:h.Base,Models:h,Router:j.Base,SubRoute:f,View:g.Base,Views:g}}),define("chiropractor",["chiropractor/main"],function(a){return a})}();
//# sourceMappingURL=chiropractor.min.map