fission
Version:
The Reactjs Toolkit
2 lines • 311 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;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.fission=e()}}(function(){var e;return function t(e,n,r){function o(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return o(n?n:t)},c,c.exports,t,e,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(e,t){(function(){"use strict";var n=function(){function t(e){this.opts=e}return t.prototype.router=e("./router"),t.prototype.model=e("./model"),t.prototype.view=e("./view"),t.prototype.modelView=e("./modelView"),t.prototype.collectionView=e("./collectionView"),t.prototype.createCollection=e("./createCollection"),t.prototype.getSync=e("./getSync"),t.prototype.alias=e("./alias"),t.prototype.middleware={auth:e("./middleware/auth"),clearFB:e("./middleware/clearFB"),log:e("./middleware/log")},t.prototype.mixins={Listener:e("./ListenerMixin")},t.prototype.React=e("react"),t}();t.exports=n}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/index.js","/lib")},{"./ListenerMixin":2,"./alias":3,"./collectionView":4,"./createCollection":5,"./getSync":6,"./middleware/auth":7,"./middleware/clearFB":8,"./middleware/log":9,"./model":10,"./modelView":11,"./router":12,"./view":13,_process:45,buffer:42,react:183}],2:[function(e,t){(function(){"use strict";t.exports={listenTo:function(e,t,n){return e.on(t,n),this},removeListener:function(e,t,n){return null!=e.off?e.off(t,n):e.removeListener&&e.removeListener(t,n),this},componentWillMount:function(){this.listeners=[]},componentWillUnmount:function(){var e,t,n,r;for(r=this.listeners,t=0,n=r.length;n>t;t++)e=r[t],this.removeListener(e.ee,e.event,e.listener)}}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/ListenerMixin.js","/lib")},{_process:45,buffer:42}],3:[function(e,t){(function(){"use strict";t.exports=function(e){var t={init:"getInitialState",mounting:"componentWillMount",mounted:"componentDidMount",unmounting:"componentWillUnmount"};for(var n in t){var r=t[n];null!=e[n]&&null==e[r]&&(e[r]=e[n])}return null==e.mixins&&(e.mixins=[]),e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/alias.js","/lib")},{_process:45,buffer:42}],4:[function(e,t){(function(){"use strict";var n=e("./ListenerMixin");t.exports=function(e){var t,r,o;if(o=this.getSync(e.model),r=this.createCollection(e.model),t={mixins:[n],renderItems:function(){return null!=this.itemView&&(this.items=this.collection.map(function(e){return function(t){return e.itemView({model:t,key:t.cid})}}(this))),this.forceUpdate()},componentWillMount:function(){return null==this.items&&(this.items=[]),null==this.collection?(this.collection=new r,this.collection.sync=o,this.collection.fetch({success:function(e){return function(){return e.renderItems()}}(this),error:function(e){return console.log("fetch error ",e)}},this.listenTo(this.collection,"add change remove",function(e){return function(){return e.renderItems()}}(this)))):this.renderItems()}},null==this.collection&&null==this.model)throw new Error("Requires either collection or model attribute");return null==e.mixins&&(e.mixins=[]),e.mixins.push(t),this.view(e)}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/collectionView.js","/lib")},{"./ListenerMixin":2,_process:45,buffer:42}],5:[function(e,t){(function(){"use strict";var n=e("ampersand-collection"),r=e("ampersand-collection-underscore-mixin"),o=e("ampersand-sync-adapter");t.exports=function(e){var t;if(e.isCollection)t=n.extend(e);else{var i=new e,s={model:e,url:i.url()};t=n.extend(r,o,s)}return t}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/createCollection.js","/lib")},{_process:45,"ampersand-collection":17,"ampersand-collection-underscore-mixin":15,"ampersand-sync-adapter":27,buffer:42}],6:[function(e,t){(function(){"use strict";t.exports=function(t){var n,r;if(t.sync)n=t.sync;else if(null!=(null!=(r=this.opts)?r.sync:void 0)){if("function"==typeof this.opts.sync)n=this.opts.sync;else if("object"==typeof this.opts.sync){if(null==this.opts.sync.plugin)throw new Error("Invalid sync adapter");n=this.opts.sync.plugin}}else n=e("ampersand-sync");return n}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/getSync.js","/lib")},{_process:45,"ampersand-sync":28,buffer:42}],7:[function(e,t){(function(){"use strict";t.exports=function(e){return function(t,n){return null!=e?n():"/login"===window.location.pathname?n():(window.location="/login",n())}}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/middleware/auth.js","/lib/middleware")},{_process:45,buffer:42}],8:[function(e,t){(function(){"use strict";t.exports=function(e,t){var n;return window.location.hash&&"#_=_"===window.location.hash&&(window.history&&window.history.replaceState?window.history.replaceState(null,null,window.location.href.split("#")[0]):(n={top:document.body.scrollTop,left:document.body.scrollLeft},window.location.hash="",document.body.scrollTop=n.top,document.body.scrollLeft=n.left)),t()}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/middleware/clearFB.js","/lib/middleware")},{_process:45,buffer:42}],9:[function(e,t){(function(){"use strict";t.exports=function(e,t){return console.log("Routing called",e),t()}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/middleware/log.js","/lib/middleware")},{_process:45,buffer:42}],10:[function(e,t){(function(){"use strict";var n=e("ampersand-model");t.exports=function(e){null==e.url&&(e.url="/"),e.urlRoot=e.url,delete e.url,e.sync=this.getSync(e);var t=n.extend(e);return t}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/model.js","/lib")},{_process:45,"ampersand-model":20,buffer:42}],11:[function(e,t){(function(){"use strict";var n=e("./ListenerMixin");t.exports=function(e){var t={mixins:[n],componentWillMount:function(){var t;return null!=this.props.model?(this.model=this.props.model,this.model):null!=(null!=(t=this.props.params)?t.id:void 0)?(this.model=new e.model,this.model.id=this.props.params.id,this.listenTo(this.model,"change",function(e){return function(){return e.forceUpdate()}}(this)),this.model.fetch()):void 0}};if(null==e.model)throw new Error("Missing model attribute");return null==e.mixins&&(e.mixins=[]),e.mixins.push(t),this.view(e)}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/modelView.js","/lib")},{"./ListenerMixin":2,_process:45,buffer:42}],12:[function(e,t){(function(){"use strict";var n=e("page"),r=e("react"),o={},i=[].slice,s=function(e,t){return null==e&&(e={}),"function"==typeof e.view?(e.view=e.view(e.args),s(e,t)):(r.renderComponent(e.view,e.el),t())};o.createRouteHandler=function(t){return"string"==typeof t?function(n,r){return e([t],function(e){return e(n,r)})}:o.createRenderHandler(t)},o.createRenderHandler=function(e){null==e&&(e={}),null==e["continue"]&&(e["continue"]=!0),"string"==typeof e.el&&(e.el=document.getElementById(e.el));var t=function(t,n){var r;return r={el:e.el,view:e.view,args:t},s(r,function(){return null!=e.title&&(document.title=e.title),e["continue"]?n():void 0})};return t},o.route=function(){var e=arguments[0],t=2<=arguments.length?i.call(arguments,1):[];return t=t.map(o.createRouteHandler),n.apply(null,[e].concat(i.call(t))),o},o.router=n,o.use=o.route.bind(null,"*"),o.start=n.start,t.exports=o}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/router.js","/lib")},{_process:45,buffer:42,page:48,react:183}],13:[function(e,t){(function(){"use strict";var n=e("react");t.exports=function(e){return n.createClass(this.alias(e))}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/lib/view.js","/lib")},{_process:45,buffer:42,react:183}],14:[function(e,t){(function(){var n=e("extend-object"),r=function(e){var t,r=this,o=[].slice.call(arguments);t=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return r.apply(this,arguments)},n(t,r);var i=function(){this.constructor=t};return i.prototype=r.prototype,t.prototype=new i,e&&(o.unshift(t.prototype),n.apply(null,o)),t.__super__=r.prototype,t};t.exports=r}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-class-extend/ampersand-class-extend.js","/node_modules/ampersand-class-extend")},{_process:45,buffer:42,"extend-object":46}],15:[function(e,t){(function(){var n=e("underscore"),r=[].slice,o={},i=["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","sample","partition"];n.each(i,function(e){n[e]&&(o[e]=function(){var t=r.call(arguments);return t.unshift(this.models),n[e].apply(n,t)})});var s=["groupBy","countBy","sortBy","indexBy"];n.each(s,function(e){n[e]&&(o[e]=function(t,r){var o=n.isFunction(t)?t:function(e){return e.get?e.get(t):e[t]};return n[e](this.models,o,r)})}),o.where=function(e,t){return n.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){var n;for(var r in e)if(n=t.get?t.get(r):t[r],e[r]!==n)return!1;return!0})},o.findWhere=function(e){return this.where(e,!0)},o.pluck=function(e){return n.invoke(this.models,"get",e)},t.exports=o}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-collection-underscore-mixin/ampersand-collection-underscore-mixin.js","/node_modules/ampersand-collection-underscore-mixin")},{_process:45,buffer:42,underscore:16}],16:[function(t,n,r){(function(){(function(){var t=this,o=t._,i=Array.prototype,s=Object.prototype,a=Function.prototype,u=i.push,l=i.slice,c=i.concat,f=s.toString,d=s.hasOwnProperty,p=Array.isArray,h=Object.keys,m=a.bind,g=function(e){return e instanceof g?e:this instanceof g?(this._wrapped=e,void 0):new g(e)};"undefined"!=typeof r?("undefined"!=typeof n&&n.exports&&(r=n.exports=g),r._=g):t._=g,g.VERSION="1.7.0";var y=function(e,t,n){if(void 0===t)return e;switch(null==n?3:n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)};case 4:return function(n,r,o,i){return e.call(t,n,r,o,i)}}return function(){return e.apply(t,arguments)}};g.iteratee=function(e,t,n){return null==e?g.identity:g.isFunction(e)?y(e,t,n):g.isObject(e)?g.matches(e):g.property(e)},g.each=g.forEach=function(e,t,n){if(null==e)return e;t=y(t,n);var r,o=e.length;if(o===+o)for(r=0;o>r;r++)t(e[r],r,e);else{var i=g.keys(e);for(r=0,o=i.length;o>r;r++)t(e[i[r]],i[r],e)}return e},g.map=g.collect=function(e,t,n){if(null==e)return[];t=g.iteratee(t,n);for(var r,o=e.length!==+e.length&&g.keys(e),i=(o||e).length,s=Array(i),a=0;i>a;a++)r=o?o[a]:a,s[a]=t(e[r],r,e);return s};var v="Reduce of empty array with no initial value";g.reduce=g.foldl=g.inject=function(e,t,n,r){null==e&&(e=[]),t=y(t,r,4);var o,i=e.length!==+e.length&&g.keys(e),s=(i||e).length,a=0;if(arguments.length<3){if(!s)throw new TypeError(v);n=e[i?i[a++]:a++]}for(;s>a;a++)o=i?i[a]:a,n=t(n,e[o],o,e);return n},g.reduceRight=g.foldr=function(e,t,n,r){null==e&&(e=[]),t=y(t,r,4);var o,i=e.length!==+e.length&&g.keys(e),s=(i||e).length;if(arguments.length<3){if(!s)throw new TypeError(v);n=e[i?i[--s]:--s]}for(;s--;)o=i?i[s]:s,n=t(n,e[o],o,e);return n},g.find=g.detect=function(e,t,n){var r;return t=g.iteratee(t,n),g.some(e,function(e,n,o){return t(e,n,o)?(r=e,!0):void 0}),r},g.filter=g.select=function(e,t,n){var r=[];return null==e?r:(t=g.iteratee(t,n),g.each(e,function(e,n,o){t(e,n,o)&&r.push(e)}),r)},g.reject=function(e,t,n){return g.filter(e,g.negate(g.iteratee(t)),n)},g.every=g.all=function(e,t,n){if(null==e)return!0;t=g.iteratee(t,n);var r,o,i=e.length!==+e.length&&g.keys(e),s=(i||e).length;for(r=0;s>r;r++)if(o=i?i[r]:r,!t(e[o],o,e))return!1;return!0},g.some=g.any=function(e,t,n){if(null==e)return!1;t=g.iteratee(t,n);var r,o,i=e.length!==+e.length&&g.keys(e),s=(i||e).length;for(r=0;s>r;r++)if(o=i?i[r]:r,t(e[o],o,e))return!0;return!1},g.contains=g.include=function(e,t){return null==e?!1:(e.length!==+e.length&&(e=g.values(e)),g.indexOf(e,t)>=0)},g.invoke=function(e,t){var n=l.call(arguments,2),r=g.isFunction(t);return g.map(e,function(e){return(r?t:e[t]).apply(e,n)})},g.pluck=function(e,t){return g.map(e,g.property(t))},g.where=function(e,t){return g.filter(e,g.matches(t))},g.findWhere=function(e,t){return g.find(e,g.matches(t))},g.max=function(e,t,n){var r,o,i=-1/0,s=-1/0;if(null==t&&null!=e){e=e.length===+e.length?e:g.values(e);for(var a=0,u=e.length;u>a;a++)r=e[a],r>i&&(i=r)}else t=g.iteratee(t,n),g.each(e,function(e,n,r){o=t(e,n,r),(o>s||o===-1/0&&i===-1/0)&&(i=e,s=o)});return i},g.min=function(e,t,n){var r,o,i=1/0,s=1/0;if(null==t&&null!=e){e=e.length===+e.length?e:g.values(e);for(var a=0,u=e.length;u>a;a++)r=e[a],i>r&&(i=r)}else t=g.iteratee(t,n),g.each(e,function(e,n,r){o=t(e,n,r),(s>o||1/0===o&&1/0===i)&&(i=e,s=o)});return i},g.shuffle=function(e){for(var t,n=e&&e.length===+e.length?e:g.values(e),r=n.length,o=Array(r),i=0;r>i;i++)t=g.random(0,i),t!==i&&(o[i]=o[t]),o[t]=n[i];return o},g.sample=function(e,t,n){return null==t||n?(e.length!==+e.length&&(e=g.values(e)),e[g.random(e.length-1)]):g.shuffle(e).slice(0,Math.max(0,t))},g.sortBy=function(e,t,n){return t=g.iteratee(t,n),g.pluck(g.map(e,function(e,n,r){return{value:e,index:n,criteria:t(e,n,r)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||void 0===n)return 1;if(r>n||void 0===r)return-1}return e.index-t.index}),"value")};var b=function(e){return function(t,n,r){var o={};return n=g.iteratee(n,r),g.each(t,function(r,i){var s=n(r,i,t);e(o,r,s)}),o}};g.groupBy=b(function(e,t,n){g.has(e,n)?e[n].push(t):e[n]=[t]}),g.indexBy=b(function(e,t,n){e[n]=t}),g.countBy=b(function(e,t,n){g.has(e,n)?e[n]++:e[n]=1}),g.sortedIndex=function(e,t,n,r){n=g.iteratee(n,r,1);for(var o=n(t),i=0,s=e.length;s>i;){var a=i+s>>>1;n(e[a])<o?i=a+1:s=a}return i},g.toArray=function(e){return e?g.isArray(e)?l.call(e):e.length===+e.length?g.map(e,g.identity):g.values(e):[]},g.size=function(e){return null==e?0:e.length===+e.length?e.length:g.keys(e).length},g.partition=function(e,t,n){t=g.iteratee(t,n);var r=[],o=[];return g.each(e,function(e,n,i){(t(e,n,i)?r:o).push(e)}),[r,o]},g.first=g.head=g.take=function(e,t,n){return null==e?void 0:null==t||n?e[0]:0>t?[]:l.call(e,0,t)},g.initial=function(e,t,n){return l.call(e,0,Math.max(0,e.length-(null==t||n?1:t)))},g.last=function(e,t,n){return null==e?void 0:null==t||n?e[e.length-1]:l.call(e,Math.max(e.length-t,0))},g.rest=g.tail=g.drop=function(e,t,n){return l.call(e,null==t||n?1:t)},g.compact=function(e){return g.filter(e,g.identity)};var _=function(e,t,n,r){if(t&&g.every(e,g.isArray))return c.apply(r,e);for(var o=0,i=e.length;i>o;o++){var s=e[o];g.isArray(s)||g.isArguments(s)?t?u.apply(r,s):_(s,t,n,r):n||r.push(s)}return r};g.flatten=function(e,t){return _(e,t,!1,[])},g.without=function(e){return g.difference(e,l.call(arguments,1))},g.uniq=g.unique=function(e,t,n,r){if(null==e)return[];g.isBoolean(t)||(r=n,n=t,t=!1),null!=n&&(n=g.iteratee(n,r));for(var o=[],i=[],s=0,a=e.length;a>s;s++){var u=e[s];if(t)s&&i===u||o.push(u),i=u;else if(n){var l=n(u,s,e);g.indexOf(i,l)<0&&(i.push(l),o.push(u))}else g.indexOf(o,u)<0&&o.push(u)}return o},g.union=function(){return g.uniq(_(arguments,!0,!0,[]))},g.intersection=function(e){if(null==e)return[];for(var t=[],n=arguments.length,r=0,o=e.length;o>r;r++){var i=e[r];if(!g.contains(t,i)){for(var s=1;n>s&&g.contains(arguments[s],i);s++);s===n&&t.push(i)}}return t},g.difference=function(e){var t=_(l.call(arguments,1),!0,!0,[]);return g.filter(e,function(e){return!g.contains(t,e)})},g.zip=function(e){if(null==e)return[];for(var t=g.max(arguments,"length").length,n=Array(t),r=0;t>r;r++)n[r]=g.pluck(arguments,r);return n},g.object=function(e,t){if(null==e)return{};for(var n={},r=0,o=e.length;o>r;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},g.indexOf=function(e,t,n){if(null==e)return-1;var r=0,o=e.length;if(n){if("number"!=typeof n)return r=g.sortedIndex(e,t),e[r]===t?r:-1;r=0>n?Math.max(0,o+n):n}for(;o>r;r++)if(e[r]===t)return r;return-1},g.lastIndexOf=function(e,t,n){if(null==e)return-1;var r=e.length;for("number"==typeof n&&(r=0>n?r+n+1:Math.min(r,n+1));--r>=0;)if(e[r]===t)return r;return-1},g.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=n||1;for(var r=Math.max(Math.ceil((t-e)/n),0),o=Array(r),i=0;r>i;i++,e+=n)o[i]=e;return o};var w=function(){};g.bind=function(e,t){var n,r;if(m&&e.bind===m)return m.apply(e,l.call(arguments,1));if(!g.isFunction(e))throw new TypeError("Bind must be called on a function");return n=l.call(arguments,2),r=function(){if(!(this instanceof r))return e.apply(t,n.concat(l.call(arguments)));w.prototype=e.prototype;var o=new w;w.prototype=null;var i=e.apply(o,n.concat(l.call(arguments)));return g.isObject(i)?i:o}},g.partial=function(e){var t=l.call(arguments,1);return function(){for(var n=0,r=t.slice(),o=0,i=r.length;i>o;o++)r[o]===g&&(r[o]=arguments[n++]);for(;n<arguments.length;)r.push(arguments[n++]);return e.apply(this,r)}},g.bindAll=function(e){var t,n,r=arguments.length;if(1>=r)throw new Error("bindAll must be passed function names");for(t=1;r>t;t++)n=arguments[t],e[n]=g.bind(e[n],e);return e},g.memoize=function(e,t){var n=function(r){var o=n.cache,i=t?t.apply(this,arguments):r;return g.has(o,i)||(o[i]=e.apply(this,arguments)),o[i]};return n.cache={},n},g.delay=function(e,t){var n=l.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},g.defer=function(e){return g.delay.apply(g,[e,1].concat(l.call(arguments,1)))},g.throttle=function(e,t,n){var r,o,i,s=null,a=0;n||(n={});var u=function(){a=n.leading===!1?0:g.now(),s=null,i=e.apply(r,o),s||(r=o=null)};return function(){var l=g.now();a||n.leading!==!1||(a=l);var c=t-(l-a);return r=this,o=arguments,0>=c||c>t?(clearTimeout(s),s=null,a=l,i=e.apply(r,o),s||(r=o=null)):s||n.trailing===!1||(s=setTimeout(u,c)),i}},g.debounce=function(e,t,n){var r,o,i,s,a,u=function(){var l=g.now()-s;t>l&&l>0?r=setTimeout(u,t-l):(r=null,n||(a=e.apply(i,o),r||(i=o=null)))};return function(){i=this,o=arguments,s=g.now();var l=n&&!r;return r||(r=setTimeout(u,t)),l&&(a=e.apply(i,o),i=o=null),a}},g.wrap=function(e,t){return g.partial(t,e)},g.negate=function(e){return function(){return!e.apply(this,arguments)}},g.compose=function(){var e=arguments,t=e.length-1;return function(){for(var n=t,r=e[t].apply(this,arguments);n--;)r=e[n].call(this,r);return r}},g.after=function(e,t){return function(){return--e<1?t.apply(this,arguments):void 0}},g.before=function(e,t){var n;return function(){return--e>0?n=t.apply(this,arguments):t=null,n}},g.once=g.partial(g.before,2),g.keys=function(e){if(!g.isObject(e))return[];if(h)return h(e);var t=[];for(var n in e)g.has(e,n)&&t.push(n);return t},g.values=function(e){for(var t=g.keys(e),n=t.length,r=Array(n),o=0;n>o;o++)r[o]=e[t[o]];return r},g.pairs=function(e){for(var t=g.keys(e),n=t.length,r=Array(n),o=0;n>o;o++)r[o]=[t[o],e[t[o]]];return r},g.invert=function(e){for(var t={},n=g.keys(e),r=0,o=n.length;o>r;r++)t[e[n[r]]]=n[r];return t},g.functions=g.methods=function(e){var t=[];for(var n in e)g.isFunction(e[n])&&t.push(n);return t.sort()},g.extend=function(e){if(!g.isObject(e))return e;for(var t,n,r=1,o=arguments.length;o>r;r++){t=arguments[r];for(n in t)d.call(t,n)&&(e[n]=t[n])}return e},g.pick=function(e,t,n){var r,o={};if(null==e)return o;if(g.isFunction(t)){t=y(t,n);for(r in e){var i=e[r];t(i,r,e)&&(o[r]=i)}}else{var s=c.apply([],l.call(arguments,1));e=new Object(e);for(var a=0,u=s.length;u>a;a++)r=s[a],r in e&&(o[r]=e[r])}return o},g.omit=function(e,t,n){if(g.isFunction(t))t=g.negate(t);else{var r=g.map(c.apply([],l.call(arguments,1)),String);t=function(e,t){return!g.contains(r,t)}}return g.pick(e,t,n)},g.defaults=function(e){if(!g.isObject(e))return e;for(var t=1,n=arguments.length;n>t;t++){var r=arguments[t];for(var o in r)void 0===e[o]&&(e[o]=r[o])}return e},g.clone=function(e){return g.isObject(e)?g.isArray(e)?e.slice():g.extend({},e):e},g.tap=function(e,t){return t(e),e};var E=function(e,t,n,r){if(e===t)return 0!==e||1/e===1/t;if(null==e||null==t)return e===t;e instanceof g&&(e=e._wrapped),t instanceof g&&(t=t._wrapped);var o=f.call(e);if(o!==f.call(t))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!==+e?+t!==+t:0===+e?1/+e===1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t}if("object"!=typeof e||"object"!=typeof t)return!1;for(var i=n.length;i--;)if(n[i]===e)return r[i]===t;var s=e.constructor,a=t.constructor;if(s!==a&&"constructor"in e&&"constructor"in t&&!(g.isFunction(s)&&s instanceof s&&g.isFunction(a)&&a instanceof a))return!1;n.push(e),r.push(t);var u,l;if("[object Array]"===o){if(u=e.length,l=u===t.length)for(;u--&&(l=E(e[u],t[u],n,r)););}else{var c,d=g.keys(e);if(u=d.length,l=g.keys(t).length===u)for(;u--&&(c=d[u],l=g.has(t,c)&&E(e[c],t[c],n,r)););}return n.pop(),r.pop(),l};g.isEqual=function(e,t){return E(e,t,[],[])},g.isEmpty=function(e){if(null==e)return!0;if(g.isArray(e)||g.isString(e)||g.isArguments(e))return 0===e.length;for(var t in e)if(g.has(e,t))return!1;return!0},g.isElement=function(e){return!(!e||1!==e.nodeType)},g.isArray=p||function(e){return"[object Array]"===f.call(e)},g.isObject=function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},g.each(["Arguments","Function","String","Number","Date","RegExp"],function(e){g["is"+e]=function(t){return f.call(t)==="[object "+e+"]"}}),g.isArguments(arguments)||(g.isArguments=function(e){return g.has(e,"callee")}),"function"!=typeof/./&&(g.isFunction=function(e){return"function"==typeof e||!1}),g.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},g.isNaN=function(e){return g.isNumber(e)&&e!==+e},g.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"===f.call(e)},g.isNull=function(e){return null===e},g.isUndefined=function(e){return void 0===e},g.has=function(e,t){return null!=e&&d.call(e,t)},g.noConflict=function(){return t._=o,this},g.identity=function(e){return e},g.constant=function(e){return function(){return e}},g.noop=function(){},g.property=function(e){return function(t){return t[e]}},g.matches=function(e){var t=g.pairs(e),n=t.length;return function(e){if(null==e)return!n;e=new Object(e);for(var r=0;n>r;r++){var o=t[r],i=o[0];if(o[1]!==e[i]||!(i in e))return!1}return!0}},g.times=function(e,t,n){var r=Array(Math.max(0,e));t=y(t,n,1);for(var o=0;e>o;o++)r[o]=t(o);return r},g.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},g.now=Date.now||function(){return(new Date).getTime()};var C={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},x=g.invert(C),N=function(e){var t=function(t){return e[t]},n="(?:"+g.keys(e).join("|")+")",r=RegExp(n),o=RegExp(n,"g");return function(e){return e=null==e?"":""+e,r.test(e)?e.replace(o,t):e}};g.escape=N(C),g.unescape=N(x),g.result=function(e,t){if(null==e)return void 0;var n=e[t];return g.isFunction(n)?e[t]():n};var R=0;g.uniqueId=function(e){var t=++R+"";return e?e+t:t},g.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var O=/(.)^/,D={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},M=/\\|'|\r|\n|\u2028|\u2029/g,T=function(e){return"\\"+D[e]};g.template=function(e,t,n){!t&&n&&(t=n),t=g.defaults({},t,g.templateSettings);var r=RegExp([(t.escape||O).source,(t.interpolate||O).source,(t.evaluate||O).source].join("|")+"|$","g"),o=0,i="__p+='";e.replace(r,function(t,n,r,s,a){return i+=e.slice(o,a).replace(M,T),o=a+t.length,n?i+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?i+="'+\n((__t=("+r+"))==null?'':__t)+\n'":s&&(i+="';\n"+s+"\n__p+='"),t}),i+="';\n",t.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var s=new Function(t.variable||"obj","_",i)}catch(a){throw a.source=i,a}var u=function(e){return s.call(this,e,g)},l=t.variable||"obj";return u.source="function("+l+"){\n"+i+"}",u},g.chain=function(e){var t=g(e);return t._chain=!0,t};var I=function(e){return this._chain?g(e).chain():e};g.mixin=function(e){g.each(g.functions(e),function(t){var n=g[t]=e[t];g.prototype[t]=function(){var e=[this._wrapped];return u.apply(e,arguments),I.call(this,n.apply(g,e))}})},g.mixin(g),g.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=i[e];g.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!==e&&"splice"!==e||0!==n.length||delete n[0],I.call(this,n)}}),g.each(["concat","join","slice"],function(e){var t=i[e];g.prototype[e]=function(){return I.call(this,t.apply(this._wrapped,arguments))}}),g.prototype.value=function(){return this._wrapped},"function"==typeof e&&e.amd&&e("underscore",[],function(){return g})}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-collection-underscore-mixin/node_modules/underscore/underscore.js","/node_modules/ampersand-collection-underscore-mixin/node_modules/underscore")},{_process:45,buffer:42}],17:[function(e,t){(function(){function n(e,t){if(t||(t={}),t.model&&(this.model=t.model),t.comparator&&(this.comparator=t.comparator),t.parent&&(this.parent=t.parent),!this.mainIndex){var n=this.model&&this.model.prototype&&this.model.prototype.idAttribute;this.mainIndex=n||"id"}this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,s({silent:!0},t))}var r=e("backbone-events-standalone"),o=e("ampersand-class-extend"),i=e("is-array"),s=e("extend-object"),a=[].slice;s(n.prototype,r,{initialize:function(){},indexes:[],isModel:function(e){return this.model&&e instanceof this.model},add:function(e,t){return this.set(e,s({merge:!1,add:!0,remove:!1},t))},parse:function(e){return e},serialize:function(){return this.map(function(e){if(e.serialize)return e.serialize();var t={};return s(t,e),delete t.collection,t})},toJSON:function(){return this.serialize()},set:function(e,t){t=s({add:!0,remove:!0,merge:!0},t),t.parse&&(e=this.parse(e,t));var n=!i(e);e=n?e?[e]:[]:e.slice();var r,o,a,u,l,c,f,d=t.at,p=this.comparator&&null==d&&t.sort!==!1,h="string"==typeof this.comparator?this.comparator:null,m=[],g=[],y={},v=t.add,b=t.merge,_=t.remove,w=!p&&v&&_?[]:!1,E=this.model&&this.model.prototype||Object.prototype;for(c=0,f=e.length;f>c;c++){if(a=e[c]||{},r=this.isModel(a)?o=a:E.generateId?E.generateId(a):a[E.idAttribute||"id"],u=this.get(r))_&&(y[u.cid||u[this.mainIndex]]=!0),b&&(a=a===o?o.attributes:a,t.parse&&(a=u.parse(a,t)),u.set?(u.set(a,t),p&&!l&&u.hasChanged(h)&&(l=!0)):s(u,a)),e[c]=u;else if(v){if(o=e[c]=this._prepareModel(a,t),!o)continue;m.push(o),this._addReference(o,t)}o=u||o,o&&(w&&(o.isNew&&o.isNew()||!o[this.mainIndex]||!y[o.cid||o[this.mainIndex]])&&w.push(o),y[o[this.mainIndex]]=!0)}if(_){for(c=0,f=this.length;f>c;c++)o=this.models[c],y[o.cid||o[this.mainIndex]]||g.push(o);g.length&&this.remove(g,t)}if(m.length||w&&w.length)if(p&&(l=!0),null!=d)for(c=0,f=m.length;f>c;c++)this.models.splice(d+c,0,m[c]);else{var C=w||m;for(c=0,f=C.length;f>c;c++)this.models.push(C[c])}if(l&&this.sort({silent:!0}),!t.silent){for(c=0,f=m.length;f>c;c++)o=m[c],o.trigger?o.trigger("add",o,this,t):this.trigger("add",o,this,t);(l||w&&w.length)&&this.trigger("sort",this,t)}return n?e[0]:e},get:function(e,t){if(e){var n=this._indexes[t||this.mainIndex];return n[e]||n[e[this.mainIndex]]||this._indexes.cid[e.cid]}},at:function(e){return this.models[e]},remove:function(e,t){var n,r,o,s,u=!i(e);for(e=u?[e]:a.call(e),t||(t={}),n=0,r=e.length;r>n;n++)o=e[n]=this.get(e[n]),o&&(this._deIndex(o),s=this.models.indexOf(o),this.models.splice(s,1),t.silent||(t.index=s,o.trigger?o.trigger("remove",o,this,t):this.trigger("remove",o,this,t)),this._removeReference(o,t));return u?e[0]:e},reset:function(e,t){t||(t={});for(var n=0,r=this.models.length;r>n;n++)this._removeReference(this.models[n],t);return t.previousModels=this.models,this._reset(),e=this.add(e,s({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},sort:function(e){var t=this;if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),"string"==typeof this.comparator?this.models.sort(function(e,n){return e.get?(e=e.get(t.comparator),n=n.get(t.comparator)):(e=e[t.comparator],n=n[t.comparator]),e>n||void 0===e?1:n>e||void 0===n?-1:0}):1===this.comparator.length?this.models.sort(function(e,n){return e=t.comparator(e),n=t.comparator(n),e>n||void 0===e?1:n>e||void 0===n?-1:0}):this.models.sort(this.comparator.bind(this)),e.silent||this.trigger("sort",this,e),this},_reset:function(){var e=this.indexes||[],t=0;e.push(this.mainIndex),e.push("cid");var n=e.length;for(this.models=[],this._indexes={};n>t;t++)this._indexes[e[t]]={}},_prepareModel:function(e,t){if(!this.model)return e;if(this.isModel(e))return e.collection||(e.collection=this),e;t=t?s({},t):{},t.collection=this;var n=new this.model(e,t);return n.validationError?(this.trigger("invalid",this,n.validationError,t),!1):n},_deIndex:function(e){for(var t in this._indexes)delete this._indexes[t][e[t]||e.get&&e.get(t)]},_index:function(e){for(var t in this._indexes){var n=e[t]||e.get&&e.get(t);n&&(this._indexes[t][n]=e)}},_addReference:function(e){this._index(e),e.collection||(e.collection=this),e.on&&e.on("all",this._onModelEvent,this)
},_removeReference:function(e){this===e.collection&&delete e.collection,this._deIndex(e),e.off&&e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,r){("add"!==e&&"remove"!==e||n===this)&&("destroy"===e&&this.remove(t,r),t&&e==="change:"+this.mainIndex&&(this._deIndex(t),this._index(t)),this.trigger.apply(this,arguments))}}),Object.defineProperties(n.prototype,{length:{get:function(){return this.models.length}},isCollection:{value:!0}});var u=["indexOf","lastIndexOf","every","some","forEach","map","filter","reduce","reduceRight"];u.forEach(function(e){n.prototype[e]=function(){return this.models[e].apply(this.models,arguments)}}),n.prototype.each=n.prototype.forEach,n.extend=o,t.exports=n}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-collection/ampersand-collection.js","/node_modules/ampersand-collection")},{_process:45,"ampersand-class-extend":14,"backbone-events-standalone":19,buffer:42,"extend-object":46,"is-array":47}],18:[function(t,n,r){(function(){!function(){function t(){return{keys:Object.keys,uniqueId:function(e){var t=++c+"";return e?e+t:t},has:function(e,t){return u.call(e,t)},each:function(e,t,n){if(null!=e)if(a&&e.forEach===a)e.forEach(t,n);else if(e.length===+e.length){for(var r=0,o=e.length;o>r;r++)if(t.call(n,e[r],r,e)===s)return}else for(var i in e)if(this.has(e,i)&&t.call(n,e[i],i,e)===s)return},once:function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}}}}var o,i=this,s={},a=Array.prototype.forEach,u=Object.prototype.hasOwnProperty,l=Array.prototype.slice,c=0,f=t();o={on:function(e,t,n){if(!p(this,"on",e,[t,n])||!t)return this;this._events||(this._events={});var r=this._events[e]||(this._events[e]=[]);return r.push({callback:t,context:n,ctx:n||this}),this},once:function(e,t,n){if(!p(this,"once",e,[t,n])||!t)return this;var r=this,o=f.once(function(){r.off(e,o),t.apply(this,arguments)});return o._callback=t,this.on(e,o,n)},off:function(e,t,n){var r,o,i,s,a,u,l,c;if(!this._events||!p(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return this._events={},this;for(s=e?[e]:f.keys(this._events),a=0,u=s.length;u>a;a++)if(e=s[a],i=this._events[e]){if(this._events[e]=r=[],t||n)for(l=0,c=i.length;c>l;l++)o=i[l],(t&&t!==o.callback&&t!==o.callback._callback||n&&n!==o.context)&&r.push(o);r.length||delete this._events[e]}return this},trigger:function(e){if(!this._events)return this;var t=l.call(arguments,1);if(!p(this,"trigger",e,t))return this;var n=this._events[e],r=this._events.all;return n&&h(n,t),r&&h(r,arguments),this},stopListening:function(e,t,n){var r=this._listeners;if(!r)return this;var o=!t&&!n;"object"==typeof t&&(n=this),e&&((r={})[e._listenerId]=e);for(var i in r)r[i].off(t,n,this),o&&delete this._listeners[i];return this}};var d=/\s+/,p=function(e,t,n,r){if(!n)return!0;if("object"==typeof n){for(var o in n)e[t].apply(e,[o,n[o]].concat(r));return!1}if(d.test(n)){for(var i=n.split(d),s=0,a=i.length;a>s;s++)e[t].apply(e,[i[s]].concat(r));return!1}return!0},h=function(e,t){var n,r=-1,o=e.length,i=t[0],s=t[1],a=t[2];switch(t.length){case 0:for(;++r<o;)(n=e[r]).callback.call(n.ctx);return;case 1:for(;++r<o;)(n=e[r]).callback.call(n.ctx,i);return;case 2:for(;++r<o;)(n=e[r]).callback.call(n.ctx,i,s);return;case 3:for(;++r<o;)(n=e[r]).callback.call(n.ctx,i,s,a);return;default:for(;++r<o;)(n=e[r]).callback.apply(n.ctx,t)}},m={listenTo:"on",listenToOnce:"once"};f.each(m,function(e,t){o[t]=function(t,n,r){var o=this._listeners||(this._listeners={}),i=t._listenerId||(t._listenerId=f.uniqueId("l"));return o[i]=t,"object"==typeof n&&(r=this),t[e](n,r,this),this}}),o.bind=o.on,o.unbind=o.off,o.mixin=function(e){var t=["on","once","off","trigger","stopListening","listenTo","listenToOnce","bind","unbind"];return f.each(t,function(t){e[t]=this[t]},this),e},"function"==typeof e?e(function(){return o}):"undefined"!=typeof r?("undefined"!=typeof n&&n.exports&&(r=n.exports=o),r.BackboneEvents=o):i.BackboneEvents=o}(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-collection/node_modules/backbone-events-standalone/backbone-events-standalone.js","/node_modules/ampersand-collection/node_modules/backbone-events-standalone")},{_process:45,buffer:42}],19:[function(e,t){(function(){t.exports=e("./backbone-events-standalone")}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-collection/node_modules/backbone-events-standalone/index.js","/node_modules/ampersand-collection/node_modules/backbone-events-standalone")},{"./backbone-events-standalone":18,_process:45,buffer:42}],20:[function(e,t){(function(){var n=e("ampersand-state"),r=e("underscore"),o=e("ampersand-sync"),i=n.extend({save:function(e,t,n){{var o,i,s;this.attributes}if(null==e||"object"==typeof e?(o=e,n=t):(o={})[e]=t,n=r.extend({validate:!0},n),o&&!n.wait){if(!this.set(o,n))return!1}else if(!this._validate(o,n))return!1;void 0===n.parse&&(n.parse=!0);var u=this,l=n.success;return n.success=function(e){var t=u.parse(e,n);return n.wait&&(t=r.extend(o||{},t)),r.isObject(t)&&!u.set(t,n)?!1:(l&&l(u,e,n),u.trigger("sync",u,e,n),void 0)},a(this,n),i=this.isNew()?"create":n.patch?"patch":"update","patch"===i&&(n.attrs=o),n.wait&&(n.attrs=r.extend(u.serialize(),o)),s=this.sync(i,this,n)},fetch:function(e){e=e?r.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=this,n=e.success;return e.success=function(r){return t.set(t.parse(r,e),e)?(n&&n(t,r,e),t.trigger("sync",t,r,e),void 0):!1},a(this,e),this.sync("read",this,e)},destroy:function(e){e=e?r.clone(e):{};var t=this,n=e.success,o=function(){t.trigger("destroy",t,t.collection,e)};if(e.success=function(r){(e.wait||t.isNew())&&o(),n&&n(t,r,e),t.isNew()||t.trigger("sync",t,r,e)},this.isNew())return e.success(),!1;a(this,e);var i=this.sync("delete",this,e);return e.wait||o(),i},sync:function(){return o.apply(this,arguments)},url:function(){var e=r.result(this,"urlRoot")||r.result(this.collection,"url")||s();return this.isNew()?e:e+("/"===e.charAt(e.length-1)?"":"/")+encodeURIComponent(this.getId())}}),s=function(){throw new Error('A "url" property or function must be specified')},a=function(e,t){var n=t.error;t.error=function(r){n&&n(e,r,t),e.trigger("error",e,r,t)}};t.exports=i}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-model/ampersand-model.js","/node_modules/ampersand-model")},{_process:45,"ampersand-state":21,"ampersand-sync":28,buffer:42,underscore:26}],21:[function(e,t){(function(){function n(e,t){t||(t={}),this.cid||(this.cid=s.uniqueId("state")),this._events={},this._values={},this._definition=Object.create(this._definition),t.parse&&(e=this.parse(e,t)),this.parent=t.parent,this.collection=t.collection,this._keyTree=new u,this._initCollections(),this._initChildren(),this._cache={},this._previousAttributes={},e&&this.set(e,s.extend({silent:!0,initial:!0},t)),this._changed={},this._derived&&this._initDerived(),t.init!==!1&&this.initialize.apply(this,arguments)}function r(e,t,n,r){var o,i,a=e._definition[t]={};if(s.isString(n))o=e._ensureValidType(n),o&&(a.type=o);else{if(s.isArray(n)&&(i=n,n={type:i[0],required:i[1],"default":i[2]}),o=e._ensureValidType(n.type),o&&(a.type=o),n.required&&(a.required=!0),n.default&&"object"==typeof n.default)throw new TypeError("The default value for "+t+" cannot be an object/array, must be a value or a function which returns a value/object/array");a.default=n.default,a.allowNull=n.allowNull?n.allowNull:!1,n.setOnce&&(a.setOnce=!0),a.required&&s.isUndefined(a.default)&&(a.default=e._getDefaultForType(o)),a.test=n.test,a.values=n.values}return r&&(a.session=!0),Object.defineProperty(e,t,{set:function(e){this.set(t,e)},get:function(){var e=this._values[t],n=this._dataTypes[a.type];return"undefined"!=typeof e?(n&&n.get&&(e=n.get(e)),e):s.result(a,"default")}}),a}function o(e,t,n){var r=e._derived[t]={fn:s.isFunction(n)?n:n.fn,cache:n.cache!==!1,depList:n.deps||[]};s.each(r.depList,function(n){e._deps[n]=s(e._deps[n]||[]).union([t])}),Object.defineProperty(e,t,{get:function(){return this._getDerivedProperty(t)},set:function(){throw new TypeError('"'+t+"\" is a derived property, it can't be set directly.")}})}function i(e){var t,n=this,i=[].slice.call(arguments);t=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return n.apply(this,arguments)},s.extend(t,n);var a=function(){this.constructor=t};a.prototype=n.prototype,t.prototype=new a,t.prototype._derived=s.extend({},n.prototype._derived),t.prototype._deps=s.extend({},n.prototype._deps),t.prototype._definition=s.extend({},n.prototype._definition),t.prototype._collections=s.extend({},n.prototype._collections),t.prototype._children=s.extend({},n.prototype._children),t.prototype._dataTypes=s.extend({},n.prototype._dataTypes||f),e&&i.forEach(function(e){e.dataTypes&&(s.each(e.dataTypes,function(e,n){t.prototype._dataTypes[n]=e}),delete e.dataTypes),e.props&&(s.each(e.props,function(e,n){r(t.prototype,n,e)}),delete e.props),e.session&&(s.each(e.session,function(e,n){r(t.prototype,n,e,!0)}),delete e.session),e.derived&&(s.each(e.derived,function(e,n){o(t.prototype,n,e)}),delete e.derived),e.collections&&(s.each(e.collections,function(e,n){t.prototype._collections[n]=e}),delete e.collections),e.children&&(s.each(e.children,function(e,n){t.prototype._children[n]=e}),delete e.children),s.extend(t.prototype,e)});Object.prototype.toString;return t.__super__=n.prototype,t}var s=e("underscore"),a=e("backbone-events-standalone"),u=e("key-tree-store"),l=e("array-next"),c=/^change:/;s.extend(n.prototype,a,{extraProperties:"ignore",idAttribute:"id",namespaceAttribute:"namespace",typeAttribute:"modelType",initialize:function(){return this},getId:function(){return this[this.idAttribute]},getNamespace:function(){return this[this.namespaceAttribute]},getType:function(){return this[this.typeAttribute]},isNew:function(){return null==this.getId()},escape:function(e){return s.escape(this.get(e))},isValid:function(e){return this._validate({},s.extend(e||{},{validate:!0}))},parse:function(e){return e},serialize:function(){var e=this.getAttributes({props:!0},!0);return s.each(this._children,function(t,n){e[n]=this[n].serialize()},this),s.each(this._collections,function(t,n){e[n]=this[n].serialize()},this),e},set:function(e,t,n){var r,o,i,a,u,l,c,f,d,p,h,m,g,y,v,b,_=this,w=this.extraProperties;if(s.isObject(e)||null===e?(d=e,n=t):(d={},d[e]=t),n=n||{},!this._validate(d,n))return!1;m=n.unset,h=n.silent,y=n.initial,o=[],r=this._changing,this._changing=!0,r||(this._previousAttributes=this.attributes,this._changed={});for(f in d){if(a=d[f],i=typeof a,g=this._values[f],u=this._definition[f],!u){if(this._children[f]||this._collections[f]){this[f].set(a,n);continue}if("ignore"===w)continue;if("reject"===w)throw new TypeError('No "'+f+'" property defined on '+(this.type||"this")+' model and extraProperties not set to "ignore" or "allow"');"allow"===w&&(u=this._createPropertyDefinition(f,"any"))}if(b=this._getCompareForType(u.type),p=this._dataTypes[u.type],p&&p.set&&(l=p.set(a),a=l.val,i=l.type),u.test&&(c=u.test.call(this,a,i)))throw new TypeError("Property '"+f+"' failed validation with error: "+c);if(s.isUndefined(a)&&u.required)throw new TypeError("Required property '"+f+"' must be of type "+u.type+". Tried to set "+a);if(s.isNull(a)&&u.required&&!u.allowNull)throw new TypeError("Property '"+f+"' must be of type "+u.type+" (cannot be null). Tried to set "+a);if(u.type&&"any"!==u.type&&u.type!==i&&!s.isNull(a)&&!s.isUndefined(a))throw new TypeError("Property '"+f+"' must be of type "+u.type+". Tried to set "+a);if(u.values&&!s.contains(u.values,a))throw new TypeError("Property '"+f+"' must be one of values: "+u.values.join(", "));if(v=!b(g,a,f),u.setOnce&&void 0!==g&&v)throw new TypeError("Property '"+e+"' can only be set once.");v?(o.push({prev:g,val:a,key:f}),_._changed[f]=a):delete _._changed[f]}if(s.each(o,function(e){_._previousAttributes[e.key]=e.prev,m?delete _._values[e.key]:_._values[e.key]=e.val}),!h&&o.length&&(_._pending=!0),h||s.each(o,function(e){_.trigger("change:"+e.key,_,e.val,n)}),r)return this;if(!h)for(;this._pending;)this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},get:function(e){return this[e]},toggle:function(e){var t=this._definition[e];if("boolean"===t.type)this[e]=!this[e];else{if(!t||!t.values)throw new TypeError("Can only toggle properties that are type `boolean` or have `values` array.");this[e]=l(t.values,this[e])}return this},previousAttributes:function(){return s.clone(this._previousAttributes)},hasChanged:function(e){return null==e?!s.isEmpty(this._changed):s.has(this._changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?s.clone(this._changed):!1;var t,n,r,o=!1,i=this._changing?this._previousAttributes:this.attributes;for(var a in e)n=this._definition[a],r=this._getCompareForType(n&&n.type),r(i[a],t=e[a])||((o||(o={}))[a]=t);return o},toJSON:function(){return this.serialize()},unset:function(e,t){{var n,r=this._definition[e];r.type}return r.required?(n=s.result(r,"default"),this.set(e,n,t)):this.set(e,n,s.extend({},t,{unset:!0}))},clear:function(e){var t=this;return s.each(s.keys(this.attributes),function(n){t.unset(n,e)}),this},previous:function(e){return null!=e&&Object.keys(this._previousAttributes).length?this._previousAttributes[e]:null},_getDefaultForType:function(e){var t=this._dataTypes[e];return t&&t.default},_getCompareForType:function(e){var t=this._dataTypes[e];return t&&t.compare?s.bind(t.compare,this):s.isEqual},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=s.extend({},this.attributes,e);var n=this.validationError=this.validate(e,t)||null;return n?(this.trigger("invalid",this,n,s.extend(t||{},{validationError:n})),!1):!0},_createPropertyDefinition:function(e,t,n){return r(this,e,t,n)},_ensureValidType:function(e){return s.contains(["string","number","boolean","array","object","date","any"].concat(s.keys(this._dataTypes)),e)?e:void 0},getAttributes:function(e,t){e||(e={}),s.defaults(e,{session:!1,props:!1,derived:!1});var n,r,o,i={};for(r in this._definition)o=this._definition[r],(e.session&&o.session||e.props&&!o.session)&&(n=t?this._values[r]:this[r],"undefined"==typeof n&&(n=s.result(o,"default")),"undefined"!=typeof n&&(i[r]=n));if(e.derived)for(r in this._derived)i[r]=this[r];return i},_initDerived:function(){var e=this;s.each(this._derived,function(t,n){var r=e._derived[n];r.deps=r.depList;var o=function(t){t=t||{};var o=r.fn.call(e);e._cache[n]===o&&r.cache||(r.cache&&(e._previousAttributes[n]=e._cache[n]),e._cache[n]=o,e.trigger("change:"+n,e,e._cache[n]))};r.deps.forEach(function(t){e._keyTree.add(t,o)})}),this.on("all",function(t){c.test(t)&&e._keyTree.get(t.split(":")[1]).forEach(function(e){e()})},this)},_getDerivedProperty:function(e,t){return this._derived[e].cache?((t||!this._cache.hasOwnProperty(e))&&(this._cache[e]=this._derived[e].fn.apply(this)),this._cache[e]):this._derived[e].fn.apply(this)},_initCollections:function(){var e;if(this._collections)for(e in this._collections)this[e]=new this._collections[e](null,{parent:this})},_initChildren:function(){var e;if(this._children)for(e in this._children)this[e]=new this._children[e]({},{parent:this}),this.listenTo(this[e],"all",this._getEventBubblingHandler(e))},_getEventBubblingHandler:function(e){return s.bind(function(t,n,r){c.test(t)?this.trigger("change:"+e+"."+t.split(":")[1],n,r):"change"===t&&this.trigger("change",this)},this)},_verifyRequired:function(){var e=this.attributes;for(var t in this._definition)if(this._definition[t].required&&"undefined"==typeof e[t])return!1;return!0}}),Object.defineProperties(n.prototype,{attributes:{get:function(){return this.getAttributes({props:!0,session:!0})}},all:{get:function(){return this.getAttributes({session:!0,props:!0,derived:!0})}},isState:{get:function(){return!0},set:function(){}}});var f={string:{"default":function(){return""}},date:{set:function(e){var t;if(s.isDate(e))t="date",e=e.valueOf();else try{if(e=new Date(parseInt(e,10)),!s.isDate(e))throw TypeError;if(e=e.valueOf(),s.isNaN(e))throw TypeError;t="date"}catch(n){t=typeof e}return{val:e,type:t}},get:function(e){return new Date(e)},"default":function(){return new Date}},array:{set:function(e){return{val:e,type:s.isArray(e)?"array":typeof e}},"default":function(){return[]}},object:{set:function(e){var t=typeof e;return"object"!==t&&s.isUndefined(e)&&(e=null,t="object"),{val:e,type:t}},"default":function(){return{}}},state:{set:function(e){var t=e instanceof n||e&&e.isState;return t?{val:e,type:"state"}:{val:e,type:typeof e}},compare:function(e,t,n){var r=e===t;return r||(e&&this.stopListening(e),null!=t&&this.listenTo(t,"all",this._getEventBubblingHandler(n))),r}}};n.extend=i,t.exports=n}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/ampersand-model/node_modules/ampersand-state/ampersand-state.js","/node_modules/ampersand-model/node_modules/ampersand-state")},{_process:45,"array-next":22,"backbone-events-standalone":24,buffer:42,"key-tree-store":25,underscore:26}],22:[function(e,t){(function(){t.exports=function(e,t){var n=e.length,r=e.indexOf(t)+1;return r>n-1&&(r=0),e[r]}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?