/** * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/almond for details */ /** * SeedHq version: "0.0.16" Copyright (c) 2011-2012, Cyril Agosta ( cyril.agosta.dev@gmail.com) All Rights Reserved. * Available via the MIT license. * see: http://github.com/cagosta/SeedHq for details */ /** * @license RequireJS domReady 2.0.1 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/requirejs/domReady for details */ // Underscore.string // (c) 2010 Esa-Matti Suuronen // Underscore.string is freely distributable under the terms of the MIT license. // Documentation: https://github.com/epeli/underscore.string // Some code is borrowed from MooTools and Alexandru Marasteanu. // Version '2.3.2' // Copyright (c) Alexandru Marasteanu /** * String.nocomplex version: "0.0.9" Copyright (c) 2011-2012, Cyril Agosta ( cyril.agosta.dev@gmail.com) All Rights Reserved. * Available via the MIT license. * see: http://github.com/cagosta/String.nocomplex for details */ /** * toDOM version: "0.0.7" Copyright (c) 2011-2012, Cyril Agosta ( cyril.agosta.dev@gmail.com) All Rights Reserved. * Available via the MIT license. * see: http://github.com/cagosta/toDOM for details */ /** * SeedView version: "0.0.22" Copyright (c) 2011-2012, Cyril Agosta ( cyril.agosta.dev@gmail.com) All Rights Reserved. * Available via the MIT license. * see: http://github.com/cagosta/SeedView for details */ var requirejs,require,define;!function(e){function t(e,t){return y.call(e,t)}function n(e,t){var n,r,i,o,s,a,u,c,l,f,h,p=t&&t.split("/"),d=m.map,g=d&&d["*"]||{};if(e&&"."===e.charAt(0))if(t){for(p=p.slice(0,p.length-1),e=e.split("/"),s=e.length-1,m.nodeIdCompat&&w.test(e[s])&&(e[s]=e[s].replace(w,"")),e=p.concat(e),l=0;l0&&(e.splice(l-1,2),l-=2)}e=e.join("/")}else 0===e.indexOf("./")&&(e=e.substring(2));if((p||g)&&d){for(n=e.split("/"),l=n.length;l>0;l-=1){if(r=n.slice(0,l).join("/"),p)for(f=p.length;f>0;f-=1)if(i=d[p.slice(0,f).join("/")],i&&(i=i[r])){o=i,a=l;break}if(o)break;!u&&g&&g[r]&&(u=g[r],c=l)}!o&&u&&(o=u,a=c),o&&(n.splice(0,a,o),e=n.join("/"))}return e}function r(t,n){return function(){return l.apply(e,v.call(arguments,0).concat([t,n]))}}function i(e){return function(t){return n(t,e)}}function o(e){return function(t){p[e]=t}}function s(n){if(t(d,n)){var r=d[n];delete d[n],g[n]=!0,c.apply(e,r)}if(!t(p,n)&&!t(g,n))throw new Error("No "+n);return p[n]}function a(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function u(e){return function(){return m&&m.config&&m.config[e]||{}}}var c,l,f,h,p={},d={},m={},g={},y=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;f=function(e,t){var r,o=a(e),u=o[0];return e=o[1],u&&(u=n(u,t),r=s(u)),u?e=r&&r.normalize?r.normalize(e,i(t)):n(e,t):(e=n(e,t),o=a(e),u=o[0],e=o[1],u&&(r=s(u))),{f:u?u+"!"+e:e,n:e,pr:u,p:r}},h={require:function(e){return r(e)},exports:function(e){var t=p[e];return"undefined"!=typeof t?t:p[e]={}},module:function(e){return{id:e,uri:"",exports:p[e],config:u(e)}}},c=function(n,i,a,u){var c,l,m,y,v,w,b=[],x=typeof a;if(u=u||n,"undefined"===x||"function"===x){for(i=!i.length&&a.length?["require","exports","module"]:i,v=0;vt;t++){var r="object"==typeof arguments[t]||"function"==typeof arguments[t]?arguments[t]:{};for(var i in r)r.hasOwnProperty(i)&&(e[i]=r[i])}return e},find:function(e,t){for(var n=0,r=e.length;r>n;n++)if(t(e[n],n))return e[n];return!1}}}),define("Seed/extendHooker",["./helpers"],function(e){var t=function(){};return t.prototype={getHooks:function(){},hookify:function(t){var n=t.__hooks=[];t.registerHook=function(e){t.__hooks.push(e)},t.hasHook=function(t){return"s"==typeof t?!!e.find(n,function(e){return e.id===t}):!!e.find(n,function(e){return e===t})},t.unregisterHook=function(t){return e.remove(n,t)}}},new t}),define("Seed/extendHooks/plusMinusExtendHook",["../helpers"],function(e){var t=function(t,n){return"undefined"==typeof n?t:"object"==typeof n&&"object"==typeof t?e.extend({},t,n):n},n=function(e,n){return"function"==typeof e||"function"==typeof n?function(){var r="function"==typeof e?e.apply(this,arguments):e,i="function"==typeof n?n.apply(this,arguments):n;return t(r,i)}:t(e,n)};return{name:"plusMinus",handle:function(e,t){var r=e,i=function(){};for(var o in t)if(t.hasOwnProperty(o)){var s=/(^\+|^-)(.*)/g;if(s.test(o)){var a=o.replace(s,"$2"),u=e[a]||i,c=t[o];switch(o.charAt(0)){case"+":r[a]=n(u,c);break;case"-":r[a]=n(c,u)}delete e[o]}else r[o]=t[o]}return r}}}),define("Seed/extendHooks/accessors/TypeChecker",[],function(){Array.isArray=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)},Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;return function(){return t.apply(e,arguments)}});var e=function(){this.is=this.is.bind(this)};return e.prototype={is:function(e,t){return null!==t&&"undefined"!=typeof t&&"function"==typeof t.isTypeOf?t.isTypeOf(e):this[e]?this[e](t)||!1:typeof t===e.toLowerCase()},Truthy:function(e){return!!e},Falsy:function(e){return!!e},Array:function(e){return Array.isArray(e)},Point:function(e){return e&&e.isPoint},Valid:function(e){return"undefined"!=typeof e},defined:function(e){return"undefined"!=typeof e},PlainObject:function(e){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString;if(!e||"[object Object]"!==n.call(e)||e.nodeType||e.setInterval)return!1;if(e.constructor&&!t.call(e,"constructor")&&!t.call(e.constructor.prototype,"isPrototypeOf"))return!1;var r;for(r in e);return void 0===r||t.call(e,r)},isStructure:function(e,t){var n;if(!this.is("PlainObject",t))return n="TypeChecker: Object "+t+" is not a plain Object",!1;for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];if(!r in t&&(n="TypeChecker: Key "+r+" is not in "+object),this.is("PlainObject",e[r]))return this.isStructure(e[r],t[r]);this.is(i,t[r])||(n="TypeChecker: Key "+r+" is not in "+object)}if(n)throw new Error(n);return!0},Profile:function(e){return this.isStructure({label:"String",id:"String"},e)},BenchmarkRawData:function(e){return this.isStructure({settings:"PlainObject",data:{W:"PlainObject",M:"PlainObject"}},e)}},e}),define("Seed/extendHooks/accessors/defaultTypeChecker",["./TypeChecker"],function(e){var t=new e;return t}),define("Seed/extendHooks/accessorsExtendHook",["./accessors/defaultTypeChecker","../helpers"],function(e,t){var n=function(e,t,n,r){this.id="accessors",this.accessorString=t,this.extendObj=n,this.typeChecker=r,this.typeChecker.is=this.typeChecker.is.bind(this.typeChecker),this.oldPrototype=e,this.create()};n.prototype={create:function(){var e,n=this.accessorString.charAt(0),r="-"===n,i="-"===n||"+"===n?this.accessorString.slice(1):this.accessorString,o=i.split("|"),s=o[1],a=o[0],u=t.capitalize(a),c=r?"_":"",l=c+"get"+u,f=c+"set"+u,h=c+a,p=(this.typeChecker,this);t.find(this.getExtendHookConfiguration().allAccessors,function(e){return e})||this.getExtendHookConfiguration().allAccessors.push(a),this.addMethod(l,function(){return this[h]}),s?this.addMethod(f,function(t){if(p.typeChecker.is(s,t))return this[h]=t,t;try{e=JSON.stringify(t)+" is not a "+s}catch(n){}throw new Error(e)}):this.addMethod(f,function(e){return this[h]=e,e})},getOldObj:function(){return this.oldPrototype},getExtendObj:function(){return this.extendObj},getExtendHookConfiguration:function(){return this.getOldObj().__extendHooks[this.id]},addMethod:function(e,t){this.extendObj[e]||(this.oldPrototype[e]=t)}};var r=function(){this.id="accessors",this.handle=this.handle.bind(this),this.typeChecker=e};return r.prototype={configure:function(e){e.typeChecker&&(this.typeChecker=e.typeChecker)},initializeHook:function(e,t){var n=[];t.__extendHooks=e.__extendHooks||{},t.__extendHooks[this.id]={id:this.id,allAccessors:n}},hasHook:function(e){return e&&e.__extendHooks&&e.__extendHooks[this.id]},handle:function(e,t){var r=t.accessors;if(this.hasHook(e)||this.initializeHook(e,t),!r)return e;for(var i=0;it)return"";for(var n="";t>0;)1&t&&(n+=e),t>>=1,e+=e;return n},u=[].slice,c=function(e){return null==e?"\\s":e.source?e.source:"["+d.escapeRegExp(e)+"]"},l={lt:"<",gt:">",quot:'"',amp:"&",apos:"'"},f={};for(var h in l)f[l[h]]=h;f["'"]="#39";var p=function(){function e(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}var n=a,r=function(){return r.cache.hasOwnProperty(arguments[0])||(r.cache[arguments[0]]=r.parse(arguments[0])),r.format.call(null,r.cache[arguments[0]],arguments)};return r.format=function(r,i){var o,s,a,u,c,l,f,h=1,d=r.length,m="",g=[];for(s=0;d>s;s++)if(m=e(r[s]),"string"===m)g.push(r[s]);else if("array"===m){if(u=r[s],u[2])for(o=i[h],a=0;a=0?"+"+o:o,l=u[4]?"0"==u[4]?"0":u[4].charAt(1):" ",f=u[6]-t(o).length,c=u[6]?n(l,f):"",g.push(u[5]?o+c:c+o)}return g.join("")},r.cache={},r.parse=function(e){for(var t=e,n=[],r=[],i=0;t;){if(null!==(n=/^[^\x25]+/.exec(t)))r.push(n[0]);else if(null!==(n=/^\x25{2}/.exec(t)))r.push("%");else{if(null===(n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t)))throw new Error("[_.sprintf] huh?");if(n[2]){i|=1;var o=[],s=n[2],a=[];if(null===(a=/^([a-z_][a-z_\d]*)/i.exec(s)))throw new Error("[_.sprintf] huh?");for(o.push(a[1]);""!==(s=s.substring(a[0].length));)if(null!==(a=/^\.([a-z_][a-z_\d]*)/i.exec(s)))o.push(a[1]);else{if(null===(a=/^\[(\d+)\]/.exec(s)))throw new Error("[_.sprintf] huh?");o.push(a[1])}n[2]=o}else i|=2;if(3===i)throw new Error("[_.sprintf] mixing positional and named placeholders is not (yet) supported");r.push(n)}t=t.substring(n[0].length)}return r},r}(),d={VERSION:"2.3.0",isBlank:function(e){return null==e&&(e=""),/^\s*$/.test(e)},stripTags:function(e){return null==e?"":t(e).replace(/<\/?[^>]+>/g,"")},capitalize:function(e){return e=null==e?"":t(e),e.charAt(0).toUpperCase()+e.slice(1)},chop:function(e,n){return null==e?[]:(e=t(e),n=~~n,n>0?e.match(new RegExp(".{1,"+n+"}","g")):[e])},clean:function(e){return d.strip(e).replace(/\s+/g," ")},count:function(e,n){if(null==e||null==n)return 0;e=t(e),n=t(n);for(var r=0,i=0,o=n.length;;){if(i=e.indexOf(n,i),-1===i)break;r++,i+=o}return r},chars:function(e){return null==e?[]:t(e).split("")},swapCase:function(e){return null==e?"":t(e).replace(/\S/g,function(e){return e===e.toUpperCase()?e.toLowerCase():e.toUpperCase()})},escapeHTML:function(e){return null==e?"":t(e).replace(/[&<>"']/g,function(e){return"&"+f[e]+";"})},unescapeHTML:function(e){return null==e?"":t(e).replace(/\&([^;]+);/g,function(e,n){var r;return n in l?l[n]:(r=n.match(/^#x([\da-fA-F]+)$/))?t.fromCharCode(parseInt(r[1],16)):(r=n.match(/^#(\d+)$/))?t.fromCharCode(~~r[1]):e})},escapeRegExp:function(e){return null==e?"":t(e).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")},splice:function(e,t,n,r){var i=d.chars(e);return i.splice(~~t,~~n,r),i.join("")},insert:function(e,t,n){return d.splice(e,t,0,n)},include:function(e,n){return""===n?!0:null==e?!1:-1!==t(e).indexOf(n)},join:function(){var e=u.call(arguments),t=e.shift();return null==t&&(t=""),e.join(t)},lines:function(e){return null==e?[]:t(e).split("\n")},reverse:function(e){return d.chars(e).reverse().join("")},startsWith:function(e,n){return""===n?!0:null==e||null==n?!1:(e=t(e),n=t(n),e.length>=n.length&&e.slice(0,n.length)===n)},endsWith:function(e,n){return""===n?!0:null==e||null==n?!1:(e=t(e),n=t(n),e.length>=n.length&&e.slice(e.length-n.length)===n)},succ:function(e){return null==e?"":(e=t(e),e.slice(0,-1)+t.fromCharCode(e.charCodeAt(e.length-1)+1))},titleize:function(e){return null==e?"":(e=t(e).toLowerCase(),e.replace(/(?:^|\s|-)\S/g,function(e){return e.toUpperCase()}))},camelize:function(e){return d.trim(e).replace(/[-_\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""})},underscored:function(e){return d.trim(e).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()},dasherize:function(e){return d.trim(e).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()},classify:function(e){return d.titleize(t(e).replace(/[\W_]/g," ")).replace(/\s/g,"")},humanize:function(e){return d.capitalize(d.underscored(e).replace(/_id$/,"").replace(/_/g," "))},trim:function(e,n){return null==e?"":!n&&r?r.call(e):(n=c(n),t(e).replace(new RegExp("^"+n+"+|"+n+"+$","g"),""))},ltrim:function(e,n){return null==e?"":!n&&o?o.call(e):(n=c(n),t(e).replace(new RegExp("^"+n+"+"),""))},rtrim:function(e,n){return null==e?"":!n&&i?i.call(e):(n=c(n),t(e).replace(new RegExp(n+"+$"),""))},truncate:function(e,n,r){return null==e?"":(e=t(e),r=r||"...",n=~~n,e.length>n?e.slice(0,n)+r:e)},prune:function(e,n,r){if(null==e)return"";if(e=t(e),n=~~n,r=null!=r?t(r):"...",e.length<=n)return e;var i=function(e){return e.toUpperCase()!==e.toLowerCase()?"A":" "},o=e.slice(0,n+1).replace(/.(?=\W*\w*$)/g,i);return o=o.slice(o.length-2).match(/\w\w/)?o.replace(/\s*\S+$/,""):d.rtrim(o.slice(0,o.length-1)),(o+r).length>e.length?e:e.slice(0,o.length)+r},words:function(e,t){return d.isBlank(e)?[]:d.trim(e,t).split(t||/\s+/)},pad:function(e,n,r,i){e=null==e?"":t(e),n=~~n;var o=0;switch(r?r.length>1&&(r=r.charAt(0)):r=" ",i){case"right":return o=n-e.length,e+a(r,o);case"both":return o=n-e.length,a(r,Math.ceil(o/2))+e+a(r,Math.floor(o/2));default:return o=n-e.length,a(r,o)+e}},lpad:function(e,t,n){return d.pad(e,t,n)},rpad:function(e,t,n){return d.pad(e,t,n,"right")},lrpad:function(e,t,n){return d.pad(e,t,n,"both")},sprintf:p,vsprintf:function(e,t){return t.unshift(e),p.apply(null,t)},toNumber:function(e,t){return e?(e=d.trim(e),e.match(/^-?\d+(?:\.\d+)?$/)?s(s(e).toFixed(~~t)):0/0):0},numberFormat:function(e,t,n,r){if(isNaN(e)||null==e)return"";e=e.toFixed(~~t),r="string"==typeof r?r:",";var i=e.split("."),o=i[0],s=i[1]?(n||".")+i[1]:"";return o.replace(/(\d)(?=(?:\d{3})+$)/g,"$1"+r)+s},strRight:function(e,n){if(null==e)return"";e=t(e),n=null!=n?t(n):n;var r=n?e.indexOf(n):-1;return~r?e.slice(r+n.length,e.length):e},strRightBack:function(e,n){if(null==e)return"";e=t(e),n=null!=n?t(n):n;var r=n?e.lastIndexOf(n):-1;return~r?e.slice(r+n.length,e.length):e},strLeft:function(e,n){if(null==e)return"";e=t(e),n=null!=n?t(n):n;var r=n?e.indexOf(n):-1;return~r?e.slice(0,r):e},strLeftBack:function(e,t){if(null==e)return"";e+="",t=null!=t?""+t:t;var n=e.lastIndexOf(t);return~n?e.slice(0,n):e},toSentence:function(e,t,n,r){t=t||", ",n=n||" and ";var i=e.slice(),o=i.pop();return e.length>2&&r&&(n=d.rtrim(t)+n),i.length?i.join(t)+n+o:o},toSentenceSerial:function(){var e=u.call(arguments);return e[3]=!0,d.toSentence.apply(d,e)},slugify:function(e){if(null==e)return"";var n="ąàáäâãåæăćęèéëêìíïîłńòóöôõøśșțùúüûñçżź",r="aaaaaaaaaceeeeeiiiilnoooooosstuuuunczz",i=new RegExp(c(n),"g");return e=t(e).toLowerCase().replace(i,function(e){var t=n.indexOf(e);return r.charAt(t)||"-"}),d.dasherize(e.replace(/[^\w\s-]/g,""))},surround:function(e,t){return[t,e,t].join("")},quote:function(e,t){return d.surround(e,t||'"')},unquote:function(e,t){return t=t||'"',e[0]===t&&e[e.length-1]===t?e.slice(1,e.length-1):e},exports:function(){var e={};for(var t in this)this.hasOwnProperty(t)&&!t.match(/^(?:include|contains|reverse)$/)&&(e[t]=this[t]);return e},repeat:function(e,n,r){if(null==e)return"";if(n=~~n,null==r)return a(t(e),n);for(var i=[];n>0;i[--n]=e);return i.join(r)},naturalCmp:function(e,n){if(e==n)return 0;if(!e)return-1;if(!n)return 1;for(var r=/(\.\d+)|(\d+)|(\D+)/g,i=t(e).toLowerCase().match(r),o=t(n).toLowerCase().match(r),s=Math.min(i.length,o.length),a=0;s>a;a++){var u=i[a],c=o[a];if(u!==c){var l=parseInt(u,10);if(!isNaN(l)){var f=parseInt(c,10);if(!isNaN(f)&&l-f)return l-f}return c>u?-1:1}}return i.length===o.length?i.length-o.length:n>e?-1:1},levenshtein:function(e,n){if(null==e&&null==n)return 0;if(null==e)return t(n).length;if(null==n)return t(e).length;e=t(e),n=t(n);for(var r,i,o=[],s=0;s<=n.length;s++)for(var a=0;a<=e.length;a++)i=s&&a?e.charAt(a-1)===n.charAt(s-1)?r:Math.min(o[a],o[a-1],r)+1:s+a,r=o[a],o[a]=i;return o.pop()},toBoolean:function(e,t,r){return"number"==typeof e&&(e=""+e),"string"!=typeof e?!!e:(e=d.trim(e),n(e,t||["true","1"])?!0:n(e,r||["false","0"])?!1:void 0)}};d.strip=d.trim,d.lstrip=d.ltrim,d.rstrip=d.rtrim,d.center=d.lrpad,d.rjust=d.lpad,d.ljust=d.rpad,d.contains=d.include,d.q=d.quote,d.toBool=d.toBoolean,"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(module.exports=d),exports._s=d),"function"==typeof define&&define.amd&&define("underscore.string",[],function(){return d}),e._=e._||{},e._.string=e._.str=d}(this,String),define("String.nocomplex/uncapitalize",[],function(){String.prototype.uncapitalize=function(){return this[0].toLowerCase()+this.substr(1,this.length-1)}}),define("String.nocomplex/String.nocomplex",["underscore.string","./uncapitalize"],function(e){var t=Array.prototype.slice,n=function(n){String.prototype[n]=function(){var r=t.call(arguments);return r.unshift(this),e[n].apply(this,r)}};for(var r in e)e.hasOwnProperty(r)&&n(r);return String.prototype}),define("Array.nocomplex/collect",[],function(){Array.prototype.collect=function(e){var t=[];if("string"==typeof e)for(var n=-1,r=this.length;++nt;t++)e(this[t],t);return this}}),define("Array.nocomplex/first",[],function(){Array.prototype.first=function(e){for(var t=0,n=this.length;n>t;t++)if(e(this[t]))return this[t];return null}}),define("Array.nocomplex/has",[],function(){Array.prototype.has=function(e){for(var t=this.length;t--;)if(this[t]===e)return!0;return!1}}),define("Array.nocomplex/last",[],function(){Array.prototype.last=function(){return this[this.length-1]}}),define("Array.nocomplex/map",[],function(){Array.prototype.map=Array.prototype.map||function(e,t){t&&(e=e.bind(t));var n=this.slice();if("function"==typeof e)for(var r=0,i=n.length;i>r;r++)n[r]=e(n[r],r);else{e=e.substr(2,e.length);for(var r=0,i=n.length;i>r;r++)n[r]=n[r][e]()}return n}}),define("Array.nocomplex/onEls",[],function(){Array.prototype.onEls=function(e){for(var t=this.length;t--;)this[t]=e(this[t],t);return this}}),define("Array.nocomplex/remove",[],function(){Array.prototype.remove=function(e){for(var t=this.length;t--;)this[t]===e&&this.splice(t,1);return this}}),define("Array.nocomplex/removeOneValue",[],function(){Array.prototype.removeOneValue=function(e){for(var t=this.length;t--;)if(this[t]===e)return this.splice(t,1)}}),define("Array.nocomplex/except",[],function(){Array.prototype.except=function(e){for(var t=[],n=0,r=this.length;r>n;n++)this[n]!==e&&t.push(this[n]);return t}}),define("Array.nocomplex/exceptFn",[],function(){Array.prototype.exceptFn=function(e){for(var t=this.slice(),n=t.length;n--;)e(t[n])&&t.splice(n,1);return t}}),define("Array.nocomplex/indexOf",[],function(){Array.prototype.indexOf=Array.prototype.indexOf||function(e){var t,n;for(t=0,n=this.length;n>t;t++)if(this[t]===e)return t;return-1}}),define("Array.nocomplex/isIn",["./has"],function(){Array.prototype.isIn=function(e){for(var t=this.length;t--;)if(!e.has(this[t]))return!1;return!0}}),define("Array.nocomplex/send",[],function(){Array.prototype.send=function(e){var t=Array.prototype.slice.call(arguments);if(t.splice(0,1),"string"==typeof e)for(var n=-1,r=this.length;++nr;r++){var o=e(this[r]);n.has(o)||(t.push(this[r]),n.push(o))}return t}for(var t=[],r=this.length;r--;)!t.has(this[r])&&t.push(this[r]);return t}}),define("Array.nocomplex/equals",["./isIn"],function(){Array.prototype.equals=function(e){return this.isIn(e)&&e.isIn(this)?!0:!1}}),define("Array.nocomplex/find",[],function(){Array.prototype.find=function(e){for(var t=0,n=this.length;n>t;t++)if(e(this[t],t))return this[t];return!1},Array.prototype.findReverse=function(e){for(var t=this.length;t--;)if(e(this[t],t))return this[t];return!1}}),define("Array.nocomplex/where",[],function(){Array.prototype.where=function(e){for(var t=[],n=0,r=this.length;r>n;n++)e(this[n])&&t.push(this[n]);return t}}),define("Array.nocomplex/findIndexOf",[],function(){Array.prototype.findIndexOf=function(e){for(var t=0,n=this.length;n>t;t++)if(e(this[t],t))return t;return!1}}),define("Array.nocomplex/findByKey",[],function(){Array.prototype.findByKey=function(e,t){for(var n=0,r=this.length;r>n;n++)if(this[n][e]===t)return this[n];return!1}}),define("Array.nocomplex/basics",["./collect","./each","./first","./has","./last","./map","./onEls","./remove","./removeOneValue","./remove","./except","./exceptFn","./indexOf","./isIn","./send","./uniq","./equals","./find","./where","./findIndexOf","./findByKey"],function(){return Array.prototype}),define("Array.nocomplex/math/all",[],function(){var e={equals:function(e){for(var t=this.length;t--;)if(e[t]!==this[t])return!1;return!0},multiply:function(e){var t=[];if("number"==typeof e)for(var n=this.length;n--;)t[n]=this[n]*e;else for(var n=this.length;n--;)t[n]=this[n]*e[n];return t},divide:function(e){var t=[];if("number"==typeof e)for(var n=this.length;n--;)t[n]=this[n]/e;else for(var n=this.length;n--;)t[n]=this[n]/e[n];return t},min:function(e){var t=e?this.map(e):this;return Math.min.apply(null,t)},minMax:function(e){return[this.min(e),this.max(e)]},max:function(e){var t=e?this.map(e):this;return Math.max.apply(null,t)},average:function(){for(var e=0,t=this.length;t--;)e+=this[t];return e/this.length},minus:function(e){var t=[];if("number"==typeof e)for(var n=this.length;n--;)t[n]=this[n]-e;else for(var n=this.length;n--;)t[n]=this[n]-e[n];return t},domain:function(e,t){var n,r,i=t&&"number"==typeof t[0]?t[0]:this.min(),o=t&&"number"==typeof t[1]?t[1]:this.max();return i===o?this.map(function(){return e[0]}):(n=(e[1]-e[0])/(o-i),r=(e[0]*o-e[1]*i)/(o-i),this.multiply(n).add(r))},add:function(e){var t=[];if("number"==typeof e)for(var n=this.length;n--;)t[n]=this[n]+e;else for(var n=this.length;n--;)t[n]=this[n]+e[n];return t},round:function(){for(var e=this.length;e--;)this[e]=Math.round(this[e]);return this},sum:function(e){for(var t=0,n=this.length;n--;)t+=e(n);return t},orth:function(){if(2!=this.length)throw Error;return[-this[1],this[0]]},norm:function(){return Math.sqrt(this.sum(function(e){return e*e}))}};for(var t in e)e.hasOwnProperty(t)&&(Array.prototype[t]=e[t]);return Array.prototype}),define("Array.nocomplex/all",["./basics","./math/all"],function(){return Array.prototype}),define("SeedView/Parser",["Seed/Seed"],function(e){return e.extend({parse:function(){console.log("overide me")}})}),define("SeedView/parsers/HTMLParser",["../Parser"],function(e){return e.extend({"+options":{name:"html"},"+constructor":function(){},parse:function(e){var t,n=document.createElement(),r=document.createElement("container");r.innerHTML=e.template,n.appendChild(r.childNodes[0]),e._fragment=n,e._elements={root:e._fragment},t=e.getElementsByAttribute("flag");for(var i=0;ir;r++)a=e(l[r],n),o.appendChild(a);return o}}),define("SeedView/parsers/ToDOMParser",["../Parser","toDOM/toDOM"],function(e,t){return e.extend({"+options":{name:"toDOM"},"+constructor":function(){},parse:function(e){var n={},r=e.getTemplate(),i=t(r,n); return{node:i,elements:n}}})}),define("SeedView/parsers/DOMParser",["../Parser"],function(e){return e.extend({"+options":{name:"dom"},"+constructor":function(){},parse:function(e){return{node:e.getTemplate()}}})}),define("SeedView/parsers/defaultParsers",["./HTMLParser","./ToDOMParser","./DOMParser"],function(e,t,n){return{toDOM:new t,html:new e,dom:new n}}),define("SeedView/SeedView",["Seed/Seed","mangrove-utils/dom/all","Array.nocomplex/isArray","String.nocomplex/String.nocomplex","Array.nocomplex/all","./parsers/defaultParsers"],function(e,t,n,r,i,o){var s=e.extend({type:"View",accessors:["data","node","template","elements"],"+options":{parser:"toDOM",template:null,events:null,data:null,parsers:o,subviews:null,contained:null,elements:null,node:null},_isView:!0,"+constructor":function(){this.data=this.data||{},this.subviews=this.subviews||{},this.contained=this.contained||{},this.elements=this.elements||{},this.detectParser(),this.parse(),"function"==typeof this.data&&(this.data=this.data.bind(this)()),this.events&&this.DOMEvent(this.events),this._displayState={}},hasElement:function(e){return!!this.elements[e]},buildSubviews:function(){this.eachElement(function(e,t){this.subviews[t]=new s({template:e})}.bind(this))},eachElement:function(e){var t=Object.keys(this.elements),n=this.elements;t.each(function(t){e(n[t],t)})},parse:function(){var e,t,n=this.parsers[this.parser];if(!n)throw new Error("No parser: "+this.parser);if(e=n.parse(this),!e)throw new Error("Parse error ");if(!e.node)throw new Error("No node given from parse");this.setNode(e.node),t=e.elements,t||(t={}),t.root=e.node,this.setElements(t)},addElement:function(e,t){this.elements[e]=t,this.contained[e]=[]},subview:function(e){return this.subviews[e]},getElementById:function(e,t){return t||(t=e,e="root"),this.element(e).getElementById(t)},getElementsByClassName:function(e,t){return t||(t=e,e="root"),this.element(e).getElementsByClassName(t)},detectParser:function(){if(!this.template)throw new Error("views/View needs a valid template");this.parser||(this.template.nodeName?this.parser="dom":"string"==typeof this.template&&"<"===this.template.charAt(0)&&(this.parser="html"))},getElementByAttribute:function(e,t){for(var n=this.element("root").getElementsByTagName("*"),r=0;ra;a++)t.addEventListener(e,s[a],function(e){r.apply(o,[e,o])},!!i)}(o,r,u);return u},checkArguments:function(e,t){var n=Array.prototype.slice.call(e);return n.length===t},toggle:function(e){e=e||"root","undefined"==typeof this._displayState[e]&&(this._displayState[e]=1),this._displayState[e]?this.hide(e):this.show(e)},show:function(e){e=e||"root",this.css(e,{display:"block"}),this._displayState[e]=1},hide:function(e){e=e||"root",this.css(e,{display:"none"}),this._displayState[e]=0},prepend:function(){},attachEvent:function(e,n,r){this.checkArguments(arguments,2)&&(r=n,n=e,e="root");var i=this.element(e);t.addEventListener(i,n,r.bind(this))},attachEvents:function(e,t){t||(t=e,e="root");for(var n in t)t.hasOwnProperty(n)&&this.attachEvent(e,n,t[n])},css:function(e,t){var n,r;if(this.checkArguments(arguments,1)&&(t=e,e="root"),n=this.element(e),r=n.style,"string"!=typeof t)for(var i in t)if(t.hasOwnProperty(i))r[i]=t[i];else for(var i in n)if(n.hasOwnProperty(i)&&i==t)return r[t]},attr:function(e,t){var n;this.checkArguments(arguments,1)&&(t=e,e="root"),n=this.element(e);for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r])},append:function(e,t){t||(t=e,e="root"),this.element(e).appendChild(t)},innerText:function(e,t){var n;"undefined"==typeof t&&(t=e,e="root"),n=this.element(e),"innerText"in n?n.innerText=t:n.textContent=t},innerHTML:function(e,t){e=e||"root";var n=this.element(e);n.innerHTML=t},hasClass:function(e,t){this.checkArguments(arguments,1)&&(t=e,e="root");var n=this.element(e);return new RegExp("(\\s|^)"+t+"(\\s|$)").test(n.className)},addClass:function(e,t){this.checkArguments(arguments,1)&&(t=e,e="root");var n=this.element(e);this.hasClass(e,t)||(n.className+=(n.className?" ":"")+t)},removeClass:function(e,t){this.checkArguments(arguments,1)&&(t=e,e="root");var n=this.element(e);this.hasClass(e,t)&&(n.className=n.className.replace(new RegExp("(\\s|^)"+t+"(\\s|$)")," ").replace(/^\s+|\s+$/g,""))},insert:function(e,t){t||(t=e,e="container"),t=Array.isArray(t)?t:[t],this.contained[e]=this.contained[e]||[],t.each(function(t){this.insertView(e,t)}.bind(this))},viewContained:function(e){return e||(e="container"),this.contained[e]},insertView:function(e,t){this.contained[e].push(t),this.element(e).appendChild(t.html())},insertAt:function(e,t,n){var r;e=e||"container",r=this.element(e),r.insertBefore(t.html(),r.childNodes[n])},reoder:function(e,t,n){var r=this.contained[e].indexOf(t);e=e||"container",-1!==r&&(this.contained[e].splice(n,0,this.contained[e].splice(r,1)[0]),this.remove(e,t),this.insertAt(e,t,n))},removeAll:function(e){if(e||(e="container"),this.hasContained(e))for(var t=0;t