/**
 * @license almond 0.3.1 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
 */

/*!
 * jQuery JavaScript Library v2.1.4
 * http://jquery.com/
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 *
 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: 2015-04-28T16:01Z
 */

/*!
 * Sizzle CSS Selector Engine v2.2.0-pre
 * http://sizzlejs.com/
 *
 * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: 2014-12-16
 */

//     Underscore.js 1.8.3
//     http://underscorejs.org
//     (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Underscore may be freely distributed under the MIT license.

// Released under MIT license
// Copyright (c) 2009-2010 Dominic Baggott
// Copyright (c) 2009-2010 Ash Berlin
// Copyright (c) 2011 Christoph Dorn <christoph@christophdorn.com> (http://www.christophdorn.com)

/*! http://mths.be/he v0.4.1 by @mathias | MIT license */

/*
 * to-markdown - an HTML to Markdown converter
 *
 * Copyright 2011, Dom Christie
 * Licenced under the MIT licence
 *
 */

//     (c) 2010-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Backbone may be freely distributed under the MIT license.
//     For all details and documentation:
//     http://backbonejs.org

// MarionetteJS (Backbone.Marionette)
// ----------------------------------
// v2.4.2
//
// Copyright (c)2015 Derick Bailey, Muted Solutions, LLC.
// Distributed under MIT license
//
// http://marionettejs.com

/*!
 * Includes BabySitter
 * https://github.com/marionettejs/backbone.babysitter/
 *
 * Includes Wreqr
 * https://github.com/marionettejs/backbone.wreqr/
 */

// Copyright (c)2015 Derick Bailey, Muted Solutions, LLC.

// Distributed under MIT license

/** @description Precise type-checker for JavaScript
             * @version 1.0.0
             * @date 2014-11-27
             * @copyright 2014
             * https://github.com/patik/kind
             */

/**
 * @license RequireJS text 2.0.14 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/requirejs/text for details
 */

// Backbone.Syphon, v0.4.1
// Copyright (c)2012 Derick Bailey, Muted Solutions, LLC.
// Distributed under MIT license
// http://github.com/derickbailey/backbone.syphon

// ┌────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël 2.1.4 - JavaScript Vector Library                          │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com)    │ \\
// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com)              │ \\
// ├────────────────────────────────────────────────────────────────────┤ \\
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\
// └────────────────────────────────────────────────────────────────────┘ \\
// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
// http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ┌────────────────────────────────────────────────────────────┐ \\
// │ Eve 0.4.2 - JavaScript Events Library                      │ \\
// ├────────────────────────────────────────────────────────────┤ \\
// │ Author Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) │ \\
// └────────────────────────────────────────────────────────────┘ \\

// ┌─────────────────────────────────────────────────────────────────────┐ \\
// │ "Raphaël 2.1.2" - JavaScript Vector Library                         │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com)   │ \\
// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com)             │ \\
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
// └─────────────────────────────────────────────────────────────────────┘ \\

// ┌─────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël - JavaScript Vector Library                                 │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ SVG Module                                                          │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com)   │ \\
// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com)             │ \\
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
// └─────────────────────────────────────────────────────────────────────┘ \\

// ┌─────────────────────────────────────────────────────────────────────┐ \\
// │ Raphaël - JavaScript Vector Library                                 │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ VML Module                                                          │ \\
// ├─────────────────────────────────────────────────────────────────────┤ \\
// │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com)   │ \\
// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com)             │ \\
// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\
// └─────────────────────────────────────────────────────────────────────┘ \\

/* @license
morris.js v0.5.0
Copyright 2014 Olly Smith All rights reserved.
Licensed under the BSD-2-Clause License.
*/

// add options to blend_license <select>

var requirejs,require,define;(function(e){function h(e,t){return f.call(e,t)}function p(e,t){var n,r,i,s,o,a,f,l,h,p,d,v=t&&t.split("/"),m=u.map,g=m&&m["*"]||{};if(e&&e.charAt(0)===".")if(t){e=e.split("/"),o=e.length-1,u.nodeIdCompat&&c.test(e[o])&&(e[o]=e[o].replace(c,"")),e=v.slice(0,v.length-1).concat(e);for(h=0;h<e.length;h+=1){d=e[h];if(d===".")e.splice(h,1),h-=1;else if(d===".."){if(h===1&&(e[2]===".."||e[0]===".."))break;h>0&&(e.splice(h-1,2),h-=2)}}e=e.join("/")}else e.indexOf("./")===0&&(e=e.substring(2));if((v||g)&&m){n=e.split("/");for(h=n.length;h>0;h-=1){r=n.slice(0,h).join("/");if(v)for(p=v.length;p>0;p-=1){i=m[v.slice(0,p).join("/")];if(i){i=i[r];if(i){s=i,a=h;break}}}if(s)break;!f&&g&&g[r]&&(f=g[r],l=h)}!s&&f&&(s=f,a=l),s&&(n.splice(0,a,s),e=n.join("/"))}return e}function d(t,r){return function(){var i=l.call(arguments,0);return typeof i[0]!="string"&&i.length===1&&i.push(null),n.apply(e,i.concat([t,r]))}}function v(e){return function(t){return p(t,e)}}function m(e){return function(t){s[e]=t}}function g(n){if(h(o,n)){var r=o[n];delete o[n],a[n]=!0,t.apply(e,r)}if(!h(s,n)&&!h(a,n))throw new Error("No "+n);return s[n]}function y(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 b(e){return function(){return u&&u.config&&u.config[e]||{}}}var t,n,r,i,s={},o={},u={},a={},f=Object.prototype.hasOwnProperty,l=[].slice,c=/\.js$/;r=function(e,t){var n,r=y(e),i=r[0];return e=r[1],i&&(i=p(i,t),n=g(i)),i?n&&n.normalize?e=n.normalize(e,v(t)):e=p(e,t):(e=p(e,t),r=y(e),i=r[0],e=r[1],i&&(n=g(i))),{f:i?i+"!"+e:e,n:e,pr:i,p:n}},i={require:function(e){return d(e)},exports:function(e){var t=s[e];return typeof t!="undefined"?t:s[e]={}},module:function(e){return{id:e,uri:"",exports:s[e],config:b(e)}}},t=function(t,n,u,f){var l,c,p,v,y,b=[],w=typeof u,E;f=f||t;if(w==="undefined"||w==="function"){n=!n.length&&u.length?["require","exports","module"]:n;for(y=0;y<n.length;y+=1){v=r(n[y],f),c=v.f;if(c==="require")b[y]=i.require(t);else if(c==="exports")b[y]=i.exports(t),E=!0;else if(c==="module")l=b[y]=i.module(t);else if(h(s,c)||h(o,c)||h(a,c))b[y]=g(c);else{if(!v.p)throw new Error(t+" missing "+c);v.p.load(v.n,d(f,!0),m(c),{}),b[y]=s[c]}}p=u?u.apply(s[t],b):undefined;if(t)if(l&&l.exports!==e&&l.exports!==s[t])s[t]=l.exports;else if(p!==e||!E)s[t]=p}else t&&(s[t]=u)},requirejs=require=n=function(s,o,a,f,l){if(typeof s=="string")return i[s]?i[s](o):g(r(s,o).f);if(!s.splice){u=s,u.deps&&n(u.deps,u.callback);if(!o)return;o.splice?(s=o,o=a,a=null):s=e}return o=o||function(){},typeof a=="function"&&(a=f,f=l),f?t(e,s,o,a):setTimeout(function(){t(e,s,o,a)},4),n},n.config=function(e){return n(e)},requirejs._defined=s,define=function(e,t,n){if(typeof e!="string")throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),!h(s,e)&&!h(o,e)&&(o[e]=[e,t,n])},define.amd={jQuery:!0}})(),define("vendor/almond/almond",function(){}),function(e,t){typeof module=="object"&&typeof module.exports=="object"?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}(typeof window!="undefined"?window:this,function(window,noGlobal){function isArraylike(e){var t="length"in e&&e.length,n=jQuery.type(e);return n==="function"||jQuery.isWindow(e)?!1:e.nodeType===1&&t?!0:n==="array"||t===0||typeof t=="number"&&t>0&&t-1 in e}function winnow(e,t,n){if(jQuery.isFunction(t))return jQuery.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return jQuery.grep(e,function(e){return e===t!==n});if(typeof t=="string"){if(risSimple.test(t))return jQuery.filter(t,e,n);t=jQuery.filter(t,e)}return jQuery.grep(e,function(e){return indexOf.call(t,e)>=0!==n})}function sibling(e,t){while((e=e[t])&&e.nodeType!==1);return e}function createOptions(e){var t=optionsCache[e]={};return jQuery.each(e.match(rnotwhite)||[],function(e,n){t[n]=!0}),t}function completed(){document.removeEventListener("DOMContentLoaded",completed,!1),window.removeEventListener("load",completed,!1),jQuery.ready()}function Data(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=jQuery.expando+Data.uid++}function dataAttr(e,t,n){var r;if(n===undefined&&e.nodeType===1){r="data-"+t.replace(rmultiDash,"-$1").toLowerCase(),n=e.getAttribute(r);if(typeof n=="string"){try{n=n==="true"?!0:n==="false"?!1:n==="null"?null:+n+""===n?+n:rbrace.test(n)?jQuery.parseJSON(n):n}catch(i){}data_user.set(e,t,n)}else n=undefined}return n}function returnTrue(){return!0}function returnFalse(){return!1}function safeActiveElement(){try{return document.activeElement}catch(e){}}function manipulationTarget(e,t){return jQuery.nodeName(e,"table")&&jQuery.nodeName(t.nodeType!==11?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function disableScript(e){return e.type=(e.getAttribute("type")!==null)+"/"+e.type,e}function restoreScript(e){var t=rscriptTypeMasked.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function setGlobalEval(e,t){var n=0,r=e.length;for(;n<r;n++)data_priv.set(e[n],"globalEval",!t||data_priv.get(t[n],"globalEval"))}function cloneCopyEvent(e,t){var n,r,i,s,o,u,a,f;if(t.nodeType!==1)return;if(data_priv.hasData(e)){s=data_priv.access(e),o=data_priv.set(t,s),f=s.events;if(f){delete o.handle,o.events={};for(i in f)for(n=0,r=f[i].length;n<r;n++)jQuery.event.add(t,i,f[i][n])}}data_user.hasData(e)&&(u=data_user.access(e),a=jQuery.extend({},u),data_user.set(t,a))}function getAll(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return t===undefined||t&&jQuery.nodeName(e,t)?jQuery.merge([e],n):n}function fixInput(e,t){var n=t.nodeName.toLowerCase();if(n==="input"&&rcheckableType.test(e.type))t.checked=e.checked;else if(n==="input"||n==="textarea")t.defaultValue=e.defaultValue}function actualDisplay(e,t){var n,r=jQuery(t.createElement(e)).appendTo(t.body),i=window.getDefaultComputedStyle&&(n=window.getDefaultComputedStyle(r[0]))?n.display:jQuery.css(r[0],"display");return r.detach(),i}function defaultDisplay(e){var t=document,n=elemdisplay[e];if(!n){n=actualDisplay(e,t);if(n==="none"||!n)iframe=(iframe||jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=iframe[0].contentDocument,t.write(),t.close(),n=actualDisplay(e,t),iframe.detach();elemdisplay[e]=n}return n}function curCSS(e,t,n){var r,i,s,o,u=e.style;return n=n||getStyles(e),n&&(o=n.getPropertyValue(t)||n[t]),n&&(o===""&&!jQuery.contains(e.ownerDocument,e)&&(o=jQuery.style(e,t)),rnumnonpx.test(o)&&rmargin.test(t)&&(r=u.width,i=u.minWidth,s=u.maxWidth,u.minWidth=u.maxWidth=u.width=o,o=n.width,u.width=r,u.minWidth=i,u.maxWidth=s)),o!==undefined?o+"":o}function addGetHookIf(e,t){return{get:function(){if(e()){delete this.get;return}return(this.get=t).apply(this,arguments)}}}function vendorPropName(e,t){if(t in e)return t;var n=t[0].toUpperCase()+t.slice(1),r=t,i=cssPrefixes.length;while(i--){t=cssPrefixes[i]+n;if(t in e)return t}return r}function setPositiveNumber(e,t,n){var r=rnumsplit.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function augmentWidthOrHeight(e,t,n,r,i){var s=n===(r?"border":"content")?4:t==="width"?1:0,o=0;for(;s<4;s+=2)n==="margin"&&(o+=jQuery.css(e,n+cssExpand[s],!0,i)),r?(n==="content"&&(o-=jQuery.css(e,"padding"+cssExpand[s],!0,i)),n!=="margin"&&(o-=jQuery.css(e,"border"+cssExpand[s]+"Width",!0,i))):(o+=jQuery.css(e,"padding"+cssExpand[s],!0,i),n!=="padding"&&(o+=jQuery.css(e,"border"+cssExpand[s]+"Width",!0,i)));return o}function getWidthOrHeight(e,t,n){var r=!0,i=t==="width"?e.offsetWidth:e.offsetHeight,s=getStyles(e),o=jQuery.css(e,"boxSizing",!1,s)==="border-box";if(i<=0||i==null){i=curCSS(e,t,s);if(i<0||i==null)i=e.style[t];if(rnumnonpx.test(i))return i;r=o&&(support.boxSizingReliable()||i===e.style[t]),i=parseFloat(i)||0}return i+augmentWidthOrHeight(e,t,n||(o?"border":"content"),r,s)+"px"}function showHide(e,t){var n,r,i,s=[],o=0,u=e.length;for(;o<u;o++){r=e[o];if(!r.style)continue;s[o]=data_priv.get(r,"olddisplay"),n=r.style.display,t?(!s[o]&&n==="none"&&(r.style.display=""),r.style.display===""&&isHidden(r)&&(s[o]=data_priv.access(r,"olddisplay",defaultDisplay(r.nodeName)))):(i=isHidden(r),(n!=="none"||!i)&&data_priv.set(r,"olddisplay",i?n:jQuery.css(r,"display")))}for(o=0;o<u;o++){r=e[o];if(!r.style)continue;if(!t||r.style.display==="none"||r.style.display==="")r.style.display=t?s[o]||"":"none"}return e}function Tween(e,t,n,r,i){return new Tween.prototype.init(e,t,n,r,i)}function createFxNow(){return setTimeout(function(){fxNow=undefined}),fxNow=jQuery.now()}function genFx(e,t){var n,r=0,i={height:e};t=t?1:0;for(;r<4;r+=2-t)n=cssExpand[r],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function createTween(e,t,n){var r,i=(tweeners[t]||[]).concat(tweeners["*"]),s=0,o=i.length;for(;s<o;s++)if(r=i[s].call(n,t,e))return r}function defaultPrefilter(e,t,n){var r,i,s,o,u,a,f,l,c=this,h={},p=e.style,d=e.nodeType&&isHidden(e),v=data_priv.get(e,"fxshow");n.queue||(u=jQuery._queueHooks(e,"fx"),u.unqueued==null&&(u.unqueued=0,a=u.empty.fire,u.empty.fire=function(){u.unqueued||a()}),u.unqueued++,c.always(function(){c.always(function(){u.unqueued--,jQuery.queue(e,"fx").length||u.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],f=jQuery.css(e,"display"),l=f==="none"?data_priv.get(e,"olddisplay")||defaultDisplay(e.nodeName):f,l==="inline"&&jQuery.css(e,"float")==="none"&&(p.display="inline-block")),n.overflow&&(p.overflow="hidden",c.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){i=t[r];if(rfxtypes.exec(i)){delete t[r],s=s||i==="toggle";if(i===(d?"hide":"show")){if(i!=="show"||!v||v[r]===undefined)continue;d=!0}h[r]=v&&v[r]||jQuery.style(e,r)}else f=undefined}if(!jQuery.isEmptyObject(h)){v?"hidden"in v&&(d=v.hidden):v=data_priv.access(e,"fxshow",{}),s&&(v.hidden=!d),d?jQuery(e).show():c.done(function(){jQuery(e).hide()}),c.done(function(){var t;data_priv.remove(e,"fxshow");for(t in h)jQuery.style(e,t,h[t])});for(r in h)o=createTween(d?v[r]:0,r,c),r in v||(v[r]=o.start,d&&(o.end=o.start,o.start=r==="width"||r==="height"?1:0))}else(f==="none"?defaultDisplay(e.nodeName):f)==="inline"&&(p.display=f)}function propFilter(e,t){var n,r,i,s,o;for(n in e){r=jQuery.camelCase(n),i=t[r],s=e[n],jQuery.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=jQuery.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Animation(e,t,n){var r,i,s=0,o=animationPrefilters.length,u=jQuery.Deferred().always(function(){delete a.elem}),a=function(){if(i)return!1;var t=fxNow||createFxNow(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,s=1-r,o=0,a=f.tweens.length;for(;o<a;o++)f.tweens[o].run(s);return u.notifyWith(e,[f,s,n]),s<1&&a?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:jQuery.extend({},t),opts:jQuery.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:fxNow||createFxNow(),duration:n.duration,tweens:[],createTween:function(t,n){var r=jQuery.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(r),r},stop:function(t){var n=0,r=t?f.tweens.length:0;if(i)return this;i=!0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;propFilter(l,f.opts.specialEasing);for(;s<o;s++){r=animationPrefilters[s].call(f,e,l,f.opts);if(r)return r}return jQuery.map(l,createTween,f),jQuery.isFunction(f.opts.start)&&f.opts.start.call(e,f),jQuery.fx.timer(jQuery.extend(a,{elem:e,anim:f,queue:f.opts.queue})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function addToPrefiltersOrTransports(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i=0,s=t.toLowerCase().match(rnotwhite)||[];if(jQuery.isFunction(n))while(r=s[i++])r[0]==="+"?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function inspectPrefiltersOrTransports(e,t,n,r){function o(u){var a;return i[u]=!0,jQuery.each(e[u]||[],function(e,u){var f=u(t,n,r);if(typeof f=="string"&&!s&&!i[f])return t.dataTypes.unshift(f),o(f),!1;if(s)return!(a=f)}),a}var i={},s=e===transports;return o(t.dataTypes[0])||!i["*"]&&o("*")}function ajaxExtend(e,t){var n,r,i=jQuery.ajaxSettings.flatOptions||{};for(n in t)t[n]!==undefined&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&jQuery.extend(!0,e,r),e}function ajaxHandleResponses(e,t,n){var r,i,s,o,u=e.contents,a=e.dataTypes;while(a[0]==="*")a.shift(),r===undefined&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in u)if(u[i]&&u[i].test(r)){a.unshift(i);break}if(a[0]in n)s=a[0];else{for(i in n){if(!a[0]||e.converters[i+" "+a[0]]){s=i;break}o||(o=i)}s=s||o}if(s)return s!==a[0]&&a.unshift(s),n[s]}function ajaxConvert(e,t,n,r){var i,s,o,u,a,f={},l=e.dataTypes.slice();if(l[1])for(o in e.converters)f[o.toLowerCase()]=e.converters[o];s=l.shift();while(s){e.responseFields[s]&&(n[e.responseFields[s]]=t),!a&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),a=s,s=l.shift();if(s)if(s==="*")s=a;else if(a!=="*"&&a!==s){o=f[a+" "+s]||f["* "+s];if(!o)for(i in f){u=i.split(" ");if(u[1]===s){o=f[a+" "+u[0]]||f["* "+u[0]];if(o){o===!0?o=f[i]:f[i]!==!0&&(s=u[0],l.unshift(u[1]));break}}}if(o!==!0)if(o&&e["throws"])t=o(t);else try{t=o(t)}catch(c){return{state:"parsererror",error:o?c:"No conversion from "+a+" to "+s}}}}return{state:"success",data:t}}function buildParams(e,t,n,r){var i;if(jQuery.isArray(t))jQuery.each(t,function(t,i){n||rbracket.test(e)?r(e,i):buildParams(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&jQuery.type(t)==="object")for(i in t)buildParams(e+"["+i+"]",t[i],n,r);else r(e,t)}function getWindow(e){return jQuery.isWindow(e)?e:e.nodeType===9&&e.defaultView}var arr=[],slice=arr.slice,concat=arr.concat,push=arr.push,indexOf=arr.indexOf,class2type={},toString=class2type.toString,hasOwn=class2type.hasOwnProperty,support={},document=window.document,version="2.1.4",jQuery=function(e,t){return new jQuery.fn.init(e,t)},rtrim=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,rmsPrefix=/^-ms-/,rdashAlpha=/-([\da-z])/gi,fcamelCase=function(e,t){return t.toUpperCase()};jQuery.fn=jQuery.prototype={jquery:version,constructor:jQuery,selector:"",length:0,toArray:function(){return slice.call(this)},get:function(e){return e!=null?e<0?this[e+this.length]:this[e]:slice.call(this)},pushStack:function(e){var t=jQuery.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return jQuery.each(this,e,t)},map:function(e){return this.pushStack(jQuery.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(slice.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:push,sort:arr.sort,splice:arr.splice},jQuery.extend=jQuery.fn.extend=function(){var e,t,n,r,i,s,o=arguments[0]||{},u=1,a=arguments.length,f=!1;typeof o=="boolean"&&(f=o,o=arguments[u]||{},u++),typeof o!="object"&&!jQuery.isFunction(o)&&(o={}),u===a&&(o=this,u--);for(;u<a;u++)if((e=arguments[u])!=null)for(t in e){n=o[t],r=e[t];if(o===r)continue;f&&r&&(jQuery.isPlainObject(r)||(i=jQuery.isArray(r)))?(i?(i=!1,s=n&&jQuery.isArray(n)?n:[]):s=n&&jQuery.isPlainObject(n)?n:{},o[t]=jQuery.extend(f,s,r)):r!==undefined&&(o[t]=r)}return o},jQuery.extend({expando:"jQuery"+(version+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return jQuery.type(e)==="function"},isArray:Array.isArray,isWindow:function(e){return e!=null&&e===e.window},isNumeric:function(e){return!jQuery.isArray(e)&&e-parseFloat(e)+1>=0},isPlainObject:function(e){return jQuery.type(e)!=="object"||e.nodeType||jQuery.isWindow(e)?!1:e.constructor&&!hasOwn.call(e.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return e==null?e+"":typeof e=="object"||typeof e=="function"?class2type[toString.call(e)]||"object":typeof e},globalEval:function(code){var script,indirect=eval;code=jQuery.trim(code),code&&(code.indexOf("use strict")===1?(script=document.createElement("script"),script.text=code,document.head.appendChild(script).parentNode.removeChild(script)):indirect(code))},camelCase:function(e){return e.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,s=e.length,o=isArraylike(e);if(n)if(o)for(;i<s;i++){r=t.apply(e[i],n);if(r===!1)break}else for(i in e){r=t.apply(e[i],n);if(r===!1)break}else if(o)for(;i<s;i++){r=t.call(e[i],i,e[i]);if(r===!1)break}else for(i in e){r=t.call(e[i],i,e[i]);if(r===!1)break}return e},trim:function(e){return e==null?"":(e+"").replace(rtrim,"")},makeArray:function(e,t){var n=t||[];return e!=null&&(isArraylike(Object(e))?jQuery.merge(n,typeof e=="string"?[e]:e):push.call(n,e)),n},inArray:function(e,t,n){return t==null?-1:indexOf.call(t,e,n)},merge:function(e,t){var n=+t.length,r=0,i=e.length;for(;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length,u=!n;for(;s<o;s++)r=!t(e[s],s),r!==u&&i.push(e[s]);return i},map:function(e,t,n){var r,i=0,s=e.length,o=isArraylike(e),u=[];if(o)for(;i<s;i++)r=t(e[i],i,n),r!=null&&u.push(r);else for(i in e)r=t(e[i],i,n),r!=null&&u.push(r);return concat.apply([],u)},guid:1,proxy:function(e,t){var n,r,i;return typeof t=="string"&&(n=e[t],t=e,e=n),jQuery.isFunction(e)?(r=slice.call(arguments,2),i=function(){return e.apply(t||this,r.concat(slice.call(arguments)))},i.guid=e.guid=e.guid||jQuery.guid++,i):undefined},now:Date.now,support:support}),jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){class2type["[object "+t+"]"]=t.toLowerCase()});var Sizzle=function(e){function ot(e,t,r,i){var s,u,f,l,c,d,g,y,S,x;(t?t.ownerDocument||t:E)!==p&&h(t),t=t||p,r=r||[],l=t.nodeType;if(typeof e!="string"||!e||l!==1&&l!==9&&l!==11)return r;if(!i&&v){if(l!==11&&(s=Z.exec(e)))if(f=s[1]){if(l===9){u=t.getElementById(f);if(!u||!u.parentNode)return r;if(u.id===f)return r.push(u),r}else if(t.ownerDocument&&(u=t.ownerDocument.getElementById(f))&&b(t,u)&&u.id===f)return r.push(u),r}else{if(s[2])return D.apply(r,t.getElementsByTagName(e)),r;if((f=s[3])&&n.getElementsByClassName)return D.apply(r,t.getElementsByClassName(f)),r}if(n.qsa&&(!m||!m.test(e))){y=g=w,S=t,x=l!==1&&e;if(l===1&&t.nodeName.toLowerCase()!=="object"){d=o(e),(g=t.getAttribute("id"))?y=g.replace(tt,"\\$&"):t.setAttribute("id",y),y="[id='"+y+"'] ",c=d.length;while(c--)d[c]=y+gt(d[c]);S=et.test(e)&&vt(t.parentNode)||t,x=d.join(",")}if(x)try{return D.apply(r,S.querySelectorAll(x)),r}catch(T){}finally{g||t.removeAttribute("id")}}}return a(e.replace(z,"$1"),t,r,i)}function ut(){function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}var e=[];return t}function at(e){return e[w]=!0,e}function ft(e){var t=p.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function lt(e,t){var n=e.split("|"),i=e.length;while(i--)r.attrHandle[n[i]]=t}function ct(e,t){var n=t&&e,r=n&&e.nodeType===1&&t.nodeType===1&&(~t.sourceIndex||L)-(~e.sourceIndex||L);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ht(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function pt(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function dt(e){return at(function(t){return t=+t,at(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function vt(e){return e&&typeof e.getElementsByTagName!="undefined"&&e}function mt(){}function gt(e){var t=0,n=e.length,r="";for(;t<n;t++)r+=e[t].value;return r}function yt(e,t,n){var r=t.dir,i=n&&r==="parentNode",s=x++;return t.first?function(t,n,s){while(t=t[r])if(t.nodeType===1||i)return e(t,n,s)}:function(t,n,o){var u,a,f=[S,s];if(o){while(t=t[r])if(t.nodeType===1||i)if(e(t,n,o))return!0}else while(t=t[r])if(t.nodeType===1||i){a=t[w]||(t[w]={});if((u=a[r])&&u[0]===S&&u[1]===s)return f[2]=u[2];a[r]=f;if(f[2]=e(t,n,o))return!0}}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function wt(e,t,n){var r=0,i=t.length;for(;r<i;r++)ot(e,t[r],n);return n}function Et(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function St(e,t,n,r,i,s){return r&&!r[w]&&(r=St(r)),i&&!i[w]&&(i=St(i,s)),at(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||wt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?Et(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=Et(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?H(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=Et(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):D.apply(o,g)})}function xt(e){var t,n,i,s=e.length,o=r.relative[e[0].type],u=o||r.relative[" "],a=o?1:0,l=yt(function(e){return e===t},u,!0),c=yt(function(e){return H(t,e)>-1},u,!0),h=[function(e,n,r){var i=!o&&(r||n!==f)||((t=n).nodeType?l(e,n,r):c(e,n,r));return t=null,i}];for(;a<s;a++)if(n=r.relative[e[a].type])h=[yt(bt(h),n)];else{n=r.filter[e[a].type].apply(null,e[a].matches);if(n[w]){i=++a;for(;i<s;i++)if(r.relative[e[i].type])break;return St(a>1&&bt(h),a>1&&gt(e.slice(0,a-1).concat({value:e[a-2].type===" "?"*":""})).replace(z,"$1"),n,a<i&&xt(e.slice(a,i)),i<s&&xt(e=e.slice(i)),i<s&&gt(e))}h.push(n)}return bt(h)}function Tt(e,t){var n=t.length>0,i=e.length>0,s=function(s,o,u,a,l){var c,h,d,v=0,m="0",g=s&&[],y=[],b=f,w=s||i&&r.find.TAG("*",l),E=S+=b==null?1:Math.random()||.1,x=w.length;l&&(f=o!==p&&o);for(;m!==x&&(c=w[m])!=null;m++){if(i&&c){h=0;while(d=e[h++])if(d(c,o,u)){a.push(c);break}l&&(S=E)}n&&((c=!d&&c)&&v--,s&&g.push(c))}v+=m;if(n&&m!==v){h=0;while(d=t[h++])d(g,y,o,u);if(s){if(v>0)while(m--)!g[m]&&!y[m]&&(y[m]=M.call(a));y=Et(y)}D.apply(a,y),l&&!s&&y.length>0&&v+t.length>1&&ot.uniqueSort(a)}return l&&(S=E,f=b),g};return n?at(s):s}var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w="sizzle"+1*new Date,E=e.document,S=0,x=0,T=ut(),N=ut(),C=ut(),k=function(e,t){return e===t&&(c=!0),0},L=1<<31,A={}.hasOwnProperty,O=[],M=O.pop,_=O.push,D=O.push,P=O.slice,H=function(e,t){var n=0,r=e.length;for(;n<r;n++)if(e[n]===t)return n;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",j="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",I=F.replace("w","w#"),q="\\["+j+"*("+F+")(?:"+j+"*([*^$|!~]?=)"+j+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+j+"*\\]",R=":("+F+")(?:\\(("+"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|"+"((?:\\\\.|[^\\\\()[\\]]|"+q+")*)|"+".*"+")\\)|)",U=new RegExp(j+"+","g"),z=new RegExp("^"+j+"+|((?:^|[^\\\\])(?:\\\\.)*)"+j+"+$","g"),W=new RegExp("^"+j+"*,"+j+"*"),X=new RegExp("^"+j+"*([>+~]|"+j+")"+j+"*"),V=new RegExp("="+j+"*([^\\]'\"]*?)"+j+"*\\]","g"),$=new RegExp(R),J=new RegExp("^"+I+"$"),K={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),TAG:new RegExp("^("+F.replace("w","w*")+")"),ATTR:new RegExp("^"+q),PSEUDO:new RegExp("^"+R),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+j+"*(even|odd|(([+-]|)(\\d*)n|)"+j+"*(?:([+-]|)"+j+"*(\\d+)|))"+j+"*\\)|)","i"),bool:new RegExp("^(?:"+B+")$","i"),needsContext:new RegExp("^"+j+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+j+"*((?:-\\d)?\\d*)"+j+"*\\)|)(?=[^-]|$)","i")},Q=/^(?:input|select|textarea|button)$/i,G=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/[+~]/,tt=/'|\\/g,nt=new RegExp("\\\\([\\da-f]{1,6}"+j+"?|("+j+")|.)","ig"),rt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,r&1023|56320)},it=function(){h()};try{D.apply(O=P.call(E.childNodes),E.childNodes),O[E.childNodes.length].nodeType}catch(st){D={apply:O.length?function(e,t){_.apply(e,P.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}n=ot.support={},s=ot.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},h=ot.setDocument=function(e){var t,i,o=e?e.ownerDocument||e:E;if(o===p||o.nodeType!==9||!o.documentElement)return p;p=o,d=o.documentElement,i=o.defaultView,i&&i!==i.top&&(i.addEventListener?i.addEventListener("unload",it,!1):i.attachEvent&&i.attachEvent("onunload",it)),v=!s(o),n.attributes=ft(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ft(function(e){return e.appendChild(o.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Y.test(o.getElementsByClassName),n.getById=ft(function(e){return d.appendChild(e).id=w,!o.getElementsByName||!o.getElementsByName(w).length}),n.getById?(r.find.ID=function(e,t){if(typeof t.getElementById!="undefined"&&v){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},r.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){return e.getAttribute("id")===t}}):(delete r.find.ID,r.filter.ID=function(e){var t=e.replace(nt,rt);return function(e){var n=typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id");return n&&n.value===t}}),r.find.TAG=n.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!="undefined")return t.getElementsByTagName(e);if(n.qsa)return t.querySelectorAll(e)}:function(e,t){var n,r=[],i=0,s=t.getElementsByTagName(e);if(e==="*"){while(n=s[i++])n.nodeType===1&&r.push(n);return r}return s},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(v)return t.getElementsByClassName(e)},g=[],m=[];if(n.qsa=Y.test(o.querySelectorAll))ft(function(e){d.appendChild(e).innerHTML="<a id='"+w+"'></a>"+"<select id='"+w+"-\f]' msallowcapture=''>"+"<option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+j+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+j+"*(?:value|"+B+")"),e.querySelectorAll("[id~="+w+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+w+"+*").length||m.push(".#.+[+~]")}),ft(function(e){var t=o.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+j+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")});return(n.matchesSelector=Y.test(y=d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ft(function(e){n.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),g.push("!=",R)}),m=m.length&&new RegExp(m.join("|")),g=g.length&&new RegExp(g.join("|")),t=Y.test(d.compareDocumentPosition),b=t||Y.test(d.contains)?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!r&&r.nodeType===1&&!!(n.contains?n.contains(r):e.compareDocumentPosition&&e.compareDocumentPosition(r)&16)}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},k=t?function(e,t){if(e===t)return c=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r?r:(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,r&1||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===o||e.ownerDocument===E&&b(E,e)?-1:t===o||t.ownerDocument===E&&b(E,t)?1:l?H(l,e)-H(l,t):0:r&4?-1:1)}:function(e,t){if(e===t)return c=!0,0;var n,r=0,i=e.parentNode,s=t.parentNode,u=[e],a=[t];if(!i||!s)return e===o?-1:t===o?1:i?-1:s?1:l?H(l,e)-H(l,t):0;if(i===s)return ct(e,t);n=e;while(n=n.parentNode)u.unshift(n);n=t;while(n=n.parentNode)a.unshift(n);while(u[r]===a[r])r++;return r?ct(u[r],a[r]):u[r]===E?-1:a[r]===E?1:0},o},ot.matches=function(e,t){return ot(e,null,null,t)},ot.matchesSelector=function(e,t){(e.ownerDocument||e)!==p&&h(e),t=t.replace(V,"='$1']");if(n.matchesSelector&&v&&(!g||!g.test(t))&&(!m||!m.test(t)))try{var r=y.call(e,t);if(r||n.disconnectedMatch||e.document&&e.document.nodeType!==11)return r}catch(i){}return ot(t,p,null,[e]).length>0},ot.contains=function(e,t){return(e.ownerDocument||e)!==p&&h(e),b(e,t)},ot.attr=function(e,t){(e.ownerDocument||e)!==p&&h(e);var i=r.attrHandle[t.toLowerCase()],s=i&&A.call(r.attrHandle,t.toLowerCase())?i(e,t,!v):undefined;return s!==undefined?s:n.attributes||!v?e.getAttribute(t):(s=e.getAttributeNode(t))&&s.specified?s.value:null},ot.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ot.uniqueSort=function(e){var t,r=[],i=0,s=0;c=!n.detectDuplicates,l=!n.sortStable&&e.slice(0),e.sort(k);if(c){while(t=e[s++])t===e[s]&&(i=r.push(s));while(i--)e.splice(r[i],1)}return l=null,e},i=ot.getText=function(e){var t,n="",r=0,s=e.nodeType;if(!s)while(t=e[r++])n+=i(t);else if(s===1||s===9||s===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(s===3||s===4)return e.nodeValue;return n},r=ot.selectors={cacheLength:50,createPseudo:at,match:K,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(nt,rt),e[3]=(e[3]||e[4]||e[5]||"").replace(nt,rt),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1].slice(0,3)==="nth"?(e[3]||ot.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*(e[3]==="even"||e[3]==="odd")),e[5]=+(e[7]+e[8]||e[3]==="odd")):e[3]&&ot.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return K.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&$.test(n)&&(t=o(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(nt,rt).toLowerCase();return e==="*"?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=T[e+" "];return t||(t=new RegExp("(^|"+j+")"+e+"("+j+"|$)"))&&T(e,function(e){return t.test(typeof e.className=="string"&&e.className||typeof e.getAttribute!="undefined"&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ot.attr(r,e);return i==null?t==="!=":t?(i+="",t==="="?i===n:t==="!="?i!==n:t==="^="?n&&i.indexOf(n)===0:t==="*="?n&&i.indexOf(n)>-1:t==="$="?n&&i.slice(-n.length)===n:t==="~="?(" "+i.replace(U," ")+" ").indexOf(n)>-1:t==="|="?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var s=e.slice(0,3)!=="nth",o=e.slice(-4)!=="last",u=t==="of-type";return r===1&&i===0?function(e){return!!e.parentNode}:function(t,n,a){var f,l,c,h,p,d,v=s!==o?"nextSibling":"previousSibling",m=t.parentNode,g=u&&t.nodeName.toLowerCase(),y=!a&&!u;if(m){if(s){while(v){c=t;while(c=c[v])if(u?c.nodeName.toLowerCase()===g:c.nodeType===1)return!1;d=v=e==="only"&&!d&&"nextSibling"}return!0}d=[o?m.firstChild:m.lastChild];if(o&&y){l=m[w]||(m[w]={}),f=l[e]||[],p=f[0]===S&&f[1],h=f[0]===S&&f[2],c=p&&m.childNodes[p];while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if(c.nodeType===1&&++h&&c===t){l[e]=[S,p,h];break}}else if(y&&(f=(t[w]||(t[w]={}))[e])&&f[0]===S)h=f[1];else while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if((u?c.nodeName.toLowerCase()===g:c.nodeType===1)&&++h){y&&((c[w]||(c[w]={}))[e]=[S,h]);if(c===t)break}return h-=i,h===r||h%r===0&&h/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||ot.error("unsupported pseudo: "+e);return i[w]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?at(function(e,n){var r,s=i(e,t),o=s.length;while(o--)r=H(e,s[o]),e[r]=!(n[r]=s[o])}):function(e){return i(e,0,n)}):i}},pseudos:{not:at(function(e){var t=[],n=[],r=u(e.replace(z,"$1"));return r[w]?at(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),t[0]=null,!n.pop()}}),has:at(function(e){return function(t){return ot(e,t).length>0}}),contains:at(function(e){return e=e.replace(nt,rt),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:at(function(e){return J.test(e||"")||ot.error("unsupported lang: "+e),e=e.replace(nt,rt).toLowerCase(),function(t){var n;do if(n=v?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||n.indexOf(e+"-")===0;while((t=t.parentNode)&&t.nodeType===1);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return G.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},text:function(e){var t;return e.nodeName.toLowerCase()==="input"&&e.type==="text"&&((t=e.getAttribute("type"))==null||t.toLowerCase()==="text")},first:dt(function(){return[0]}),last:dt(function(e,t){return[t-1]}),eq:dt(function(e,t,n){return[n<0?n+t:n]}),even:dt(function(e,t){var n=0;for(;n<t;n+=2)e.push(n);return e}),odd:dt(function(e,t){var n=1;for(;n<t;n+=2)e.push(n);return e}),lt:dt(function(e,t,n){var r=n<0?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:dt(function(e,t,n){var r=n<0?n+t:n;for(;++r<t;)e.push(r);return e})}},r.pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=ht(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=pt(t);return mt.prototype=r.filters=r.pseudos,r.setFilters=new mt,o=ot.tokenize=function(e,t){var n,i,s,o,u,a,f,l=N[e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=r.preFilter;while(u){if(!n||(i=W.exec(u)))i&&(u=u.slice(i[0].length)||u),a.push(s=[]);n=!1;if(i=X.exec(u))n=i.shift(),s.push({value:n,type:i[0].replace(z," ")}),u=u.slice(n.length);for(o in r.filter)(i=K[o].exec(u))&&(!f[o]||(i=f[o](i)))&&(n=i.shift(),s.push({value:n,type:o,matches:i}),u=u.slice(n.length));if(!n)break}return t?u.length:u?ot.error(e):N(e,a).slice(0)},u=ot.compile=function(e,t){var n,r=[],i=[],s=C[e+" "];if(!s){t||(t=o(e)),n=t.length;while(n--)s=xt(t[n]),s[w]?r.push(s):i.push(s);s=C(e,Tt(i,r)),s.selector=e}return s},a=ot.select=function(e,t,i,s){var a,f,l,c,h,p=typeof e=="function"&&e,d=!s&&o(e=p.selector||e);i=i||[];if(d.length===1){f=d[0]=d[0].slice(0);if(f.length>2&&(l=f[0]).type==="ID"&&n.getById&&t.nodeType===9&&v&&r.relative[f[1].type]){t=(r.find.ID(l.matches[0].replace(nt,rt),t)||[])[0];if(!t)return i;p&&(t=t.parentNode),e=e.slice(f.shift().value.length)}a=K.needsContext.test(e)?0:f.length;while(a--){l=f[a];if(r.relative[c=l.type])break;if(h=r.find[c])if(s=h(l.matches[0].replace(nt,rt),et.test(f[0].type)&&vt(t.parentNode)||t)){f.splice(a,1),e=s.length&&gt(f);if(!e)return D.apply(i,s),i;break}}}return(p||u(e,d))(s,t,!v,i,et.test(e)&&vt(t.parentNode)||t),i},n.sortStable=w.split("").sort(k).join("")===w,n.detectDuplicates=!!c,h(),n.sortDetached=ft(function(e){return e.compareDocumentPosition(p.createElement("div"))&1}),ft(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild.getAttribute("href")==="#"})||lt("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,t.toLowerCase()==="type"?1:2)}),(!n.attributes||!ft(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),e.firstChild.getAttribute("value")===""}))&&lt("value",function(e,t,n){if(!n&&e.nodeName.toLowerCase()==="input")return e.defaultValue}),ft(function(e){return e.getAttribute("disabled")==null})||lt(B,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),ot}(window);jQuery.find=Sizzle,jQuery.expr=Sizzle.selectors,jQuery.expr[":"]=jQuery.expr.pseudos,jQuery.unique=Sizzle.uniqueSort,jQuery.text=Sizzle.getText,jQuery.isXMLDoc=Sizzle.isXML,jQuery.contains=Sizzle.contains;var rneedsContext=jQuery.expr.match.needsContext,rsingleTag=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,risSimple=/^.[^:#\[\.,]*$/;jQuery.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),t.length===1&&r.nodeType===1?jQuery.find.matchesSelector(r,e)?[r]:[]:jQuery.find.matches(e,jQuery.grep(t,function(e){return e.nodeType===1}))},jQuery.fn.extend({find:function(e){var t,n=this.length,r=[],i=this;if(typeof e!="string")return this.pushStack(jQuery(e).filter(function(){for(t=0;t<n;t++)if(jQuery.contains(i[t],this))return!0}));for(t=0;t<n;t++)jQuery.find(e,i[t],r);return r=this.pushStack(n>1?jQuery.unique(r):r),r.selector=this.selector?this.selector+" "+e:e,r},filter:function(e){return this.pushStack(winnow(this,e||[],!1))},not:function(e){return this.pushStack(winnow(this,e||[],!0))},is:function(e){return!!winnow(this,typeof e=="string"&&rneedsContext.test(e)?jQuery(e):e||[],!1).length}});var rootjQuery,rquickExpr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,init=jQuery.fn.init=function(e,t){var n,r;if(!e)return this;if(typeof e=="string"){e[0]==="<"&&e[e.length-1]===">"&&e.length>=3?n=[null,e,null]:n=rquickExpr.exec(e);if(n&&(n[1]||!t)){if(n[1]){t=t instanceof jQuery?t[0]:t,jQuery.merge(this,jQuery.parseHTML(n[1],t&&t.nodeType?t.ownerDocument||t:document,!0));if(rsingleTag.test(n[1])&&jQuery.isPlainObject(t))for(n in t)jQuery.isFunction(this[n])?this[n](t[n]):this.attr(n,t[n]);return this}return r=document.getElementById(n[2]),r&&r.parentNode&&(this.length=1,this[0]=r),this.context=document,this.selector=e,this}return!t||t.jquery?(t||rootjQuery).find(e):this.constructor(t).find(e)}return e.nodeType?(this.context=this[0]=e,this.length=1,this):jQuery.isFunction(e)?typeof rootjQuery.ready!="undefined"?rootjQuery.ready(e):e(jQuery):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),jQuery.makeArray(e,this))};init.prototype=jQuery.fn,rootjQuery=jQuery(document);var rparentsprev=/^(?:parents|prev(?:Until|All))/,guaranteedUnique={children:!0,contents:!0,next:!0,prev:!0};jQuery.extend({dir:function(e,t,n){var r=[],i=n!==undefined;while((e=e[t])&&e.nodeType!==9)if(e.nodeType===1){if(i&&jQuery(e).is(n))break;r.push(e)}return r},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}}),jQuery.fn.extend({has:function(e){var t=jQuery(e,this),n=t.length;return this.filter(function(){var e=0;for(;e<n;e++)if(jQuery.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,s=[],o=rneedsContext.test(e)||typeof e!="string"?jQuery(e,t||this.context):0;for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(o?o.index(n)>-1:n.nodeType===1&&jQuery.find.matchesSelector(n,e))){s.push(n);break}return this.pushStack(s.length>1?jQuery.unique(s):s)},index:function(e){return e?typeof e=="string"?indexOf.call(jQuery(e),this[0]):indexOf.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),jQuery(e,t))))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),jQuery.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return jQuery.dir(e,"parentNode")},parentsUntil:function(e,t,n){return jQuery.dir(e,"parentNode",n)},next:function(e){return sibling(e,"nextSibling")},prev:function(e){return sibling(e,"previousSibling")},nextAll:function(e){return jQuery.dir(e,"nextSibling")},prevAll:function(e){return jQuery.dir(e,"previousSibling")},nextUntil:function(e,t,n){return jQuery.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return jQuery.dir(e,"previousSibling",n)},siblings:function(e){return jQuery.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return jQuery.sibling(e.firstChild)},contents:function(e){return e.contentDocument||jQuery.merge([],e.childNodes)}},function(e,t){jQuery.fn[e]=function(n,r){var i=jQuery.map(this,t,n);return e.slice(-5)!=="Until"&&(r=n),r&&typeof r=="string"&&(i=jQuery.filter(r,i)),this.length>1&&(guaranteedUnique[e]||jQuery.unique(i),rparentsprev.test(e)&&i.reverse()),this.pushStack(i)}});var rnotwhite=/\S+/g,optionsCache={};jQuery.Callbacks=function(e){e=typeof e=="string"?optionsCache[e]||createOptions(e):jQuery.extend({},e);var t,n,r,i,s,o,u=[],a=!e.once&&[],f=function(c){t=e.memory&&c,n=!0,o=i||0,i=0,s=u.length,r=!0;for(;u&&o<s;o++)if(u[o].apply(c[0],c[1])===!1&&e.stopOnFalse){t=!1;break}r=!1,u&&(a?a.length&&f(a.shift()):t?u=[]:l.disable())},l={add:function(){if(u){var n=u.length;(function o(t){jQuery.each(t,function(t,n){var r=jQuery.type(n);r==="function"?(!e.unique||!l.has(n))&&u.push(n):n&&n.length&&r!=="string"&&o(n)})})(arguments),r?s=u.length:t&&(i=n,f(t))}return this},remove:function(){return u&&jQuery.each(arguments,function(e,t){var n;while((n=jQuery.inArray(t,u,n))>-1)u.splice(n,1),r&&(n<=s&&s--,n<=o&&o--)}),this},has:function(e){return e?jQuery.inArray(e,u)>-1:!!u&&!!u.length},empty:function(){return u=[],s=0,this},disable:function(){return u=a=t=undefined,this},disabled:function(){return!u},lock:function(){return a=undefined,t||l.disable(),this},locked:function(){return!a},fireWith:function(e,t){return u&&(!n||a)&&(t=t||[],t=[e,t.slice?t.slice():t],r?a.push(t):f(t)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!n}};return l},jQuery.extend({Deferred:function(e){var t=[["resolve","done",jQuery.Callbacks("once memory"),"resolved"],["reject","fail",jQuery.Callbacks("once memory"),"rejected"],["notify","progress",jQuery.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return jQuery.Deferred(function(n){jQuery.each(t,function(t,s){var o=jQuery.isFunction(e[t])&&e[t];i[s[1]](function(){var e=o&&o.apply(this,arguments);e&&jQuery.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s[0]+"With"](this===r?n.promise():this,o?[e]:arguments)})}),e=null}).promise()},promise:function(e){return e!=null?jQuery.extend(e,r):r}},i={};return r.pipe=r.then,jQuery.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=function(){return i[s[0]+"With"](this===i?r:this,arguments),this},i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=slice.call(arguments),r=n.length,i=r!==1||e&&jQuery.isFunction(e.promise)?r:0,s=i===1?e:jQuery.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?slice.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&jQuery.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}});var readyList;jQuery.fn.ready=function(e){return jQuery.ready.promise().done(e),this},jQuery.extend({isReady:!1,readyWait:1,holdReady:function(e){e?jQuery.readyWait++:jQuery.ready(!0)},ready:function(e){if(e===!0?--jQuery.readyWait:jQuery.isReady)return;jQuery.isReady=!0;if(e!==!0&&--jQuery.readyWait>0)return;readyList.resolveWith(document,[jQuery]),jQuery.fn.triggerHandler&&(jQuery(document).triggerHandler("ready"),jQuery(document).off("ready"))}}),jQuery.ready.promise=function(e){return readyList||(readyList=jQuery.Deferred(),document.readyState==="complete"?setTimeout(jQuery.ready):(document.addEventListener("DOMContentLoaded",completed,!1),window.addEventListener("load",completed,!1))),readyList.promise(e)},jQuery.ready.promise();var access=jQuery.access=function(e,t,n,r,i,s,o){var u=0,a=e.length,f=n==null;if(jQuery.type(n)==="object"){i=!0;for(u in n)jQuery.access(e,t,u,n[u],!0,s,o)}else if(r!==undefined){i=!0,jQuery.isFunction(r)||(o=!0),f&&(o?(t.call(e,r),t=null):(f=t,t=function(e,t,n){return f.call(jQuery(e),n)}));if(t)for(;u<a;u++)t(e[u],n,o?r:r.call(e[u],u,t(e[u],n)))}return i?e:f?t.call(e):a?t(e[0],n):s};jQuery.acceptData=function(e){return e.nodeType===1||e.nodeType===9||!+e.nodeType},Data.uid=1,Data.accepts=jQuery.acceptData,Data.prototype={key:function(e){if(!Data.accepts(e))return 0;var t={},n=e[this.expando];if(!n){n=Data.uid++;try{t[this.expando]={value:n},Object.defineProperties(e,t)}catch(r){t[this.expando]=n,jQuery.extend(e,t)}}return this.cache[n]||(this.cache[n]={}),n},set:function(e,t,n){var r,i=this.key(e),s=this.cache[i];if(typeof t=="string")s[t]=n;else if(jQuery.isEmptyObject(s))jQuery.extend(this.cache[i],t);else for(r in t)s[r]=t[r];return s},get:function(e,t){var n=this.cache[this.key(e)];return t===undefined?n:n[t]},access:function(e,t,n){var r;return t===undefined||t&&typeof t=="string"&&n===undefined?(r=this.get(e,t),r!==undefined?r:this.get(e,jQuery.camelCase(t))):(this.set(e,t,n),n!==undefined?n:t)},remove:function(e,t){var n,r,i,s=this.key(e),o=this.cache[s];if(t===undefined)this.cache[s]={};else{jQuery.isArray(t)?r=t.concat(t.map(jQuery.camelCase)):(i=jQuery.camelCase(t),t in o?r=[t,i]:(r=i,r=r in o?[r]:r.match(rnotwhite)||[])),n=r.length;while(n--)delete o[r[n]]}},hasData:function(e){return!jQuery.isEmptyObject(this.cache[e[this.expando]]||{})},discard:function(e){e[this.expando]&&delete this.cache[e[this.expando]]}};var data_priv=new Data,data_user=new Data,rbrace=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,rmultiDash=/([A-Z])/g;jQuery.extend({hasData:function(e){return data_user.hasData(e)||data_priv.hasData(e)},data:function(e,t,n){return data_user.access(e,t,n)},removeData:function(e,t){data_user.remove(e,t)},_data:function(e,t,n){return data_priv.access(e,t,n)},_removeData:function(e,t){data_priv.remove(e,t)}}),jQuery.fn.extend({data:function(e,t){var n,r,i,s=this[0],o=s&&s.attributes;if(e===undefined){if(this.length){i=data_user.get(s);if(s.nodeType===1&&!data_priv.get(s,"hasDataAttrs")){n=o.length;while(n--)o[n]&&(r=o[n].name,r.indexOf("data-")===0&&(r=jQuery.camelCase(r.slice(5)),dataAttr(s,r,i[r])));data_priv.set(s,"hasDataAttrs",!0)}}return i}return typeof e=="object"?this.each(function(){data_user.set(this,e)}):access(this,function(t){var n,r=jQuery.camelCase(e);if(s&&t===undefined){n=data_user.get(s,e);if(n!==undefined)return n;n=data_user.get(s,r);if(n!==undefined)return n;n=dataAttr(s,r,undefined);if(n!==undefined)return n;return}this.each(function(){var n=data_user.get(this,r);data_user.set(this,r,t),e.indexOf("-")!==-1&&n!==undefined&&data_user.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){data_user.remove(this,e)})}}),jQuery.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=data_priv.get(e,t),n&&(!r||jQuery.isArray(n)?r=data_priv.access(e,t,jQuery.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=jQuery.queue(e,t),r=n.length,i=n.shift(),s=jQuery._queueHooks(e,t),o=function(){jQuery.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return data_priv.get(e,n)||data_priv.access(e,n,{empty:jQuery.Callbacks("once memory").add(function(){data_priv.remove(e,[t+"queue",n])})})}}),jQuery.fn.extend({queue:function(e,t){var n=2;return typeof e!="string"&&(t=e,e="fx",n--),arguments.length<n?jQuery.queue(this[0],e):t===undefined?this:this.each(function(){var n=jQuery.queue(this,e,t);jQuery._queueHooks(this,e),e==="fx"&&n[0]!=="inprogress"&&jQuery.dequeue(this,e)})},dequeue:function(e){return this.each(function(){jQuery.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=jQuery.Deferred(),s=this,o=this.length,u=function(){--r||i.resolveWith(s,[s])};typeof e!="string"&&(t=e,e=undefined),e=e||"fx";while(o--)n=data_priv.get(s[o],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(u));return u(),i.promise(t)}});var pnum=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,cssExpand=["Top","Right","Bottom","Left"],isHidden=function(e,t){return e=t||e,jQuery.css(e,"display")==="none"||!jQuery.contains(e.ownerDocument,e)},rcheckableType=/^(?:checkbox|radio)$/i;(function(){var e=document.createDocumentFragment(),t=e.appendChild(document.createElement("div")),n=document.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),support.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="<textarea>x</textarea>",support.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue})();var strundefined=typeof undefined;support.focusinBubbles="onfocusin"in window;var rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|pointer|contextmenu)|click/,rfocusMorph=/^(?:focusinfocus|focusoutblur)$/,rtypenamespace=/^([^.]*)(?:\.(.+)|)$/;jQuery.event={global:{},add:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=data_priv.get(e);if(!m)return;n.handler&&(s=n,n=s.handler,i=s.selector),n.guid||(n.guid=jQuery.guid++),(a=m.events)||(a=m.events={}),(o=m.handle)||(o=m.handle=function(t){return typeof jQuery!==strundefined&&jQuery.event.triggered!==t.type?jQuery.event.dispatch.apply(e,arguments):undefined}),t=(t||"").match(rnotwhite)||[""],f=t.length;while(f--){u=rtypenamespace.exec(t[f])||[],p=v=u[1],d=(u[2]||"").split(".").sort();if(!p)continue;c=jQuery.event.special[p]||{},p=(i?c.delegateType:c.bindType)||p,c=jQuery.event.special[p]||{},l=jQuery.extend({type:p,origType:v,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&jQuery.expr.match.needsContext.test(i),namespace:d.join(".")},s),(h=a[p])||(h=a[p]=[],h.delegateCount=0,(!c.setup||c.setup.call(e,r,d,o)===!1)&&e.addEventListener&&e.addEventListener(p,o,!1)),c.add&&(c.add.call(e,l),l.handler.guid||(l.handler.guid=n.guid)),i?h.splice(h.delegateCount++,0,l):h.push(l),jQuery.event.global[p]=!0}},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=data_priv.hasData(e)&&data_priv.get(e);if(!m||!(a=m.events))return;t=(t||"").match(rnotwhite)||[""],f=t.length;while(f--){u=rtypenamespace.exec(t[f])||[],p=v=u[1],d=(u[2]||"").split(".").sort();if(!p){for(p in a)jQuery.event.remove(e,p+t[f],n,r,!0);continue}c=jQuery.event.special[p]||{},p=(r?c.delegateType:c.bindType)||p,h=a[p]||[],u=u[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=h.length;while(s--)l=h[s],(i||v===l.origType)&&(!n||n.guid===l.guid)&&(!u||u.test(l.namespace))&&(!r||r===l.selector||r==="**"&&l.selector)&&(h.splice(s,1),l.selector&&h.delegateCount--,c.remove&&c.remove.call(e,l));o&&!h.length&&((!c.teardown||c.teardown.call(e,d,m.handle)===!1)&&jQuery.removeEvent(e,p,m.handle),delete a[p])}jQuery.isEmptyObject(a)&&(delete m.handle,data_priv.remove(e,"events"))},trigger:function(e,t,n,r){var i,s,o,u,a,f,l,c=[n||document],h=hasOwn.call(e,"type")?e.type:e,p=hasOwn.call(e,"namespace")?e.namespace.split("."):[];s=o=n=n||document;if(n.nodeType===3||n.nodeType===8)return;if(rfocusMorph.test(h+jQuery.event.triggered))return;h.indexOf(".")>=0&&(p=h.split("."),h=p.shift(),p.sort()),a=h.indexOf(":")<0&&"on"+h,e=e[jQuery.expando]?e:new jQuery.Event(h,typeof e=="object"&&e),e.isTrigger=r?2:3,e.namespace=p.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=undefined,e.target||(e.target=n),t=t==null?[e]:jQuery.makeArray(t,[e]),l=jQuery.event.special[h]||{};if(!r&&l.trigger&&l.trigger.apply(n,t)===!1)return;if(!r&&!l.noBubble&&!jQuery.isWindow(n)){u=l.delegateType||h,rfocusMorph.test(u+h)||(s=s.parentNode);for(;s;s=s.parentNode)c.push(s),o=s;o===(n.ownerDocument||document)&&c.push(o.defaultView||o.parentWindow||window)}i=0;while((s=c[i++])&&!e.isPropagationStopped())e.type=i>1?u:l.bindType||h,f=(data_priv.get(s,"events")||{})[e.type]&&data_priv.get(s,"handle"),f&&f.apply(s,t),f=a&&s[a],f&&f.apply&&jQuery.acceptData(s)&&(e.result=f.apply(s,t),e.result===!1&&e.preventDefault());return e.type=h,!r&&!e.isDefaultPrevented()&&(!l._default||l._default.apply(c.pop(),t)===!1)&&jQuery.acceptData(n)&&a&&jQuery.isFunction(n[h])&&!jQuery.isWindow(n)&&(o=n[a],o&&(n[a]=null),jQuery.event.triggered=h,n[h](),jQuery.event.triggered=undefined,o&&(n[a]=o)),e.result},dispatch:function(e){e=jQuery.event.fix(e);var t,n,r,i,s,o=[],u=slice.call(arguments),a=(data_priv.get(this,"events")||{})[e.type]||[],f=jQuery.event.special[e.type]||{};u[0]=e,e.delegateTarget=this;if(f.preDispatch&&f.preDispatch.call(this,e)===!1)return;o=jQuery.event.handlers.call(this,e,a),t=0;while((i=o[t++])&&!e.isPropagationStopped()){e.currentTarget=i.elem,n=0;while((s=i.handlers[n++])&&!e.isImmediatePropagationStopped())if(!e.namespace_re||e.namespace_re.test(s.namespace))e.handleObj=s,e.data=s.data,r=((jQuery.event.special[s.origType]||{}).handle||s.handler).apply(i.elem,u),r!==undefined&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation())}return f.postDispatch&&f.postDispatch.call(this,e),e.result},handlers:function(e,t){var n,r,i,s,o=[],u=t.delegateCount,a=e.target;if(u&&a.nodeType&&(!e.button||e.type!=="click"))for(;a!==this;a=a.parentNode||this)if(a.disabled!==!0||e.type!=="click"){r=[];for(n=0;n<u;n++)s=t[n],i=s.selector+" ",r[i]===undefined&&(r[i]=s.needsContext?jQuery(i,this).index(a)>=0:jQuery.find(i,this,null,[a]).length),r[i]&&r.push(s);r.length&&o.push({elem:a,handlers:r})}return u<t.length&&o.push({elem:this,handlers:t.slice(u)}),o},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return e.pageX==null&&t.clientX!=null&&(n=e.target.ownerDocument||document,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),!e.which&&s!==undefined&&(e.which=s&1?1:s&2?3:s&4?2:0),e}},fix:function(e){if(e[jQuery.expando])return e;var t,n,r,i=e.type,s=e,o=this.fixHooks[i];o||(this.fixHooks[i]=o=rmouseEvent.test(i)?this.mouseHooks:rkeyEvent.test(i)?this.keyHooks:{}),r=o.props?this.props.concat(o.props):this.props,e=new jQuery.Event(s),t=r.length;while(t--)n=r[t],e[n]=s[n];return e.target||(e.target=document),e.target.nodeType===3&&(e.target=e.target.parentNode),o.filter?o.filter(e,s):e},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==safeActiveElement()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===safeActiveElement()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if(this.type==="checkbox"&&this.click&&jQuery.nodeName(this,"input"))return this.click(),!1},_default:function(e){return jQuery.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==undefined&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=jQuery.extend(new jQuery.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?jQuery.event.trigger(i,null,t):jQuery.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},jQuery.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)},jQuery.Event=function(e,t){if(!(this instanceof jQuery.Event))return new jQuery.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.defaultPrevented===undefined&&e.returnValue===!1?returnTrue:returnFalse):this.type=e,t&&jQuery.extend(this,t),this.timeStamp=e&&e.timeStamp||jQuery.now(),this[jQuery.expando]=!0},jQuery.Event.prototype={isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=returnTrue,e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=returnTrue,e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=returnTrue,e&&e.stopImmediatePropagation&&e.stopImmediatePropagation(),this.stopPropagation()}},jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){jQuery.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj;if(!i||i!==r&&!jQuery.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),support.focusinBubbles||jQuery.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){jQuery.event.simulate(t,e.target,jQuery.event.fix(e),!0)};jQuery.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=data_priv.access(r,t);i||r.addEventListener(e,n,!0),data_priv.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=data_priv.access(r,t)-1;i?data_priv.access(r,t,i):(r.removeEventListener(e,n,!0),data_priv.remove(r,t))}}}),jQuery.fn.extend({on:function(e,t,n,r,i){var s,o;if(typeof e=="object"){typeof t!="string"&&(n=n||t,t=undefined);for(o in e)this.on(o,t,n,e[o],i);return this}n==null&&r==null?(r=t,n=t=undefined):r==null&&(typeof t=="string"?(r=n,n=undefined):(r=n,n=t,t=undefined));if(r===!1)r=returnFalse;else if(!r)return this;return i===1&&(s=r,r=function(e){return jQuery().off(e),s.apply(this,arguments)},r.guid=s.guid||(s.guid=jQuery.guid++)),this.each(function(){jQuery.event.add(this,e,r,n,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,jQuery(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if(typeof e=="object"){for(i in e)this.off(i,t,e[i]);return this}if(t===!1||typeof t=="function")n=t,t=undefined;return n===!1&&(n=returnFalse),this.each(function(){jQuery.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){jQuery.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return jQuery.event.trigger(e,t,n,!0)}});var rxhtmlTag=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,rtagName=/<([\w:]+)/,rhtml=/<|&#?\w+;/,rnoInnerhtml=/<(?:script|style|link)/i,rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rscriptType=/^$|\/(?:java|ecma)script/i,rscriptTypeMasked=/^true\/(.*)/,rcleanScript=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,wrapMap={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};wrapMap.optgroup=wrapMap.option,wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead,wrapMap.th=wrapMap.td,jQuery.extend({clone:function(e,t,n){var r,i,s,o,u=e.cloneNode(!0),a=jQuery.contains(e.ownerDocument,e);if(!support.noCloneChecked&&(e.nodeType===1||e.nodeType===11)&&!jQuery.isXMLDoc(e)){o=getAll(u),s=getAll(e);for(r=0,i=s.length;r<i;r++)fixInput(s[r],o[r])}if(t)if(n){s=s||getAll(e),o=o||getAll(u);for(r=0,i=s.length;r<i;r++)cloneCopyEvent(s[r],o[r])}else cloneCopyEvent(e,u);return o=getAll(u,"script"),o.length>0&&setGlobalEval(o,!a&&getAll(e,"script")),u},buildFragment:function(e,t,n,r){var i,s,o,u,a,f,l=t.createDocumentFragment(),c=[],h=0,p=e.length;for(;h<p;h++){i=e[h];if(i||i===0)if(jQuery.type(i)==="object")jQuery.merge(c,i.nodeType?[i]:i);else if(!rhtml.test(i))c.push(t.createTextNode(i));else{s=s||l.appendChild(t.createElement("div")),o=(rtagName.exec(i)||["",""])[1].toLowerCase(),u=wrapMap[o]||wrapMap._default,s.innerHTML=u[1]+i.replace(rxhtmlTag,"<$1></$2>")+u[2],f=u[0];while(f--)s=s.lastChild;jQuery.merge(c,s.childNodes),s=l.firstChild,s.textContent=""}}l.textContent="",h=0;while(i=c[h++]){if(r&&jQuery.inArray(i,r)!==-1)continue;a=jQuery.contains(i.ownerDocument,i),s=getAll(l.appendChild(i),"script"),a&&setGlobalEval(s);if(n){f=0;while(i=s[f++])rscriptType.test(i.type||"")&&n.push(i)}}return l},cleanData:function(e){var t,n,r,i,s=jQuery.event.special,o=0;for(;(n=e[o])!==undefined;o++){if(jQuery.acceptData(n)){i=n[data_priv.expando];if(i&&(t=data_priv.cache[i])){if(t.events)for(r in t.events)s[r]?jQuery.event.remove(n,r):jQuery.removeEvent(n,r,t.handle);data_priv.cache[i]&&delete data_priv.cache[i]}}delete data_user.cache[n[data_user.expando]]}}}),jQuery.fn.extend({text:function(e){return access(this,function(e){return e===undefined?jQuery.text(this):this.empty().each(function(){if(this.nodeType===1||this.nodeType===11||this.nodeType===9)this.textContent=e})},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=manipulationTarget(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=manipulationTarget(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?jQuery.filter(e,this):this,i=0;for(;(n=r[i])!=null;i++)!t&&n.nodeType===1&&jQuery.cleanData(getAll(n)),n.parentNode&&(t&&jQuery.contains(n.ownerDocument,n)&&setGlobalEval(getAll(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++)e.nodeType===1&&(jQuery.cleanData(getAll(e,!1)),e.textContent="");return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return jQuery.clone(this,e,t)})},html:function(e){return access(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined&&t.nodeType===1)return t.innerHTML;if(typeof e=="string"&&!rnoInnerhtml.test(e)&&!wrapMap[(rtagName.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(rxhtmlTag,"<$1></$2>");try{for(;n<r;n++)t=this[n]||{},t.nodeType===1&&(jQuery.cleanData(getAll(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=arguments[0];return this.domManip(arguments,function(t){e=this.parentNode,jQuery.cleanData(getAll(this)),e&&e.replaceChild(t,this)}),e&&(e.length||e.nodeType)?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t){e=concat.apply([],e);var n,r,i,s,o,u,a=0,f=this.length,l=this,c=f-1,h=e[0],p=jQuery.isFunction(h);if(p||f>1&&typeof h=="string"&&!support.checkClone&&rchecked.test(h))return this.each(function(n){var r=l.eq(n);p&&(e[0]=h.call(this,n,r.html())),r.domManip(e,t)});if(f){n=jQuery.buildFragment(e,this[0].ownerDocument,!1,this),r=n.firstChild,n.childNodes.length===1&&(n=r);if(r){i=jQuery.map(getAll(n,"script"),disableScript),s=i.length;for(;a<f;a++)o=n,a!==c&&(o=jQuery.clone(o,!0,!0),s&&jQuery.merge(i,getAll(o,"script"))),t.call(this[a],o,a);if(s){u=i[i.length-1].ownerDocument,jQuery.map(i,restoreScript);for(a=0;a<s;a++)o=i[a],rscriptType.test(o.type||"")&&!data_priv.access(o,"globalEval")&&jQuery.contains(u,o)&&(o.src?jQuery._evalUrl&&jQuery._evalUrl(o.src):jQuery.globalEval(o.textContent.replace(rcleanScript,"")))}}}return this}}),jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){jQuery.fn[e]=function(e){var n,r=[],i=jQuery(e),s=i.length-1,o=0;for(;o<=s;o++)n=o===s?this:this.clone(!0),jQuery(i[o])[t](n),push.apply(r,n.get());return this.pushStack(r)}});var iframe,elemdisplay={},rmargin=/^margin/,rnumnonpx=new RegExp("^("+pnum+")(?!px)[a-z%]+$","i"),getStyles=function(e){return e.ownerDocument.defaultView.opener?e.ownerDocument.defaultView.getComputedStyle(e,null):window.getComputedStyle(e,null)};(function(){function s(){i.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",i.innerHTML="",n.appendChild(r);var s=window.getComputedStyle(i,null);e=s.top!=="1%",t=s.width==="4px",n.removeChild(r)}var e,t,n=document.documentElement,r=document.createElement("div"),i=document.createElement("div");if(!i.style)return;i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",support.clearCloneStyle=i.style.backgroundClip==="content-box",r.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",r.appendChild(i),window.getComputedStyle&&jQuery.extend(support,{pixelPosition:function(){return s(),e},boxSizingReliable:function(){return t==null&&s(),t},reliableMarginRight:function(){var e,t=i.appendChild(document.createElement("div"));return t.style.cssText=i.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",t.style.marginRight=t.style.width="0",i.style.width="1px",n.appendChild(r),e=!parseFloat(window.getComputedStyle(t,null).marginRight),n.removeChild(r),i.removeChild(t),e}})})(),jQuery.swap=function(e,t,n,r){var i,s,o={};for(s in t)o[s]=e.style[s],e.style[s]=t[s];i=n.apply(e,r||[]);for(s in t)e.style[s]=o[s];return i};var rdisplayswap=/^(none|table(?!-c[ea]).+)/,rnumsplit=new RegExp("^("+pnum+")(.*)$","i"),rrelNum=new RegExp("^([+-])=("+pnum+")","i"),cssShow={position:"absolute",visibility:"hidden",display:"block"},cssNormalTransform={letterSpacing:"0",fontWeight:"400"},cssPrefixes=["Webkit","O","Moz","ms"];jQuery.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=curCSS(e,"opacity");return n===""?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,n,r){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var i,s,o,u=jQuery.camelCase(t),a=e.style;t=jQuery.cssProps[u]||(jQuery.cssProps[u]=vendorPropName(a,u)),o=jQuery.cssHooks[t]||jQuery.cssHooks[u];if(n===undefined)return o&&"get"in o&&(i=o.get(e,!1,r))!==undefined?i:a[t];s=typeof n,s==="string"&&(i=rrelNum.exec(n))&&(n=(i[1]+1)*i[2]+parseFloat(jQuery.css(e,t)),s="number");if(n==null||n!==n)return;s==="number"&&!jQuery.cssNumber[u]&&(n+="px"),!support.clearCloneStyle&&n===""&&t.indexOf("background")===0&&(a[t]="inherit");if(!o||!("set"in o)||(n=o.set(e,n,r))!==undefined)a[t]=n},css:function(e,t,n,r){var i,s,o,u=jQuery.camelCase(t);return t=jQuery.cssProps[u]||(jQuery.cssProps[u]=vendorPropName(e.style,u)),o=jQuery.cssHooks[t]||jQuery.cssHooks[u],o&&"get"in o&&(i=o.get(e,!0,n)),i===undefined&&(i=curCSS(e,t,r)),i==="normal"&&t in cssNormalTransform&&(i=cssNormalTransform[t]),n===""||n?(s=parseFloat(i),n===!0||jQuery.isNumeric(s)?s||0:i):i}}),jQuery.each(["height","width"],function(e,t){jQuery.cssHooks[t]={get:function(e,n,r){if(n)return rdisplayswap.test(jQuery.css(e,"display"))&&e.offsetWidth===0?jQuery.swap(e,cssShow,function(){return getWidthOrHeight(e,t,r)}):getWidthOrHeight(e,t,r)},set:function(e,n,r){var i=r&&getStyles(e);return setPositiveNumber(e,n,r?augmentWidthOrHeight(e,t,r,jQuery.css(e,"boxSizing",!1,i)==="border-box",i):0)}}}),jQuery.cssHooks.marginRight=addGetHookIf(support.reliableMarginRight,function(e,t){if(t)return jQuery.swap(e,{display:"inline-block"},curCSS,[e,"marginRight"])}),jQuery.each({margin:"",padding:"",border:"Width"},function(e,t){jQuery.cssHooks[e+t]={expand:function(n){var r=0,i={},s=typeof n=="string"?n.split(" "):[n];for(;r<4;r++)i[e+cssExpand[r]+t]=s[r]||s[r-2]||s[0];return i}},rmargin.test(e)||(jQuery.cssHooks[e+t].set=setPositiveNumber)}),jQuery.fn.extend({css:function(e,t){return access(this,function(e,t,n){var r,i,s={},o=0;if(jQuery.isArray(t)){r=getStyles(e),i=t.length;for(;o<i;o++)s[t[o]]=jQuery.css(e,t[o],!1,r);return s}return n!==undefined?jQuery.style(e,t,n):jQuery.css(e,t)},e,t,arguments.length>1)},show:function(){return showHide(this,!0)},hide:function(){return showHide(this)},toggle:function(e){return typeof e=="boolean"?e?this.show():this.hide():this.each(function(){isHidden(this)?jQuery(this).show():jQuery(this).hide()})}}),jQuery.Tween=Tween,Tween.prototype={constructor:Tween,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(jQuery.cssNumber[n]?"":"px")},cur:function(){var e=Tween.propHooks[this.prop];return e&&e.get?e.get(this):Tween.propHooks._default.get(this)},run:function(e){var t,n=Tween.propHooks[this.prop];return this.options.duration?this.pos=t=jQuery.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Tween.propHooks._default.set(this),this}},Tween.prototype.init.prototype=Tween.prototype,Tween.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=jQuery.css(e.elem,e.prop,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){jQuery.fx.step[e.prop]?jQuery.fx.step[e.prop](e):e.elem.style&&(e.elem.style[jQuery.cssProps[e.prop]]!=null||jQuery.cssHooks[e.prop])?jQuery.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Tween.propHooks.scrollTop=Tween.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},jQuery.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},jQuery.fx=Tween.prototype.init,jQuery.fx.step={};var fxNow,timerId,rfxtypes=/^(?:toggle|show|hide)$/,rfxnum=new RegExp("^(?:([+-])=|)("+pnum+")([a-z%]*)$","i"),rrun=/queueHooks$/,animationPrefilters=[defaultPrefilter],tweeners={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=rfxnum.exec(t),s=i&&i[3]||(jQuery.cssNumber[e]?"":"px"),o=(jQuery.cssNumber[e]||s!=="px"&&+r)&&rfxnum.exec(jQuery.css(n.elem,e)),u=1,a=20;if(o&&o[3]!==s){s=s||o[3],i=i||[],o=+r||1;do u=u||".5",o/=u,jQuery.style(n.elem,e,o+s);while(u!==(u=n.cur()/r)&&u!==1&&--a)}return i&&(o=n.start=+o||+r||0,n.unit=s,n.end=i[1]?o+(i[1]+1)*i[2]:+i[2]),n}]};jQuery.Animation=jQuery.extend(Animation,{tweener:function(e,t){jQuery.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],tweeners[n]=tweeners[n]||[],tweeners[n].unshift(t)},prefilter:function(e,t){t?animationPrefilters.unshift(e):animationPrefilters.push(e)}}),jQuery.speed=function(e,t,n){var r=e&&typeof e=="object"?jQuery.extend({},e):{complete:n||!n&&t||jQuery.isFunction(e)&&e,duration:e,easing:n&&t||t&&!jQuery.isFunction(t)&&t};r.duration=jQuery.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in jQuery.fx.speeds?jQuery.fx.speeds[r.duration]:jQuery.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){jQuery.isFunction(r.old)&&r.old.call(this),r.queue&&jQuery.dequeue(this,r.queue)},r},jQuery.fn.extend({fadeTo:function(e,t,n,r){return this.filter(isHidden).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=jQuery.isEmptyObject(e),s=jQuery.speed(t,n,r),o=function(){var t=Animation(this,jQuery.extend({},e),s);(i||data_priv.get(this,"finish"))&&t.stop(!0)};return o.finish=o,i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return typeof e!="string"&&(n=t,t=e,e=undefined),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=e!=null&&e+"queueHooks",s=jQuery.timers,o=data_priv.get(this);if(i)o[i]&&o[i].stop&&r(o[i]);else for(i in o)o[i]&&o[i].stop&&rrun.test(i)&&r(o[i]);for(i=s.length;i--;)s[i].elem===this&&(e==null||s[i].queue===e)&&(s[i].anim.stop(n),t=!1,s.splice(i,1));(t||!n)&&jQuery.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=data_priv.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],s=jQuery.timers,o=r?r.length:0;n.finish=!0,jQuery.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0);for(t=s.length;t--;)s[t].elem===this&&s[t].queue===e&&(s[t].anim.stop(!0),s.splice(t,1));for(t=0;t<o;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),jQuery.each(["toggle","show","hide"],function(e,t){var n=jQuery.fn[t];jQuery.fn[t]=function(e,r,i){return e==null||typeof e=="boolean"?n.apply(this,arguments):this.animate(genFx(t,!0),e,r,i)}}),jQuery.each({slideDown:genFx("show"),slideUp:genFx("hide"),slideToggle:genFx("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){jQuery.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),jQuery.timers=[],jQuery.fx.tick=function(){var e,t=0,n=jQuery.timers;fxNow=jQuery.now();for(;t<n.length;t++)e=n[t],!e()&&n[t]===e&&n.splice(t--,1);n.length||jQuery.fx.stop(),fxNow=undefined},jQuery.fx.timer=function(e){jQuery.timers.push(e),e()?jQuery.fx.start():jQuery.timers.pop()},jQuery.fx.interval=13,jQuery.fx.start=function(){timerId||(timerId=setInterval(jQuery.fx.tick,jQuery.fx.interval))},jQuery.fx.stop=function(){clearInterval(timerId),timerId=null},jQuery.fx.speeds={slow:600,fast:200,_default:400},jQuery.fn.delay=function(e,t){return e=jQuery.fx?jQuery.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},function(){var e=document.createElement("input"),t=document.createElement("select"),n=t.appendChild(document.createElement("option"));e.type="checkbox",support.checkOn=e.value!=="",support.optSelected=n.selected,t.disabled=!0,support.optDisabled=!n.disabled,e=document.createElement("input"),e.value="t",e.type="radio",support.radioValue=e.value==="t"}();var nodeHook,boolHook,attrHandle=jQuery.expr.attrHandle;jQuery.fn.extend({attr:function(e,t){return access(this,jQuery.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){jQuery.removeAttr(this,e)})}}),jQuery.extend({attr:function(e,t,n){var r,i,s=e.nodeType;if(!e||s===3||s===8||s===2)return;if(typeof e.getAttribute===strundefined)return jQuery.prop(e,t,n);if(s!==1||!jQuery.isXMLDoc(e))t=t.toLowerCase(),r=jQuery.attrHooks[t]||(jQuery.expr.match.bool.test(t)?boolHook:nodeHook);if(n===undefined)return r&&"get"in r&&(i=r.get(e,t))!==null?i:(i=jQuery.find.attr(e,t),i==null?undefined:i);if(n!==null)return r&&"set"in r&&(i=r.set(e,n,t))!==undefined?i:(e.setAttribute(t,n+""),n);jQuery.removeAttr(e,t)},removeAttr:function(e,t){var n,r,i=0,s=t&&t.match(rnotwhite);if(s&&e.nodeType===1)while(n=s[i++])r=jQuery.propFix[n]||n,jQuery.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)},attrHooks:{type:{set:function(e,t){if(!support.radioValue&&t==="radio"&&jQuery.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}}}),boolHook={set:function(e,t,n){return t===!1?jQuery.removeAttr(e,n):e.setAttribute(n,n),n}},jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g),function(e,t){var n=attrHandle[t]||jQuery.find.attr;attrHandle[t]=function(e,t,r){var i,s;return r||(s=attrHandle[t],attrHandle[t]=i,i=n(e,t,r)!=null?t.toLowerCase():null,attrHandle[t]=s),i}});var rfocusable=/^(?:input|select|textarea|button)$/i;jQuery.fn.extend({prop:function(e,t){return access(this,jQuery.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[jQuery.propFix[e]||e]})}}),jQuery.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,n){var r,i,s,o=e.nodeType;if(!e||o===3||o===8||o===2)return;return s=o!==1||!jQuery.isXMLDoc(e),s&&(t=jQuery.propFix[t]||t,i=jQuery.propHooks[t]),n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&(r=i.get(e,t))!==null?r:e[t]},propHooks:{tabIndex:{get:function(e){return e.hasAttribute("tabindex")||rfocusable.test(e.nodeName)||e.href?e.tabIndex:-1}}}}),support.optSelected||(jQuery.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null}}),jQuery.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){jQuery.propFix[this.toLowerCase()]=this});var rclass=/[\t\r\n\f]/g;jQuery.fn.extend({addClass:function(e){var t,n,r,i,s,o,u=typeof e=="string"&&e,a=0,f=this.length;if(jQuery.isFunction(e))return this.each(function(t){jQuery(this).addClass(e.call(this,t,this.className))});if(u){t=(e||"").match(rnotwhite)||[];for(;a<f;a++){n=this[a],r=n.nodeType===1&&(n.className?(" "+n.className+" ").replace(rclass," "):" ");if(r){s=0;while(i=t[s++])r.indexOf(" "+i+" ")<0&&(r+=i+" ");o=jQuery.trim(r),n.className!==o&&(n.className=o)}}}return this},removeClass:function(e){var t,n,r,i,s,o,u=arguments.length===0||typeof e=="string"&&e,a=0,f=this.length;if(jQuery.isFunction(e))return this.each(function(t){jQuery(this).removeClass(e.call(this,t,this.className))});if(u){t=(e||"").match(rnotwhite)||[];for(;a<f;a++){n=this[a],r=n.nodeType===1&&(n.className?(" "+n.className+" ").replace(rclass," "):"");if(r){s=0;while(i=t[s++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");o=e?jQuery.trim(r):"",n.className!==o&&(n.className=o)}}}return this},toggleClass:function(e,t){var n=typeof e;return typeof t=="boolean"&&n==="string"?t?this.addClass(e):this.removeClass(e):jQuery.isFunction(e)?this.each(function(n){jQuery(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var t,r=0,i=jQuery(this),s=e.match(rnotwhite)||[];while(t=s[r++])i.hasClass(t)?i.removeClass(t):i.addClass(t)}else if(n===strundefined||n==="boolean")this.className&&data_priv.set(this,"__className__",this.className),this.className=this.className||e===!1?"":data_priv.get(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(rclass," ").indexOf(t)>=0)return!0;return!1}});var rreturn=/\r/g;jQuery.fn.extend({val:function(e){var t,n,r,i=this[0];if(!arguments.length){if(i)return t=jQuery.valHooks[i.type]||jQuery.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,typeof n=="string"?n.replace(rreturn,""):n==null?"":n);return}return r=jQuery.isFunction(e),this.each(function(n){var i;if(this.nodeType!==1)return;r?i=e.call(this,n,jQuery(this).val()):i=e,i==null?i="":typeof i=="number"?i+="":jQuery.isArray(i)&&(i=jQuery.map(i,function(e){return e==null?"":e+""})),t=jQuery.valHooks[this.type]||jQuery.valHooks[this.nodeName.toLowerCase()];if(!t||!("set"in t)||t.set(this,i,"value")===undefined)this.value=i})}}),jQuery.extend({valHooks:{option:{get:function(e){var t=jQuery.find.attr(e,"value");return t!=null?t:jQuery.trim(jQuery.text(e))}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!jQuery.nodeName(n.parentNode,"optgroup"))){t=jQuery(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n,r,i=e.options,s=jQuery.makeArray(t),o=i.length;while(o--){r=i[o];if(r.selected=jQuery.inArray(r.value,s)>=0)n=!0}return n||(e.selectedIndex=-1),s}}}}),jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={set:function(e,t){if(jQuery.isArray(t))return e.checked=jQuery.inArray(jQuery(e).val(),t)>=0}},support.checkOn||(jQuery.valHooks[this].get=function(e){return e.getAttribute("value")===null?"on":e.value})}),jQuery.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){jQuery.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),jQuery.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)}});var nonce=jQuery.now(),rquery=/\?/;jQuery.parseJSON=function(e){return JSON.parse(e+"")},jQuery.parseXML=function(e){var t,n;if(!e||typeof e!="string")return null;try{n=new DOMParser,t=n.parseFromString(e,"text/xml")}catch(r){t=undefined}return(!t||t.getElementsByTagName("parsererror").length)&&jQuery.error("Invalid XML: "+e),t};var rhash=/#.*$/,rts=/([?&])_=[^&]*/,rheaders=/^(.*?):[ \t]*([^\r\n]*)$/mg,rlocalProtocol=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,rurl=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,prefilters={},transports={},allTypes="*/".concat("*"),ajaxLocation=window.location.href,ajaxLocParts=rurl.exec(ajaxLocation.toLowerCase())||[];jQuery.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ajaxLocation,type:"GET",isLocal:rlocalProtocol.test(ajaxLocParts[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":allTypes,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":jQuery.parseJSON,"text xml":jQuery.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?ajaxExtend(ajaxExtend(e,jQuery.ajaxSettings),t):ajaxExtend(jQuery.ajaxSettings,e)},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(e,t){function S(e,t,s,u){var f,m,g,b,E,S=t;if(y===2)return;y=2,o&&clearTimeout(o),n=undefined,i=u||"",w.readyState=e>0?4:0,f=e>=200&&e<300||e===304,s&&(b=ajaxHandleResponses(l,w,s)),b=ajaxConvert(l,b,w,f);if(f)l.ifModified&&(E=w.getResponseHeader("Last-Modified"),E&&(jQuery.lastModified[r]=E),E=w.getResponseHeader("etag"),E&&(jQuery.etag[r]=E)),e===204||l.type==="HEAD"?S="nocontent":e===304?S="notmodified":(S=b.state,m=b.data,g=b.error,f=!g);else{g=S;if(e||!S)S="error",e<0&&(e=0)}w.status=e,w.statusText=(t||S)+"",f?p.resolveWith(c,[m,S,w]):p.rejectWith(c,[w,S,g]),w.statusCode(v),v=undefined,a&&h.trigger(f?"ajaxSuccess":"ajaxError",[w,l,f?m:g]),d.fireWith(c,[w,S]),a&&(h.trigger("ajaxComplete",[w,l]),--jQuery.active||jQuery.event.trigger("ajaxStop"))}typeof e=="object"&&(t=e,e=undefined),t=t||{};var n,r,i,s,o,u,a,f,l=jQuery.ajaxSetup({},t),c=l.context||l,h=l.context&&(c.nodeType||c.jquery)?jQuery(c):jQuery.event,p=jQuery.Deferred(),d=jQuery.Callbacks("once memory"),v=l.statusCode||{},m={},g={},y=0,b="canceled",w={readyState:0,getResponseHeader:function(e){var t;if(y===2){if(!s){s={};while(t=rheaders.exec(i))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return t==null?null:t},getAllResponseHeaders:function(){return y===2?i:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return y||(e=g[n]=g[n]||e,m[e]=t),this},overrideMimeType:function(e){return y||(l.mimeType=e),this},statusCode:function(e){var t;if(e)if(y<2)for(t in e)v[t]=[v[t],e[t]];else w.always(e[w.status]);return this},abort:function(e){var t=e||b;return n&&n.abort(t),S(0,t),this}};p.promise(w).complete=d.add,w.success=w.done,w.error=w.fail,l.url=((e||l.url||ajaxLocation)+"").replace(rhash,"").replace(rprotocol,ajaxLocParts[1]+"//"),l.type=t.method||t.type||l.method||l.type,l.dataTypes=jQuery.trim(l.dataType||"*").toLowerCase().match(rnotwhite)||[""],l.crossDomain==null&&(u=rurl.exec(l.url.toLowerCase()),l.crossDomain=!(!u||u[1]===ajaxLocParts[1]&&u[2]===ajaxLocParts[2]&&(u[3]||(u[1]==="http:"?"80":"443"))===(ajaxLocParts[3]||(ajaxLocParts[1]==="http:"?"80":"443")))),l.data&&l.processData&&typeof l.data!="string"&&(l.data=jQuery.param(l.data,l.traditional)),inspectPrefiltersOrTransports(prefilters,l,t,w);if(y===2)return w;a=jQuery.event&&l.global,a&&jQuery.active++===0&&jQuery.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!rnoContent.test(l.type),r=l.url,l.hasContent||(l.data&&(r=l.url+=(rquery.test(r)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=rts.test(r)?r.replace(rts,"$1_="+nonce++):r+(rquery.test(r)?"&":"?")+"_="+nonce++)),l.ifModified&&(jQuery.lastModified[r]&&w.setRequestHeader("If-Modified-Since",jQuery.lastModified[r]),jQuery.etag[r]&&w.setRequestHeader("If-None-Match",jQuery.etag[r])),(l.data&&l.hasContent&&l.contentType!==!1||t.contentType)&&w.setRequestHeader("Content-Type",l.contentType),w.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):l.accepts["*"]);for(f in l.headers)w.setRequestHeader(f,l.headers[f]);if(!l.beforeSend||l.beforeSend.call(c,w,l)!==!1&&y!==2){b="abort";for(f in{success:1,error:1,complete:1})w[f](l[f]);n=inspectPrefiltersOrTransports(transports,l,t,w);if(!n)S(-1,"No Transport");else{w.readyState=1,a&&h.trigger("ajaxSend",[w,l]),l.async&&l.timeout>0&&(o=setTimeout(function(){w.abort("timeout")},l.timeout));try{y=1,n.send(m,S)}catch(E){if(!(y<2))throw E;S(-1,E)}}return w}return w.abort()},getJSON:function(e,t,n){return jQuery.get(e,t,n,"json")},getScript:function(e,t){return jQuery.get(e,undefined,t,"script")}}),jQuery.each(["get","post"],function(e,t){jQuery[t]=function(e,n,r,i){return jQuery.isFunction(n)&&(i=i||r,r=n,n=undefined),jQuery.ajax({url:e,type:t,dataType:i,data:n,success:r})}}),jQuery._evalUrl=function(e){return jQuery.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},jQuery.fn.extend({wrapAll:function(e){var t;return jQuery.isFunction(e)?this.each(function(t){jQuery(this).wrapAll(e.call(this,t))}):(this[0]&&(t=jQuery(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return jQuery.isFunction(e)?this.each(function(t){jQuery(this).wrapInner(e.call(this,t))}):this.each(function(){var t=jQuery(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=jQuery.isFunction(e);return this.each(function(n){jQuery(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){jQuery.nodeName(this,"body")||jQuery(this).replaceWith(this.childNodes)}).end()}}),jQuery.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0},jQuery.expr.filters.visible=function(e){return!jQuery.expr.filters.hidden(e)};var r20=/%20/g,rbracket=/\[\]$/,rCRLF=/\r?\n/g,rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i;jQuery.param=function(e,t){var n,r=[],i=function(e,t){t=jQuery.isFunction(t)?t():t==null?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};t===undefined&&(t=jQuery.ajaxSettings&&jQuery.ajaxSettings.traditional);if(jQuery.isArray(e)||e.jquery&&!jQuery.isPlainObject(e))jQuery.each(e,function(){i(this.name,this.value)});else for(n in e)buildParams(n,e[n],t,i);return r.join("&").replace(r20,"+")},jQuery.fn.extend({serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=jQuery.prop(this,"elements");return e?jQuery.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!jQuery(this).is(":disabled")&&rsubmittable.test(this.nodeName)&&!rsubmitterTypes.test(e)&&(this.checked||!rcheckableType.test(e))}).map(function(e,t){var n=jQuery(this).val();return n==null?null:jQuery.isArray(n)?jQuery.map(n,function(e){return{name:t.name,value:e.replace(rCRLF,"\r\n")}}):{name:t.name,value:n.replace(rCRLF,"\r\n")}}).get()}}),jQuery.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(e){}};var xhrId=0,xhrCallbacks={},xhrSuccessStatus={0:200,1223:204},xhrSupported=jQuery.ajaxSettings.xhr();window.attachEvent&&window.attachEvent("onunload",function(){for(var e in xhrCallbacks)xhrCallbacks[e]()}),support.cors=!!xhrSupported&&"withCredentials"in xhrSupported,support.ajax=xhrSupported=!!xhrSupported,jQuery.ajaxTransport(function(e){var t;if(support.cors||xhrSupported&&!e.crossDomain)return{send:function(n,r){var i,s=e.xhr(),o=++xhrId;s.open(e.type,e.url,e.async,e.username,e.password);if(e.xhrFields)for(i in e.xhrFields)s[i]=e.xhrFields[i];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),!e.crossDomain&&!n["X-Requested-With"]&&(n["X-Requested-With"]="XMLHttpRequest");for(i in n)s.setRequestHeader(i,n[i]);t=function(e){return function(){t&&(delete xhrCallbacks[o],t=s.onload=s.onerror=null,e==="abort"?s.abort():e==="error"?r(s.status,s.statusText):r(xhrSuccessStatus[s.status]||s.status,s.statusText,typeof s.responseText=="string"?{text:s.responseText}:undefined,s.getAllResponseHeaders()))}},s.onload=t(),s.onerror=t("error"),t=xhrCallbacks[o]=t("abort");try{s.send(e.hasContent&&e.data||null)}catch(u){if(t)throw u}},abort:function(){t&&t()}}}),jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return jQuery.globalEval(e),e}}}),jQuery.ajaxPrefilter("script",function(e){e.cache===undefined&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),jQuery.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=jQuery("<script>").prop({async:!0,charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i(e.type==="error"?404:200,e.type)}),document.head.appendChild(t[0])},abort:function(){n&&n()}}}});var oldCallbacks=[],rjsonp=/(=)\?(?=&|$)|\?\?/;jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=oldCallbacks.pop()||jQuery.expando+"_"+nonce++;return this[e]=!0,e}}),jQuery.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,s,o=e.jsonp!==!1&&(rjsonp.test(e.url)?"url":typeof e.data=="string"&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&rjsonp.test(e.data)&&"data");if(o||e.dataTypes[0]==="jsonp")return r=e.jsonpCallback=jQuery.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,o?e[o]=e[o].replace(rjsonp,"$1"+r):e.jsonp!==!1&&(e.url+=(rquery.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return s||jQuery.error(r+" was not called"),s[0]},e.dataTypes[0]="json",i=window[r],window[r]=function(){s=arguments},n.always(function(){window[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,oldCallbacks.push(r)),s&&jQuery.isFunction(i)&&i(s[0]),s=i=undefined}),"script"}),jQuery.parseHTML=function(e,t,n){if(!e||typeof e!="string")return null;typeof t=="boolean"&&(n=t,t=!1),t=t||document;var r=rsingleTag.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=jQuery.buildFragment([e],t,i),i&&i.length&&jQuery(i).remove(),jQuery.merge([],r.childNodes))};var _load=jQuery.fn.load;jQuery.fn.load=function(e,t,n){if(typeof e!="string"&&_load)return _load.apply(this,arguments);var r,i,s,o=this,u=e.indexOf(" ");return u>=0&&(r=jQuery.trim(e.slice(u)),e=e.slice(0,u)),jQuery.isFunction(t)?(n=t,t=undefined):t&&typeof t=="object"&&(i="POST"),o.length>0&&jQuery.ajax({url:e,type:i,dataType:"html",data:t}).done(function(e){s=arguments,o.html(r?jQuery("<div>").append(jQuery.parseHTML(e)).find(r):e)}).complete(n&&function(e,t){o.each(n,s||[e.responseText,t,e])}),this},jQuery.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){jQuery.fn[t]=function(e){return this.on(t,e)}}),jQuery.expr.filters.animated=function(e){return jQuery.grep(jQuery.timers,function(t){return e===t.elem}).length};var docElem=window.document.documentElement;jQuery.offset={setOffset:function(e,t,n){var r,i,s,o,u,a,f,l=jQuery.css(e,"position"),c=jQuery(e),h={};l==="static"&&(e.style.position="relative"),u=c.offset(),s=jQuery.css(e,"top"),a=jQuery.css(e,"left"),f=(l==="absolute"||l==="fixed")&&(s+a).indexOf("auto")>-1,f?(r=c.position(),o=r.top,i=r.left):(o=parseFloat(s)||0,i=parseFloat(a)||0),jQuery.isFunction(t)&&(t=t.call(e,n,u)),t.top!=null&&(h.top=t.top-u.top+o),t.left!=null&&(h.left=t.left-u.left+i),"using"in t?t.using.call(e,h):c.css(h)}},jQuery.fn.extend({offset:function(e){if(arguments.length)return e===undefined?this:this.each(function(t){jQuery.offset.setOffset(this,e,t)});var t,n,r=this[0],i={top:0,left:0},s=r&&r.ownerDocument;if(!s)return;return t=s.documentElement,jQuery.contains(t,r)?(typeof r.getBoundingClientRect!==strundefined&&(i=r.getBoundingClientRect()),n=getWindow(s),{top:i.top+n.pageYOffset-t.clientTop,left:i.left+n.pageXOffset-t.clientLeft}):i},position:function(){if(!this[0])return;var e,t,n=this[0],r={top:0,left:0};return jQuery.css(n,"position")==="fixed"?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),jQuery.nodeName(e[0],"html")||(r=e.offset()),r.top+=jQuery.css(e[0],"borderTopWidth",!0),r.left+=jQuery.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-jQuery.css(n,"marginTop",!0),left:t.left-r.left-jQuery.css(n,"marginLeft",!0)}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||docElem;while(e&&!jQuery.nodeName(e,"html")&&jQuery.css(e,"position")==="static")e=e.offsetParent;return e||docElem})}}),jQuery.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;jQuery.fn[e]=function(r){return access(this,function(e,r,i){var s=getWindow(e);if(i===undefined)return s?s[t]:e[r];s?s.scrollTo(n?window.pageXOffset:i,n?i:window.pageYOffset):e[r]=i},e,r,arguments.length,null)}}),jQuery.each(["top","left"],function(e,t){jQuery.cssHooks[t]=addGetHookIf(support.pixelPosition,function(e,n){if(n)return n=curCSS(e,t),rnumnonpx.test(n)?jQuery(e).position()[t]+"px":n})}),jQuery.each({Height:"height",Width:"width"},function(e,t){jQuery.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){jQuery.fn[r]=function(r,i){var s=arguments.length&&(n||typeof r!="boolean"),o=n||(r===!0||i===!0?"margin":"border");return access(this,function(t,n,r){var i;return jQuery.isWindow(t)?t.document.documentElement["client"+e]:t.nodeType===9?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):r===undefined?jQuery.css(t,n,o):jQuery.style(t,n,r,o)},t,s?r:undefined,s,null)}})}),jQuery.fn.size=function(){return this.length},jQuery.fn.andSelf=jQuery.fn.addBack,typeof define=="function"&&define.amd&&define("jquery",[],function(){return jQuery});var _jQuery=window.jQuery,_$=window.$;return jQuery.noConflict=function(e){return window.$===jQuery&&(window.$=_$),e&&window.jQuery===jQuery&&(window.jQuery=_jQuery),jQuery},typeof noGlobal===strundefined&&(window.jQuery=window.$=jQuery),jQuery}),function(){function x(e){function t(t,n,r,i,s,o){for(;s>=0&&s<o;s+=e){var u=i?i[s]:s;r=n(r,t[u],u,t)}return r}return function(n,r,i,s){r=v(r,s,4);var o=!S(n)&&d.keys(n),u=(o||n).length,a=e>0?0:u-1;return arguments.length<3&&(i=n[o?o[a]:a],a+=e),t(n,r,i,o,a,u)}}function C(e){return function(t,n,r){n=m(n,r);var i=E(t),s=e>0?0:i-1;for(;s>=0&&s<i;s+=e)if(n(t[s],s,t))return s;return-1}}function k(e,t,n){return function(r,i,s){var u=0,a=E(r);if(typeof s=="number")e>0?u=s>=0?s:Math.max(s+a,u):a=s>=0?Math.min(s+1,a):s+a+1;else if(n&&s&&a)return s=n(r,i),r[s]===i?s:-1;if(i!==i)return s=t(o.call(r,u,a),d.isNaN),s>=0?s+u:-1;for(s=e>0?u:a-1;s>=0&&s<a;s+=e)if(r[s]===i)return s;return-1}}function M(e,t){var n=O.length,i=e.constructor,s=d.isFunction(i)&&i.prototype||r,o="constructor";d.has(e,o)&&!d.contains(t,o)&&t.push(o);while(n--)o=O[n],o in e&&e[o]!==s[o]&&!d.contains(t,o)&&t.push(o)}var e=this,t=e._,n=Array.prototype,r=Object.prototype,i=Function.prototype,s=n.push,o=n.slice,u=r.toString,a=r.hasOwnProperty,f=Array.isArray,l=Object.keys,c=i.bind,h=Object.create,p=function(){},d=function(e){if(e instanceof d)return e;if(!(this instanceof d))return new d(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=d),exports._=d):e._=d,d.VERSION="1.8.3";var v=function(e,t,n){if(t===void 0)return e;switch(n==null?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,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,s){return e.call(t,n,r,i,s)}}return function(){return e.apply(t,arguments)}},m=function(e,t,n){return e==null?d.identity:d.isFunction(e)?v(e,t,n):d.isObject(e)?d.matcher(e):d.property(e)};d.iteratee=function(e,t){return m(e,t,Infinity)};var g=function(e,t){return function(n){var r=arguments.length;if(r<2||n==null)return n;for(var i=1;i<r;i++){var s=arguments[i],o=e(s),u=o.length;for(var a=0;a<u;a++){var f=o[a];if(!t||n[f]===void 0)n[f]=s[f]}}return n}},y=function(e){if(!d.isObject(e))return{};if(h)return h(e);p.prototype=e;var t=new p;return p.prototype=null,t},b=function(e){return function(t){return t==null?void 0:t[e]}},w=Math.pow(2,53)-1,E=b("length"),S=function(e){var t=E(e);return typeof t=="number"&&t>=0&&t<=w};d.each=d.forEach=function(e,t,n){t=v(t,n);var r,i;if(S(e))for(r=0,i=e.length;r<i;r++)t(e[r],r,e);else{var s=d.keys(e);for(r=0,i=s.length;r<i;r++)t(e[s[r]],s[r],e)}return e},d.map=d.collect=function(e,t,n){t=m(t,n);var r=!S(e)&&d.keys(e),i=(r||e).length,s=Array(i);for(var o=0;o<i;o++){var u=r?r[o]:o;s[o]=t(e[u],u,e)}return s},d.reduce=d.foldl=d.inject=x(1),d.reduceRight=d.foldr=x(-1),d.find=d.detect=function(e,t,n){var r;S(e)?r=d.findIndex(e,t,n):r=d.findKey(e,t,n);if(r!==void 0&&r!==-1)return e[r]},d.filter=d.select=function(e,t,n){var r=[];return t=m(t,n),d.each(e,function(e,n,i){t(e,n,i)&&r.push(e)}),r},d.reject=function(e,t,n){return d.filter(e,d.negate(m(t)),n)},d.every=d.all=function(e,t,n){t=m(t,n);var r=!S(e)&&d.keys(e),i=(r||e).length;for(var s=0;s<i;s++){var o=r?r[s]:s;if(!t(e[o],o,e))return!1}return!0},d.some=d.any=function(e,t,n){t=m(t,n);var r=!S(e)&&d.keys(e),i=(r||e).length;for(var s=0;s<i;s++){var o=r?r[s]:s;if(t(e[o],o,e))return!0}return!1},d.contains=d.includes=d.include=function(e,t,n,r){S(e)||(e=d.values(e));if(typeof n!="number"||r)n=0;return d.indexOf(e,t,n)>=0},d.invoke=function(e,t){var n=o.call(arguments,2),r=d.isFunction(t);return d.map(e,function(e){var i=r?t:e[t];return i==null?i:i.apply(e,n)})},d.pluck=function(e,t){return d.map(e,d.property(t))},d.where=function(e,t){return d.filter(e,d.matcher(t))},d.findWhere=function(e,t){return d.find(e,d.matcher(t))},d.max=function(e,t,n){var r=-Infinity,i=-Infinity,s,o;if(t==null&&e!=null){e=S(e)?e:d.values(e);for(var u=0,a=e.length;u<a;u++)s=e[u],s>r&&(r=s)}else t=m(t,n),d.each(e,function(e,n,s){o=t(e,n,s);if(o>i||o===-Infinity&&r===-Infinity)r=e,i=o});return r},d.min=function(e,t,n){var r=Infinity,i=Infinity,s,o;if(t==null&&e!=null){e=S(e)?e:d.values(e);for(var u=0,a=e.length;u<a;u++)s=e[u],s<r&&(r=s)}else t=m(t,n),d.each(e,function(e,n,s){o=t(e,n,s);if(o<i||o===Infinity&&r===Infinity)r=e,i=o});return r},d.shuffle=function(e){var t=S(e)?e:d.values(e),n=t.length,r=Array(n);for(var i=0,s;i<n;i++)s=d.random(0,i),s!==i&&(r[i]=r[s]),r[s]=t[i];return r},d.sample=function(e,t,n){return t==null||n?(S(e)||(e=d.values(e)),e[d.random(e.length-1)]):d.shuffle(e).slice(0,Math.max(0,t))},d.sortBy=function(e,t,n){return t=m(t,n),d.pluck(d.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||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index-t.index}),"value")};var T=function(e){return function(t,n,r){var i={};return n=m(n,r),d.each(t,function(r,s){var o=n(r,s,t);e(i,r,o)}),i}};d.groupBy=T(function(e,t,n){d.has(e,n)?e[n].push(t):e[n]=[t]}),d.indexBy=T(function(e,t,n){e[n]=t}),d.countBy=T(function(e,t,n){d.has(e,n)?e[n]++:e[n]=1}),d.toArray=function(e){return e?d.isArray(e)?o.call(e):S(e)?d.map(e,d.identity):d.values(e):[]},d.size=function(e){return e==null?0:S(e)?e.length:d.keys(e).length},d.partition=function(e,t,n){t=m(t,n);var r=[],i=[];return d.each(e,function(e,n,s){(t(e,n,s)?r:i).push(e)}),[r,i]},d.first=d.head=d.take=function(e,t,n){return e==null?void 0:t==null||n?e[0]:d.initial(e,e.length-t)},d.initial=function(e,t,n){return o.call(e,0,Math.max(0,e.length-(t==null||n?1:t)))},d.last=function(e,t,n){return e==null?void 0:t==null||n?e[e.length-1]:d.rest(e,Math.max(0,e.length-t))},d.rest=d.tail=d.drop=function(e,t,n){return o.call(e,t==null||n?1:t)},d.compact=function(e){return d.filter(e,d.identity)};var N=function(e,t,n,r){var i=[],s=0;for(var o=r||0,u=E(e);o<u;o++){var a=e[o];if(S(a)&&(d.isArray(a)||d.isArguments(a))){t||(a=N(a,t,n));var f=0,l=a.length;i.length+=l;while(f<l)i[s++]=a[f++]}else n||(i[s++]=a)}return i};d.flatten=function(e,t){return N(e,t,!1)},d.without=function(e){return d.difference(e,o.call(arguments,1))},d.uniq=d.unique=function(e,t,n,r){d.isBoolean(t)||(r=n,n=t,t=!1),n!=null&&(n=m(n,r));var i=[],s=[];for(var o=0,u=E(e);o<u;o++){var a=e[o],f=n?n(a,o,e):a;t?((!o||s!==f)&&i.push(a),s=f):n?d.contains(s,f)||(s.push(f),i.push(a)):d.contains(i,a)||i.push(a)}return i},d.union=function(){return d.uniq(N(arguments,!0,!0))},d.intersection=function(e){var t=[],n=arguments.length;for(var r=0,i=E(e);r<i;r++){var s=e[r];if(d.contains(t,s))continue;for(var o=1;o<n;o++)if(!d.contains(arguments[o],s))break;o===n&&t.push(s)}return t},d.difference=function(e){var t=N(arguments,!0,!0,1);return d.filter(e,function(e){return!d.contains(t,e)})},d.zip=function(){return d.unzip(arguments)},d.unzip=function(e){var t=e&&d.max(e,E).length||0,n=Array(t);for(var r=0;r<t;r++)n[r]=d.pluck(e,r);return n},d.object=function(e,t){var n={};for(var r=0,i=E(e);r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},d.findIndex=C(1),d.findLastIndex=C(-1),d.sortedIndex=function(e,t,n,r){n=m(n,r,1);var i=n(t),s=0,o=E(e);while(s<o){var u=Math.floor((s+o)/2);n(e[u])<i?s=u+1:o=u}return s},d.indexOf=k(1,d.findIndex,d.sortedIndex),d.lastIndexOf=k(-1,d.findLastIndex),d.range=function(e,t,n){t==null&&(t=e||0,e=0),n=n||1;var r=Math.max(Math.ceil((t-e)/n),0),i=Array(r);for(var s=0;s<r;s++,e+=n)i[s]=e;return i};var L=function(e,t,n,r,i){if(r instanceof t){var s=y(e.prototype),o=e.apply(s,i);return d.isObject(o)?o:s}return e.apply(n,i)};d.bind=function(e,t){if(c&&e.bind===c)return c.apply(e,o.call(arguments,1));if(!d.isFunction(e))throw new TypeError("Bind must be called on a function");var n=o.call(arguments,2),r=function(){return L(e,r,t,this,n.concat(o.call(arguments)))};return r},d.partial=function(e){var t=o.call(arguments,1),n=function(){var r=0,i=t.length,s=Array(i);for(var o=0;o<i;o++)s[o]=t[o]===d?arguments[r++]:t[o];while(r<arguments.length)s.push(arguments[r++]);return L(e,n,this,this,s)};return n},d.bindAll=function(e){var t,n=arguments.length,r;if(n<=1)throw new Error("bindAll must be passed function names");for(t=1;t<n;t++)r=arguments[t],e[r]=d.bind(e[r],e);return e},d.memoize=function(e,t){var n=function(r){var i=n.cache,s=""+(t?t.apply(this,arguments):r);return d.has(i,s)||(i[s]=e.apply(this,arguments)),i[s]};return n.cache={},n},d.delay=function(e,t){var n=o.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},d.defer=d.partial(d.delay,d,1),d.throttle=function(e,t,n){var r,i,s,o=null,u=0;n||(n={});var a=function(){u=n.leading===!1?0:d.now(),o=null,s=e.apply(r,i),o||(r=i=null)};return function(){var f=d.now();!u&&n.leading===!1&&(u=f);var l=t-(f-u);return r=this,i=arguments,l<=0||l>t?(o&&(clearTimeout(o),o=null),u=f,s=e.apply(r,i),o||(r=i=null)):!o&&n.trailing!==!1&&(o=setTimeout(a,l)),s}},d.debounce=function(e,t,n){var r,i,s,o,u,a=function(){var f=d.now()-o;f<t&&f>=0?r=setTimeout(a,t-f):(r=null,n||(u=e.apply(s,i),r||(s=i=null)))};return function(){s=this,i=arguments,o=d.now();var f=n&&!r;return r||(r=setTimeout(a,t)),f&&(u=e.apply(s,i),s=i=null),u}},d.wrap=function(e,t){return d.partial(t,e)},d.negate=function(e){return function(){return!e.apply(this,arguments)}},d.compose=function(){var e=arguments,t=e.length-1;return function(){var n=t,r=e[t].apply(this,arguments);while(n--)r=e[n].call(this,r);return r}},d.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},d.before=function(e,t){var n;return function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=null),n}},d.once=d.partial(d.before,2);var A=!{toString:null}.propertyIsEnumerable("toString"),O=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];d.keys=function(e){if(!d.isObject(e))return[];if(l)return l(e);var t=[];for(var n in e)d.has(e,n)&&t.push(n);return A&&M(e,t),t},d.allKeys=function(e){if(!d.isObject(e))return[];var t=[];for(var n in e)t.push(n);return A&&M(e,t),t},d.values=function(e){var t=d.keys(e),n=t.length,r=Array(n);for(var i=0;i<n;i++)r[i]=e[t[i]];return r},d.mapObject=function(e,t,n){t=m(t,n);var r=d.keys(e),i=r.length,s={},o;for(var u=0;u<i;u++)o=r[u],s[o]=t(e[o],o,e);return s},d.pairs=function(e){var t=d.keys(e),n=t.length,r=Array(n);for(var i=0;i<n;i++)r[i]=[t[i],e[t[i]]];return r},d.invert=function(e){var t={},n=d.keys(e);for(var r=0,i=n.length;r<i;r++)t[e[n[r]]]=n[r];return t},d.functions=d.methods=function(e){var t=[];for(var n in e)d.isFunction(e[n])&&t.push(n);return t.sort()},d.extend=g(d.allKeys),d.extendOwn=d.assign=g(d.keys),d.findKey=function(e,t,n){t=m(t,n);var r=d.keys(e),i;for(var s=0,o=r.length;s<o;s++){i=r[s];if(t(e[i],i,e))return i}},d.pick=function(e,t,n){var r={},i=e,s,o;if(i==null)return r;d.isFunction(t)?(o=d.allKeys(i),s=v(t,n)):(o=N(arguments,!1,!1,1),s=function(e,t,n){return t in n},i=Object(i));for(var u=0,a=o.length;u<a;u++){var f=o[u],l=i[f];s(l,f,i)&&(r[f]=l)}return r},d.omit=function(e,t,n){if(d.isFunction(t))t=d.negate(t);else{var r=d.map(N(arguments,!1,!1,1),String);t=function(e,t){return!d.contains(r,t)}}return d.pick(e,t,n)},d.defaults=g(d.allKeys,!0),d.create=function(e,t){var n=y(e);return t&&d.extendOwn(n,t),n},d.clone=function(e){return d.isObject(e)?d.isArray(e)?e.slice():d.extend({},e):e},d.tap=function(e,t){return t(e),e},d.isMatch=function(e,t){var n=d.keys(t),r=n.length;if(e==null)return!r;var i=Object(e);for(var s=0;s<r;s++){var o=n[s];if(t[o]!==i[o]||!(o in i))return!1}return!0};var _=function(e,t,n,r){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return e===t;e instanceof d&&(e=e._wrapped),t instanceof d&&(t=t._wrapped);var i=u.call(e);if(i!==u.call(t))return!1;switch(i){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":if(+e!==+e)return+t!==+t;return+e===0?1/+e===1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t}var s=i==="[object Array]";if(!s){if(typeof e!="object"||typeof t!="object")return!1;var o=e.constructor,a=t.constructor;if(o!==a&&!(d.isFunction(o)&&o instanceof o&&d.isFunction(a)&&a instanceof a)&&"constructor"in e&&"constructor"in t)return!1}n=n||[],r=r||[];var f=n.length;while(f--)if(n[f]===e)return r[f]===t;n.push(e),r.push(t);if(s){f=e.length;if(f!==t.length)return!1;while(f--)if(!_(e[f],t[f],n,r))return!1}else{var l=d.keys(e),c;f=l.length;if(d.keys(t).length!==f)return!1;while(f--){c=l[f];if(!d.has(t,c)||!_(e[c],t[c],n,r))return!1}}return n.pop(),r.pop(),!0};d.isEqual=function(e,t){return _(e,t)},d.isEmpty=function(e){return e==null?!0:S(e)&&(d.isArray(e)||d.isString(e)||d.isArguments(e))?e.length===0:d.keys(e).length===0},d.isElement=function(e){return!!e&&e.nodeType===1},d.isArray=f||function(e){return u.call(e)==="[object Array]"},d.isObject=function(e){var t=typeof e;return t==="function"||t==="object"&&!!e},d.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(e){d["is"+e]=function(t){return u.call(t)==="[object "+e+"]"}}),d.isArguments(arguments)||(d.isArguments=function(e){return d.has(e,"callee")}),typeof /./!="function"&&typeof Int8Array!="object"&&(d.isFunction=function(e){return typeof e=="function"||!1}),d.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},d.isNaN=function(e){return d.isNumber(e)&&e!==+e},d.isBoolean=function(e){return e===!0||e===!1||u.call(e)==="[object Boolean]"},d.isNull=function(e){return e===null},d.isUndefined=function(e){return e===void 0},d.has=function(e,t){return e!=null&&a.call(e,t)},d.noConflict=function(){return e._=t,this},d.identity=function(e){return e},d.constant=function(e){return function(){return e}},d.noop=function(){},d.property=b,d.propertyOf=function(e){return e==null?function(){}:function(t){return e[t]}},d.matcher=d.matches=function(e){return e=d.extendOwn({},e),function(t){return d.isMatch(t,e)}},d.times=function(e,t,n){var r=Array(Math.max(0,e));t=v(t,n,1);for(var i=0;i<e;i++)r[i]=t(i);return r},d.random=function(e,t){return t==null&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},d.now=Date.now||function(){return(new Date).getTime()};var D={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},P=d.invert(D),H=function(e){var t=function(t){return e[t]},n="(?:"+d.keys(e).join("|")+")",r=RegExp(n),i=RegExp(n,"g");return function(e){return e=e==null?"":""+e,r.test(e)?e.replace(i,t):e}};d.escape=H(D),d.unescape=H(P),d.result=function(e,t,n){var r=e==null?void 0:e[t];return r===void 0&&(r=n),d.isFunction(r)?r.call(e):r};var B=0;d.uniqueId=function(e){var t=++B+"";return e?e+t:t},d.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var j=/(.)^/,F={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},I=/\\|'|\r|\n|\u2028|\u2029/g,q=function(e){return"\\"+F[e]};d.template=function(e,t,n){!t&&n&&(t=n),t=d.defaults({},t,d.templateSettings);var r=RegExp([(t.escape||j).source,(t.interpolate||j).source,(t.evaluate||j).source].join("|")+"|$","g"),i=0,s="__p+='";e.replace(r,function(t,n,r,o,u){return s+=e.slice(i,u).replace(I,q),i=u+t.length,n?s+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?s+="'+\n((__t=("+r+"))==null?'':__t)+\n'":o&&(s+="';\n"+o+"\n__p+='"),t}),s+="';\n",t.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{var o=new Function(t.variable||"obj","_",s)}catch(u){throw u.source=s,u}var a=function(e){return o.call(this,e,d)},f=t.variable||"obj";return a.source="function("+f+"){\n"+s+"}",a},d.chain=function(e){var t=d(e);return t._chain=!0,t};var R=function(e,t){return e._chain?d(t).chain():t};d.mixin=function(e){d.each(d.functions(e),function(t){var n=d[t]=e[t];d.prototype[t]=function(){var e=[this._wrapped];return s.apply(e,arguments),R(this,n.apply(d,e))}})},d.mixin(d),d.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=n[e];d.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e==="shift"||e==="splice")&&n.length===0&&delete n[0],R(this,n)}}),d.each(["concat","join","slice"],function(e){var t=n[e];d.prototype[e]=function(){return R(this,t.apply(this._wrapped,arguments))}}),d.prototype.value=function(){return this._wrapped},d.prototype.valueOf=d.prototype.toJSON=d.prototype.value,d.prototype.toString=function(){return""+this._wrapped},typeof define=="function"&&define.amd&&define("underscore",[],function(){return d})}.call(this),function(e){define("markdown",[],function(){return function(){return function(e){function n(){return"Markdown.mk_block( "+uneval(this.toString())+", "+uneval(this.trailing)+", "+uneval(this.lineNumber)+" )"}function r(){var e=require("util");return"Markdown.mk_block( "+e.inspect(this.toString())+", "+e.inspect(this.trailing)+", "+e.inspect(this.lineNumber)+" )"}function s(e){var t=0,n=-1;while((n=e.indexOf("\n",n+1))!==-1)t++;return t}function o(e,t){function i(e){this.len_after=e,this.name="close_"+t}var n=e+"_state",r=e=="strong"?"em_state":"strong_state";return function(s,o){if(this[n][0]==t)return this[n].shift(),[s.length,new i(s.length-t.length)];var u=this[r].slice(),a=this[n].slice();this[n].unshift(t);var f=this.processInline(s.substr(t.length)),l=f[f.length-1],c=this[n].shift();if(l instanceof i){f.pop();var h=s.length-l.len_after;return[h,[e].concat(f)]}return this[r]=u,this[n]=a,[t.length,t]}}function u(e){var t=e.split(""),n=[""],r=!1;while(t.length){var i=t.shift();switch(i){case" ":r?n[n.length-1]+=i:n.push("");break;case"'":case'"':r=!r;break;case"\\":i=t.shift();default:n[n.length-1]+=i}}return n}function h(e){return f(e)&&e.length>1&&typeof e[1]=="object"&&!f(e[1])?e[1]:undefined}function d(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function v(e){if(typeof e=="string")return d(e);var t=e.shift(),n={},r=[];e.length&&typeof e[0]=="object"&&!(e[0]instanceof Array)&&(n=e.shift());while(e.length)r.push(v(e.shift()));var i="";for(var s in n)i+=" "+s+'="'+d(n[s])+'"';return t=="img"||t=="br"||t=="hr"?"<"+t+i+"/>":"<"+t+i+">"+r.join("")+"</"+t+">"}function m(e,t,n){var r;n=n||{};var i=e.slice(0);typeof n.preprocessTreeNode=="function"&&(i=n.preprocessTreeNode(i,t));var s=h(i);if(s){i[1]={};for(r in s)i[1][r]=s[r];s=i[1]}if(typeof i=="string")return i;switch(i[0]){case"header":i[0]="h"+i[1].level,delete i[1].level;break;case"bulletlist":i[0]="ul";break;case"numberlist":i[0]="ol";break;case"listitem":i[0]="li";break;case"para":i[0]="p";break;case"markdown":i[0]="html",s&&delete s.references;break;case"code_block":i[0]="pre",r=s?2:1;var o=["code"];o.push.apply(o,i.splice(r,i.length-r)),i[r]=o;break;case"inlinecode":i[0]="code";break;case"img":i[1].src=i[1].href,delete i[1].href;break;case"linebreak":i[0]="br";break;case"link":i[0]="a";break;case"link_ref":i[0]="a";var u=t[s.ref];if(!u)return s.original;delete s.ref,s.href=u.href,u.title&&(s.title=u.title),delete s.original;break;case"img_ref":i[0]="img";var u=t[s.ref];if(!u)return s.original;delete s.ref,s.src=u.href,u.title&&(s.title=u.title),delete s.original}r=1;if(s){for(var a in i[1]){r=2;break}r===1&&i.splice(r,1)}for(;r<i.length;++r)i[r]=m(i[r],t,n);return i}function g(e){var t=h(e)?2:1;while(t<e.length)typeof e[t]=="string"?t+1<e.length&&typeof e[t+1]=="string"?e[t]+=e.splice(t+1,1)[0]:++t:(g(e[t]),++t)}var t=e.Markdown=function(e){switch(typeof e){case"undefined":this.dialect=t.dialects.Gruber;break;case"object":this.dialect=e;break;default:if(!(e in t.dialects))throw new Error("Unknown Markdown dialect '"+String(e)+"'");this.dialect=t.dialects[e]}this.em_state=[],this.strong_state=[],this.debug_indent=""};e.parse=function(e,n){var r=new t(n);return r.toTree(e)},e.toHTML=function(n,r,i){var s=e.toHTMLTree(n,r,i);return e.renderJsonML(s)},e.toHTMLTree=function(t,n,r){typeof t=="string"&&(t=this.parse(t,n));var i=h(t),s={};i&&i.references&&(s=i.references);var o=m(t,s,r);return g(o),o};var i=t.mk_block=function(e,t,i){arguments.length==1&&(t="\n\n");var s=new String(e);return s.trailing=t,s.inspect=r,s.toSource=n,i!=undefined&&(s.lineNumber=i),s};t.prototype.split_blocks=function(t,n){t=t.replace(/(\r\n|\n|\r)/g,"\n");var r=/([\s\S]+?)($|\n#|\n(?:\s*\n|$)+)/g,o=[],u,a=1;(u=/^(\s*\n)/.exec(t))!=null&&(a+=s(u[0]),r.lastIndex=u[0].length);while((u=r.exec(t))!==null)u[2]=="\n#"&&(u[2]="\n",r.lastIndex--),o.push(i(u[1],u[2],a)),a+=s(u[0]);return o},t.prototype.processBlock=function(t,n){var r=this.dialect.block,i=r.__order__;if("__call__"in r)return r.__call__.call(this,t,n);for(var s=0;s<i.length;s++){var o=r[i[s]].call(this,t,n);if(o)return(!f(o)||o.length>0&&!f(o[0]))&&this.debug(i[s],"didn't return a proper array"),o}return[]},t.prototype.processInline=function(t){return this.dialect.inline.__call__.call(this,String(t))},t.prototype.toTree=function(t,n){var r=t instanceof Array?t:this.split_blocks(t),i=this.tree;try{this.tree=n||this.tree||["markdown"];e:while(r.length){var s=this.processBlock(r.shift(),r);if(!s.length)continue e;this.tree.push.apply(this.tree,s)}return this.tree}finally{n&&(this.tree=i)}},t.prototype.debug=function(){var e=Array.prototype.slice.call(arguments);e.unshift(this.debug_indent),typeof print!="undefined"&&print.apply(print,e),typeof console!="undefined"&&typeof console.log!="undefined"&&console.log.apply(null,e)},t.prototype.loop_re_over_block=function(e,t,n){var r,i=t.valueOf();while(i.length&&(r=e.exec(i))!=null)i=i.substr(r[0].length),n.call(this,r);return i},t.dialects={},t.dialects.Gruber={block:{atxHeader:function(t,n){var r=t.match(/^(#{1,6})\s*(.*?)\s*#*\s*(?:\n|$)/);if(!r)return undefined;var s=["header",{level:r[1].length}];return Array.prototype.push.apply(s,this.processInline(r[2])),r[0].length<t.length&&n.unshift(i(t.substr(r[0].length),t.trailing,t.lineNumber+2)),[s]},setextHeader:function(t,n){var r=t.match(/^(.*)\n([-=])\2\2+(?:\n|$)/);if(!r)return undefined;var s=r[2]==="="?1:2,o=["header",{level:s},r[1]];return r[0].length<t.length&&n.unshift(i(t.substr(r[0].length),t.trailing,t.lineNumber+2)),[o]},code:function(t,n){var r=[],s=/^(?: {0,3}\t| {4})(.*)\n?/,o;if(!t.match(s))return undefined;e:do{var u=this.loop_re_over_block(s,t.valueOf(),function(e){r.push(e[1])});if(u.length){n.unshift(i(u,t.trailing));break e}if(!n.length)break e;if(!n[0].match(s))break e;r.push(t.trailing.replace(/[^\n]/g,"").substring(2)),t=n.shift()}while(!0);return[["code_block",r.join("\n")]]},horizRule:function(t,n){var r=t.match(/^(?:([\s\S]*?)\n)?[ \t]*([-_*])(?:[ \t]*\2){2,}[ \t]*(?:\n([\s\S]*))?$/);if(!r)return undefined;var s=[["hr"]];return r[1]&&s.unshift.apply(s,this.processBlock(r[1],[])),r[3]&&n.unshift(i(r[3])),s},lists:function(){function o(t){return new RegExp("(?:^("+s+"{0,"+t+"} {0,3})("+e+")\\s+)|"+"(^"+s+"{0,"+(t-1)+"}[ ]{0,4})")}function u(e){return e.replace(/ {0,3}\t/g,"    ")}function a(e,t,n,r){if(t){e.push(["para"].concat(n));return}var i=e[e.length-1]instanceof Array&&e[e.length-1][0]=="para"?e[e.length-1]:e;r&&e.length>1&&n.unshift(r);for(var s=0;s<n.length;s++){var o=n[s],u=typeof o=="string";u&&i.length>1&&typeof i[i.length-1]=="string"?i[i.length-1]+=o:i.push(o)}}function f(e,t){var n=new RegExp("^("+s+"{"+e+"}.*?\\n?)*$"),r=new RegExp("^"+s+"{"+e+"}","gm"),o=[];while(t.length>0){if(!n.exec(t[0]))break;var u=t.shift(),a=u.replace(r,"");o.push(i(a,u.trailing,u.lineNumber))}return o}function c(e,t,n){var r=e.list,i=r[r.length-1];if(i[1]instanceof Array&&i[1][0]=="para")return;if(t+1==n.length)i.push(["para"].concat(i.splice(1,i.length-1)));else{var s=i.pop();i.push(["para"].concat(i.splice(1,i.length-1)),s)}}var e="[*+-]|\\d+\\.",t=/[*+-]/,n=/\d+\./,r=new RegExp("^( {0,3})("+e+")[ 	]+"),s="(?: {0,3}\\t| {4})";return function(e,n){function s(e){var n=t.exec(e[2])?["bulletlist"]:["numberlist"];return h.push({list:n,indent:e[1]}),n}var i=e.match(r);if(!i)return undefined;var h=[],p=s(i),d,v=!1,m=[h[0].list],g;e:for(;;){var y=e.split(/(?=\n)/),b="";for(var w=0;w<y.length;w++){var E="",S=y[w].replace(/^\n/,function(e){return E=e,""}),x=o(h.length);i=S.match(x);if(i[1]!==undefined){b.length&&(a(d,v,this.processInline(b),E),v=!1,b=""),i[1]=u(i[1]);var T=Math.floor(i[1].length/4)+1;if(T>h.length)p=s(i),d.push(p),d=p[1]=["listitem"];else{var N=!1;for(g=0;g<h.length;g++){if(h[g].indent!=i[1])continue;p=h[g].list,h.splice(g+1,h.length-(g+1)),N=!0;break}N||(T++,T<=h.length?(h.splice(T,h.length-T),p=h[T-1].list):(p=s(i),d.push(p))),d=["listitem"],p.push(d)}E=""}S.length>i[0].length&&(b+=E+S.substr(i[0].length))}b.length&&(a(d,v,this.processInline(b),E),v=!1,b="");var C=f(h.length,n);C.length>0&&(l(h,c,this),d.push.apply(d,this.toTree(C,[])));var k=n[0]&&n[0].valueOf()||"";if(k.match(r)||k.match(/^ /)){e=n.shift();var L=this.dialect.block.horizRule(e,n);if(L){m.push.apply(m,L);break}l(h,c,this),v=!0;continue e}break}return m}}(),blockquote:function(t,n){if(!t.match(/^>/m))return undefined;var r=[];if(t[0]!=">"){var s=t.split(/\n/),o=[],u=t.lineNumber;while(s.length&&s[0][0]!=">")o.push(s.shift()),u++;var a=i(o.join("\n"),"\n",t.lineNumber);r.push.apply(r,this.processBlock(a,[])),t=i(s.join("\n"),t.trailing,u)}while(n.length&&n[0][0]==">"){var f=n.shift();t=i(t+t.trailing+f,f.trailing,t.lineNumber)}var l=t.replace(/^> ?/gm,""),p=this.tree,d=this.toTree(l,["blockquote"]),v=h(d);return v&&v.references&&(delete v.references,c(v)&&d.splice(1,1)),r.push(d),r},referenceDefn:function(t,n){var r=/^\s*\[(.*?)\]:\s*(\S+)(?:\s+(?:(['"])(.*?)\3|\((.*?)\)))?\n?/;if(!t.match(r))return undefined;h(this.tree)||this.tree.splice(1,0,{});var s=h(this.tree);s.references===undefined&&(s.references={});var o=this.loop_re_over_block(r,t,function(e){e[2]&&e[2][0]=="<"&&e[2][e[2].length-1]==">"&&(e[2]=e[2].substring(1,e[2].length-1));var t=s.references[e[1].toLowerCase()]={href:e[2]};e[4]!==undefined?t.title=e[4]:e[5]!==undefined&&(t.title=e[5])});return o.length&&n.unshift(i(o,t.trailing)),[]},para:function(t,n){return[["para"].concat(this.processInline(t))]}}},t.dialects.Gruber.inline={__oneElement__:function(t,n,r){var i,s,o=0;n=n||this.dialect.inline.__patterns__;var u=new RegExp("([\\s\\S]*?)("+(n.source||n)+")");i=u.exec(t);if(!i)return[t.length,t];if(i[1])return[i[1].length,i[1]];var s;return i[2]in this.dialect.inline&&(s=this.dialect.inline[i[2]].call(this,t.substr(i.index),i,r||[])),s=s||[i[2].length,i[2]],s},__call__:function(t,n){function s(e){typeof e=="string"&&typeof r[r.length-1]=="string"?r[r.length-1]+=e:r.push(e)}var r=[],i;while(t.length>0)i=this.dialect.inline.__oneElement__.call(this,t,n,r),t=t.substr(i.shift()),l(i,s);return r},"]":function(){},"}":function(){},__escape__:/^\\[\\`\*_{}\[\]()#\+.!\-]/,"\\":function(t){return this.dialect.inline.__escape__.exec(t)?[2,t.charAt(1)]:[1,"\\"]},"![":function(t){var n=t.match(/^!\[(.*?)\][ \t]*\([ \t]*([^")]*?)(?:[ \t]+(["'])(.*?)\3)?[ \t]*\)/);if(n){n[2]&&n[2][0]=="<"&&n[2][n[2].length-1]==">"&&(n[2]=n[2].substring(1,n[2].length-1)),n[2]=this.dialect.inline.__call__.call(this,n[2],/\\/)[0];var r={alt:n[1],href:n[2]||""};return n[4]!==undefined&&(r.title=n[4]),[n[0].length,["img",r]]}return n=t.match(/^!\[(.*?)\][ \t]*\[(.*?)\]/),n?[n[0].length,["img_ref",{alt:n[1],ref:n[2].toLowerCase(),original:n[0]}]]:[2,"!["]},"[":function y(e){var n=String(e),r=t.DialectHelpers.inline_until_char.call(this,e.substr(1),"]");if(!r)return[1,"["];var i=1+r[0],s=r[1],y,o;e=e.substr(i);var u=e.match(/^\s*\([ \t]*([^"']*)(?:[ \t]+(["'])(.*?)\2)?[ \t]*\)/);if(u){var a=u[1];i+=u[0].length,a&&a[0]=="<"&&a[a.length-1]==">"&&(a=a.substring(1,a.length-1));if(!u[3]){var f=1;for(var l=0;l<a.length;l++)switch(a[l]){case"(":f++;break;case")":--f==0&&(i-=a.length-l,a=a.substring(0,l))}}return a=this.dialect.inline.__call__.call(this,a,/\\/)[0],o={href:a||""},u[3]!==undefined&&(o.title=u[3]),y=["link",o].concat(s),[i,y]}return u=e.match(/^\s*\[(.*?)\]/),u?(i+=u[0].length,o={ref:(u[1]||String(s)).toLowerCase(),original:n.substr(0,i)},y=["link_ref",o].concat(s),[i,y]):s.length==1&&typeof s[0]=="string"?(o={ref:s[0].toLowerCase(),original:n.substr(0,i)},y=["link_ref",o,s[0]],[i,y]):[1,"["]},"<":function(t){var n;return(n=t.match(/^<(?:((https?|ftp|mailto):[^>]+)|(.*?@.*?\.[a-zA-Z]+))>/))!=null?n[3]?[n[0].length,["link",{href:"mailto:"+n[3]},n[3]]]:n[2]=="mailto"?[n[0].length,["link",{href:n[1]},n[1].substr("mailto:".length)]]:[n[0].length,["link",{href:n[1]},n[1]]]:[1,"<"]},"`":function(t){var n=t.match(/(`+)(([\s\S]*?)\1)/);return n&&n[2]?[n[1].length+n[2].length,["inlinecode",n[3]]]:[1,"`"]},"  \n":function(t){return[3,["linebreak"]]}},t.dialects.Gruber.inline["**"]=o("strong","**"),t.dialects.Gruber.inline.__=o("strong","__"),t.dialects.Gruber.inline["*"]=o("em","*"),t.dialects.Gruber.inline._=o("em","_"),t.buildBlockOrder=function(e){var t=[];for(var n in e){if(n=="__order__"||n=="__call__")continue;t.push(n)}e.__order__=t},t.buildInlinePatterns=function(e){var t=[];for(var n in e){if(n.match(/^__.*__$/))continue;var r=n.replace(/([\\.*+?|()\[\]{}])/g,"\\$1").replace(/\n/,"\\n");t.push(n.length==1?r:"(?:"+r+")")}t=t.join("|"),e.__patterns__=t;var i=e.__call__;e.__call__=function(e,n){return n!=undefined?i.call(this,e,n):i.call(this,e,t)}},t.DialectHelpers={},t.DialectHelpers.inline_until_char=function(e,t){var n=0,r=[];for(;;){if(e.charAt(n)==t)return n++,[n,r];if(n>=e.length)return null;var i=this.dialect.inline.__oneElement__.call(this,e.substr(n));n+=i[0],r.push.apply(r,i.slice(1))}},t.subclassDialect=function(e){function t(){}function n(){}return t.prototype=e.block,n.prototype=e.inline,{block:new t,inline:new n}},t.buildBlockOrder(t.dialects.Gruber.block),t.buildInlinePatterns(t.dialects.Gruber.inline),t.dialects.Maruku=t.subclassDialect(t.dialects.Gruber),t.dialects.Maruku.processMetaHash=function(t){var n=u(t),r={};for(var i=0;i<n.length;++i)if(/^#/.test(n[i]))r.id=n[i].substring(1);else if(/^\./.test(n[i]))r["class"]?r["class"]=r["class"]+n[i].replace(/./," "):r["class"]=n[i].substring(1);else if(/\=/.test(n[i])){var s=n[i].split(/\=/);r[s[0]]=s[1]}return r},t.dialects.Maruku.block.document_meta=function(t,n){if(t.lineNumber>1)return undefined;if(!t.match(/^(?:\w+:.*\n)*\w+:.*$/))return undefined;h(this.tree)||this.tree.splice(1,0,{});var r=t.split(/\n/);for(p in r){var i=r[p].match(/(\w+):\s*(.*)$/),s=i[1].toLowerCase(),o=i[2];this.tree[1][s]=o}return[]},t.dialects.Maruku.block.block_meta=function(t,n){var r=t.match(/(^|\n) {0,3}\{:\s*((?:\\\}|[^\}])*)\s*\}$/);if(!r)return undefined;var i=this.dialect.processMetaHash(r[2]),s;if(r[1]===""){var o=this.tree[this.tree.length-1];s=h(o);if(typeof o=="string")return undefined;s||(s={},o.splice(1,0,s));for(a in i)s[a]=i[a];return[]}var u=t.replace(/\n.*$/,""),f=this.processBlock(u,[]);s=h(f[0]),s||(s={},f[0].splice(1,0,s));for(a in i)s[a]=i[a];return f},t.dialects.Maruku.block.definition_list=function(t,n){var r=/^((?:[^\s:].*\n)+):\s+([\s\S]+)$/,i=["dl"],s,o;if(!(o=t.match(r)))return undefined;var u=[t];while(n.length&&r.exec(n[0]))u.push(n.shift());for(var a=0;a<u.length;++a){var o=u[a].match(r),f=o[1].replace(/\n$/,"").split(/\n/),l=o[2].split(/\n:\s+/);for(s=0;s<f.length;++s)i.push(["dt",f[s]]);for(s=0;s<l.length;++s)i.push(["dd"].concat(this.processInline(l[s].replace(/(\n)\s+/,"$1"))))}return[i]},t.dialects.Maruku.block.table=function b(e,t){var n=function(e,t){t=t||"\\s",t.match(/^[\\|\[\]{}?*.+^$]$/)&&(t="\\"+t);var n=[],r=new RegExp("^((?:\\\\.|[^\\\\"+t+"])*)"+t+"(.*)"),i;while(i=e.match(r))n.push(i[1]),e=i[2];return n.push(e),n},r=/^ {0,3}\|(.+)\n {0,3}\|\s*([\-:]+[\-| :]*)\n((?:\s*\|.*(?:\n|$))*)(?=\n|$)/,i=/^ {0,3}(\S(?:\\.|[^\\|])*\|.*)\n {0,3}([\-:]+\s*\|[\-| :]*)\n((?:(?:\\.|[^\\|])*\|.*(?:\n|$))*)(?=\n|$)/,s,o;if(o=e.match(r))o[3]=o[3].replace(/^\s*\|/gm,"");else if(!(o=e.match(i)))return undefined;var b=["table",["thead",["tr"]],["tbody"]];o[2]=o[2].replace(/\|\s*$/,"").split("|");var u=[];l(o[2],function(e){e.match(/^\s*-+:\s*$/)?u.push({align:"right"}):e.match(/^\s*:-+\s*$/)?u.push({align:"left"}):e.match(/^\s*:-+:\s*$/)?u.push({align:"center"}):u.push({})}),o[1]=n(o[1].replace(/\|\s*$/,""),"|");for(s=0;s<o[1].length;s++)b[1][1].push(["th",u[s]||{}].concat(this.processInline(o[1][s].trim())));return l(o[3].replace(/\|\s*$/mg,"").split("\n"),function(e){var t=["tr"];e=n(e,"|");for(s=0;s<e.length;s++)t.push(["td",u[s]||{}].concat(this.processInline(e[s].trim())));b[2].push(t)},this),[b]},t.dialects.Maruku.inline["{:"]=function(t,n,r){if(!r.length)return[2,"{:"];var i=r[r.length-1];if(typeof i=="string")return[2,"{:"];var s=t.match(/^\{:\s*((?:\\\}|[^\}])*)\s*\}/);if(!s)return[2,"{:"];var o=this.dialect.processMetaHash(s[1]),u=h(i);u||(u={},i.splice(1,0,u));for(var a in o)u[a]=o[a];return[s[0].length,""]},t.dialects.Maruku.inline.__escape__=/^\\[\\`\*_{}\[\]()#\+.!\-|:]/,t.buildBlockOrder(t.dialects.Maruku.block),t.buildInlinePatterns(t.dialects.Maruku.inline);var f=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"},l;Array.prototype.forEach?l=function(e,t,n){return e.forEach(t,n)}:l=function(e,t,n){for(var r=0;r<e.length;r++)t.call(n||e,e[r],r,e)};var c=function(e){for(var t in e)if(hasOwnProperty.call(e,t))return!1;return!0};e.renderJsonML=function(e,t){t=t||{},t.root=t.root||!1;var n=[];if(t.root)n.push(v(e));else{e.shift(),e.length&&typeof e[0]=="object"&&!(e[0]instanceof Array)&&e.shift();while(e.length)n.push(v(e.shift()))}return n.join("\n\n")}}(function(){return typeof exports=="undefined"?(window.markdown={},window.markdown):exports}()),e.markdown=markdown}.apply(e,arguments)})}(this),function(e){var t=typeof exports=="object"&&exports,n=typeof module=="object"&&module&&module.exports==t&&module,r=typeof global=="object"&&global;if(r.global===r||r.window===r)e=r;var i=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,s=/[\x01-\x7F]/g,o=/[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,u=/<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g,a={"Á":"Aacute","á":"aacute","Ă":"Abreve","ă":"abreve","∾":"ac","∿":"acd","∾̳":"acE","Â":"Acirc","â":"acirc","´":"acute","А":"Acy","а":"acy","Æ":"AElig","æ":"aelig","⁡":"af","𝔄":"Afr","𝔞":"afr","À":"Agrave","à":"agrave","ℵ":"aleph","Α":"Alpha","α":"alpha","Ā":"Amacr","ā":"amacr","⨿":"amalg","&":"amp","⩕":"andand","⩓":"And","∧":"and","⩜":"andd","⩘":"andslope","⩚":"andv","∠":"ang","⦤":"ange","⦨":"angmsdaa","⦩":"angmsdab","⦪":"angmsdac","⦫":"angmsdad","⦬":"angmsdae","⦭":"angmsdaf","⦮":"angmsdag","⦯":"angmsdah","∡":"angmsd","∟":"angrt","⊾":"angrtvb","⦝":"angrtvbd","∢":"angsph","Å":"angst","⍼":"angzarr","Ą":"Aogon","ą":"aogon","𝔸":"Aopf","𝕒":"aopf","⩯":"apacir","≈":"ap","⩰":"apE","≊":"ape","≋":"apid","'":"apos","å":"aring","𝒜":"Ascr","𝒶":"ascr","≔":"colone","*":"ast","≍":"CupCap","Ã":"Atilde","ã":"atilde","Ä":"Auml","ä":"auml","∳":"awconint","⨑":"awint","≌":"bcong","϶":"bepsi","‵":"bprime","∽":"bsim","⋍":"bsime","∖":"setmn","⫧":"Barv","⊽":"barvee","⌅":"barwed","⌆":"Barwed","⎵":"bbrk","⎶":"bbrktbrk","Б":"Bcy","б":"bcy","„":"bdquo","∵":"becaus","⦰":"bemptyv","ℬ":"Bscr","Β":"Beta","β":"beta","ℶ":"beth","≬":"twixt","𝔅":"Bfr","𝔟":"bfr","⋂":"xcap","◯":"xcirc","⋃":"xcup","⨀":"xodot","⨁":"xoplus","⨂":"xotime","⨆":"xsqcup","★":"starf","▽":"xdtri","△":"xutri","⨄":"xuplus","⋁":"Vee","⋀":"Wedge","⤍":"rbarr","⧫":"lozf","▪":"squf","▴":"utrif","▾":"dtrif","◂":"ltrif","▸":"rtrif","␣":"blank","▒":"blk12","░":"blk14","▓":"blk34","█":"block","=⃥":"bne","≡⃥":"bnequiv","⫭":"bNot","⌐":"bnot","𝔹":"Bopf","𝕓":"bopf","⊥":"bot","⋈":"bowtie","⧉":"boxbox","┐":"boxdl","╕":"boxdL","╖":"boxDl","╗":"boxDL","┌":"boxdr","╒":"boxdR","╓":"boxDr","╔":"boxDR","─":"boxh","═":"boxH","┬":"boxhd","╤":"boxHd","╥":"boxhD","╦":"boxHD","┴":"boxhu","╧":"boxHu","╨":"boxhU","╩":"boxHU","⊟":"minusb","⊞":"plusb","⊠":"timesb","┘":"boxul","╛":"boxuL","╜":"boxUl","╝":"boxUL","└":"boxur","╘":"boxuR","╙":"boxUr","╚":"boxUR","│":"boxv","║":"boxV","┼":"boxvh","╪":"boxvH","╫":"boxVh","╬":"boxVH","┤":"boxvl","╡":"boxvL","╢":"boxVl","╣":"boxVL","├":"boxvr","╞":"boxvR","╟":"boxVr","╠":"boxVR","˘":"breve","¦":"brvbar","𝒷":"bscr","⁏":"bsemi","⧅":"bsolb","\\":"bsol","⟈":"bsolhsub","•":"bull","≎":"bump","⪮":"bumpE","≏":"bumpe","Ć":"Cacute","ć":"cacute","⩄":"capand","⩉":"capbrcup","⩋":"capcap","∩":"cap","⋒":"Cap","⩇":"capcup","⩀":"capdot","ⅅ":"DD","∩︀":"caps","⁁":"caret","ˇ":"caron","ℭ":"Cfr","⩍":"ccaps","Č":"Ccaron","č":"ccaron","Ç":"Ccedil","ç":"ccedil","Ĉ":"Ccirc","ĉ":"ccirc","∰":"Cconint","⩌":"ccups","⩐":"ccupssm","Ċ":"Cdot","ċ":"cdot","¸":"cedil","⦲":"cemptyv","¢":"cent","·":"middot","𝔠":"cfr","Ч":"CHcy","ч":"chcy","✓":"check","Χ":"Chi","χ":"chi","ˆ":"circ","≗":"cire","↺":"olarr","↻":"orarr","⊛":"oast","⊚":"ocir","⊝":"odash","⊙":"odot","®":"reg","Ⓢ":"oS","⊖":"ominus","⊕":"oplus","⊗":"otimes","○":"cir","⧃":"cirE","⨐":"cirfnint","⫯":"cirmid","⧂":"cirscir","∲":"cwconint","”":"rdquo","’":"rsquo","♣":"clubs",":":"colon","∷":"Colon","⩴":"Colone",",":"comma","@":"commat","∁":"comp","∘":"compfn","ℂ":"Copf","≅":"cong","⩭":"congdot","≡":"equiv","∮":"oint","∯":"Conint","𝕔":"copf","∐":"coprod","©":"copy","℗":"copysr","↵":"crarr","✗":"cross","⨯":"Cross","𝒞":"Cscr","𝒸":"cscr","⫏":"csub","⫑":"csube","⫐":"csup","⫒":"csupe","⋯":"ctdot","⤸":"cudarrl","⤵":"cudarrr","⋞":"cuepr","⋟":"cuesc","↶":"cularr","⤽":"cularrp","⩈":"cupbrcap","⩆":"cupcap","∪":"cup","⋓":"Cup","⩊":"cupcup","⊍":"cupdot","⩅":"cupor","∪︀":"cups","↷":"curarr","⤼":"curarrm","⋎":"cuvee","⋏":"cuwed","¤":"curren","∱":"cwint","⌭":"cylcty","†":"dagger","‡":"Dagger","ℸ":"daleth","↓":"darr","↡":"Darr","⇓":"dArr","‐":"dash","⫤":"Dashv","⊣":"dashv","⤏":"rBarr","˝":"dblac","Ď":"Dcaron","ď":"dcaron","Д":"Dcy","д":"dcy","⇊":"ddarr","ⅆ":"dd","⤑":"DDotrahd","⩷":"eDDot","°":"deg","∇":"Del","Δ":"Delta","δ":"delta","⦱":"demptyv","⥿":"dfisht","𝔇":"Dfr","𝔡":"dfr","⥥":"dHar","⇃":"dharl","⇂":"dharr","˙":"dot","`":"grave","˜":"tilde","⋄":"diam","♦":"diams","¨":"die","ϝ":"gammad","⋲":"disin","÷":"div","⋇":"divonx","Ђ":"DJcy","ђ":"djcy","⌞":"dlcorn","⌍":"dlcrop",$:"dollar","𝔻":"Dopf","𝕕":"dopf","⃜":"DotDot","≐":"doteq","≑":"eDot","∸":"minusd","∔":"plusdo","⊡":"sdotb","⇐":"lArr","⇔":"iff","⟸":"xlArr","⟺":"xhArr","⟹":"xrArr","⇒":"rArr","⊨":"vDash","⇑":"uArr","⇕":"vArr","∥":"par","⤓":"DownArrowBar","⇵":"duarr","̑":"DownBreve","⥐":"DownLeftRightVector","⥞":"DownLeftTeeVector","⥖":"DownLeftVectorBar","↽":"lhard","⥟":"DownRightTeeVector","⥗":"DownRightVectorBar","⇁":"rhard","↧":"mapstodown","⊤":"top","⤐":"RBarr","⌟":"drcorn","⌌":"drcrop","𝒟":"Dscr","𝒹":"dscr","Ѕ":"DScy","ѕ":"dscy","⧶":"dsol","Đ":"Dstrok","đ":"dstrok","⋱":"dtdot","▿":"dtri","⥯":"duhar","⦦":"dwangle","Џ":"DZcy","џ":"dzcy","⟿":"dzigrarr","É":"Eacute","é":"eacute","⩮":"easter","Ě":"Ecaron","ě":"ecaron","Ê":"Ecirc","ê":"ecirc","≖":"ecir","≕":"ecolon","Э":"Ecy","э":"ecy","Ė":"Edot","ė":"edot","ⅇ":"ee","≒":"efDot","𝔈":"Efr","𝔢":"efr","⪚":"eg","È":"Egrave","è":"egrave","⪖":"egs","⪘":"egsdot","⪙":"el","∈":"in","⏧":"elinters","ℓ":"ell","⪕":"els","⪗":"elsdot","Ē":"Emacr","ē":"emacr","∅":"empty","◻":"EmptySmallSquare","▫":"EmptyVerySmallSquare"," ":"emsp13"," ":"emsp14"," ":"emsp","Ŋ":"ENG","ŋ":"eng"," ":"ensp","Ę":"Eogon","ę":"eogon","𝔼":"Eopf","𝕖":"eopf","⋕":"epar","⧣":"eparsl","⩱":"eplus","ε":"epsi","Ε":"Epsilon","ϵ":"epsiv","≂":"esim","⩵":"Equal","=":"equals","≟":"equest","⇌":"rlhar","⩸":"equivDD","⧥":"eqvparsl","⥱":"erarr","≓":"erDot","ℯ":"escr","ℰ":"Escr","⩳":"Esim","Η":"Eta","η":"eta","Ð":"ETH","ð":"eth","Ë":"Euml","ë":"euml","€":"euro","!":"excl","∃":"exist","Ф":"Fcy","ф":"fcy","♀":"female","ﬃ":"ffilig","ﬀ":"fflig","ﬄ":"ffllig","𝔉":"Ffr","𝔣":"ffr","ﬁ":"filig","◼":"FilledSmallSquare",fj:"fjlig","♭":"flat","ﬂ":"fllig","▱":"fltns","ƒ":"fnof","𝔽":"Fopf","𝕗":"fopf","∀":"forall","⋔":"fork","⫙":"forkv","ℱ":"Fscr","⨍":"fpartint","½":"half","⅓":"frac13","¼":"frac14","⅕":"frac15","⅙":"frac16","⅛":"frac18","⅔":"frac23","⅖":"frac25","¾":"frac34","⅗":"frac35","⅜":"frac38","⅘":"frac45","⅚":"frac56","⅝":"frac58","⅞":"frac78","⁄":"frasl","⌢":"frown","𝒻":"fscr","ǵ":"gacute","Γ":"Gamma","γ":"gamma","Ϝ":"Gammad","⪆":"gap","Ğ":"Gbreve","ğ":"gbreve","Ģ":"Gcedil","Ĝ":"Gcirc","ĝ":"gcirc","Г":"Gcy","г":"gcy","Ġ":"Gdot","ġ":"gdot","≥":"ge","≧":"gE","⪌":"gEl","⋛":"gel","⩾":"ges","⪩":"gescc","⪀":"gesdot","⪂":"gesdoto","⪄":"gesdotol","⋛︀":"gesl","⪔":"gesles","𝔊":"Gfr","𝔤":"gfr","≫":"gg","⋙":"Gg","ℷ":"gimel","Ѓ":"GJcy","ѓ":"gjcy","⪥":"gla","≷":"gl","⪒":"glE","⪤":"glj","⪊":"gnap","⪈":"gne","≩":"gnE","⋧":"gnsim","𝔾":"Gopf","𝕘":"gopf","⪢":"GreaterGreater","≳":"gsim","𝒢":"Gscr","ℊ":"gscr","⪎":"gsime","⪐":"gsiml","⪧":"gtcc","⩺":"gtcir",">":"gt","⋗":"gtdot","⦕":"gtlPar","⩼":"gtquest","⥸":"gtrarr","≩︀":"gvnE"," ":"hairsp","ℋ":"Hscr","Ъ":"HARDcy","ъ":"hardcy","⥈":"harrcir","↔":"harr","↭":"harrw","^":"Hat","ℏ":"hbar","Ĥ":"Hcirc","ĥ":"hcirc","♥":"hearts","…":"mldr","⊹":"hercon","𝔥":"hfr","ℌ":"Hfr","⤥":"searhk","⤦":"swarhk","⇿":"hoarr","∻":"homtht","↩":"larrhk","↪":"rarrhk","𝕙":"hopf","ℍ":"Hopf","―":"horbar","𝒽":"hscr","Ħ":"Hstrok","ħ":"hstrok","⁃":"hybull","Í":"Iacute","í":"iacute","⁣":"ic","Î":"Icirc","î":"icirc","И":"Icy","и":"icy","İ":"Idot","Е":"IEcy","е":"iecy","¡":"iexcl","𝔦":"ifr","ℑ":"Im","Ì":"Igrave","ì":"igrave","ⅈ":"ii","⨌":"qint","∭":"tint","⧜":"iinfin","℩":"iiota","Ĳ":"IJlig","ĳ":"ijlig","Ī":"Imacr","ī":"imacr","ℐ":"Iscr","ı":"imath","⊷":"imof","Ƶ":"imped","℅":"incare","∞":"infin","⧝":"infintie","⊺":"intcal","∫":"int","∬":"Int","ℤ":"Zopf","⨗":"intlarhk","⨼":"iprod","⁢":"it","Ё":"IOcy","ё":"iocy","Į":"Iogon","į":"iogon","𝕀":"Iopf","𝕚":"iopf","Ι":"Iota","ι":"iota","¿":"iquest","𝒾":"iscr","⋵":"isindot","⋹":"isinE","⋴":"isins","⋳":"isinsv","Ĩ":"Itilde","ĩ":"itilde","І":"Iukcy","і":"iukcy","Ï":"Iuml","ï":"iuml","Ĵ":"Jcirc","ĵ":"jcirc","Й":"Jcy","й":"jcy","𝔍":"Jfr","𝔧":"jfr","ȷ":"jmath","𝕁":"Jopf","𝕛":"jopf","𝒥":"Jscr","𝒿":"jscr","Ј":"Jsercy","ј":"jsercy","Є":"Jukcy","є":"jukcy","Κ":"Kappa","κ":"kappa","ϰ":"kappav","Ķ":"Kcedil","ķ":"kcedil","К":"Kcy","к":"kcy","𝔎":"Kfr","𝔨":"kfr","ĸ":"kgreen","Х":"KHcy","х":"khcy","Ќ":"KJcy","ќ":"kjcy","𝕂":"Kopf","𝕜":"kopf","𝒦":"Kscr","𝓀":"kscr","⇚":"lAarr","Ĺ":"Lacute","ĺ":"lacute","⦴":"laemptyv","ℒ":"Lscr","Λ":"Lambda","λ":"lambda","⟨":"lang","⟪":"Lang","⦑":"langd","⪅":"lap","«":"laquo","⇤":"larrb","⤟":"larrbfs","←":"larr","↞":"Larr","⤝":"larrfs","↫":"larrlp","⤹":"larrpl","⥳":"larrsim","↢":"larrtl","⤙":"latail","⤛":"lAtail","⪫":"lat","⪭":"late","⪭︀":"lates","⤌":"lbarr","⤎":"lBarr","❲":"lbbrk","{":"lcub","[":"lsqb","⦋":"lbrke","⦏":"lbrksld","⦍":"lbrkslu","Ľ":"Lcaron","ľ":"lcaron","Ļ":"Lcedil","ļ":"lcedil","⌈":"lceil","Л":"Lcy","л":"lcy","⤶":"ldca","“":"ldquo","⥧":"ldrdhar","⥋":"ldrushar","↲":"ldsh","≤":"le","≦":"lE","⇆":"lrarr","⟦":"lobrk","⥡":"LeftDownTeeVector","⥙":"LeftDownVectorBar","⌊":"lfloor","↼":"lharu","⇇":"llarr","⇋":"lrhar","⥎":"LeftRightVector","↤":"mapstoleft","⥚":"LeftTeeVector","⋋":"lthree","⧏":"LeftTriangleBar","⊲":"vltri","⊴":"ltrie","⥑":"LeftUpDownVector","⥠":"LeftUpTeeVector","⥘":"LeftUpVectorBar","↿":"uharl","⥒":"LeftVectorBar","⪋":"lEg","⋚":"leg","⩽":"les","⪨":"lescc","⩿":"lesdot","⪁":"lesdoto","⪃":"lesdotor","⋚︀":"lesg","⪓":"lesges","⋖":"ltdot","≶":"lg","⪡":"LessLess","≲":"lsim","⥼":"lfisht","𝔏":"Lfr","𝔩":"lfr","⪑":"lgE","⥢":"lHar","⥪":"lharul","▄":"lhblk","Љ":"LJcy","љ":"ljcy","≪":"ll","⋘":"Ll","⥫":"llhard","◺":"lltri","Ŀ":"Lmidot","ŀ":"lmidot","⎰":"lmoust","⪉":"lnap","⪇":"lne","≨":"lnE","⋦":"lnsim","⟬":"loang","⇽":"loarr","⟵":"xlarr","⟷":"xharr","⟼":"xmap","⟶":"xrarr","↬":"rarrlp","⦅":"lopar","𝕃":"Lopf","𝕝":"lopf","⨭":"loplus","⨴":"lotimes","∗":"lowast",_:"lowbar","↙":"swarr","↘":"searr","◊":"loz","(":"lpar","⦓":"lparlt","⥭":"lrhard","‎":"lrm","⊿":"lrtri","‹":"lsaquo","𝓁":"lscr","↰":"lsh","⪍":"lsime","⪏":"lsimg","‘":"lsquo","‚":"sbquo","Ł":"Lstrok","ł":"lstrok","⪦":"ltcc","⩹":"ltcir","<":"lt","⋉":"ltimes","⥶":"ltlarr","⩻":"ltquest","◃":"ltri","⦖":"ltrPar","⥊":"lurdshar","⥦":"luruhar","≨︀":"lvnE","¯":"macr","♂":"male","✠":"malt","⤅":"Map","↦":"map","↥":"mapstoup","▮":"marker","⨩":"mcomma","М":"Mcy","м":"mcy","—":"mdash","∺":"mDDot"," ":"MediumSpace","ℳ":"Mscr","𝔐":"Mfr","𝔪":"mfr","℧":"mho","µ":"micro","⫰":"midcir","∣":"mid","−":"minus","⨪":"minusdu","∓":"mp","⫛":"mlcp","⊧":"models","𝕄":"Mopf","𝕞":"mopf","𝓂":"mscr","Μ":"Mu","μ":"mu","⊸":"mumap","Ń":"Nacute","ń":"nacute","∠⃒":"nang","≉":"nap","⩰̸":"napE","≋̸":"napid","ŉ":"napos","♮":"natur","ℕ":"Nopf"," ":"nbsp","≎̸":"nbump","≏̸":"nbumpe","⩃":"ncap","Ň":"Ncaron","ň":"ncaron","Ņ":"Ncedil","ņ":"ncedil","≇":"ncong","⩭̸":"ncongdot","⩂":"ncup","Н":"Ncy","н":"ncy","–":"ndash","⤤":"nearhk","↗":"nearr","⇗":"neArr","≠":"ne","≐̸":"nedot","​":"ZeroWidthSpace","≢":"nequiv","⤨":"toea","≂̸":"nesim","\n":"NewLine","∄":"nexist","𝔑":"Nfr","𝔫":"nfr","≧̸":"ngE","≱":"nge","⩾̸":"nges","⋙̸":"nGg","≵":"ngsim","≫⃒":"nGt","≯":"ngt","≫̸":"nGtv","↮":"nharr","⇎":"nhArr","⫲":"nhpar","∋":"ni","⋼":"nis","⋺":"nisd","Њ":"NJcy","њ":"njcy","↚":"nlarr","⇍":"nlArr","‥":"nldr","≦̸":"nlE","≰":"nle","⩽̸":"nles","≮":"nlt","⋘̸":"nLl","≴":"nlsim","≪⃒":"nLt","⋪":"nltri","⋬":"nltrie","≪̸":"nLtv","∤":"nmid","⁠":"NoBreak","𝕟":"nopf","⫬":"Not","¬":"not","≭":"NotCupCap","∦":"npar","∉":"notin","≹":"ntgl","⋵̸":"notindot","⋹̸":"notinE","⋷":"notinvb","⋶":"notinvc","⧏̸":"NotLeftTriangleBar","≸":"ntlg","⪢̸":"NotNestedGreaterGreater","⪡̸":"NotNestedLessLess","∌":"notni","⋾":"notnivb","⋽":"notnivc","⊀":"npr","⪯̸":"npre","⋠":"nprcue","⧐̸":"NotRightTriangleBar","⋫":"nrtri","⋭":"nrtrie","⊏̸":"NotSquareSubset","⋢":"nsqsube","⊐̸":"NotSquareSuperset","⋣":"nsqsupe","⊂⃒":"vnsub","⊈":"nsube","⊁":"nsc","⪰̸":"nsce","⋡":"nsccue","≿̸":"NotSucceedsTilde","⊃⃒":"vnsup","⊉":"nsupe","≁":"nsim","≄":"nsime","⫽⃥":"nparsl","∂̸":"npart","⨔":"npolint","⤳̸":"nrarrc","↛":"nrarr","⇏":"nrArr","↝̸":"nrarrw","𝒩":"Nscr","𝓃":"nscr","⊄":"nsub","⫅̸":"nsubE","⊅":"nsup","⫆̸":"nsupE","Ñ":"Ntilde","ñ":"ntilde","Ν":"Nu","ν":"nu","#":"num","№":"numero"," ":"numsp","≍⃒":"nvap","⊬":"nvdash","⊭":"nvDash","⊮":"nVdash","⊯":"nVDash","≥⃒":"nvge",">⃒":"nvgt","⤄":"nvHarr","⧞":"nvinfin","⤂":"nvlArr","≤⃒":"nvle","<⃒":"nvlt","⊴⃒":"nvltrie","⤃":"nvrArr","⊵⃒":"nvrtrie","∼⃒":"nvsim","⤣":"nwarhk","↖":"nwarr","⇖":"nwArr","⤧":"nwnear","Ó":"Oacute","ó":"oacute","Ô":"Ocirc","ô":"ocirc","О":"Ocy","о":"ocy","Ő":"Odblac","ő":"odblac","⨸":"odiv","⦼":"odsold","Œ":"OElig","œ":"oelig","⦿":"ofcir","𝔒":"Ofr","𝔬":"ofr","˛":"ogon","Ò":"Ograve","ò":"ograve","⧁":"ogt","⦵":"ohbar","Ω":"ohm","⦾":"olcir","⦻":"olcross","‾":"oline","⧀":"olt","Ō":"Omacr","ō":"omacr","ω":"omega","Ο":"Omicron","ο":"omicron","⦶":"omid","𝕆":"Oopf","𝕠":"oopf","⦷":"opar","⦹":"operp","⩔":"Or","∨":"or","⩝":"ord","ℴ":"oscr","ª":"ordf","º":"ordm","⊶":"origof","⩖":"oror","⩗":"orslope","⩛":"orv","𝒪":"Oscr","Ø":"Oslash","ø":"oslash","⊘":"osol","Õ":"Otilde","õ":"otilde","⨶":"otimesas","⨷":"Otimes","Ö":"Ouml","ö":"ouml","⌽":"ovbar","⏞":"OverBrace","⎴":"tbrk","⏜":"OverParenthesis","¶":"para","⫳":"parsim","⫽":"parsl","∂":"part","П":"Pcy","п":"pcy","%":"percnt",".":"period","‰":"permil","‱":"pertenk","𝔓":"Pfr","𝔭":"pfr","Φ":"Phi","φ":"phi","ϕ":"phiv","☎":"phone","Π":"Pi","π":"pi","ϖ":"piv","ℎ":"planckh","⨣":"plusacir","⨢":"pluscir","+":"plus","⨥":"plusdu","⩲":"pluse","±":"pm","⨦":"plussim","⨧":"plustwo","⨕":"pointint","𝕡":"popf","ℙ":"Popf","£":"pound","⪷":"prap","⪻":"Pr","≺":"pr","≼":"prcue","⪯":"pre","≾":"prsim","⪹":"prnap","⪵":"prnE","⋨":"prnsim","⪳":"prE","′":"prime","″":"Prime","∏":"prod","⌮":"profalar","⌒":"profline","⌓":"profsurf","∝":"prop","⊰":"prurel","𝒫":"Pscr","𝓅":"pscr","Ψ":"Psi","ψ":"psi"," ":"puncsp","𝔔":"Qfr","𝔮":"qfr","𝕢":"qopf","ℚ":"Qopf","⁗":"qprime","𝒬":"Qscr","𝓆":"qscr","⨖":"quatint","?":"quest",'"':"quot","⇛":"rAarr","∽̱":"race","Ŕ":"Racute","ŕ":"racute","√":"Sqrt","⦳":"raemptyv","⟩":"rang","⟫":"Rang","⦒":"rangd","⦥":"range","»":"raquo","⥵":"rarrap","⇥":"rarrb","⤠":"rarrbfs","⤳":"rarrc","→":"rarr","↠":"Rarr","⤞":"rarrfs","⥅":"rarrpl","⥴":"rarrsim","⤖":"Rarrtl","↣":"rarrtl","↝":"rarrw","⤚":"ratail","⤜":"rAtail","∶":"ratio","❳":"rbbrk","}":"rcub","]":"rsqb","⦌":"rbrke","⦎":"rbrksld","⦐":"rbrkslu","Ř":"Rcaron","ř":"rcaron","Ŗ":"Rcedil","ŗ":"rcedil","⌉":"rceil","Р":"Rcy","р":"rcy","⤷":"rdca","⥩":"rdldhar","↳":"rdsh","ℜ":"Re","ℛ":"Rscr","ℝ":"Ropf","▭":"rect","⥽":"rfisht","⌋":"rfloor","𝔯":"rfr","⥤":"rHar","⇀":"rharu","⥬":"rharul","Ρ":"Rho","ρ":"rho","ϱ":"rhov","⇄":"rlarr","⟧":"robrk","⥝":"RightDownTeeVector","⥕":"RightDownVectorBar","⇉":"rrarr","⊢":"vdash","⥛":"RightTeeVector","⋌":"rthree","⧐":"RightTriangleBar","⊳":"vrtri","⊵":"rtrie","⥏":"RightUpDownVector","⥜":"RightUpTeeVector","⥔":"RightUpVectorBar","↾":"uharr","⥓":"RightVectorBar","˚":"ring","‏":"rlm","⎱":"rmoust","⫮":"rnmid","⟭":"roang","⇾":"roarr","⦆":"ropar","𝕣":"ropf","⨮":"roplus","⨵":"rotimes","⥰":"RoundImplies",")":"rpar","⦔":"rpargt","⨒":"rppolint","›":"rsaquo","𝓇":"rscr","↱":"rsh","⋊":"rtimes","▹":"rtri","⧎":"rtriltri","⧴":"RuleDelayed","⥨":"ruluhar","℞":"rx","Ś":"Sacute","ś":"sacute","⪸":"scap","Š":"Scaron","š":"scaron","⪼":"Sc","≻":"sc","≽":"sccue","⪰":"sce","⪴":"scE","Ş":"Scedil","ş":"scedil","Ŝ":"Scirc","ŝ":"scirc","⪺":"scnap","⪶":"scnE","⋩":"scnsim","⨓":"scpolint","≿":"scsim","С":"Scy","с":"scy","⋅":"sdot","⩦":"sdote","⇘":"seArr","§":"sect",";":"semi","⤩":"tosa","✶":"sext","𝔖":"Sfr","𝔰":"sfr","♯":"sharp","Щ":"SHCHcy","щ":"shchcy","Ш":"SHcy","ш":"shcy","↑":"uarr","­":"shy","Σ":"Sigma","σ":"sigma","ς":"sigmaf","∼":"sim","⩪":"simdot","≃":"sime","⪞":"simg","⪠":"simgE","⪝":"siml","⪟":"simlE","≆":"simne","⨤":"simplus","⥲":"simrarr","⨳":"smashp","⧤":"smeparsl","⌣":"smile","⪪":"smt","⪬":"smte","⪬︀":"smtes","Ь":"SOFTcy","ь":"softcy","⌿":"solbar","⧄":"solb","/":"sol","𝕊":"Sopf","𝕤":"sopf","♠":"spades","⊓":"sqcap","⊓︀":"sqcaps","⊔":"sqcup","⊔︀":"sqcups","⊏":"sqsub","⊑":"sqsube","⊐":"sqsup","⊒":"sqsupe","□":"squ","𝒮":"Sscr","𝓈":"sscr","⋆":"Star","☆":"star","⊂":"sub","⋐":"Sub","⪽":"subdot","⫅":"subE","⊆":"sube","⫃":"subedot","⫁":"submult","⫋":"subnE","⊊":"subne","⪿":"subplus","⥹":"subrarr","⫇":"subsim","⫕":"subsub","⫓":"subsup","∑":"sum","♪":"sung","¹":"sup1","²":"sup2","³":"sup3","⊃":"sup","⋑":"Sup","⪾":"supdot","⫘":"supdsub","⫆":"supE","⊇":"supe","⫄":"supedot","⟉":"suphsol","⫗":"suphsub","⥻":"suplarr","⫂":"supmult","⫌":"supnE","⊋":"supne","⫀":"supplus","⫈":"supsim","⫔":"supsub","⫖":"supsup","⇙":"swArr","⤪":"swnwar","ß":"szlig","	":"Tab","⌖":"target","Τ":"Tau","τ":"tau","Ť":"Tcaron","ť":"tcaron","Ţ":"Tcedil","ţ":"tcedil","Т":"Tcy","т":"tcy","⃛":"tdot","⌕":"telrec","𝔗":"Tfr","𝔱":"tfr","∴":"there4","Θ":"Theta","θ":"theta","ϑ":"thetav","  ":"ThickSpace"," ":"thinsp","Þ":"THORN","þ":"thorn","⨱":"timesbar","×":"times","⨰":"timesd","⌶":"topbot","⫱":"topcir","𝕋":"Topf","𝕥":"topf","⫚":"topfork","‴":"tprime","™":"trade","▵":"utri","≜":"trie","◬":"tridot","⨺":"triminus","⨹":"triplus","⧍":"trisb","⨻":"tritime","⏢":"trpezium","𝒯":"Tscr","𝓉":"tscr","Ц":"TScy","ц":"tscy","Ћ":"TSHcy","ћ":"tshcy","Ŧ":"Tstrok","ŧ":"tstrok","Ú":"Uacute","ú":"uacute","↟":"Uarr","⥉":"Uarrocir","Ў":"Ubrcy","ў":"ubrcy","Ŭ":"Ubreve","ŭ":"ubreve","Û":"Ucirc","û":"ucirc","У":"Ucy","у":"ucy","⇅":"udarr","Ű":"Udblac","ű":"udblac","⥮":"udhar","⥾":"ufisht","𝔘":"Ufr","𝔲":"ufr","Ù":"Ugrave","ù":"ugrave","⥣":"uHar","▀":"uhblk","⌜":"ulcorn","⌏":"ulcrop","◸":"ultri","Ū":"Umacr","ū":"umacr","⏟":"UnderBrace","⏝":"UnderParenthesis","⊎":"uplus","Ų":"Uogon","ų":"uogon","𝕌":"Uopf","𝕦":"uopf","⤒":"UpArrowBar","↕":"varr","υ":"upsi","ϒ":"Upsi","Υ":"Upsilon","⇈":"uuarr","⌝":"urcorn","⌎":"urcrop","Ů":"Uring","ů":"uring","◹":"urtri","𝒰":"Uscr","𝓊":"uscr","⋰":"utdot","Ũ":"Utilde","ũ":"utilde","Ü":"Uuml","ü":"uuml","⦧":"uwangle","⦜":"vangrt","⊊︀":"vsubne","⫋︀":"vsubnE","⊋︀":"vsupne","⫌︀":"vsupnE","⫨":"vBar","⫫":"Vbar","⫩":"vBarv","В":"Vcy","в":"vcy","⊩":"Vdash","⊫":"VDash","⫦":"Vdashl","⊻":"veebar","≚":"veeeq","⋮":"vellip","|":"vert","‖":"Vert","❘":"VerticalSeparator","≀":"wr","𝔙":"Vfr","𝔳":"vfr","𝕍":"Vopf","𝕧":"vopf","𝒱":"Vscr","𝓋":"vscr","⊪":"Vvdash","⦚":"vzigzag","Ŵ":"Wcirc","ŵ":"wcirc","⩟":"wedbar","≙":"wedgeq","℘":"wp","𝔚":"Wfr","𝔴":"wfr","𝕎":"Wopf","𝕨":"wopf","𝒲":"Wscr","𝓌":"wscr","𝔛":"Xfr","𝔵":"xfr","Ξ":"Xi","ξ":"xi","⋻":"xnis","𝕏":"Xopf","𝕩":"xopf","𝒳":"Xscr","𝓍":"xscr","Ý":"Yacute","ý":"yacute","Я":"YAcy","я":"yacy","Ŷ":"Ycirc","ŷ":"ycirc","Ы":"Ycy","ы":"ycy","¥":"yen","𝔜":"Yfr","𝔶":"yfr","Ї":"YIcy","ї":"yicy","𝕐":"Yopf","𝕪":"yopf","𝒴":"Yscr","𝓎":"yscr","Ю":"YUcy","ю":"yucy","ÿ":"yuml","Ÿ":"Yuml","Ź":"Zacute","ź":"zacute","Ž":"Zcaron","ž":"zcaron","З":"Zcy","з":"zcy","Ż":"Zdot","ż":"zdot","ℨ":"Zfr","Ζ":"Zeta","ζ":"zeta","𝔷":"zfr","Ж":"ZHcy","ж":"zhcy","⇝":"zigrarr","𝕫":"zopf","𝒵":"Zscr","𝓏":"zscr","‍":"zwj","‌":"zwnj"},f=/["&'<>`]/g,l={'"':"&quot;","&":"&amp;","'":"&#x27;","<":"&lt;",">":"&gt;","`":"&#x60;"},c=/&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/,h=/[\0-\x08\x0B\x0E-\x1F\x7F-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,p=/&#([0-9]+)(;?)|&#[xX]([a-fA-F0-9]+)(;?)|&([0-9a-zA-Z]+);|&(Aacute|iacute|Uacute|plusmn|otilde|Otilde|Agrave|agrave|yacute|Yacute|oslash|Oslash|Atilde|atilde|brvbar|Ccedil|ccedil|ograve|curren|divide|Eacute|eacute|Ograve|oacute|Egrave|egrave|ugrave|frac12|frac14|frac34|Ugrave|Oacute|Iacute|ntilde|Ntilde|uacute|middot|Igrave|igrave|iquest|aacute|laquo|THORN|micro|iexcl|icirc|Icirc|Acirc|ucirc|ecirc|Ocirc|ocirc|Ecirc|Ucirc|aring|Aring|aelig|AElig|acute|pound|raquo|acirc|times|thorn|szlig|cedil|COPY|Auml|ordf|ordm|uuml|macr|Uuml|auml|Ouml|ouml|para|nbsp|Euml|quot|QUOT|euml|yuml|cent|sect|copy|sup1|sup2|sup3|Iuml|iuml|shy|eth|reg|not|yen|amp|AMP|REG|uml|ETH|deg|gt|GT|LT|lt)([=a-zA-Z0-9])?/g,d={Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",amp:"&",AMP:"&",andand:"⩕",And:"⩓",and:"∧",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angmsd:"∡",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",apacir:"⩯",ap:"≈",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",barwed:"⌅",Barwed:"⌆",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",because:"∵",Because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxdl:"┐",boxdL:"╕",boxDl:"╖",boxDL:"╗",boxdr:"┌",boxdR:"╒",boxDr:"╓",boxDR:"╔",boxh:"─",boxH:"═",boxhd:"┬",boxHd:"╤",boxhD:"╥",boxHD:"╦",boxhu:"┴",boxHu:"╧",boxhU:"╨",boxHU:"╩",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxul:"┘",boxuL:"╛",boxUl:"╜",boxUL:"╝",boxur:"└",boxuR:"╘",boxUr:"╙",boxUR:"╚",boxv:"│",boxV:"║",boxvh:"┼",boxvH:"╪",boxVh:"╫",boxVH:"╬",boxvl:"┤",boxvL:"╡",boxVl:"╢",boxVL:"╣",boxvr:"├",boxvR:"╞",boxVr:"╟",boxVR:"╠",bprime:"‵",breve:"˘",Breve:"˘",brvbar:"¦",bscr:"𝒷",Bscr:"ℬ",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsolb:"⧅",bsol:"\\",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",capand:"⩄",capbrcup:"⩉",capcap:"⩋",cap:"∩",Cap:"⋒",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",centerdot:"·",CenterDot:"·",cfr:"𝔠",Cfr:"ℭ",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cir:"○",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",colon:":",Colon:"∷",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",conint:"∮",Conint:"∯",ContourIntegral:"∮",copf:"𝕔",Copf:"ℂ",coprod:"∐",Coproduct:"∐",copy:"©",COPY:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",cross:"✗",Cross:"⨯",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",cupbrcap:"⩈",cupcap:"⩆",CupCap:"≍",cup:"∪",Cup:"⋓",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",dagger:"†",Dagger:"‡",daleth:"ℸ",darr:"↓",Darr:"↡",dArr:"⇓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",ddagger:"‡",ddarr:"⇊",DD:"ⅅ",dd:"ⅆ",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",diamond:"⋄",Diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrowBar:"⤓",downarrow:"↓",DownArrow:"↓",Downarrow:"⇓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVectorBar:"⥖",DownLeftVector:"↽",DownRightTeeVector:"⥟",DownRightVectorBar:"⥗",DownRightVector:"⇁",DownTeeArrow:"↧",DownTee:"⊤",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",Ecirc:"Ê",ecirc:"ê",ecir:"≖",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",edot:"ė",eDot:"≑",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp13:" ",emsp14:" ",emsp:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",escr:"ℯ",Escr:"ℰ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",exponentiale:"ⅇ",ExponentialE:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ﬃ",fflig:"ﬀ",ffllig:"ﬄ",Ffr:"𝔉",ffr:"𝔣",filig:"ﬁ",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"ﬂ",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",forall:"∀",ForAll:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",fscr:"𝒻",Fscr:"ℱ",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",ge:"≥",gE:"≧",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",gescc:"⪩",ges:"⩾",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",gg:"≫",Gg:"⋙",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gla:"⪥",gl:"≷",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gne:"⪈",gnE:"≩",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",gtcc:"⪧",gtcir:"⩺",gt:">",GT:">",Gt:"≫",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",harrcir:"⥈",harr:"↔",hArr:"⇔",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",hfr:"𝔥",Hfr:"ℌ",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",hopf:"𝕙",Hopf:"ℍ",horbar:"―",HorizontalLine:"─",hscr:"𝒽",Hscr:"ℋ",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",ifr:"𝔦",Ifr:"ℑ",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"Ĳ",ijlig:"ĳ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",Im:"ℑ",imof:"⊷",imped:"Ƶ",Implies:"⇒",incare:"℅","in":"∈",infin:"∞",infintie:"⧝",inodot:"ı",intcal:"⊺","int":"∫",Int:"∬",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",iscr:"𝒾",Iscr:"ℐ",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",lang:"⟨",Lang:"⟪",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",larrb:"⇤",larrbfs:"⤟",larr:"←",Larr:"↞",lArr:"⇐",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",latail:"⤙",lAtail:"⤛",lat:"⪫",late:"⪭",lates:"⪭︀",lbarr:"⤌",lBarr:"⤎",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",le:"≤",lE:"≦",LeftAngleBracket:"⟨",LeftArrowBar:"⇤",leftarrow:"←",LeftArrow:"←",Leftarrow:"⇐",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVectorBar:"⥙",LeftDownVector:"⇃",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",leftrightarrow:"↔",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTeeArrow:"↤",LeftTee:"⊣",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangleBar:"⧏",LeftTriangle:"⊲",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVectorBar:"⥘",LeftUpVector:"↿",LeftVectorBar:"⥒",LeftVector:"↼",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",lescc:"⪨",les:"⩽",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",llarr:"⇇",ll:"≪",Ll:"⋘",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoustache:"⎰",lmoust:"⎰",lnap:"⪉",lnapprox:"⪉",lne:"⪇",lnE:"≨",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",longleftarrow:"⟵",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftrightarrow:"⟷",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longmapsto:"⟼",longrightarrow:"⟶",LongRightArrow:"⟶",Longrightarrow:"⟹",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",lscr:"𝓁",Lscr:"ℒ",lsh:"↰",Lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",ltcc:"⪦",ltcir:"⩹",lt:"<",LT:"<",Lt:"≪",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",midast:"*",midcir:"⫰",mid:"∣",middot:"·",minusb:"⊟",minus:"−",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",mscr:"𝓂",Mscr:"ℳ",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ŉ",napprox:"≉",natural:"♮",naturals:"ℕ",natur:"♮",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",nearhk:"⤤",nearr:"↗",neArr:"⇗",nearrow:"↗",ne:"≠",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nharr:"↮",nhArr:"⇎",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlarr:"↚",nlArr:"⇍",nldr:"‥",nlE:"≦̸",nle:"≰",nleftarrow:"↚",nLeftarrow:"⇍",nleftrightarrow:"↮",nLeftrightarrow:"⇎",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",nopf:"𝕟",Nopf:"ℕ",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangleBar:"⧏̸",NotLeftTriangle:"⋪",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangleBar:"⧐̸",NotRightTriangle:"⋫",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",nparallel:"∦",npar:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",nprec:"⊀",npreceq:"⪯̸",npre:"⪯̸",nrarrc:"⤳̸",nrarr:"↛",nrArr:"⇏",nrarrw:"↝̸",nrightarrow:"↛",nRightarrow:"⇏",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nvdash:"⊬",nvDash:"⊭",nVdash:"⊮",nVDash:"⊯",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwarr:"↖",nwArr:"⇖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",Ocirc:"Ô",ocirc:"ô",ocir:"⊚",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",orarr:"↻",Or:"⩔",or:"∨",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",otimesas:"⨶",Otimes:"⨷",otimes:"⊗",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",para:"¶",parallel:"∥",par:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plus:"+",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",popf:"𝕡",Popf:"ℙ",pound:"£",prap:"⪷",Pr:"⪻",pr:"≺",prcue:"≼",precapprox:"⪷",prec:"≺",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",pre:"⪯",prE:"⪳",precsim:"≾",prime:"′",Prime:"″",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportional:"∝",Proportion:"∷",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",qopf:"𝕢",Qopf:"ℚ",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",quot:'"',QUOT:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",rang:"⟩",Rang:"⟫",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarr:"→",Rarr:"↠",rArr:"⇒",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",ratail:"⤚",rAtail:"⤜",ratio:"∶",rationals:"ℚ",rbarr:"⤍",rBarr:"⤏",RBarr:"⤐",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",Re:"ℜ",rect:"▭",reg:"®",REG:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",rfr:"𝔯",Rfr:"ℜ",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrowBar:"⇥",rightarrow:"→",RightArrow:"→",Rightarrow:"⇒",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVectorBar:"⥕",RightDownVector:"⇂",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTeeArrow:"↦",RightTee:"⊢",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangleBar:"⧐",RightTriangle:"⊳",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVectorBar:"⥔",RightUpVector:"↾",RightVectorBar:"⥓",RightVector:"⇀",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoustache:"⎱",rmoust:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",ropf:"𝕣",Ropf:"ℝ",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",rscr:"𝓇",Rscr:"ℛ",rsh:"↱",Rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",scap:"⪸",Scaron:"Š",scaron:"š",Sc:"⪼",sc:"≻",sccue:"≽",sce:"⪰",scE:"⪴",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdotb:"⊡",sdot:"⋅",sdote:"⩦",searhk:"⤥",searr:"↘",seArr:"⇘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",solbar:"⌿",solb:"⧄",sol:"/",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",square:"□",Square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squ:"□",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",sub:"⊂",Sub:"⋐",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",subset:"⊂",Subset:"⋐",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succapprox:"⪸",succ:"≻",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",sum:"∑",Sum:"∑",sung:"♪",sup1:"¹",sup2:"²",sup3:"³",sup:"⊃",Sup:"⋑",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",supset:"⊃",Supset:"⋑",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swarr:"↙",swArr:"⇙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"	",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",therefore:"∴",Therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",ThinSpace:" ",thinsp:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",tilde:"˜",Tilde:"∼",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",timesbar:"⨱",timesb:"⊠",times:"×",timesd:"⨰",tint:"∭",toea:"⤨",topbot:"⌶",topcir:"⫱",top:"⊤",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",trade:"™",TRADE:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",uarr:"↑",Uarr:"↟",uArr:"⇑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrowBar:"⤒",uparrow:"↑",UpArrow:"↑",Uparrow:"⇑",UpArrowDownArrow:"⇅",updownarrow:"↕",UpDownArrow:"↕",Updownarrow:"⇕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",upsi:"υ",Upsi:"ϒ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTeeArrow:"↥",UpTee:"⊥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",varr:"↕",vArr:"⇕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",vBar:"⫨",Vbar:"⫫",vBarv:"⫩",Vcy:"В",vcy:"в",vdash:"⊢",vDash:"⊨",Vdash:"⊩",VDash:"⊫",Vdashl:"⫦",veebar:"⊻",vee:"∨",Vee:"⋁",veeeq:"≚",vellip:"⋮",verbar:"|",Verbar:"‖",vert:"|",Vert:"‖",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",wedge:"∧",Wedge:"⋀",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xharr:"⟷",xhArr:"⟺",Xi:"Ξ",xi:"ξ",xlarr:"⟵",xlArr:"⟸",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrarr:"⟶",xrArr:"⟹",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",yuml:"ÿ",Yuml:"Ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",zfr:"𝔷",Zfr:"ℨ",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",zopf:"𝕫",Zopf:"ℤ",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"},v={Aacute:"Á",aacute:"á",Acirc:"Â",acirc:"â",acute:"´",AElig:"Æ",aelig:"æ",Agrave:"À",agrave:"à",amp:"&",AMP:"&",Aring:"Å",aring:"å",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",brvbar:"¦",Ccedil:"Ç",ccedil:"ç",cedil:"¸",cent:"¢",copy:"©",COPY:"©",curren:"¤",deg:"°",divide:"÷",Eacute:"É",eacute:"é",Ecirc:"Ê",ecirc:"ê",Egrave:"È",egrave:"è",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",frac12:"½",frac14:"¼",frac34:"¾",gt:">",GT:">",Iacute:"Í",iacute:"í",Icirc:"Î",icirc:"î",iexcl:"¡",Igrave:"Ì",igrave:"ì",iquest:"¿",Iuml:"Ï",iuml:"ï",laquo:"«",lt:"<",LT:"<",macr:"¯",micro:"µ",middot:"·",nbsp:" ",not:"¬",Ntilde:"Ñ",ntilde:"ñ",Oacute:"Ó",oacute:"ó",Ocirc:"Ô",ocirc:"ô",Ograve:"Ò",ograve:"ò",ordf:"ª",ordm:"º",Oslash:"Ø",oslash:"ø",Otilde:"Õ",otilde:"õ",Ouml:"Ö",ouml:"ö",para:"¶",plusmn:"±",pound:"£",quot:'"',QUOT:'"',raquo:"»",reg:"®",REG:"®",sect:"§",shy:"­",sup1:"¹",sup2:"²",sup3:"³",szlig:"ß",THORN:"Þ",thorn:"þ",times:"×",Uacute:"Ú",uacute:"ú",Ucirc:"Û",ucirc:"û",Ugrave:"Ù",ugrave:"ù",uml:"¨",Uuml:"Ü",uuml:"ü",Yacute:"Ý",yacute:"ý",yen:"¥",yuml:"ÿ"},m={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"},g=[1,2,3,4,5,6,7,8,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986,64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999,65e3,65001,65002,65003,65004,65005,65006,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111],y=String.fromCharCode,b={},w=b.hasOwnProperty,E=function(e,t){return w.call(e,t)},S=function(e,t){var n=-1,r=e.length;while(++n<r)if(e[n]==t)return!0;return!1},x=function(e,t){if(!e)return t;var n={},r;for(r in t)n[r]=E(e,r)?e[r]:t[r];return n},T=function(e,t){var n="";return e>=55296&&e<=57343||e>1114111?(t&&C("character reference outside the permissible Unicode range"),"�"):E(m,e)?(t&&C("disallowed character reference"),m[e]):(t&&S(g,e)&&C("disallowed character reference"),e>65535&&(e-=65536,n+=y(e>>>10&1023|55296),e=56320|e&1023),n+=y(e),n)},N=function(e){return"&#x"+e.charCodeAt(0).toString(16).toUpperCase()+";"},C=function(e){throw Error("Parse error: "+e)},k=function(e,t){t=x(t,k.options);var n=t.strict;n&&h.test(e)&&C("forbidden code point");var r=t.encodeEverything,l=t.useNamedReferences;return r?(e=e.replace(s,function(e){return l&&E(a,e)?"&"+a[e]+";":N(e)}),l&&(e=e.replace(/&gt;\u20D2/g,"&nvgt;").replace(/&lt;\u20D2/g,"&nvlt;").replace(/&#x66;&#x6A;/g,"&fjlig;")),l&&(e=e.replace(u,function(e){return"&"+a[e]+";"}))):l?(e=e.replace(f,function(e){return"&"+a[e]+";"}),e=e.replace(/&gt;\u20D2/g,"&nvgt;").replace(/&lt;\u20D2/g,"&nvlt;"),e=e.replace(u,function(e){return"&"+a[e]+";"})):e=e.replace(f,N),e.replace(i,function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1),r=(t-55296)*1024+n-56320+65536;return"&#x"+r.toString(16).toUpperCase()+";"}).replace(o,N)};k.options={encodeEverything:!1,strict:!1,useNamedReferences:!1};var L=function(e,t){t=x(t,L.options);var n=t.strict;return n&&c.test(e)&&C("malformed character reference"),e.replace(p,function(e,r,i,s,o,u,a,f){var l,c,h,p,m;return r?(l=r,c=i,n&&!c&&C("character reference was not terminated by a semicolon"),T(l,n)):s?(h=s,c=o,n&&!c&&C("character reference was not terminated by a semicolon"),l=parseInt(h,16),T(l,n)):u?(p=u,E(d,p)?d[p]:(n&&C("named character reference was not terminated by a semicolon"),e)):(p=a,m=f,m&&t.isAttributeValue?(n&&m=="="&&C("`&` did not start a character reference"),e):(n&&C("named character reference was not terminated by a semicolon"),v[p]+(m||"")))})};L.options={isAttributeValue:!1,strict:!1};var A=function(e){return e.replace(f,function(e){return l[e]})},O={version:"0.4.1",encode:k,decode:L,escape:A,unescape:L};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("he",[],function(){return O});else if(t&&!t.nodeType)if(n)n.exports=O;else for(var M in O)E(O,M)&&(t[M]=O[M]);else e.he=O}(this),function(e){define("to-markdown",["he"],function(){return function(){if(typeof t!="object"&&typeof require=="function")var t=require("he");var n=function(e){function u(e,t){var n=t.type==="void"?"<"+t.tag+"\\b([^>]*)\\/?>":"<"+t.tag+"\\b([^>]*)>([\\s\\S]*?)<\\/"+t.tag+">",r=new RegExp(n,"gi"),i="";return typeof t.replacement=="string"?i=e.replace(r,t.replacement):i=e.replace(r,function(e,n,r,i){return t.replacement.call(this,e,n,r,i)}),i}function a(e){return new RegExp(e+"\\s*=\\s*[\"']?([^\"']*)[\"']?","i")}function l(e){return e=e.replace(/<(ul|ol)\b[^>]*>([\s\S]*?)<\/\1>/gi,function(e,t,n){var s=n.split("</li>");s.splice(s.length-1,1);for(r=0,i=s.length;r<i;r++){if(s[r]){var o=t==="ol"?r+1+".  ":"*   ";s[r]=s[r].replace(/\s*<li[^>]*>([\s\S]*)/i,function(e,t){return t=t.replace(/^\s+/,""),t=t.replace(/\n\n/g,"\n\n    "),t=t.replace(/\n([ ]*)+(\*|\d+\.) /g,"\n$1    $2 "),o+t})}s[r]=s[r].replace(/(.) +$/m,"$1")}return s.join("\n")}),"\n\n"+e.replace(/[ \t]+\n|\s+$/g,"")}function h(e){return e=e.replace(/<blockquote\b[^>]*>([\s\S]*?)<\/blockquote>/gi,function(e,t){return t=t.replace(/^\s+|\s+$/g,""),t=p(t),t=t.replace(/^/gm,"> "),t=t.replace(/^(>([ \t]{2,}>)+)/gm,"> >"),t}),e}function p(e){return e=e.replace(/^[\t\r\n]+|[\t\r\n]+$/g,""),e=e.replace(/\n\s+\n/g,"\n\n"),e=e.replace(/\n{3,}/g,"\n\n"),e}var n=[{patterns:"p",replacement:function(e,t,n){return n?"\n\n"+n+"\n":""}},{patterns:"br",type:"void",replacement:"  \n"},{patterns:"h([1-6])",replacement:function(e,t,n,r){var i="";for(var s=0;s<t;s++)i+="#";return"\n\n"+i+" "+r+"\n"}},{patterns:"hr",type:"void",replacement:"\n\n* * *\n"},{patterns:"a",replacement:function(e,t,n){var r=t.match(a("href")),i=t.match(a("title"));return r?"["+n+"]"+"("+r[1]+(i&&i[1]?' "'+i[1]+'"':"")+")":e}},{patterns:["b","strong"],replacement:function(e,t,n){return n?"**"+n+"**":""}},{patterns:["i","em"],replacement:function(e,t,n){return n?"_"+n+"_":""}},{patterns:"code",replacement:function(e,n,r){return r?"`"+t.decode(r)+"`":""}},{patterns:"img",type:"void",replacement:function(e,t,n){var r=t.match(a("src")),i=t.match(a("alt")),s=t.match(a("title"));return r?"!["+(i&&i[1]?i[1]:"")+"]"+"("+r[1]+(s&&s[1]?' "'+s[1]+'"':"")+")":""}}];for(var r=0,i=n.length;r<i;r++)if(typeof n[r].patterns=="string")e=u(e,{tag:n[r].patterns,replacement:n[r].replacement,type:n[r].type});else for(var s=0,o=n[r].patterns.length;s<o;s++)e=u(e,{tag:n[r].patterns[s],replacement:n[r].replacement,type:n[r].type});e=e.replace(/<pre\b[^>]*>`([\s\S]*?)`<\/pre>/gi,function(e,n){var r=t.decode(n);return r=r.replace(/^\t+/g,"  "),r=r.replace(/\n/g,"\n    "),"\n\n    "+r+"\n"}),e=e.replace(/^(\s{0,3}\d+)\. /g,"$1\\. ");var f=/<(ul|ol)\b[^>]*>(?:(?!<ul|<ol)[\s\S])*?<\/\1>/gi;while(e.match(f))e=e.replace(f,function(e){return l(e)});var c=/<blockquote\b[^>]*>((?:(?!<blockquote)[\s\S])*?)<\/blockquote>/gi;while(e.match(c))e=e.replace(c,function(e){return h(e)});return p(e)};return typeof exports=="object"&&(exports.toMarkdown=n),e.toMarkdown=n}.apply(e,arguments)})}(this),function(e){var t=typeof self=="object"&&self.self==self&&self||typeof global=="object"&&global.global==global&&global;if(typeof define=="function"&&define.amd)define("backbone",["underscore","jquery","exports"],function(n,r,i){t.Backbone=e(t,i,n,r)});else if(typeof exports!="undefined"){var n=require("underscore"),r;try{r=require("jquery")}catch(i){}e(t,exports,n,r)}else t.Backbone=e(t,{},t._,t.jQuery||t.Zepto||t.ender||t.$)}(function(e,t,n,r){var i=e.Backbone,s=[].slice;t.VERSION="1.2.1",t.$=r,t.noConflict=function(){return e.Backbone=i,this},t.emulateHTTP=!1,t.emulateJSON=!1;var o=function(e,t,r){switch(e){case 1:return function(){return n[t](this[r])};case 2:return function(e){return n[t](this[r],e)};case 3:return function(e,i){return n[t](this[r],e,i)};case 4:return function(e,i,s){return n[t](this[r],e,i,s)};default:return function(){var e=s.call(arguments);return e.unshift(this[r]),n[t].apply(n,e)}}},u=function(e,t,r){n.each(t,function(t,i){n[i]&&(e.prototype[i]=o(t,i,r))})},a=t.Events={},f=/\s+/,l=function(e,t,r,i,s){var o=0,u;if(r&&typeof r=="object"){i!==void 0&&"context"in s&&s.context===void 0&&(s.context=i);for(u=n.keys(r);o<u.length;o++)t=e(t,u[o],r[u[o]],s)}else if(r&&f.test(r))for(u=r.split(f);o<u.length;o++)t=e(t,u[o],i,s);else t=e(t,r,i,s);return t};a.on=function(e,t,n){return c(this,e,t,n)};var c=function(e,t,n,r,i){e._events=l(h,e._events||{},t,n,{context:r,ctx:e,listening:i});if(i){var s=e._listeners||(e._listeners={});s[i.id]=i}return e};a.listenTo=function(e,t,r){if(!e)return this;var i=e._listenId||(e._listenId=n.uniqueId("l")),s=this._listeningTo||(this._listeningTo={}),o=s[i];if(!o){var u=this._listenId||(this._listenId=n.uniqueId("l"));o=s[i]={obj:e,objId:i,id:u,listeningTo:s,count:0}}return c(e,t,r,this,o),this};var h=function(e,t,n,r){if(n){var i=e[t]||(e[t]=[]),s=r.context,o=r.ctx,u=r.listening;u&&u.count++,i.push({callback:n,context:s,ctx:s||o,listening:u})}return e};a.off=function(e,t,n){return this._events?(this._events=l(p,this._events,e,t,{context:n,listeners:this._listeners}),this):this},a.stopListening=function(e,t,r){var i=this._listeningTo;if(!i)return this;var s=e?[e._listenId]:n.keys(i);for(var o=0;o<s.length;o++){var u=i[s[o]];if(!u)break;u.obj.off(t,r,this)}return n.isEmpty(i)&&(this._listeningTo=void 0),this};var p=function(e,t,r,i){if(!e)return;var s=0,o,u=i.context,a=i.listeners;if(!t&&!r&&!u){var f=n.keys(a);for(;s<f.length;s++)o=a[f[s]],delete a[o.id],delete o.listeningTo[o.objId];return}var l=t?[t]:n.keys(e);for(;s<l.length;s++){t=l[s];var c=e[t];if(!c)break;var h=[];for(var p=0;p<c.length;p++){var d=c[p];r&&r!==d.callback&&r!==d.callback._callback||u&&u!==d.context?h.push(d):(o=d.listening,o&&--o.count===0&&(delete a[o.id],delete o.listeningTo[o.objId]))}h.length?e[t]=h:delete e[t]}if(n.size(e))return e};a.once=function(e,t,r){var i=l(d,{},e,t,n.bind(this.off,this));return this.on(i,void 0,r)},a.listenToOnce=function(e,t,r){var i=l(d,{},t,r,n.bind(this.stopListening,this,e));return this.listenTo(e,i)};var d=function(e,t,r,i){if(r){var s=e[t]=n.once(function(){i(t,s),r.apply(this,arguments)});s._callback=r}return e};a.trigger=function(e){if(!this._events)return this;var t=Math.max(0,arguments.length-1),n=Array(t);for(var r=0;r<t;r++)n[r]=arguments[r+1];return l(v,this._events,e,void 0,n),this};var v=function(e,t,n,r){if(e){var i=e[t],s=e.all;i&&s&&(s=s.slice()),i&&m(i,r),s&&m(s,[t].concat(r))}return e},m=function(e,t){var n,r=-1,i=e.length,s=t[0],o=t[1],u=t[2];switch(t.length){case 0:while(++r<i)(n=e[r]).callback.call(n.ctx);return;case 1:while(++r<i)(n=e[r]).callback.call(n.ctx,s);return;case 2:while(++r<i)(n=e[r]).callback.call(n.ctx,s,o);return;case 3:while(++r<i)(n=e[r]).callback.call(n.ctx,s,o,u);return;default:while(++r<i)(n=e[r]).callback.apply(n.ctx,t);return}};a.bind=a.on,a.unbind=a.off,n.extend(t,a);var g=t.Model=function(e,t){var r=e||{};t||(t={}),this.cid=n.uniqueId(this.cidPrefix),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(r=this.parse(r,t)||{}),r=n.defaults({},r,n.result(this,"defaults")),this.set(r,t),this.changed={},this.initialize.apply(this,arguments)};n.extend(g.prototype,a,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(e){return n.clone(this.attributes)},sync:function(){return t.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return n.escape(this.get(e))},has:function(e){return this.get(e)!=null},matches:function(e){return!!n.iteratee(e,this)(this.attributes)},set:function(e,t,r){if(e==null)return this;var i;typeof e=="object"?(i=e,r=t):(i={})[e]=t,r||(r={});if(!this._validate(i,r))return!1;var s=r.unset,o=r.silent,u=[],a=this._changing;this._changing=!0,a||(this._previousAttributes=n.clone(this.attributes),this.changed={});var f=this.attributes,l=this.changed,c=this._previousAttributes;this.idAttribute in i&&(this.id=i[this.idAttribute]);for(var h in i)t=i[h],n.isEqual(f[h],t)||u.push(h),n.isEqual(c[h],t)?delete l[h]:l[h]=t,s?delete f[h]:f[h]=t;if(!o){u.length&&(this._pending=r);for(var p=0;p<u.length;p++)this.trigger("change:"+u[p],this,f[u[p]],r)}if(a)return this;if(!o)while(this._pending)r=this._pending,this._pending=!1,this.trigger("change",this,r);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,n.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var r in this.attributes)t[r]=void 0;return this.set(t,n.extend({},e,{unset:!0}))},hasChanged:function(e){return e==null?!n.isEmpty(this.changed):n.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?n.clone(this.changed):!1;var t=this._changing?this._previousAttributes:this.attributes,r={};for(var i in e){var s=e[i];if(n.isEqual(t[i],s))continue;r[i]=s}return n.size(r)?r:!1},previous:function(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]},previousAttributes:function(){return n.clone(this._previousAttributes)},fetch:function(e){e=n.extend({parse:!0},e);var t=this,r=e.success;return e.success=function(n){var i=e.parse?t.parse(n,e):n;if(!t.set(i,e))return!1;r&&r.call(e.context,t,n,e),t.trigger("sync",t,n,e)},I(this,e),this.sync("read",this,e)},save:function(e,t,r){var i;e==null||typeof e=="object"?(i=e,r=t):(i={})[e]=t,r=n.extend({validate:!0,parse:!0},r);var s=r.wait;if(i&&!s){if(!this.set(i,r))return!1}else if(!this._validate(i,r))return!1;var o=this,u=r.success,a=this.attributes;r.success=function(e){o.attributes=a;var t=r.parse?o.parse(e,r):e;s&&(t=n.extend({},i,t));if(t&&!o.set(t,r))return!1;u&&u.call(r.context,o,e,r),o.trigger("sync",o,e,r)},I(this,r),i&&s&&(this.attributes=n.extend({},a,i));var f=this.isNew()?"create":r.patch?"patch":"update";f==="patch"&&!r.attrs&&(r.attrs=i);var l=this.sync(f,this,r);return this.attributes=a,l},destroy:function(e){e=e?n.clone(e):{};var t=this,r=e.success,i=e.wait,s=function(){t.stopListening(),t.trigger("destroy",t,t.collection,e)};e.success=function(n){i&&s(),r&&r.call(e.context,t,n,e),t.isNew()||t.trigger("sync",t,n,e)};var o=!1;return this.isNew()?n.defer(e.success):(I(this,e),o=this.sync("delete",this,e)),i||s(),o},url:function(){var e=n.result(this,"urlRoot")||n.result(this.collection,"url")||F();if(this.isNew())return e;var t=this.get(this.idAttribute);return e.replace(/[^\/]$/,"$&/")+encodeURIComponent(t)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(e){return this._validate({},n.defaults({validate:!0},e))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=n.extend({},this.attributes,e);var r=this.validationError=this.validate(e,t)||null;return r?(this.trigger("invalid",this,r,n.extend(t,{validationError:r})),!1):!0}});var y={keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1};u(g,y,"attributes");var b=t.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),t.comparator!==void 0&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,n.extend({silent:!0},t))},w={add:!0,remove:!0,merge:!0},E={add:!0,remove:!1};n.extend(b.prototype,a,{model:g,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return t.sync.apply(this,arguments)},add:function(e,t){return this.set(e,n.extend({merge:!1},t,E))},remove:function(e,t){t=n.extend({},t);var r=!n.isArray(e);e=r?[e]:n.clone(e);var i=this._removeModels(e,t);return!t.silent&&i&&this.trigger("update",this,t),r?i[0]:i},set:function(e,t){t=n.defaults({},t,w),t.parse&&!this._isModel(e)&&(e=this.parse(e,t));var r=!n.isArray(e);e=r?e?[e]:[]:e.slice();var i,s,o,u,a,f=t.at;f!=null&&(f=+f),f<0&&(f+=this.length+1);var l=this.comparator&&f==null&&t.sort!==!1,c=n.isString(this.comparator)?this.comparator:null,h=[],p=[],d={},v=t.add,m=t.merge,g=t.remove,y=!l&&v&&g?[]:!1,b=!1;for(var E=0;E<e.length;E++){o=e[E];if(u=this.get(o))g&&(d[u.cid]=!0),m&&o!==u&&(o=this._isModel(o)?o.attributes:o,t.parse&&(o=u.parse(o,t)),u.set(o,t),l&&!a&&u.hasChanged(c)&&(a=!0)),e[E]=u;else if(v){s=e[E]=this._prepareModel(o,t);if(!s)continue;h.push(s),this._addReference(s,t)}s=u||s;if(!s)continue;i=this.modelId(s.attributes),y&&(s.isNew()||!d[i])&&(y.push(s),b=b||!this.models[E]||s.cid!==this.models[E].cid),d[i]=!0}if(g){for(var E=0;E<this.length;E++)d[(s=this.models[E]).cid]||p.push(s);p.length&&this._removeModels(p,t)}if(h.length||b){l&&(a=!0),this.length+=h.length;if(f!=null)for(var E=0;E<h.length;E++)this.models.splice(f+E,0,h[E]);else{y&&(this.models.length=0);var S=y||h;for(var E=0;E<S.length;E++)this.models.push(S[E])}}a&&this.sort({silent:!0});if(!t.silent){var x=f!=null?n.clone(t):t;for(var E=0;E<h.length;E++)f!=null&&(x.index=f+E),(s=h[E]).trigger("add",s,this,x);(a||b)&&this.trigger("sort",this,t),(h.length||p.length)&&this.trigger("update",this,t)}return r?e[0]:e},reset:function(e,t){t=t?n.clone(t):{};for(var r=0;r<this.models.length;r++)this._removeReference(this.models[r],t);return t.previousModels=this.models,this._reset(),e=this.add(e,n.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,n.extend({at:this.length},t))},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e)},unshift:function(e,t){return this.add(e,n.extend({at:0},t))},shift:function(e){var t=this.at(0);return this.remove(t,e)},slice:function(){return s.apply(this.models,arguments)},get:function(e){if(e==null)return void 0;var t=this.modelId(this._isModel(e)?e.attributes:e);return this._byId[e]||this._byId[t]||this._byId[e.cid]},at:function(e){return e<0&&(e+=this.length),this.models[e]},where:function(e,t){var r=n.matches(e);return this[t?"find":"filter"](function(e){return r(e.attributes)})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),n.isString(this.comparator)||this.comparator.length===1?this.models=this.sortBy(this.comparator,this):this.models.sort(n.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return n.invoke(this.models,"get",e)},fetch:function(e){e=n.extend({parse:!0},e);var t=e.success,r=this;return e.success=function(n){var i=e.reset?"reset":"set";r[i](n,e),t&&t.call(e.context,r,n,e),r.trigger("sync",r,n,e)},I(this,e),this.sync("read",this,e)},create:function(e,t){t=t?n.clone(t):{};var r=t.wait;e=this._prepareModel(e,t);if(!e)return!1;r||this.add(e,t);var i=this,s=t.success;return t.success=function(e,t,n){r&&i.add(e,n),s&&s.call(n.context,e,t,n)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(e){return e[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(this._isModel(e))return e.collection||(e.collection=this),e;t=t?n.clone(t):{},t.collection=this;var r=new this.model(e,t);return r.validationError?(this.trigger("invalid",this,r.validationError,t),!1):r},_removeModels:function(e,t){var n=[];for(var r=0;r<e.length;r++){var i=this.get(e[r]);if(!i)continue;var s=this.indexOf(i);this.models.splice(s,1),this.length--,t.silent||(t.index=s,i.trigger("remove",i,this,t)),n.push(i),this._removeReference(i,t)}return n.length?n:!1},_isModel:function(e){return e instanceof g},_addReference:function(e,t){this._byId[e.cid]=e;var n=this.modelId(e.attributes);n!=null&&(this._byId[n]=e),e.on("all",this._onModelEvent,this)},_removeReference:function(e,t){delete this._byId[e.cid];var n=this.modelId(e.attributes);n!=null&&delete this._byId[n],this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,r){if((e==="add"||e==="remove")&&n!==this)return;e==="destroy"&&this.remove(t,r);if(e==="change"){var i=this.modelId(t.previousAttributes()),s=this.modelId(t.attributes);i!==s&&(i!=null&&delete this._byId[i],s!=null&&(this._byId[s]=t))}this.trigger.apply(this,arguments)}});var S={forEach:3,each:3,map:3,collect:3,reduce:4,foldl:4,inject:4,reduceRight:4,foldr:4,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:2,contains:2,invoke:0,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3};u(b,S,"models");var x=["groupBy","countBy","sortBy","indexBy"];n.each(x,function(e){if(!n[e])return;b.prototype[e]=function(t,r){var i=n.isFunction(t)?t:function(e){return e.get(t)};return n[e](this.models,i,r)}});var T=t.View=function(e){this.cid=n.uniqueId("view"),n.extend(this,n.pick(e,C)),this._ensureElement(),this.initialize.apply(this,arguments)},N=/^(\S+)\s*(.*)$/,C=["model","collection","el","id","attributes","className","tagName","events"];n.extend(T.prototype,a,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.$el.remove()},setElement:function(e){return this.undelegateEvents(),this._setElement(e),this.delegateEvents(),this},_setElement:function(e){this.$el=e instanceof t.$?e:t.$(e),this.el=this.$el[0]},delegateEvents:function(e){e||(e=n.result(this,"events"));if(!e)return this;this.undelegateEvents();for(var t in e){var r=e[t];n.isFunction(r)||(r=this[r]);if(!r)continue;var i=t.match(N);this.delegate(i[1],i[2],n.bind(r,this))}return this},delegate:function(e,t,n){return this.$el.on(e+".delegateEvents"+this.cid,t,n),this},undelegateEvents:function(){return this.$el&&this.$el.off(".delegateEvents"+this.cid),this},undelegate:function(e,t,n){return this.$el.off(e+".delegateEvents"+this.cid,t,n),this},_createElement:function(e){return document.createElement(e)},_ensureElement:function(){if(!this.el){var e=n.extend({},n.result(this,"attributes"));this.id&&(e.id=n.result(this,"id")),this.className&&(e["class"]=n.result(this,"className")),this.setElement(this._createElement(n.result(this,"tagName"))),this._setAttributes(e)}else this.setElement(n.result(this,"el"))},_setAttributes:function(e){this.$el.attr(e)}}),t.sync=function(e,r,i){var s=k[e];n.defaults(i||(i={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON});var o={type:s,dataType:"json"};i.url||(o.url=n.result(r,"url")||F()),i.data==null&&r&&(e==="create"||e==="update"||e==="patch")&&(o.contentType="application/json",o.data=JSON.stringify(i.attrs||r.toJSON(i))),i.emulateJSON&&(o.contentType="application/x-www-form-urlencoded",o.data=o.data?{model:o.data}:{});if(i.emulateHTTP&&(s==="PUT"||s==="DELETE"||s==="PATCH")){o.type="POST",i.emulateJSON&&(o.data._method=s);var u=i.beforeSend;i.beforeSend=function(e){e.setRequestHeader("X-HTTP-Method-Override",s);if(u)return u.apply(this,arguments)}}o.type!=="GET"&&!i.emulateJSON&&(o.processData=!1);var a=i.error;i.error=function(e,t,n){i.textStatus=t,i.errorThrown=n,a&&a.call(i.context,e,t,n)};var f=i.xhr=t.ajax(n.extend(o,i));return r.trigger("request",r,f,i),f};var k={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var L=t.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},A=/\((.*?)\)/g,O=/(\(\?)?:\w+/g,M=/\*\w+/g,_=/[\-{}\[\]+?.,\\\^$|#\s]/g;n.extend(L.prototype,a,{initialize:function(){},route:function(e,r,i){n.isRegExp(e)||(e=this._routeToRegExp(e)),n.isFunction(r)&&(i=r,r=""),i||(i=this[r]);var s=this;return t.history.route(e,function(n){var o=s._extractParameters(e,n);s.execute(i,o,r)!==!1&&(s.trigger.apply(s,["route:"+r].concat(o)),s.trigger("route",r,o),t.history.trigger("route",s,r,o))}),this},execute:function(e,t,n){e&&e.apply(this,t)},navigate:function(e,n){return t.history.navigate(e,n),this},_bindRoutes:function(){if(!this.routes)return;this.routes=n.result(this,"routes");var e,t=n.keys(this.routes);while((e=t.pop())!=null)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(_,"\\$&").replace(A,"(?:$1)?").replace(O,function(e,t){return t?e:"([^/?]+)"}).replace(M,"([^?]*?)"),new RegExp("^"+e+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(e,t){var r=e.exec(t).slice(1);return n.map(r,function(e,t){return t===r.length-1?e||null:e?decodeURIComponent(e):null})}});var D=t.History=function(){this.handlers=[],n.bindAll(this,"checkUrl"),typeof window!="undefined"&&(this.location=window.location,this.history=window.history)},P=/^[#\/]|\s+$/g,H=/^\/+|\/+$/g,B=/#.*$/;D.started=!1,n.extend(D.prototype,a,{interval:50,atRoot:function(){var e=this.location.pathname.replace(/[^\/]$/,"$&/");return e===this.root&&!this.getSearch()},matchRoot:function(){var e=this.decodeFragment(this.location.pathname),t=e.slice(0,this.root.length-1)+"/";return t===this.root},decodeFragment:function(e){return decodeURI(e.replace(/%25/g,"%2525"))},getSearch:function(){var e=this.location.href.replace(/#.*/,"").match(/\?.+/);return e?e[0]:""},getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getPath:function(){var e=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return e.charAt(0)==="/"?e.slice(1):e},getFragment:function(e){return e==null&&(this._usePushState||!this._wantsHashChange?e=this.getPath():e=this.getHash()),e.replace(P,"")},start:function(e){if(D.started)throw new Error("Backbone.history has already been started");D.started=!0,this.options=n.extend({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._hasHashChange="onhashchange"in window,this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!this.history&&!!this.history.pushState,this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(H,"/");if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var t=this.root.slice(0,-1)||"/";return this.location.replace(t+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var r=document.body,i=r.insertBefore(this.iframe,r.firstChild).contentWindow;i.document.open(),i.document.close(),i.location.hash="#"+this.fragment}var s=window.addEventListener||function(e,t){return attachEvent("on"+e,t)};this._usePushState?s("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?s("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval));if(!this.options.silent)return this.loadUrl()},stop:function(){var e=window.removeEventListener||function(e,t){return detachEvent("on"+e,t)};this._usePushState?e("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&e("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),D.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();t===this.fragment&&this.iframe&&(t=this.getHash(this.iframe.contentWindow));if(t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()},loadUrl:function(e){return this.matchRoot()?(e=this.fragment=this.getFragment(e),n.any(this.handlers,function(t){if(t.route.test(e))return t.callback(e),!0})):!1},navigate:function(e,t){if(!D.started)return!1;if(!t||t===!0)t={trigger:!!t};e=this.getFragment(e||"");var n=this.root;if(e===""||e.charAt(0)==="?")n=n.slice(0,-1)||"/";var r=n+e;e=this.decodeFragment(e.replace(B,""));if(this.fragment===e)return;this.fragment=e;if(this._usePushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,r);else{if(!this._wantsHashChange)return this.location.assign(r);this._updateHash(this.location,e,t.replace);if(this.iframe&&e!==this.getHash(this.iframe.contentWindow)){var i=this.iframe.contentWindow;t.replace||(i.document.open(),i.document.close()),this._updateHash(i.location,e,t.replace)}}if(t.trigger)return this.loadUrl(e)},_updateHash:function(e,t,n){if(n){var r=e.href.replace(/(javascript:|#).*$/,"");e.replace(r+"#"+t)}else e.hash="#"+t}}),t.history=new D;var j=function(e,t){var r=this,i;e&&n.has(e,"constructor")?i=e.constructor:i=function(){return r.apply(this,arguments)},n.extend(i,r,t);var s=function(){this.constructor=i};return s.prototype=r.prototype,i.prototype=new s,e&&n.extend(i.prototype,e),i.__super__=r.prototype,i};g.extend=b.extend=L.extend=T.extend=D.extend=j;var F=function(){throw new Error('A "url" property or function must be specified')},I=function(e,t){var n=t.error;t.error=function(r){n&&n.call(t.context,e,r,t),e.trigger("error",e,r,t)}};return t}),function(e,t){if(typeof define=="function"&&define.amd)define("marionette",["backbone","underscore"],function(n,r){return e.Marionette=e.Mn=t(e,n,r)});else if(typeof exports!="undefined"){var n=require("backbone"),r=require("underscore");module.exports=t(e,n,r)}else e.Marionette=e.Mn=t(e,e.Backbone,e._)}(this,function(e,t,n){(function(e,t){var n=e.ChildViewContainer;return e.ChildViewContainer=function(e,t){var n=function(e){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),t.each(e,this.add,this)};t.extend(n.prototype,{add:function(e,t){var n=e.cid;return this._views[n]=e,e.model&&(this._indexByModel[e.model.cid]=n),t&&(this._indexByCustom[t]=n),this._updateLength(),this},findByModel:function(e){return this.findByModelCid(e.cid)},findByModelCid:function(e){var t=this._indexByModel[e];return this.findByCid(t)},findByCustom:function(e){var t=this._indexByCustom[e];return this.findByCid(t)},findByIndex:function(e){return t.values(this._views)[e]},findByCid:function(e){return this._views[e]},remove:function(e){var n=e.cid;return e.model&&delete this._indexByModel[e.model.cid],t.any(this._indexByCustom,function(e,t){if(e===n)return delete this._indexByCustom[t],!0},this),delete this._views[n],this._updateLength(),this},call:function(e){this.apply(e,t.tail(arguments))},apply:function(e,n){t.each(this._views,function(r){t.isFunction(r[e])&&r[e].apply(r,n||[])})},_updateLength:function(){this.length=t.size(this._views)}});var r=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck","reduce"];return t.each(r,function(e){n.prototype[e]=function(){var n=t.values(this._views),r=[n].concat(t.toArray(arguments));return t[e].apply(t,r)}}),n}(e,t),e.ChildViewContainer.VERSION="0.1.7",e.ChildViewContainer.noConflict=function(){return e.ChildViewContainer=n,this},e.ChildViewContainer})(t,n),function(e,t){var n=e.Wreqr,r=e.Wreqr={};return e.Wreqr.VERSION="1.3.3",e.Wreqr.noConflict=function(){return e.Wreqr=n,this},r.Handlers=function(e,t){var n=function(e){this.options=e,this._wreqrHandlers={},t.isFunction(this.initialize)&&this.initialize(e)};return n.extend=e.Model.extend,t.extend(n.prototype,e.Events,{setHandlers:function(e){t.each(e,function(e,n){var r=null;t.isObject(e)&&!t.isFunction(e)&&(r=e.context,e=e.callback),this.setHandler(n,e,r)},this)},setHandler:function(e,t,n){var r={callback:t,context:n};this._wreqrHandlers[e]=r,this.trigger("handler:add",e,t,n)},hasHandler:function(e){return!!this._wreqrHandlers[e]},getHandler:function(e){var t=this._wreqrHandlers[e];if(!t)return;return function(){return t.callback.apply(t.context,arguments)}},removeHandler:function(e){delete this._wreqrHandlers[e]},removeAllHandlers:function(){this._wreqrHandlers={}}}),n}(e,t),r.CommandStorage=function(){var n=function(e){this.options=e,this._commands={},t.isFunction(this.initialize)&&this.initialize(e)};return t.extend(n.prototype,e.Events,{getCommands:function(e){var t=this._commands[e];return t||(t={command:e,instances:[]},this._commands[e]=t),t},addCommand:function(e,t){var n=this.getCommands(e);n.instances.push(t)},clearCommands:function(e){var t=this.getCommands(e);t.instances=[]}}),n}(),r.Commands=function(e,t){return e.Handlers.extend({storageType:e.CommandStorage,constructor:function(t){this.options=t||{},this._initializeStorage(this.options),this.on("handler:add",this._executeCommands,this),e.Handlers.prototype.constructor.apply(this,arguments)},execute:function(e){e=arguments[0];var n=t.rest(arguments);this.hasHandler(e)?this.getHandler(e).apply(this,n):this.storage.addCommand(e,n)},_executeCommands:function(e,n,r){var i=this.storage.getCommands(e);t.each(i.instances,function(e){n.apply(r,e)}),this.storage.clearCommands(e)},_initializeStorage:function(e){var n,r=e.storageType||this.storageType;t.isFunction(r)?n=new r:n=r,this.storage=n}})}(r,t),r.RequestResponse=function(e,t){return e.Handlers.extend({request:function(e){if(this.hasHandler(e))return this.getHandler(e).apply(this,t.rest(arguments))}})}(r,t),r.EventAggregator=function(e,t){var n=function(){};return n.extend=e.Model.extend,t.extend(n.prototype,e.Events),n}(e,t),r.Channel=function(n){var r=function(t){this.vent=new e.Wreqr.EventAggregator,this.reqres=new e.Wreqr.RequestResponse,this.commands=new e.Wreqr.Commands,this.channelName=t};return t.extend(r.prototype,{reset:function(){return this.vent.off(),this.vent.stopListening(),this.reqres.removeAllHandlers(),this.commands.removeAllHandlers(),this},connectEvents:function(e,t){return this._connect("vent",e,t),this},connectCommands:function(e,t){return this._connect("commands",e,t),this},connectRequests:function(e,t){return this._connect("reqres",e,t),this},_connect:function(e,n,r){if(!n)return;r=r||this;var i=e==="vent"?"on":"setHandler";t.each(n,function(n,s){this[e][i](s,t.bind(n,r))},this)}}),r}(r),r.radio=function(e,t){var n=function(){this._channels={},this.vent={},this.commands={},this.reqres={},this._proxyMethods()};t.extend(n.prototype,{channel:function(e){if(!e)throw new Error("Channel must receive a name");return this._getChannel(e)},_getChannel:function(t){var n=this._channels[t];return n||(n=new e.Channel(t),this._channels[t]=n),n},_proxyMethods:function(){t.each(["vent","commands","reqres"],function(e){t.each(r[e],function(t){this[e][t]=i(this,e,t)},this)},this)}});var r={vent:["on","off","trigger","once","stopListening","listenTo","listenToOnce"],commands:["execute","setHandler","setHandlers","removeHandler","removeAllHandlers"],reqres:["request","setHandler","setHandlers","removeHandler","removeAllHandlers"]},i=function(e,n,r){return function(i){var s=e._getChannel(i)[n];return s[r].apply(s,t.rest(arguments))}};return new n}(r,t),e.Wreqr}(t,n);var r=e.Marionette,i=e.Mn,s=t.Marionette={};s.VERSION="2.4.2",s.noConflict=function(){return e.Marionette=r,e.Mn=i,this},t.Marionette=s,s.Deferred=t.$.Deferred,s.extend=t.Model.extend,s.isNodeAttached=function(e){return t.$.contains(document.documentElement,e)},s.mergeOptions=function(e,t){if(!e)return;n.extend(this,n.pick(e,t))},s.getOption=function(e,t){if(!e||!t)return;return e.options&&e.options[t]!==undefined?e.options[t]:e[t]},s.proxyGetOption=function(e){return s.getOption(this,e)},s._getValue=function(e,t,r){return n.isFunction(e)&&(e=r?e.apply(t,r):e.call(t)),e},s.normalizeMethods=function(e){return n.reduce(e,function(e,t,r){return n.isFunction(t)||(t=this[t]),t&&(e[r]=t),e},{},this)},s.normalizeUIString=function(e,t){return e.replace(/@ui\.[a-zA-Z_$0-9]*/g,function(e){return t[e.slice(4)]})},s.normalizeUIKeys=function(e,t){return n.reduce(e,function(e,n,r){var i=s.normalizeUIString(r,t);return e[i]=n,e},{})},s.normalizeUIValues=function(e,t,r){return n.each(e,function(i,o){n.isString(i)?e[o]=s.normalizeUIString(i,t):n.isObject(i)&&n.isArray(r)&&(n.extend(i,s.normalizeUIValues(n.pick(i,r),t)),n.each(r,function(e){var r=i[e];n.isString(r)&&(i[e]=s.normalizeUIString(r,t))}))}),e},s.actAsCollection=function(e,t){var r=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];n.each(r,function(r){e[r]=function(){var e=n.values(n.result(this,t)),i=[e].concat(n.toArray(arguments));return n[r].apply(n,i)}})};var o=s.deprecate=function(e,t){n.isObject(e)&&(e=e.prev+" is going to be removed in the future. "+"Please use "+e.next+" instead."+(e.url?" See: "+e.url:"")),(t===undefined||!t)&&!o._cache[e]&&(o._warn("Deprecation warning: "+e),o._cache[e]=!0)};o._warn=typeof console!="undefined"&&(console.warn||console.log)||function(){},o._cache={},s._triggerMethod=function(){function t(e,t,n){return n.toUpperCase()}var e=/(^|:)(\w)/gi;return function(r,i,s){var o=arguments.length<3;o&&(s=i,i=s[0]);var u="on"+i.replace(e,t),a=r[u],f;return n.isFunction(a)&&(f=a.apply(r,o?n.rest(s):s)),n.isFunction(r.trigger)&&(o+s.length>1?r.trigger.apply(r,o?s:[i].concat(n.drop(s,0))):r.trigger(i)),f}}(),s.triggerMethod=function(e){return s._triggerMethod(this,arguments)},s.triggerMethodOn=function(e){var t=n.isFunction(e.triggerMethod)?e.triggerMethod:s.triggerMethod;return t.apply(e,n.rest(arguments))},s.MonitorDOMRefresh=function(e){function t(){e._isShown=!0,i()}function r(){e._isRendered=!0,i()}function i(){e._isShown&&e._isRendered&&s.isNodeAttached(e.el)&&n.isFunction(e.triggerMethod)&&e.triggerMethod("dom:refresh")}e.on({show:t,render:r})},function(e){function t(t,r,i,s){var o=s.split(/\s+/);n.each(o,function(n){var s=t[n];if(!s)throw new e.Error('Method "'+n+'" was configured as an event handler, but does not exist.');t.listenTo(r,i,s)})}function r(e,t,n,r){e.listenTo(t,n,r)}function i(e,t,r,i){var s=i.split(/\s+/);n.each(s,function(n){var i=e[n];e.stopListening(t,r,i)})}function s(e,t,n,r){e.stopListening(t,n,r)}function o(t,r,i,s,o){if(!r||!i)return;if(!n.isObject(i))throw new e.Error({message:"Bindings must be an object or function.",url:"marionette.functions.html#marionettebindentityevents"});i=e._getValue(i,t),n.each(i,function(e,i){n.isFunction(e)?s(t,r,i,e):o(t,r,i,e)})}e.bindEntityEvents=function(e,n,i){o(e,n,i,r,t)},e.unbindEntityEvents=function(e,t,n){o(e,t,n,s,i)},e.proxyBindEntityEvents=function(t,n){return e.bindEntityEvents(this,t,n)},e.proxyUnbindEntityEvents=function(t,n){return e.unbindEntityEvents(this,t,n)}}(s);var u=["description","fileName","lineNumber","name","message","number"];return s.Error=s.extend.call(Error,{urlRoot:"http://marionettejs.com/docs/v"+s.VERSION+"/",constructor:function(e,t){n.isObject(e)?(t=e,e=t.message):t||(t={});var r=Error.call(this,e);n.extend(this,n.pick(r,u),n.pick(t,u)),this.captureStackTrace(),t.url&&(this.url=this.urlRoot+t.url)},captureStackTrace:function(){Error.captureStackTrace&&Error.captureStackTrace(this,s.Error)},toString:function(){return this.name+": "+this.message+(this.url?" See: "+this.url:"")}}),s.Error.extend=s.extend,s.Callbacks=function(){this._deferred=s.Deferred(),this._callbacks=[]},n.extend(s.Callbacks.prototype,{add:function(e,t){var r=n.result(this._deferred,"promise");this._callbacks.push({cb:e,ctx:t}),r.then(function(n){t&&(n.context=t),e.call(n.context,n.options)})},run:function(e,t){this._deferred.resolve({options:e,context:t})},reset:function(){var e=this._callbacks;this._deferred=s.Deferred(),this._callbacks=[],n.each(e,function(e){this.add(e.cb,e.ctx)},this)}}),s.Controller=function(e){this.options=e||{},n.isFunction(this.initialize)&&this.initialize(this.options)},s.Controller.extend=s.extend,n.extend(s.Controller.prototype,t.Events,{destroy:function(){return s._triggerMethod(this,"before:destroy",arguments),s._triggerMethod(this,"destroy",arguments),this.stopListening(),this.off(),this},triggerMethod:s.triggerMethod,mergeOptions:s.mergeOptions,getOption:s.proxyGetOption}),s.Object=function(e){this.options=n.extend({},n.result(this,"options"),e),this.initialize.apply(this,arguments)},s.Object.extend=s.extend,n.extend(s.Object.prototype,t.Events,{initialize:function(){},destroy:function(){return this.triggerMethod("before:destroy"),this.triggerMethod("destroy"),this.stopListening(),this},triggerMethod:s.triggerMethod,mergeOptions:s.mergeOptions,getOption:s.proxyGetOption,bindEntityEvents:s.proxyBindEntityEvents,unbindEntityEvents:s.proxyUnbindEntityEvents}),s.Region=s.Object.extend({constructor:function(e){this.options=e||{},this.el=this.getOption("el"),this.el=this.el instanceof t.$?this.el[0]:this.el;if(!this.el)throw new s.Error({name:"NoElError",message:'An "el" must be specified for a region.'});this.$el=this.getEl(this.el),s.Object.call(this,e)},show:function(e,t){if(!this._ensureElement())return;this._ensureViewIsIntact(e);var r=t||{},i=e!==this.currentView,o=!!r.preventDestroy,u=!!r.forceShow,a=!!this.currentView,f=i&&!o,l=i||u;a&&this.triggerMethod("before:swapOut",this.currentView,this,t),this.currentView&&delete this.currentView._parent,f?this.empty():a&&l&&this.currentView.off("destroy",this.empty,this);if(l){e.once("destroy",this.empty,this),e.render(),e._parent=this,a&&this.triggerMethod("before:swap",e,this,t),this.triggerMethod("before:show",e,this,t),s.triggerMethodOn(e,"before:show",e,this,t),a&&this.triggerMethod("swapOut",this.currentView,this,t);var c=s.isNodeAttached(this.el),h=[],p=n.extend({triggerBeforeAttach:this.triggerBeforeAttach,triggerAttach:this.triggerAttach},r);return c&&p.triggerBeforeAttach&&(h=this._displayedViews(e),this._triggerAttach(h,"before:")),this.attachHtml(e),this.currentView=e,c&&p.triggerAttach&&(h=this._displayedViews(e),this._triggerAttach(h)),a&&this.triggerMethod("swap",e,this,t),this.triggerMethod("show",e,this,t),s.triggerMethodOn(e,"show",e,this,t),this}return this},triggerBeforeAttach:!0,triggerAttach:!0,_triggerAttach:function(e,t){var r=(t||"")+"attach";n.each(e,function(e){s.triggerMethodOn(e,r,e,this)},this)},_displayedViews:function(e){return n.union([e],n.result(e,"_getNestedViews")||[])},_ensureElement:function(){n.isObject(this.el)||(this.$el=this.getEl(this.el),this.el=this.$el[0]);if(!this.$el||this.$el.length===0){if(this.getOption("allowMissingEl"))return!1;throw new s.Error('An "el" '+this.$el.selector+" must exist in DOM")}return!0},_ensureViewIsIntact:function(e){if(!e)throw new s.Error({name:"ViewNotValid",message:"The view passed is undefined and therefore invalid. You must pass a view instance to show."});if(e.isDestroyed)throw new s.Error({name:"ViewDestroyedError",message:'View (cid: "'+e.cid+'") has already been destroyed and cannot be used.'})},getEl:function(e){return t.$(e,s._getValue(this.options.parentEl,this))},attachHtml:function(e){this.$el.contents().detach(),this.el.appendChild(e.el)},empty:function(e){var t=this.currentView,n=s._getValue(e,"preventDestroy",this);if(!t)return;return t.off("destroy",this.empty,this),this.triggerMethod("before:empty",t),n||this._destroyView(),this.triggerMethod("empty",t),delete this.currentView,n&&this.$el.contents().detach(),this},_destroyView:function(){var e=this.currentView;e.destroy&&!e.isDestroyed?e.destroy():e.remove&&(e.remove(),e.isDestroyed=!0)},attachView:function(e){return this.currentView=e,this},hasView:function(){return!!this.currentView},reset:function(){return this.empty(),this.$el&&(this.el=this.$el.selector),delete this.$el,this}},{buildRegion:function(e,t){if(n.isString(e))return this._buildRegionFromSelector(e,t);if(e.selector||e.el||e.regionClass)return this._buildRegionFromObject(e,t);if(n.isFunction(e))return this._buildRegionFromRegionClass(e);throw new s.Error({message:"Improper region configuration type.",url:"marionette.region.html#region-configuration-types"})},_buildRegionFromSelector:function(e,t){return new t({el:e})},_buildRegionFromObject:function(e,t){var r=e.regionClass||t,i=n.omit(e,"selector","regionClass");return e.selector&&!i.el&&(i.el=e.selector),new r(i)},_buildRegionFromRegionClass:function(e){return new e}}),s.RegionManager=s.Controller.extend({constructor:function(e){this._regions={},this.length=0,s.Controller.call(this,e),this.addRegions(this.getOption("regions"))},addRegions:function(e,t){return e=s._getValue(e,this,arguments),n.reduce(e,function(e,r,i){return n.isString(r)&&(r={selector:r}),r.selector&&(r=n.defaults({},r,t)),e[i]=this.addRegion(i,r),e},{},this)},addRegion:function(e,t){var n;return t instanceof s.Region?n=t:n=s.Region.buildRegion(t,s.Region),this.triggerMethod("before:add:region",e,n),n._parent=this,this._store(e,n),this.triggerMethod("add:region",e,n),n},get:function(e){return this._regions[e]},getRegions:function(){return n.clone(this._regions)},removeRegion:function(e){var t=this._regions[e];return this._remove(e,t),t},removeRegions:function(){var e=this.getRegions();return n.each(this._regions,function(e,t){this._remove(t,e)},this),e},emptyRegions:function(){var e=this.getRegions();return n.invoke(e,"empty"),e},destroy:function(){return this.removeRegions(),s.Controller.prototype.destroy.apply(this,arguments)},_store:function(e,t){this._regions[e]||this.length++,this._regions[e]=t},_remove:function(e,t){this.triggerMethod("before:remove:region",e,t),t.empty(),t.stopListening(),delete t._parent,delete this._regions[e],this.length--,this.triggerMethod("remove:region",e,t)}}),s.actAsCollection(s.RegionManager.prototype,"_regions"),s.TemplateCache=function(e){this.templateId=e},n.extend(s.TemplateCache,{templateCaches:{},get:function(e,t){var n=this.templateCaches[e];return n||(n=new s.TemplateCache(e),this.templateCaches[e]=n),n.load(t)},clear:function(){var e,t=n.toArray(arguments),r=t.length;if(r>0)for(e=0;e<r;e++)delete this.templateCaches[t[e]];else this.templateCaches={}}}),n.extend(s.TemplateCache.prototype,{load:function(e){if(this.compiledTemplate)return this.compiledTemplate;var t=this.loadTemplate(this.templateId,e);return this.compiledTemplate=this.compileTemplate(t,e),this.compiledTemplate},loadTemplate:function(e,n){var r=t.$(e).html();if(!r||r.length===0)throw new s.Error({name:"NoTemplateError",message:'Could not find template: "'+e+'"'});return r},compileTemplate:function(e,t){return n.template(e,t)}}),s.Renderer={render:function(e,t){if(!e)throw new s.Error({name:"TemplateNotFoundError",message:"Cannot render the template since its false, null or undefined."});var r=n.isFunction(e)?e:s.TemplateCache.get(e);return r(t)}},s.View=t.View.extend({isDestroyed:!1,constructor:function(e){n.bindAll(this,"render"),e=s._getValue(e,this),this.options=n.extend({},n.result(this,"options"),e),this._behaviors=s.Behaviors(this),t.View.call(this,this.options),s.MonitorDOMRefresh(this)},getTemplate:function(){return this.getOption("template")},serializeModel:function(e){return e.toJSON.apply(e,n.rest(arguments))},mixinTemplateHelpers:function(e){e=e||{};var t=this.getOption("templateHelpers");return t=s._getValue(t,this),n.extend(e,t)},normalizeUIKeys:function(e){var t=n.result(this,"_uiBindings");return s.normalizeUIKeys(e,t||n.result(this,"ui"))},normalizeUIValues:function(e,t){var r=n.result(this,"ui"),i=n.result(this,"_uiBindings");return s.normalizeUIValues(e,i||r,t)},configureTriggers:function(){if(!this.triggers)return;var e=this.normalizeUIKeys(n.result(this,"triggers"));return n.reduce(e,function(e,t,n){return e[n]=this._buildViewTrigger(t),e},{},this)},delegateEvents:function(e){return this._delegateDOMEvents(e),this.bindEntityEvents(this.model,this.getOption("modelEvents")),this.bindEntityEvents(this.collection,this.getOption("collectionEvents")),n.each(this._behaviors,function(e){e.bindEntityEvents(this.model,e.getOption("modelEvents")),e.bindEntityEvents(this.collection,e.getOption("collectionEvents"))},this),this},_delegateDOMEvents:function(e){var r=s._getValue(e||this.events,this);r=this.normalizeUIKeys(r),n.isUndefined(e)&&(this.events=r);var i={},o=n.result(this,"behaviorEvents")||{},u=this.configureTriggers(),a=n.result(this,"behaviorTriggers")||{};n.extend(i,o,r,u,a),t.View.prototype.delegateEvents.call(this,i)},undelegateEvents:function(){return t.View.prototype.undelegateEvents.apply(this,arguments),this.unbindEntityEvents(this.model,this.getOption("modelEvents")),this.unbindEntityEvents(this.collection,this.getOption("collectionEvents")),n.each(this._behaviors,function(e){e.unbindEntityEvents(this.model,e.getOption("modelEvents")),e.unbindEntityEvents(this.collection,e.getOption("collectionEvents"))},this),this},_ensureViewIsIntact:function(){if(this.isDestroyed)throw new s.Error({name:"ViewDestroyedError",message:'View (cid: "'+this.cid+'") has already been destroyed and cannot be used.'})},destroy:function(){if(this.isDestroyed)return this;var e=n.toArray(arguments);return this.triggerMethod.apply(this,["before:destroy"].concat(e)),this.isDestroyed=!0,this.triggerMethod.apply(this,["destroy"].concat(e)),this.unbindUIElements(),this.isRendered=!1,this.remove(),n.invoke(this._behaviors,"destroy",e),this},bindUIElements:function(){this._bindUIElements(),n.invoke(this._behaviors,this._bindUIElements)},_bindUIElements:function(){if(!this.ui)return;this._uiBindings||(this._uiBindings=this.ui);var e=n.result(this,"_uiBindings");this.ui={},n.each(e,function(e,t){this.ui[t]=this.$(e)},this)},unbindUIElements:function(){this._unbindUIElements(),n.invoke(this._behaviors,this._unbindUIElements)},_unbindUIElements:function(){if(!this.ui||!this._uiBindings)return;n.each(this.ui,function(e,t){delete this.ui[t]},this),this.ui=this._uiBindings,delete this._uiBindings},_buildViewTrigger:function(e){var t=n.isObject(e),r=n.defaults({},t?e:{},{preventDefault:!0,stopPropagation:!0}),i=t?r.event:e;return function(e){e&&(e.preventDefault&&r.preventDefault&&e.preventDefault(),e.stopPropagation&&r.stopPropagation&&e.stopPropagation());var t={view:this,model:this.model,collection:this.collection};this.triggerMethod(i,t)}},setElement:function(){var e=t.View.prototype.setElement.apply(this,arguments);return n.invoke(this._behaviors,"proxyViewProperties",this),e},triggerMethod:function(){var e=s._triggerMethod(this,arguments);return this._triggerEventOnBehaviors(arguments),this._triggerEventOnParentLayout(arguments[0],n.rest(arguments)),e},_triggerEventOnBehaviors:function(e){var t=s._triggerMethod,n=this._behaviors;for(var r=0,i=n&&n.length;r<i;r++)t(n[r],e)},_triggerEventOnParentLayout:function(e,t){var r=this._parentLayoutView();if(!r)return;var i=s.getOption(r,"childViewEventPrefix"),o=i+":"+e;s._triggerMethod(r,[o,this].concat(t));var u=s.getOption(r,"childEvents"),a=r.normalizeMethods(u);!!a&&n.isFunction(a[e])&&a[e].apply(r,[this].concat(t))},_getImmediateChildren:function(){return[]},_getNestedViews:function(){var e=this._getImmediateChildren();return e.length?n.reduce(e,function(e,t){return t._getNestedViews?e.concat(t._getNestedViews()):e},e):e},_getAncestors:function(){var e=[],t=this._parent;while(t)e.push(t),t=t._parent;return e},_parentLayoutView:function(){var e=this._getAncestors();return n.find(e,function(e){return e instanceof s.LayoutView})},normalizeMethods:s.normalizeMethods,mergeOptions:s.mergeOptions,getOption:s.proxyGetOption,bindEntityEvents:s.proxyBindEntityEvents,unbindEntityEvents:s.proxyUnbindEntityEvents}),s.ItemView=s.View.extend({constructor:function(){s.View.apply(this,arguments)},serializeData:function(){if(!this.model&&!this.collection)return{};var e=[this.model||this.collection];return arguments.length&&e.push.apply(e,arguments),this.model?this.serializeModel.apply(this,e):{items:this.serializeCollection.apply(this,e)}},serializeCollection:function(e){return e.toJSON.apply(e,n.rest(arguments))},render:function(){return this._ensureViewIsIntact(),this.triggerMethod("before:render",this),this._renderTemplate(),this.isRendered=!0,this.bindUIElements(),this.triggerMethod("render",this),this},_renderTemplate:function(){var e=this.getTemplate();if(e===!1)return;if(!e)throw new s.Error({name:"UndefinedTemplateError",message:"Cannot render the template since it is null or undefined."});var t=this.mixinTemplateHelpers(this.serializeData()),n=s.Renderer.render(e,t,this);return this.attachElContent(n),this},attachElContent:function(e){return this.$el.html(e),this}}),s.CollectionView=s.View.extend({childViewEventPrefix:"childview",sort:!0,constructor:function(e){this.once("render",this._initialEvents),this._initChildViewStorage(),s.View.apply(this,arguments),this.on({"before:show":this._onBeforeShowCalled,show:this._onShowCalled,"before:attach":this._onBeforeAttachCalled,attach:this._onAttachCalled}),this.initRenderBuffer()},initRenderBuffer:function(){this._bufferedChildren=[]},startBuffering:function(){this.initRenderBuffer(),this.isBuffering=!0},endBuffering:function(){var e=this._isShown&&s.isNodeAttached(this.el),t;this.isBuffering=!1,this._isShown&&this._triggerMethodMany(this._bufferedChildren,this,"before:show"),e&&this._triggerBeforeAttach&&(t=this._getNestedViews(),this._triggerMethodMany(t,this,"before:attach")),this.attachBuffer(this,this._createBuffer()),e&&this._triggerAttach&&(t=this._getNestedViews(),this._triggerMethodMany(t,this,"attach")),this._isShown&&this._triggerMethodMany(this._bufferedChildren,this,"show"),this.initRenderBuffer()},_triggerMethodMany:function(e,t,r){var i=n.drop(arguments,3);n.each(e,function(e){s.triggerMethodOn.apply(e,[e,r,e,t].concat(i))})},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this._onCollectionAdd),this.listenTo(this.collection,"remove",this._onCollectionRemove),this.listenTo(this.collection,"reset",this.render),this.getOption("sort")&&this.listenTo(this.collection,"sort",this._sortViews))},_onCollectionAdd:function(e,t,r){var i;r.at!==undefined?i=r.at:i=n.indexOf(this._filteredSortedModels(),e);if(this._shouldAddChild(e,i)){this.destroyEmptyView();var s=this.getChildView(e);this.addChild(e,s,i)}},_onCollectionRemove:function(e){var t=this.children.findByModel(e);this.removeChildView(t),this.checkEmpty()},_onBeforeShowCalled:function(){this._triggerBeforeAttach=this._triggerAttach=!1,this.children.each(function(e){s.triggerMethodOn(e,"before:show",e)})},_onShowCalled:function(){this.children.each(function(e){s.triggerMethodOn(e,"show",e)})},_onBeforeAttachCalled:function(){this._triggerBeforeAttach=!0},_onAttachCalled:function(){this._triggerAttach=!0},render:function(){return this._ensureViewIsIntact(),this.triggerMethod("before:render",this),this._renderChildren(),this.isRendered=!0,this.triggerMethod("render",this),this},reorder:function(){var e=this.children,t=this._filteredSortedModels(),r=n.find(t,function(t){return!e.findByModel(t)});if(r)this.render();else{var i=n.map(t,function(t,n){var r=e.findByModel(t);return r._index=n,r.el});this.triggerMethod("before:reorder"),this._appendReorderedChildren(i),this.triggerMethod("reorder")}},resortView:function(){s.getOption(this,"reorderOnSort")?this.reorder():this.render()},_sortViews:function(){var e=this._filteredSortedModels(),t=n.find(e,function(e,t){var n=this.children.findByModel(e);return!n||n._index!==t},this);t&&this.resortView()},_emptyViewIndex:-1,_appendReorderedChildren:function(e){this.$el.append(e)},_renderChildren:function(){this.destroyEmptyView(),this.destroyChildren({checkEmpty:!1}),this.isEmpty(this.collection)?this.showEmptyView():(this.triggerMethod("before:render:collection",this),this.startBuffering(),this.showCollection(),this.endBuffering(),this.triggerMethod("render:collection",this),this.children.isEmpty()&&this.showEmptyView())},showCollection:function(){var e,t=this._filteredSortedModels();n.each(t,function(t,n){e=this.getChildView(t),this.addChild(t,e,n)},this)},_filteredSortedModels:function(){var e,t=this.getViewComparator();return t?n.isString(t)||t.length===1?e=this.collection.sortBy(t,this):e=n.clone(this.collection.models).sort(n.bind(t,this)):e=this.collection.models,this.getOption("filter")&&(e=n.filter(e,function(e,t){return this._shouldAddChild(e,t)},this)),e},showEmptyView:function(){var e=this.getEmptyView();if(e&&!this._showingEmptyView){this.triggerMethod("before:render:empty"),this._showingEmptyView=!0;var n=new t.Model;this.addEmptyView(n,e),this.triggerMethod("render:empty")}},destroyEmptyView:function(){this._showingEmptyView&&(this.triggerMethod("before:remove:empty"),this.destroyChildren(),delete this._showingEmptyView,this.triggerMethod("remove:empty"))},getEmptyView:function(){return this.getOption("emptyView")},addEmptyView:function(e,t){var r=this._isShown&&!this.isBuffering&&s.isNodeAttached(this.el),i,o=this.getOption("emptyViewOptions")||this.getOption("childViewOptions");n.isFunction(o)&&(o=o.call(this,e,this._emptyViewIndex));var u=this.buildChildView(e,t,o);u._parent=this,this.proxyChildEvents(u),this._isShown&&s.triggerMethodOn(u,"before:show",u),this.children.add(u),r&&this._triggerBeforeAttach&&(i=[u].concat(u._getNestedViews()),u.once("render",function(){this._triggerMethodMany(i,this,"before:attach")},this)),this.renderChildView(u,this._emptyViewIndex),r&&this._triggerAttach&&(i=[u].concat(u._getNestedViews()),this._triggerMethodMany(i,this,"attach")),this._isShown&&s.triggerMethodOn(u,"show",u)},getChildView:function(e){var t=this.getOption("childView");if(!t)throw new s.Error({name:"NoChildViewError",message:'A "childView" must be specified'});return t},addChild:function(e,t,n){var r=this.getOption("childViewOptions");r=s._getValue(r,this,[e,n]);var i=this.buildChildView(e,t,r);return this._updateIndices(i,!0,n),this.triggerMethod("before:add:child",i),this._addChildView(i,n),this.triggerMethod("add:child",i),i._parent=this,i},_updateIndices:function(e,t,n){if(!this.getOption("sort"))return;t&&(e._index=n),this.children.each(function(n){n._index>=e._index&&(n._index+=t?1:-1)})},_addChildView:function(e,t){var n=this._isShown&&!this.isBuffering&&s.isNodeAttached(this.el),r;this.proxyChildEvents(e),this._isShown&&!this.isBuffering&&s.triggerMethodOn(e,"before:show",e),this.children.add(e),n&&this._triggerBeforeAttach&&(r=[e].concat(e._getNestedViews()),e.once("render",function(){this._triggerMethodMany(r,this,"before:attach")},this)),this.renderChildView(e,t),n&&this._triggerAttach&&(r=[e].concat(e._getNestedViews()),this._triggerMethodMany(r,this,"attach")),this._isShown&&!this.isBuffering&&s.triggerMethodOn(e,"show",e)},renderChildView:function(e,t){return e.render(),this.attachHtml(this,e,t),e},buildChildView:function(e,t,r){var i=n.extend({model:e},r);return new t(i)},removeChildView:function(e){return e&&(this.triggerMethod("before:remove:child",e),e.destroy?e.destroy():e.remove&&e.remove(),delete e._parent,this.stopListening(e),this.children.remove(e),this.triggerMethod("remove:child",e),this._updateIndices(e,!1)),e},isEmpty:function(){return!this.collection||this.collection.length===0},checkEmpty:function(){this.isEmpty(this.collection)&&this.showEmptyView()},attachBuffer:function(e,t){e.$el.append(t)},_createBuffer:function(){var e=document.createDocumentFragment();return n.each(this._bufferedChildren,function(t){e.appendChild(t.el)}),e},attachHtml:function(e,t,n){e.isBuffering?e._bufferedChildren.splice(n,0,t):e._insertBefore(t,n)||e._insertAfter(t)},_insertBefore:function(e,t){var n,r=this.getOption("sort")&&t<this.children.length-1;return r&&(n=this.children.find(function(e){return e._index===t+1})),n?(n.$el.before(e.el),!0):!1},_insertAfter:function(e){this.$el.append(e.el)},_initChildViewStorage:function(){this.children=new t.ChildViewContainer},destroy:function(){return this.isDestroyed?this:(this.triggerMethod("before:destroy:collection"),this.destroyChildren({checkEmpty:!1}),this.triggerMethod("destroy:collection"),s.View.prototype.destroy.apply(this,arguments))},destroyChildren:function(e){var t=e||{},r=!0,i=this.children.map(n.identity);return n.isUndefined(t.checkEmpty)||(r=t.checkEmpty),this.children.each(this.removeChildView,this),r&&this.checkEmpty(),i},_shouldAddChild:function(e,t){var r=this.getOption("filter");return!n.isFunction(r)||r.call(this,e,t,this.collection)},proxyChildEvents:function(e){var t=this.getOption("childViewEventPrefix");this.listenTo(e,"all",function(){var r=n.toArray(arguments),i=r[0],s=this.normalizeMethods(n.result(this,"childEvents"));r[0]=t+":"+i,r.splice(1,0,e),typeof s!="undefined"&&n.isFunction(s[i])&&s[i].apply(this,r.slice(1)),this.triggerMethod.apply(this,r)})},_getImmediateChildren:function(){return n.values(this.children._views)},getViewComparator:function(){return this.getOption("viewComparator")}}),s.CompositeView=s.CollectionView.extend({constructor:function(){s.CollectionView.apply(this,arguments)},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this._onCollectionAdd),this.listenTo(this.collection,"remove",this._onCollectionRemove),this.listenTo(this.collection,"reset",this._renderChildren),this.getOption("sort")&&this.listenTo(this.collection,"sort",this._sortViews))},getChildView:function(e){var t=this.getOption("childView")||this.constructor;return t},serializeData:function(){var e={};return this.model&&(e=n.partial(this.serializeModel,this.model).apply(this,arguments)),e},render:function(){return this._ensureViewIsIntact(),this._isRendering=!0,this.resetChildViewContainer(),this.triggerMethod("before:render",this),this._renderTemplate(),this._renderChildren(),this._isRendering=!1,this.isRendered=!0,this.triggerMethod("render",this),this},_renderChildren:function(){(this.isRendered||this._isRendering)&&s.CollectionView.prototype._renderChildren.call(this)},_renderTemplate:function(){var e={};e=this.serializeData(),e=this.mixinTemplateHelpers(e),this.triggerMethod("before:render:template");var t=this.getTemplate(),n=s.Renderer.render(t,e,this);this.attachElContent(n),this.bindUIElements(),this.triggerMethod("render:template")},attachElContent:function(e){return this.$el.html(e),this},attachBuffer:function(e,t){var n=this.getChildViewContainer(e);n.append(t)},_insertAfter:function(e){var t=this.getChildViewContainer(this,e);t.append(e.el)},_appendReorderedChildren:function(e){var t=this.getChildViewContainer(this);t.append(e)},getChildViewContainer:function(e,t){if(!e.$childViewContainer){var n,r=s.getOption(e,"childViewContainer");if(r){var i=s._getValue(r,e);i.charAt(0)==="@"&&e.ui?n=e.ui[i.substr(4)]:n=e.$(i);if(n.length<=0)throw new s.Error({name:"ChildViewContainerMissingError",message:'The specified "childViewContainer" was not found: '+e.childViewContainer})}else n=e.$el;return e.$childViewContainer=n,n}return e.$childViewContainer},resetChildViewContainer:function(){this.$childViewContainer&&(this.$childViewContainer=undefined)}}),s.LayoutView=s.ItemView.extend({regionClass:s.Region,options:{destroyImmediate:!1},childViewEventPrefix:"childview",constructor:function(e){e=e||{},this._firstRender=!0,this._initializeRegions(e),s.ItemView.call(this,e)},render:function(){return this._ensureViewIsIntact(),this._firstRender?this._firstRender=!1:this._reInitializeRegions(),s.ItemView.prototype.render.apply(this,arguments)},destroy:function(){return this.isDestroyed?this:(this.getOption("destroyImmediate")===!0&&this.$el.remove(),this.regionManager.destroy(),s.ItemView.prototype.destroy.apply(this,arguments))},showChildView:function(e,t){return this.getRegion(e).show(t)},getChildView:function(e){return this.getRegion(e).currentView},addRegion:function(e,t){var n={};return n[e]=t,this._buildRegions(n)[e]},addRegions:function(e){return this.regions=n.extend({},this.regions,e),this._buildRegions(e)},removeRegion:function(e){return delete this.regions[e],this.regionManager.removeRegion(e)},getRegion:function(e){return this.regionManager.get(e)},getRegions:function(){return this.regionManager.getRegions()},_buildRegions:function(e){var t={regionClass:this.getOption("regionClass"),parentEl:n.partial(n.result,this,"el")};return this.regionManager.addRegions(e,t)},_initializeRegions:function(e){var t;this._initRegionManager(),t=s._getValue(this.regions,this,[e])||{};var r=this.getOption.call(e,"regions");r=s._getValue(r,this,[e]),n.extend(t,r),t=this.normalizeUIValues(t,["selector","el"]),this.addRegions(t)},_reInitializeRegions:function(){this.regionManager.invoke("reset")},getRegionManager:function(){return new s.RegionManager},_initRegionManager:function(){this.regionManager=this.getRegionManager(),this.regionManager._parent=this,this.listenTo(this.regionManager,"before:add:region",function(e){this.triggerMethod("before:add:region",e)}),this.listenTo(this.regionManager,"add:region",function(e,t){this[e]=t,this.triggerMethod("add:region",e,t)}),this.listenTo(this.regionManager,"before:remove:region",function(e){this.triggerMethod("before:remove:region",e)}),this.listenTo(this.regionManager,"remove:region",function(e,t){delete this[e],this.triggerMethod("remove:region",e,t)})},_getImmediateChildren:function(){return n.chain(this.regionManager.getRegions()).pluck("currentView").compact().value()}}),s.Behavior=s.Object.extend({constructor:function(e,t){this.view=t,this.defaults=n.result(this,"defaults")||{},this.options=n.extend({},this.defaults,e),this.ui=n.extend({},n.result(t,"ui"),n.result(this,"ui")),s.Object.apply(this,arguments)},$:function(){return this.view.$.apply(this.view,arguments)},destroy:function(){return this.stopListening(),this},proxyViewProperties:function(e){this.$el=e.$el,this.el=e.el}}),s.Behaviors=function(e,t){function r(e,n){return t.isObject(e.behaviors)?(n=r.parseBehaviors(e,n||t.result(e,"behaviors")),r.wrap(e,n,t.keys(i)),n):{}}function s(e,t){this._view=e,this._behaviors=t,this._triggers={}}function o(e){return e._uiBindings||e.ui}var n=/^(\S+)\s*(.*)$/,i={behaviorTriggers:function(e,t){var n=new s(this,t);return n.buildBehaviorTriggers()},behaviorEvents:function(r,i){var s={};return t.each(i,function(r,i){var u={},a=t.clone(t.result(r,"events"))||{};a=e.normalizeUIKeys(a,o(r));var f=0;t.each(a,function(e,s){var o=s.match(n),a=o[1]+"."+[this.cid,i,f++," "].join(""),l=o[2],c=a+l,h=t.isFunction(e)?e:r[e];u[c]=t.bind(h,r)},this),s=t.extend(s,u)},this),s}};return t.extend(r,{behaviorsLookup:function(){throw new e.Error({message:"You must define where your behaviors are stored.",url:"marionette.behaviors.html#behaviorslookup"})},getBehaviorClass:function(t,n){return t.behaviorClass?t.behaviorClass:e._getValue(r.behaviorsLookup,this,[t,n])[n]},parseBehaviors:function(e,n){return t.chain(n).map(function(n,i){var s=r.getBehaviorClass(n,i),o=new s(n,e),u=r.parseBehaviors(e,t.result(o,"behaviors"));return[o].concat(u)}).flatten().value()},wrap:function(e,n,r){t.each(r,function(r){e[r]=t.partial(i[r],e[r],n)})}}),t.extend(s.prototype,{buildBehaviorTriggers:function(){return t.each(this._behaviors,this._buildTriggerHandlersForBehavior,this),this._triggers},_buildTriggerHandlersForBehavior:function(n,r){var i=t.clone(t.result(n,"triggers"))||{};i=e.normalizeUIKeys(i,o(n)),t.each(i,t.bind(this._setHandlerForBehavior,this,n,r))},_setHandlerForBehavior:function(e,t,n,r){var i=r.replace(/^\S+/,function(e){return e+"."+"behaviortriggers"+t});this._triggers[i]=this._view._buildViewTrigger(n)}}),r}(s,n),s.AppRouter=t.Router.extend({constructor:function(e){this.options=e||{},t.Router.apply(this,arguments);var n=this.getOption("appRoutes"),r=this._getController();this.processAppRoutes(r,n),this.on("route",this._processOnRoute,this)},appRoute:function(e,t){var n=this._getController();this._addAppRoute(n,e,t)},_processOnRoute:function(e,t){if(n.isFunction(this.onRoute)){var r=n.invert(this.getOption("appRoutes"))[e];this.onRoute(e,r,t)}},processAppRoutes:function(e,t){if(!t)return;var r=n.keys(t).reverse();n.each(r,function(n){this._addAppRoute(e,n,t[n])},this)},_getController:function(){return this.getOption("controller")},_addAppRoute:function(e,t,r){var i=e[r];if(!i)throw new s.Error('Method "'+r+'" was not found on the controller');this.route(t,r,n.bind(i,e))},mergeOptions:s.mergeOptions,getOption:s.proxyGetOption,triggerMethod:s.triggerMethod,bindEntityEvents:s.proxyBindEntityEvents,unbindEntityEvents:s.proxyUnbindEntityEvents}),s.Application=s.Object.extend({constructor:function(e){this._initializeRegions(e),this._initCallbacks=new s.Callbacks,this.submodules={},n.extend(this,e),this._initChannel(),s.Object.call(this,e)},execute:function(){this.commands.execute.apply(this.commands,arguments)},request:function(){return this.reqres.request.apply(this.reqres,arguments)},addInitializer:function(e){this._initCallbacks.add(e)},start:function(e){this.triggerMethod("before:start",e),this._initCallbacks.run(e,this),this.triggerMethod("start",e)},addRegions:function(e){return this._regionManager.addRegions(e)},emptyRegions:function(){return this._regionManager.emptyRegions()},removeRegion:function(e){return this._regionManager.removeRegion(e)},getRegion:function(e){return this._regionManager.get(e)},getRegions:function(){return this._regionManager.getRegions()},module:function(e,t){var r=s.Module.getClass(t),i=n.toArray(arguments);return i.unshift(this),r.create.apply(r,i)},getRegionManager:function(){return new s.RegionManager},_initializeRegions:function(e){var t=n.isFunction(this.regions)?this.regions(e):this.regions||{};this._initRegionManager();var r=s.getOption(e,"regions");return n.isFunction(r)&&(r=r.call(this,e)),n.extend(t,r),this.addRegions(t),this},_initRegionManager:function(){this._regionManager=this.getRegionManager(),this._regionManager._parent=this,this.listenTo(this._regionManager,"before:add:region",function(){s._triggerMethod(this,"before:add:region",arguments)}),this.listenTo(this._regionManager,"add:region",function(e,t){this[e]=t,s._triggerMethod(this,"add:region",arguments)}),this.listenTo(this._regionManager,"before:remove:region",function(){s._triggerMethod(this,"before:remove:region",arguments)}),this.listenTo(this._regionManager,"remove:region",function(e){delete this[e],s._triggerMethod(this,"remove:region",arguments)})},_initChannel:function(){this.channelName=n.result(this,"channelName")||"global",this.channel=n.result(this,"channel")||t.Wreqr.radio.channel(this.channelName),this.vent=n.result(this,"vent")||this.channel.vent,this.commands=n.result(this,"commands")||this.channel.commands,this.reqres=n.result(this,"reqres")||this.channel.reqres}}),s.Module=function(e,t,r){this.moduleName=e,this.options=n.extend({},this.options,r),this.initialize=r.initialize||this.initialize,this.submodules={},this._setupInitializersAndFinalizers(),this.app=t,n.isFunction(this.initialize)&&this.initialize(e,t,this.options)},s.Module.extend=s.extend,n.extend(s.Module.prototype,t.Events,{startWithParent:!0,initialize:function(){},addInitializer:function(e){this._initializerCallbacks.add(e)},addFinalizer:function(e){this._finalizerCallbacks.add(e)},start:function(e){if(this._isInitialized)return;n.each(this.submodules,function(t){t.startWithParent&&t.start(e)}),this.triggerMethod("before:start",e),this._initializerCallbacks.run(e,this),this._isInitialized=!0,this.triggerMethod("start",e)},stop:function(){if(!this._isInitialized)return;this._isInitialized=!1,this.triggerMethod("before:stop"),n.invoke(this.submodules,"stop"),this._finalizerCallbacks.run(undefined,this),this._initializerCallbacks.reset(),this._finalizerCallbacks.reset(),this.triggerMethod("stop")},addDefinition:function(e,t){this._runModuleDefinition(e,t)},_runModuleDefinition:function(e,r){if(!e)return;var i=n.flatten([this,this.app,t,s,t.$,n,r]);e.apply(this,i)},_setupInitializersAndFinalizers:function(){this._initializerCallbacks=new s.Callbacks,this._finalizerCallbacks=new s.Callbacks},triggerMethod:s.triggerMethod}),n.extend(s.Module,{create:function(e,t,r){var i=e,s=n.drop(arguments,3);t=t.split(".");var o=t.length,u=[];return u[o-1]=r,n.each(t,function(t,n){var o=i;i=this._getModule(o,t,e,r),this._addModuleDefinition(o,i,u[n],s)},this),i},_getModule:function(e,t,r,i,s){var o=n.extend({},i),u=this.getClass(i),a=e[t];return a||(a=new u(t,r,o),e[t]=a,e.submodules[t]=a),a},getClass:function(e){var t=s.Module;return e?e.prototype instanceof t?e:e.moduleClass||t:t},_addModuleDefinition:function(e,t,n,r){var i=this._getDefine(n),s=this._getStartWithParent(n,t);i&&t.addDefinition(i,r),this._addStartWithParent(e,t,s)},_getStartWithParent:function(e,t){var r;return n.isFunction(e)&&e.prototype instanceof s.Module?(r=t.constructor.prototype.startWithParent,n.isUndefined(r)?!0:r):n.isObject(e)?(r=e.startWithParent,n.isUndefined(r)?!0:r):!0},_getDefine:function(e){return!n.isFunction(e)||e.prototype instanceof s.Module?n.isObject(e)?e.define:null:e},_addStartWithParent:function(e,t,n){t.startWithParent=t.startWithParent&&n;if(!t.startWithParent||!!t.startWithParentIsConfigured)return;t.startWithParentIsConfigured=!0,e.addInitializer(function(e){t.startWithParent&&t.start(e)})}}),s}),define("lib/extensions",["app","backbone"],function(e,t){"function"!=typeof String.prototype.endsWith&&(String.prototype.endsWith=function(e){return this.indexOf(e,this.length-e.length)!==-1}),"function"!=typeof String.prototype.trim&&(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/gim,"")}),"function"!=typeof String.prototype.capitalize&&(String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1)}),"function"!=typeof String.prototype.pluralize&&(String.prototype.pluralize=function(){return this.endsWith("a")||this.endsWith("s")?this:this+"s"}),"function"!=typeof String.prototype.singularize&&(String.prototype.singularize=function(){return this=="Media"?"Medium":this=="News"?this:this.replace(/s+$/gi,"")}),"function"!=typeof String.prototype.strip_tags&&(String.prototype.strip_tags=function(){return this.replace(/<\/?[a-z0-9]+([^>]+?)>/gim,"")}),function(e){($.browser=$.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))}(navigator.userAgent||navigator.vendor||window.opera),$.browser.mobile!==CakePHPisMobile&&CakePHPisMobile&&($.browser.mobile=CakePHPisMobile),$.fn.extend({dropdownMenu:function(){return this.each(function(){var t,n=this,r=$(this),i=r.parent().find("a");$.browser.mobile?(i.on("touchend",function(t){var i=$(t.currentTarget);i.is(".js-submenu-trigger")&&(t.preventDefault(),r.is(":hidden")?(r.slideDown(100),e.trigger("app:submenu",n)):r.slideUp(100))}),e.on("app:submenu",function(e){n!==e&&r.slideUp(100)})):(r.parent().hover(function(){r.css({"z-index":2e3}),clearTimeout(t),t=setTimeout(function(){r.slideDown(100)},200)},function(){r.css({"z-index":"inherit"}),clearTimeout(t),t=setTimeout(function(){r.slideUp(100)},400)}),r.on("click",function(){r.slideUp(100)})),e.on("app:escape",function(){r.hide()})})},getCursorPosition:function(){var e=this[0],t=0;if("selectionStart"in e)t=e.selectionStart;else if("selection"in document){e.focus();var n=document.selection.createRange(),r=document.selection.createRange().text.length;n.moveStart("character",-e.value.length),t=n.text.length-r}return t},setCursorPosition:function(e){var t=this[0];if("setSelectionRange"in t)t.setSelectionRange(e,e);else if("createTextRange"in document){t.focus();var n=t.createTextRange();n.collapse(!0),n.moveEnd("character",e),n.moveStart("character",e),n.select()}return!1}});var n=$(".popup:not(.cookie-nag)");n.length>0&&n.each(function(){var e=$(this),t=e.text().length;setTimeout(function(){e.slideUp(function(){$(this).remove()})},t*85)}),"undefined"==typeof t.View.prototype.autoEmbed&&(t.View.prototype.autoEmbed=function(){var t=e.parseVideo(this.model.get("body"));t&&(this.$(".has-video").prepend(t),$(window).on("resize",function(){var e=t.parent().width();t.css({width:e+"px",height:e*9/16+"px"})}),$(window).trigger("resize"))}),"undefined"==typeof t.View.prototype.close&&(t.View.prototype.close=function(e){e&&e.preventDefault&&(e.preventDefault(),e.stopPropagation()),this.remove(),this.unbind(),this.onClose&&this.onClose()}),"undefined"==typeof t.View.prototype.setFollow&&(t.View.prototype.setFollow=function(e){this.model.set("Follow",e)}),"undefined"==typeof t.View.prototype.initFollow&&(t.View.prototype.initFollow=function(){var t=this.model.get("id"),n="follow:set:"+this.object_class+":"+t;this.listenTo(e,n,this.setFollow),this.listenTo(this.model,"change:Follow",this.renderFollow),e.trigger("follow:register",this.model.get("Follow"))}),"undefined"==typeof t.View.prototype.followClicked&&(t.View.prototype.followClicked=function(t){t&&t.preventDefault(),e.CurrentUser.isLoggedIn()&&e.trigger("follow:manage",this.object_class,this.model.get("id"))}),"undefined"==typeof t.View.prototype.renderFollow&&(t.View.prototype.renderFollow=function(){var t="Follow",n="icon-follow",r="button-green",i="button-red",s="icon-unfollow",o="Click to follow this "+this.object_class,u=this.model.get("user_id"),a=e.CurrentUser.get("id");this.followButton||(this.followButton=this.$(".js-follow"));var f=this.model.get("Follow");_.isEmpty(f)?this.model.isOwn()&&this.followClicked():(t="Unfollow",n="icon-unfollow",s="icon-follow green",o="Click to unfollow this "+this.object_class,r="button-red",i="button-green",u===a&&(this.followButton.attr({disabled:"disabled"}),o="You can't unfollow your own stuff",r="button-red",i="button-green")),this.followButton.find("span").eq(0).addClass(n).removeClass(s).siblings(".button-label").text(t),this.followButton.attr({title:o}).removeClass(i).addClass(r)}),"undefined"==typeof t.View.prototype.disableForm&&(t.View.prototype.disableForm=function(t){e.trigger("spinner:on"),this.$el.find(":input").attr({disabled:"disabled"})}),"undefined"==typeof t.View.prototype.enableForm&&(t.View.prototype.enableForm=function(t){e.trigger("spinner:off"),this.$el.find(":input").removeAttr("disabled")}),"undefined"==typeof t.View.prototype.killEvent&&(t.View.prototype.killEvent=function(e){e&&(e.preventDefault(),e.stopPropagation())}),"undefined"==typeof t.View.prototype.loadFromScript&&(t.View.prototype.loadFromScript=function(e){var t,n,r="script[type='application/json']";e?n=e.find(r).eq(0):n=this.$el.find(r).eq(0);if(n.length>0)try{return t=JSON.parse(n.html()),t}catch(i){return!1}return!1}),"undefined"==typeof t.View.prototype.unrender&&(t.View.prototype.unrender=function(e){var t=this;this.$el.hide(250,"linear",function(){t.close()})})}),function(e,t){typeof exports=="object"&&typeof require=="function"?module.exports=t(require("backbone")):typeof define=="function"&&define.amd?define("localstorage",["backbone"],function(n){return t(n||e.Backbone)}):t(Backbone)}(this,function(e){function t(){return((1+Math.random())*65536|0).toString(16).substring(1)}function n(){return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}function r(e){return e===Object(e)}function i(e,t){var n=e.length;while(n--)if(e[n]===t)return!0;return!1}function s(e,t){for(var n in t)e[n]=t[n];return e}function o(e,t){if(e==null)return void 0;var n=e[t];return typeof n=="function"?e[t]():n}return e.LocalStorage=window.Store=function(e,t){if(!this.localStorage)throw"Backbone.localStorage: Environment does not support localStorage.";this.name=e,this.serializer=t||{serialize:function(e){return r(e)?JSON.stringify(e):e},deserialize:function(e){return e&&JSON.parse(e)}};var n=this.localStorage().getItem(this.name);this.records=n&&n.split(",")||[]},s(e.LocalStorage.prototype,{save:function(){this.localStorage().setItem(this.name,this.records.join(","))},create:function(e){return!e.id&&e.id!==0&&(e.id=n(),e.set(e.idAttribute,e.id)),this.localStorage().setItem(this._itemName(e.id),this.serializer.serialize(e)),this.records.push(e.id.toString()),this.save(),this.find(e)},update:function(e){this.localStorage().setItem(this._itemName(e.id),this.serializer.serialize(e));var t=e.id.toString();return i(this.records,t)||(this.records.push(t),this.save()),this.find(e)},find:function(e){return this.serializer.deserialize(this.localStorage().getItem(this._itemName(e.id)))},findAll:function(){var e=[];for(var t=0,n,r;t<this.records.length;t++)n=this.records[t],r=this.serializer.deserialize(this.localStorage().getItem(this._itemName(n))),r!=null&&e.push(r);return e},destroy:function(e){this.localStorage().removeItem(this._itemName(e.id));var t=e.id.toString();for(var n=0,r;n<this.records.length;n++)this.records[n]===t&&this.records.splice(n,1);return this.save(),e},localStorage:function(){return localStorage},_clear:function(){var e=this.localStorage(),t=new RegExp("^"+this.name+"-");e.removeItem(this.name);for(var n in e)t.test(n)&&e.removeItem(n);this.records.length=0},_storageSize:function(){return this.localStorage().length},_itemName:function(e){return this.name+"-"+e}}),e.LocalStorage.sync=window.Store.sync=e.localSync=function(t,n,r){var i=o(n,"localStorage")||o(n.collection,"localStorage"),s,u,a=e.$?e.$.Deferred&&e.$.Deferred():e.Deferred&&e.Deferred();try{switch(t){case"read":s=n.id!=undefined?i.find(n):i.findAll();break;case"create":s=i.create(n);break;case"update":s=i.update(n);break;case"delete":s=i.destroy(n)}}catch(f){f.code===22&&i._storageSize()===0?u="Private browsing is unsupported":u=f.message}return s?(r&&r.success&&(e.VERSION==="0.9.10"?r.success(n,s,r):r.success(s)),a&&a.resolve(s)):(u=u?u:"Record Not Found",r&&r.error&&(e.VERSION==="0.9.10"?r.error(n,u,r):r.error(u)),a&&a.reject(u)),r&&r.complete&&r.complete(s),a&&a.promise()},e.ajaxSync=e.sync,e.getSyncMethod=function(t,n){var r=n&&n.ajaxSync;return!r&&(o(t,"localStorage")||o(t.collection,"localStorage"))?e.localSync:e.ajaxSync},e.sync=function(t,n,r){return e.getSyncMethod(n,r).apply(this,[t,n,r])},e.LocalStorage}),define("entities/base",["app"],function(e){return e.module("Entities",function(e,t,n){e.BaseModel=n.Model.extend({initialize:function(e){this.listenTo(this,"request",function(){t.trigger("spinner:on")}),this.listenTo(this,"sync error destroy",function(){t.trigger("spinner:off")}),this.listenTo(this,"invalid",function(e,n){t.trigger("app:error",n.join(". "))})},isOwn:function(){return this.get("user_id")===t.CurrentUser.get("id")},getUrlID:function(){return this.id?"/"+this.id:""},cleanErrors:function(e){if(!_.isEmpty(e))for(var t=e.length-1;t>=0;t--)e[t]||e.splice(t,1);return e},validateText:function(e,t,n,r,i){var s;return e?(e=e.replace(/^\s+|\s+$/gi,""),HTML_REGEXP.test(e)?s="The "+t+" contains HTML code, please remove it":EMAIL_REGEXP.test(e)?s="The "+t+" contains an email, please remove it":e.length<n?s="The "+t+" is too short, "+n+" characters minimum":e.length>r?s="The "+t+" is too long, "+r+" characters maximum":i&&(s=this.detectTextAbuse(e,t))):s="Please provide a "+t,s},detectTextAbuse:function(e,t){var n=e.match(/[ !?@#\$%\^&*\.\,]{5,}/gim,"");if(n)return"It looks like you're using filler text in the "+t+", please avoid reapeating a character 5 times or more, "+"and put some more effort in your "+t+". Found repeats: '"+n.join("', '")+"'"},validateTags:function(e){var t;return/\w+(\s+)?,(\s+)?\w+?/gi.test(e)?t=this.validateText(e,"tags",2,1024,!0):t="Please provide at least two tags, separated by commas",t},validateArrayTaxa:function(e,t,n,r){n=n||1,r=r||5;var i;return e?"object"==typeof e?e.length<n?i="Please select at least "+n+" "+t:e.length>r&&(i="Please select a maximum of "+r+" "+t):i="Array taxa came in the wrong format, report this error to the admins":i="Empty categories, Please select at least "+n+" "+t,i},validateIsFanArt:function(e){var t;return"boolean"!=typeof e&&["0","1"].indexOf(e)<0&&(t="You probably should not be sharing this if you don't know whether it's fan art or not."),t},validateLicense:function(e){var t,n=["CC-BY","CC-BY-SA","CC-BY-NC","CC-BY-NC-SA","CC-0"];return n.indexOf(e)<0&&(t="The license "+e+" is not a valid value."),t},validateBlenderVersion:function(e){var n;return e?e<t.MIN_BLENDER_VERSION?(n="The oldest supported Blender release is ",n+=(t.MIN_BLENDER_VERSION/100).toFixed(2)):e>t.MAX_BLENDER_VERSION&&(n="The latest supported Blender release is ",n+=(t.MAX_BLENDER_VERSION/100).toFixed(2)):n="Please select the appropriate Blender version",n},validateThreeDee:function(e){var t,n=/https?:\/\/(www\.)?(p3d|sketchfab)\.(in|com)/gi;return e&&(e.match(n)||(t="The 3D preview service you provided is not supported")),t},validateAllowed:function(e,n){var r;return n=n||["incomplete","pending","tash"],t.CurrentUser.isAdmin()||n.indexOf(e)<0&&(r="Invalid status"),r}}),e.BaseCollection=n.Collection.extend({page:1,model:e.BaseModel,initialize:function(){this.listenTo(this,"request",function(){t.trigger("spinner:on")}),this.listenTo(this,"sync error remove",function(){t.trigger("spinner:off")})},parse:function(e){return e.data?e.data:e},url:function(){return(new this.model).url()+"/index/page:"+this.page}})}),e.Entities}),define("entities/cookie_nag",["app","localstorage","entities/base"],function(e,t){return e.module("Entities",function(e,n,r){e.CookieNagModel=e.BaseModel.extend({defaults:{}}),e.CookiesNagCollection=r.Collection.extend({model:e.CookieNagModel,localStorage:new t("blendswap_cookie_nag"),url:function(){return"/cookies"},parse:function(e){return e.data?e.data:e}}),n.reqres.setHandler("entities:cookies:index",function(t){return new e.CookiesNagCollection([],t)})}),e.Entities}),define("modules/layout/views/app_menu",["app"],function(e){return e.module("LayoutApp.Views",function(e,t,n,r){e.TopMenuView=r.ItemView.extend({el:$(".blendswap-menu").eq(0)})}),e.LayoutApp.Views.TopMenuView}),Function.prototype.bind&&/^object$|^function$/.test(typeof console)&&typeof console.log=="object"&&typeof window.addEventListener=="function"&&(["assert","clear","dir","error","info","log","profile","profileEnd","warn"].forEach(function(e){console[e]=this.call(console[e],console)},Function.prototype.bind),["_exception","count","debug","dirxml","group","groupCollapsed","groupEnd","table","time","timeEnd","timeline","timelineEnd","timeStamp","trace"].forEach(function(e){console[e]=console.log})),function(e,t){typeof module!="undefined"?module.exports=t():typeof define=="function"&&define.amd?define("consolelog",t):window[e]=t()}("log",function(){var t,n=navigator.userAgent,r=function(){var e=/Windows\sNT\s(\d+\.\d+)/;return typeof console!="undefined"&&console.log&&/MSIE\s(\d+)/.test(n)&&e.test(n)&&parseFloat(e.exec(n)[1])>=6.1?!0:!1}(),i=function(){var t=Function.prototype.bind;return(!t||t&&typeof window.addEventListener=="undefined")&&typeof console=="object"&&typeof console.log=="object"}(),s=!r&&!i&&/Trident\//.test(n),o=r||window.console&&typeof console.log=="function",u=0,a={label:"Log:",collapsed:!0},f=function(){(function(e,t,n,r,i,s,o,u,a,f,l){if(e.getElementById(i))return;l=e[t+"NS"]&&e.documentElement.namespaceURI,l=l?e[t+"NS"](l,"script"):e[t]("script"),l[n]("id",i),l[n]("src",a+o+f),l[n](i,s),(e[r]("head")[0]||e[r]("body")[0]).appendChild(l),l=new Image,l[n]("src",a+u)})(document,"createElement","setAttribute","getElementsByTagName","FirebugLite","4","firebug-lite.js","releases/lite/latest/skin/xp/sprite.png","https://getfirebug.com/","#startOpened")},l=function(t){var n=t.split("\n").pop(),r=document.location.pathname.substr(0,document.location.pathname.lastIndexOf("/")+1);return n.indexOf(r)>-1&&(n=n.replace(r,"").replace(document.location.protocol+"//","")),/[^\(\@]+\:\d+\:\d+\)?$/.test(n)?n="@"+/([^\(\@]+\:\d+\:\d+)\)?$/.exec(n)[1]:(n.indexOf(" (")>-1?n=n.split(" (")[1].substring(0,n.length-1):n.indexOf("at ")>-1?n=n.split("at ")[1]:/([^\/]+\:\d+\:\d+)/.test(n)&&(n=/([^\/]+\:\d+\:\d+)/.exec(n)[1]),n="@"+n.substring(n.lastIndexOf("/")+1)),n},c=function(e){var t,n,r;if(null===e)return"null";if(/function|undefined|string|boolean|number/.test(typeof e))return typeof e;if("object"==typeof e)for(t=Object.prototype.toString.call(e),n=["Math","ErrorEvent","Error","Date","RegExp","Event","Array"],r=n.length;r--;)return t==="[object "+n[r]+"]"?n[r].toLowerCase():"object"==typeof HTMLElement&&e instanceof HTMLElement?"element":"string"==typeof e.nodeName&&1===e.nodeType?"element":"object"==typeof Node&&e instanceof Node?"node":"number"==typeof e.nodeType&&"string"==typeof e.nodeName?"node":/^\[object (HTMLCollection|NodeList|Object)\]$/.test(t)&&"number"==typeof e.length&&"undefined"!=typeof e.item&&(0===e.length||"object"==typeof e[0]&&e[0].nodeType>0)?"nodelist":"object";return"unknown"};return t=function(){var e=arguments,n=Array.prototype.slice.call(e),o=r||window.console&&typeof console.log=="function",a,h;t.history.push(arguments);if(o){t.options.group&&(t.options.group.collapsed?console.groupCollapsed(t.options.group.label):console.group(t.options.group.label)),t.options.lineNumber&&(a=new Error,a.fileName&&a.lineNumber?n.push("@"+a.fileName.substr(a.fileName.lastIndexOf("/")+1)+":"+a.lineNumber+":1"):a.stack&&n.push(l(a.stack)));if(t.detailPrint&&t.needsDetailPrint){console.log("-----------------"),e=t.detailPrint(e),h=0;while(h<e.length)console.log(e[h]),h++}else if(n.length===1&&typeof n[0]=="string")console.log(n.toString());else if(s){h=0;while(h<e.length)s&&c(e[h])==="object"?console.dir(e[h]):console.log(e[h]),h++}else console.log(n);t.options.group&&console.groupEnd()}else if(i)if(t.detailPrint){e=t.detailPrint(e),e.unshift("-----------------"),h=0;while(h<e.length)Function.prototype.call.call(console.log,console,Array.prototype.slice.call([e[h]])),h++}else Function.prototype.call.call(console.log,console,Array.prototype.slice.call(e));else document.getElementById("FirebugLite")?u<20?(setTimeout(function(){window.log.apply(window,e)},500),u++):u=0:(f(),setTimeout(function(){window.log.apply(window,e)},3e3),t.needsDetailPrint=!1)},t.history=[],t.options={lineNumber:!0,group:!1},s&&!t.options.group&&(t.options.group=a),t.settings=function(n){n&&c(n)==="object"&&(o&&console.group&&(typeof n.group=="boolean"?n.group?t.options.group=a:t.options.group=!1:c(n.group)==="object"&&(t.options.group=a,typeof n.group.collapsed!="undefined"&&(t.options.group.collapsed=!!n.group.collapsed),typeof n.group.label=="string"&&(t.options.group.label=n.group.label))),typeof n.lineNumber!="undefined"&&(t.options.lineNumber=!!n.lineNumber))},t}),define("modules/layout/views/app_footer",["app","consolelog"],function(e,t){return e.module("LayoutApp.Views",function(e,t,n,r){e.FooterView=r.ItemView.extend({el:"#blendswap-footer",events:{"click .footer-nav-triggers .clk":"triggerClicked"},triggerClicked:function(e){var t=$(e.currentTarget),n=t.data("trigger");this.$(".footer-nav-links").slideUp(250),this.$(".footer-nav-triggers .active").removeClass("active"),t.addClass("active"),this.$(n).stop().slideDown(250)}})}),e.LayoutApp.Views.FooterView}),define("modules/layout/views/app_sort",["app"],function(e,t){return e.module("LayoutApp.Views",function(e,t,n,r){e.AppSort=r.ItemView.extend({isOpen:!1,events:{"click .trigger":"layout"},initialize:function(){this.linkOffset={top:0,left:0};var e=location.pathname,t=e.match(/(sort:.+?\/)/gi);if(t){var n=this.$("a[href*='"+t[0].slice(0,-1)+"']");this.linkOffset=n.position(),this.slideToLink()}},slideToLink:function(){this.$(".dropdown-list").css({top:-this.linkOffset.top})},slideToTop:function(){this.$(".dropdown-list").css({top:0})},layout:function(){this.isOpen?(this.$el.css({overflow:"hidden"}),this.slideToLink()):(this.$el.css({overflow:"visible"}),this.slideToTop()),this.isOpen=!this.isOpen}})}),e.LayoutApp.Views.AppSort}),define("text",["module"],function(e){var t,n,r,i,s,o=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],u=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,a=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,f=typeof location!="undefined"&&location.href,l=f&&location.protocol&&location.protocol.replace(/\:/,""),c=f&&location.hostname,h=f&&(location.port||undefined),p={},d=e.config&&e.config()||{};t={version:"2.0.14",strip:function(e){if(e){e=e.replace(u,"");var t=e.match(a);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:d.createXhr||function(){var e,t,n;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")for(t=0;t<3;t+=1){n=o[t];try{e=new ActiveXObject(n)}catch(r){}if(e){o=[n];break}}return e},parseName:function(e){var t,n,r,i=!1,s=e.lastIndexOf("."),o=e.indexOf("./")===0||e.indexOf("../")===0;return s!==-1&&(!o||s>1)?(t=e.substring(0,s),n=e.substring(s+1)):t=e,r=n||t,s=r.indexOf("!"),s!==-1&&(i=r.substring(s+1)==="strip",r=r.substring(0,s),n?n=r:t=r),{moduleName:t,ext:n,strip:i}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,r,i){var s,o,u,a=t.xdRegExp.exec(e);return a?(s=a[2],o=a[3],o=o.split(":"),u=o[1],o=o[0],(!s||s===n)&&(!o||o.toLowerCase()===r.toLowerCase())&&(!u&&!o||u===i)):!0},finishLoad:function(e,n,r,i){r=n?t.strip(r):r,d.isBuild&&(p[e]=r),i(r)},load:function(e,n,r,i){if(i&&i.isBuild&&!i.inlineText){r();return}d.isBuild=i&&i.isBuild;var s=t.parseName(e),o=s.moduleName+(s.ext?"."+s.ext:""),u=n.toUrl(o),a=d.useXhr||t.useXhr;if(u.indexOf("empty:")===0){r();return}!f||a(u,l,c,h)?t.get(u,function(n){t.finishLoad(e,s.strip,n,r)},function(e){r.error&&r.error(e)}):n([o],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,r)})},write:function(e,n,r,i){if(p.hasOwnProperty(n)){var s=t.jsEscape(p[n]);r.asModule(e+"!"+n,"define(function () { return '"+s+"';});\n")}},writeFile:function(e,n,r,i,s){var o=t.parseName(n),u=o.ext?"."+o.ext:"",a=o.moduleName+u,f=r.toUrl(o.moduleName+u)+".js";t.load(a,r,function(n){var r=function(e){return i(f,e)};r.asModule=function(e,t){return i.asModule(e,f,t)},t.write(e,a,r,s)},s)}};if(d.env==="node"||!d.env&&typeof process!="undefined"&&process.versions&&!!process.versions.node&&!process.versions["node-webkit"]&&!process.versions["atom-shell"])n=require.nodeRequire("fs"),t.get=function(e,t,r){try{var i=n.readFileSync(e,"utf8");i[0]==="﻿"&&(i=i.substring(1)),t(i)}catch(s){r&&r(s)}};else if(d.env==="xhr"||!d.env&&t.createXhr())t.get=function(e,n,r,i){var s=t.createXhr(),o;s.open("GET",e,!0);if(i)for(o in i)i.hasOwnProperty(o)&&s.setRequestHeader(o.toLowerCase(),i[o]);d.onXhr&&d.onXhr(s,e),s.onreadystatechange=function(t){var i,o;s.readyState===4&&(i=s.status||0,i>399&&i<600?(o=new Error(e+" HTTP status: "+i),o.xhr=s,r&&r(o)):n(s.responseText),d.onXhrComplete&&d.onXhrComplete(s,e))},s.send(null)};else if(d.env==="rhino"||!d.env&&typeof Packages!="undefined"&&typeof java!="undefined")t.get=function(e,t){var n,r,i="utf-8",s=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),u=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),i)),a="";try{n=new java.lang.StringBuffer,r=u.readLine(),r&&r.length()&&r.charAt(0)===65279&&(r=r.substring(1)),r!==null&&n.append(r);while((r=u.readLine())!==null)n.append(o),n.append(r);a=String(n.toString())}finally{u.close()}t(a)};else if(d.env==="xpconnect"||!d.env&&typeof Components!="undefined"&&Components.classes&&Components.interfaces)r=Components.classes,i=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),s="@mozilla.org/windows-registry-key;1"in r,t.get=function(e,t){var n,o,u,a={};s&&(e=e.replace(/\//g,"\\")),u=new FileUtils.File(e);try{n=r["@mozilla.org/network/file-input-stream;1"].createInstance(i.nsIFileInputStream),n.init(u,1,0,!1),o=r["@mozilla.org/intl/converter-input-stream;1"].createInstance(i.nsIConverterInputStream),o.init(n,"utf-8",n.available(),i.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),o.readString(n.available(),a),o.close(),n.close(),t(a.value)}catch(f){throw new Error((u&&u.path||"")+": "+f)}};return t}),define("text!templates/common/cookie_nag.html",[],function(){return'<div class="col-large-12 text-center"><small class="popup-content">Blend Swap stores little pieces of data (cookies, local stroage, etc.) in your computer to help us identify your account , keep you logged in, and make some features (such as <em>likes</em>) run very fast.<br><br>Do you agree to store this data in your computer?<br><br><a href="#" class="button button-green js-agree">I agree, keep the data and give me blends</a>&nbsp; <a href="#" class="button button-blue js-disagree">I disagree, delete data</a></small></div>'}),define("modules/common/views/cookie_nag",["app","text!templates/common/cookie_nag.html"],function(e,t){return e.module("CommonApp.Views",function(e,n,r,i){e.CookieNagView=i.ItemView.extend({className:"nag cookie-nag marker-light-green",template:_.template(t),events:{"click .js-agree":"agreeClicked","click .js-disagree":"disagreeClicked"},unrender:function(){var e=this;this.$el.slideUp(500,function(){e.remove()})},agreeClicked:function(e){e&&e.preventDefault(),this.trigger("agree")},disagreeClicked:function(e){e&&e.preventDefault(),this.trigger("disagree")}})}),e.CommonApp.Views.CookieNagView}),define("modules/layout/layout_controller",["app","entities/cookie_nag"],function(e,t){e.module("LayoutApp",function(e,n,r,i){e.Controller=i.Controller.extend({initialize:function(){this.loadMenuView(),this.loadFooterView(),this.loadSortWidget(),this.loadCookieNag()},loadMenuView:function(){require(["modules/layout/views/app_menu"],function(e){new e})},loadFooterView:function(){require(["modules/layout/views/app_footer"],function(e){new e})},loadSortWidget:function(){var e=$("#app-sort").eq(0);e.length&&require(["modules/layout/views/app_sort"],function(t){new t({el:e})})},loadCookieNag:function(){var e=new t.CookiesNagCollection;e.fetch({success:function(){0===e.length&&require(["modules/common/views/cookie_nag"],function(t){function i(e){var t=new Date(0),n="expires="+t.toGMTString();document.cookie=e+"=; "+n+"; path=/"}var r=new t;r.listenTo(r,"agree",function(){e.create({cookie_nag:"accepted"},{success:function(){r.unrender(),n.trigger("app:success","Done, we won't nag you again with that. Enjoy the site!")},error:function(){alert("Error when saving your cookies preference")}})}),r.listenTo(r,"disagree",function(){var e=["blend_swap","__utma","__utmb","__utmc","__utmt","__utmz"];for(var t in e)i(e[t]);window.localStorage.clear(),alert("All deleted. To make sure we're not setting any more data in your computer just browse away from www.blendswap.com."),r.unrender()}),n.nagRegion.show(r)})}})}}),n.addInitializer(function(){var t=new e.Controller})})}),define("models/item",["app","backbone"],function(e,t){return t.Model.extend({defaults:{user_id:e.CurrentUser.get("id"),type:"collect"},initialize:function(){this.on("request",function(){e.trigger("spinner:on")}).on("error reset invalid sync destroy",function(){e.trigger("spinner:off")})},parse:function(e){return e.id?e:(e.User&&(e.Item.User=e.User),e.Collection&&(e.Item.Collection=e.Collection),e.Blend&&(e.Item.Blend=e.Blend),e.Item)},validate:function(e,t){var n={};if(!this.isNew()||"like"!=e.type)e.collection_id||(n.collection_id="No Collection ID");e.blend_id||(n.blend_id="No Blend ID"),e.user_id||(n.user_id="No User ID");if(!_.isEmpty(n))return n},url:function(){return"/items"+(this.id?"/"+this.get("id"):"")}})}),define("modules/likes/collections/local",["app","backbone","models/item","localstorage"],function(e,t,n){return t.Collection.extend({model:n,localStorage:new t.LocalStorage("app-likes")})}),define("modules/likes/collections/remote",["app","backbone","models/item"],function(e,t,n){return t.Collection.extend({model:n,url:function(){return"/items"},parse:function(e,t){return e.data}})}),define("modules/likes/app",["app","backbone","modules/likes/collections/local","modules/likes/collections/remote"],function(e,t,n,r){var i="app-likes",s={wait:!0,reset:!0,parse:!0,error:function(){e.trigger("app:popup",{data:{pclass:"error-message",message:"There was an error while retrieving your likes fromthe server..."}})},success:function(){TimeStamp.updateTimeStamp(i)}};e.Applications.LikesManager=t.View.extend({initialize:function(){e.isLoggedIn()&&(this.collection=new n,this.remote=new r,this.listenTo(this.remote,"reset",this.copyToLocal),this.listenTo(e,"blend:liked:get",this.broadcastByBlendID),this.listenTo(e,"blend:liked:manage",this.manageLike),this.listenTo(this.collection,"add",this.broadcastByItem),this.prepare())},prepare:function(){this.collection.fetch(),TimeStamp.isExpired(i)&&this.remote.fetch(s)},copyToLocal:function(){_.each(this.collection.models,function(e){e&&e.destroy()},this),_.each(this.remote.models,function(e){this.collection.add(e.toJSON()).save()},this)},broadcastByBlendID:function(t){var n="blend:liked:"+t;t==="66740",e.trigger(n,this.collection.findWhere({blend_id:t}))},broadcastByItem:function(e){this.broadcastByBlendID(e.get("blend_id"))},manageLike:function(e){var t=this.collection.findWhere({blend_id:e});t?this.destroyLike(t,e):this.saveNewLike(e)},destroyLike:function(e,t){var n=this;this.remote.add(e.toJSON()).destroy({wait:!0,success:function(){e.destroy()&&n.broadcastByBlendID(t)},error:function(){e.destroy()&&n.broadcastByBlendID(t)}})},saveNewLike:function(e){var t=this,n={blend_id:e,type:"like"};this.remote.create(n,{wait:!0,error:function(){t.broadcastByBlendID(e)},success:function(e){t.collection.add(e.toJSON()).save()}})}})}),define("entities/follow",["app","entities/base"],function(e){return e.module("Entities",function(e,t,n){e.FollowModel=e.BaseModel.extend({defaults:{status:"active",user_id:t.CurrentUser.get("id")},parse:function(e){if(e.id)return e;if(e.Follow)return e.Follow;throw{}},url:function(){return"/follows"+this.getUrlID()}}),e.FollowsCollection=e.BaseCollection.extend({model:e.FollowModel,url:function(){return"/follows"}}),t.reqres.setHandler("entities:follows:new",function(){return new e.FollowModel}),t.reqres.setHandler("entities:follows:collection",function(){return new e.FollowsCollection})}),e.Entities}),define("modules/follows/follows_controller",["app","entities/follow"],function(e){e.module("FollowsApp",function(e,t,n,r){e.Controller=r.Controller.extend({initialize:function(){t.CurrentUser.isLoggedIn()&&(this.collection=t.request("entities:follows:collection"),this.listenTo(this.collection,"remove",this.announceRemoved),this.listenTo(this.collection,"add",this.announceAdded),this.listenTo(t,"follow:register",this.register),this.listenTo(t,"follow:manage",this.manageFollow))},register:function(e){_.isEmpty(e)||this.collection.add(e)},manageFollow:function(e,t){var n=this.collection.findWhere({object_id:t,object_class:e});n?this.destroyFollow(n):this.createFollow(e,t)},announceAdded:function(e){var n=["follow","set",e.get("object_class"),e.get("object_id")].join(":");t.trigger(n,[e])},announceRemoved:function(e){var n=["follow","set",e.get("object_class"),e.get("object_id")].join(":");t.trigger(n,[])},destroyFollow:function(e){var n=this;e.destroy({wait:!0,error:function(){t.trigger("app:popup",{data:{pclass:"error-message",message:"Error when unfollowing this object."}})},success:function(){n.collection.remove(e)}})},createFollow:function(e,n){this.collection.create({object_id:n,object_class:e},{wait:!0,error:function(){t.trigger("app:popup",{data:{pclass:"error-message",message:"Error when following this object."}})}})}}),t.addInitializer(function(){t.FollowsManager=new e.Controller})})}),define("entities/news",["app","entities/base"],function(e){return e.module("Entities",function(e,t,n){e.NewsModel=e.BaseModel.extend({defaults:{},url:function(){return"/news"+(this.id?"/"+this.id:"")},parse:function(e){if(e.id)return e;if(e.News)return e.User&&(e.News.User=e.User),e.Image&&(e.News.Image=e.Image),e.BlendFile&&(e.News.BlendFile=e.BlendFile),e.Follow&&(e.News.Follow=e.Follow),e.News;t.trigger("app:error","There was an error when parsing a News object. Please report you saw this error to the admins.")},validate:function(e){var t=[];t=this.cleanErrors();if(!_.isEmpty(t))return t}}),e.NewssCollection=e.BaseCollection.extend({model:e.NewsModel,url:function(){return"/news"},parse:function(e){return e.data?e.data:e}}),e.Newss=n.Collection.extend({model:e.NewsModel,url:function(){return"/news"},parse:function(e){return e.data?e.data:e}}),t.reqres.setHandler("entities:news:new",function(){return new e.NewsModel}),t.reqres.setHandler("entities:news:single",function(t){return new e.NewsModel({id:t})}),t.reqres.setHandler("entities:news:index",function(t){return new e.NewssCollection([],t)}),t.reqres.setHandler("entities:news:collection",function(t,n){return new e.Newss(t,n)})}),e.Entities}),define("modules/news/views/single",["app","backbone","entities/news"],function(e,t,n){return t.View.extend({object_class:"News",events:{"click .js-follow":"followClicked"},initialize:function(){var t=this.loadFromScript();t&&(this.model=new n.NewsModel(t,{parse:!0}),this.listenTo(this.model,"request",function(){e.trigger("spinner:on")}),this.listenTo(this.model,"sync error",function(){e.trigger("spinner:off")}),this.render())},render:function(){return e.isLoggedIn()&&this.initFollow(),e.trigger("register:user",this.model.get("User")),this}})}),define("text!templates/comments/layout.html",[],function(){return'<div class="col-large-12"><div class="cage-small-12 subtle-relief" id="comments-list"><div class="text-center"><img src="/img/async-light.gif" alt="Loading comments..."></div></div></div><div class="col-large-12" id="comment-form"><div class="alert-message">Here goes the form</div></div>'}),define("modules/comments/views/layout",["app","text!templates/comments/layout.html"],function(e,t){return e.module("CommentsApp",function(e,n,r,i){e.ManagerView=i.LayoutView.extend({template:_.template(t),regions:{listRegion:"#comments-list",formRegion:"#comment-form"}})}),e.CommentsApp.ManagerView}),define("text!templates/comments/one_comment.html",[],function(){return'<div class="comment-avatar"><div class="gravatar-link"><div class="gravatar"><a href="/user/<%- User.username %>"><%= gravatarImage(User, 80) %></a></div><% if (App.isLoggedIn()) { %><div class="vote-widget"><span class="js-vote vote-button vote-up icon-thumb-up"></span><span class="vote-holder"><%- points %></span><span class="js-vote vote-button vote-down icon-thumb-down"></span></div><% } %></div></div><div class="comment-content"><h1 class="text-big-18 comment-author"><strong><a class="abel" href="/user/<%- User.username %>"><%- User.username %></a></strong></h1><div class="hasAt comment-body"><%= markdown.toHTML(parseAt(body)) %></div><div class="comment-edit hidden"><form><p><textarea name="body" rows="5"><%= body %></textarea></p><p><button class="button js-save" type="submit">Save</button>&nbsp; <button class="button button-blue js-edit" type="submit">Cancel</button></p></form></div><div class="clearfix small"><% if (App.isLoggedIn()) { %><a href="#" class="js-reply">Reply</a> |&nbsp;<% if (!is_own) { %> <a href="#" class="js-message">Message</a> |&nbsp;<% } %><% if (can_edit) { %> <a href="#" class="js-edit">Edit</a> |&nbsp;<% } %><% if (App.isAdmin()) { %> <a href="#" class="js-delete">Delete</a> |&nbsp;<% } %><% } %> <a href="/<%- object_class.toLowerCase().pluralize() %>/view/<%- object_id %>#comment-<%- id %>"><span class="gray">On:<%- prettyDatetime(created) %></span></a></div></div>'}),define("entities/vote",["app"],function(e){e.module("Entities",function(e,t,n,r){e.VoteModel=n.Model.extend({defaults:{vote:1,user_id:t.CurrentUser.get("id")},initialize:function(){this.on("request",function(){t.trigger("spinner:on")}),this.on("sync error invalid destroy remove",function(){t.trigger("spinner:off")}),this.on("invalid",function(e,n){t.trigger("app:error",n.join(". "))})},url:function(){return"/votes"+(this.id?"/"+this.id:"")},parse:function(e){if(e.id)return e;if(e.Vote)return e.User&&(e.Vote.User=e.User),e.Vote;alert("Vote parsing error, please report you saw this!")},validate:function(e){var t=[];if(!_.isEmpty(t))return t}}),e.VotesCollection=n.Collection.extend({object_id:0,object_class:"None",model:e.VoteModel,initialize:function(e,n){this.object_id=n.oid||0,this.object_class=n.oc||"None",this.on("request",function(){t.trigger("spinner:on")}),this.on("sync error invalid destroy remove",function(){t.trigger("spinner:off")})},url:function(){var e=this.object_class,t=this.object_id,n=["votes","index",e,t];return"/"+n.join("/")},parse:function(e){return e}});var i={"new":function(t){return new e.VoteModel(t)},single:function(t){var n=$.Deferred(),r=new e.VoteModel({id:t});return r.fetch({wait:!0,parse:!0,error:function(e){n.resolve(e)},success:function(e){n.resolve(e)}}),n.promise()},collection:function(t){var n=$.Deferred(),r=new e.VotesCollection([],t);return r.fetch({wait:!0,parse:!0}).always=function(){n.resolve(r)},n.promise()}};t.reqres.setHandler("entities:votes:new",function(e){return i.new(e)}),t.reqres.setHandler("entities:votes:single",function(e){return i.single(e)}),t.reqres.setHandler("entities:votes:collection",function(e){return i.collection(e)})})}),function(e,t){typeof define=="function"&&define.amd&&define("backbone.syphon",["underscore","jquery","backbone"],t)}(this,function(e,t,n){return n.Syphon=function(e,t,n){var r={};r.ignoredTypes=["button","submit","reset","fieldset"],r.serialize=function(e,r){var o={},f=u(r),l=i(e,f);return n.each(l,function(e){var n=t(e),r=s(n),i=f.keyExtractors.get(r),u=i(n),l=f.inputReaders.get(r),c=l(n),h=f.keyAssignmentValidators.get(r);if(h(n,u,c)){var p=f.keySplitter(u);o=a(o,p,c)}}),o},r.deserialize=function(e,r,o){var a=u(o),l=i(e,a),c=f(a,r);n.each(l,function(e){var n=t(e),r=s(n),i=a.keyExtractors.get(r),o=i(n),u=a.inputWriters.get(r),f=c[o];u(n,f)})};var i=function(e,r){var i=o(e),u=i.elements;return u=n.reject(u,function(e){var i,o=s(e),u=r.keyExtractors.get(o),a=u(t(e)),f=n.include(r.ignoredTypes,o),l=n.include(r.include,a),c=n.include(r.exclude,a);return l?i=!1:r.include?i=!0:i=c||f,i}),u},s=function(e){var n,r=t(e),i=r[0].tagName,s=i;return i.toLowerCase()==="input"&&(n=r.attr("type"),n?s=n:s="text"),s.toLowerCase()},o=function(e){return n.isUndefined(e.$el)&&e.tagName.toLowerCase()==="form"?e:e.$el.is("form")?e.el:e.$("form")[0]},u=function(e){var t=n.clone(e)||{};return t.ignoredTypes=n.clone(r.ignoredTypes),t.inputReaders=t.inputReaders||r.InputReaders,t.inputWriters=t.inputWriters||r.InputWriters,t.keyExtractors=t.keyExtractors||r.KeyExtractors,t.keySplitter=t.keySplitter||r.KeySplitter,t.keyJoiner=t.keyJoiner||r.KeyJoiner,t.keyAssignmentValidators=t.keyAssignmentValidators||r.KeyAssignmentValidators,t},a=function(e,t,r){if(!t)return e;var i=t.shift();return e[i]||(e[i]=n.isArray(i)?[]:{}),t.length===0&&(n.isArray(e[i])?e[i].push(r):e[i]=r),t.length>0&&a(e[i],t,r),e},f=function(e,t,r){var i={};return n.each(t,function(t,s){var o={};r&&(s=e.keyJoiner(r,s)),n.isArray(t)?(s+="[]",o[s]=t):n.isObject(t)?o=f(e,t,s):o[s]=t,n.extend(i,o)}),i};return r}(n,t,e),n.Syphon.TypeRegistry=function(){this.registeredTypes={}},n.Syphon.TypeRegistry.extend=n.Model.extend,e.extend(n.Syphon.TypeRegistry.prototype,{get:function(e){var t=this.registeredTypes[e];return t||(t=this.registeredTypes["default"]),t},register:function(e,t){this.registeredTypes[e]=t},registerDefault:function(e){this.registeredTypes["default"]=e},unregister:function(e){this.registeredTypes[e]&&delete this.registeredTypes[e]}}),n.Syphon.KeyExtractorSet=n.Syphon.TypeRegistry.extend(),n.Syphon.KeyExtractors=new n.Syphon.KeyExtractorSet,n.Syphon.KeyExtractors.registerDefault(function(e){return e.prop("name")}),n.Syphon.InputReaderSet=n.Syphon.TypeRegistry.extend(),n.Syphon.InputReaders=new n.Syphon.InputReaderSet,n.Syphon.InputReaders.registerDefault(function(e){return e.val()}),n.Syphon.InputReaders.register("checkbox",function(e){var t=e.prop("checked");return t}),n.Syphon.InputWriterSet=n.Syphon.TypeRegistry.extend(),n.Syphon.InputWriters=new n.Syphon.InputWriterSet,n.Syphon.InputWriters.registerDefault(function(e,t){e.val(t)}),n.Syphon.InputWriters.register("checkbox",function(e,t){e.prop("checked",t)}),n.Syphon.InputWriters.register("radio",function(e,t){e.prop("checked",e.val()===t)}),n.Syphon.KeyAssignmentValidatorSet=n.Syphon.TypeRegistry.extend(),n.Syphon.KeyAssignmentValidators=new n.Syphon.KeyAssignmentValidatorSet,n.Syphon.KeyAssignmentValidators.registerDefault(function(){return!0}),n.Syphon.KeyAssignmentValidators.register("radio",function(e,t,n){return e.prop("checked")}),n.Syphon.KeySplitter=function(e){var t=e.match(/[^\[\]]+/g);return e.indexOf("[]")===e.length-2&&(lastKey=t.pop(),t.push([lastKey])),t},n.Syphon.KeyJoiner=function(e,t){return e+"["+t+"]"},n.Syphon}),define("modules/comments/views/one_comment",["app","text!templates/comments/one_comment.html","entities/vote","backbone.syphon"],function(e,t){return e.module("CommentsApp.Views",function(e,n,r,i){e.OneCommentView=i.ItemView.extend({className:"comment",template:_.template(t),events:{"click .js-vote":"voteClicked","click .js-edit":"editClicked","click .js-save":"saveClicked","click .js-reply":"replyClicked","click .js-message":"messageClicked","click .js-delete":"deleteClicked","keyup textarea":"liveSearch"},onRender:function(){this.vote=n.request("entities:votes:new",{object_class:"Comment",object_id:this.model.get("id")}),this.listenTo(this.model,"change",this.render);var e=this.model.get("parent_id");e=parseInt(e,10),this.$el.addClass(e?"comment-child":"comment-main"),this.$el.attr({id:"comment-"+this.model.get("id")}),n.trigger("register:user",this.model.get("User"))},onShow:function(){var e="#comment-"+this.model.get("id");location.hash==e&&setTimeout(function(){n.scroll_to(e)},500)},serializeData:function(){var e=this.model.toJSON(),t=n.CurrentUser.get("id"),r=this.model.get("user_id");return e.is_own=r==t,e.can_edit=e.is_own||n.isAdmin(),e},editClicked:function(e){e&&(e.preventDefault(),e.stopPropagation()),this.$(".comment-edit, .comment-body").toggle()},saveClicked:function(e){e&&(e.preventDefault(),e.stopPropagation());var t=r.Syphon.serialize(this);this.trigger("save",t)},messageClicked:function(e){e&&(e.preventDefault(),e.stopPropagation());var t=this.model.get("User");n.trigger("user:message",t)},replyClicked:function(e){e&&(e.preventDefault(),e.stopPropagation()),this.trigger("reply")},deleteClicked:function(e){e&&(e.preventDefault(),e.stopPropagation()),this.trigger("comment:delete",this.model)},voteClicked:function(e){e&&(e.preventDefault(),e.stopPropagation());var t=this,r=n.CurrentUser.get("id"),i=this.model.get("user_id");if(r===i)return n.trigger("app:alert","You can not vote on your own comments."),!1;var s=1;$(e.target).is(".vote-down")&&(s=-1);var o=this.vote.save({vote:s},{wait:!0,error:function(){n.trigger("app:error","there was an error saving your vote")},success:function(e){if(0===e.get("vote"))n.trigger("app:info","You already voted this object that way.");else{var r=t.model.get("points");r=parseInt(r,10),r+=parseInt(e.get("vote"),10),t.model.set({points:r})}}})}})}),e.CommentsApp.Views.OneCommentView}),define("modules/comments/views/children",["app","modules/comments/views/one_comment"],function(e,t){return e.module("CommentsApp.Views",function(e,n,r,i){e.IndexView=i.CollectionView.extend({className:"cage-large-12",childView:t})}),e.CommentsApp.Views.IndexView}),define("text!templates/comments/form.html",[],function(){return'<form action="/comments" method="POST"><input type="hidden" name="parent_id" value="<%- parent_id %>"> <input type="hidden" name="object_id" value="<%- object_id %>"> <input type="hidden" name="object_class" value="<%- object_class %>"> <input type="hidden" name="user_id" value="<%- user_id %>"><div class="input"><textarea name="body" rows="7" id="comment-body" rows="5" placeholder="What do you think?&#10;&#10;You can use Markdown&#10;    __bold text__&#10;    *emphasized text*&#10;    [linked text](http://example.com)"></textarea><div class="cage-small-12 js-live-search"></div></div><div class="cage-small-6"><button class="button" type="submit">Save comment</button>&nbsp; <button class="button button-blue js-cancel" type="reset">Cancel</button></div><div class="cage-small-6 text-right"><small class="shrinkwrap"><span class="count">0</span>/2000 characters<br>@replies are supported.</small></div></form>'}),define("text!templates/comments/form_lo.html",[],function(){return'<div class="info-message with-icon">You must <a href="/login">login</a> to leave a comment.</div>'}),define("modules/comments/views/form",["app","text!templates/comments/form.html","text!templates/comments/form_lo.html","backbone.syphon"],function(e,t,n){return t=e.isLoggedIn()?t:n,e.module("CommentsApp.Views",function(e,n,r,i){e.FormView=i.ItemView.extend({template:_.template(t),events:{"keyup textarea":"keyupTriggered","submit form":"saveComment","click .js-cancel":"cancelClicked"},initialize:function(e){this.listenTo(n,"comment:reply:start",this.remove),this.users=n.request("entities:users:collection")},onShow:function(){n.CurrentUser.isLoggedIn()&&(this.textarea=this.$("textarea"),this.searchRegion=new i.Region({el:this.$(".js-live-search")}))},keyupTriggered:function(e){var t=this.textarea.val().length;this.$(".count").text(t),this.liveSearch()},userSelected:function(e){var t=this.textarea.getCursorPosition(),n=this.textarea.val(),r=n.slice(0,t),i=n.slice(t);n=n.replace(/ {2,}/gim," "),i=i.replace(/ {2,}/gim," "),r=r.replace(/@([a-z0-9]+)?$/gim," @"+e+" "),r=r.replace(/ {2,}/gim," "),n=r+i,this.textarea.val(n),this.textarea.focus(),this.textarea.setCursorPosition(r.length)},liveSearch:function(e){var t=this.textarea.getCursorPosition(),n=this.textarea.val(),r=n.slice(0,t),i=r.search(/@([a-z0-9]+)?$/gim);if(i>=0){var s=r.slice(i+1);this.trigger("users:search",s)}else this.trigger("users:none")},saveComment:function(e){e.preventDefault();var t=r.Syphon.serialize(this);this.trigger("save:comment",t)},cancelClicked:function(){this.trigger("cancel")}})}),e.CommentsApp.Views.FormView}),define("text!templates/comments/threaded_comment.html",[],function(){return'<div class="comment-parent"></div><div class="comment-children"></div><div class="form-region"></div>'}),define("entities/comment",["app"],function(e){e.module("Entities",function(e,t,n,r){e.CommentModel=n.Model.extend({defaults:{body:"",points:0,children:[],parent_id:"0",object_id:"0",object_class:"none",user_id:t.CurrentUser.get("id")},initialize:function(){this.on("request",function(){t.trigger("spinner:on")}),this.on("sync error invalid",function(){t.trigger("spinner:off")}),this.on("invalid",function(e,n){t.trigger("app:error",n.join(". "))})},url:function(){return"/comments"+(this.id?"/"+this.id:"")},parse:function(e){if(e.id)return e;if(e.Comment){e.User&&(e.Comment.User=e.User),e.children&&(e.Comment.children=e.children);var n=t.CurrentUser.get("id"),r=e.Comment.user_id;return e.Comment.is_own=r==n,e.Comment.can_edit=e.Comment.is_own||t.isAdmin(),e.Comment}alert("Comment parsing error, please report you saw this!")},validate:function(e){var t=[];e.body?(e.body.length<2&&t.push("The comment is too short, 2 characters minimum"),e.body.length>2e3&&t.push("The comment is too long, 2000 characters maximum"),HTML_REGEXP.test(e.body)&&t.push("HTML is not allowed, please use Markdown notation"),EMAIL_REGEXP.test(e.body)&&t.push("The comment contains an email, please remove it")):t.push("The comment is empty, please write a comment");if(!_.isEmpty(t))return t}}),e.CommentsCollection=n.Collection.extend({object_id:0,object_class:"None",model:e.CommentModel,initialize:function(e,n){this.object_id=n.object_id||0,this.object_class=n.object_class||"None",this.on("request",function(){t.trigger("spinner:on")}),this.on("sync error invalid",function(){t.trigger("spinner:off")})},url:function(){var e=["comments","index",this.object_class,this.object_id].join("/");return"/"+e},parse:function(e){return e}});var i={"new":function(t){return t=t||{},new e.CommentModel(t)},children:function(t){return new e.CommentsCollection(t,{parse:!0})},collection:function(t){return new e.CommentsCollection([],t)},single:function(t){var n=$.Deferred(),r=new e.CommentModel({id:t});return r.fetch({wait:!0,parse:!0,error:function(e){n.resolve(e)},success:function(e){n.resolve(e)}}),n.promise()},index:function(t){var n=$.Deferred(),r=new e.CommentsCollection([],t);return r.fetch({wait:!0,parse:!0}).always=function(){n.resolve(r)},n.promise()}};t.reqres.setHandler("entities:comments:new",function(e){return i.new(e)}),t.reqres.setHandler("entities:comments:single",function(e){return i.single(e)}),t.reqres.setHandler("entities:comments:index",function(e){return i.index(e)}),t.reqres.setHandler("entities:comments:collection",function(e){return i.collection(e)}),t.reqres.setHandler("entities:comments:children",function(e){return i.children(e)})})}),define("modules/comments/views/threaded_comment",["app","modules/comments/views/one_comment","modules/comments/views/children","modules/comments/views/form","text!templates/comments/threaded_comment.html","entities/comment"],function(e,t,n,r,i){return e.module("CommentsApp.Views",function(e,t,n,r){e.ParentCommentView=r.LayoutView.extend({className:"comment-root subtle-pop",template:_.template(i),regions:{commentParent:".comment-parent",commentChildren:".comment-children",formRegion:".form-region"},onShow:function(){this.$el.prop({id:this.cid})}})}),e.CommentsApp.Views.ParentCommentView}),define("modules/comments/views/index",["app","modules/comments/views/threaded_comment"],function(e,t){return e.module("CommentsApp.Views",function(e,n,r,i){e.IndexView=i.CollectionView.extend({className:"comments-index",childView:t,initialize:function(e){this.listenTo(n,"new:comment",this.addComment)},addComment:function(e){e instanceof r.Model&&(e=e.toJSON()),e.parent_id=="0"&&this.collection.add(e)},shouldLoad:function(){if(location.hash.match(/#comment-\d+/))return!0;var e=$(window).height(),t=$(window).scrollTop(),n=this.$el.offset().top;return e+t>=n}})}),e.CommentsApp.Views.IndexView}),define("text!templates/common/user_live_search_item.html",[],function(){return'<img src="//www.gravatar.com/avatar/<%- email %>.jpg?d=%2F%2Fwww.blendswap.com%2Fimg%2Fdefaults%2Fdefault_avatar.png&amp;s=32&amp;r=pg" class="avatar" alt="<%- username %>" width="32px"> <strong><%- username %></strong>'}),define("modules/common/views/user_live_search_item",["app","text!templates/common/user_live_search_item.html"],function(e,t){return e.module("UserLiveSearchApp.Views",function(e,n,r,i){e.ItemView=i.ItemView.extend({tagName:"div",className:"live-search-item",template:_.template(t),events:{click:"clicked"},clicked:function(e){e.preventDefault(),this.trigger("user:selected",this.model.get("username"))}})}),e.UserLiveSearchApp.Views.ItemView}),define("modules/common/views/user_live_search",["app","modules/common/views/user_live_search_item"],function(e,t){return e.module("UserLiveSearchApp.Views",function(e,n,r,i){e.ListView=i.CollectionView.extend({tagName:"div",className:"live-search-list",childView:t})}),e.UserLiveSearchApp.Views.ListView}),define("entities/user",["app","entities/base"],function(e){return e.module("Entities",function(e,t,n){e.UserModel=e.BaseModel.extend({defaults:{},url:function(){return"/user"+(this.id?"/"+this.get("username"):"")},parse:function(e){if(e.id)return e;if(e.User)return e.Image&&(e.User.Image=e.Image),e.Follow&&(e.User.Follow=e.Follow),e.Profile&&(e.User.Profile=e.Profile[0]),e.Membership&&(e.User.Membership=e.Membership||null),e.Achievement&&(e.User.Achievement=e.Achievement),e.Limit&&(e.User.Limit=e.Limit[0]),e.User;t.trigger("app:error","There was an error when parsing a User object. Please report you saw this error to the admins.")},validate:function(e){var t=[];t=this.cleanErrors();if(!_.isEmpty(t))return t},isFree:function(){return this.isLoggedIn()?!this.isAssociate()&&!this.isDeadline()&&!this.isAdmin():!1},isAssociate:function(){var e=this.get("Membership");return _.isEmpty(e)?!1:["2","3"].indexOf(e.plan_id)>=0},isDeadline:function(){var e=this.get("Membership");return _.isEmpty(e)?!1:["4"].indexOf(e.plan_id)>=0},isLevel:function(e){var t=this.get("level");return parseInt(e,10)===parseInt(t,10)},isAdmin:function(){return this.get("role")==="admin"}}),e.UsersCollection=e.BaseCollection.extend({model:e.UserModel,url:function(){return"/users"},parse:function(e){return e.data?e.data:e}}),e.Users=n.Collection.extend({model:e.UserModel,url:function(){return"/users"},parse:function(e){return e.data?e.data:e}}),t.reqres.setHandler("entities:users:new",function(){return new e.UserModel}),t.reqres.setHandler("entities:users:single",function(t){return new e.UserModel({id:t})}),t.reqres.setHandler("entities:users:index",function(t){return new e.UsersCollection([],t)}),t.reqres.setHandler("entities:users:collection",function(t,n){return new e.Users(t,n)})}),e.Entities}),define("modules/common/views/modal",["app","backbone"],function(e,t){return t.View.extend({className:"overlay",events:{click:"shouldClose","click .js-close":"unrender"},afterInit:function(t){this.listenTo(e,"app:escape",this.unrender),this.model&&(this.listenTo(this.model,"request",function(){e.trigger("spinner:on")}),this.listenTo(this.model,"sync error reset",function(){e.trigger("spinner:off")})),this.collection&&(this.listenTo(this.collection,"request",function(){e.trigger("spinner:on")}),this.listenTo(this.collection,"sync error reset",function(){e.trigger("spinner:off")})),this.listenTo(e,"app:modal",this.newModal),e.trigger("app:modal",this.cid)},newModal:function(e){e!==this.cid&&this.unrender()},render:function(){var t;return this.serializeData?t=this.serializeData():t=this.model.toJSON(),this.$el.html(this.template(t)),$("body").append(this.$el),this.$el.fadeIn(125,"swing",function(){e.trigger("spinner:off")}),this.onShow&&this.onShow(),e.trigger("app:modal",this.cid),this},unrender:function(e){e&&e.preventDefault();var t=this;this.$el.fadeOut(125,"swing",function(){t.close()})},closeClicked:function(e){var t=$(e.target);t.is(".overlay")&&this.unrender()},shouldClose:function(e){$(e.target).is(".overlay, .js-close")&&this.unrender(e)}})}),define("models/base_model",["backbone"],function(){return Backbone.Model.extend({initialize:function(e){this.on("invalid",function(e,t){App.trigger("app:popup",{data:{pclass:"error-message",message:t.join(". ")}}).trigger("spinner:off")}),this.on("request",function(){App.trigger("spinner:on")}),this.on("sync error destroy",function(){App.trigger("spinner:off")}),undefined!==this.baseInit&&this.baseInit()}})}),define("models/user",["models/base_model"],function(e){return e.extend({url:function(){return"/user/"+this.get("username")},parse:function(e,t){return e.id?e:(e.Membership&&(e.User.Membership=e.Membership),e.Profile&&(e.User.Profile=e.Profile),e.Achievement&&(e.User.Achievement=e.Achievement),e.Blend&&(e.User.Blend=e.Blend),e.Follow&&(e.User.Follow=e.Follow),e.Limit&&(e.User.Limit=e.Limit[0]),e.Image&&(e.User.Image=e.Image),e.Skill&&(e.User.Skill=e.Skill),e.User)}})}),define("collections/users_search",["backbone","models/user"],function(e,t){return e.Collection.extend({model:t,username:"",initialize:function(e){this.type=e.type||"available"},url:function(){return"/users/search/"+this.type+"/"+this.username+".json"},setUsername:function(e){return this.username=e,!0}})}),define("modules/users/helpers/search",["app","backbone","collections/users_search"],function(e,t,n){var r=t.View.extend({tagName:"div",className:"live-search-item",template:_.template("<%- username %>"),events:{click:"announce"},render:function(){return this.$el.html(this.template(this.model.toJSON())),this},announce:function(t){var n=this;t.preventDefault(),e.trigger("set:destinatary",this.model)}}),i=t.View.extend({tagName:"div",className:"live-search-list",initialize:function(){this.listenTo(e,"set:destinatary",this.close)},render:function(){return _.each(this.collection.models,this.render_one_result,this),this},render_one_result:function(e){var t=new r({model:e});this.$el.append(t.render().el)}});return t.View.extend({events:{keyup:"keyupTriggered"},template:_.template('<div class="<%- className %> with-icon"> <%- messageText %></div>'),initialize:function(t){this.type=t.type||"available",this.elParent=this.$el.parent(),this.collection=new n({type:this.type}),this.listenTo(this.collection,"sync error",this.render),this.listenTo(e,"set:destinatary",this.clearInput)},clearInput:function(){this.$el.val("")},keyupTriggered:function(e){this.timer&&clearTimeout(this.timer);var t=this.$el.val();if(!t)return;this.unrenderList(),this.collection.username=t,this.enqueueSearch()},enqueueSearch:function(){var e=this;this.timer=setTimeout(function(){e.collection.fetch({wait:!0,reset:!0,error:function(t,n){e.printError()},success:function(t,n){e.printSuccess()}})},400)},printError:function(){"find"==this.type?this.printMessage("error-message","No user found"):this.printMessage("error-message","The username is already taken :(")},printSuccess:function(){"find"==this.type?this.renderDropdown():this.printMessage("success-message","The username is available :)")},printMessage:function(e,t){this.elParent.find(".success-message, .error-message").remove(),this.elParent.append(this.template({className:e,messageText:t}))},renderDropdown:function(){if(this.collection.length<1){this.printError();return}this.unrenderList(),this.resultsList=new i({collection:this.collection}),this.$el.parent().append(this.resultsList.render().el)},unrenderList:function(){this.resultsList&&(this.resultsList.close(),delete this.resultsList)}})}),define("models/message",["app","models/base_model"],function(e,t){return t.extend({defaults:{user_id:e.CurrentUser.get("id"),body:""},parse:function(t,n){if(!t.Message)return t;t.User&&(t.Message.User=t.User);var r=parseInt(t.Message.user_id,10),i=parseInt(e.CurrentUser.get("id"),10);return t.Message.is_own=r===i,t.Message},url:function(){return"/messages"+(this.id?"/"+this.get("id"):"")},validate:function(e,t){var n=[];e.user_id||n.push("Who is sending this message???"),e.to_user_id||n.push("The destinatary has not been set"),(!e.body||e.body.length<2)&&n.push("The message is too short, 2 characters or more, please"),e.body.length>2048&&n.push("The message is too long, 2048 characters or less, please");if(!_.isEmpty(n))return n}})}),define("text!templates/conversations/modal_add.html",[],function(){return'<div class="modal contained"><header class="contained-header"><h1 class="contained-title continue">New Conversation</h1></header><section class="contained-body col-large-12"><div class="col-large-6 col-small-12 continue text-big-32" id="destinatary">&nbsp;</div><div class="col-large-6 col-small-12 relative"><input id="username" type="text" class="full" name="username" placeholder="Search by username"><div class="live-search-list"></div></div><div class="col-large-12 input textarea"><textarea name="body" id="body" rows="7" class="full" placeholder="Your message"></textarea></div><div class="col-large-6 col-small-12"></div></section><footer class="contained-footer col-large-12"><div class="col-large-6 col-small-12"><button class="button block js-submit">Send message</button></div><div class="col-large-6 col-small-12"><button class="button button-blue block js-close">Cancel</button></div></footer></div>'}),define("modules/conversations/views/modal_add",["app","modules/common/views/modal","modules/users/helpers/search","models/message","models/user","text!templates/conversations/modal_add.html"],function(e,t,n,r,i,s){var o=function(){e.trigger("app:popup",{data:{pclass:"error-message",message:"An error happened while saving your new message and conversation. Please try again and report if you see this error again."}})},u=function(){e.trigger("app:popup",{data:{pclass:"success-message",message:"Your message was sent sucessfully!"}})},a=_.template("To: <strong><%- username %></strong>");return t.extend({template:_.template(s),events:{click:"shouldClose","click .js-close":"unrender","click .js-submit":"submitClicked"},initialize:function(e){var t=e.user;t instanceof Backbone.Model?this.user=e.user:this.user=new i(e.userData||{},{parse:!0}),this.model=new r,this.afterInit(),this.render()},onShow:function(){this.search=new n({el:this.$("#username"),type:"find"}),this.user.get("id")?this.setDestinatary(this.user):this.listenTo(e,"set:destinatary",this.setDestinatary)},setDestinatary:function(e){this.model.set({to_user_id:e.get("id")}),this.user.set(e.toJSON()),this.renderDestinatary()},renderDestinatary:function(){this.$("#destinatary").html(a(this.user.toJSON()))},submitClicked:function(e){e.preventDefault();var t=this;this.model.set({body:this.$("textarea").val()}),this.saveMessage()},saveMessage:function(){var t=this;this.model.save(this.model.toJSON(),{wait:!0,error:o,success:function(){u(),e.trigger("conversation:created"),t.close()}})}})}),define("modules/comments/controller",["app","modules/comments/views/layout","modules/comments/views/index","modules/comments/views/form","modules/comments/views/threaded_comment","modules/comments/views/children","modules/comments/views/one_comment","modules/common/views/user_live_search","entities/comment","entities/user","entities/vote"],function(e,t,n,r,i,s,o,u){var a=e.request("entities:users:collection");a.listenTo(e,"register:user",function(e){this.add(e)});var f=e.request("entities:users:collection");f.url=function(){return"/"+["users","search","find",this.username].join("/")+".json"},f.comparator=function(e,t){return e.get("username")>t.get("username")};var l=function(){e.trigger("app:error","It was impossible to delete this comment, please report you saw this error.")},c=function(){e.trigger("app:error","It was impossible to update this comment, please report you saw this error.")};e.module("CommentsApp",function(e,r,i,u){e.Controller=u.Controller.extend({prepare:function(e){var i=r.request("entities:comments:collection",e);"Question"===e.object_class&&(i.comparator=function(e,t){return e.get("points")<t.get("points")},i.sort());var u=new t,a=new n({collection:i});a.listenTo(r,"app:scroll",function(){a.shouldLoad()&&(a.stopListening(r,"app:scroll"),i.fetch({wait:!0,reset:!0}))}),a.on("childview:show",function(e){var t=new o({model:e.model}),n=r.request("entities:comments:children",e.model.get("children")),i=new s({model:e.model,collection:n});t.on("reply",function(){r.trigger("comment:reply:start"),e.trigger("reply")}),i.on("childview:reply",function(t){r.trigger("comment:reply:start"),e.trigger("reply")}),t.on("comment:delete",function(e){confirm("the comment will be deleted forever, are you 100% sure?")&&e.destroy({wait:!0,error:l})}),i.on("childview:comment:delete",function(e,t){confirm("the comment will be deleted forever, are you 100% sure?")&&t.destroy({wait:!0,error:l})}),t.on("save",function(e){var n=t.model.save(e,{wait:!0,error:c,success:function(){t.editClicked()}})}),i.on("childview:save",function(e,t){var n=e.model.save(t,{wait:!0,error:c,success:function(){e.editClicked()}})}),r.on("new:comment",function(t){t.parent_id==e.model.get("id")&&i.collection.add(t)}),e.commentParent.show(t),e.commentChildren.show(i)}),a.on("childview:reply",function(t){var n=t.model.get("id");t.formRegion.show(h(n,e))}),r.on("comment:reply:cancel",function(){var t="0";u.formRegion.show(h(t,e))}),r.on("user:message",function(e){require(["modules/conversations/views/modal_add"],function(t){new t({user:e})})}),u.on("show",function(){u.listRegion.show(a),r.trigger("app:scroll")}),r.commentsRegion.show(u),r.trigger("comment:reply:cancel")}})});var h=function(t,n){var i=_.extend({parent_id:t},n),s=e.request("entities:comments:new",i),o=new r({model:s});o.on("cancel",function(){var t=s.get("parent_id");"0"!==t&&(e.trigger("comment:reply:cancel"),o.destroy())}),o.listenTo(s,"request",function(){this.$(":input").attr("disabled","disabled")}),o.listenTo(s,"error invalid sync remove",function(){this.$(":input").removeAttr("disabled")}),o.on("save:comment",function(t){var n=s.save(t,{wait:!0,success:function(t){var n=t.toJSON();e.trigger("new:comment",n),t.clear(i),o.$("textarea").val("")}})});var l=new u({collection:f});return l.on("childview:user:selected",function(e,t){o.userSelected(t),f.reset()}),o.on("destroy",function(){l.destroy()}),o.on("users:search",function(e){var t=a.findByUsername(e);t.length>0?(f.reset(t),o.searchRegion.show(l)):(o.timer&&clearTimeout(o.timer),f.username=e,o.timer=setTimeout(function(){f.fetch({wait:!0,reset:!0})},400))}),o.on("users:none",function(){f.reset()}),o};return e.CommentsApp.Controller}),define("modules/news/router",["app","backbone"],function(e,t){e.Applications.news=t.Router.extend({routes:{"news/add":"newsAdd","news/view/:id":"newsSingle","news(/index)(/page::pagenum)(/sort::field)(/direction::dir)":"newsIndex"},newsIndex:function(){},newsAdd:function(){},newsSingle:function(e){require(["modules/news/views/single","modules/comments/controller"],function(t,n){new t({el:".news.news-single"});var r=new n;r.prepare({object_class:"News",object_id:e})})}})}),define("modules/common/views/exclusive_section",["app","backbone"],function(e,t){return t.View.extend({events:{"click .collapsible-title":"announce"},initialize:function(t){this.$el.is(".force")||(this.listenTo(e,"page:section:display",this.displayMe),this.render())},render:function(){return this.displayMe(),this},announce:function(t){t.preventDefault(),e.trigger("page:section:display",this.el.id)},displayMe:function(e){e===this.el.id?this.$el.children(".collapsible-content").slideDown():this.$el.children(".collapsible-content").slideUp()}})}),define("modules/pages/views/index",["app","backbone","modules/common/views/exclusive_section"],function(e,t,n){return t.View.extend({initialize:function(){this.hookSections()},hookSections:function(){_.each(this.$("section.collapsible"),function(e){var t=new n({el:$(e)})},this)}})}),define("modules/pages/views/single",["app","backbone"],function(e){return e.View.extend({})}),define("modules/pages/router",["app","backbone"],function(e,t){e.Applications.PagesApp=t.Router.extend({routes:{"pages*args":"pagesIndex","help*args":"pagesIndex","page/:pageSlug":"pagesSingle","upload-rules":"pagesSingle",welcome:"pagesSingle",markdown:"pagesSingle",status:"pagesSingle"},pagesIndex:function(e){require(["modules/pages/views/index"],function(e){new e({el:$(".page-content")})})},pagesSingle:function(e){require(["modules/pages/views/single"],function(e){new e({el:$(".page-content")})})}})}),define("models/medium",["backbone"],function(e){return e.Model.extend({url:function(){return"/media"+(this.id?"/"+this.id:"")},parse:function(e){if("undefined"!=typeof e.Media)return e.User&&(e.Media.User=e.User),e.Media;if("undefined"!=typeof e.id)return e;alert("Unable to parse Media data")}})}),define("collections/media",["backbone","models/medium"],function(e,t){return e.Collection.extend({uploading:!1,model:t,initialize:function(e,t){this.object_class=t.object_class,this.object_id=t.object_id,this.on("request",function(e){this.uploading=!0,App.trigger("spinner:on")},this),this.on("sync error remove destroy",function(e){this.uploading=!1,App.trigger("spinner:off")},this)},url:function(){return"/media/index/"+this.object_class+"/"+this.object_id+".json"},parse:function(e){return"undefined"!=typeof e.data?e.data:e},isUploading:function(){return this.uploading}})}),define("text!templates/common/manager_images_image.html",[],function(){return'<div class="<%- (\'default\' == status) ? \'box-green\' : \'box-pale-green\' %> managed-image relative"><img src="<%- small %>" alt="<%- body %>" class="block" width="100%" height="auto"><% if (\'News\' == object_class || \'Page\' == object_class) { %><ul class="image-sizes"><li class="small"><a href="<%- thumb %>"><img src="<%- thumb %>" alt="Thumb" width="100%"> <small>96px</small></a></li><li class="normal"><a href="<%- small %>"><img src="<%- small %>" alt="Small" width="100%"> <small>256px</small></a></li><li class="text-big-22"><a href="<%- medium %>"><img src="<%- medium %>" alt="Medium" width="100%"> <small>512px</small></a></li><li class="text-big-24"><a href="<%- large %>"><img src="<%- large %>" alt="Big" width="100%"> <small>512px</small></a></li></ul><% } %><div class="actions"><% if ("default" === status) { %><span class="icon-check green" title="This is the default file"></span><% } else { %> <span class="icon-check clk js-default" title="Click to set as default"></span><% } %> <span class="icon-close clk red js-delete"></span></div></div>'}),define("modules/common/views/manager_images_image",["app","backbone","text!templates/common/manager_images_image.html"],function(e,t,n){var r=function(){e.trigger("app:popup",{data:{pclass:"alert-message",message:"This file is set as default so it can not be deleted. You 'll have to set another file as default before deleting this one."}})},i=function(){e.trigger("app:popup",{data:{pclass:"error-message",message:"There was an error when deleting this image entry. Please try again."}})},s=function(){e.trigger("app:popup",{data:{pclass:"error-message",message:"There was an error when updating the image status. Please try again."}})};return t.View.extend({className:"col-large-4 col-medium-6",template:_.template(n),events:{"click .js-delete":"deleteClicked","click .icon-check":"setAsDefault"},initialize:function(t){this.listenTo(this.model,"change",this.render),this.listenTo(this.model,"destroy",this.unrender),this.listenTo(e,"default:set",this.myStatus)},render:function(){return this.$el.html(this.template(this.model.toJSON())),this},myStatus:function(e){if(e===this.model.get("id"))return;this.model.set({status:"normal"})},deleteClicked:function(e){e.preventDefault();if("default"===this.model.get("status")){alert("This is the default image for this entry!\nYou can't delete it until you set another image as default.");return}confirm("The image will be deleted forever, are you sure?")&&this.model.destroy({wait:!0,error:i})},setAsDefault:function(){if("default"===this.model.get("status")){r();return}var t=this.model.save({status:"default"},{wait:!0,success:function(t){e.trigger("default:set",t.get("id"))}});t||s()}})}),define("text!templates/common/manager_images_dropzone.html",[],function(){return'<% if (uploading) { %><div class="progress-track"><div class="progress-bar"></div></div><% } else { %><div class="dropzone" id="dropzone"><p>Drag and drop images into this box ;)</p><p><input multiple="multiple" type="file" accept=".jpg,.jpeg,.png"></p></div><% } %>'}),define("modules/common/views/manager_images",["app","backbone","collections/media","modules/common/views/manager_images_image","text!templates/common/manager_images_dropzone.html"],function(e,t,n,r,i){var s=function(){e.trigger("app:info","Wait just a few moments while the upload in progress finishes...")},o=function(){e.trigger("app:warning","No files were added to the upload queue, please try again!")},u=function(t){e.trigger("app:error","The file "+t.name+" was NOT added to the upload queue, please try again!")},a=function(){e.trigger("app:error","The file was rejected by the server, maybe it's too small? Please upload images bigger than 1024 PX **WIDE AND TALL**")},f=$("<div>",{"class":"info-message with-icon",text:"You haven't uploaded any images yet :p"}),l=$("<div>",{"class":"col-large-12"}).append(f);return t.View.extend({typeTest:/(jpe?|pn)g$/i,dzTemplate:_.template(i),events:{"drop .dropzone":"dropTriggered","dragend .dropzone":"dragOffTriggered","dragover .dropzone":"dragOnTriggered","dragenter .dropzone":"dragOnTriggered","dragleave .dropzone":"dragOffTriggered","change input[type='file']":"dropTriggered"},initialize:function(e){this.imgClassName=e.imgClassName||"col-large-3 col-medium-4 col-small-6",this.imagesList=this.$("#images-list"),this.dropzone=this.$("#dropzone-cage"),this.collection=new n(null,{object_class:e.object_class,object_id:e.object_id||this.model.get("id")}),this.listenTo(this.collection,"add",this.renderOneImage),this.listenTo(this.collection,"request sync error remove destroy",this.renderDropzone),this.collection.fetch({wait:!0,parse:!0}),this.onWindowClose(),this.render()},onWindowClose:function(){var e=this;window.onbeforeunload=function(){if(e.collection.isUploading())return confirm("There are uploads in progress right now,\nif you leave this page they won't be completed.\nAre you sure you want to leave this page?")}},render:function(){return this.imagesList.empty(),this},renderOneImage:function(e){var t=new r({model:e,className:this.imgClassName});this.imagesList.append(t.render().el)},renderDropzone:function(){this.dropzone.html(this.dzTemplate({uploading:this.collection.isUploading()}))},dragOnTriggered:function(e){e&&e.preventDefault(),this.dropzone.addClass("success-message")},dragOffTriggered:function(e){e&&e.preventDefault(),this.dropzone.removeClass("success-message")},dropTriggered:function(e){this.dragOffTriggered(e);var t=this;if(this.collection.isUploading()){s();return}var n=e.originalEvent,r=n.dataTransfer?n.dataTransfer.files:e.target.files;if(!r)return alert("Code error when uploading files, please report you saw this!"),!1;var i,a,f=0,l=r.length,c=new FormData;for(var h=0;h<l;h++)a=r[h],a.name.match(this.typeTest)?(i=new FileReader,i.readAsDataURL(a),c.append("data[]",a),f++):u(a);f?this.uploadFiles(c):o()},uploadFiles:function(t){var n=this,r=function(e){if(e.lengthComputable){var t=Math.floor(e.loaded/e.total*100);n.$(".progress-bar").css({width:t+"%"})}};this.collection.uploading=!0;var i="/media/add/"+this.collection.object_class+"/"+this.collection.object_id+".json";if(t){var s={type:"POST",cache:!1,data:t,accepts:"json",dataType:"json",url:i,processData:!1,contentType:!1,xhr:function(){var e=new window.XMLHttpRequest;return e.upload.addEventListener("progress",r,!1),e},error:function(){a(),n.renderDropzone()},success:function(t,r,i){t.data&&n.collection.add(t,{parse:!0}),t.report&&t.report.length>=1&&e.trigger("app:popup",{data:{pclass:"alert-message",message:t.report.join(". ")}})},complete:function(){n.collection.uploading=!1,n.renderDropzone()}},o=$.ajax(s);n.renderDropzone()}}})}),define("modules/media/views/portfolio",["app","backbone","models/user","modules/common/views/manager_images"],function(e,t,n,r){return t.View.extend({initialize:function(e){var t=this.loadFromScript();t&&(this.model=new n(t,{parse:!0}),this.loadDependencies())},loadDependencies:function(){var e=this;require(["modules/common/views/manager_images"],function(t){new t({el:e.$("#manager-images"),model:e.model,object_class:"User",imgClassName:"col-large-3 col-medium-4 col-small-6"})})}})}),define("modules/media/router",["app","backbone"],function(e,t){e.Applications.Media=t.Router.extend({routes:{"media/portfolio/:userID":"portfolio"},portfolio:function(e){require(["modules/media/views/portfolio"],function(t){new t({el:"#portfolio-manager",object_class:"User",object_id:e})})}})}),define("entities/blend",["app","entities/base"],function(e){return e.module("Entities",function(t){t.BlendModel=t.BaseModel.extend({defaults:{title:"",body:"",tags:"",views:0,downloads:0,three_dee:"",categories:[],blend_license:"CC-BY",status:"incomplete",blender_version:e.MAX_BLENDER_VERSION,is_fan_art:null,is_staff_pick:!1,render_engine:"Internal",user_id:e.CurrentUser.get("id")},url:function(){return"/blends"+this.getUrlID()},parse:function(t){return t.id?("boolean"==typeof t.is_fan_art&&(t.is_fan_art=t.is_fan_art?"1":"0"),t):t.Blend?(t.User&&(t.Blend.User=t.User),t.Image&&(t.Blend.Image=t.Image),t.BlendFile&&(t.Blend.BlendFile=t.BlendFile),t.Follow&&(t.Blend.Follow=t.Follow),t.Response&&(t.Blend.Response=t.Response),"boolean"==typeof t.Blend.is_fan_art&&(t.Blend.is_fan_art=t.Blend.is_fan_art?"1":"0"),"boolean"==typeof t.Blend.is_staff_pick&&(t.Blend.is_staff_pick=t.Blend.is_staff_pick?"1":"0"),t.Termrel&&t.Termrel[0]&&(t.Blend.Termrel=t.Termrel,this.parseTaxa(t)),t.Blend):(e.trigger("app:error","There was an error when parsing a blend objectPlease report you saw this error!"),this.defaults)},parseTaxa:function(e){var t=[];e.Blend.Category=[],e.Blend.categories=[],e.Blend.Tag=[],e.Blend.tags="",e.Termrel&&(_.each(e.Termrel,function(n){"category"===n.Term.type?(e.Blend.Category.push(n),e.Blend.categories.push(n.Term.id)):"tag"===n.Term.type&&(e.Blend.Tag.push(n),t.push(n.Term.name))},this),_.isEmpty(t)||(e.Blend.tags=t.join(", ")))},validate:function(t){var n=[],r=[this.get("status")];n.push(this.validateText(t.title,"title",2,64)),n.push(this.validateText(t.body,"description",50,5e3,!0)),n.push(this.validateThreeDee(t.three_dee)),n.push(this.validateBlenderVersion(t.blender_version)),n.push(this.validateLicense(t.blend_license)),e.CurrentUser.isAdmin()||n.push(this.validateAllowed(this.get("status"),r)),n.push(this.validateTags(t.tags)),n.push(this.validateArrayTaxa(t.categories,"categories",1,5)),n.push(this.validateIsFanArt(t.is_fan_art)),n=this.cleanErrors(n);if(!_.isEmpty(n))return n}}),t.BlendsCollection=t.BaseCollection.extend({model:t.BlendModel}),e.reqres.setHandler("entities:blends:new",function(){return new t.BlendModel}),e.reqres.setHandler("entities:blends:single",function(e){return new t.BlendModel({id:e})}),e.reqres.setHandler("entities:blends:index",function(e,n){return new t.BlendsCollection(e,n)}),e.reqres.setHandler("entities:blends:collection",function(){return new t.BlendsCollection})}),e.Entities}),define("collections/blends",["backbone","entities/blend"],function(e,t){return e.Collection.extend({page:null,sortField:null,sortDirection:null,model:t.BlendModel,url:function(){return"/blends/index"+(this.page?"/page:"+this.page:"")+(this.sortField?"/sort:"+this.sortField:"")+(this.sortDirection?"/direction:"+this.sortDirection:"")+(this.page?"/page:"+this.page:"")+".json"}})}),define("modules/blends/views/index_item",["app","backbone"],function(e,t){return t.View.extend({events:{"click .js-like":"likeClicked"},initialize:function(){var t=this.model.get("id"),n="blend:liked:"+t;this.listenTo(e,n,this.setLiked),this.listenTo(this.model,"change:liked",this.renderLiked),this.likeButton=this.$(".like-button")},render:function(){e.isLoggedIn()&&this.likeButton.addClass("clk"),e.trigger("blend:liked:get",this.model.get("id"))},renderLiked:function(){this.model.get("liked")?this.likeButton.addClass("red"):this.likeButton.removeClass("red")},setLiked:function(e){this.model.set({liked:Boolean(e)})},likeClicked:function(t){t.preventDefault(),t.stopPropagation(),e.trigger("blend:liked:manage",this.model.get("id"))}})}),define("modules/blends/views/index",["app","backbone","collections/blends","modules/blends/views/index_item"],function(e,t,n,r){return t.View.extend({initialize:function(){this.collection=new n,this.renderList()},renderList:function(){_.each($(".index-blend.blend"),function(e){var t=this.loadFromScript($(e));if(t){var n=this.collection.add(t,{parse:!0});this.renderOneBlend(n,e)}},this)},renderOneBlend:function(e,t){var n=new r({el:t,model:e});n.render()}})}),define("text!templates/stats_box.html",[],function(){return'<div class="contained marker-pale-gray subtle-pop"><header class="contained-header"><h3 class="contained-title continue"><img src="<%- Image[0].thumb %>" width="40px" height="40px" alt="" class="align-left"> <a href="/blends/view/<%- Blend.id %>" target="_blank"><%- Blend.title %></a></h3></header><section class="contained-body col-large-12"><p class="col-large-12">Downloads in the last 30 days:</p><div class="col-large-12"><div class="stats-plot box-pale-white subtle-pop" id="stats-plot-<%- Blend.id %>"></div></div><div class="col-large-3 col-medium-4 col-small-6"><div class="box-pale-white subtle-pop text-center"><span class="text-big-32 strong green"><%- MonthDownload.length %></span><br><span class="icon-cloud-download"></span> This Month</div></div><div class="col-large-3 col-medium-4 col-small-6"><div class="box-pale-white subtle-pop text-center"><span class="text-big-32 strong green"><%- Blend.downloads %></span><br><span class="icon-cloud-download"></span> All Time</div></div><div class="col-large-3 col-medium-4 col-small-6"><div class="box-pale-white subtle-pop text-center"><span class="text-big-32 strong green"><%- MonthLike.length %></span><br><span class="icon-heart-full"></span> This Month</div></div><div class="col-large-3 col-medium-4 col-small-6"><div class="box-pale-white subtle-pop text-center"><span class="text-big-32 strong green"><%- Blend.item_count %></span><br><span class="icon-heart-full"></span> All Time</div></div><div class="col-large-3 col-medium-4 col-small-6"><div class="box-pale-white subtle-pop text-center"><span class="text-big-32 strong green"><%- Collection.length %></span><br><span class="icon-folder-plus"></span> Collections</div></div><div class="col-large-3 col-medium-4 col-small-6"><div class="box-pale-white subtle-pop text-center"><span class="text-big-32 strong green"><%- Blend.comment_count %></span><br><span class="icon-comment"></span> Comments</div></div><div class="col-large-3 col-medium-4 col-small-6"><div class="box-pale-white subtle-pop text-center"><span class="text-big-32 strong green"><%- Image.length %></span><br><span class="icon-image"></span> Images</div></div><div class="col-large-3 col-medium-4 col-small-6"><div class="box-pale-white subtle-pop text-center"><span class="text-big-32 strong green"><%- BlendFile.length %></span><br><span class="icon-blender"></span> Blend Files</div></div><div class="col-large-12"><%- Blend.downloads %>downloads from<%- Blend.views %>views result in<%- ((Blend.downloads / Blend.views) * 100).toFixed(2) %>% download rate. Download rates above 25% are considered good.</div></section></div>'}),function(e){var t="0.4.2",n="hasOwnProperty",r=/[\.\/]/,i="*",s=function(){},o=function(e,t){return e-t},u,a,f={n:{}},l=function(e,t){e=String(e);var n=f,r=a,i=Array.prototype.slice.call(arguments,2),s=l.listeners(e),c=0,h=!1,p,d=[],v={},m=[],g=u,y=[];u=e,a=0;for(var b=0,w=s.length;b<w;b++)"zIndex"in s[b]&&(d.push(s[b].zIndex),s[b].zIndex<0&&(v[s[b].zIndex]=s[b]));d.sort(o);while(d[c]<0){p=v[d[c++]],m.push(p.apply(t,i));if(a)return a=r,m}for(b=0;b<w;b++){p=s[b];if("zIndex"in p)if(p.zIndex==d[c]){m.push(p.apply(t,i));if(a)break;do{c++,p=v[d[c]],p&&m.push(p.apply(t,i));if(a)break}while(p)}else v[p.zIndex]=p;else{m.push(p.apply(t,i));if(a)break}}return a=r,u=g,m.length?m:null};l._events=f,l.listeners=function(e){var t=e.split(r),n=f,s,o,u,a,l,c,h,p,d=[n],v=[];for(a=0,l=t.length;a<l;a++){p=[];for(c=0,h=d.length;c<h;c++){n=d[c].n,o=[n[t[a]],n[i]],u=2;while(u--)s=o[u],s&&(p.push(s),v=v.concat(s.f||[]))}d=p}return v},l.on=function(e,t){e=String(e);if(typeof t!="function")return function(){};var n=e.split(r),i=f;for(var o=0,u=n.length;o<u;o++)i=i.n,i=i.hasOwnProperty(n[o])&&i[n[o]]||(i[n[o]]={n:{}});i.f=i.f||[];for(o=0,u=i.f.length;o<u;o++)if(i.f[o]==t)return s;return i.f.push(t),function(e){+e==+e&&(t.zIndex=+e)}},l.f=function(e){var t=[].slice.call(arguments,1);return function(){l.apply(null,[e,null].concat(t).concat([].slice.call(arguments,0)))}},l.stop=function(){a=1},l.nt=function(e){return e?(new RegExp("(?:\\.|\\/|^)"+e+"(?:\\.|\\/|$)")).test(u):u},l.nts=function(){return u.split(r)},l.off=l.unbind=function(e,t){if(!e){l._events=f={n:{}};return}var s=e.split(r),o,u,a,c,h,p,d,v=[f];for(c=0,h=s.length;c<h;c++)for(p=0;p<v.length;p+=a.length-2){a=[p,1],o=v[p].n;if(s[c]!=i)o[s[c]]&&a.push(o[s[c]]);else for(u in o)o[n](u)&&a.push(o[u]);v.splice.apply(v,a)}for(c=0,h=v.length;c<h;c++){o=v[c];while(o.n){if(t){if(o.f){for(p=0,d=o.f.length;p<d;p++)if(o.f[p]==t){o.f.splice(p,1);break}!o.f.length&&delete o.f}for(u in o.n)if(o.n[n](u)&&o.n[u].f){var m=o.n[u].f;for(p=0,d=m.length;p<d;p++)if(m[p]==t){m.splice(p,1);break}!m.length&&delete o.n[u].f}}else{delete o.f;for(u in o.n)o.n[n](u)&&o.n[u].f&&delete o.n[u].f}o=o.n}}},l.once=function(e,t){var n=function(){return l.unbind(e,n),t.apply(this,arguments)};return l.on(e,n)},l.version=t,l.toString=function(){return"You are running Eve "+t},typeof module!="undefined"&&module.exports?module.exports=l:typeof define!="undefined"?define("eve",[],function(){return l}):e.eve=l}(window||this),function(e,t){typeof define=="function"&&define.amd?define("raphael",["eve"],function(n){return t(e,n)}):t(e,e.eve||typeof require=="function"&&require("eve"))}(this,function(e,t){function n(e){if(n.is(e,"function"))return r?e():t.on("raphael.DOMload",e);if(n.is(e,_))return n._engine.create[d](n,e.splice(0,3+n.is(e[0],O))).add(e);var i=Array.prototype.slice.call(arguments,0);if(n.is(i[i.length-1],"function")){var s=i.pop();return r?s.call(n._engine.create[d](n,i)):t.on("raphael.DOMload",function(){s.call(n._engine.create[d](n,i))})}return n._engine.create[d](n,arguments)}function dt(e){if(typeof e=="function"||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)e[a](n)&&(t[n]=dt(e[n]));return t}function St(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function xt(e,t,n){function r(){var i=Array.prototype.slice.call(arguments,0),s=i.join("␀"),o=r.cache=r.cache||{},u=r.count=r.count||[];return o[a](s)?(St(u,s),n?n(o[s]):o[s]):(u.length>=1e3&&delete o[u.shift()],u.push(s),o[s]=e[d](t,i),n?n(o[s]):o[s])}return r}function Nt(){return this.hex}function Ct(e,t){var n=[];for(var r=0,i=e.length;i-2*!t>r;r+=2){var s=[{x:+e[r-2],y:+e[r-1]},{x:+e[r],y:+e[r+1]},{x:+e[r+2],y:+e[r+3]},{x:+e[r+4],y:+e[r+5]}];t?r?i-4==r?s[3]={x:+e[0],y:+e[1]}:i-2==r&&(s[2]={x:+e[0],y:+e[1]},s[3]={x:+e[2],y:+e[3]}):s[0]={x:+e[i-2],y:+e[i-1]}:i-4==r?s[3]=s[2]:r||(s[0]={x:+e[r],y:+e[r+1]}),n.push(["C",(-s[0].x+6*s[1].x+s[2].x)/6,(-s[0].y+6*s[1].y+s[2].y)/6,(s[1].x+6*s[2].x-s[3].x)/6,(s[1].y+6*s[2].y-s[3].y)/6,s[2].x,s[2].y])}return n}function Lt(e,t,n,r,i){var s=-3*t+9*n-9*r+3*i,o=e*s+6*t-12*n+6*r;return e*o-3*t+3*n}function At(e,t,n,r,i,s,o,u,a){a==null&&(a=1),a=a>1?1:a<0?0:a;var f=a/2,l=12,c=[-0.1252,.1252,-0.3678,.3678,-0.5873,.5873,-0.7699,.7699,-0.9041,.9041,-0.9816,.9816],h=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],p=0;for(var d=0;d<l;d++){var v=f*c[d]+f,m=Lt(v,e,n,i,o),g=Lt(v,t,r,s,u),y=m*m+g*g;p+=h[d]*T.sqrt(y)}return f*p}function Ot(e,t,n,r,i,s,o,u,a){if(a<0||At(e,t,n,r,i,s,o,u)<a)return;var f=1,l=f/2,c=f-l,h,p=.01;h=At(e,t,n,r,i,s,o,u,c);while(k(h-a)>p)l/=2,c+=(h<a?1:-1)*l,h=At(e,t,n,r,i,s,o,u,c);return c}function Mt(e,t,n,r,i,s,o,u){if(N(e,n)<C(i,o)||C(e,n)>N(i,o)||N(t,r)<C(s,u)||C(t,r)>N(s,u))return;var a=(e*r-t*n)*(i-o)-(e-n)*(i*u-s*o),f=(e*r-t*n)*(s-u)-(t-r)*(i*u-s*o),l=(e-n)*(s-u)-(t-r)*(i-o);if(!l)return;var c=a/l,h=f/l,p=+c.toFixed(2),d=+h.toFixed(2);if(p<+C(e,n).toFixed(2)||p>+N(e,n).toFixed(2)||p<+C(i,o).toFixed(2)||p>+N(i,o).toFixed(2)||d<+C(t,r).toFixed(2)||d>+N(t,r).toFixed(2)||d<+C(s,u).toFixed(2)||d>+N(s,u).toFixed(2))return;return{x:c,y:h}}function _t(e,t){return Pt(e,t)}function Dt(e,t){return Pt(e,t,1)}function Pt(e,t,r){var i=n.bezierBBox(e),s=n.bezierBBox(t);if(!n.isBBoxIntersect(i,s))return r?0:[];var o=At.apply(0,e),u=At.apply(0,t),a=N(~~(o/5),1),f=N(~~(u/5),1),l=[],c=[],h={},p=r?0:[];for(var d=0;d<a+1;d++){var v=n.findDotsAtSegment.apply(n,e.concat(d/a));l.push({x:v.x,y:v.y,t:d/a})}for(d=0;d<f+1;d++)v=n.findDotsAtSegment.apply(n,t.concat(d/f)),c.push({x:v.x,y:v.y,t:d/f});for(d=0;d<a;d++)for(var m=0;m<f;m++){var g=l[d],y=l[d+1],b=c[m],w=c[m+1],E=k(y.x-g.x)<.001?"y":"x",S=k(w.x-b.x)<.001?"y":"x",x=Mt(g.x,g.y,y.x,y.y,b.x,b.y,w.x,w.y);if(x){if(h[x.x.toFixed(4)]==x.y.toFixed(4))continue;h[x.x.toFixed(4)]=x.y.toFixed(4);var T=g.t+k((x[E]-g[E])/(y[E]-g[E]))*(y.t-g.t),L=b.t+k((x[S]-b[S])/(w[S]-b[S]))*(w.t-b.t);T>=0&&T<=1.001&&L>=0&&L<=1.001&&(r?p++:p.push({x:x.x,y:x.y,t1:C(T,1),t2:C(L,1)}))}}return p}function Ht(e,t,r){e=n._path2curve(e),t=n._path2curve(t);var i,s,o,u,a,f,l,c,h,p,d=r?0:[];for(var v=0,m=e.length;v<m;v++){var g=e[v];if(g[0]=="M")i=a=g[1],s=f=g[2];else{g[0]=="C"?(h=[i,s].concat(g.slice(1)),i=h[6],s=h[7]):(h=[i,s,i,s,a,f,a,f],i=a,s=f);for(var y=0,b=t.length;y<b;y++){var w=t[y];if(w[0]=="M")o=l=w[1],u=c=w[2];else{w[0]=="C"?(p=[o,u].concat(w.slice(1)),o=p[6],u=p[7]):(p=[o,u,o,u,l,c,l,c],o=l,u=c);var E=Pt(h,p,r);if(r)d+=E;else{for(var S=0,x=E.length;S<x;S++)E[S].segment1=v,E[S].segment2=y,E[S].bez1=h,E[S].bez2=p;d=d.concat(E)}}}}}return d}function rn(e,t,n,r,i,s){e!=null?(this.a=+e,this.b=+t,this.c=+n,this.d=+r,this.e=+i,this.f=+s):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function bn(){return this.x+y+this.y}function wn(){return this.x+y+this.y+y+this.width+" × "+this.height}function _n(e,t,n,r,i,s){function h(e){return((a*e+u)*e+o)*e}function p(e,t){var n=d(e,t);return((c*n+l)*n+f)*n}function d(e,t){var n,r,i,s,f,l;for(i=e,l=0;l<8;l++){s=h(i)-e;if(k(s)<t)return i;f=(3*a*i+2*u)*i+o;if(k(f)<1e-6)break;i-=s/f}n=0,r=1,i=e;if(i<n)return n;if(i>r)return r;while(n<r){s=h(i);if(k(s-e)<t)return i;e>s?n=i:r=i,i=(r-n)/2+n}return i}var o=3*t,u=3*(r-t)-o,a=1-o-u,f=3*n,l=3*(i-n)-f,c=1-f-l;return p(e,1/(200*s))}function Dn(e,t){var n=[],r={};this.ms=t,this.times=1;if(e){for(var i in e)e[a](i)&&(r[W(i)]=e[i],n.push(W(i)));n.sort(st)}this.anim=r,this.top=n[n.length-1],this.percents=n}function Pn(e,r,s,o,u,f){s=W(s);var l,c,h,p=[],d,m,g,y=e.ms,E={},S={},x={};if(o)for(N=0,C=Ln.length;N<C;N++){var T=Ln[N];if(T.el.id==r.id&&T.anim==e){T.percent!=s?(Ln.splice(N,1),h=1):c=T,r.attr(T.totalOrigin);break}}else o=+S;for(var N=0,C=e.percents.length;N<C;N++){if(e.percents[N]==s||e.percents[N]>o*e.top){s=e.percents[N],m=e.percents[N-1]||0,y=y/e.top*(s-m),d=e.percents[N+1],l=e.anim[s];break}o&&r.attr(e.anim[e.percents[N]])}if(!l)return;if(!c){for(var k in l)if(l[a](k))if(J[a](k)||r.paper.customAttributes[a](k)){E[k]=r.attr(k),E[k]==null&&(E[k]=$[k]),S[k]=l[k];switch(J[k]){case O:x[k]=(S[k]-E[k])/y;break;case"colour":E[k]=n.getRGB(E[k]);var L=n.getRGB(S[k]);x[k]={r:(L.r-E[k].r)/y,g:(L.g-E[k].g)/y,b:(L.b-E[k].b)/y};break;case"path":var A=Xt(E[k],S[k]),M=A[1];E[k]=A[0],x[k]=[];for(N=0,C=E[k].length;N<C;N++){x[k][N]=[0];for(var _=1,D=E[k][N].length;_<D;_++)x[k][N][_]=(M[N][_]-E[k][N][_])/y}break;case"transform":var P=r._,H=nn(P[k],S[k]);if(H){E[k]=H.from,S[k]=H.to,x[k]=[],x[k].real=!0;for(N=0,C=E[k].length;N<C;N++){x[k][N]=[E[k][N][0]];for(_=1,D=E[k][N].length;_<D;_++)x[k][N][_]=(S[k][N][_]-E[k][N][_])/y}}else{var B=r.matrix||new rn,j={_:{transform:P.transform},getBBox:function(){return r.getBBox(1)}};E[k]=[B.a,B.b,B.c,B.d,B.e,B.f],en(j,S[k]),S[k]=j._.transform,x[k]=[(j.matrix.a-B.a)/y,(j.matrix.b-B.b)/y,(j.matrix.c-B.c)/y,(j.matrix.d-B.d)/y,(j.matrix.e-B.e)/y,(j.matrix.f-B.f)/y]}break;case"csv":var F=b(l[k])[w](i),I=b(E[k])[w](i);if(k=="clip-rect"){E[k]=I,x[k]=[],N=I.length;while(N--)x[k][N]=(F[N]-E[k][N])/y}S[k]=F;break;default:F=[][v](l[k]),I=[][v](E[k]),x[k]=[],N=r.paper.customAttributes[k].length;while(N--)x[k][N]=((F[N]||0)-(I[N]||0))/y}}var q=l.easing,U=n.easing_formulas[q];if(!U){U=b(q).match(R);if(U&&U.length==5){var z=U;U=function(e){return _n(e,+z[1],+z[2],+z[3],+z[4],y)}}else U=ut}g=l.start||e.start||+(new Date),T={anim:e,percent:s,timestamp:g,start:g+(e.del||0),status:0,initstatus:o||0,stop:!1,ms:y,easing:U,from:E,diff:x,to:S,el:r,callback:l.callback,prev:m,next:d,repeat:f||e.times,origin:r.attr(),totalOrigin:u},Ln.push(T);if(o&&!c&&!h){T.stop=!0,T.start=new Date-y*o;if(Ln.length==1)return On()}h&&(T.start=new Date-T.ms*o),Ln.length==1&&An(On)}else c.initstatus=o,c.start=new Date-c.ms*o;t("raphael.anim.start."+r.id,r,e)}function Hn(e){for(var t=0;t<Ln.length;t++)Ln[t].el.paper==e&&Ln.splice(t--,1)}n.version="2.1.2",n.eve=t;var r,i=/[, ]+/,s={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},o=/\{(\d+)\}/g,u="prototype",a="hasOwnProperty",f={doc:document,win:e},l={was:Object.prototype[a].call(f.win,"Raphael"),is:f.win.Raphael},c=function(){this.ca=this.customAttributes={}},h,p="appendChild",d="apply",v="concat",m="ontouchstart"in f.win||f.win.DocumentTouch&&f.doc instanceof DocumentTouch,g="",y=" ",b=String,w="split",E="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[w](y),S={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},x=b.prototype.toLowerCase,T=Math,N=T.max,C=T.min,k=T.abs,L=T.pow,A=T.PI,O="number",M="string",_="array",D="toString",P="fill",H=Object.prototype.toString,B={},j="push",F=n._ISURL=/^url\(['"]?(.+?)['"]?\)$/i,I=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i,q={NaN:1,Infinity:1,"-Infinity":1},R=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,U=T.round,z="setAttribute",W=parseFloat,X=parseInt,V=b.prototype.toUpperCase,$=n._availableAttrs={"arrow-end":"none","arrow-start":"none",blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",transform:"",width:0,x:0,y:0},J=n._availableAnimAttrs={blur:O,"clip-rect":"csv",cx:O,cy:O,fill:"colour","fill-opacity":O,"font-size":O,height:O,opacity:O,path:"path",r:O,rx:O,ry:O,stroke:"colour","stroke-opacity":O,"stroke-width":O,transform:"transform",width:O,x:O,y:O},K=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]/g,Q=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,G={hs:1,rg:1},Y=/,?([achlmqrstvxz]),?/gi,Z=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,et=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,tt=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/ig,nt=n._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,rt={},it=function(e,t){return e.key-t.key},st=function(e,t){return W(e)-W(t)},ot=function(){},ut=function(e){return e},at=n._rectPath=function(e,t,n,r,i){return i?[["M",e+i,t],["l",n-i*2,0],["a",i,i,0,0,1,i,i],["l",0,r-i*2],["a",i,i,0,0,1,-i,i],["l",i*2-n,0],["a",i,i,0,0,1,-i,-i],["l",0,i*2-r],["a",i,i,0,0,1,i,-i],["z"]]:[["M",e,t],["l",n,0],["l",0,r],["l",-n,0],["z"]]},ft=function(e,t,n,r){return r==null&&(r=n),[["M",e,t],["m",0,-r],["a",n,r,0,1,1,0,2*r],["a",n,r,0,1,1,0,-2*r],["z"]]},lt=n._getPath={path:function(e){return e.attr("path")},circle:function(e){var t=e.attrs;return ft(t.cx,t.cy,t.r)},ellipse:function(e){var t=e.attrs;return ft(t.cx,t.cy,t.rx,t.ry)},rect:function(e){var t=e.attrs;return at(t.x,t.y,t.width,t.height,t.r)},image:function(e){var t=e.attrs;return at(t.x,t.y,t.width,t.height)},text:function(e){var t=e._getBBox();return at(t.x,t.y,t.width,t.height)},set:function(e){var t=e._getBBox();return at(t.x,t.y,t.width,t.height)}},ct=n.mapPath=function(e,t){if(!t)return e;var n,r,i,s,o,u,a;e=Xt(e);for(i=0,o=e.length;i<o;i++){a=e[i];for(s=1,u=a.length;s<u;s+=2)n=t.x(a[s],a[s+1]),r=t.y(a[s],a[s+1]),a[s]=n,a[s+1]=r}return e};n._g=f,n.type=f.win.SVGAngle||f.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(n.type=="VML"){var ht=f.doc.createElement("div"),pt;ht.innerHTML='<v:shape adj="1"/>',pt=ht.firstChild,pt.style.behavior="url(#default#VML)";if(!pt||typeof pt.adj!="object")return n.type=g;ht=null}n.svg=!(n.vml=n.type=="VML"),n._Paper=c,n.fn=h=c.prototype=n.prototype,n._id=0,n._oid=0,n.is=function(e,t){return t=x.call(t),t=="finite"?!q[a](+e):t=="array"?e instanceof Array:t=="null"&&e===null||t==typeof e&&e!==null||t=="object"&&e===Object(e)||t=="array"&&Array.isArray&&Array.isArray(e)||H.call(e).slice(8,-1).toLowerCase()==t},n.angle=function(e,t,r,i,s,o){if(s==null){var u=e-r,a=t-i;return!u&&!a?0:(180+T.atan2(-a,-u)*180/A+360)%360}return n.angle(e,t,s,o)-n.angle(r,i,s,o)},n.rad=function(e){return e%360*A/180},n.deg=function(e){return Math.round(e*180/A%360*1e3)/1e3},n.snapTo=function(e,t,r){r=n.is(r,"finite")?r:10;if(n.is(e,_)){var i=e.length;while(i--)if(k(e[i]-t)<=r)return e[i]}else{e=+e;var s=t%e;if(s<r)return t-s;if(s>e-r)return t-s+e}return t};var vt=n.createUUID=function(e,t){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(e,t).toUpperCase()}}(/[xy]/g,function(e){var t=T.random()*16|0,n=e=="x"?t:t&3|8;return n.toString(16)});n.setWindow=function(e){t("raphael.setWindow",n,f.win,e),f.win=e,f.doc=f.win.document,n._engine.initWin&&n._engine.initWin(f.win)};var mt=function(e){if(n.vml){var t=/^\s+|\s+$/g,r;try{var i=new ActiveXObject("htmlfile");i.write("<body>"),i.close(),r=i.body}catch(s){r=createPopup().document.body}var o=r.createTextRange();mt=xt(function(e){try{r.style.color=b(e).replace(t,g);var n=o.queryCommandValue("ForeColor");return n=(n&255)<<16|n&65280|(n&16711680)>>>16,"#"+("000000"+n.toString(16)).slice(-6)}catch(i){return"none"}})}else{var u=f.doc.createElement("i");u.title="Raphaël Colour Picker",u.style.display="none",f.doc.body.appendChild(u),mt=xt(function(e){return u.style.color=e,f.doc.defaultView.getComputedStyle(u,g).getPropertyValue("color")})}return mt(e)},gt=function(){return"hsb("+[this.h,this.s,this.b]+")"},yt=function(){return"hsl("+[this.h,this.s,this.l]+")"},bt=function(){return this.hex},wt=function(e,t,r){t==null&&n.is(e,"object")&&"r"in e&&"g"in e&&"b"in e&&(r=e.b,t=e.g,e=e.r);if(t==null&&n.is(e,M)){var i=n.getRGB(e);e=i.r,t=i.g,r=i.b}if(e>1||t>1||r>1)e/=255,t/=255,r/=255;return[e,t,r]},Et=function(e,t,r,i){e*=255,t*=255,r*=255;var s={r:e,g:t,b:r,hex:n.rgb(e,t,r),toString:bt};return n.is(i,"finite")&&(s.opacity=i),s};n.color=function(e){var t;return n.is(e,"object")&&"h"in e&&"s"in e&&"b"in e?(t=n.hsb2rgb(e),e.r=t.r,e.g=t.g,e.b=t.b,e.hex=t.hex):n.is(e,"object")&&"h"in e&&"s"in e&&"l"in e?(t=n.hsl2rgb(e),e.r=t.r,e.g=t.g,e.b=t.b,e.hex=t.hex):(n.is(e,"string")&&(e=n.getRGB(e)),n.is(e,"object")&&"r"in e&&"g"in e&&"b"in e?(t=n.rgb2hsl(e),e.h=t.h,e.s=t.s,e.l=t.l,t=n.rgb2hsb(e),e.v=t.b):(e={hex:"none"},e.r=e.g=e.b=e.h=e.s=e.v=e.l=-1)),e.toString=bt,e},n.hsb2rgb=function(e,t,n,r){this.is(e,"object")&&"h"in e&&"s"in e&&"b"in e&&(n=e.b,t=e.s,r=e.o,e=e.h),e*=360;var i,s,o,u,a;return e=e%360/60,a=n*t,u=a*(1-k(e%2-1)),i=s=o=n-a,e=~~e,i+=[a,u,0,0,u,a][e],s+=[u,a,a,u,0,0][e],o+=[0,0,u,a,a,u][e],Et(i,s,o,r)},n.hsl2rgb=function(e,t,n,r){this.is(e,"object")&&"h"in e&&"s"in e&&"l"in e&&(n=e.l,t=e.s,e=e.h);if(e>1||t>1||n>1)e/=360,t/=100,n/=100;e*=360;var i,s,o,u,a;return e=e%360/60,a=2*t*(n<.5?n:1-n),u=a*(1-k(e%2-1)),i=s=o=n-a/2,e=~~e,i+=[a,u,0,0,u,a][e],s+=[u,a,a,u,0,0][e],o+=[0,0,u,a,a,u][e],Et(i,s,o,r)},n.rgb2hsb=function(e,t,n){n=wt(e,t,n),e=n[0],t=n[1],n=n[2];var r,i,s,o;return s=N(e,t,n),o=s-C(e,t,n),r=o==0?null:s==e?(t-n)/o:s==t?(n-e)/o+2:(e-t)/o+4,r=(r+360)%6*60/360,i=o==0?0:o/s,{h:r,s:i,b:s,toString:gt}},n.rgb2hsl=function(e,t,n){n=wt(e,t,n),e=n[0],t=n[1],n=n[2];var r,i,s,o,u,a;return o=N(e,t,n),u=C(e,t,n),a=o-u,r=a==0?null:o==e?(t-n)/a:o==t?(n-e)/a+2:(e-t)/a+4,r=(r+360)%6*60/360,s=(o+u)/2,i=a==0?0:s<.5?a/(2*s):a/(2-2*s),{h:r,s:i,l:s,toString:yt}},n._path2string=function(){return this.join(",").replace(Y,"$1")};var Tt=n._preload=function(e,t){var n=f.doc.createElement("img");n.style.cssText="position:absolute;left:-9999em;top:-9999em",n.onload=function(){t.call(this),this.onload=null,f.doc.body.removeChild(this)},n.onerror=function(){f.doc.body.removeChild(this)},f.doc.body.appendChild(n),n.src=e};n.getRGB=xt(function(e){if(!e||!!((e=b(e)).indexOf("-")+1))return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:Nt};if(e=="none")return{r:-1,g:-1,b:-1,hex:"none",toString:Nt};!G[a](e.toLowerCase().substring(0,2))&&e.charAt()!="#"&&(e=mt(e));var t,r,i,s,o,u,f,l=e.match(I);return l?(l[2]&&(s=X(l[2].substring(5),16),i=X(l[2].substring(3,5),16),r=X(l[2].substring(1,3),16)),l[3]&&(s=X((u=l[3].charAt(3))+u,16),i=X((u=l[3].charAt(2))+u,16),r=X((u=l[3].charAt(1))+u,16)),l[4]&&(f=l[4][w](Q),r=W(f[0]),f[0].slice(-1)=="%"&&(r*=2.55),i=W(f[1]),f[1].slice(-1)=="%"&&(i*=2.55),s=W(f[2]),f[2].slice(-1)=="%"&&(s*=2.55),l[1].toLowerCase().slice(0,4)=="rgba"&&(o=W(f[3])),f[3]&&f[3].slice(-1)=="%"&&(o/=100)),l[5]?(f=l[5][w](Q),r=W(f[0]),f[0].slice(-1)=="%"&&(r*=2.55),i=W(f[1]),f[1].slice(-1)=="%"&&(i*=2.55),s=W(f[2]),f[2].slice(-1)=="%"&&(s*=2.55),(f[0].slice(-3)=="deg"||f[0].slice(-1)=="°")&&(r/=360),l[1].toLowerCase().slice(0,4)=="hsba"&&(o=W(f[3])),f[3]&&f[3].slice(-1)=="%"&&(o/=100),n.hsb2rgb(r,i,s,o)):l[6]?(f=l[6][w](Q),r=W(f[0]),f[0].slice(-1)=="%"&&(r*=2.55),i=W(f[1]),f[1].slice(-1)=="%"&&(i*=2.55),s=W(f[2]),f[2].slice(-1)=="%"&&(s*=2.55),(f[0].slice(-3)=="deg"||f[0].slice(-1)=="°")&&(r/=360),l[1].toLowerCase().slice(0,4)=="hsla"&&(o=W(f[3])),f[3]&&f[3].slice(-1)=="%"&&(o/=100),n.hsl2rgb(r,i,s,o)):(l={r:r,g:i,b:s,toString:Nt},l.hex="#"+(16777216|s|i<<8|r<<16).toString(16).slice(1),n.is(o,"finite")&&(l.opacity=o),l)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:Nt}},n),n.hsb=xt(function(e,t,r){return n.hsb2rgb(e,t,r).hex}),n.hsl=xt(function(e,t,r){return n.hsl2rgb(e,t,r).hex}),n.rgb=xt(function(e,t,n){return"#"+(16777216|n|t<<8|e<<16).toString(16).slice(1)}),n.getColor=function(e){var t=this.getColor.start=this.getColor.start||{h:0,s:1,b:e||.75},n=this.hsb2rgb(t.h,t.s,t.b);return t.h+=.075,t.h>1&&(t.h=0,t.s-=.2,t.s<=0&&(this.getColor.start={h:0,s:1,b:t.b})),n.hex},n.getColor.reset=function(){delete this.start},n.parsePathString=function(e){if(!e)return null;var t=kt(e);if(t.arr)return jt(t.arr);var r={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},i=[];return n.is(e,_)&&n.is(e[0],_)&&(i=jt(e)),i.length||b(e).replace(Z,function(e,t,n){var s=[],o=t.toLowerCase();n.replace(tt,function(e,t){t&&s.push(+t)}),o=="m"&&s.length>2&&(i.push([t][v](s.splice(0,2))),o="l",t=t=="m"?"l":"L");if(o=="r")i.push([t][v](s));else while(s.length>=r[o]){i.push([t][v](s.splice(0,r[o])));if(!r[o])break}}),i.toString=n._path2string,t.arr=jt(i),i},n.parseTransformString=xt(function(e){if(!e)return null;var t={r:3,s:4,t:2,m:6},r=[];return n.is(e,_)&&n.is(e[0],_)&&(r=jt(e)),r.length||b(e).replace(et,function(e,t,n){var i=[],s=x.call(t);n.replace(tt,function(e,t){t&&i.push(+t)}),r.push([t][v](i))}),r.toString=n._path2string,r});var kt=function(e){var t=kt.ps=kt.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout(function(){for(var n in t)t[a](n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])}),t[e]};n.findDotsAtSegment=function(e,t,n,r,i,s,o,u,a){var f=1-a,l=L(f,3),c=L(f,2),h=a*a,p=h*a,d=l*e+c*3*a*n+f*3*a*a*i+p*o,v=l*t+c*3*a*r+f*3*a*a*s+p*u,m=e+2*a*(n-e)+h*(i-2*n+e),g=t+2*a*(r-t)+h*(s-2*r+t),y=n+2*a*(i-n)+h*(o-2*i+n),b=r+2*a*(s-r)+h*(u-2*s+r),w=f*e+a*n,E=f*t+a*r,S=f*i+a*o,x=f*s+a*u,N=90-T.atan2(m-y,g-b)*180/A;return(m>y||g<b)&&(N+=180),{x:d,y:v,m:{x:m,y:g},n:{x:y,y:b},start:{x:w,y:E},end:{x:S,y:x},alpha:N}},n.bezierBBox=function(e,t,r,i,s,o,u,a){n.is(e,"array")||(e=[e,t,r,i,s,o,u,a]);var f=Wt.apply(null,e);return{x:f.min.x,y:f.min.y,x2:f.max.x,y2:f.max.y,width:f.max.x-f.min.x,height:f.max.y-f.min.y}},n.isPointInsideBBox=function(e,t,n){return t>=e.x&&t<=e.x2&&n>=e.y&&n<=e.y2},n.isBBoxIntersect=function(e,t){var r=n.isPointInsideBBox;return r(t,e.x,e.y)||r(t,e.x2,e.y)||r(t,e.x,e.y2)||r(t,e.x2,e.y2)||r(e,t.x,t.y)||r(e,t.x2,t.y)||r(e,t.x,t.y2)||r(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)},n.pathIntersection=function(e,t){return Ht(e,t)},n.pathIntersectionNumber=function(e,t){return Ht(e,t,1)},n.isPointInsidePath=function(e,t,r){var i=n.pathBBox(e);return n.isPointInsideBBox(i,t,r)&&Ht(e,[["M",t,r],["H",i.x2+10]],1)%2==1},n._removedFactory=function(e){return function(){t("raphael.log",null,"Raphaël: you are calling to method “"+e+"” of removed object",e)}};var Bt=n.pathBBox=function(e){var t=kt(e);if(t.bbox)return dt(t.bbox);if(!e)return{x:0,y:0,width:0,height:0,x2:0,y2:0};e=Xt(e);var n=0,r=0,i=[],s=[],o;for(var u=0,a=e.length;u<a;u++){o=e[u];if(o[0]=="M")n=o[1],r=o[2],i.push(n),s.push(r);else{var f=Wt(n,r,o[1],o[2],o[3],o[4],o[5],o[6]);i=i[v](f.min.x,f.max.x),s=s[v](f.min.y,f.max.y),n=o[5],r=o[6]}}var l=C[d](0,i),c=C[d](0,s),h=N[d](0,i),p=N[d](0,s),m=h-l,g=p-c,y={x:l,y:c,x2:h,y2:p,width:m,height:g,cx:l+m/2,cy:c+g/2};return t.bbox=dt(y),y},jt=function(e){var t=dt(e);return t.toString=n._path2string,t},Ft=n._pathToRelative=function(e){var t=kt(e);if(t.rel)return jt(t.rel);if(!n.is(e,_)||!n.is(e&&e[0],_))e=n.parsePathString(e);var r=[],i=0,s=0,o=0,u=0,a=0;e[0][0]=="M"&&(i=e[0][1],s=e[0][2],o=i,u=s,a++,r.push(["M",i,s]));for(var f=a,l=e.length;f<l;f++){var c=r[f]=[],h=e[f];if(h[0]!=x.call(h[0])){c[0]=x.call(h[0]);switch(c[0]){case"a":c[1]=h[1],c[2]=h[2],c[3]=h[3],c[4]=h[4],c[5]=h[5],c[6]=+(h[6]-i).toFixed(3),c[7]=+(h[7]-s).toFixed(3);break;case"v":c[1]=+(h[1]-s).toFixed(3);break;case"m":o=h[1],u=h[2];default:for(var p=1,d=h.length;p<d;p++)c[p]=+(h[p]-(p%2?i:s)).toFixed(3)}}else{c=r[f]=[],h[0]=="m"&&(o=h[1]+i,u=h[2]+s);for(var v=0,m=h.length;v<m;v++)r[f][v]=h[v]}var g=r[f].length;switch(r[f][0]){case"z":i=o,s=u;break;case"h":i+=+r[f][g-1];break;case"v":s+=+r[f][g-1];break;default:i+=+r[f][g-2],s+=+r[f][g-1]}}return r.toString=n._path2string,t.rel=jt(r),r},It=n._pathToAbsolute=function(e){var t=kt(e);if(t.abs)return jt(t.abs);if(!n.is(e,_)||!n.is(e&&e[0],_))e=n.parsePathString(e);if(!e||!e.length)return[["M",0,0]];var r=[],i=0,s=0,o=0,u=0,a=0;e[0][0]=="M"&&(i=+e[0][1],s=+e[0][2],o=i,u=s,a++,r[0]=["M",i,s]);var f=e.length==3&&e[0][0]=="M"&&e[1][0].toUpperCase()=="R"&&e[2][0].toUpperCase()=="Z";for(var l,c,h=a,p=e.length;h<p;h++){r.push(l=[]),c=e[h];if(c[0]!=V.call(c[0])){l[0]=V.call(c[0]);switch(l[0]){case"A":l[1]=c[1],l[2]=c[2],l[3]=c[3],l[4]=c[4],l[5]=c[5],l[6]=+(c[6]+i),l[7]=+(c[7]+s);break;case"V":l[1]=+c[1]+s;break;case"H":l[1]=+c[1]+i;break;case"R":var d=[i,s][v](c.slice(1));for(var m=2,g=d.length;m<g;m++)d[m]=+d[m]+i,d[++m]=+d[m]+s;r.pop(),r=r[v](Ct(d,f));break;case"M":o=+c[1]+i,u=+c[2]+s;default:for(m=1,g=c.length;m<g;m++)l[m]=+c[m]+(m%2?i:s)}}else if(c[0]=="R")d=[i,s][v](c.slice(1)),r.pop(),r=r[v](Ct(d,f)),l=["R"][v](c.slice(-2));else for(var y=0,b=c.length;y<b;y++)l[y]=c[y];switch(l[0]){case"Z":i=o,s=u;break;case"H":i=l[1];break;case"V":s=l[1];break;case"M":o=l[l.length-2],u=l[l.length-1];default:i=l[l.length-2],s=l[l.length-1]}}return r.toString=n._path2string,t.abs=jt(r),r},qt=function(e,t,n,r){return[e,t,n,r,n,r]},Rt=function(e,t,n,r,i,s){var o=1/3,u=2/3;return[o*e+u*n,o*t+u*r,o*i+u*n,o*s+u*r,i,s]},Ut=function(e,t,n,r,i,s,o,u,a,f){var l=A*120/180,c=A/180*(+i||0),h=[],p,d=xt(function(e,t,n){var r=e*T.cos(n)-t*T.sin(n),i=e*T.sin(n)+t*T.cos(n);return{x:r,y:i}});if(!f){p=d(e,t,-c),e=p.x,t=p.y,p=d(u,a,-c),u=p.x,a=p.y;var m=T.cos(A/180*i),g=T.sin(A/180*i),y=(e-u)/2,b=(t-a)/2,E=y*y/(n*n)+b*b/(r*r);E>1&&(E=T.sqrt(E),n=E*n,r=E*r);var S=n*n,x=r*r,N=(s==o?-1:1)*T.sqrt(k((S*x-S*b*b-x*y*y)/(S*b*b+x*y*y))),C=N*n*b/r+(e+u)/2,L=N*-r*y/n+(t+a)/2,O=T.asin(((t-L)/r).toFixed(9)),M=T.asin(((a-L)/r).toFixed(9));O=e<C?A-O:O,M=u<C?A-M:M,O<0&&(O=A*2+O),M<0&&(M=A*2+M),o&&O>M&&(O-=A*2),!o&&M>O&&(M-=A*2)}else O=f[0],M=f[1],C=f[2],L=f[3];var _=M-O;if(k(_)>l){var D=M,P=u,H=a;M=O+l*(o&&M>O?1:-1),u=C+n*T.cos(M),a=L+r*T.sin(M),h=Ut(u,a,n,r,i,0,o,P,H,[M,D,C,L])}_=M-O;var B=T.cos(O),j=T.sin(O),F=T.cos(M),I=T.sin(M),q=T.tan(_/4),R=4/3*n*q,U=4/3*r*q,z=[e,t],W=[e+R*j,t-U*B],X=[u+R*I,a-U*F],V=[u,a];W[0]=2*z[0]-W[0],W[1]=2*z[1]-W[1];if(f)return[W,X,V][v](h);h=[W,X,V][v](h).join()[w](",");var $=[];for(var J=0,K=h.length;J<K;J++)$[J]=J%2?d(h[J-1],h[J],c).y:d(h[J],h[J+1],c).x;return $},zt=function(e,t,n,r,i,s,o,u,a){var f=1-a;return{x:L(f,3)*e+L(f,2)*3*a*n+f*3*a*a*i+L(a,3)*o,y:L(f,3)*t+L(f,2)*3*a*r+f*3*a*a*s+L(a,3)*u}},Wt=xt(function(e,t,n,r,i,s,o,u){var a=i-2*n+e-(o-2*i+n),f=2*(n-e)-2*(i-n),l=e-n,c=(-f+T.sqrt(f*f-4*a*l))/2/a,h=(-f-T.sqrt(f*f-4*a*l))/2/a,p=[t,u],v=[e,o],m;return k(c)>"1e12"&&(c=.5),k(h)>"1e12"&&(h=.5),c>0&&c<1&&(m=zt(e,t,n,r,i,s,o,u,c),v.push(m.x),p.push(m.y)),h>0&&h<1&&(m=zt(e,t,n,r,i,s,o,u,h),v.push(m.x),p.push(m.y)),a=s-2*r+t-(u-2*s+r),f=2*(r-t)-2*(s-r),l=t-r,c=(-f+T.sqrt(f*f-4*a*l))/2/a,h=(-f-T.sqrt(f*f-4*a*l))/2/a,k(c)>"1e12"&&(c=.5),k(h)>"1e12"&&(h=.5),c>0&&c<1&&(m=zt(e,t,n,r,i,s,o,u,c),v.push(m.x),p.push(m.y)),h>0&&h<1&&(m=zt(e,t,n,r,i,s,o,u,h),v.push(m.x),p.push(m.y)),{min:{x:C[d](0,v),y:C[d](0,p)},max:{x:N[d](0,v),y:N[d](0,p)}}}),Xt=n._path2curve=xt(function(e,t){var n=!t&&kt(e);if(!t&&n.curve)return jt(n.curve);var r=It(e),i=t&&It(t),s={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},u=function(e,t,n){var r,i,s={T:1,Q:1};if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];!(e[0]in s)&&(t.qx=t.qy=null);switch(e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"][v](Ut[d](0,[t.x,t.y][v](e.slice(1))));break;case"S":n=="C"||n=="S"?(r=t.x*2-t.bx,i=t.y*2-t.by):(r=t.x,i=t.y),e=["C",r,i][v](e.slice(1));break;case"T":n=="Q"||n=="T"?(t.qx=t.x*2-t.qx,t.qy=t.y*2-t.qy):(t.qx=t.x,t.qy=t.y),e=["C"][v](Rt(t.x,t.y,t.qx,t.qy,e[1],e[2]));break;case"Q":t.qx=e[1],t.qy=e[2],e=["C"][v](Rt(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"][v](qt(t.x,t.y,e[1],e[2]));break;case"H":e=["C"][v](qt(t.x,t.y,e[1],t.y));break;case"V":e=["C"][v](qt(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"][v](qt(t.x,t.y,t.X,t.Y))}return e},a=function(e,t){if(e[t].length>7){e[t].shift();var n=e[t];while(n.length)l[t]="A",i&&(c[t]="A"),e.splice(t++,0,["C"][v](n.splice(0,6)));e.splice(t,1),g=N(r.length,i&&i.length||0)}},f=function(e,t,n,s,o){e&&t&&e[o][0]=="M"&&t[o][0]!="M"&&(t.splice(o,0,["M",s.x,s.y]),n.bx=0,n.by=0,n.x=e[o][1],n.y=e[o][2],g=N(r.length,i&&i.length||0))},l=[],c=[],h="",p="";for(var m=0,g=N(r.length,i&&i.length||0);m<g;m++){r[m]&&(h=r[m][0]),h!="C"&&(l[m]=h,m&&(p=l[m-1])),r[m]=u(r[m],s,p),l[m]!="A"&&h=="C"&&(l[m]="C"),a(r,m),i&&(i[m]&&(h=i[m][0]),h!="C"&&(c[m]=h,m&&(p=c[m-1])),i[m]=u(i[m],o,p),c[m]!="A"&&h=="C"&&(c[m]="C"),a(i,m)),f(r,i,s,o,m),f(i,r,o,s,m);var y=r[m],b=i&&i[m],w=y.length,E=i&&b.length;s.x=y[w-2],s.y=y[w-1],s.bx=W(y[w-4])||s.x,s.by=W(y[w-3])||s.y,o.bx=i&&(W(b[E-4])||o.x),o.by=i&&(W(b[E-3])||o.y),o.x=i&&b[E-2],o.y=i&&b[E-1]}return i||(n.curve=jt(r)),i?[r,i]:r},null,jt),Vt=n._parseDots=xt(function(e){var t=[];for(var r=0,i=e.length;r<i;r++){var s={},o=e[r].match(/^([^:]*):?([\d\.]*)/);s.color=n.getRGB(o[1]);if(s.color.error)return null;s.color=s.color.hex,o[2]&&(s.offset=o[2]+"%"),t.push(s)}for(r=1,i=t.length-1;r<i;r++)if(!t[r].offset){var u=W(t[r-1].offset||0),a=0;for(var f=r+1;f<i;f++)if(t[f].offset){a=t[f].offset;break}a||(a=100,f=i),a=W(a);var l=(a-u)/(f-r+1);for(;r<f;r++)u+=l,t[r].offset=u+"%"}return t}),$t=n._tear=function(e,t){e==t.top&&(t.top=e.prev),e==t.bottom&&(t.bottom=e.next),e.next&&(e.next.prev=e.prev),e.prev&&(e.prev.next=e.next)},Jt=n._tofront=function(e,t){if(t.top===e)return;$t(e,t),e.next=null,e.prev=t.top,t.top.next=e,t.top=e},Kt=n._toback=function(e,t){if(t.bottom===e)return;$t(e,t),e.next=t.bottom,e.prev=null,t.bottom.prev=e,t.bottom=e},Qt=n._insertafter=function(e,t,n){$t(e,n),t==n.top&&(n.top=e),t.next&&(t.next.prev=e),e.next=t.next,e.prev=t,t.next=e},Gt=n._insertbefore=function(e,t,n){$t(e,n),t==n.bottom&&(n.bottom=e),t.prev&&(t.prev.next=e),e.prev=t.prev,t.prev=e,e.next=t},Yt=n.toMatrix=function(e,t){var n=Bt(e),r={_:{transform:g},getBBox:function(){return n}};return en(r,t),r.matrix},Zt=n.transformPath=function(e,t){return ct(e,Yt(e,t))},en=n._extractTransform=function(e,t){if(t==null)return e._.transform;t=b(t).replace(/\.{3}|\u2026/g,e._.transform||g);var r=n.parseTransformString(t),i=0,s=0,o=0,u=1,a=1,f=e._,l=new rn;f.transform=r||[];if(r)for(var c=0,h=r.length;c<h;c++){var p=r[c],d=p.length,v=b(p[0]).toLowerCase(),m=p[0]!=v,y=m?l.invert():0,w,E,S,x,T;v=="t"&&d==3?m?(w=y.x(0,0),E=y.y(0,0),S=y.x(p[1],p[2]),x=y.y(p[1],p[2]),l.translate(S-w,x-E)):l.translate(p[1],p[2]):v=="r"?d==2?(T=T||e.getBBox(1),l.rotate(p[1],T.x+T.width/2,T.y+T.height/2),i+=p[1]):d==4&&(m?(S=y.x(p[2],p[3]),x=y.y(p[2],p[3]),l.rotate(p[1],S,x)):l.rotate(p[1],p[2],p[3]),i+=p[1]):v=="s"?d==2||d==3?(T=T||e.getBBox(1),l.scale(p[1],p[d-1],T.x+T.width/2,T.y+T.height/2),u*=p[1],a*=p[d-1]):d==5&&(m?(S=y.x(p[3],p[4]),x=y.y(p[3],p[4]),l.scale(p[1],p[2],S,x)):l.scale(p[1],p[2],p[3],p[4]),u*=p[1],a*=p[2]):v=="m"&&d==7&&l.add(p[1],p[2],p[3],p[4],p[5],p[6]),f.dirtyT=1,e.matrix=l}e.matrix=l,f.sx=u,f.sy=a,f.deg=i,f.dx=s=l.e,f.dy=o=l.f,u==1&&a==1&&!i&&f.bbox?(f.bbox.x+=+s,f.bbox.y+=+o):f.dirtyT=1},tn=function(e){var t=e[0];switch(t.toLowerCase()){case"t":return[t,0,0];case"m":return[t,1,0,0,1,0,0];case"r":return e.length==4?[t,0,e[2],e[3]]:[t,0];case"s":return e.length==5?[t,1,1,e[3],e[4]]:e.length==3?[t,1,1]:[t,1]}},nn=n._equaliseTransform=function(e,t){t=b(t).replace(/\.{3}|\u2026/g,e),e=n.parseTransformString(e)||[],t=n.parseTransformString(t)||[];var r=N(e.length,t.length),i=[],s=[],o=0,u,a,f,l;for(;o<r;o++){f=e[o]||tn(t[o]),l=t[o]||tn(f);if(f[0]!=l[0]||f[0].toLowerCase()=="r"&&(f[2]!=l[2]||f[3]!=l[3])||f[0].toLowerCase()=="s"&&(f[3]!=l[3]||f[4]!=l[4]))return;i[o]=[],s[o]=[];for(u=0,a=N(f.length,l.length);u<a;u++)u in f&&(i[o][u]=f[u]),u in l&&(s[o][u]=l[u])}return{from:i,to:s}};n._getContainer=function(e,t,r,i){var s;s=i==null&&!n.is(e,"object")?f.doc.getElementById(e):e;if(s==null)return;return s.tagName?t==null?{container:s,width:s.style.pixelWidth||s.offsetWidth,height:s.style.pixelHeight||s.offsetHeight}:{container:s,width:t,height:r}:{container:1,x:e,y:t,width:r,height:i}},n.pathToRelative=Ft,n._engine={},n.path2curve=Xt,n.matrix=function(e,t,n,r,i,s){return new rn(e,t,n,r,i,s)},function(e){function t(e){return e[0]*e[0]+e[1]*e[1]}function r(e){var n=T.sqrt(t(e));e[0]&&(e[0]/=n),e[1]&&(e[1]/=n)}e.add=function(e,t,n,r,i,s){var o=[[],[],[]],u=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],a=[[e,n,i],[t,r,s],[0,0,1]],f,l,c,h;e&&e instanceof rn&&(a=[[e.a,e.c,e.e],[e.b,e.d,e.f],[0,0,1]]);for(f=0;f<3;f++)for(l=0;l<3;l++){h=0;for(c=0;c<3;c++)h+=u[f][c]*a[c][l];o[f][l]=h}this.a=o[0][0],this.b=o[1][0],this.c=o[0][1],this.d=o[1][1],this.e=o[0][2],this.f=o[1][2]},e.invert=function(){var e=this,t=e.a*e.d-e.b*e.c;return new rn(e.d/t,-e.b/t,-e.c/t,e.a/t,(e.c*e.f-e.d*e.e)/t,(e.b*e.e-e.a*e.f)/t)},e.clone=function(){return new rn(this.a,this.b,this.c,this.d,this.e,this.f)},e.translate=function(e,t){this.add(1,0,0,1,e,t)},e.scale=function(e,t,n,r){t==null&&(t=e),(n||r)&&this.add(1,0,0,1,n,r),this.add(e,0,0,t,0,0),(n||r)&&this.add(1,0,0,1,-n,-r)},e.rotate=function(e,t,r){e=n.rad(e),t=t||0,r=r||0;var i=+T.cos(e).toFixed(9),s=+T.sin(e).toFixed(9);this.add(i,s,-s,i,t,r),this.add(1,0,0,1,-t,-r)},e.x=function(e,t){return e*this.a+t*this.c+this.e},e.y=function(e,t){return e*this.b+t*this.d+this.f},e.get=function(e){return+this[b.fromCharCode(97+e)].toFixed(4)},e.toString=function(){return n.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},e.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},e.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},e.split=function(){var e={};e.dx=this.e,e.dy=this.f;var i=[[this.a,this.c],[this.b,this.d]];e.scalex=T.sqrt(t(i[0])),r(i[0]),e.shear=i[0][0]*i[1][0]+i[0][1]*i[1][1],i[1]=[i[1][0]-i[0][0]*e.shear,i[1][1]-i[0][1]*e.shear],e.scaley=T.sqrt(t(i[1])),r(i[1]),e.shear/=e.scaley;var s=-i[0][1],o=i[1][1];return o<0?(e.rotate=n.deg(T.acos(o)),s<0&&(e.rotate=360-e.rotate)):e.rotate=n.deg(T.asin(s)),e.isSimple=!+e.shear.toFixed(9)&&(e.scalex.toFixed(9)==e.scaley.toFixed(9)||!e.rotate),e.isSuperSimple=!+e.shear.toFixed(9)&&e.scalex.toFixed(9)==e.scaley.toFixed(9)&&!e.rotate,e.noRotation=!+e.shear.toFixed(9)&&!e.rotate,e},e.toTransformString=function(e){var t=e||this[w]();return t.isSimple?(t.scalex=+t.scalex.toFixed(4),t.scaley=+t.scaley.toFixed(4),t.rotate=+t.rotate.toFixed(4),(t.dx||t.dy?"t"+[t.dx,t.dy]:g)+(t.scalex!=1||t.scaley!=1?"s"+[t.scalex,t.scaley,0,0]:g)+(t.rotate?"r"+[t.rotate,0,0]:g)):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(rn.prototype);var sn=navigator.userAgent.match(/Version\/(.*?)\s/)||navigator.userAgent.match(/Chrome\/(\d+)/);navigator.vendor=="Apple Computer, Inc."&&(sn&&sn[1]<4||navigator.platform.slice(0,2)=="iP")||navigator.vendor=="Google Inc."&&sn&&sn[1]<8?h.safari=function(){var e=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});setTimeout(function(){e.remove()})}:h.safari=ot;var on=function(){this.returnValue=!1},un=function(){return this.originalEvent.preventDefault()},an=function(){this.cancelBubble=!0},fn=function(){return this.originalEvent.stopPropagation()},ln=function(e){var t=f.doc.documentElement.scrollTop||f.doc.body.scrollTop,n=f.doc.documentElement.scrollLeft||f.doc.body.scrollLeft;return{x:e.clientX+n,y:e.clientY+t}},cn=function(){if(f.doc.addEventListener)return function(e,t,n,r){var i=function(e){var t=ln(e);return n.call(r,e,t.x,t.y)};e.addEventListener(t,i,!1);if(m&&S[t]){var s=function(t){var i=ln(t),s=t;for(var o=0,u=t.targetTouches&&t.targetTouches.length;o<u;o++)if(t.targetTouches[o].target==e){t=t.targetTouches[o],t.originalEvent=s,t.preventDefault=un,t.stopPropagation=fn;break}return n.call(r,t,i.x,i.y)};e.addEventListener(S[t],s,!1)}return function(){return e.removeEventListener(t,i,!1),m&&S[t]&&e.removeEventListener(S[t],s,!1),!0}};if(f.doc.attachEvent)return function(e,t,n,r){var i=function(e){e=e||f.win.event;var t=f.doc.documentElement.scrollTop||f.doc.body.scrollTop,i=f.doc.documentElement.scrollLeft||f.doc.body.scrollLeft,s=e.clientX+i,o=e.clientY+t;return e.preventDefault=e.preventDefault||on,e.stopPropagation=e.stopPropagation||an,n.call(r,e,s,o)};e.attachEvent("on"+t,i);var s=function(){return e.detachEvent("on"+t,i),!0};return s}}(),hn=[],pn=function(e){var n=e.clientX,r=e.clientY,i=f.doc.documentElement.scrollTop||f.doc.body.scrollTop,s=f.doc.documentElement.scrollLeft||f.doc.body.scrollLeft,o,u=hn.length;while(u--){o=hn[u];if(m&&e.touches){var a=e.touches.length,l;while(a--){l=e.touches[a];if(l.identifier==o.el._drag.id){n=l.clientX,r=l.clientY,(e.originalEvent?e.originalEvent:e).preventDefault();break}}}else e.preventDefault();var c=o.el.node,h,p=c.nextSibling,d=c.parentNode,v=c.style.display;f.win.opera&&d.removeChild(c),c.style.display="none",h=o.el.paper.getElementByPoint(n,r),c.style.display=v,f.win.opera&&(p?d.insertBefore(c,p):d.appendChild(c)),h&&t("raphael.drag.over."+o.el.id,o.el,h),n+=s,r+=i,t("raphael.drag.move."+o.el.id,o.move_scope||o.el,n-o.el._drag.x,r-o.el._drag.y,n,r,e)}},dn=function(e){n.unmousemove(pn).unmouseup(dn);var r=hn.length,i;while(r--)i=hn[r],i.el._drag={},t("raphael.drag.end."+i.el.id,i.end_scope||i.start_scope||i.move_scope||i.el,e);hn=[]},vn=n.el={};for(var mn=E.length;mn--;)(function(e){n[e]=vn[e]=function(t,r){return n.is(t,"function")&&(this.events=this.events||[],this.events.push({name:e,f:t,unbind:cn(this.shape||this.node||f.doc,e,t,r||this)})),this},n["un"+e]=vn["un"+e]=function(t){var r=this.events||[],i=r.length;while(i--)r[i].name==e&&(n.is(t,"undefined")||r[i].f==t)&&(r[i].unbind(),r.splice(i,1),!r.length&&delete this.events);return this}})(E[mn]);vn.data=function(e,r){var i=rt[this.id]=rt[this.id]||{};if(arguments.length==0)return i;if(arguments.length==1){if(n.is(e,"object")){for(var s in e)e[a](s)&&this.data(s,e[s]);return this}return t("raphael.data.get."+this.id,this,i[e],e),i[e]}return i[e]=r,t("raphael.data.set."+this.id,this,r,e),this},vn.removeData=function(e){return e==null?rt[this.id]={}:rt[this.id]&&delete rt[this.id][e],this},vn.getData=function(){return dt(rt[this.id]||{})},vn.hover=function(e,t,n,r){return this.mouseover(e,n).mouseout(t,r||n)},vn.unhover=function(e,t){return this.unmouseover(e).unmouseout(t)};var gn=[];vn.drag=function(e,r,i,s,o,u){function a(a){(a.originalEvent||a).preventDefault();var l=a.clientX,c=a.clientY,h=f.doc.documentElement.scrollTop||f.doc.body.scrollTop,p=f.doc.documentElement.scrollLeft||f.doc.body.scrollLeft;this._drag.id=a.identifier;if(m&&a.touches){var d=a.touches.length,v;while(d--){v=a.touches[d],this._drag.id=v.identifier;if(v.identifier==this._drag.id){l=v.clientX,c=v.clientY;break}}}this._drag.x=l+p,this._drag.y=c+h,!hn.length&&n.mousemove(pn).mouseup(dn),hn.push({el:this,move_scope:s,start_scope:o,end_scope:u}),r&&t.on("raphael.drag.start."+this.id,r),e&&t.on("raphael.drag.move."+this.id,e),i&&t.on("raphael.drag.end."+this.id,i),t("raphael.drag.start."+this.id,o||s||this,a.clientX+p,a.clientY+h,a)}return this._drag={},gn.push({el:this,start:a}),this.mousedown(a),this},vn.onDragOver=function(e){e?t.on("raphael.drag.over."+this.id,e):t.unbind("raphael.drag.over."+this.id)},vn.undrag=function(){var e=gn.length;while(e--)gn[e].el==this&&(this.unmousedown(gn[e].start),gn.splice(e,1),t.unbind("raphael.drag.*."+this.id));!gn.length&&n.unmousemove(pn).unmouseup(dn),hn=[]},h.circle=function(e,t,r){var i=n._engine.circle(this,e||0,t||0,r||0);return this.__set__&&this.__set__.push(i),i},h.rect=function(e,t,r,i,s){var o=n._engine.rect(this,e||0,t||0,r||0,i||0,s||0);return this.__set__&&this.__set__.push(o),o},h.ellipse=function(e,t,r,i){var s=n._engine.ellipse(this,e||0,t||0,r||0,i||0);return this.__set__&&this.__set__.push(s),s},h.path=function(e){e&&!n.is(e,M)&&!n.is(e[0],_)&&(e+=g);var t=n._engine.path(n.format[d](n,arguments),this);return this.__set__&&this.__set__.push(t),t},h.image=function(e,t,r,i,s){var o=n._engine.image(this,e||"about:blank",t||0,r||0,i||0,s||0);return this.__set__&&this.__set__.push(o),o},h.text=function(e,t,r){var i=n._engine.text(this,e||0,t||0,b(r));return this.__set__&&this.__set__.push(i),i},h.set=function(e){!n.is(e,"array")&&(e=Array.prototype.splice.call(arguments,0,arguments.length));var t=new Bn(e);return this.__set__&&this.__set__.push(t),t.paper=this,t.type="set",t},h.setStart=function(e){this.__set__=e||this.set()},h.setFinish=function(e){var t=this.__set__;return delete this.__set__,t},h.getSize=function(){var e=this.canvas.parentNode;return{width:e.offsetWidth,height:e.offsetHeight}},h.setSize=function(e,t){return n._engine.setSize.call(this,e,t)},h.setViewBox=function(e,t,r,i,s){return n._engine.setViewBox.call(this,e,t,r,i,s)},h.top=h.bottom=null,h.raphael=n;var yn=function(e){var t=e.getBoundingClientRect(),n=e.ownerDocument,r=n.body,i=n.documentElement,s=i.clientTop||r.clientTop||0,o=i.clientLeft||r.clientLeft||0,u=t.top+(f.win.pageYOffset||i.scrollTop||r.scrollTop)-s,a=t.left+(f.win.pageXOffset||i.scrollLeft||r.scrollLeft)-o;return{y:u,x:a}};h.getElementByPoint=function(e,t){var n=this,r=n.canvas,i=f.doc.elementFromPoint(e,t);if(f.win.opera&&i.tagName=="svg"){var s=yn(r),o=r.createSVGRect();o.x=e-s.x,o.y=t-s.y,o.width=o.height=1;var u=r.getIntersectionList(o,null);u.length&&(i=u[u.length-1])}if(!i)return null;while(i.parentNode&&i!=r.parentNode&&!i.raphael)i=i.parentNode;return i==n.canvas.parentNode&&(i=r),i=i&&i.raphael?n.getById(i.raphaelid):null,i},h.getElementsByBBox=function(e){var t=this.set();return this.forEach(function(r){n.isBBoxIntersect(r.getBBox(),e)&&t.push(r)}),t},h.getById=function(e){var t=this.bottom;while(t){if(t.id==e)return t;t=t.next}return null},h.forEach=function(e,t){var n=this.bottom;while(n){if(e.call(t,n)===!1)return this;n=n.next}return this},h.getElementsByPoint=function(e,t){var n=this.set();return this.forEach(function(r){r.isPointInside(e,t)&&n.push(r)}),n},vn.isPointInside=function(e,t){var r=this.realPath=lt[this.type](this);return this.attr("transform")&&this.attr("transform").length&&(r=n.transformPath(r,this.attr("transform"))),n.isPointInsidePath(r,e,t)},vn.getBBox=function(e){if(this.removed)return{};var t=this._;if(e){if(t.dirty||!t.bboxwt)this.realPath=lt[this.type](this),t.bboxwt=Bt(this.realPath),t.bboxwt.toString=wn,t.dirty=0;return t.bboxwt}if(t.dirty||t.dirtyT||!t.bbox){if(t.dirty||!this.realPath)t.bboxwt=0,this.realPath=lt[this.type](this);t.bbox=Bt(ct(this.realPath,this.matrix)),t.bbox.toString=wn,t.dirty=t.dirtyT=0}return t.bbox},vn.clone=function(){if(this.removed)return null;var e=this.paper[this.type]().attr(this.attr());return this.__set__&&this.__set__.push(e),e},vn.glow=function(e){if(this.type=="text")return null;e=e||{};var t={width:(e.width||10)+(+this.attr("stroke-width")||1),fill:e.fill||!1,opacity:e.opacity||.5,offsetx:e.offsetx||0,offsety:e.offsety||0,color:e.color||"#000"},n=t.width/2,r=this.paper,i=r.set(),s=this.realPath||lt[this.type](this);s=this.matrix?ct(s,this.matrix):s;for(var o=1;o<n+1;o++)i.push(r.path(s).attr({stroke:t.color,fill:t.fill?t.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(t.width/n*o).toFixed(3),opacity:+(t.opacity/n).toFixed(3)}));return i.insertBefore(this).translate(t.offsetx,t.offsety)};var En={},Sn=function(e,t,r,i,s,o,u,a,f){return f==null?At(e,t,r,i,s,o,u,a):n.findDotsAtSegment(e,t,r,i,s,o,u,a,Ot(e,t,r,i,s,o,u,a,f))},xn=function(e,t){return function(r,i,s){r=Xt(r);var o,u,a,f,l="",c={},h,p=0;for(var d=0,v=r.length;d<v;d++){a=r[d];if(a[0]=="M")o=+a[1],u=+a[2];else{f=Sn(o,u,a[1],a[2],a[3],a[4],a[5],a[6]);if(p+f>i){if(t&&!c.start){h=Sn(o,u,a[1],a[2],a[3],a[4],a[5],a[6],i-p),l+=["C"+h.start.x,h.start.y,h.m.x,h.m.y,h.x,h.y];if(s)return l;c.start=l,l=["M"+h.x,h.y+"C"+h.n.x,h.n.y,h.end.x,h.end.y,a[5],a[6]].join(),p+=f,o=+a[5],u=+a[6];continue}if(!e&&!t)return h=Sn(o,u,a[1],a[2],a[3],a[4],a[5],a[6],i-p),{x:h.x,y:h.y,alpha:h.alpha}}p+=f,o=+a[5],u=+a[6]}l+=a.shift()+a}return c.end=l,h=e?p:t?c:n.findDotsAtSegment(o,u,a[0],a[1],a[2],a[3],a[4],a[5],1),h.alpha&&(h={x:h.x,y:h.y,alpha:h.alpha}),h}},Tn=xn(1),Nn=xn(),Cn=xn(0,1);n.getTotalLength=Tn,n.getPointAtLength=Nn,n.getSubpath=function(e,t,n){if(this.getTotalLength(e)-n<1e-6)return Cn(e,t).end;var r=Cn(e,n,1);return t?Cn(r,t).end:r},vn.getTotalLength=function(){var e=this.getPath();if(!e)return;return this.node.getTotalLength?this.node.getTotalLength():Tn(e)},vn.getPointAtLength=function(e){var t=this.getPath();if(!t)return;return Nn(t,e)},vn.getPath=function(){var e,t=n._getPath[this.type];if(this.type=="text"||this.type=="set")return;return t&&(e=t(this)),e},vn.getSubpath=function(e,t){var r=this.getPath();if(!r)return;return n.getSubpath(r,e,t)};var kn=n.easing_formulas={linear:function(e){return e},"<":function(e){return L(e,1.7)},">":function(e){return L(e,.48)},"<>":function(e){var t=.48-e/1.04,n=T.sqrt(.1734+t*t),r=n-t,i=L(k(r),1/3)*(r<0?-1:1),s=-n-t,o=L(k(s),1/3)*(s<0?-1:1),u=i+o+.5;return(1-u)*3*u*u+u*u*u},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){e-=1;var t=1.70158;return e*e*((t+1)*e+t)+1},elastic:function(e){return e==!!e?e:L(2,-10*e)*T.sin((e-.075)*2*A/.3)+1},bounce:function(e){var t=7.5625,n=2.75,r;return e<1/n?r=t*e*e:e<2/n?(e-=1.5/n,r=t*e*e+.75):e<2.5/n?(e-=2.25/n,r=t*e*e+.9375):(e-=2.625/n,r=t*e*e+.984375),r}};kn.easeIn=kn["ease-in"]=kn["<"],kn.easeOut=kn["ease-out"]=kn[">"],kn.easeInOut=kn["ease-in-out"]=kn["<>"],kn["back-in"]=kn.backIn,kn["back-out"]=kn.backOut;var Ln=[],An=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(e){setTimeout(e,16)},On=function(){var e=+(new Date),r=0;for(;r<Ln.length;r++){var i=Ln[r];if(i.el.removed||i.paused)continue;var s=e-i.start,o=i.ms,u=i.easing,f=i.from,l=i.diff,c=i.to,h=i.t,p=i.el,d={},m,g={},b;i.initstatus?(s=(i.initstatus*i.anim.top-i.prev)/(i.percent-i.prev)*o,i.status=i.initstatus,delete i.initstatus,i.stop&&Ln.splice(r--,1)):i.status=(i.prev+(i.percent-i.prev)*(s/o))/i.anim.top;if(s<0)continue;if(s<o){var w=u(s/o);for(var E in f)if(f[a](E)){switch(J[E]){case O:m=+f[E]+w*o*l[E];break;case"colour":m="rgb("+[Mn(U(f[E].r+w*o*l[E].r)),Mn(U(f[E].g+w*o*l[E].g)),Mn(U(f[E].b+w*o*l[E].b))].join(",")+")";break;case"path":m=[];for(var S=0,x=f[E].length;S<x;S++){m[S]=[f[E][S][0]];for(var T=1,N=f[E][S].length;T<N;T++)m[S][T]=+f[E][S][T]+w*o*l[E][S][T];m[S]=m[S].join(y)}m=m.join(y);break;case"transform":if(l[E].real){m=[];for(S=0,x=f[E].length;S<x;S++){m[S]=[f[E][S][0]];for(T=1,N=f[E][S].length;T<N;T++)m[S][T]=f[E][S][T]+w*o*l[E][S][T]}}else{var C=function(e){return+f[E][e]+w*o*l[E][e]};m=[["m",C(0),C(1),C(2),C(3),C(4),C(5)]]}break;case"csv":if(E=="clip-rect"){m=[],S=4;while(S--)m[S]=+f[E][S]+w*o*l[E][S]}break;default:var k=[][v](f[E]);m=[],S=p.paper.customAttributes[E].length;while(S--)m[S]=+k[S]+w*o*l[E][S]}d[E]=m}p.attr(d),function(e,n,r){setTimeout(function(){t("raphael.anim.frame."+e,n,r)})}(p.id,p,i.anim)}else{(function(e,r,i){setTimeout(function(){t("raphael.anim.frame."+r.id,r,i),t("raphael.anim.finish."+r.id,r,i),n.is(e,"function")&&e.call(r)})})(i.callback,p,i.anim),p.attr(c),Ln.splice(r--,1);if(i.repeat>1&&!i.next){for(b in c)c[a](b)&&(g[b]=i.totalOrigin[b]);i.el.attr(g),Pn(i.anim,i.el,i.anim.percents[0],null,i.totalOrigin,i.repeat-1)}i.next&&!i.stop&&Pn(i.anim,i.el,i.next,null,i.totalOrigin,i.repeat)}}n.svg&&p&&p.paper&&p.paper.safari(),Ln.length&&An(On)},Mn=function(e){return e>255?255:e<0?0:e};vn.animateWith=function(e,t,r,i,s,o){var u=this;if(u.removed)return o&&o.call(u),u;var a=r instanceof Dn?r:n.animation(r,i,s,o),f,l;Pn(a,u,a.percents[0],null,u.attr());for(var c=0,h=Ln.length;c<h;c++)if(Ln[c].anim==t&&Ln[c].el==e){Ln[h-1].start=Ln[c].start;break}return u},vn.onAnimation=function(e){return e?t.on("raphael.anim.frame."+this.id,e):t.unbind("raphael.anim.frame."+this.id),this},Dn.prototype.delay=function(e){var t=new Dn(this.anim,this.ms);return t.times=this.times,t.del=+e||0,t},Dn.prototype.repeat=function(e){var t=new Dn(this.anim,this.ms);return t.del=this.del,t.times=T.floor(N(e,0))||1,t},n.animation=function(e,t,r,i){if(e instanceof Dn)return e;if(n.is(r,"function")||!r)i=i||r||null,r=null;e=Object(e),t=+t||0;var s={},o,u;for(u in e)e[a](u)&&W(u)!=u&&W(u)+"%"!=u&&(o=!0,s[u]=e[u]);if(!o){if(i){var f=0;for(var l in e){var c=X(l);e[a](l)&&c>f&&(f=c)}f+="%",!e[f].callback&&(e[f].callback=i)}return new Dn(e,t)}return r&&(s.easing=r),i&&(s.callback=i),new Dn({100:s},t)},vn.animate=function(e,t,r,i){var s=this;if(s.removed)return i&&i.call(s),s;var o=e instanceof Dn?e:n.animation(e,t,r,i);return Pn(o,s,o.percents[0],null,s.attr()),s},vn.setTime=function(e,t){return e&&t!=null&&this.status(e,C(t,e.ms)/e.ms),this},vn.status=function(e,t){var n=[],r=0,i,s;if(t!=null)return Pn(e,this,-1,C(t,1)),this;i=Ln.length;for(;r<i;r++){s=Ln[r];if(s.el.id==this.id&&(!e||s.anim==e)){if(e)return s.status;n.push({anim:s.anim,status:s.status})}}return e?0:n},vn.pause=function(e){for(var n=0;n<Ln.length;n++)Ln[n].el.id==this.id&&(!e||Ln[n].anim==e)&&t("raphael.anim.pause."+this.id,this,Ln[n].anim)!==!1&&(Ln[n].paused=!0);return this},vn.resume=function(e){for(var n=0;n<Ln.length;n++)if(Ln[n].el.id==this.id&&(!e||Ln[n].anim==e)){var r=Ln[n];t("raphael.anim.resume."+this.id,this,r.anim)!==!1&&(delete r.paused,this.status(r.anim,r.status))}return this},vn.stop=function(e){for(var n=0;n<Ln.length;n++)Ln[n].el.id==this.id&&(!e||Ln[n].anim==e)&&t("raphael.anim.stop."+this.id,this,Ln[n].anim)!==!1&&Ln.splice(n--,1);return this},t.on("raphael.remove",Hn),t.on("raphael.clear",Hn),vn.toString=function(){return"Raphaël’s object"};var Bn=function(e){this.items=[],this.length=0,this.type="set";if(e)for(var t=0,n=e.length;t<n;t++)e[t]&&(e[t].constructor==vn.constructor||e[t].constructor==Bn)&&(this[this.items.length]=this.items[this.items.length]=e[t],this.length++)},jn=Bn.prototype;jn.push=function(){var e,t;for(var n=0,r=arguments.length;n<r;n++)e=arguments[n],e&&(e.constructor==vn.constructor||e.constructor==Bn)&&(t=this.items.length,this[t]=this.items[t]=e,this.length++);return this},jn.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},jn.forEach=function(e,t){for(var n=0,r=this.items.length;n<r;n++)if(e.call(t,this.items[n],n)===!1)return this;return this};for(var Fn in vn)vn[a](Fn)&&(jn[Fn]=function(e){return function(){var t=arguments;return this.forEach(function(n){n[e][d](n,t)})}}(Fn));return jn.attr=function(e,t){if(e&&n.is(e,_)&&n.is(e[0],"object"))for(var r=0,i=e.length;r<i;r++)this.items[r].attr(e[r]);else for(var s=0,o=this.items.length;s<o;s++)this.items[s].attr(e,t);return this},jn.clear=function(){while(this.length)this.pop()},jn.splice=function(e,t,n){e=e<0?N(this.length+e,0):e,t=N(0,C(this.length-e,t));var r=[],i=[],s=[],o;for(o=2;o<arguments.length;o++)s.push(arguments[o]);for(o=0;o<t;o++)i.push(this[e+o]);for(;o<this.length-e;o++)r.push(this[e+o]);var u=s.length;for(o=0;o<u+r.length;o++)this.items[e+o]=this[e+o]=o<u?s[o]:r[o-u];o=this.items.length=this.length-=t-u;while(this[o])delete this[o++];return new Bn(i)},jn.exclude=function(e){for(var t=0,n=this.length;t<n;t++)if(this[t]==e)return this.splice(t,1),!0},jn.animate=function(e,t,r,i){(n.is(r,"function")||!r)&&(i=r||null);var s=this.items.length,o=s,u,a=this,f;if(!s)return this;i&&(f=function(){!--s&&i.call(a)}),r=n.is(r,M)?r:f;var l=n.animation(e,t,r,f);u=this.items[--o].animate(l);while(o--)this.items[o]&&!this.items[o].removed&&this.items[o].animateWith(u,l,l),this.items[o]&&!this.items[o].removed||s--;return this},jn.insertAfter=function(e){var t=this.items.length;while(t--)this.items[t].insertAfter(e);return this},jn.getBBox=function(){var e=[],t=[],n=[],r=[];for(var i=this.items.length;i--;)if(!this.items[i].removed){var s=this.items[i].getBBox();e.push(s.x),t.push(s.y),n.push(s.x+s.width),r.push(s.y+s.height)}return e=C[d](0,e),t=C[d](0,t),n=N[d](0,n),r=N[d](0,r),{x:e,y:t,x2:n,y2:r,width:n-e,height:r-t}},jn.clone=function(e){e=this.paper.set();for(var t=0,n=this.items.length;t<n;t++)e.push(this.items[t].clone());return e},jn.toString=function(){return"Raphaël‘s set"},jn.glow=function(e){var t=this.paper.set();return this.forEach(function(n,r){var i=n.glow(e);i!=null&&i.forEach(function(e,n){t.push(e)})}),t},jn.isPointInside=function(e,t){var n=!1;return this.forEach(function(r){if(r.isPointInside(e,t))return n=!0,!1}),n},n.registerFont=function(e){if(!e.face)return e;this.fonts=this.fonts||{};var t={w:e.w,face:{},glyphs:{}},n=e.face["font-family"];for(var r in e.face)e.face[a](r)&&(t.face[r]=e.face[r]);this.fonts[n]?this.fonts[n].push(t):this.fonts[n]=[t];if(!e.svg){t.face["units-per-em"]=X(e.face["units-per-em"],10);for(var i in e.glyphs)if(e.glyphs[a](i)){var s=e.glyphs[i];t.glyphs[i]={w:s.w,k:{},d:s.d&&"M"+s.d.replace(/[mlcxtrv]/g,function(e){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[e]||"M"})+"z"};if(s.k)for(var o in s.k)s[a](o)&&(t.glyphs[i].k[o]=s.k[o])}}return e},h.getFont=function(e,t,r,i){i=i||"normal",r=r||"normal",t=+t||{normal:400,bold:700,lighter:300,bolder:800}[t]||400;if(!n.fonts)return;var s=n.fonts[e];if(!s){var o=new RegExp("(^|\\s)"+e.replace(/[^\w\d\s+!~.:_-]/g,g)+"(\\s|$)","i");for(var u in n.fonts)if(n.fonts[a](u)&&o.test(u)){s=n.fonts[u];break}}var f;if(s)for(var l=0,c=s.length;l<c;l++){f=s[l];if(f.face["font-weight"]==t&&(f.face["font-style"]==r||!f.face["font-style"])&&f.face["font-stretch"]==i)break}return f},h.print=function(e,t,r,s,o,u,a,f){u=u||"middle",a=N(C(a||0,1),-1),f=N(C(f||1,3),1);var l=b(r)[w](g),c=0,h=0,p=g,d;n.is(s,"string")&&(s=this.getFont(s));if(s){d=(o||16)/s.face["units-per-em"];var v=s.face.bbox[w](i),m=+v[0],y=v[3]-v[1],E=0,S=+v[1]+(u=="baseline"?y+ +s.face.descent:y/2);for(var x=0,T=l.length;x<T;x++){if(l[x]=="\n")c=0,L=0,h=0,E+=y*f;else{var k=h&&s.glyphs[l[x-1]]||{},L=s.glyphs[l[x]];c+=h?(k.w||s.w)+(k.k&&k.k[l[x]]||0)+s.w*a:0,h=1}L&&L.d&&(p+=n.transformPath(L.d,["t",c*d,E*d,"s",d,d,m,S,"t",(e-m)/d,(t-S)/d]))}}return this.path(p).attr({fill:"#000",stroke:"none"})},h.add=function(e){if(n.is(e,"array")){var t=this.set(),r=0,i=e.length,o;for(;r<i;r++)o=e[r]||{},s[a](o.type)&&t.push(this[o.type]().attr(o))}return t},n.format=function(e,t){var r=n.is(t,_)?[0][v](t):arguments;return e&&n.is(e,M)&&r.length-1&&(e=e.replace(o,function(e,t){return r[++t]==null?g:r[t]})),e||g},n.fullfill=function(){var e=/\{([^\}]+)\}/g,t=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,n=function(e,n,r){var i=r;return n.replace(t,function(e,t,n,r,s){t=t||r,i&&(t in i&&(i=i[t]),typeof i=="function"&&s&&(i=i()))}),i=(i==null||i==r?e:i)+"",i};return function(t,r){return String(t).replace(e,function(e,t){return n(e,t,r)})}}(),n.ninja=function(){return l.was?f.win.Raphael=l.is:delete Raphael,n},n.st=jn,t.on("raphael.DOMload",function(){r=!0}),function(e,t,r){function i(){/in/.test(e.readyState)?setTimeout(i,9):n.eve("raphael.DOMload")}e.readyState==null&&e.addEventListener&&(e.addEventListener(t,r=function(){e.removeEventListener(t,r,!1),e.readyState="complete"},!1),e.readyState="loading"),i()}(document,"DOMContentLoaded"),function(){if(!n.svg)return;var e="hasOwnProperty",t=String,r=parseFloat,i=parseInt,s=Math,o=s.max,u=s.abs,a=s.pow,f=/[, ]+/,l=n.eve,c="",h=" ",p="http://www.w3.org/1999/xlink",d={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},v={};n.toString=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var m=function(r,i){if(i){typeof r=="string"&&(r=m(r));for(var s in i)i[e](s)&&(s.substring(0,6)=="xlink:"?r.setAttributeNS(p,s.substring(6),t(i[s])):r.setAttribute(s,t(i[s])))}else r=n._g.doc.createElementNS("http://www.w3.org/2000/svg",r),r.style&&(r.style.webkitTapHighlightColor="rgba(0,0,0,0)");return r},g=function(e,i){var f="linear",l=e.id+i,h=.5,p=.5,d=e.node,v=e.paper,g=d.style,y=n._g.doc.getElementById(l);if(!y){i=t(i).replace(n._radial_gradient,function(e,t,n){f="radial";if(t&&n){h=r(t),p=r(n);var i=(p>.5)*2-1;a(h-.5,2)+a(p-.5,2)>.25&&(p=s.sqrt(.25-a(h-.5,2))*i+.5)&&p!=.5&&(p=p.toFixed(5)-1e-5*i)}return c}),i=i.split(/\s*\-\s*/);if(f=="linear"){var b=i.shift();b=-r(b);if(isNaN(b))return null;var w=[0,0,s.cos(n.rad(b)),s.sin(n.rad(b))],E=1/(o(u(w[2]),u(w[3]))||1);w[2]*=E,w[3]*=E,w[2]<0&&(w[0]=-w[2],w[2]=0),w[3]<0&&(w[1]=-w[3],w[3]=0)}var S=n._parseDots(i);if(!S)return null;l=l.replace(/[\(\)\s,\xb0#]/g,"_"),e.gradient&&l!=e.gradient.id&&(v.defs.removeChild(e.gradient),delete e.gradient);if(!e.gradient){y=m(f+"Gradient",{id:l}),e.gradient=y,m(y,f=="radial"?{fx:h,fy:p}:{x1:w[0],y1:w[1],x2:w[2],y2:w[3],gradientTransform:e.matrix.invert()}),v.defs.appendChild(y);for(var x=0,T=S.length;x<T;x++)y.appendChild(m("stop",{offset:S[x].offset?S[x].offset:x?"100%":"0%","stop-color":S[x].color||"#fff"}))}}return m(d,{fill:"url('"+document.location+"#"+l+"')",opacity:1,"fill-opacity":1}),g.fill=c,g.opacity=1,g.fillOpacity=1,1},y=function(e){var t=e.getBBox(1);m(e.pattern,{patternTransform:e.matrix.invert()+" translate("+t.x+","+t.y+")"})},b=function(r,i,s){if(r.type=="path"){var o=t(i).toLowerCase().split("-"),u=r.paper,a=s?"end":"start",f=r.node,l=r.attrs,h=l["stroke-width"],p=o.length,g="classic",y,b,w,E,S,x=3,T=3,N=5;while(p--)switch(o[p]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":g=o[p];break;case"wide":T=5;break;case"narrow":T=2;break;case"long":x=5;break;case"short":x=2}g=="open"?(x+=2,T+=2,N+=2,w=1,E=s?4:1,S={fill:"none",stroke:l.stroke}):(E=w=x/2,S={fill:l.stroke,stroke:"none"}),r._.arrows?s?(r._.arrows.endPath&&v[r._.arrows.endPath]--,r._.arrows.endMarker&&v[r._.arrows.endMarker]--):(r._.arrows.startPath&&v[r._.arrows.startPath]--,r._.arrows.startMarker&&v[r._.arrows.startMarker]--):r._.arrows={};if(g!="none"){var C="raphael-marker-"+g,k="raphael-marker-"+a+g+x+T+"-obj"+r.id;n._g.doc.getElementById(C)?v[C]++:(u.defs.appendChild(m(m("path"),{"stroke-linecap":"round",d:d[g],id:C})),v[C]=1);var L=n._g.doc.getElementById(k),A;L?(v[k]++,A=L.getElementsByTagName("use")[0]):(L=m(m("marker"),{id:k,markerHeight:T,markerWidth:x,orient:"auto",refX:E,refY:T/2}),A=m(m("use"),{"xlink:href":"#"+C,transform:(s?"rotate(180 "+x/2+" "+T/2+") ":c)+"scale("+x/N+","+T/N+")","stroke-width":(1/((x/N+T/N)/2)).toFixed(4)}),L.appendChild(A),u.defs.appendChild(L),v[k]=1),m(A,S);var O=w*(g!="diamond"&&g!="oval");s?(y=r._.arrows.startdx*h||0,b=n.getTotalLength(l.path)-O*h):(y=O*h,b=n.getTotalLength(l.path)-(r._.arrows.enddx*h||0)),S={},S["marker-"+a]="url(#"+k+")";if(b||y)S.d=n.getSubpath(l.path,y,b);m(f,S),r._.arrows[a+"Path"]=C,r._.arrows[a+"Marker"]=k,r._.arrows[a+"dx"]=O,r._.arrows[a+"Type"]=g,r._.arrows[a+"String"]=i}else s?(y=r._.arrows.startdx*h||0,b=n.getTotalLength(l.path)-y):(y=0,b=n.getTotalLength(l.path)-(r._.arrows.enddx*h||0)),r._.arrows[a+"Path"]&&m(f,{d:n.getSubpath(l.path,y,b)}),delete r._.arrows[a+"Path"],delete r._.arrows[a+"Marker"],delete r._.arrows[a+"dx"],delete r._.arrows[a+"Type"],delete r._.arrows[a+"String"];for(S in v)if(v[e](S)&&!v[S]){var M=n._g.doc.getElementById(S);M&&M.parentNode.removeChild(M)}}},w={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},E=function(e,n,r){n=w[t(n).toLowerCase()];if(n){var i=e.attrs["stroke-width"]||"1",s={round:i,square:i,butt:0}[e.attrs["stroke-linecap"]||r["stroke-linecap"]]||0,o=[],u=n.length;while(u--)o[u]=n[u]*i+(u%2?1:-1)*s;m(e.node,{"stroke-dasharray":o.join(",")})}},S=function(r,s){var a=r.node,l=r.attrs,h=a.style.visibility;a.style.visibility="hidden";for(var d in s)if(s[e](d)){if(!n._availableAttrs[e](d))continue;var v=s[d];l[d]=v;switch(d){case"blur":r.blur(v);break;case"title":var w=a.getElementsByTagName("title");if(w.length&&(w=w[0]))w.firstChild.nodeValue=v;else{w=m("title");var S=n._g.doc.createTextNode(v);w.appendChild(S),a.appendChild(w)}break;case"href":case"target":var x=a.parentNode;if(x.tagName.toLowerCase()!="a"){var N=m("a");x.insertBefore(N,a),N.appendChild(a),x=N}d=="target"?x.setAttributeNS(p,"show",v=="blank"?"new":v):x.setAttributeNS(p,d,v);break;case"cursor":a.style.cursor=v;break;case"transform":r.transform(v);break;case"arrow-start":b(r,v);break;case"arrow-end":b(r,v,1);break;case"clip-rect":var C=t(v).split(f);if(C.length==4){r.clip&&r.clip.parentNode.parentNode.removeChild(r.clip.parentNode);var k=m("clipPath"),L=m("rect");k.id=n.createUUID(),m(L,{x:C[0],y:C[1],width:C[2],height:C[3]}),k.appendChild(L),r.paper.defs.appendChild(k),m(a,{"clip-path":"url(#"+k.id+")"}),r.clip=L}if(!v){var A=a.getAttribute("clip-path");if(A){var O=n._g.doc.getElementById(A.replace(/(^url\(#|\)$)/g,c));O&&O.parentNode.removeChild(O),m(a,{"clip-path":c}),delete r.clip}}break;case"path":r.type=="path"&&(m(a,{d:v?l.path=n._pathToAbsolute(v):"M0,0"}),r._.dirty=1,r._.arrows&&("startString"in r._.arrows&&b(r,r._.arrows.startString),"endString"in r._.arrows&&b(r,r._.arrows.endString,1)));break;case"width":a.setAttribute(d,v),r._.dirty=1;if(!l.fx)break;d="x",v=l.x;case"x":l.fx&&(v=-l.x-(l.width||0));case"rx":if(d=="rx"&&r.type=="rect")break;case"cx":a.setAttribute(d,v),r.pattern&&y(r),r._.dirty=1;break;case"height":a.setAttribute(d,v),r._.dirty=1;if(!l.fy)break;d="y",v=l.y;case"y":l.fy&&(v=-l.y-(l.height||0));case"ry":if(d=="ry"&&r.type=="rect")break;case"cy":a.setAttribute(d,v),r.pattern&&y(r),r._.dirty=1;break;case"r":r.type=="rect"?m(a,{rx:v,ry:v}):a.setAttribute(d,v),r._.dirty=1;break;case"src":r.type=="image"&&a.setAttributeNS(p,"href",v);break;case"stroke-width":if(r._.sx!=1||r._.sy!=1)v/=o(u(r._.sx),u(r._.sy))||1;a.setAttribute(d,v),l["stroke-dasharray"]&&E(r,l["stroke-dasharray"],s),r._.arrows&&("startString"in r._.arrows&&b(r,r._.arrows.startString),"endString"in r._.arrows&&b(r,r._.arrows.endString,1));break;case"stroke-dasharray":E(r,v,s);break;case"fill":var M=t(v).match(n._ISURL);if(M){k=m("pattern");var _=m("image");k.id=n.createUUID(),m(k,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),m(_,{x:0,y:0,"xlink:href":M[1]}),k.appendChild(_),function(e){n._preload(M[1],function(){var t=this.offsetWidth,n=this.offsetHeight;m(e,{width:t,height:n}),m(_,{width:t,height:n}),r.paper.safari()})}(k),r.paper.defs.appendChild(k),m(a,{fill:"url(#"+k.id+")"}),r.pattern=k,r.pattern&&y(r);break}var D=n.getRGB(v);if(!D.error)delete s.gradient,delete l.gradient,!n.is(l.opacity,"undefined")&&n.is(s.opacity,"undefined")&&m(a,{opacity:l.opacity}),!n.is(l["fill-opacity"],"undefined")&&n.is(s["fill-opacity"],"undefined")&&m(a,{"fill-opacity":l["fill-opacity"]});else if((r.type=="circle"||r.type=="ellipse"||t(v).charAt()!="r")&&g(r,v)){if("opacity"in l||"fill-opacity"in l){var P=n._g.doc.getElementById(a.getAttribute("fill").replace(/^url\(#|\)$/g,c));if(P){var H=P.getElementsByTagName("stop");m(H[H.length-1],{"stop-opacity":("opacity"in l?l.opacity:1)*("fill-opacity"in l?l["fill-opacity"]:1)})}}l.gradient=v,l.fill="none";break}D[e]("opacity")&&m(a,{"fill-opacity":D.opacity>1?D.opacity/100:D.opacity});case"stroke":D=n.getRGB(v),a.setAttribute(d,D.hex),d=="stroke"&&D[e]("opacity")&&m(a,{"stroke-opacity":D.opacity>1?D.opacity/100:D.opacity}),d=="stroke"&&r._.arrows&&("startString"in r._.arrows&&b(r,r._.arrows.startString),"endString"in r._.arrows&&b(r,r._.arrows.endString,1));break;case"gradient":(r.type=="circle"||r.type=="ellipse"||t(v).charAt()!="r")&&g(r,v);break;case"opacity":l.gradient&&!l[e]("stroke-opacity")&&m(a,{"stroke-opacity":v>1?v/100:v});case"fill-opacity":if(l.gradient){P=n._g.doc.getElementById(a.getAttribute("fill").replace(/^url\(#|\)$/g,c)),P&&(H=P.getElementsByTagName("stop"),m(H[H.length-1],{"stop-opacity":v}));break};default:d=="font-size"&&(v=i(v,10)+"px");var B=d.replace(/(\-.)/g,function(e){return e.substring(1).toUpperCase()});a.style[B]=v,r._.dirty=1,a.setAttribute(d,v)}}T(r,s),a.style.visibility=h},x=1.2,T=function(r,s){if(r.type!="text"||!(s[e]("text")||s[e]("font")||s[e]("font-size")||s[e]("x")||s[e]("y")))return;var o=r.attrs,u=r.node,a=u.firstChild?i(n._g.doc.defaultView.getComputedStyle(u.firstChild,c).getPropertyValue("font-size"),10):10;if(s[e]("text")){o.text=s.text;while(u.firstChild)u.removeChild(u.firstChild);var f=t(s.text).split("\n"),l=[],h;for(var p=0,d=f.length;p<d;p++)h=m("tspan"),p&&m(h,{dy:a*x,x:o.x}),h.appendChild(n._g.doc.createTextNode(f[p])),u.appendChild(h),l[p]=h}else{l=u.getElementsByTagName("tspan");for(p=0,d=l.length;p<d;p++)p?m(l[p],{dy:a*x,x:o.x}):m(l[0],{dy:0})}m(u,{x:o.x,y:o.y}),r._.dirty=1;var v=r._getBBox(),g=o.y-(v.y+v.height/2);g&&n.is(g,"finite")&&m(l[0],{dy:g})},N=function(e){return e.parentNode&&e.parentNode.tagName.toLowerCase()==="a"?e.parentNode:e},C=function(e,t){var r=0,i=0;this[0]=this.node=e,e.raphael=!0,this.id=n._oid++,e.raphaelid=this.id,this.matrix=n.matrix(),this.realPath=null,this.paper=t,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!t.bottom&&(t.bottom=this),this.prev=t.top,t.top&&(t.top.next=this),t.top=this,this.next=null},k=n.el;C.prototype=k,k.constructor=C,n._engine.path=function(e,t){var n=m("path");t.canvas&&t.canvas.appendChild(n);var r=new C(n,t);return r.type="path",S(r,{fill:"none",stroke:"#000",path:e}),r},k.rotate=function(e,n,i){if(this.removed)return this;e=t(e).split(f),e.length-1&&(n=r(e[1]),i=r(e[2])),e=r(e[0]),i==null&&(n=i);if(n==null||i==null){var s=this.getBBox(1);n=s.x+s.width/2,i=s.y+s.height/2}return this.transform(this._.transform.concat([["r",e,n,i]])),this},k.scale=function(e,n,i,s){if(this.removed)return this;e=t(e).split(f),e.length-1&&(n=r(e[1]),i=r(e[2]),s=r(e[3])),e=r(e[0]),n==null&&(n=e),s==null&&(i=s);if(i==null||s==null)var o=this.getBBox(1);return i=i==null?o.x+o.width/2:i,s=s==null?o.y+o.height/2:s,this.transform(this._.transform.concat([["s",e,n,i,s]])),this},k.translate=function(e,n){return this.removed?this:(e=t(e).split(f),e.length-1&&(n=r(e[1])),e=r(e[0])||0,n=+n||0,this.transform(this._.transform.concat([["t",e,n]])),this)},k.transform=function(t){var r=this._;if(t==null)return r.transform;n._extractTransform(this,t),this.clip&&m(this.clip,{transform:this.matrix.invert()}),this.pattern&&y(this),this.node&&m(this.node,{transform:this.matrix});if(r.sx!=1||r.sy!=1){var i=this.attrs[e]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":i})}return this},k.hide=function(){return!this.removed&&this.paper.safari(this.node.style.display="none"),this},k.show=function(){return!this.removed&&this.paper.safari(this.node.style.display=""),this},k.remove=function(){var e=N(this.node);if(this.removed||!e.parentNode)return;var t=this.paper;t.__set__&&t.__set__.exclude(this),l.unbind("raphael.*.*."+this.id),this.gradient&&t.defs.removeChild(this.gradient),n._tear(this,t),e.parentNode.removeChild(e),this.removeData();for(var r in this)this[r]=typeof this[r]=="function"?n._removedFactory(r):null;this.removed=!0},k._getBBox=function(){if(this.node.style.display=="none"){this.show();var e=!0}var t=!1,n;this.paper.canvas.parentElement?n=this.paper.canvas.parentElement.style:this.paper.canvas.parentNode&&(n=this.paper.canvas.parentNode.style),n&&n.display=="none"&&(t=!0,n.display="");var r={};try{r=this.node.getBBox()}catch(i){r={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}finally{r=r||{},t&&(n.display="none")}return e&&this.hide(),r},k.attr=function(t,r){if(this.removed)return this;if(t==null){var i={};for(var s in this.attrs)this.attrs[e](s)&&(i[s]=this.attrs[s]);return i.gradient&&i.fill=="none"&&(i.fill=i.gradient)&&delete i.gradient,i.transform=this._.transform,i}if(r==null&&n.is(t,"string")){if(t=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;if(t=="transform")return this._.transform;var o=t.split(f),u={};for(var a=0,c=o.length;a<c;a++)t=o[a],t in this.attrs?u[t]=this.attrs[t]:n.is(this.paper.customAttributes[t],"function")?u[t]=this.paper.customAttributes[t].def:u[t]=n._availableAttrs[t];return c-1?u:u[o[0]]}if(r==null&&n.is(t,"array")){u={};for(a=0,c=t.length;a<c;a++)u[t[a]]=this.attr(t[a]);return u}if(r!=null){var h={};h[t]=r}else t!=null&&n.is(t,"object")&&(h=t);for(var p in h)l("raphael.attr."+p+"."+this.id,this,h[p]);for(p in this.paper.customAttributes)if(this.paper.customAttributes[e](p)&&h[e](p)&&n.is(this.paper.customAttributes[p],"function")){var d=this.paper.customAttributes[p].apply(this,[].concat(h[p]));this.attrs[p]=h[p];for(var v in d)d[e](v)&&(h[v]=d[v])}return S(this,h),this},k.toFront=function(){if(this.removed)return this;var e=N(this.node);e.parentNode.appendChild(e);var t=this.paper;return t.top!=this&&n._tofront(this,t),this},k.toBack=function(){if(this.removed)return this;var e=N(this.node),t=e.parentNode;t.insertBefore(e,t.firstChild),n._toback(this,this.paper);var r=this.paper;return this},k.insertAfter=function(e){if(this.removed||!e)return this;var t=N(this.node),r=N(e.node||e[e.length-1].node);return r.nextSibling?r.parentNode.insertBefore(t,r.nextSibling):r.parentNode.appendChild(t),n._insertafter(this,e,this.paper),this},k.insertBefore=function(e){if(this.removed||!e)return this;var t=N(this.node),r=N(e.node||e[0].node);return r.parentNode.insertBefore(t,r),n._insertbefore(this,e,this.paper),this},k.blur=function(e){var t=this;if(+e!==0){var r=m("filter"),i=m("feGaussianBlur");t.attrs.blur=e,r.id=n.createUUID(),m(i,{stdDeviation:+e||1.5}),r.appendChild(i),t.paper.defs.appendChild(r),t._blur=r,m(t.node,{filter:"url(#"+r.id+")"})}else t._blur&&(t._blur.parentNode.removeChild(t._blur),delete t._blur,delete t.attrs.blur),t.node.removeAttribute("filter");return t},n._engine.circle=function(e,t,n,r){var i=m("circle");e.canvas&&e.canvas.appendChild(i);var s=new C(i,e);return s.attrs={cx:t,cy:n,r:r,fill:"none",stroke:"#000"},s.type="circle",m(i,s.attrs),s},n._engine.rect=function(e,t,n,r,i,s){var o=m("rect");e.canvas&&e.canvas.appendChild(o);var u=new C(o,e);return u.attrs={x:t,y:n,width:r,height:i,rx:s||0,ry:s||0,fill:"none",stroke:"#000"},u.type="rect",m(o,u.attrs),u},n._engine.ellipse=function(e,t,n,r,i){var s=m("ellipse");e.canvas&&e.canvas.appendChild(s);var o=new C(s,e);return o.attrs={cx:t,cy:n,rx:r,ry:i,fill:"none",stroke:"#000"},o.type="ellipse",m(s,o.attrs),o},n._engine.image=function(e,t,n,r,i,s){var o=m("image");m(o,{x:n,y:r,width:i,height:s,preserveAspectRatio:"none"}),o.setAttributeNS(p,"href",t),e.canvas&&e.canvas.appendChild(o);var u=new C(o,e);return u.attrs={x:n,y:r,width:i,height:s,src:t},u.type="image",u},n._engine.text=function(e,t,r,i){var s=m("text");e.canvas&&e.canvas.appendChild(s);var o=new C(s,e);return o.attrs={x:t,y:r,"text-anchor":"middle",text:i,"font-family":n._availableAttrs["font-family"],"font-size":n._availableAttrs["font-size"],stroke:"none",fill:"#000"},o.type="text",S(o,o.attrs),o},n._engine.setSize=function(e,t){return this.width=e||this.width,this.height=t||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox),this},n._engine.create=function(){var e=n._getContainer.apply(0,arguments),t=e&&e.container,r=e.x,i=e.y,s=e.width,o=e.height;if(!t)throw new Error("SVG container not found.");var u=m("svg"),a="overflow:hidden;",f;return r=r||0,i=i||0,s=s||512,o=o||342,m(u,{height:o,version:1.1,width:s,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}),t==1?(u.style.cssText=a+"position:absolute;left:"+r+"px;top:"+i+"px",n._g.doc.body.appendChild(u),f=1):(u.style.cssText=a+"position:relative",t.firstChild?t.insertBefore(u,t.firstChild):t.appendChild(u)),t=new n._Paper,t.width=s,t.height=o,t.canvas=u,t.clear(),t._left=t._top=0,f&&(t.renderfix=function(){}),t.renderfix(),t},n._engine.setViewBox=function(e,t,n,r,i){l("raphael.setViewBox",this,this._viewBox,[e,t,n,r,i]);var s=this.getSize(),u=o(n/s.width,r/s.height),a=this.top,f=i?"xMidYMid meet":"xMinYMin",c,p;e==null?(this._vbSize&&(u=1),delete this._vbSize,c="0 0 "+this.width+h+this.height):(this._vbSize=u,c=e+h+t+h+n+h+r),m(this.canvas,{viewBox:c,preserveAspectRatio:f});while(u&&a)p="stroke-width"in a.attrs?a.attrs["stroke-width"]:1,a.attr({"stroke-width":p}),a._.dirty=1,a._.dirtyT=1,a=a.prev;return this._viewBox=[e,t,n,r,!!i],this},n.prototype.renderfix=function(){var e=this.canvas,t=e.style,n;try{n=e.getScreenCTM()||e.createSVGMatrix()}catch(r){n=e.createSVGMatrix()}var i=-n.e%1,s=-n.f%1;if(i||s)i&&(this._left=(this._left+i)%1,t.left=this._left+"px"),s&&(this._top=(this._top+s)%1,t.top=this._top+"px")},n.prototype.clear=function(){n.eve("raphael.clear",this);var e=this.canvas;while(e.firstChild)e.removeChild(e.firstChild);this.bottom=this.top=null,(this.desc=m("desc")).appendChild(n._g.doc.createTextNode("Created with Raphaël "+n.version)),e.appendChild(this.desc),e.appendChild(this.defs=m("defs"))},n.prototype.remove=function(){l("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var e in this)this[e]=typeof this[e]=="function"?n._removedFactory(e):null};var L=n.st;for(var A in k)k[e](A)&&!L[e](A)&&(L[A]=function(e){return function(){var t=arguments;return this.forEach(function(n){n[e].apply(n,t)})}}(A))}(),function(){if(!n.vml)return;var e="hasOwnProperty",t=String,r=parseFloat,i=Math,s=i.round,o=i.max,u=i.min,a=i.abs,f="fill",l=/[, ]+/,c=n.eve,h=" progid:DXImageTransform.Microsoft",p=" ",d="",v={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},m=/([clmz]),?([^clmz]*)/gi,g=/ progid:\S+Blur\([^\)]+\)/g,y=/-?[^,\s-]+/g,b="position:absolute;left:0;top:0;width:1px;height:1px;behavior:url(#default#VML)",w=21600,E={path:1,rect:1,image:1},S={circle:1,ellipse:1},x=function(e){var r=/[ahqstv]/ig,i=n._pathToAbsolute;t(e).match(r)&&(i=n._path2curve),r=/[clmz]/g;if(i==n._pathToAbsolute&&!t(e).match(r)){var o=t(e).replace(m,function(e,t,n){var r=[],i=t.toLowerCase()=="m",o=v[t];return n.replace(y,function(e){i&&r.length==2&&(o+=r+v[t=="m"?"l":"L"],r=[]),r.push(s(e*w))}),o+r});return o}var u=i(e),a,f;o=[];for(var l=0,c=u.length;l<c;l++){a=u[l],f=u[l][0].toLowerCase(),f=="z"&&(f="x");for(var h=1,g=a.length;h<g;h++)f+=s(a[h]*w)+(h!=g-1?",":d);o.push(f)}return o.join(p)},T=function(e,t,r){var i=n.matrix();return i.rotate(-e,.5,.5),{dx:i.x(t,r),dy:i.y(t,r)}},N=function(e,t,n,r,i,s){var o=e._,u=e.matrix,l=o.fillpos,c=e.node,h=c.style,d=1,v="",m,g=w/t,y=w/n;h.visibility="hidden";if(!t||!n)return;c.coordsize=a(g)+p+a(y),h.rotation=s*(t*n<0?-1:1);if(s){var b=T(s,r,i);r=b.dx,i=b.dy}t<0&&(v+="x"),n<0&&(v+=" y")&&(d=-1),h.flip=v,c.coordorigin=r*-g+p+i*-y;if(l||o.fillsize){var E=c.getElementsByTagName(f);E=E&&E[0],c.removeChild(E),l&&(b=T(s,u.x(l[0],l[1]),u.y(l[0],l[1])),E.position=b.dx*d+p+b.dy*d),o.fillsize&&(E.size=o.fillsize[0]*a(t)+p+o.fillsize[1]*a(n)),c.appendChild(E)}h.visibility="visible"};n.toString=function(){return"Your browser doesn’t support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var C=function(e,n,r){var i=t(n).toLowerCase().split("-"),s=r?"end":"start",o=i.length,u="classic",a="medium",f="medium";while(o--)switch(i[o]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":u=i[o];break;case"wide":case"narrow":f=i[o];break;case"long":case"short":a=i[o]}var l=e.node.getElementsByTagName("stroke")[0];l[s+"arrow"]=u,l[s+"arrowlength"]=a,l[s+"arrowwidth"]=f},k=function(i,a){i.attrs=i.attrs||{};var c=i.node,h=i.attrs,v=c.style,m,g=E[i.type]&&(a.x!=h.x||a.y!=h.y||a.width!=h.width||a.height!=h.height||a.cx!=h.cx||a.cy!=h.cy||a.rx!=h.rx||a.ry!=h.ry||a.r!=h.r),y=S[i.type]&&(h.cx!=a.cx||h.cy!=a.cy||h.r!=a.r||h.rx!=a.rx||h.ry!=a.ry),b=i;for(var T in a)a[e](T)&&(h[T]=a[T]);g&&(h.path=n._getPath[i.type](i),i._.dirty=1),a.href&&(c.href=a.href),a.title&&(c.title=a.title),a.target&&(c.target=a.target),a.cursor&&(v.cursor=a.cursor),"blur"in a&&i.blur(a.blur);if(a.path&&i.type=="path"||g)c.path=x(~t(h.path).toLowerCase().indexOf("r")?n._pathToAbsolute(h.path):h.path),i._.dirty=1,i.type=="image"&&(i._.fillpos=[h.x,h.y],i._.fillsize=[h.width,h.height],N(i,1,1,0,0,0));"transform"in a&&i.transform(a.transform);if(y){var k=+h.cx,A=+h.cy,O=+h.rx||+h.r||0,_=+h.ry||+h.r||0;c.path=n.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",s((k-O)*w),s((A-_)*w),s((k+O)*w),s((A+_)*w),s(k*w)),i._.dirty=1}if("clip-rect"in a){var D=t(a["clip-rect"]).split(l);if(D.length==4){D[2]=+D[2]+ +D[0],D[3]=+D[3]+ +D[1];var P=c.clipRect||n._g.doc.createElement("div"),H=P.style;H.clip=n.format("rect({1}px {2}px {3}px {0}px)",D),c.clipRect||(H.position="absolute",H.top=0,H.left=0,H.width=i.paper.width+"px",H.height=i.paper.height+"px",c.parentNode.insertBefore(P,c),P.appendChild(c),c.clipRect=P)}a["clip-rect"]||c.clipRect&&(c.clipRect.style.clip="auto")}if(i.textpath){var B=i.textpath.style;a.font&&(B.font=a.font),a["font-family"]&&(B.fontFamily='"'+a["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,d)+'"'),a["font-size"]&&(B.fontSize=a["font-size"]),a["font-weight"]&&(B.fontWeight=a["font-weight"]),a["font-style"]&&(B.fontStyle=a["font-style"])}"arrow-start"in a&&C(b,a["arrow-start"]),"arrow-end"in a&&C(b,a["arrow-end"],1);if(a.opacity!=null||a["stroke-width"]!=null||a.fill!=null||a.src!=null||a.stroke!=null||a["stroke-width"]!=null||a["stroke-opacity"]!=null||a["fill-opacity"]!=null||a["stroke-dasharray"]!=null||a["stroke-miterlimit"]!=null||a["stroke-linejoin"]!=null||a["stroke-linecap"]!=null){var j=c.getElementsByTagName(f),F=!1;j=j&&j[0],!j&&(F=j=M(f)),i.type=="image"&&a.src&&(j.src=a.src),a.fill&&(j.on=!0);if(j.on==null||a.fill=="none"||a.fill===null)j.on=!1;if(j.on&&a.fill){var I=t(a.fill).match(n._ISURL);if(I){j.parentNode==c&&c.removeChild(j),j.rotate=!0,j.src=I[1],j.type="tile";var q=i.getBBox(1);j.position=q.x+p+q.y,i._.fillpos=[q.x,q.y],n._preload(I[1],function(){i._.fillsize=[this.offsetWidth,this.offsetHeight]})}else j.color=n.getRGB(a.fill).hex,j.src=d,j.type="solid",n.getRGB(a.fill).error&&(b.type in{circle:1,ellipse:1}||t(a.fill).charAt()!="r")&&L(b,a.fill,j)&&(h.fill="none",h.gradient=a.fill,j.rotate=!1)}if("fill-opacity"in a||"opacity"in a){var R=((+h["fill-opacity"]+1||2)-1)*((+h.opacity+1||2)-1)*((+n.getRGB(a.fill).o+1||2)-1);R=u(o(R,0),1),j.opacity=R,j.src&&(j.color="none")}c.appendChild(j);var U=c.getElementsByTagName("stroke")&&c.getElementsByTagName("stroke")[0],z=!1;!U&&(z=U=M("stroke"));if(a.stroke&&a.stroke!="none"||a["stroke-width"]||a["stroke-opacity"]!=null||a["stroke-dasharray"]||a["stroke-miterlimit"]||a["stroke-linejoin"]||a["stroke-linecap"])U.on=!0;(a.stroke=="none"||a.stroke===null||U.on==null||a.stroke==0||a["stroke-width"]==0)&&(U.on=!1);var W=n.getRGB(a.stroke);U.on&&a.stroke&&(U.color=W.hex),R=((+h["stroke-opacity"]+1||2)-1)*((+h.opacity+1||2)-1)*((+W.o+1||2)-1);var X=(r(a["stroke-width"])||1)*.75;R=u(o(R,0),1),a["stroke-width"]==null&&(X=h["stroke-width"]),a["stroke-width"]&&(U.weight=X),X&&X<1&&(R*=X)&&(U.weight=1),U.opacity=R,a["stroke-linejoin"]&&(U.joinstyle=a["stroke-linejoin"]||"miter"),U.miterlimit=a["stroke-miterlimit"]||8,a["stroke-linecap"]&&(U.endcap=a["stroke-linecap"]=="butt"?"flat":a["stroke-linecap"]=="square"?"square":"round");if("stroke-dasharray"in a){var V={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};U.dashstyle=V[e](a["stroke-dasharray"])?V[a["stroke-dasharray"]]:d}z&&c.appendChild(U)}if(b.type=="text"){b.paper.canvas.style.display=d;var $=b.paper.span,J=100,K=h.font&&h.font.match(/\d+(?:\.\d*)?(?=px)/);v=$.style,h.font&&(v.font=h.font),h["font-family"]&&(v.fontFamily=h["font-family"]),h["font-weight"]&&(v.fontWeight=h["font-weight"]),h["font-style"]&&(v.fontStyle=h["font-style"]),K=r(h["font-size"]||K&&K[0])||10,v.fontSize=K*J+"px",b.textpath.string&&($.innerHTML=t(b.textpath.string).replace(/</g,"&#60;").replace(/&/g,"&#38;").replace(/\n/g,"<br>"));var Q=$.getBoundingClientRect();b.W=h.w=(Q.right-Q.left)/J,b.H=h.h=(Q.bottom-Q.top)/J,b.X=h.x,b.Y=h.y+b.H/2,("x"in a||"y"in a)&&(b.path.v=n.format("m{0},{1}l{2},{1}",s(h.x*w),s(h.y*w),s(h.x*w)+1));var G=["x","y","text","font","font-family","font-weight","font-style","font-size"];for(var Y=0,Z=G.length;Y<Z;Y++)if(G[Y]in a){b._.dirty=1;break}switch(h["text-anchor"]){case"start":b.textpath.style["v-text-align"]="left",b.bbx=b.W/2;break;case"end":b.textpath.style["v-text-align"]="right",b.bbx=-b.W/2;break;default:b.textpath.style["v-text-align"]="center",b.bbx=0}b.textpath.style["v-text-kern"]=!0}},L=function(e,s,o){e.attrs=e.attrs||{};var u=e.attrs,a=Math.pow,f,l,c="linear",h=".5 .5";e.attrs.gradient=s,s=t(s).replace(n._radial_gradient,function(e,t,n){return c="radial",t&&n&&(t=r(t),n=r(n),a(t-.5,2)+a(n-.5,2)>.25&&(n=i.sqrt(.25-a(t-.5,2))*((n>.5)*2-1)+.5),h=t+p+n),d}),s=s.split(/\s*\-\s*/);if(c=="linear"){var v=s.shift();v=-r(v);if(isNaN(v))return null}var m=n._parseDots(s);if(!m)return null;e=e.shape||e.node;if(m.length){e.removeChild(o),o.on=!0,o.method="none",o.color=m[0].color,o.color2=m[m.length-1].color;var g=[];for(var y=0,b=m.length;y<b;y++)m[y].offset&&g.push(m[y].offset+p+m[y].color);o.colors=g.length?g.join():"0% "+o.color,c=="radial"?(o.type="gradientTitle",o.focus="100%",o.focussize="0 0",o.focusposition=h,o.angle=0):(o.type="gradient",o.angle=(270-v)%360),e.appendChild(o)}return 1},A=function(e,t){this[0]=this.node=e,e.raphael=!0,this.id=n._oid++,e.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=t,this.matrix=n.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!t.bottom&&(t.bottom=this),this.prev=t.top,t.top&&(t.top.next=this),t.top=this,this.next=null},O=n.el;A.prototype=O,O.constructor=A,O.transform=function(e){if(e==null)return this._.transform;var r=this.paper._viewBoxShift,i=r?"s"+[r.scale,r.scale]+"-1-1t"+[r.dx,r.dy]:d,s;r&&(s=e=t(e).replace(/\.{3}|\u2026/g,this._.transform||d)),n._extractTransform(this,i+e);var o=this.matrix.clone(),u=this.skew,a=this.node,f,l=~t(this.attrs.fill).indexOf("-"),c=!t(this.attrs.fill).indexOf("url(");o.translate(1,1);if(c||l||this.type=="image"){u.matrix="1 0 0 1",u.offset="0 0",f=o.split();if(l&&f.noRotation||!f.isSimple){a.style.filter=o.toFilter();var h=this.getBBox(),v=this.getBBox(1),m=h.x-v.x,g=h.y-v.y;a.coordorigin=m*-w+p+g*-w,N(this,1,1,m,g,0)}else a.style.filter=d,N(this,f.scalex,f.scaley,f.dx,f.dy,f.rotate)}else a.style.filter=d,u.matrix=t(o),u.offset=o.offset();return s!==null&&(this._.transform=s,n._extractTransform(this,s)),this},O.rotate=function(e,n,i){if(this.removed)return this;if(e==null)return;e=t(e).split(l),e.length-1&&(n=r(e[1]),i=r(e[2])),e=r(e[0]),i==null&&(n=i);if(n==null||i==null){var s=this.getBBox(1);n=s.x+s.width/2,i=s.y+s.height/2}return this._.dirtyT=1,this.transform(this._.transform.concat([["r",e,n,i]])),this},O.translate=function(e,n){return this.removed?this:(e=t(e).split(l),e.length-1&&(n=r(e[1])),e=r(e[0])||0,n=+n||0,this._.bbox&&(this._.bbox.x+=e,this._.bbox.y+=n),this.transform(this._.transform.concat([["t",e,n]])),this)},O.scale=function(e,n,i,s){if(this.removed)return this;e=t(e).split(l),e.length-1&&(n=r(e[1]),i=r(e[2]),s=r(e[3]),isNaN(i)&&(i=null),isNaN(s)&&(s=null)),e=r(e[0]),n==null&&(n=e),s==null&&(i=s);if(i==null||s==null)var o=this.getBBox(1);return i=i==null?o.x+o.width/2:i,s=s==null?o.y+o.height/2:s,this.transform(this._.transform.concat([["s",e,n,i,s]])),this._.dirtyT=1,this},O.hide=function(){return!this.removed&&(this.node.style.display="none"),this},O.show=function(){return!this.removed&&(this.node.style.display=d),this},O.auxGetBBox=n.el.getBBox,O.getBBox=function(){var e=this.auxGetBBox();if(this.paper&&this.paper._viewBoxShift){var t={},n=1/this.paper._viewBoxShift.scale;return t.x=e.x-this.paper._viewBoxShift.dx,t.x*=n,t.y=e.y-this.paper._viewBoxShift.dy,t.y*=n,t.width=e.width*n,t.height=e.height*n,t.x2=t.x+t.width,t.y2=t.y+t.height,t}return e},O._getBBox=function(){return this.removed?{}:{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},O.remove=function(){if(this.removed||!this.node.parentNode)return;this.paper.__set__&&this.paper.__set__.exclude(this),n.eve.unbind("raphael.*.*."+this.id),n._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var e in this)this[e]=typeof this[e]=="function"?n._removedFactory(e):null;this.removed=!0},O.attr=function(t,r){if(this.removed)return this;if(t==null){var i={};for(var s in this.attrs)this.attrs[e](s)&&(i[s]=this.attrs[s]);return i.gradient&&i.fill=="none"&&(i.fill=i.gradient)&&delete i.gradient,i.transform=this._.transform,i}if(r==null&&n.is(t,"string")){if(t==f&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;var o=t.split(l),u={};for(var a=0,h=o.length;a<h;a++)t=o[a],t in this.attrs?u[t]=this.attrs[t]:n.is(this.paper.customAttributes[t],"function")?u[t]=this.paper.customAttributes[t].def:u[t]=n._availableAttrs[t];return h-1?u:u[o[0]]}if(this.attrs&&r==null&&n.is(t,"array")){u={};for(a=0,h=t.length;a<h;a++)u[t[a]]=this.attr(t[a]);return u}var p;r!=null&&(p={},p[t]=r),r==null&&n.is(t,"object")&&(p=t);for(var d in p)c("raphael.attr."+d+"."+this.id,this,p[d]);if(p){for(d in this.paper.customAttributes)if(this.paper.customAttributes[e](d)&&p[e](d)&&n.is(this.paper.customAttributes[d],"function")){var v=this.paper.customAttributes[d].apply(this,[].concat(p[d]));this.attrs[d]=p[d];for(var m in v)v[e](m)&&(p[m]=v[m])}p.text&&this.type=="text"&&(this.textpath.string=p.text),k(this,p)}return this},O.toFront=function(){return!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&n._tofront(this,this.paper),this},O.toBack=function(){return this.removed?this:(this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),n._toback(this,this.paper)),this)},O.insertAfter=function(e){return this.removed?this:(e.constructor==n.st.constructor&&(e=e[e.length-1]),e.node.nextSibling?e.node.parentNode.insertBefore(this.node,e.node.nextSibling):e.node.parentNode.appendChild(this.node),n._insertafter(this,e,this.paper),this)},O.insertBefore=function(e){return this.removed?this:(e.constructor==n.st.constructor&&(e=e[0]),e.node.parentNode.insertBefore(this.node,e.node),n._insertbefore(this,e,this.paper),this)},O.blur=function(e){var t=this.node.runtimeStyle,r=t.filter;return r=r.replace(g,d),+e!==0?(this.attrs.blur=e,t.filter=r+p+h+".Blur(pixelradius="+(+e||1.5)+")",t.margin=n.format("-{0}px 0 0 -{0}px",s(+e||1.5))):(t.filter=r,t.margin=0,delete this.attrs.blur),this},n._engine.path=function(e,t){var n=M("shape");n.style.cssText=b,n.coordsize=w+p+w,n.coordorigin=t.coordorigin;var r=new A(n,t),i={fill:"none",stroke:"#000"};e&&(i.path=e),r.type="path",r.path=[],r.Path=d,k(r,i),t.canvas.appendChild(n);var s=M("skew");return s.on=!0,n.appendChild(s),r.skew=s,r.transform(d),r},n._engine.rect=function(e,t,r,i,s,o){var u=n._rectPath(t,r,i,s,o),a=e.path(u),f=a.attrs;return a.X=f.x=t,a.Y=f.y=r,a.W=f.width=i,a.H=f.height=s,f.r=o,f.path=u,a.type="rect",a},n._engine.ellipse=function(e,t,n,r,i){var s=e.path(),o=s.attrs;return s.X=t-r,s.Y=n-i,s.W=r*2,s.H=i*2,s.type="ellipse",k(s,{cx:t,cy:n,rx:r,ry:i}),s},n._engine.circle=function(e,t,n,r){var i=e.path(),s=i.attrs;return i.X=t-r,i.Y=n-r,i.W=i.H=r*2,i.type="circle",k(i,{cx:t,cy:n,r:r}),i},n._engine.image=function(e,t,r,i,s,o){var u=n._rectPath(r,i,s,o),a=e.path(u).attr({stroke:"none"}),l=a.attrs,c=a.node,h=c.getElementsByTagName(f)[0];return l.src=t,a.X=l.x=r,a.Y=l.y=i,a.W=l.width=s,a.H=l.height=o,l.path=u,a.type="image",h.parentNode==c&&c.removeChild(h),h.rotate=!0,h.src=t,h.type="tile",a._.fillpos=[r,i],a._.fillsize=[s,o],c.appendChild(h),N(a,1,1,0,0,0),a},n._engine.text=function(e,r,i,o){var u=M("shape"),a=M("path"),f=M("textpath");r=r||0,i=i||0,o=o||"",a.v=n.format("m{0},{1}l{2},{1}",s(r*w),s(i*w),s(r*w)+1),a.textpathok=!0,f.string=t(o),f.on=!0,u.style.cssText=b,u.coordsize=w+p+w,u.coordorigin="0 0";var l=new A(u,e),c={fill:"#000",stroke:"none",font:n._availableAttrs.font,text:o};l.shape=u,l.path=a,l.textpath=f,l.type="text",l.attrs.text=t(o),l.attrs.x=r,l.attrs.y=i,l.attrs.w=1,l.attrs.h=1,k(l,c),u.appendChild(f),u.appendChild(a),e.canvas.appendChild(u);var h=M("skew");return h.on=!0,u.appendChild(h),l.skew=h,l.transform(d),l},n._engine.setSize=function(e,t){var r=this.canvas.style;return this.width=e,this.height=t,e==+e&&(e+="px"),t==+t&&(t+="px"),r.width=e,r.height=t,r.clip="rect(0 "+e+" "+t+" 0)",this._viewBox&&n._engine.setViewBox.apply(this,this._viewBox),this},n._engine.setViewBox=function(e,t,r,i,s){n.eve("raphael.setViewBox",this,this._viewBox,[e,t,r,i,s]);var o=this.getSize(),u=o.width,a=o.height,f,l;return s&&(f=a/i,l=u/r,r*f<u&&(e-=(u-r*f)/2/f),i*l<a&&(t-=(a-i*l)/2/l)),this._viewBox=[e,t,r,i,!!s],this._viewBoxShift={dx:-e,dy:-t,scale:o},this.forEach(function(e){e.transform("...")}),this};var M;n._engine.initWin=function(e){var t=e.document;t.styleSheets.length<31?t.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)"):t.styleSheets[0].addRule(".rvml","behavior:url(#default#VML)");try{!t.namespaces.rvml&&t.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),M=function(e){return t.createElement("<rvml:"+e+' class="rvml">')}}catch(n){M=function(e){return t.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},n._engine.initWin(n._g.win),n._engine.create=function(){var e=n._getContainer.apply(0,arguments),t=e.container,r=e.height,i,s=e.width,o=e.x,u=e.y;if(!t)throw new Error("VML container not found.");var a=new n._Paper,f=a.canvas=n._g.doc.createElement("div"),l=f.style;return o=o||0,u=u||0,s=s||512,r=r||342,a.width=s,a.height=r,s==+s&&(s+="px"),r==+r&&(r+="px"),a.coordsize=w*1e3+p+w*1e3,a.coordorigin="0 0",a.span=n._g.doc.createElement("span"),a.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",f.appendChild(a.span),l.cssText=n.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",s,r),t==1?(n._g.doc.body.appendChild(f),l.left=o+"px",l.top=u+"px",l.position="absolute"):t.firstChild?t.insertBefore(f,t.firstChild):t.appendChild(f),a.renderfix=function(){},a},n.prototype.clear=function(){n.eve("raphael.clear",this),this.canvas.innerHTML=d,this.span=n._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},n.prototype.remove=function(){n.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var e in this)this[e]=typeof this[e]=="function"?n._removedFactory(e):null;return!0};var _=n.st;for(var D in O)O[e](D)&&!_[e](D)&&(_[D]=function(e){return function(){var t=arguments;return this.forEach(function(n){n[e].apply(n,t)})}}(D))}(),l.was?f.win.Raphael=n:Raphael=n,typeof exports=="object"&&(module.exports=n),n}),function(e){define("morris",["raphael"],function(){return function(){return function(){var e,t,n,r,i=[].slice,s=function(e,t){return function(){return e.apply(t,arguments)}},o={}.hasOwnProperty,u=function(e,t){function r(){this.constructor=e}for(var n in t)o.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},a=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1};t=window.Morris={},e=jQuery,t.EventEmitter=function(){function e(){}return e.prototype.on=function(e,t){return this.handlers==null&&(this.handlers={}),this.handlers[e]==null&&(this.handlers[e]=[]),this.handlers[e].push(t),this},e.prototype.fire=function(){var e,t,n,r,s,o,u;n=arguments[0],e=2<=arguments.length?i.call(arguments,1):[];if(this.handlers!=null&&this.handlers[n]!=null){o=this.handlers[n],u=[];for(r=0,s=o.length;r<s;r++)t=o[r],u.push(t.apply(null,e));return u}},e}(),t.commas=function(e){var t,n,r,i;return e!=null?(r=e<0?"-":"",t=Math.abs(e),n=Math.floor(t).toFixed(0),r+=n.replace(/(?=(?:\d{3})+$)(?!^)/g,","),i=t.toString(),i.length>n.length&&(r+=i.slice(n.length)),r):"-"},t.pad2=function(e){return(e<10?"0":"")+e},t.Grid=function(n){function r(t){this.resizeHandler=s(this.resizeHandler,this);var n=this;typeof t.element=="string"?this.el=e(document.getElementById(t.element)):this.el=e(t.element);if(this.el==null||this.el.length===0)throw new Error("Graph container element not found");this.el.css("position")==="static"&&this.el.css("position","relative"),this.options=e.extend({},this.gridDefaults,this.defaults||{},t),typeof this.options.units=="string"&&(this.options.postUnits=t.units),this.raphael=new Raphael(this.el[0]),this.elementWidth=null,this.elementHeight=null,this.dirty=!1,this.selectFrom=null,this.init&&this.init(),this.setData(this.options.data),this.el.bind("mousemove",function(e){var t,r,i,s,o;return r=n.el.offset(),o=e.pageX-r.left,n.selectFrom?(t=n.data[n.hitTest(Math.min(o,n.selectFrom))]._x,i=n.data[n.hitTest(Math.max(o,n.selectFrom))]._x,s=i-t,n.selectionRect.attr({x:t,width:s})):n.fire("hovermove",o,e.pageY-r.top)}),this.el.bind("mouseleave",function(e){return n.selectFrom&&(n.selectionRect.hide(),n.selectFrom=null),n.fire("hoverout")}),this.el.bind("touchstart touchmove touchend",function(e){var t,r;return r=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],t=n.el.offset(),n.fire("hovermove",r.pageX-t.left,r.pageY-t.top)}),this.el.bind("click",function(e){var t;return t=n.el.offset(),n.fire("gridclick",e.pageX-t.left,e.pageY-t.top)}),this.options.rangeSelect&&(this.selectionRect=this.raphael.rect(0,0,0,this.el.innerHeight()).attr({fill:this.options.rangeSelectColor,stroke:!1}).toBack().hide(),this.el.bind("mousedown",function(e){var t;return t=n.el.offset(),n.startRange(e.pageX-t.left)}),this.el.bind("mouseup",function(e){var t;return t=n.el.offset(),n.endRange(e.pageX-t.left),n.fire("hovermove",e.pageX-t.left,e.pageY-t.top)})),this.options.resize&&e(window).bind("resize",function(e){return n.timeoutId!=null&&window.clearTimeout(n.timeoutId),n.timeoutId=window.setTimeout(n.resizeHandler,100)}),this.el.css("-webkit-tap-highlight-color","rgba(0,0,0,0)"),this.postInit&&this.postInit()}return u(r,n),r.prototype.gridDefaults={dateFormat:null,axes:!0,grid:!0,gridLineColor:"#aaa",gridStrokeWidth:.5,gridTextColor:"#888",gridTextSize:12,gridTextFamily:"sans-serif",gridTextWeight:"normal",hideHover:!1,yLabelFormat:null,xLabelAngle:0,numLines:5,padding:25,parseTime:!0,postUnits:"",preUnits:"",ymax:"auto",ymin:"auto 0",goals:[],goalStrokeWidth:1,goalLineColors:["#666633","#999966","#cc6666","#663333"],events:[],eventStrokeWidth:1,eventLineColors:["#005a04","#ccffbb","#3a5f0b","#005502"],rangeSelect:null,rangeSelectColor:"#eef",resize:!1},r.prototype.setData=function(e,n){var r,i,s,o,u,a,f,l,c,h,p,d,v,m,g;n==null&&(n=!0),this.options.data=e;if(e==null||e.length===0){this.data=[],this.raphael.clear(),this.hover!=null&&this.hover.hide();return}d=this.cumulative?0:null,v=this.cumulative?0:null,this.options.goals.length>0&&(u=Math.min.apply(Math,this.options.goals),o=Math.max.apply(Math,this.options.goals),v=v!=null?Math.min(v,u):u,d=d!=null?Math.max(d,o):o),this.data=function(){var n,r,o;o=[];for(s=n=0,r=e.length;n<r;s=++n)f=e[s],a={src:f},a.label=f[this.options.xkey],this.options.parseTime?(a.x=t.parseDate(a.label),this.options.dateFormat?a.label=this.options.dateFormat(a.x):typeof a.label=="number"&&(a.label=(new Date(a.label)).toString())):(a.x=s,this.options.xLabelFormat&&(a.label=this.options.xLabelFormat(a))),c=0,a.y=function(){var e,t,n,r;n=this.options.ykeys,r=[];for(i=e=0,t=n.length;e<t;i=++e)p=n[i],m=f[p],typeof m=="string"&&(m=parseFloat(m)),m!=null&&typeof m!="number"&&(m=null),m!=null&&(this.cumulative?c+=m:d!=null?(d=Math.max(m,d),v=Math.min(m,v)):d=v=m),this.cumulative&&c!=null&&(d=Math.max(c,d),v=Math.min(c,v)),r.push(m);return r}.call(this),o.push(a);return o}.call(this),this.options.parseTime&&(this.data=this.data.sort(function(e,t){return(e.x>t.x)-(t.x>e.x)})),this.xmin=this.data[0].x,this.xmax=this.data[this.data.length-1].x,this.events=[],this.options.events.length>0&&(this.options.parseTime?this.events=function(){var e,n,i,s;i=this.options.events,s=[];for(e=0,n=i.length;e<n;e++)r=i[e],s.push(t.parseDate(r));return s}.call(this):this.events=this.options.events,this.xmax=Math.max(this.xmax,Math.max.apply(Math,this.events)),this.xmin=Math.min(this.xmin,Math.min.apply(Math,this.events))),this.xmin===this.xmax&&(this.xmin-=1,this.xmax+=1),this.ymin=this.yboundary("min",v),this.ymax=this.yboundary("max",d),this.ymin===this.ymax&&(v&&(this.ymin-=1),this.ymax+=1);if((g=this.options.axes)===!0||g==="both"||g==="y"||this.options.grid===!0)this.options.ymax===this.gridDefaults.ymax&&this.options.ymin===this.gridDefaults.ymin?(this.grid=this.autoGridLines(this.ymin,this.ymax,this.options.numLines),this.ymin=Math.min(this.ymin,this.grid[0]),this.ymax=Math.max(this.ymax,this.grid[this.grid.length-1])):(l=(this.ymax-this.ymin)/(this.options.numLines-1),this.grid=function(){var e,t,n,r;r=[];for(h=e=t=this.ymin,n=this.ymax;l>0?e<=n:e>=n;h=e+=l)r.push(h);return r}.call(this));this.dirty=!0;if(n)return this.redraw()},r.prototype.yboundary=function(e,t){var n,r;return n=this.options["y"+e],typeof n=="string"?n.slice(0,4)==="auto"?n.length>5?(r=parseInt(n.slice(5),10),t==null?r:Math[e](t,r)):t!=null?t:0:parseInt(n,10):n},r.prototype.autoGridLines=function(e,t,n){var r,i,s,o,u,a,f,l,c;return u=t-e,c=Math.floor(Math.log(u)/Math.log(10)),f=Math.pow(10,c),i=Math.floor(e/f)*f,r=Math.ceil(t/f)*f,a=(r-i)/(n-1),f===1&&a>1&&Math.ceil(a)!==a&&(a=Math.ceil(a),r=i+a*(n-1)),i<0&&r>0&&(i=Math.floor(e/a)*a,r=Math.ceil(t/a)*a),a<1?(o=Math.floor(Math.log(a)/Math.log(10)),s=function(){var e,t;t=[];for(l=e=i;a>0?e<=r:e>=r;l=e+=a)t.push(parseFloat(l.toFixed(1-o)));return t}()):s=function(){var e,t;t=[];for(l=e=i;a>0?e<=r:e>=r;l=e+=a)t.push(l);return t}(),s},r.prototype._calc=function(){var e,t,n,r,i,s,o,u;i=this.el.width(),n=this.el.height();if(this.elementWidth!==i||this.elementHeight!==n||this.dirty){this.elementWidth=i,this.elementHeight=n,this.dirty=!1,this.left=this.options.padding,this.right=this.elementWidth-this.options.padding,this.top=this.options.padding,this.bottom=this.elementHeight-this.options.padding;if((o=this.options.axes)===!0||o==="both"||o==="y")s=function(){var e,n,r,i;r=this.grid,i=[];for(e=0,n=r.length;e<n;e++)t=r[e],i.push(this.measureText(this.yAxisFormat(t)).width);return i}.call(this),this.left+=Math.max.apply(Math,s);if((u=this.options.axes)===!0||u==="both"||u==="x")e=function(){var e,t,n;n=[];for(r=e=0,t=this.data.length;0<=t?e<t:e>t;r=0<=t?++e:--e)n.push(this.measureText(this.data[r].text,-this.options.xLabelAngle).height);return n}.call(this),this.bottom-=Math.max.apply(Math,e);this.width=Math.max(1,this.right-this.left),this.height=Math.max(1,this.bottom-this.top),this.dx=this.width/(this.xmax-this.xmin),this.dy=this.height/(this.ymax-this.ymin);if(this.calc)return this.calc()}},r.prototype.transY=function(e){return this.bottom-(e-this.ymin)*this.dy},r.prototype.transX=function(e){return this.data.length===1?(this.left+this.right)/2:this.left+(e-this.xmin)*this.dx},r.prototype.redraw=function(){this.raphael.clear(),this._calc(),this.drawGrid(),this.drawGoals(),this.drawEvents();if(this.draw)return this.draw()},r.prototype.measureText=function(e,t){var n,r;return t==null&&(t=0),r=this.raphael.text(100,100,e).attr("font-size",this.options.gridTextSize).attr("font-family",this.options.gridTextFamily).attr("font-weight",this.options.gridTextWeight).rotate(t),n=r.getBBox(),r.remove(),n},r.prototype.yAxisFormat=function(e){return this.yLabelFormat(e)},r.prototype.yLabelFormat=function(e){return typeof this.options.yLabelFormat=="function"?this.options.yLabelFormat(e):""+this.options.preUnits+t.commas(e)+this.options.postUnits},r.prototype.drawGrid=function(){var e,t,n,r,i,s,o,u;if(this.options.grid===!1&&(i=this.options.axes)!==!0&&i!=="both"&&i!=="y")return;s=this.grid,u=[];for(n=0,r=s.length;n<r;n++)e=s[n],t=this.transY(e),((o=this.options.axes)===!0||o==="both"||o==="y")&&this.drawYAxisLabel(this.left-this.options.padding/2,t,this.yAxisFormat(e)),this.options.grid?u.push(this.drawGridLine("M"+this.left+","+t+"H"+(this.left+this.width))):u.push(void 0);return u},r.prototype.drawGoals=function(){var e,t,n,r,i,s,o;s=this.options.goals,o=[];for(n=r=0,i=s.length;r<i;n=++r)t=s[n],e=this.options.goalLineColors[n%this.options.goalLineColors.length],o.push(this.drawGoal(t,e));return o},r.prototype.drawEvents=function(){var e,t,n,r,i,s,o;s=this.events,o=[];for(n=r=0,i=s.length;r<i;n=++r)t=s[n],e=this.options.eventLineColors[n%this.options.eventLineColors.length],o.push(this.drawEvent(t,e));return o},r.prototype.drawGoal=function(e,t){return this.raphael.path("M"+this.left+","+this.transY(e)+"H"+this.right).attr("stroke",t).attr("stroke-width",this.options.goalStrokeWidth)},r.prototype.drawEvent=function(e,t){return this.raphael.path("M"+this.transX(e)+","+this.bottom+"V"+this.top).attr("stroke",t).attr("stroke-width",this.options.eventStrokeWidth)},r.prototype.drawYAxisLabel=function(e,t,n){return this.raphael.text(e,t,n).attr("font-size",this.options.gridTextSize).attr("font-family",this.options.gridTextFamily).attr("font-weight",this.options.gridTextWeight).attr("fill",this.options.gridTextColor).attr("text-anchor","end")},r.prototype.drawGridLine=function(e){return this.raphael.path(e).attr("stroke",this.options.gridLineColor).attr("stroke-width",this.options.gridStrokeWidth)},r.prototype.startRange=function(e){return this.hover.hide(),this.selectFrom=e,this.selectionRect.attr({x:e,width:0}).show()},r.prototype.endRange=function(e){var t,n;if(this.selectFrom)return n=Math.min(this.selectFrom,e),t=Math.max(this.selectFrom,e),this.options.rangeSelect.call(this.el,{start:this.data[this.hitTest(n)].x,end:this.data[this.hitTest(t)].x}),this.selectFrom=null},r.prototype.resizeHandler=function(){return this.timeoutId=null,this.raphael.setSize(this.el.width(),this.el.height()),this.redraw()},r}(t.EventEmitter),t.parseDate=function(e){var t,n,r,i,s,o,u,a,f,l,c;return typeof e=="number"?e:(n=e.match(/^(\d+) Q(\d)$/),i=e.match(/^(\d+)-(\d+)$/),s=e.match(/^(\d+)-(\d+)-(\d+)$/),u=e.match(/^(\d+) W(\d+)$/),a=e.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+)(Z|([+-])(\d\d):?(\d\d))?$/),f=e.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+):(\d+(\.\d+)?)(Z|([+-])(\d\d):?(\d\d))?$/),n?(new Date(parseInt(n[1],10),parseInt(n[2],10)*3-1,1)).getTime():i?(new Date(parseInt(i[1],10),parseInt(i[2],10)-1,1)).getTime():s?(new Date(parseInt(s[1],10),parseInt(s[2],10)-1,parseInt(s[3],10))).getTime():u?(l=new Date(parseInt(u[1],10),0,1),l.getDay()!==4&&l.setMonth(0,1+(4-l.getDay()+7)%7),l.getTime()+parseInt(u[2],10)*6048e5):a?a[6]?(o=0,a[6]!=="Z"&&(o=parseInt(a[8],10)*60+parseInt(a[9],10),a[7]==="+"&&(o=0-o)),Date.UTC(parseInt(a[1],10),parseInt(a[2],10)-1,parseInt(a[3],10),parseInt(a[4],10),parseInt(a[5],10)+o)):(new Date(parseInt(a[1],10),parseInt(a[2],10)-1,parseInt(a[3],10),parseInt(a[4],10),parseInt(a[5],10))).getTime():f?(c=parseFloat(f[6]),t=Math.floor(c),r=Math.round((c-t)*1e3),f[8]?(o=0,f[8]!=="Z"&&(o=parseInt(f[10],10)*60+parseInt(f[11],10),f[9]==="+"&&(o=0-o)),Date.UTC(parseInt(f[1],10),parseInt(f[2],10)-1,parseInt(f[3],10),parseInt(f[4],10),parseInt(f[5],10)+o,t,r)):(new Date(parseInt(f[1],10),parseInt(f[2],10)-1,parseInt(f[3],10),parseInt(f[4],10),parseInt(f[5],10),t,r)).getTime()):(new Date(parseInt(e,10),0,1)).getTime())},t.Hover=function(){function n(n){n==null&&(n={}),this.options=e.extend({},t.Hover.defaults,n),this.el=e("<div class='"+this.options["class"]+"'></div>"),this.el.hide(),this.options.parent.append(this.el)}return n.defaults={"class":"morris-hover morris-default-style"},n.prototype.update=function(e,t,n){return e?(this.html(e),this.show(),this.moveTo(t,n)):this.hide()},n.prototype.html=function(e){return this.el.html(e)},n.prototype.moveTo=function(e,t){var n,r,i,s,o,u;return o=this.options.parent.innerWidth(),s=this.options.parent.innerHeight(),r=this.el.outerWidth(),n=this.el.outerHeight(),i=Math.min(Math.max(0,e-r/2),o-r),t!=null?(u=t-n-10,u<0&&(u=t+10,u+n>s&&(u=s/2-n/2))):u=s/2-n/2,this.el.css({left:i+"px",top:parseInt(u)+"px"})},n.prototype.show=function(){return this.el.show()},n.prototype.hide=function(){return this.el.hide()},n}(),t.Line=function(e){function n(e){this.hilight=s(this.hilight,this),this.onHoverOut=s(this.onHoverOut,this),this.onHoverMove=s(this.onHoverMove,this),this.onGridClick=s(this.onGridClick,this);if(!(this instanceof t.Line))return new t.Line(e);n.__super__.constructor.call(this,e)}return u(n,e),n.prototype.init=function(){if(this.options.hideHover!=="always")return this.hover=new t.Hover({parent:this.el}),this.on("hovermove",this.onHoverMove),this.on("hoverout",this.onHoverOut),this.on("gridclick",this.onGridClick)},n.prototype.defaults={lineWidth:3,pointSize:4,lineColors:["#0b62a4","#7A92A3","#4da74d","#afd8f8","#edc240","#cb4b4b","#9440ed"],pointStrokeWidths:[1],pointStrokeColors:["#ffffff"],pointFillColors:[],smooth:!0,xLabels:"auto",xLabelFormat:null,xLabelMargin:24,hideHover:!1},n.prototype.calc=function(){return this.calcPoints(),this.generatePaths()},n.prototype.calcPoints=function(){var e,t,n,r,i,s;i=this.data,s=[];for(n=0,r=i.length;n<r;n++)e=i[n],e._x=this.transX(e.x),e._y=function(){var n,r,i,s;i=e.y,s=[];for(n=0,r=i.length;n<r;n++)t=i[n],t!=null?s.push(this.transY(t)):s.push(t);return s}.call(this),s.push(e._ymax=Math.min.apply(Math,[this.bottom].concat(function(){var n,r,i,s;i=e._y,s=[];for(n=0,r=i.length;n<r;n++)t=i[n],t!=null&&s.push(t);return s}())));return s},n.prototype.hitTest=function(e){var t,n,r,i,s;if(this.data.length===0)return null;s=this.data.slice(1);for(t=r=0,i=s.length;r<i;t=++r){n=s[t];if(e<(n._x+this.data[t]._x)/2)break}return t},n.prototype.onGridClick=function(e,t){var n;return n=this.hitTest(e),this.fire("click",n,this.data[n].src,e,t)},n.prototype.onHoverMove=function(e,t){var n;return n=this.hitTest(e),this.displayHoverForRow(n)},n.prototype.onHoverOut=function(){if(this.options.hideHover!==!1)return this.displayHoverForRow(null)},n.prototype.displayHoverForRow=function(e){var t;return e!=null?((t=this.hover).update.apply(t,this.hoverContentForRow(e)),this.hilight(e)):(this.hover.hide(),this.hilight())},n.prototype.hoverContentForRow=function(e){var t,n,r,i,s,o,u;r=this.data[e],t="<div class='morris-hover-row-label'>"+r.label+"</div>",u=r.y;for(n=s=0,o=u.length;s<o;n=++s)i=u[n],t+="<div class='morris-hover-point' style='color: "+this.colorFor(r,n,"label")+"'>\n  "+this.options.labels[n]+":\n  "+this.yLabelFormat(i)+"\n</div>";return typeof this.options.hoverCallback=="function"&&(t=this.options.hoverCallback(e,this.options,t,r.src)),[t,r._x,r._ymax]},n.prototype.generatePaths=function(){var e,n,r,i;return this.paths=function(){var s,o,u,f;f=[];for(n=s=0,o=this.options.ykeys.length;0<=o?s<o:s>o;n=0<=o?++s:--s)i=typeof this.options.smooth=="boolean"?this.options.smooth:(u=this.options.ykeys[n],a.call(this.options.smooth,u)>=0),e=function(){var e,t,i,s;i=this.data,s=[];for(e=0,t=i.length;e<t;e++)r=i[e],r._y[n]!==void 0&&s.push({x:r._x,y:r._y[n]});return s}.call(this),e.length>1?f.push(t.Line.createPath(e,i,this.bottom)):f.push(null);return f}.call(this)},n.prototype.draw=function(){var e;((e=this.options.axes)===!0||e==="both"||e==="x")&&this.drawXAxis(),this.drawSeries();if(this.options.hideHover===!1)return this.displayHoverForRow(this.data.length-1)},n.prototype.drawXAxis=function(){var e,n,r,i,s,o,u,a,f,l,c=this;u=this.bottom+this.options.padding/2,s=null,i=null,e=function(e,t){var n,r,o,a,f;return n=c.drawXAxisLabel(c.transX(t),u,e),f=n.getBBox(),n.transform("r"+ -c.options.xLabelAngle),r=n.getBBox(),n.transform("t0,"+r.height/2+"..."),c.options.xLabelAngle!==0&&(a=-0.5*f.width*Math.cos(c.options.xLabelAngle*Math.PI/180),n.transform("t"+a+",0...")),r=n.getBBox(),(s==null||s>=r.x+r.width||i!=null&&i>=r.x)&&r.x>=0&&r.x+r.width<c.el.width()?(c.options.xLabelAngle!==0&&(o=1.25*c.options.gridTextSize/Math.sin(c.options.xLabelAngle*Math.PI/180),i=r.x-o),s=r.x-c.options.xLabelMargin):n.remove()},this.options.parseTime?this.data.length===1&&this.options.xLabels==="auto"?r=[[this.data[0].label,this.data[0].x]]:r=t.labelSeries(this.xmin,this.xmax,this.width,this.options.xLabels,this.options.xLabelFormat):r=function(){var e,t,n,r;n=this.data,r=[];for(e=0,t=n.length;e<t;e++)o=n[e],r.push([o.label,o.x]);return r}.call(this),r.reverse(),l=[];for(a=0,f=r.length;a<f;a++)n=r[a],l.push(e(n[0],n[1]));return l},n.prototype.drawSeries=function(){var e,t,n,r,i,s;this.seriesPoints=[];for(e=t=r=this.options.ykeys.length-1;r<=0?t<=0:t>=0;e=r<=0?++t:--t)this._drawLineFor(e);s=[];for(e=n=i=this.options.ykeys.length-1;i<=0?n<=0:n>=0;e=i<=0?++n:--n)s.push(this._drawPointFor(e));return s},n.prototype._drawPointFor=function(e){var t,n,r,i,s,o;this.seriesPoints[e]=[],s=this.data,o=[];for(r=0,i=s.length;r<i;r++)n=s[r],t=null,n._y[e]!=null&&(t=this.drawLinePoint(n._x,n._y[e],this.colorFor(n,e,"point"),e)),o.push(this.seriesPoints[e].push(t));return o},n.prototype._drawLineFor=function(e){var t;t=this.paths[e];if(t!==null)return this.drawLinePath(t,this.colorFor(null,e,"line"),e)},n.createPath=function(e,n,r){var i,s,o,u,a,f,l,c,h,p,d,v,m,g;l="",n&&(o=t.Line.gradients(e)),c={y:null};for(u=m=0,g=e.length;m<g;u=++m){i=e[u];if(i.y!=null)if(c.y!=null)n?(s=o[u],f=o[u-1],a=(i.x-c.x)/4,h=c.x+a,d=Math.min(r,c.y+a*f),p=i.x-a,v=Math.min(r,i.y-a*s),l+="C"+h+","+d+","+p+","+v+","+i.x+","+i.y):l+="L"+i.x+","+i.y;else if(!n||o[u]!=null)l+="M"+i.x+","+i.y;c=i}return l},n.gradients=function(e){var t,n,r,i,s,o,u,a;n=function(e,t){return(e.y-t.y)/(e.x-t.x)},a=[];for(r=o=0,u=e.length;o<u;r=++o)t=e[r],t.y!=null?(i=e[r+1]||{y:null},s=e[r-1]||{y:null},s.y!=null&&i.y!=null?a.push(n(s,i)):s.y!=null?a.push(n(s,t)):i.y!=null?a.push(n(t,i)):a.push(null)):a.push(null);return a},n.prototype.hilight=function(e){var t,n,r,i,s;if(this.prevHilight!==null&&this.prevHilight!==e)for(t=n=0,i=this.seriesPoints.length-1;0<=i?n<=i:n>=i;t=0<=i?++n:--n)this.seriesPoints[t][this.prevHilight]&&this.seriesPoints[t][this.prevHilight].animate(this.pointShrinkSeries(t));if(e!==null&&this.prevHilight!==e)for(t=r=0,s=this.seriesPoints.length-1;0<=s?r<=s:r>=s;t=0<=s?++r:--r)this.seriesPoints[t][e]&&this.seriesPoints[t][e].animate(this.pointGrowSeries(t));return this.prevHilight=e},n.prototype.colorFor=function(e,t,n){return typeof this.options.lineColors=="function"?this.options.lineColors.call(this,e,t,n):n==="point"?this.options.pointFillColors[t%this.options.pointFillColors.length]||this.options.lineColors[t%this.options.lineColors.length]:this.options.lineColors[t%this.options.lineColors.length]},n.prototype.drawXAxisLabel=function(e,t,n){return this.raphael.text(e,t,n).attr("font-size",this.options.gridTextSize).attr("font-family",this.options.gridTextFamily).attr("font-weight",this.options.gridTextWeight).attr("fill",this.options.gridTextColor)},n.prototype.drawLinePath=function(e,t,n){return this.raphael.path(e).attr("stroke",t).attr("stroke-width",this.lineWidthForSeries(n))},n.prototype.drawLinePoint=function(e,t,n,r){return this.raphael.circle(e,t,this.pointSizeForSeries(r)).attr("fill",n).attr("stroke-width",this.pointStrokeWidthForSeries(r)).attr("stroke",this.pointStrokeColorForSeries(r))},n.prototype.pointStrokeWidthForSeries=function(e){return this.options.pointStrokeWidths[e%this.options.pointStrokeWidths.length]},n.prototype.pointStrokeColorForSeries=function(e){return this.options.pointStrokeColors[e%this.options.pointStrokeColors.length]},n.prototype.lineWidthForSeries=function(e){return this.options.lineWidth instanceof Array?this.options.lineWidth[e%this.options.lineWidth.length]:this.options.lineWidth},n.prototype.pointSizeForSeries=function(e){return this.options.pointSize instanceof Array?this.options.pointSize[e%this.options.pointSize.length]:this.options.pointSize},n.prototype.pointGrowSeries=function(e){return Raphael.animation({r:this.pointSizeForSeries(e)+3},25,"linear")},n.prototype.pointShrinkSeries=function(e){return Raphael.animation({r:this.pointSizeForSeries(e)},25,"linear")},n}(t.Grid),t.labelSeries=function(n,r,i,s,o){var u,a,f,l,c,h,p,d,v,m,g;f=200*(r-n)/i,a=new Date(n),p=t.LABEL_SPECS[s];if(p===void 0){g=t.AUTO_LABEL_ORDER;for(v=0,m=g.length;v<m;v++){l=g[v],h=t.LABEL_SPECS[l];if(f>=h.span){p=h;break}}}p===void 0&&(p=t.LABEL_SPECS.second),o&&(p=e.extend({},p,{fmt:o})),u=p.start(a),c=[];while((d=u.getTime())<=r)d>=n&&c.push([p.fmt(u),d]),p.incr(u);return c},n=function(e){return{span:e*60*1e3,start:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours())},fmt:function(e){return""+t.pad2(e.getHours())+":"+t.pad2(e.getMinutes())},incr:function(t){return t.setUTCMinutes(t.getUTCMinutes()+e)}}},r=function(e){return{span:e*1e3,start:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes())},fmt:function(e){return""+t.pad2(e.getHours())+":"+t.pad2(e.getMinutes())+":"+t.pad2(e.getSeconds())},incr:function(t){return t.setUTCSeconds(t.getUTCSeconds()+e)}}},t.LABEL_SPECS={decade:{span:1728e8,start:function(e){return new Date(e.getFullYear()-e.getFullYear()%10,0,1)},fmt:function(e){return""+e.getFullYear()},incr:function(e){return e.setFullYear(e.getFullYear()+10)}},year:{span:1728e7,start:function(e){return new Date(e.getFullYear(),0,1)},fmt:function(e){return""+e.getFullYear()},incr:function(e){return e.setFullYear(e.getFullYear()+1)}},month:{span:24192e5,start:function(e){return new Date(e.getFullYear(),e.getMonth(),1)},fmt:function(e){return""+e.getFullYear()+"-"+t.pad2(e.getMonth()+1)},incr:function(e){return e.setMonth(e.getMonth()+1)}},week:{span:6048e5,start:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},fmt:function(e){return""+e.getFullYear()+"-"+t.pad2(e.getMonth()+1)+"-"+t.pad2(e.getDate())},incr:function(e){return e.setDate(e.getDate()+7)}},day:{span:864e5,start:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},fmt:function(e){return""+e.getFullYear()+"-"+t.pad2(e.getMonth()+1)+"-"+t.pad2(e.getDate())},incr:function(e){return e.setDate(e.getDate()+1)}},hour:n(60),"30min":n(30),"15min":n(15),"10min":n(10),"5min":n(5),minute:n(1),"30sec":r(30),"15sec":r(15),"10sec":r(10),"5sec":r(5),second:r(1)},t.AUTO_LABEL_ORDER=["decade","year","month","week","day","hour","30min","15min","10min","5min","minute","30sec","15sec","10sec","5sec","second"],t.Area=function(n){function i(n){var s;if(!(this instanceof t.Area))return new t.Area(n);s=e.extend({},r,n),this.cumulative=!s.behaveLikeLine,s.fillOpacity==="auto"&&(s.fillOpacity=s.behaveLikeLine?.8:1),i.__super__.constructor.call(this,s)}var r;return u(i,n),r={fillOpacity:"auto",behaveLikeLine:!1},i.prototype.calcPoints=function(){var e,t,n,r,i,s,o;s=this.data,o=[];for(r=0,i=s.length;r<i;r++)e=s[r],e._x=this.transX(e.x),t=0,e._y=function(){var r,i,s,o;s=e.y,o=[];for(r=0,i=s.length;r<i;r++)n=s[r],this.options.behaveLikeLine?o.push(this.transY(n)):(t+=n||0,o.push(this.transY(t)));return o}.call(this),o.push(e._ymax=Math.max.apply(Math,e._y));return o},i.prototype.drawSeries=function(){var e,t,n,r,i,s,o,u,a,f,l;this.seriesPoints=[],this.options.behaveLikeLine?t=function(){a=[];for(var e=0,t=this.options.ykeys.length-1;0<=t?e<=t:e>=t;0<=t?e++:e--)a.push(e);return a}.apply(this):t=function(){f=[];for(var e=u=this.options.ykeys.length-1;u<=0?e<=0:e>=0;u<=0?e++:e--)f.push(e);return f}.apply(this),l=[];for(i=0,s=t.length;i<s;i++)e=t[i],this._drawFillFor(e),this._drawLineFor(e),l.push(this._drawPointFor(e));return l},i.prototype._drawFillFor=function(e){var t;t=this.paths[e];if(t!==null)return t+="L"+this.transX(this.xmax)+","+this.bottom+"L"+this.transX(this.xmin)+","+this.bottom+"Z",this.drawFilledPath(t,this.fillForSeries(e))},i.prototype.fillForSeries=function(e){var t;return t=Raphael.rgb2hsl(this.colorFor(this.data[e],e,"line")),Raphael.hsl(t.h,this.options.behaveLikeLine?t.s*.9:t.s*.75,Math.min(.98,this.options.behaveLikeLine?t.l*1.2:t.l*1.25))},i.prototype.drawFilledPath=function(e,t){return this.raphael.path(e).attr("fill",t).attr("fill-opacity",this.options.fillOpacity).attr("stroke","none")},i}(t.Line),t.Bar=function(n){function r(n){this.onHoverOut=s(this.onHoverOut,this),this.onHoverMove=s(this.onHoverMove,this),this.onGridClick=s(this.onGridClick,this);if(!(this instanceof t.Bar))return new t.Bar(n);r.__super__.constructor.call(this,e.extend({},n,{parseTime:!1}))}return u(r,n),r.prototype.init=function(){this.cumulative=this.options.stacked;if(this.options.hideHover!=="always")return this.hover=new t.Hover({parent:this.el}),this.on("hovermove",this.onHoverMove),this.on("hoverout",this.onHoverOut),this.on("gridclick",this.onGridClick)},r.prototype.defaults={barSizeRatio:.75,barGap:3,barColors:["#0b62a4","#7a92a3","#4da74d","#afd8f8","#edc240","#cb4b4b","#9440ed"],barOpacity:1,barRadius:[0,0,0,0],xLabelMargin:50},r.prototype.calc=function(){var e;this.calcBars();if(this.options.hideHover===!1)return(e=this.hover).update.apply(e,this.hoverContentForRow(this.data.length-1))},r.prototype.calcBars=function(){var e,t,n,r,i,s,o;s=this.data,o=[];for(e=r=0,i=s.length;r<i;e=++r)t=s[e],t._x=this.left+this.width*(e+.5)/this.data.length,o.push(t._y=function(){var e,r,i,s;i=t.y,s=[];for(e=0,r=i.length;e<r;e++)n=i[e],n!=null?s.push(this.transY(n)):s.push(null);return s}.call(this));return o},r.prototype.draw=function(){var e;return((e=this.options.axes)===!0||e==="both"||e==="x")&&this.drawXAxis(),this.drawSeries()},r.prototype.drawXAxis=function(){var e,t,n,r,i,s,o,u,a,f,l,c,h;f=this.bottom+(this.options.xAxisLabelTopPadding||this.options.padding/2),o=null,s=null,h=[];for(e=l=0,c=this.data.length;0<=c?l<c:l>c;e=0<=c?++l:--l)u=this.data[this.data.length-1-e],t=this.drawXAxisLabel(u._x,f,u.label),a=t.getBBox(),t.transform("r"+ -this.options.xLabelAngle),n=t.getBBox(),t.transform("t0,"+n.height/2+"..."),this.options.xLabelAngle!==0&&(i=-0.5*a.width*Math.cos(this.options.xLabelAngle*Math.PI/180),t.transform("t"+i+",0...")),(o==null||o>=n.x+n.width||s!=null&&s>=n.x)&&n.x>=0&&n.x+n.width<this.el.width()?(this.options.xLabelAngle!==0&&(r=1.25*this.options.gridTextSize/Math.sin(this.options.xLabelAngle*Math.PI/180),s=n.x-r),h.push(o=n.x-this.options.xLabelMargin)):h.push(t.remove());return h},r.prototype.drawSeries=function(){var e,t,n,r,i,s,o,u,a,f,l,c,h,p,d;return n=this.width/this.options.data.length,u=this.options.stacked?1:this.options.ykeys.length,e=(n*this.options.barSizeRatio-this.options.barGap*(u-1))/u,this.options.barSize&&(e=Math.min(e,this.options.barSize)),c=n-e*u-this.options.barGap*(u-1),o=c/2,d=this.ymin<=0&&this.ymax>=0?this.transY(0):null,this.bars=function(){var u,c,v,m;v=this.data,m=[];for(r=u=0,c=v.length;u<c;r=++u)a=v[r],i=0,m.push(function(){var u,c,v,m;v=a._y,m=[];for(f=u=0,c=v.length;u<c;f=++u)p=v[f],p!==null?(d?(h=Math.min(p,d),t=Math.max(p,d)):(h=p,t=this.bottom),s=this.left+r*n+o,this.options.stacked||(s+=f*(e+this.options.barGap)),l=t-h,this.options.verticalGridCondition&&this.options.verticalGridCondition(a.x)&&this.drawBar(this.left+r*n,this.top,n,Math.abs(this.top-this.bottom),this.options.verticalGridColor,this.options.verticalGridOpacity,this.options.barRadius),this.options.stacked&&(h-=i),this.drawBar(s,h,e,l,this.colorFor(a,f,"bar"),this.options.barOpacity,this.options.barRadius),m.push(i+=l)):m.push(null);return m}.call(this));return m}.call(this)},r.prototype.colorFor=function(e,t,n){var r,i;return typeof this.options.barColors=="function"?(r={x:e.x,y:e.y[t],label:e.label},i={index:t,key:this.options.ykeys[t],label:this.options.labels[t]},this.options.barColors.call(this,r,i,n)):this.options.barColors[t%this.options.barColors.length]},r.prototype.hitTest=function(e){return this.data.length===0?null:(e=Math.max(Math.min(e,this.right),this.left),Math.min(this.data.length-1,Math.floor((e-this.left)/(this.width/this.data.length))))},r.prototype.onGridClick=function(e,t){var n;return n=this.hitTest(e),this.fire("click",n,this.data[n].src,e,t)},r.prototype.onHoverMove=function(e,t){var n,r;return n=this.hitTest(e),(r=this.hover).update.apply(r,this.hoverContentForRow(n))},r.prototype.onHoverOut=function(){if(this.options.hideHover!==!1)return this.hover.hide()},r.prototype.hoverContentForRow=function(e){var t,n,r,i,s,o,u,a;r=this.data[e],t="<div class='morris-hover-row-label'>"+r.label+"</div>",a=r.y;for(n=o=0,u=a.length;o<u;n=++o)s=a[n],t+="<div class='morris-hover-point' style='color: "+this.colorFor(r,n,"label")+"'>\n  "+this.options.labels[n]+":\n  "+this.yLabelFormat(s)+"\n</div>";return typeof this.options.hoverCallback=="function"&&(t=this.options.hoverCallback(e,this.options,t,r.src)),i=this.left+(e+.5)*this.width/this.data.length,[t,i]},r.prototype.drawXAxisLabel=function(e,t,n){var r;return r=this.raphael.text(e,t,n).attr("font-size",this.options.gridTextSize).attr("font-family",this.options.gridTextFamily).attr("font-weight",this.options.gridTextWeight).attr("fill",this.options.gridTextColor)},r.prototype.drawBar=function(e,t,n,r,i,s,o){var u,a;return u=Math.max.apply(Math,o),u===0||u>r?a=this.raphael.rect(e,t,n,r):a=this.raphael.path(this.roundedRect(e,t,n,r,o)),a.attr("fill",i).attr("fill-opacity",s).attr("stroke","none")},r.prototype.roundedRect=function(e,t,n,r,i){return i==null&&(i=[0,0,0,0]),["M",e,i[0]+t,"Q",e,t,e+i[0],t,"L",e+n-i[1],t,"Q",e+n,t,e+n,t+i[1],"L",e+n,t+r-i[2],"Q",e+n,t+r,e+n-i[2],t+r,"L",e+i[3],t+r,"Q",e,t+r,e,t+r-i[3],"Z"]},r}(t.Grid),t.Donut=function(n){function r(n){this.resizeHandler=s(this.resizeHandler,this),this.select=s(this.select,this),this.click=s(this.click,this);var r=this;if(!(this instanceof t.Donut))return new t.Donut(n);this.options=e.extend({},this.defaults,n),typeof n.element=="string"?this.el=e(document.getElementById(n.element)):this.el=e(n.element);if(this.el===null||this.el.length===0)throw new Error("Graph placeholder not found.");if(n.data===void 0||n.data.length===0)return;this.raphael=new Raphael(this.el[0]),this.options.resize&&e(window).bind("resize",function(e){return r.timeoutId!=null&&window.clearTimeout(r.timeoutId),r.timeoutId=window.setTimeout(r.resizeHandler,100)}),this.setData(n.data)}return u(r,n),r.prototype.defaults={colors:["#0B62A4","#3980B5","#679DC6","#95BBD7","#B0CCE1","#095791","#095085","#083E67","#052C48","#042135"],backgroundColor:"#FFFFFF",labelColor:"#000000",formatter:t.commas,resize:!1},r.prototype.redraw=function(){var e,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x;this.raphael.clear(),n=this.el.width()/2,r=this.el.height()/2,p=(Math.min(n,r)-10)/3,c=0,w=this.values;for(d=0,g=w.length;d<g;d++)h=w[d],c+=h;a=5/(2*p),e=1.9999*Math.PI-a*this.data.length,o=0,s=0,this.segments=[],E=this.values;for(i=v=0,y=E.length;v<y;i=++v)h=E[i],f=o+a+e*(h/c),l=new t.DonutSegment(n,r,p*2,p,o,f,this.data[i].color||this.options.colors[s%this.options.colors.length],this.options.backgroundColor,s,this.raphael),l.render(),this.segments.push(l),l.on("hover",this.select),l.on("click",this.click),o=f,s+=1;this.text1=this.drawEmptyDonutLabel(n,r-10,this.options.labelColor,15,800),this.text2=this.drawEmptyDonutLabel(n,r+10,this.options.labelColor,14),u=Math.max.apply(Math,this.values),s=0,S=this.values,x=[];for(m=0,b=S.length;m<b;m++){h=S[m];if(h===u){this.select(s);break}x.push(s+=1)}return x},r.prototype.setData=function(e){var t;return this.data=e,this.values=function(){var e,n,r,i;r=this.data,i=[];for(e=0,n=r.length;e<n;e++)t=r[e],i.push(parseFloat(t.value));return i}.call(this),this.redraw()},r.prototype.click=function(e){return this.fire("click",e,this.data[e])},r.prototype.select=function(e){var t,n,r,i,s,o;o=this.segments;for(i=0,s=o.length;i<s;i++)n=o[i],n.deselect();return r=this.segments[e],r.select(),t=this.data[e],this.setLabels(t.label,this.options.formatter(t.value,t))},r.prototype.setLabels=function(e,t){var n,r,i,s,o,u,a,f;return n=(Math.min(this.el.width()/2,this.el.height()/2)-10)*2/3,s=1.8*n,i=n/2,r=n/3,this.text1.attr({text:e,transform:""}),o=this.text1.getBBox(),u=Math.min(s/o.width,i/o.height),this.text1.attr({transform:"S"+u+","+u+","+(o.x+o.width/2)+","+(o.y+o.height)}),this.text2.attr({text:t,transform:""}),a=this.text2.getBBox(),f=Math.min(s/a.width,r/a.height),this.text2.attr({transform:"S"+f+","+f+","+(a.x+a.width/2)+","+a.y})},r.prototype.drawEmptyDonutLabel=function(e,t,n,r,i){var s;return s=this.raphael.text(e,t,"").attr("font-size",r).attr("fill",n),i!=null&&s.attr("font-weight",i),s},r.prototype.resizeHandler=function(){return this.timeoutId=null,this.raphael.setSize(this.el.width(),this.el.height()),this.redraw()},r}(t.EventEmitter),t.DonutSegment=function(e){function t(e,t,n,r,i,o,u,a,f,l){this.cx=e,this.cy=t,this.inner=n,this.outer=r,this.color=u,this.backgroundColor=a,this.index=f,this.raphael=l,this.deselect=s(this.deselect,this),this.select=s(this.select,this),this.sin_p0=Math.sin(i),this.cos_p0=Math.cos(i),this.sin_p1=Math.sin(o),this.cos_p1=Math.cos(o),this.is_long=o-i>Math.PI?1:0,this.path=this.calcSegment(this.inner+3,this.inner+this.outer-5),this.selectedPath=this.calcSegment(this.inner+3,this.inner+this.outer),this.hilight=this.calcArc(this.inner)}return u(t,e),t.prototype.calcArcPoints=function(e){return[this.cx+e*this.sin_p0,this.cy+e*this.cos_p0,this.cx+e*this.sin_p1,this.cy+e*this.cos_p1]},t.prototype.calcSegment=function(e,t){var n,r,i,s,o,u,a,f,l,c;return l=this.calcArcPoints(e),n=l[0],i=l[1],r=l[2],s=l[3],c=this.calcArcPoints(t),o=c[0],a=c[1],u=c[2],f=c[3],"M"+n+","+i+("A"+e+","+e+",0,"+this.is_long+",0,"+r+","+s)+("L"+u+","+f)+("A"+t+","+t+",0,"+this.is_long+",1,"+o+","+a)+"Z"},t.prototype.calcArc=function(e){var t,n,r,i,s;return s=this.calcArcPoints(e),t=s[0],r=s[1],n=s[2],i=s[3],"M"+t+","+r+("A"+e+","+e+",0,"+this.is_long+",0,"+n+","+i)},t.prototype.render=function(){var e=this;return this.arc=this.drawDonutArc(this.hilight,this.color),this.seg=this.drawDonutSegment(this.path,this.color,this.backgroundColor,function(){return e.fire("hover",e.index)},function(){return e.fire("click",e.index)})},t.prototype.drawDonutArc=function(e,t){return this.raphael.path(e).attr({stroke:t,"stroke-width":2,opacity:0})},t.prototype.drawDonutSegment=function(e,t,n,r,i){return this.raphael.path(e).attr({fill:t,stroke:n,"stroke-width":3}).hover(r).click(i)},t.prototype.select=function(){if(!this.selected)return this.seg.animate({path:this.selectedPath},150,"<>"),this.arc.animate({opacity:1},150,"<>"),this.selected=!0},t.prototype.deselect=function(){if(this.selected)return this.seg.animate({path:this.path},150,"<>"),this.arc.animate({opacity:0},150,"<>"),this.selected=!1},t}(t.EventEmitter)}.call(this),e.Morris=Morris}.apply(e,arguments)})}(this),define("modules/blends/views/stats",["app","backbone","text!templates/stats_box.html","raphael","morris"],function(e,t,n){toNiceDate=function(e){0==e instanceof Date&&(e=new Date(Date.parse(e)));var t="";return t+=e.getFullYear()+"-",t+=e.getMonth()+1+"-",t+=e.getDate(),t};var r=864e5,i=2592e6,s=(new Date).getTime(),o=new Date(s-i),u=[toNiceDate(o)],a=new Date(o.getTime()+r);while(u.length<=30)u.push(toNiceDate(a)),a.setTime(a.getTime()+r);var f=t.Model.extend({initialize:function(){},parse:function(e){var t={};for(var n in u){var r=u[n];t[r]=0}for(var i in e.MonthDownload){var s=e.MonthDownload[i],o=toNiceDate(s.created);t[o]++}e.Dataset=[];for(var a in t){var f=t[a];e.Dataset.push({date:a,downloads:f})}return e}}),l=t.Collection.extend({model:f,page:1,url:function(){return window.location.pathname+(this.page?"/page:"+this.page:"")},parse:function(e){return e.data}}),c=t.View.extend({events:{},className:"col-large-12",template:_.template(n),initialize:function(){},render:function(){return this.$el.html(this.template(this.model.toJSON())),this.plot(),this},plot:function(){var e=this;setTimeout(function(){e.graph=Morris.Bar({element:"stats-plot-"+e.model.get("Blend").id,data:e.model.get("Dataset"),xkey:["date"],ykeys:["downloads"],labels:["Downloads"],barColors:["#2ab25c"],hideHover:!0,xLabels:"day",smooth:!1}),$(window).on("resize",function(){e.timer&&clearTimeout(e.timer),e.timer=setTimeout(function(){e.graph.redraw()},100)})},200)}});return t.View.extend({el:"#stats-root",events:{},initialize:function(){if(e.isAdmin()||e.isAssociate())this.collection=new l,this.listenTo(this.collection,"reset",this.render),this.listenTo(this.collection,"add",this.render_one_result),this.statsList=this.$el.find("#stats-list"),this.request_stats()},hook_layout:function(){var e=this;$(window).on("scroll",function(){e.check_scroll()})},check_scroll:function(){var e=this,t=$(document).scrollTop(),n=$(window).height(),r=this.$el.height();n+t>=r&&($(window).off("scroll"),this.request_stats())},request_stats:function(){var t=this;e.trigger("spinner:on"),this.collection.fetch({merge:!0,success:function(e){e.page++,t.hook_layout()},error:function(){t.$el.append("<div class='col-large-12'><p class='success-message'>End of stats.</p></div>")}}).always(function(){e.trigger("spinner:off")})},render:function(){VENT.trigger("app:popup:off"),_.each(this.collection.models,function(e){this.render_one_result(e)},this)},render_one_result:function(e){var t=new c({model:e});this.statsList.append(t.render().el)}})}),define("modules/blends/router",["app"],function(e){e.Applications.Blends=Backbone.Router.extend({routes:{"blends/stats/:uid":"blendsStats","blends/user/:uid(/page::pagenum)(/sort::field)(/direction::dir)(/page::pagenum)":"blendsIndex","blends(/index)(/page::pagenum)(/sort::field)(/direction::dir)(/page::pagenum)":"blendsIndex","category/:termName(/index)(/page::pagenum)(/sort::field)(/direction::dir)(/page::pagenum)":"blendsIndex","tag/:termName(/index)(/page::pagenum)(/sort::field)(/direction::dir)(/page::pagenum)":"blendsIndex"},blendsIndex:function(){require(["modules/blends/views/index"],function(e){new e})},blendsStats:function(e,t){require(["modules/blends/views/stats"],function(e){new e})}})}),define("entities/result",["app"],function(e){e.module("Entities",function(e,t,n,r){e.ResultModel=n.Model.extend({defaults:{},initialize:function(){this.on("request",function(){t.trigger("spinner:on")}),this.on("sync error invalid destroy remove",function(){t.trigger("spinner:off")}),this.on("invalid",function(e,n){t.trigger("app:error",n.join(". "))})},url:function(){return"/search"+(this.id?"/"+this.id:"")},parse:function(e){if(e.id)return e;if(e.Result)return e.User&&(e.Result.User=e.User),e.Image&&(e.Result.Image=e.Image),e.Result;alert("Result parsing error, please report you saw this!")}}),e.ResultsCollection=n.Collection.extend({object_id:0,object_class:"None",model:e.ResultModel,initialize:function(e,n){this.object_id=n.oid||0,this.object_class=n.oc||"None",this.on("request",function(){t.trigger("spinner:on")}),this.on("sync error invalid destroy remove",function(){t.trigger("spinner:off")}),console.log(this.url)},parse:function(e){return e}});var i={"new":function(){return new e.ResultModel},children:function(t){return new e.ResultsCollection(t,{parse:!0})},single:function(t){var n=$.Deferred(),r=new e.ResultModel({id:t});return r.fetch({wait:!0,parse:!0,error:function(e){n.resolve(e)},success:function(e){n.resolve(e)}}),n.promise()},collection:function(t){var n=$.Deferred(),r=new e.ResultsCollection([],{url:t});return r.fetch({wait:!0,parse:!0}).always=function(){n.resolve(r)},n.promise()}};t.reqres.setHandler("entities:results:new",function(){return i.new()}),t.reqres.setHandler("entities:results:single",function(e){return i.single(e)}),t.reqres.setHandler("entities:results:collection",function(e){return i.collection(e)})})}),define("modules/search/views/index",["app"],function(e){return e.module("SearchApp.Views",function(e,t,n,r){e.LayoutView=r.CompositeView.extend({el:"#app-content-body",events:{"change select[name='object_class']":"toggleRefinement"},initialize:function(){this.typeSelect=this.$("select[name='object_class']"),this.toggleRefinement()},toggleRefinement:function(e){"Blend"===this.typeSelect.val()?this.$(".blend-refine select").removeAttr("disabled"):this.$(".blend-refine select").prop({disabled:"disabled"})}})}),e.SearchApp.Views.LayoutView}),define("modules/search/controller",["app","entities/result"],function(e){var t=function(e){var t={};if(e){var n=e.split("&");for(var r in n){var i=n[r],s=i.split("=");t[s[0]]=s[1]||""}}return t};return e.module("SearchApp",function(e,n,r,i){e.Controller=i.Controller.extend({index:function(e){options=t(e),require(["modules/search/views/index"],function(e){new e({el:"#app-content-body"})})}})}),e.SearchApp.Controller}),define("modules/search/router",["app","modules/search/controller"],function(e,t){return e.module("SearchApp",function(e,n,r,i){controller=new t,e.Router=i.AppRouter.extend({appRoutes:{search:"index"}}),n.addInitializer(function(){new e.Router({controller:controller})})}),e.SearchApp.Router}),define("modules/requests/router",["app"],function(e){e.Applications.Requests=Backbone.Router.extend({routes:{"requests/user/:username(/page::pagenum)":"requestsIndex"},requestsIndex:function(){},requestsAdd:function(){},requestsView:function(e){},requestsEdit:function(e){}})}),define("entities/question",["app","entities/base"],function(e){return e.module("Entities",function(e,t,n){e.QuestionModel=e.BaseModel.extend({defaults:{title:"",body:"",tags:"",status:"open"},url:function(){return"/questions"+(this.id?"/"+this.id:"")},parse:function(e){if(e.id)return e;if(e.Question)return e.User&&(e.Question.User=e.User),e.Image&&(e.Question.Image=e.Image),e.Follow&&(e.Question.Follow=e.Follow),e.Termrel&&(e.Question.Termrel=e.Termrel,this.parseTaxa(e)),e.Question;t.trigger("app:error","There was an error when parsing a $1 object. Please report you saw this error to the admins.")},parseTaxa:function(e){var t=[];e.Question.tags="",e.Termrel&&(_.each(e.Termrel,function(e){"tag"===e.Term.type&&t.push(e.Term.name)},this),_.isEmpty(t)||(e.Question.tags=t.join(", ")))},validate:function(e){var t=[];t.push(this.validateText(e.title,"title",2,256,!0)),t.push(this.validateText(e.body,"description",50,5e3,!0)),t.push(this.validateTags(e.tags));var n=["open","solved","closed"];t.push(this.validateAllowed(e.status,n)),t=this.cleanErrors(t);if(!_.isEmpty(t))return t}}),e.QuestionsCollection=e.BaseCollection.extend({model:e.QuestionModel,url:function(){return"/questions"},parse:function(e){return e.data?e.data:e}}),e.Questions=n.Collection.extend({model:e.QuestionModel,url:function(){return"/questions"},parse:function(e){return e.data?e.data:e}}),t.reqres.setHandler("entities:questions:new",function(){return new e.QuestionModel}),t.reqres.setHandler("entities:questions:single",function(t){return new e.QuestionModel({id:t})}),t.reqres.setHandler("entities:questions:index",function(t){return new e.QuestionsCollection([],t)}),t.reqres.setHandler("entities:questions:collection",function(t,n){return new e.Questions(t,n)})}),e.Entities}),define("modules/questions/views/single",["app","backbone","entities/question"],function(e,t,n){var r=function(t){e.trigger("app:popup",{data:{pclass:"error-message",message:"An error happened while changing the status of this question."}})},i=function(t){e.trigger("app:popup",{data:{pclass:"success-message",message:"Status successfully changed to "+t.get("status")}})},s=function(){e.trigger("app:popup",{data:{pclass:"error-message",message:"This question was closed by an admin, and only an admin can re-open it."}})};return t.View.extend({object_class:"Question",events:{"click .js-vote-up":"voteUpClicked","click .js-vote-down":"voteDownClicked","click .js-follow":"followClicked","click .js-mark":"markClicked","click .js-close":"closeClicked"},initialize:function(){var t=this.loadFromScript();t&&(this.model=new n.QuestionModel(t,{parse:!0}),this.listenTo(this.model,"request",function(){e.trigger("spinner:on")}),this.listenTo(this.model,"sync error",function(){e.trigger("spinner:off")}),this.listenTo(this.model,"change:status",function(){this.renderStatusButton(),this.renderCloseButton()}),this.render())},render:function(){return e.CurrentUser.isLoggedIn()&&this.initFollow(),this.renderCloseButton(),this.renderStatusButton(),e.trigger("register:user",this.model.get("User")),this},renderStatusButton:function(){var e=this.$(".js-mark"),t=this.model.get("status");"open"===t?e.removeClass("button-green").addClass("").removeAttr("disabled").children(".button-label").text("Mark as Solved"):"solved"===t?e.removeClass("").addClass("button-green").removeAttr("disabled").children(".button-label").text("Mark as Open"):"closed"===t&&e.attr("disabled","disabled").children(".button-label").text("Question Closed")},renderCloseButton:function(){if(e.isAdmin()){var t=this.$(".js-close"),n=this.model.get("status");"closed"===n&&t.children(".button.label").text("Re-open this Question")}},voteUpClicked:function(e){e&&e.preventDefault()},voteDownClicked:function(e){e&&e.preventDefault()},markClicked:function(t){if(t){t.preventDefault();if(!e.isAdmin()&&"closed"===this.model.get("status")){s();return}}var n=this.model.get("status")==="open";this.model.save({status:n?"solved":"open"},{wait:!0,error:r,success:i})},closeClicked:function(t){t&&t.preventDefault();if(e.isAdmin()){var n=this.model.get("status")==="open";this.model.save({status:n?"closed":"open"},{wait:!0,error:r,success:i})}}})}),define("modules/questions/router",["app","backbone"],function(e,t){e.Applications.Questions=t.Router.extend({routes:{"questions/view/:id":"questionsView"},questionsIndex:function(){},questionsAdd:function(){},questionsView:function(e){require(["modules/questions/views/single","modules/comments/controller"],function(t,n){var r=new n;r.prepare({object_class:"Question",object_id:e}),new t({el:".question.question-single"})})},questionsEdit:function(e){}})}),define("text!templates/common/user-sidebar.html",[],function(){return'<ul class="dash-nav-list" id="usernav-feed"><li class="dash-nav-item dash-nav-label" data-tour="activityFilters"><strong>Around me</strong></li><li class="dash-nav-item"><a href="/" class="dashboard-reset dash-nav-link"><span class="icon-home"></span> <span class="dash-nav-label dashboard-reset">All Activity</span></a></li></ul><hr><ul class="dash-nav-list" id="usernav-buzz"><li class="dash-nav-item dash-nav-label" data-tour="buzz"><strong>Conversations</strong></li><li class="dash-nav-item"><a href="/conversations" class="dash-nav-link <%- pending_messages ? \'red\' : \'\' %>"><span class="icon-mail"></span> <span class="dash-nav-label">Conversations (<%- pending_messages %>)</span></a></li></ul><hr><ul class="dash-nav-list hide-for-small" id="usernav-me"><li class="dash-nav-item dash-nav-label" data-tour="myStuff"><strong>My Stuff</strong></li><li class="dash-nav-item"><a href="/user/<%- username %>" class="dash-nav-link"><span class="icon-id-card"></span> <span class="dash-nav-label">My Public Profile</span></a></li><li class="dash-nav-item"><a href="/blends/user/<%- id %>" class="dash-nav-link"><span class="icon-blender"></span> <span class="dash-nav-label">My Blends</span></a></li><li class="dash-nav-item"><a href="/collections/user/<%- id %>" class="dash-nav-link"><span class="icon-folder-plus"></span> <span class="dash-nav-label">My Collections</span></a></li><li class="dash-nav-item" data-tour="advancedStats"><a href="/blends/stats/<%- id %>" class="dash-nav-link strong"><span class="icon-stats"></span> <span class="dash-nav-label">Advanced Stats</span></a></li></ul><hr><ul class="dash-nav-list" id="usernav-config"><li class="dash-nav-item dash-nav-label" data-tour="manageAccount"><strong>Management</strong></li><li class="dash-nav-item"><a href="/users/edit/<%- id %>" class="dash-nav-link"><span class="icon-settings"></span> <span class="dash-nav-label">Account &amp; Settings</span></a></li><li class="dash-nav-item"><a href="/profiles/edit/<%- Profile.id %>" class="dash-nav-link"><span class="icon-user"></span> <span class="dash-nav-label">Edit Profile</span></a></li><li class="dash-nav-item"><a href="/media/portfolio/<%- id %>" class="dash-nav-link"><span class="icon-image"></span> <span class="dash-nav-label">Edit Portfolio</span></a></li><li class="dash-nav-item"><a href="/users/password/<%- id %>" class="dash-nav-link"><span class="icon-login"></span> <span class="dash-nav-label">Change Password</span></a></li><li class="dash-nav-item"><a href="/limits/view/<%- Limit.id %>" class="dash-nav-link"><span class="icon-history"></span> <span class="dash-nav-label">Download History</span></a></li></ul><% if (App.isFree()) { %><hr><ul class="dash-nav-list hide-for-small"><li class=""><h3>Hey,<%- username %>!</h3><p>Would you like to have <strong>Unlimited Bandwidth</strong>, Unlimited Blend Requests, Advanced Stats, Unlimited and Private Collections, No Ads, and more?</p><a href="/upgrade" class="button fatButton">Upgrade Now!</a></li></ul><% } %>'}),define("modules/common/views/user-sidebar",["app","text!templates/common/user-sidebar.html"],function(e,t){return e.module("CommonApp.Views",function(e,n,r,i){e.UserNavView=i.ItemView.extend({className:"dash-nav col-small-12",template:_.template(t),events:{"click a[href='/']":"goHome"},serializeData:function(){return n.CurrentUser.toJSON()}})}),e.CommonApp.Views.UserNavView}),define("text!templates/dashboard/layout.html",[],function(){return'<div class="cage-large-4 cage-small-12" id="dashboard-sidebar"></div><div class="cage-large-8 cage-small-12" id="dashboard-content"></div>'}),define("modules/dashboard/views/layout",["app","text!templates/dashboard/layout.html"],function(e,t){return e.module("DashboardApp.Views",function(e,n,r,i){e.LayoutView=i.LayoutView.extend({className:"cage-small-12",template:_.template(t),regions:{contentRegion:"#dashboard-content",sidebarRegion:"#dashboard-sidebar"},initialize:function(){this.listenTo(n,"dashboard:hook:scroll",this.hookScroll),this.listenTo(n,"dashboard:nothing:more",this.nothingMore)},serializeData:function(){return{is_free:n.isFree()}},hookScroll:function(){this.listenTo(n,"app:scroll",this.evaluateScroll)},evaluateScroll:function(){var e=$(window).height(),t=$(window).scrollTop(),r=this.$el.height();e+t>r&&(this.trigger("load:more"),this.stopListening(n,"app:scroll"))}})}),e.DashboardApp.Views.LayoutView}),define("text!templates/events/index_item.html",[],function(){return'<article class="marker-pale-gray event clearfix type-<%- type %>"><header class="event-title clearfix"><strong class="tight"><%= gravatarImage(User, 32) %><a href="/user/<%- User.username %>"><%- is_own ? \'You\' : User.username %></a><%- action %><% if (\'user-follow\' === type) { %> <a href="/user/<%- object_name %>"><%- object_name === App.CurrentUser.username ? \'You\' : object_name %></a><% } else if (\'user-new\' !== type) { %> <a href="<%- href %>"><%- object_name %></a><% } %></strong><br><span class="small gray"><%- created %></span></header><% if ("user-follow" !== type && "user-new" !== type) { %><section class="event-body clearfix"><% if (img) { %><div class="col-small-4"><a href="<%- href %>"><img src="<%- img %>" alt="<%- object_name %>" width="100%" height="auto"></a></div><% } %><% if (body) { %><div class="body col-small-<%- (img) ? 8 : 12 %>" id="event-<%- id %>"><%= body ? markdown.toHTML(parseAt(body)) : body %></div><% } %><% if (can_edit) { %><div class="cage-small-<%- (img) ? 8 : 12 %> edit hidden"><form action=""><div class="col-small-12"><textarea name="body" rows="5"><%- body %></textarea></div><div class="col-small-12"><button class="button js-save">Save Changes</button> <button class="button button-blue js-edit">Cancel</button></div></form></div><% } %></section><% } %><% if (can_edit) { %><footer class="event-footer small gray margin-top-8 clearfix"><a href="#" class="js-edit">Edit</a> | <a href="#" class="js-delete">Delete</a></footer><% } %></article>'}),define("modules/dashboard/views/index_item",["app","text!templates/events/index_item.html","backbone.syphon"],function(e,t){return e.module("DashboardApp.Views",function(e,n,r,i){e.IndexItemView=i.ItemView.extend({className:"col-small-12",template:_.template(t),events:{"click .js-edit":"editClicked","click .js-delete":"deleteClicked","click .js-save":"submitTriggered","submit form":"submitTriggered"},initialize:function(e){this.listenTo(this.model,"change sync error",this.render)},serializeData:function(){var e=this.model.toJSON();return e.is_own=n.CurrentUser.get("id")===e.user_id,e.can_edit=n.CurrentUser.isAdmin(),e.created=prettyDatetime(e.created),e.CurrentUser=n.CurrentUser.toJSON(),e.action=eventAction(e.type),e},editClicked:function(e){e&&e.preventDefault(),this.$(".body, .edit").toggle()},deleteClicked:function(e){e&&e.preventDefault(),this.trigger("delete")},submitTriggered:function(e){e&&e.preventDefault();var t=r.Syphon.serialize(this);this.trigger("save",t)}})}),e.DashboardApp.Views.IndexItemView}),define("text!templates/dashboard/index.html",[],function(){return'<div class="cage-small-12" id="events-index"></div><div class="col-small-12 text-center" id="dashboard-spinner"><img src="/img/async-light.gif" alt="Loading..."></div>'}),define("modules/dashboard/views/index",["app","modules/dashboard/views/index_item","text!templates/dashboard/index.html"],function(e,t,n){var r=_.template('<div class="success-message with-icon"> Nothing else to load...</div>');return e.module("DashboardApp.Views",function(e,i,s,o){e.IndexView=o.CompositeView.extend({template:_.template(n),childView:t,childViewContainer:"#events-index",initialize:function(){this.listenTo(i,"dashboard:nothing:more",this.nothingMore)},loadMore:function(){var e=this;this.collection.fetch({wait:!0,remove:!1,error:function(){i.trigger("dashboard:nothing:more")},success:function(){e.collection.page++,i.trigger("dashboard:hook:scroll")}})},nothingMore:function(){this.$("#dashboard-spinner").html(r())}})}),e.DashboardApp.Views.IndexView}),define("entities/event",["app","entities/base"],function(e){return e.module("Entities",function(e,t,n,r){e.EventModel=e.BaseModel.extend({defaults:{img:"",body:"",object_id:0,object_name:"",object_class:"",href:"",type:"admin"},initialize:function(){this.on("request",function(){t.trigger("spinner:on")}),this.on("sync error invalid",function(){t.trigger("spinner:off")}),this.on("invalid",function(e,n){t.trigger("app:error",n.join(". "))})},url:function(){return"/events"+(this.id?"/"+this.id:"")},parse:function(e){if(e.id)return e;if(e.Event)return e.User&&(e.Event.User=e.User),e.Event;alert("Event parsing error, please report you saw this!")},validate:function(e){var t=[];!e.body||(HTML_REGEXP.test(e.body)&&t.push("HTML is not allowed, please use Markdown notation"),EMAIL_REGEXP.test(e.body)&&t.push("The event contains an email, please remove it"));if(!_.isEmpty(t))return t}}),e.EventsCollection=e.BaseCollection.extend({page:1,model:e.EventModel});var i={"new":function(){return new e.EventModel},children:function(t){return new e.EventsCollection(t,{parse:!0})},single:function(t){var n=$.Deferred(),r=new e.EventModel({id:t});return r.fetch({wait:!0,parse:!0,error:function(e){n.resolve(e)},success:function(e){n.resolve(e)}}),n.promise()},collection:function(t){var n=$.Deferred(),r=new e.EventsCollection([],t);return r.fetch({wait:!0,parse:!0,error:function(){n.resolve(r)},success:function(){n.resolve(r)}}),n.promise()}};t.reqres.setHandler("entities:events:new",function(){return i.new()}),t.reqres.setHandler("entities:events:single",function(e){return i.single(e)}),t.reqres.setHandler("entities:events:collection",function(e){return i.collection(e)}),t.reqres.setHandler("entities:events:children",function(e){return i.children(e)})}),e.Entities}),define("modules/dashboard/controller",["app"],function(e){return e.module("DashboardApp",function(e,t,n,r){e.Controller=r.Controller.extend({index:function(){t.isLoggedIn()?this._loadDashboard():this._loadHomePage()},_loadHomePage:function(){},_loadDashboard:function(){require(["modules/common/views/user-sidebar","modules/dashboard/views/layout","modules/dashboard/views/index","entities/event"],function(e,n,r){var i=t.request("entities:events:collection");$.when(i).done(function(i){i.page++;var s=new n,o=new e,u=new r({collection:i});u.on("childview:save",function(e,n){e.model.save(n,{wait:!0,error:function(){t.trigger("app:error","Impossible to update this event.")},success:function(){e.render()}})}),u.on("childview:delete",function(e){confirm("The event will be deleted permanently, are you sure?")&&e.model.destroy({wait:!0,error:function(){t.trigger("app:error","Impossible to delete this event.")}})}),t.on("dashboard:load:more",function(){u.loadMore()}),s.on("load:more",function(){t.trigger("dashboard:load:more")}),t.trigger("dashboard:hook:scroll"),s.on("show",function(){s.sidebarRegion.show(o),s.contentRegion.show(u)}),t.contentRegion.show(s)})})}})}),e.DashboardApp.Controller}),define("modules/dashboard/router",["app","modules/dashboard/controller"],function(e,t){e.module("DashboardApp",function(e,n,r,i){var s=new t;e.Router=i.AppRouter.extend({appRoutes:{"":"index"}}),n.on("route:home",function(){n.navigate("/"),s.index()}),n.addInitializer(function(){new e.Router({controller:s})})})}),define("collections/items",["backbone","models/item"],function(e,t){return e.Collection.extend({model:t,url:function(){return"/items.json"}})}),define("text!templates/collections/one_item.html",[],function(){return'<div class="box-pale-gray"><div class="margin-bottom-8"><img src="<%- Blend.Image[0].small %>" alt="<%- Blend.title %>" width="100%" height="auto"></div><div class="margin-top-8 continue"><strong><%- Blend.title %></strong></div><div class="margin-top-8 continue"><a href="#" class="small js-delete">Remove from collection <span class="icon-delete"></span></a></div></div>'}),define("modules/collections/views/items",["app","backbone","text!templates/collections/one_item.html"],function(e,t,n){var r=t.View.extend({className:"col-large-3 col-medium-4 col-small-6",template:_.template(n),events:{"click .js-delete":"deleteClicked"},initialize:function(){this.listenTo(this.model,"destroy",this.unrender)},render:function(){return this.$el.html(this.template(this.model.toJSON())),this},unrender:function(){var e=this;this.$el.hide(500,function(){e.close()})},deleteClicked:function(e){e&&e.preventDefault(),confirm("The blend will be removed from the collection. Are you sure?")&&this.model.destroy({wait:!0})}});return t.View.extend({el:"#items-list",events:{"click .js-load-items":"loadItemsClicked"},initialize:function(t){this.listenTo(this.collection,"request",function(){e.trigger("spinner:on")}),this.listenTo(this.collection,"error sync destroy",function(){e.trigger("spinner:off")}),this.listenTo(this.collection,"sync",this.render)},render:function(){this.$(".index").empty(),_.each(this.collection.models,this.renderOneItem,this)},renderOneItem:function(e){var t=new r({model:e});this.$(".index").append(t.render().el)},loadItemsClicked:function(e){e&&e.preventDefault(),this.collection.fetch({wait:!0,reset:!0,error:function(){},success:function(){}})}})}),define("modules/collections/router",["app","backbone"],function(e,t){e.Applications.CollectionsApp=t.Router.extend({routes:{"collections(/index)(/page::pagenum)(/sort::field)(/direction::dir)":"collectionsIndex","collections/view/:collectionID(*args)":"collectionsIndex","collections/edit/:collectionID":"collectionsEdit","collections/user/:userID(*args)":"collectionsIndex"},collectionsIndex:function(){require(["modules/blends/views/index"],function(e){new e})},collectionsEdit:function(e){require(["collections/items","modules/collections/views/items"],function(t,n){var r="/items/in/"+e,i=new t;i.url=r,new n({collection:i})})}})}),define("modules/memberships/views/add",["app","backbone"],function(e,t){return t.View.extend({events:{"submit form":"submitClicked"},submitClicked:function(e){var t="You've chosen the ",n=$(e.target).find("select");return n.length>0?t+=n.find("option:selected").text()+". ":t+="$5 24 hour Deadline Membership. ",confirm(t+"We will now take you to PayPal so the payment process is completed.\n\nDo you want to continue?")}})}),define("modules/memberships/router",["app","backbone"],function(e,t){e.Applications.Memberships=t.Router.extend({routes:{upgrade:"membershipsAdd","memberships/add":"membershipsAdd"},membershipsAdd:function(){var e=this;require(["modules/memberships/views/add"],function(e){new e({el:".memberships-add"})})}})}),define("modules/common/views/infinite",["app","backbone"],function(e,t){return t.View.extend({ownScroll:!1,render:function(){return this.template&&this.$el.html(this.template()),this},renderChild:function(e){if(this.ChildView){var t=new this.ChildView({model:e});this.$("#children-list").append(t.render().el)}},initInfinite:function(){if(!this.collection)return!1;this.collection&&(this.listenTo(this.collection,"request",function(){e.trigger("spinner:on")}),this.listenTo(this.collection,"sync error reset",function(){e.trigger("spinner:off")})),this.collection.page=1,this.listenTo(this.collection,"add",function(e){this.renderChild&&this.renderChild(e)}),this.fetchCollection()},fetchCollection:function(){var e=this;this.collection.fetch({wait:!0,success:function(t){t.page++,e.hookScroll()},error:function(){e.nothingElseToLoad()}})},hookScroll:function(){this.listenTo(e,"app:scroll",this.processScroll);var t=this.ownScroll?this.$el:$(document);t.on("scroll",function(){e.trigger("app:scroll")})},processScroll:function(){var t=parseInt(this.$el.offset().top,10),n=parseInt(this.$el.height(),10),r=parseInt($(window).height(),10),i=parseInt($(window).scrollTop(),10);n+t<=i+r&&(this.stopListening(e,"app:scroll"),this.fetchCollection())},nothingElseToLoad:function(){var e=$("<div>",{html:"<div class=success-message>Nothing else to load</span>","class":"text-center col-large-12"});this.$("#children-list").append(e)}})}),define("models/conversation",["app","backbone","models/base_model"],function(e,t,n){return n.extend({defaults:{user_id:e.CurrentUser.get("id")},parse:function(t){var n=String(t.User.id),r=String(e.CurrentUser.get("id"));return n===r?t.Conversation.Interlocutor=t.ToUser:t.Conversation.Interlocutor=t.User,t.Conversation.Message=t.Message,t.Conversation.User=t.User,t.Conversation.ToUser=t.ToUser,t.Conversation},url:function(){return"/conversations"+(this.id?"/"+this.id:"")},validate:function(e,t){return null}})}),define("collections/conversations",["backbone","models/conversation"],function(e,t){return e.Collection.extend({model:t,page:1,parse:function(e){return"undefined"!=typeof e.data?e.data:e},url:function(){return"/conversations/index/page:"+this.page+".json"},set_page:function(e){this.page=e}})}),define("text!templates/conversations/index_item.html",[],function(){return'<div class="box-lighter clk message <%- is_own ? \'\' : Message[0].status %>"><% if (Interlocutor.username) { %><div class="align-left"><img src="//www.gravatar.com/avatar/<%- Interlocutor.email %>.jpg?d=<%- encodeURIComponent(\'//www.blendswap.com/img/defaults/default_avatar.png\') %>&s=128&r=pg" alt="Avatar" width="64px" height="64px"></div><div class="shrinkwrap"><strong><%- Interlocutor.username %></strong></div><% if (Message[0]) { %><div><%= markdown.toHTML(Message[0].body.substr(0, 64) + "[...]") %></div><div class="gray small"><% if (App.isAdmin()) { %><a href="#" class="js-delete">Delete</a><% } %><%- prettyDatetime(Message[0].modified) %></div><% } %><% } %></div>'}),define("collections/messages",["backbone","models/message"],function(e,t){return e.Collection.extend({page:1,tmpPage:1,conversation_id:0,model:t,initialize:function(e){this.conversation_id=e.conversation_id},url:function(){return"/messages/index/"+this.conversation_id+".json"},parse:function(e){return e.data},comparator:function(e,t){var n=e.get("created"),r=t.get("created");return n>r?1:-1}})}),define("text!templates/conversations/one_message.html",[],function(){return'<div class="message <%- status %> <%- is_own ? \'own\' : \'other\' %>"><div class="message-card"><img src="//www.gravatar.com/avatar/<%- User.email %>.jpg?d=<%- encodeURIComponent(\'//www.blendswap.com/img/defaults/default_avatar.png\') %>&s=40&r=pg" alt="Avatar" width="40px" height="40px"><br></div><div class="message-content padded-8"><div class="message-body"><%= markdown.toHTML(body) %></div><div class="message-date small gray"><%- prettyDatetime(created) %></div></div></div>'}),define("modules/conversations/views/one_message",["app","backbone","text!templates/conversations/one_message.html"],function(e,t,n){return t.View.extend({className:"col-large-12",template:_.template(n),render:function(){return this.$el.html(this.template(this.model.toJSON())),this}})}),define("text!templates/conversations/modal_single.html",[],function(){return'<div class="modal contained"><header class="contained-header"><h1 class="contained-title continue">Conversation with <a target="_blank" href="/user/<%- Interlocutor.username %>"><%- Interlocutor.username %></a></h1><div class="contained-actions"><span class="icon-close js-close"></span></div></header><section class="contained-body cage-large-12"><div class="col-large-12 clearfix" id="children-list"></div></section><footer class="contained-footer col-large-12"><div class="col-large-12"><input type="text" class="block full js-message" name="body" placeholder="Your message"></div></footer></div>'}),define("modules/conversations/views/modal_single",["app","modules/common/views/modal","collections/messages","modules/conversations/views/one_message","text!templates/conversations/modal_single.html"],function(e,t,n,r,i){var s=_.template('<div class="col-large-12"><div class="success-message">Nothing else to load</div></div>'),o=function(){e.trigger("app:popup",{data:{pclass:"error-message",message:"An error happened while sending your new message; please try again and report this error if you see it again!"}})},u=function(){e.trigger("app:popup",{data:{pclass:"error-message",message:"An error happened while fetching the messages in this conversation; please try again and report this error if you see it again!"}})};return t.extend({template:_.template(i),events:{click:"shouldClose","click .js-close":"unrender","keyup .js-message":"keyupBody"},initialize:function(e){this.childrenViews=[],this.collection=new n({conversation_id:this.model.get("id")}),this.messages=new n({conversation_id:this.model.get("id")}),this.listenTo(this.messages,"add",this.addToCollection),this.listenTo(this.collection,"reset",this.render),this.afterInit(),this.collection.fetch({reset:!0,error:u})},addToCollection:function(){_.each(this.messages.models,function(e){this.collection.add(e.toJSON())},this)},onShow:function(){this.inputBox=this.$(".js-message").eq(0),this.childrenList=this.$("#children-list"),this.containedBody=this.$(".contained-body"),this.listenTo(this.collection,"add",this.renderChild);var e=this.model.get("Interlocutor"),t="App"==e.username||"82109"==e.id,n=!e.username,r="blocked"==e.status;(t||n||r)&&this.disableForm(),this.renderChildren()},onClose:function(){this.timer&&clearInterval(this.timer)},renderChildren:function(){_.isEmpty(this.childrenViews)||_.each(this.childrenViews,function(e){e&&e.close()}),_.each(this.collection.models,this.renderChild,this)},renderChild:function(e,t){var n=this,i=new r({model:e});this.childrenViews.push(i),this.childrenList.append(i.render().el),t==this.collection.length-1&&setTimeout(function(){n.scrollToBottom()},500)},hookBodyScroll:function(){this.listenTo(e,"view:scroll",this.handleScroll)},scrollToBottom:function(){var e=this;this.lastLoaded=this.childrenList.height(),this.containedBody.animate({scrollTop:this.lastLoaded},250,"swing",function(){e.hookBodyScroll()}),this.inputBox.focus()},scrollToLastLoaded:function(){},keyupBody:function(e){ENTER_KEY===e.keyCode&&this.saveNewMessage(e.target)},saveNewMessage:function(t){var n=this;this.disableForm();var r=this.collection.create({status:"unread",body:$(t).val(),user_id:e.CurrentUser.get("id"),conversation_id:this.model.get("id"),to_user_id:this.model.get("Interlocutor").id},{wait:!0,error:function(){n.enableForm(),o()},success:function(){n.enableForm(),n.inputBox.val(""),n.scrollToBottom()}});r.isValid()||n.enableForm()},nothingElse:function(){this.childrenList.prepend(s())}})}),define("modules/conversations/views/index_item",["app","backbone","text!templates/conversations/index_item.html"],function(e,t,n){return t.View.extend({className:"col-large-12 clk",template:_.template(n),events:{"click .js-delete":"deleteClicked",click:"loadSingle"},initialize:function(){this.listenTo(this.model,"destroy",this.close)},serializeData:function(){var t=this.model.toJSON();return t.is_own=t.Message[0].user_id===e.CurrentUser.get("id"),t},render:function(){return this.$el.html(this.template(this.serializeData())),this},loadSingle:function(){var e=this;require(["modules/conversations/views/modal_single"],function(t){new t({model:e.model})})},deleteClicked:function(e){e.preventDefault(),e.stopPropagation(),this.model.destroy({wait:!0})}})}),define("text!templates/conversations/index.html",[],function(){return'<div class="col-large-12"><button class="button button-green js-new">New Conversation</button></div><div id="children-list" class="cage-large-12"></div>'}),define("modules/conversations/views/index",["app","backbone","modules/common/views/infinite","collections/conversations","modules/conversations/views/index_item","text!templates/conversations/index.html"],function(e,t,n,r,i,s){return n.extend({el:"#conversations-index",template:_.template(s),events:{"click .js-new":"newConversation"},initialize:function(){this.ChildView=i,this.collection=new r,this.initInfinite(),this.render()},newConversation:function(e){e.preventDefault(),require(["modules/conversations/views/modal_add"],function(e){new e({})})}})}),define("modules/conversations/router",["app","backbone"],function(e,t){e.Applications.Conversations=t.Router.extend({routes:{conversations:"conversationsIndex"},conversationsIndex:function(){var e=this;require(["modules/conversations/views/index"],function(e){new e})}})}),define("entities/term",["app","entities/base"],function(e){return e.module("Entities",function(e,t,n){e.TermModel=e.BaseModel.extend({url:function(){return"/terms"+this.getIDUrl()},parse:function(e){if(e.id)return e;if(e.Term)return e.children&&(e.Term.children=e.children),e.Term;t.trigger("app:error","There was an error when parsing a term object")}}),e.TermsCollection=e.BaseCollection.extend({term_type:"",model:e.TermModel,initialize:function(e,t){t.term_type&&(this.term_type=t.term_type)},url:function(){return"/terms/index/type:"+this.term_type},parse:function(e){return e.data?e.data:e}}),t.reqres.setHandler("entities:terms:type",function(t){return new e.TermsCollection([],{term_type:t})})}),e.Entities}),define("text!templates/blends/form_view.html",[],function(){return'<div id="guidelines-region" class="cage-large-12 <%- isNew ? \'\' : \'hidden\' %>"><div class="col-large-12"><div class="box-red"><div class="col-large-6 col-small-12"><h1 class="shrinkwrap">Statement of Compliance</h1></div><div class="col-large-6 col-small-12">By hitting the button at the end of this page you acknowledge you have read, agree and comply with this document . You also agree that your failure to comply with this document has consequences, anything from rejection of your asset , to a full ban and public exposure of your profile.</div></div></div><div class="col-large-12"><hr></div><div class="cage-large-12"><div class="col-large-6 col-small-12"><h4 class="shrinkwrap"><span class="green text-big-56 align-left">#1</span> I made this blend from scratch and/or it\'s based on Open Source content.</h4></div><div class="col-large-6 col-small-12"><ul class="shrinkwrap"><li>This blend is my own original idea/design, I made every part of it</li><li>This blend was designed/made by a friend of mine and I\'m explicitly authorized to distribute it.</li><li>This blend is not my original design, but it\'s based on content licensed under <a href="https://creativecommons.com" target="_blank">Creative Commons</a></li></ul></div><div class="col-large-12"><hr></div></div><div class="cage-large-12"><div class="col-large-6 col-small-12"><h4 class="shrinkwrap"><span class="green text-big-56 align-left">#2</span> The third party assets I may have used are properly licensed.</h4></div><div class="col-large-6 col-small-12"><ul class="shrinkwrap"><li>All textures and media from other people I use in this blend allow the use I have given them.</li><li>I will respect any requirements attached to the third party assets I used, including, but not limited to, author attribution and non-commercial clauses.</li></ul></div><div class="col-large-12"><hr></div></div><div class="cage-large-12"><div class="col-large-6 col-small-12"><h4 class="shrinkwrap"><span class="green text-big-56 align-left">#3</span> My blend can be used in production environments.</h4></div><div class="col-large-6 col-small-12"><ul class="shrinkwrap"><li>My blend is ready to be used in a movie, game or still render with little to no configuration.</li><li>My blend is NOT a test or work in progress (WIP); it doesn\'t need to be finished by other users of Blend Swap in order to use it.</li></ul></div><div class="col-large-12"><hr></div></div><div class="cage-large-12"><div class="col-large-6 col-small-12"><h4 class="shrinkwrap"><span class="green text-big-56 align-left">#4</span> My blend contains all the files it needs to work as intended.</h4></div><div class="col-large-6 col-small-12"><ul class="shrinkwrap"><li>I\'ve packed my blend file using:<br><strong class="green">File / External Data / Pack all into .blend</strong></li><li>My blend\'s required media files are present in the .zip file I will upload to Blend Swap.</li><li>I used <em class="green">relative paths</em> for my external data.</li></ul></div><div class="col-large-12"><hr></div></div><div class="cage-large-12"><div class="col-large-6 col-small-12"><h4 class="shrinkwrap"><span class="green text-big-56 align-left">#5</span> My blend\'s information and preview images are accurate.</h4></div><div class="col-large-6 col-small-12"><ul class="shrinkwrap"><li>Anyone can get my preview image by making a screen shot or rendering the completed scene.</li><li>The description of my blend, the blender version and all other textual information I\'ll include is accurate.</li></ul></div><div class="col-large-12"><hr></div></div><div class="col-large-12"><div class="success-message">Remember that moderation can take anywhere from a couple minutes to a couple of days, depending on the availability of the admins. You will be notified by email with the results of moderation.</div></div><div class="col-large-12"><hr><p class="text-center"><button class="button button-big button-green js-form-accept"><span class="icon-follow"></span> I COMPLY WITH THIS DOCUMENT</button></p></div></div><div id="form-region" class="cage-large-12 <%- isNew ? \'hidden\' : \'\' %>"><div class="cage-large-8 cage-medium-12"><div class="col-large-12"><h3 class="shrinkwrap"><% if (isNew) { %>Share New Blend<% } else { %>Editing <a href="/blends/view/<%- id %>">Blend #<%- id %></a><% } %></h3></div><form action="/blends/add"><div class="cage-large-12" id="data-region"><div class="col-large-12"><label for="blend-title"><span class="icon-info"></span> Title</label><input class="full" type="text" name="title" id="blend-title" placeholder="2 characters minimum"></div><div class="col-large-12"><label for="blend-body"><span class="icon-info"></span> Description</label><textarea class="full" rows="8" name="body" id="blend-body" placeholder="50 characters minimum"></textarea></div><div class="col-large-6"><label for="blend-three_dee"><span class="icon-three-dee"></span> 3D Preview</label><input class="full" type="text" name="three_dee" id="blend-three_dee" placeholder="p3d.in or sketchfab.com"></div><div class="col-large-6"><label for="blend-blender_version"><span class="icon-blender"></span> Blender Version</label><select name="blender_version" id="blend-blender_version"></select></div><div class="col-large-6"><label for="blend-blend_license"><span class="icon-cc"></span> Blend License</label><select name="blend_license" id="blend-blend_license"></select></div><div class="col-large-6"><label for="blend-render_engine"><span class="icon-image"></span> Render Engine</label><select name="render_engine" id="blend-render_engine"></select></div><% if (isAdmin && !isNew) { %><div class="col-large-6"><label for="blend-status"><span class="icon-info"></span> Status</label><select name="status" id="blend-status"><option value="pending">Pending</option><option value="published">Published</option><option value="incomplete">Incomplete</option><option value="trash">Trash</option></select></div><% } %><% if (!isAdmin && !isNew) { %><div class="col-large-12"><label for="blend-change_log"><span class="icon-three-dee"></span> Change log</label><input class="full" type="text" name="change_log" id="blend-change_log" placeholder="What did you change?"></div><% } %><% if (!isNew) { %><div class="cage-large-12"><div class="col-large-6"><button type="submit" class="block">Save Blend</button></div><div class="col-large-6"><a href="/blends/view/<%- id %>" class="button button-blue block">Cancel</a></div></div><% } %></div><div class="col-large-12"><hr><h3 class="shrinkwrap">Tags and Categories</h3></div><div class="cage-large-12"><div class="col-large-12"><% if (isNew) { %><p class="info-message">Tags and categories help others find your blend in relevant searches , use good keywords related to your blend. For example , a model of a honey bee can be tagged: <em>bee, honey, honeycomb , apiculture, beekeeping, pollen</em>; and so on</p><% } %><label for="blend-tags">Tags</label><input class="full" type="text" name="tags" id="blend-tags" placeholder="Example: tag, another tag, hello tagging"></div><div class="col-large-12"><label for="">Categories</label></div><div class="cage-large-12" id="terms-region"></div><div class="col-large-12"><hr></div><% if (!isNew) { %><div class="cage-large-12"><div class="col-large-6"><button type="submit" class="block">Save Blend</button></div><div class="col-large-6"><a href="/blends/view/<%- id %>" class="button button-blue block">Cancel</a></div></div><% } %></div><div class="cage-large-12"><div class="col-large-12"><h3 class="shrinkwrap">Fan Art Mark</h3><% if (isNew) { %><p class="success-message">Please select the appropriate option according to the examples:</p><% } %></div><div class="col-large-12"><ul><li><label for="blend-is_fan_art-0"><input type="radio" name="is_fan_art" id="blend-is_fan_art-0" value="0"> No, it\'s not because:<ul class="small"><li>I designed and built this blend on my own.</li><li>A friend of mine designed and built this blend, and gave me permission to distribute it.</li><li>My blend is based on Open Source content and/or non-fan-art work here on Blend Swap.</li></ul></label></li><li><label for="blend-is_fan_art-1"><input type="radio" name="is_fan_art" id="blend-is_fan_art-1" value="1"> Yes, it is because:<ul class="small"><li>I made this model based on a design found on a TV show, movie, game, comic book, etc. I\'m not associated with.</li><li>I made the model based on a design or concept art I found on the web, whose author is not a friend of mine.</li><li>this blend is based on previous Fan Art by another artist, and I\'m allowed to publish my modification.</li><li>I made this blend following a tutorial on the web.</li></ul></label></li><li><label for="blend-is_fan_art-2"><input type="radio" name="is_fan_art" id="blend-is_fan_art-2" value="2"> I don\'t know LOL<ul class="small"><li>I found this asset somewhere on the Internet, and I thought it was so cool that I had to convert it to .blend and share it with everyone ecuz I\'m a cool guy, you see?!1one</li><li>I have no skills other than copy-pasting and converting formats with plugins, which allows me to pose as a real 3D artist.</li><li>My parents should\'ve never gotten me this badass laptop cuz I can\'t do anything original with it.</li></ul></label></li></ul></div><div class="cage-large-12"><div class="col-large-6"><button type="submit" class="block">Save Blend</button></div><% if (!isNew) { %><div class="col-large-6"><a href="/blends/view/<%- id %>" class="button button-blue block">Cancel</a></div><% } else { %><div class="col-large-6"><a href="/blends" class="button button-blue block">Cancel</a></div><% } %></div><% if (!isNew) { %><div class="col-large-12 col-small-12"><hr><h3 class="tight">Danger Zone</h3><div class="error-message">Deleting your blend will poke a hole in the fabric of the Internet!</div></div><div class="col-large-6"><a href="#" class="button button-red block js-blend-delete">Delete Blend</a></div><% } %></div></form></div><div class="cage-large-4 cage-medium-12"><div class="cage-large-12"><div class="col-large-12"><h3 class="tight"><span class="icon-image"></span> Images</h3><% if (isNew) { %><div class="info-message">Please fill and submit the info to the left/above, before uploading the files. :)</div><% } else { %><div class="alert-message">.jpg or .png, 512px by 512px min</div><% } %></div><div id="images-region" class="col-large-12"></div><div class="col-large-12"><hr></div></div><div class="cage-large-12"><div class="col-large-12"><h3 class="tight"><span class="icon-blender"></span> Blends</h3><% if (isNew) { %><div class="info-message">Please fill and submit the info to the left/above, before uploading the files. :)</div><% } else { %><div class="alert-message">.blend or .zip, 90 MB max</div><% } %></div><div id="zips-region" class="col-large-12"></div><div class="col-large-12"><hr></div><div class="col-large-12"><div class="success-message"><h5 class="tight">Notes:</h5><ul class="shrinkwrap"><li>The default image shows up first and is used in the indexes.</li><li>The default blend is the file other users download.</li><li>You have to set files as default manually if you want them to be downloadable or to show up first.</li></ul></div></div></div></div></div>'}),define("modules/blends/common/form_view",["app","backbone.syphon","text!templates/blends/form_view.html"],function(e,t,n){var r=function(){e.trigger("app:error","There was an error when updating the blend. Please report your saw this error to the admins.")},i=function(t){var n=t.get("status");"published"==n?e.trigger("app:success","The blend was published!"):"pending"===n&&e.trigger("app:success","The blend was added to the moderation queue. Please allow some time for moderation to complete.")};return t.InputWriters.register("checkbox",function(e,t){var n=_.contains(t,e.val());e.prop("checked",n)}),t.InputWriters.register("radio",function(e,t){var n=_.isEqual(t,e.val());e.prop("checked",n)}),t.InputReaders.register("checkbox",function(e){return e.val()}),t.KeyAssignmentValidators.register("checkbox",function(e){return e.is(":checked")}),e.module("BlendsApp.Views",function(e,s,o,u){e.FormView=u.LayoutView.extend({tagName:"article",className:"cage-large-12",events:{"submit form":"formSubmitted","click .js-form-accept":"acceptClicked","click .js-blend-delete":"deleteClicked","click .js-blend-cancel":"cancelClicked"},regions:{dataRegion:"#data-region",zipsRegion:"#zips-region",imagesRegion:"#images-region",termsRegion:"#terms-region"},template:_.template(n),serializeData:function(){var e=this.model.toJSON();return e.change_log="",e.isNew=this.model.isNew(),e.isAdmin=s.CurrentUser.isAdmin(),"boolean"==typeof e.is_fan_art&&(e.is_fan_art=e.is_fan_art?"1":"0"),e},onShow:function(){var e=this;this.renderEngines(),this.renderLicenses(),this.renderVersions(),setTimeout(function(){t.deserialize(e,e.serializeData())},10)},shouldUpdate:function(){var e=this.model.get("status");return"published"!==e},enqueue:function(){this.model.fetch({wait:!0,error:r,success:i})},formSubmitted:function(e){e&&e.preventDefault();var n=t.serialize(this);this.trigger("save",n)},acceptClicked:function(e){e&&e.preventDefault(),this.trigger("accept")},deleteClicked:function(e){e&&e.preventDefault(),this.trigger("delete",this.model)},cancelClicked:function(e){e&&e.preventDefault(),this.trigger("cancel",this.model)},renderVersions:function(){bVersions=s.supportedBlenderVersions(),_.each(bVersions,function(e,t){var n=$("<option>",{value:e,text:t});this.$("select#blend-blender_version").append(n)},this)},renderLicenses:function(){_.each(s.supportedBlendLicenses(),function(e,t){var n=$("<option>",{value:e,text:t});this.$("select#blend-blend_license").append(n)},this)},renderEngines:function(){_.each(s.supportedRenderEngines(),function(e,t){var n=$("<optgroup>",{label:t});_.each(e,function(e){var t=$("<option>",{value:e,text:e});n.append(t)},this),this.$("select#blend-render_engine").append(n)},this)}})}),e.BlendsApp.Views.FormView}),define("modules/blends/add/add_view",["app","modules/blends/common/form_view"],function(e,t){return e.module("BlendsApp.Views",function(e,n,r,i){e.AddView=t.extend({})}),e.BlendsApp.Views.AddView}),define("text!templates/blends/category_item.html",[],function(){return'<input type="checkbox" value="<%- id %>" name="categories[]" id="blend-categories-<%- id %>"><label for="blend-categories-<%- id %>"><%- name %></label>'}),define("modules/blends/common/category_item",["app","text!templates/blends/category_item.html"],function(e,t){return e.module("BlendsApp.Views",function(e,n,r,i){e.CategoryItem=i.ItemView.extend({className:"col-large-12",template:_.template(t)})}),e.BlendsApp.Views.CategoryItem}),define("modules/blends/common/categories_view",["app","modules/blends/common/category_item"],function(e,t,n){var r=Marionette.ItemView.extend({template:_.template("<h3>Nothing to see around here :jetpack:</h3>")});return e.module("BlendsApp.Views",function(e,n,i,s){e.Categories=s.CollectionView.extend({childView:t,emptyView:r,tagName:"div",className:"three-columns"})}),e.BlendsApp.Views.Categories}),define("modules/blends/add/add_controller",["app","entities/term"],function(e){e.module("BlendsApp",function(t){t.BaseController=t.BaseController||{},t.BaseController.add=function(){e.CurrentUser.isLoggedIn()||(window.location="/blends");var t=e.request("entities:terms:type","category");t.fetch({wait:!0}).success(function(){require(["modules/blends/add/add_view","modules/blends/common/categories_view"],function(n,r){var i=e.request("entities:blends:new"),s=new r({collection:t}),o=new n({model:i});o.listenTo(o,"show",function(){o.termsRegion.show(s)}),o.listenTo(o,"cancel",function(){window.location="/blends"}),o.listenTo(o,"accept",function(){o.$("#guidelines-region").slideUp(250),o.$("#form-region").slideDown(250),$("body").animate({scrollTop:0},250)}),o.listenTo(o,"save",function(t){i.save(t,{wait:!0,error:function(){e.trigger("app:error","There was an error when saving the blend's data! Please report you saw this message.")},success:function(){e.trigger("blends:edit",i.get("id"))}})}),e.contentRegion.show(o)})}).error(function(){alert("Error when retrieving the categories!")})}})}),define("modules/blends/edit/edit_view",["app","modules/blends/common/form_view"],function(e,t){return e.module("BlendsApp.Views",function(e,n,r,i){e.EditView=t.extend({})}),e.BlendsApp.Views.EditView}),define("text!templates/common/media_item.html",[],function(){return'<td width="88px"><% if ("image" === type) { %><img src="<%- thumb %>" alt="Preview"><% } else {%> <span class="icon-blender text-big-72 orange"></span><%}%></td><td><strong><a href="/media/download/<%- id %>"><%- title || id %></a></strong><br><small><%- prettyDatetime(created) %><br><a href="#" class="js-media-default" title="<%- \'default\' === status ? \'This is the default \' + type : \'. Click to set as default\' %>"><span class="icon-check <%- \'default\' === status ? \'green\' : \'blue\' %>"></span></a> /&nbsp; <a href="#" class="js-media-delete"><span class="icon-close"></span></a></small></td>'}),define("modules/common/views/media_item",["app","text!templates/common/media_item.html"],function(e,t){return e.module("CommonApp.Views",function(e,n,r,i){e.MediaItem=i.ItemView.extend({tagName:"tr",events:{"click .js-media-delete":"deleteClicked","click .js-media-default":"defaultClicked"},template:_.template(t),onShow:function(){this.listenTo(this.model,"change",this.render),this.listenTo(n,"media:default",this.setDefault)},setDefault:function(e){var t=e===this.model.get("id");this.model.set("status",t?"default":"normal")},deleteClicked:function(e){e&&(e.preventDefault(),e.stopPropagation()),this.trigger("delete",this.model)},defaultClicked:function(e){e&&(e.preventDefault(),e.stopPropagation()),this.trigger("default",this.model)}})}),e.CommonApp.Views.MediaItem}),define("text!templates/common/media_manager.html",[],function(){return'<table class="stripes"><thead><tr><th colspan="2"><input type="file" multiple="multiple" accept="<%- accept %>"></th></tr></thead><tbody class="media-index"></tbody></table>'}),define("text!templates/common/media_empty.html",[],function(){return'<td><div class="error-message text-center"><% if (\'blend\' === media_type) { %>Dont\' forget to pack your blend file!<br><br><img src="/img/pack_your_blend_file.gif" alt="Pack your blend file!"><% } else { %> No files right now<% } %></div></td>'}),define("modules/common/views/media_manager",["app","modules/common/views/media_item","text!templates/common/media_manager.html","text!templates/common/media_empty.html"],function(e,t,n,r){var i=_.template('<div class="progress-track"><div class="progress-bar" style="width:0%;"></div></div>'),s=Marionette.ItemView.extend({tagName:"tr",template:_.template(r),initialize:function(e){this.media_type=e.media_type},serializeData:function(){return{media_type:this.media_type}}});return e.module("CommonApp.Views",function(e,r,o,u){e.MediaManager=u.CompositeView.extend({media_type:"image",isUploading:!1,childView:t,emptyView:s,tagName:"section",className:"cage-large-12",childViewContainer:".media-index",template:_.template(n),_typeRegex:/\.(jpe?g|png)$/gi,events:{"change input[type='file']":"handleFiles"},initialize:function(e){this.media_type=e.media_type,this.whatToUpload=".jpg or .png",this._canUpload("blend")&&(this.whatToUpload=".blend or .zip",this._typeRegex=/\.(blend|zip)$/gi)},emptyViewOptions:function(){return{media_type:this.media_type}},_canUpload:function(e){return e===this.media_type},serializeData:function(){var e=".jpg,.jpeg,.png";return this._canUpload("blend")&&(e=".blend,.zip"),{accept:e,media_type:this.media_type,media_count:this.collection.length}},onShow:function(){this.thNode=this.$("th")},handleFiles:function(e){e&&(e.preventDefault(),e.stopPropagation());if(r.request("state:uploading"))return r.trigger("app:info","There are uploads in progress, please wait until they finish.");var t=this._collectFiles(e);t?this._uploadFiles(t):(r.trigger("app:error","No files were sent to the server please try again."),self.$("input[type='file']").val(null))},_collectFiles:function(e){var t=null,n=0,i=this,s=new FormData,o=e.originalEvent;"undefined"!=typeof o.dataTrasfer?t=o.dataTrasfer.files:"undefined"!=typeof o.target.files&&(t=o.target.files);for(var u=0;u<t.length;u++){var a=t.item(u);if(this.collection.length>=8||this.collection.length+n>=8){r.trigger("app:info","The file "+a.name+" was not added to the queue "+"because this entry already has 8 images, no more are allowed.");continue}if(!a.name.match(this._typeRegex)){r.trigger("app:error","The file "+a.name+" is not an allowed format. "+"Please upload "+this.whatToUpload);continue}if(!this._fileIsTooBig(a))continue;var f=new FileReader;f.readAsDataURL(a),s.append("data[]",a,a.name),n++}return n?s:!1},_uploadFiles:function(e){var t=this;this.thNode.append(i);var n=function(e){if(e.lengthComputable){var n=Math.floor(e.loaded/e.total*100);Math.round(n)===100&&t.$(".progress-bar").addClass("processing"),t.$(".progress-bar").css({width:n+"%"})}},s=this.collection.url().replace("index","add"),o={type:"POST",cache:!1,url:s,accepts:"json",dataType:"json",processData:!1,contentType:!1,data:e,xhr:function(){var e=new window.XMLHttpRequest;return e.upload.addEventListener("progress",n,!1),e},error:function(){r.trigger("app:error","The server rejected this file, please report you saw this error.")},complete:function(){r.trigger("upload:done"),t.$(".progress-track").remove(),t.$("input[type='file']").val(null)},success:function(e){e.data&&t.collection.add(e.data,{parse:!0}),e.report&&e.report.length>=1&&r.trigger("app:alert",e.report.join(". "))}};r.trigger("upload:start"),$.ajax(o)},_fileIsTooBig:function(e){var t=Math.pow(2,20),n=90*t;if(e.size>n){var i=Math.ceil(e.size/t)+" MB";return r.trigger("app:error","The max upload file size is 90 MB, "+e.name+" file is "+i+"."),this._fileSizeTips(e),!1}return!0},_fileSizeTips:function(){/\.zip$/.test(fileEntry.name)?r.trigger("app:info","This file, cannot be shared on Blend Swap at all, even zipped it's just too big, please consider making a lower poly version for sharing on Blend Swap."):/\.blend$/.test(fileEntry.name)&&r.trigger("app:info","Please try and zip the file before uploading it to Blend Swap, this way you'll make it smaller and it may go through.")}})}),e.CommonApp.Views.MediaManager}),define("modules/blends/edit/edit_controller",["app","entities/term","collections/media"],function(e,t,n){e.module("BlendsApp",function(e,t,r,i){e.BaseController=e.BaseController||{},e.BaseController.edit=function(e){t.CurrentUser.isLoggedIn()||(window.location="/blends"),t.trigger("scroll:top");var r=t.request("entities:blends:single",e),i=t.request("entities:terms:type","category");i.fetch({wait:!0}).success(function(){r.fetch({wait:!0}).success(function(){if(!t.CurrentUser.isAdmin()&&!r.isOwn())return window.location="/blends/user/"+t.CurrentUser.get("id"),!1;var s={parse:!0,object_class:"Blend",object_id:e},o=new n(r.get("Image"),s),u=new n(r.get("BlendFile"),s);require(["modules/blends/edit/edit_view","modules/blends/common/categories_view","modules/common/views/media_manager"],function(e,n,s){var a=new n({collection:i}),f=new e({model:r}),l=new s({collection:o,media_type:"image"});f.listenTo(t,"media:added",function(e){var t,n,r=e.get("type");"image"===r?n="Image":n="BlendFile",t=f.model.get(n),t.push(e.toJSON()),f.model.set(n,t),f.shouldUpdate()&&f.enqueue()}),f.listenTo(o,"add",function(e){t.trigger("media:added",e)}),f.listenTo(u,"add",function(e){t.trigger("media:added",e)}),l.listenTo(l,"childview:default",function(e,n){n.save({status:"default"},{wait:!0,error:function(){t.trigger("app:error","There was an error when setting this image as default. Please report you saw this error to the admins.")},success:function(){t.trigger("media:default",n.get("id"))}})}),l.listenTo(l,"childview:delete",function(e,n){var r="default"===n.get("status"),i=t.CurrentUser.isAdmin();if(!i&&r)return t.trigger("app:error","This file is the default one, you'll have to set a new default file before deleting this one."),!1;confirm("The file will be deleted forever.\nAre you sure?")&&n.destroy({wait:!0,success:function(){t.trigger("app:success","The file was deleted correctly")},error:function(){t.trigger("app:error","Something went wrong and the file was not deleted. Please report you saw this error.")}})});var c=new s({collection:u,media_type:"blend"});c.listenTo(c,"childview:default",function(e,n){n.save({status:"default"},{wait:!0,error:function(){t.trigger("app:error","There was an error when setting this image as default. Please report you saw this error to the admins.")},success:function(){t.trigger("media:default",n.get("id"))}})}),c.listenTo(c,"childview:delete",function(e,n){var r="default"===n.get("status"),i=t.CurrentUser.isAdmin();if(!i&&r)return t.trigger("app:error","This file is the default one, you'll have to set a new default file before deleting this one."),!1;confirm("The file will be deleted forever.\nAre you sure?")&&n.destroy({wait:!0,success:function(){t.trigger("app:success","The file was deleted correctly")},error:function(){t.trigger("app:error","Something went wrong and the file was not deleted. Please report you saw this error.")}})}),f.listenTo(f,"show",function(){f.termsRegion.show(a),f.imagesRegion.show(l),f.zipsRegion.show(c)}),f.listenTo(f,"cancel",function(e){window.location="/blends/view/"+e.get("id")}),f.listenTo(f,"save",function(e){r.save(e,{wait:!0,error:function(){t.trigger("app:error","There was an error when saving the blend's data! Please report you saw this message.")},success:function(){t.trigger("app:success","The blend's info was updated successfully.")}})}),f.listenTo(f,"delete",function(e){if(confirm("The blend will be deleted permanently.\nAre you 100% sure?")){var n=e.get("user_id");e.destroy({wait:!0,error:function(){t.trigger("app:error","There was an error when saving the blend's data! Please report you saw this message.")},success:function(){window.location="/blends/user/"+n}})}}),t.contentRegion.show(f)})}).error(function(){})}).error(function(){alert("Error when retrieving the categories!")})}})}),define("modules/blends/single/single_view",["app"],function(e,t){return e.module("BlendsApp.Views",function(e,t,n,r){e.Single=r.LayoutView.extend({object_class:"Blend",events:{"click .js-blend-like":"likeClicked","click .js-blend-staff":"staffClicked","click .js-blend-reject":"rejectClicked","click .js-blend-delete":"deleteClicked","click .js-blend-report":"reportClicked","click .js-blend-follow":"followClicked","click .js-blend-collect":"collectClicked","click .js-blend-publish":"publishClicked","click .js-blend-download":"downloadClicked"},regions:{collectorRegion:"#collector-region",previewsRegion:"#previews-region"},initialize:function(){this.likeButton=this.$(".js-blend-like"),this.followButton=this.$(".js-blend-follow"),this.listenTo(this.model,"change:is_staff_pick",this.renderStaff);var e=this.model.get("id"),n="blend:liked:"+e;this.listenTo(t,n,this.setLiked),this.listenTo(this.model,"change:liked",this.renderLiked)},setLiked:function(e){this.model.set({liked:Boolean(e)})},renderLiked:function(){this.model.get("liked")?this.likeButton.addClass("red"):this.likeButton.removeClass("red")},onRender:function(){t.isLoggedIn()&&(this.likeButton.addClass("clk"),t.trigger("follow:get","Blend",this.model.get("id")),t.trigger("blend:liked:get",this.model.get("id")),t.isAdmin()&&this.renderStaff()),this.autoEmbed()},renderStaff:function(){var e=this.model.get("is_staff_pick");e=parseInt(e,10);var t=this.$(".js-blend-staff"),n="icon-close",r="icon-add",i="Add Staff Pick";e&&(n="icon-add",r="icon-close",i="Remove Staff Pick"),this.$(".js-blend-staff-icon").eq(0).removeClass(n).addClass(r),this.$(".js-blend-staff-label").eq(0).text(i)},likeClicked:function(e){this.killEvent(e),this.trigger("like",this.model)},staffClicked:function(e){this.killEvent(e),this.trigger("staff",this.model)},rejectClicked:function(e){this.killEvent(e),this.trigger("reject",this.model)},deleteClicked:function(e){this.killEvent(e),this.trigger("delete",this.model)},reportClicked:function(e){this.killEvent(e),this.trigger("report",this.model)},followClicked:function(e){this.killEvent(),this.trigger("follow",this.object_class,this.model.get("id"))},collectClicked:function(e){this.killEvent(e),this.trigger("collect",this.model)},publishClicked:function(e){this.killEvent(e),this.trigger("publish",this.model)},downloadClicked:function(e){this.killEvent(e),this.trigger("download",this.model)}})}),e.BlendsApp.Views.Single}),define("modules/common/views/accordion",["app","backbone"],function(e,t){var n=t.View.extend({events:{"click .accordion-tab-header":"announce"},initialize:function(){this.contentNode=this.$el.find(".accordion-tab-content"),this.listenTo(e,"accordion:switch",this.show),this.render()},announce:function(t){e.trigger("accordion:switch",this.$el)},render:function(){this.$el.is(".visible")||this.contentNode.slideUp()},show:function(e){e.attr("id")===this.$el.attr("id")?this.contentNode.slideDown(250):this.$el.is(".force")||this.contentNode.slideUp(250)}});return t.View.extend({el:".accordion",initialize:function(){this.accordionTabs=this.$el.find(".accordion-tab:not(.force)"),_.each(this.accordionTabs,function(e){var t=new n({el:e})},this)}})}),define("lib/three_dee_parser",[],function(){function t(e){this.url=e,this.ready=this.prepare()}var e=[{name:"p3d",type:"replace",finder:/https?:\/\/(www\.)?p3d\.in/i,valid:/https?:\/\/(www\.)?p3d\.in\/e\//i,clean:{finder:/https?:\/\/(www\.)?p3d\.in\//i,should:"https://www.p3d.in/e/"}},{name:"sketchfab",type:"concat",finder:/https?:\/\/(www\.)?sketchfab.com/i,valid:/https?:\/\/(www\.)?sketchfab.com\/models\/[a-f0-9]+\/embed/i,clean:{finder:/https:\/\/(www\.)?sketchfab\.com\/(show|models?)/i,concat:"/embed?controls=0",should:"https://sketchfab.com/models"}}];return t.prototype.prepare=function(){for(var t in e){var n=e[t];if(this.url.match(n.finder))return this.provider=n,!0}return!1},t.prototype.parse=function(e){return this.ready?this.attributes={type:"three-dee",id:"three-dee-preview",thumb:"/img/logos/"+this.provider.name+"_thumb.png",src:this.prepareURL()}:alert("No provider matched the 3D preview url!!!"),this},t.prototype.prepareURL=function(){return this.url.match(this.provider.valid)||(this.url=this.url.replace(this.provider.clean.finder,this.provider.clean.should)),"undefined"!=typeof this.provider.clean.concat&&(this.url+=this.provider.clean.concat,this.provider.name==="p3d"&&(this.url=this.url.replace(/\+.+$/,""))),this.url},t.prototype.getAttributes=function(){return this.attributes},t}),define("modules/common/views/lightbox_image",["app","backbone"],function(e,t){return t.View.extend({className:"hidden lightbox-image",template:_.template('<img src="<%- large %>" alt="Full size preview image">'),initialize:function(){this.listenTo(e,"lightbox:show",this.showOrHide)},render:function(){var e=this.template(this.model.toJSON());return this.$el.html(e),this},showOrHide:function(t){this.model.get("id")===t?(this.$el.show(),e.trigger("previews:show",t)):this.$el.hide()}})}),define("text!templates/common/lightbox.html",[],function(){return'<div class="lightbox-area"></div><div class="lightbox-pass prev js-prev"></div><div class="lightbox-pass next js-next"></div><div class="lightbox-close clk js-close"><span class="icon-close"></span></div>'}),define("modules/common/views/lightbox",["app","backbone","modules/common/views/lightbox_image","text!templates/common/lightbox.html"],function(e,t,n,r){return t.View.extend({className:"overlay lightbox",template:_.template(r),events:{click:"shouldClose","click .js-close":"unrender","click .js-next":"slideImage","click .js-prev":"slideImage"},initialize:function(){this.currentIndex=0,this.listenTo(e,"app:escape",this.unrender),this.listenTo(e,"previews:set:current",this.setCurrent),this.listenTo(e,"app:left app:right",this.arrowNav),$("body").append(this.el)},arrowNav:function(e){e&&e.preventDevault&&e.preventDevault(),LEFT_ARR===e.keyCode?this.$(".js-prev").trigger("click"):RIGHT_ARR===e.keyCode&&this.$(".js-next").trigger("click")},setCurrent:function(e){var t=this.collection.findWhere({id:e});this.currentIndex=this.collection.models.indexOf(t),this.showCurrentImage()},render:function(){var e=this;return this.$el.html(this.template()),this.imagesArea=this.$(".lightbox-area").eq(0),_.each(this.collection.models,this.renderOneImage,this),e.showCurrentImage(),this.$el.fadeIn(250,"swing"),this},renderOneImage:function(e){var t=new n({model:e});this.imagesArea.append(t.render().el)},unrender:function(){var e=this;this.$el.fadeOut(250,"swing",function(){e.remove()})},shouldClose:function(e){e.preventDefault(),e.stopPropagation();var t=$(e.target);t.is(".overlay")&&this.unrender()},slideImage:function(e){e.preventDefault(),$(e.target).is(".js-next")?this.currentIndex++:this.currentIndex--,this.correctCurrentIndex(),this.showCurrentImage()},correctCurrentIndex:function(){this.currentIndex>=this.collection.length?this.currentIndex=0:this.currentIndex<0&&(this.currentIndex=this.collection.length-1)},showCurrentImage:function(){this.correctCurrentIndex();var t=this.collection.at(this.currentIndex);t&&e.trigger("lightbox:show",t.get("id"))}})}),define("modules/common/helpers/preview_collection",["app"],function(e,t,n){var r=Marionette.ItemView.extend({template:_.template("<em>No images to show yet...</em>")});return e.module("CommonApp.Views",function(e,t,n,i){e.PreviewCollectionView=i.CollectionView.extend({events:{},emptyView:r,tagName:"div",className:"col-large-12"})}),e.CommonApp.Views.PreviewCollectionView}),define("text!templates/common/preview_image.html",[],function(){return'<% if (\'image\' === type) { %> <img src="<%- medium %>" height="100%" width="100%" alt="<%- \'User\' === type ? \'Portfolio image by \' + User.username : \'Preview image for \' + object_class + \' #\' + object_id %>"><% } else { %><iframe src="<%- src %>" frameborder="0" webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen="true" class="live-three-dee" height="100%" width="100%"></iframe><% } %>'}),define("modules/common/helpers/preview_image",["app","text!templates/common/preview_image.html"],function(e,t){return e.module("CommonApp.Views",function(e,n,r,i){e.PreviewImage=i.ItemView.extend({className:"preview-image",template:_.template(t),initialize:function(){this.listenTo(n,"previews:show",this.showTriggered),this.listenTo(n,"app:resize",this.layout)},layout:function(){var e=this.$el.parent().width();this.$el.css({width:e,height:e})},showTriggered:function(e){e===this.model.get("id")?this.showImage():this.hide()},showImage:function(){var e={},t=this.$el.is(":empty");"image"===this.model.get("type")&&t?this.appendImage():"three-dee"===this.model.get("type")&&t&&this.appendIframe(),this.$el.show()},appendImage:function(){var e={width:"100%",height:"auto","class":"preview-image",src:this.model.get("medium")},t=$("<img>",e);this.$el.append(t)},appendIframe:function(){var e={src:this.model.get("src")},t=$("<iframe/>",e);this.$el.append(t)},hide:function(){this.$el.hide()}})}),e.CommonApp.Views.PreviewImage}),define("text!templates/common/preview_thumb.html",[],function(){return'<img src="<%- thumb %>" alt="Preview Switch">'}),define("modules/common/helpers/preview_thumb",["app","text!templates/common/preview_thumb.html"],function(e,t){return e.module("CommonApp.Views",function(e,n,r,i){e.PreviewThumb=i.ItemView.extend({className:"preview-thumb",events:{click:"thumbClicked"},template:_.template(t),render:function(){return this.$el.html(this.template(this.model.toJSON())),this},thumbClicked:function(e){e.preventDefault();var t=this.model.get("id");n.trigger("previews:show",t),n.trigger("previews:set:current",t)}})}),e.CommonApp.Views.PreviewThumb}),define("text!templates/common/preview_area.html",[],function(){return'<div id="preview-area-images-region"></div><div id="preview-area-thumbs-region"></div><% if ("undefined" !== typeof username || !App.isFree()) { %><div class="magnify clk js-lightbox"><span class="icon-zoom-in"></span></div><% } %><% if ("undefined" !== typeof is_staff_pick && "1" === is_staff_pick) {%><a href="/blends/staffpicks"><span class="staff-picked"><span class="icon-star"></span></span></a><% } %>'}),define("entities/medium",["app","entities/base"],function(e){return e.module("Entities",function(e,t,n){e.MediumModel=e.BaseModel.extend({defaults:{},url:function(){return"/media"+(this.id?"/"+this.id:"")},parse:function(e){if(e.id)return e;if(e.Media)return e.User&&(e.Media.User=e.User),e.Media;if(e.Image)return e.User&&(e.Image.User=e.User),e.Image;if(e.BlendFile)return e.User&&(e.BlendFile.User=e.User),e.BlendFile;t.trigger("app:error","There was an error when parsing a Medium object. Please report you saw this error to the admins.")},validate:function(e){var t=[];if(!_.isEmpty(t))return t}}),e.MediaCollection=e.BaseCollection.extend({model:e.MediumModel,url:function(){return"/media"},parse:function(e){return e.data?e.data:e}}),e.Media=n.Collection.extend({model:e.MediumModel,url:function(){return"/media"},parse:function(e){return e.data?e.data:e}}),t.reqres.setHandler("entities:media:new",function(){return new e.MediumModel}),t.reqres.setHandler("entities:media:single",function(t){return new e.MediumModel({id:t})}),t.reqres.setHandler("entities:media:index",function(t,n){var r=new e.MediaCollection([]);return r.url=function(){return"/media/index/"+t+"/"+n},r}),t.reqres.setHandler("entities:media:collection",function(t,n){return new e.Media(t,n)})}),e.Entities}),define("modules/common/helpers/preview_area",["app","lib/three_dee_parser","modules/common/views/lightbox","modules/common/helpers/preview_collection","modules/common/helpers/preview_image","modules/common/helpers/preview_thumb","text!templates/common/preview_area.html","entities/medium"],function(e,t,n,r,i,s,o){return e.module("CommonApp.Views",function(e,u,a,f){e.PreviewArea=f.LayoutView.extend({className:"preview-area",template:_.template(o),events:{"click .js-lightbox":"lightboxClicked"},regions:{imagesRegion:"#preview-area-images-region",thumbsRegion:"#preview-area-thumbs-region"},initialize:function(){this.imagesView=new r({className:"preview-images",collection:this.collection,childView:i}),this.thumbsView=new r({className:"preview-thumbs",collection:this.collection,childView:s}),this.listenTo(u,"app:resize",this.manageLayout),this.setupThreeDee()},setupThreeDee:function(){var e=this.model.get("three_dee");if(e){var n=new t(e);if(n.ready){n.parse();var r=n.getAttributes();this.collection.add(r)}}},lightboxClicked:function(){var e=this.collection.clone(),t=e.where({type:"three-dee"});_.isEmpty(t)||e.remove(t),lightbox=new n({collection:e}),lightbox.render()},onShow:function(){this.imagesRegion.show(this.imagesView),this.thumbsRegion.show(this.thumbsView),this.imagesView.children.each(function(e,t){t>0&&e.hide()}),this.manageLayout()},manageLayout:function(){var e=this.$el.parent().width();e=parseInt(e,10),this.$el.css({width:e+"px",height:e+"px"}),this.imagesView.$el.css({width:e+"px",height:e+"px"}),this.imagesView.$("iframe").css({width:e+"px",height:e+"px"})},serializeData:function(){var e=this.model.toJSON();return e}})}),e.CommonApp.Views.PreviewArea}),define("text!templates/one_taxon.html",[],function(){return'<a href="/blends/<%- Term.type == \'tag\' ? \'tagged\' : \'categories\' %>/<%- Term.slug %>"><span class="icon-<%- icon %>"></span> <span class="taxon-name" title="<%- Term.name %>"><%- Term.name %></span></a><% if (App.isAdmin()) { %> <span class="taxon-destroy clk"><span class="icon-close"></span></span><% } %>'}),define("modules/common/views/taxonomies",["jquery","underscore","backbone","text!templates/one_taxon.html"],function(e,t,n,r){var i=n.Model.extend({parse:function(e){return"undefined"!=typeof e.Termrel?("undefined"!==e.Term?(e.Termrel.Term=e.Term,e.Termrel.icon=e.Term.type.indexOf("tag")>=0?"tag":"grid"):e.Termrel.icon="tag",e.Termrel):e},url:function(){return"/termrels"+(this.id?"/"+this.id:"")}}),s=n.View.extend({tagName:"span",className:"one-taxon",template:t.template(r),events:{"click .taxon-destroy":"delete"},initialize:function(){this.listenTo(this.model,"destroy",this.close)},render:function(){return this.$el.html(this.template(this.model.toJSON())),this},"delete":function(){this.model.destroy({wait:!0})}}),o=n.Collection.extend({model:i});return n.View.extend({initialize:function(){this.tagsArea=this.$el.find(".tags"),this.catsArea=this.$el.find(".cats"),this.taxonomies=this.model.get("Termrel"),this.setup_taxons(),this.render()},setup_taxons:function(){this.catsCollection=new o(this.model.get("Category"),{parse:!0}),this.tagsCollection=new o(this.model.get("Tag"),{parse:!0})},render:function(){return t.each(this.tagsCollection.models,function(e){var t=new s({model:e});this.tagsArea.append(t.render().el)},this),t.each(this.catsCollection.models,function(e){var t=new s({model:e});this.catsArea.append(t.render().el)},this),this}})}),define("text!templates/blends/modal_reject.html",[],function(){return'<div class="contained modal"><form action="/blends/edit/<%- id %>" method="POST"><div class="contained-header marker-orange"><h1 class="contained-title continue">Rejecting "<%- title %>"</h1><div class="contained-actions"><span class="icon-close js-close" title="cancel"></span></div></div><div class="contained-body"><div class="col-large-12"><div class="col-large-12 input select"><label for="blend-reject-reason">Select rejection reason</label><select name="reason" id="blend-reject-reason"><option value="The model breaks one or more of the Upload Rules">The model breaks one or more of the Upload Rules</option><optgroup label="Rules &amp; Quality"><option value="The model is too basic">The model is too basic</option><option value="The model is work in progress">The model is work in progress</option><option value="The model preview image does not match the model">The model preview image does not match the model</option><option value="The modeling quality is below minimal standards">The modeling quality is below minimal standards</option><option value="The model has been uploaded too many times to Blend Swap">The model has been uploaded too many times to Blend Swap</option></optgroup><optgroup label="Files &amp; Multimedia"><option value="The model is missing textures and/or other media">The model is missing textures and/or other media</option><option value="The model contains cache/bake files">The model contains cache/bake files</option><option value="The model contains unused media files">The model contains unused media files</option><option value="The model contains forbidden media files">The model contains forbidden media files</option></optgroup><optgroup label="Licensing &amp; Ripping"><option value="The model violates a Cretive Commons License">The model violates a Cretive Commons License</option><option value="The model violates other Open Source licenses">The model violates other Open Source licenses</option><option value="The author ripped this asset from another artist">The author ripped this asset from another artist</option><option value="The author ripped this asset from a game">The author ripped this asset from a game</option><option value="The author is impersonating other 3D artist">The author is impersonating other 3D artist</option></optgroup><optgroup label="Other"><option value="Other">Other... (clarify below)</option></optgroup></select></div></div><div class="col-large-12 input textarea"><label for="blend-reject-notes">Add notes <span class="small gray">(You can use Markdown)</span></label><textarea name="notes" id="blend-reject-notes" class="full"></textarea></div></div><div class="contained-footer col-large-12"><div class="col-large-6 col-small-12"><button class="button block" type="submit">Reject and Notify</button></div><div class="col-large-6 col-small-12"><button class="button button-blue block js-close" type="button">Cancel</button></div></div></form></div>'}),define("modules/blends/views/modal_reject",["app","modules/common/views/modal","text!templates/blends/modal_reject.html"],function(e,t,n){return t.extend({template:_.template(n),className:"overlay modal",events:{click:"shouldClose","click .js-close":"unrender","submit form":"submitClicked"},initialize:function(e){this.afterInit(),this.render()},render:function(){return this.$el.html(this.template(this.model.toJSON())),$("body").append(this.el),this.$el.fadeIn(250),this},submitClicked:function(e){e.preventDefault();var t=[];_.each(this.$el.find(":input"),function(e){var n=$(e).val();n&&""!==n&&t.push(n)},this),this.model.set({status:"rejected",reason:t.join(": "),change_log:"Rejected because: "+t.join(":")}),this.executeRejection()},executeRejection:function(){var t=this,n=this.model.save(this.model.toJSON(),{wait:!0,error:function(){e.trigger("app:error","There was an error when rejecting this blend. Please report you saw this.")},success:function(){var e="/blends/view/"+t.model.get("id");window.location=e}});n||e.trigger("app:error","The rejection was not executed, please try again.")}})}),define("models/report",["app","models/base_model"],function(e,t){return t.extend({defaults:{user_id:e.CurrentUser.get("id"),body:"",reason:"",type:"bug",status:"pending",object_id:0,object_class:"app"},url:function(){return"/reports"+(this.id?"/"+this.id:"")},validate:function(e,t){var n=[];(!e.reason||e.reason.length<8)&&n.push("Please select a reason for your report"),(!e.body||e.body.length<40)&&n.push("Please include notes and links to evidence. 40 characters minimum.");if(!_.isEmpty(n))return n}})}),define("text!templates/reports/modal_blend_report.html",[],function(){return'<div class="modal contained"><header class="contained-header marker-red"><h1 class="contained-title continue">Reporting "<%- title %>"</h1><div class="contained-actions"><span class="icon-close js-close"></span></div></header><form action=""><section class="contained-body col-large-12"><div class="col-large-12"><p>Send us a detailed report if you have serious trouble with thos blend.</p></div><div class="input input-select col-large-12"><label for="reason">Why are you reporting this blend?</label><select name="reason" id="reason"><option value="">Please choose the reason for your report...</option><optgroup label="Files &amp; Setup"><option value="The .zip file contains no .blend file">The .zip file contains no .blend file</option><option value="The blend is missing textures and/or other media">The blend is missing textures and/or other media</option><option value="The preview image is unrelated to the contents">The preview image is unrelated to the contents</option></optgroup><optgroup label="Licensing &amp; Copyright"><option value="This blend violates my copyright/trademark">This blend violates my copyright/trademark</option><option value="This blend violates a third party license">This blend violates a third party license</option><option value="This blend was ripped from a game">This blend was ripped from a game</option><option value="This blend was ripped from another 3D artist">This blend was ripped from another 3D artist</option></optgroup><optgroup label="Other"><option value="Other...">Other (Use only if strictly necessary)</option></optgroup></select></div><div class="input input-textarea col-large-12"><label for="body">Please add detailed notes and links to evidence <span class="small gray">(You can use Markdown)</span></label><textarea name="body" id="body" class="full" placeholder="Reports with no evidence will be ignored."></textarea></div></section><footer class="contained-footer col-large-12"><div class="col-large-6 col-small-12"><button class="button block" type="submit">Send report</button></div><div class="col-large-6 col-small-12"><button class="button button-blue block js-close">Cancel</button></div></footer></form></div>'}),define("modules/reports/views/modal_blend_report",["app","modules/common/views/modal","text!templates/reports/modal_blend_report.html"],function(e,t,n){return t.extend({template:_.template(n),events:{click:"shouldClose","click .js-close":"unrender","submit form":"submitClicked"},initialize:function(e){this.afterInit(),this.render()},submitClicked:function(t){t.preventDefault();var n=this;this.model.save({body:this.$("[name='body']").val(),reason:this.$("[name='reason']").val()},{wait:!0,success:function(){e.trigger("app:popup",{data:{pclass:"success-message",message:"Your report has been sent, we will take a look at it soon."}}),n.unrender(t)}})}})}),define("models/download",["models/base_model"],function(e){return e.extend({parse:function(e){if(e.id)return e;if(e.Download)return e.Blend&&(e.Download.Blend=e.Blend),e.Download;throw new Error("Unable to parse the server response")},url:function(){return"/downloads"+(this.id?"/"+this.id:"")}})}),define("text!templates/blends/modal_download.html",[],function(){return'<div class="modal contained"><header class="contained-header"><h3 class="contained-title continue">Downloading "<%- Blend.title %>"</h3><div class="contained-actions"><span class="icon-close clk js-close"></span></div></header><section class="contained-body col-large-12"><div class="col-large-12"><h3><strong><a href="/blends/view/<%- Blend.id %>"><%- Blend.title %></a></strong> is available under the <strong><%- Blend.blend_license %></strong> Creative Commons License.</h3><p>You can use this blend for any purposes under the following conditions.</p><ul><%= licenseConditions(Blend.blend_license) %><%= licenseFanArt(Blend.is_fan_art) %></ul><% if (Blend.blend_license.match(/by/i)) { %><div class="info-message with-icon"><a href="/page/crediting-authors">What does it mean to "give credit"?</a></div><% } %><h3>Are you OK with this license?</h3></div></section><footer class="contained-footer col-large-12"><div class="col-large-6 col-small-12"><a class="button block js-download-now" download="<%- fileName %>.html" href="/downloads/serve/<%- id %>/<%- blend_id %>/<%- fileName %>">Yes Download now!</a></div><div class="col-large-6 col-small-12"><button class="button button-blue block js-close">Cancel Download</button></div></footer></div>'}),define("modules/blends/views/modal_download",["jquery","backbone","modules/common/views/modal","text!templates/blends/modal_download.html"],function(e,t,n,r){var i=function(e,t){App.trigger("app:error",t.responseJSON.errors.join(". "))};return n.extend({tagName:"div",className:"overlay",template:_.template(r),events:{"click .js-download-now":"queueCheck",click:"shouldClose"},initialize:function(e){this.listenTo(this.model,"sync",this.render),this.listenTo(this.model,"destroy",this.close),this.afterInit();var t=this;this.model.save(this.model.toJSON(),{wait:!0,error:i})},serializeData:function(){var e=this.model.toJSON(),t=this.model.get("blend_id")+"_";return t+=this.model.get("Blend").title,t=t.replace(/[^a-z0-9\-\.]/gi,"_"),e.fileName=t+".zip",e},render:function(){return this.$el.html(this.template(this.serializeData())),e("body").append(this.el),this.$el.fadeIn(125,"swing",function(){App.trigger("spinner:off")}),this},onClose:function(){this.unQueueCheck()},unQueueCheck:function(){this.timer&&clearInterval(this.timer)},queueCheck:function(){var e=this;this.timer=setInterval(function(){e.model.fetch({wait:!0,error:function(t){e.unQueueCheck()},success:function(t){e.testComplete(),e.unQueueCheck()}})},2e3)},testComplete:function(){this.model.get("status").match(/complete/gi)&&this.close()},errorMessage:function(){alert("Something went wrong when retrieving this download."),this.unQueueCheck()}})}),define("models/collection",["app","backbone"],function(e,t){return t.Model.extend({defaults:{user_id:e.CurrentUser.get("id")},initialize:function(){this.on("invalid",function(t,n){var r="";for(var i in n)r+=n[i]+" ";e.trigger("app:popup",{data:{pclass:"error-message",message:r}}).trigger("spinner:off")}),this.on("request",function(){e.trigger("spinner:on")}).on("error reset invalid sync",function(){e.trigger("spinner:off")})},parse:function(e){return e.name?e:(e.Item&&(e.Collection.Item=e.Item),e.Collection)},url:function(){return"/collections"+(this.id?"/"+this.id:"")},validate:function(t){var n=[];t.name?t.name.length<2&&n.push("the collection name is too short."):n.push("The collection has no name!"),t.visibility?0>["public","private"].indexOf(t.visibility)&&n.push("Invalid visibility value"):n.push("The collection has no visibility!"),this.isNew()?e.isFree()&&"private"===t.visibility&&n.push("Only Associate Members can create Private Collections."):e.isFree()&&t.visibility!==this.get("visibility")&&n.push("Only Associate Members can change a collection's visibility.");if(!_.isEmpty(n))return n}})}),define("modules/collector/collections/collections",["app","backbone","models/collection"],function(e,t,n){return t.Collection.extend({url:"/collections",model:n,parse:function(e,t){return e.data}})}),define("text!templates/collector/box.html",[],function(){return'<header class="contained-header"><h1 class="contained-title continue"><span class="icon-folder-plus"></span> Collecting "<%- title %>"</h1><div class="contained-actions"><span class="icon-close js-close"></span></div></header><section class="contained-body col-large-12"><div class="col-large-12"><p>Click on a collection to add or remove from it.</p><p><a href="/collections/user/<%- App.CurrentUser.get(\'id\') %>">Manage collections &rarr;</a></p><div id="collections-list" class="collections-list"></div></div><div class="cage-large-12" id="new-collection"><form><div class="col-large-12"><p>Or create a brand new collection:</p><input type="text" name="name" placeholder="Collection Name" class="block"></div><div class="col-large-6 col-small-12" title="Only Associate Members can create Private Collections"><input type="checkbox" name="visibility" id="collection-visibility"><label for="collection-visibility">Private Collection</label></div><div class="col-large-6 col-small-12"><button type="submit" class="align-right">Create Collection</button></div></form></div></section>'}),define("text!templates/collector/item.html",[],function(){return"<span class=\"<%- _.isEmpty(Item) ? '' : 'green' %>\" id=\"collection-item-<%- id %>\" title=\"Click to <%- _.isEmpty(Item) ? 'add' : 'remove' %>\"><span class=\"icon-folder-<%- _.isEmpty(Item) ? 'minus' : 'plus' %>\"></span> <strong><%- name %></strong> <small class=\"gray\">(<%- visibility %>|<%- item_count %>items)</small></span>"}),define("modules/collector/app",["app","models/item","modules/collector/collections/collections","text!templates/collector/box.html","text!templates/collector/item.html"],function(e,t,n,r,i){var s=Backbone.View.extend({className:"collection-list-item clk continue",template:_.template(i),events:{click:"processClicked","click .js-delete":"deleteClicked"},initialize:function(e){this.blend_id=e.blend_id,this.listenTo(this.model,"destroy",this.close),this.listenTo(this.model,"change",this.render)},render:function(){return this.$el.html(this.template(this.model.toJSON())),this},processClicked:function(){e.trigger("collector:process",this.model);var t=this.model.get("Item");t[0]?this.destroyItem(t[0]):this.createItem()},createItem:function(){var e=this,n={blend_id:this.blend_id,collection_id:this.model.get("id")};(new t(n)).save(n,{wait:!0,success:function(t){e.model.set("Item",[t.toJSON()])}})},destroyItem:function(e){var n=this;(new t(e)).destroy({wait:!0,success:function(){n.model.set("Item",[])}})},deleteClicked:function(e){e.stopPropagation();var t="The collection '"+this.model.get("name")+"' ";t+="will be deleted forever!\n",t+="Are you sure you want to do this?",confirm(t)&&this.model.destroy({wait:!0})}});return Backbone.View.extend({tagName:"div",className:"contained marker-lighter",template:_.template(r),events:{"click .js-close":"close","submit form":"submitClicked"},initialize:function(){e.isLoggedIn()&&(this.collection=new n,this.collection.url+="?blend_id="+this.model.get("id"),this.listenTo(this.collection,"sync error",function(){e.trigger("spinner:off")}).listenTo(this.collection,"request",function(){e.trigger("spinner:on")}),this.listenTo(this.collection,"reset",this.render),this.listenTo(this.collection,"add",this.renderOneCollection),this.collection.fetch({reset:!0,parse:!0}))},render:function(){return this.$el.html(this.template(this.model.toJSON())),this.collectionsList=this.$("#collections-list"),_.each(this.collection.models,this.renderOneCollection,this),this.newCollectionAuth(),this.$el.parent().slideDown(),this},newCollectionAuth:function(){e.isFree()&&this.collection.length>=1&&this.$("#new-collection").remove()},renderOneCollection:function(e){var t=new s({model:e,blend_id:this.model.get("id")});this.collectionsList.append(t.render().el)},close:function(e){var t=this;this.$el.parent().slideUp(function(){Backbone.View.prototype.close.call(t,e)})},submitClicked:function(t){t.preventDefault();var n={blend_id:this.model.get("id"),name:this.$('[name="name"]').val(),visibility:this.$('[name="visibility"]').is(":checked")?"private":"public"};this.collection.create(n,{wait:!0,error:function(){e.trigger("app:popup",{data:{pclass:"error-message",message:"Server error when creating your new collection."}})}})}})}),define("modules/blends/single/single_controller",["app","entities/blend"],function(e,t){e.module("BlendsApp",function(e,n,r,i){e.BaseController=e.BaseController||{},e.BaseController.single=function(e){require(["modules/blends/single/single_view","modules/comments/controller","modules/common/views/accordion","modules/common/helpers/preview_area","modules/common/views/taxonomies"],function(r,i,s,o,u){var a,f=$(".blend.single-blend"),l=f.find("script[type='application/json']"),c=l.html();try{a=JSON.parse(c)}catch(h){return!1}var p=new t.BlendModel(a,{parse:!0}),d=new r({el:f,model:p});n.CurrentUser.isLoggedIn()&&d.initFollow();var v=n.request("entities:media:index","Blend",e);v.fetch({wait:!0}).success(function(){var e=new o({model:p,collection:v});d.previewsRegion.show(e)}).error(function(){n.trigger("app:error","There was an error when loading the preview images")});var m=new u({model:p,el:self.$("#taxonomies-box").eq(0)});d.listenTo(d,"staff",function(e){var t=e.get("is_staff_pick");t=parseInt(t,10),t=t!==0?0:1,e.save({is_staff_pick:t},{wait:!0,error:function(){n.trigger("app:error","Error when changing Staff Pick status.")},success:function(){n.trigger("app:success","Successfully "+(t?"added":"removed")+" the blend "+(t?"to":"from")+" Staff Picks.")}})}),d.listenTo(d,"delete",function(e){confirm("The blend will be deleted forever, are you sure?")&&e.destroy({wait:!0,error:function(){n.trigger("app:error","Error when deleting this blend")},success:function(){window.location="/blends/user/"+e.get("user_id")}})}),d.listenTo(d,"publish",function(e){e.save({status:"published"},{wait:!0,error:function(){n.trigger("app:error","Error when publishing the blend")},success:function(){n.trigger("app:success","Blend successfully published. Reloading..."),setTimeout(function(){window.location="/blends/view/"+e.get("id")},3e3)}})}),d.listenTo(d,"reject",function(e){n.CurrentUser.isAdmin()&&require(["modules/blends/views/modal_reject"],function(t){new t({model:e})})}),d.listenTo(d,"report",function(e){n.CurrentUser.isLoggedIn()&&(n.trigger("spinner:on"),require(["models/report","modules/reports/views/modal_blend_report"],function(t,n){var r=new t({type:"blend",object_class:"Blend",object_id:e.get("id"),title:e.get("title")});new n({model:r})},function(){n.trigger("spinner:off")}))}),d.listenTo(d,"download",function(e){if(e.isOwn()||n.CurrentUser.isAdmin()){var t=e.get("id")+"_"+e.get("title");t=t.replace(/[^a-z0-9_]/gim,"_"),t+=".zip",window.location="/media/download/"+e.get("BlendFile")[0].id}else{if("blocked"===e.get("User").status){n.trigger("app:alert","The author of this blend has been blocked, we're not serving their files anymore. Please do NOT report this blend, this behavior is normal.");return}require(["models/download","modules/blends/views/modal_download"],function(t,n){var r=new t({blend_id:e.get("id"),Blend:e.toJSON()});new n({model:r})})}}),d.listenTo(d,"follow",function(e,t){n.trigger("follow:manage",e,t)}),d.listenTo(d,"collect",function(e){"published"!==e.get("status")?n.trigger("app:error","This blend hasn't been published, you can't collect it right now."):n.CurrentUser.isLoggedIn()?require(["modules/collector/app"],function(t){var n=new t({model:e});d.collectorRegion.show(n)}):n.trigger("app:error","You must log in in order to collect a blend!")}),d.listenTo(d,"like",function(e){n.trigger("blend:liked:manage",e.get("id"))});var g=new i;g.prepare({object_class:"Blend",object_id:p.get("id")});var y=new s({el:d.$(".accordion").eq(0),model:d.model});n.trigger("register:user",p.get("User")),d.onRender()})}})}),define("modules/blends/blends_controller",["app","entities/blend","modules/blends/add/add_controller","modules/blends/edit/edit_controller","modules/blends/single/single_controller"],function(e){return e.module("BlendsApp",function(e,t,n,r){e.BaseController=e.BaseController||{},e.Controller=r.Controller.extend(e.BaseController)}),e.BlendsApp.Controller}),define("modules/blends/blends_router",["app","modules/blends/blends_controller"],function(e,t){return e.module("BlendsApp",function(e,n,r,i){var s=new t;e.Router=i.AppRouter.extend({controller:s,appRoutes:{"blends/add":"add","blends/edit/:id":"edit","blends/view/:id":"single"}}),n.on("blends:edit",function(e){n.navigate("/blends/edit/"+e),s.edit(e)}),n.on("blends:add",function(){n.navigate("/blends/add"),s.add()}),n.on("blends:single",function(e){n.navigate("/blends/view/"+e),s.single(e)}),n.addInitializer(function(){new e.Router})}),e.BlendsApp.Router}),define("entities/report",["app","entities/base"],function(e){return e.module("Entities",function(e,t,n){e.ReportModel=e.BaseModel.extend({defaults:{user_id:t.CurrentUser.get("id"),object_id:0,object_class:"BlendSwap"},url:function(){return"/reports"+this.getUrlID()},parse:function(e){if(e.id)return e;if(e.Report)return e.User&&(e.Report.User=e.User),e.Report;t.trigger("app:error","there was an error when parsing a report. Please report you saw thyis error message to the admins")},validate:function(e){var t=[];t.push(this.validateText(e.reason,"reason",2,256,!0)),t.push(this.validateText(e.body,"description",50,5e3,!1));var n=["Blend","Request","Question","BlendSwap"];t.push(this.validateAllowed(e.object_class,n)),t=this.cleanErrors(t);if(!_.isEmpty(t))return t}}),e.ReportsCollection=e.BaseCollection.extend({model:e.ReportModel,url:function(){return"/reports"}}),t.reqres.setHandler("entities:reports:new",function(t){return new e.ReportModel}),t.reqres.setHandler("entities:reports:single",function(t){return new e.ReportModel({id:t})}),t.reqres.setHandler("entities:reports:index",function(t){return new e.ReportsCollection([],t)}),t.reqres.setHandler("entities:reports:collection",function(t){return new e.ReportsCollection(t,{parse:!0})})}),e.Entities}),define("text!templates/reports/form_view.html",[],function(){return'<% if (isNew) { %><div class="col-large-12"><div class="alert-message">You are about to send a bug report to the Blend Swap admins, please be very specific and include as many details as possible.<ul><li>What do you see?</li><li>Is there an error message from the site?</li><li>Can you open your browser console and tell us if an error pops up in there?</li></ul></div></div><form><div class="col-large-12"><label for="report-reason">Select the reason for your report</label><select name="reason" id="report-reason"><option value="I\'ve found a typo on Blend Swap\'s interface">I\'ve found a typo on Blend Swap\'s interface</option><option value="A Blend Swap feature is not working for me">A Blend Swap feature is not working for me</option><option value="An error message me instructed me to report the issue">An error message me instructed me to report the issue</option><option value="I keep seeing errors when using Blend Swap">I keep seeing errors when using Blend Swap</option><option value="I\'ve found a bug in your code">I\'ve found a bug in your code</option><option value="I\'ve found a security flaw">I\'ve found a security flaw</option></select></div><div class="col-large-12"><label for="report-body">Describe your issue with exhaustive details</label><textarea name="body" id="report-body" rows="8"></textarea></div><div class="col-large-12"><p class="info-message small">We have automatically collected the following data about your browser and OS so we can better diagnose your issue . If you don\'t agree that we receive this data please browse away or press the <em>Cancel</em> button below.</p><input type="hidden" name="browserData"><pre id="report-browser-data"></pre></div><div class="col-large-12"><button type="submit" class="button js-save">Send Report</button>&nbsp; <a href="/" class="button button-blue js-cancel">Cancel</a></div></form><% } else { %><div class="col-large-12"><div class="success-message text-big-24">Your report has been sent, we will have a look at it as soon as possible. Thank you!</div></div><% } %>'}),define("modules/reports/common/form_view",["app","backbone.syphon","text!templates/reports/form_view.html"],function(e,t,n){return e.module("ReportsApp.Views",function(e,r,i,s){e.AddView=s.ItemView.extend({events:{"submit form":"formSubmitted"},template:_.template(n),serializeData:function(){var e=this.model.toJSON();return e.isNew=this.model.isNew(),e},onShow:function(){var e=_.pick(window.navigator,"userAgent","buildID","cookieEnabled","jsEnabled","appName","platform","appVersion","appCodeName","product"),t=JSON.stringify(e,null,2);this.$("#report-browser-data").text(t),this.$("input[name='browserData']").val(t)},formSubmitted:function(e){e&&e.preventDefault();var n=t.serialize(this);this.trigger("save",n)}})}),e.ReportsApp.Views.AddView}),define("modules/reports/add/add_controller",["app","entities/report"],function(e){e.module("ReportsApp",function(e,t,n,r){e.BaseController=e.BaseController||{},e.BaseController.add=function(){var e=t.request("entities:reports:new");require(["modules/reports/common/form_view"],function(n){var r=new n({model:e});r.listenTo(r,"save",function(n){e.save(n,{wait:!0,error:function(){t.trigger("app:error","There was an error when sending your report. Please report you saw this error to the admins on Twitter, Facebook or our #blendswap Freenode channel.")},success:function(){t.trigger("app:success","Your report was sent successfully! Thank you very much for helping us find issues on the site!"),r.render(),t.trigger("scroll:top")}})}),t.contentRegion.show(r)})}})}),define("modules/reports/reports_controller",["app","modules/reports/add/add_controller"],function(e){return e.module("ReportsApp",function(e,t,n,r){e.BaseController=e.BaseController||{},e.Controller=r.Controller.extend(e.BaseController)}),e.ReportsApp.Controller}),define("modules/reports/reports_router",["app","modules/reports/reports_controller"],function(e,t){return e.module("ReportsApp",function(e,n,r,i){var s=new t;e.Router=i.AppRouter.extend({controller:s,appRoutes:{bugs:"add","reports/add":"add"}}),n.on("reports:add",function(){n.navigate("/bugs"),s.bugs()}),n.addInitializer(function(){new e.Router})}),e.ReportsApp.Router}),define("entities/request",["app","entities/base"],function(e){return e.module("Entities",function(t){t.RequestModel=t.BaseModel.extend({defaults:{title:"",body:"",status:"incomplete",is_challenge:"0",requirements:[],user_id:e.CurrentUser.get("id")},url:function(){return"/requests"+this.getUrlID()},parse:function(t){return t.id?("boolean"==typeof t.is_challenge&&(t.is_challenge=t.is_challenge?"1":"0"),t):t.Request?(t.User&&(t.Request.User=t.User),t.Image&&(t.Request.Image=t.Image),t.BlendFile&&(t.Request.BlendFile=t.BlendFile),t.Follow&&(t.Request.Follow=t.Follow),t.Response&&(t.Request.Response=t.Response),"boolean"==typeof t.Request.is_challenge&&(t.Request.is_challenge=t.Request.is_challenge?"1":"0"),t.Requirement&&t.Requirement[0]&&(t.Request.Requirement=t.Requirement,this.parseTaxa(t)),t.Request):(e.trigger("app:error","There was an error when parsing a request objectPlease report you saw this error!"),this.defaults)},parseTaxa:function(e){var t=[];e.Request.Requirement=[],e.Request.requirements=[],e.Request.Tag=[],e.Request.tags="",e.Requirement&&(_.each(e.Requirement,function(n){"requirement"===n.Term.type?(e.Request.Requirement.push(n),e.Request.requirements.push(n.Term.id)):"tag"===n.Term.type&&(e.Request.Tag.push(n),t.push(n.Term.name))},this),_.isEmpty(t)||(e.Request.tags=t.join(", ")))},validate:function(t){var n=[];n.push(this.validateText(t.title,"title",2,64)),n.push(this.validateText(t.body,"description",50,5e3,!0));if(!e.CurrentUser.isAdmin()){var r=[this.get("status"),"open","closed"];n.push(this.validateAllowed(this.get("status"),r))}n.push(this.validateArrayTaxa(t.requirements,"requirements",1,5)),t.award&&(t.award=parseInt(t.award,10),t.award<2&&n.push("Award factor must be at least 2, lower values are just lame...")),n=this.cleanErrors(n);if(!_.isEmpty(n))return n}}),t.RequestsCollection=t.BaseCollection.extend({model:t.RequestModel,url:function(){return"/requests"}}),e.reqres.setHandler("entities:requests:new",function(){return new t.RequestModel}),e.reqres.setHandler("entities:requests:single",function(e){return new t.RequestModel({id:e})}),e.reqres.setHandler("entities:requests:index",function(e,n){return new t.RequestsCollection(e,n)})}),e.Entities}),define("text!templates/requests/form_view.html",[],function(){return'<div id="guidelines-region" class="cage-large-12 <%- isNew ? \'\' : \'hidden\' %>"><div class="col-large-12"><div class="error-message"><h3 class="shrinkwrap">Guidelines</h3><div>Please make sure you understand these guidelines before going ahead and create your request.</div></div></div><div class="col-large-12"><hr><h3 class="tight">Get help from the community.</h3><p class="shrinkwrap">Requests are a way for you to get help from the Blend Swap community , whether it\'s to make a model from scratch or to ask for someone to help you finish your work , this is the place to be.</p><% if (isFree) { %><p>Users with free accounts can create a single request every 30 days. If you would like to enjoy of <strong>Unlimited Requests</strong> please consider joining the Associate Membership program, which will also get you a lot of other enhancements on the site.</p><% } %></div><div class="col-large-12"><hr><h3 class="tight">Be as specific as possible.</h3><p class="shrinkwrap">Your request\'s description should be thorough. If the form doesn\'t have a field for what you want then add it to the description. The more details the better, if someone asks for a detail you didn\'t include in the comments, you should answer to them there and add the info to the description as well.</p></div><div class="col-large-12"><hr><h3 class="tight">About blend files in requests.</h3><p class="shrinkwrap">The requests section of Blend Swap now also supports blend files to be shared from it, please follow the following rules:</p><ul><li>The blend files you upload MUST be your own own creation, or a friend\'s. DO NOT UPLOAD THIRD PARTY BLENDS.</li><li>The blend files you upload here MUST be work in progress. Do not upload completed work to a request, completed work is to be shared <a href="/blends/add">from this other page</a>.</li><li>Do not upload a blend here to circumvent the moderation queue for regular blends. If you do this once we will delete the request and send you a warning. If you do this twice we will block your account permanently.</li></ul></div><div class="col-large-12"><hr><p class="text-center"><button class="button button-big button-green js-form-accept"><span class="icon-thumb-up"></span> I\'M OK WITH THESE GUIDELINES</button></p></div></div><div class="cage-large-12 <%- isNew ? \'hidden\' : \'\' %>" id="form-region"><div class="cage-large-8 cage-medium-12" id="data-region"><form action="/requests/add" method="POST"><div class="col-large-12"><h3 class="shrinkwrap"><% if (isNew) { %>Create a new Request<% } else { %>Editing Request <a href="/requests/view/<%- id %>">#<%- id %></a><% } %></h3></div><div class="cage-large-12"><div class="col-large-12"><label for="request-title"><span class="icon-info"></span> Request Title</label><input class="full" type="text" name="title" id="request-title" placeholder="2 characters minimum, 64 maximum"></div></div><div class="cage-large-12"><div class="col-large-12"><label for="request-body"><span class="icon-info"></span> Description</label><textarea class="full" rows="8" name="body" id="request-body" placeholder="50 characters minimum, 5000 maximum"></textarea></div></div><div class="cage-large-12"><% if (isAdmin) { %><div class="col-large-6"><label for="request-is_challenge"><span class="icon-info"></span> Is this request a Weekend Challenge?</label><select name="is_challenge" id="request-is_challenge"><option value="0">No, it\'s not</option><option value="1">Yes, it is</option></select></div><% } %><% if (!isNew && isComplete) { %><div class="col-large-6 col-small-12"><label for="request-status"><span class="icon-info"></span> Status</label><select name="status" id="request-status"><option value="open">Open</option><option value="closed">Closed</option></select></div><% } %><div class="col-large-6 col-small-12"><label for="request-blend_license"><span class="icon-cc"></span> Blend License</label><select name="blend_license" id="request-blend_license"><option value="CC">Optional</option><option value="CC-0">CC-Zero</option><option value="CC-BY">CC-BY</option><option value="CC-BY-SA">CC-BY-SA</option><option value="CC-BY-NC">CC-BY-NC</option><option value="CC-BY-SA-NC">CC-BY-NC-SA</option></select><p class="small shrinkwrap">Selecting a license is optional, your responders will be required to release their assets under this license.</p></div></div><% if (!isNew) { %><div class="cage-large-12"><div class="col-large-6"><button class="button block js-submit" type="submit">Save Request</button></div><div class="col-large-6"><a href="/requests/view/<%- id %>" class="button button-blue block js-cancel">Cancel</a></div></div><% } %><div class="col-large-12"><hr></div><div class="cage-large-12"><div class="col-large-12"><h3 class="shrinkwrap">Requirements</h3></div><div class="cage-large-12" id="terms-region"></div></div><div class="cage-large-12"><div class="col-large-6"><button class="button block js-submit" type="submit">Save Request</button></div><% if (isNew) { %><div class="col-large-6"><a href="/requests" class="button button-blue block js-cancel">Cancel</a></div><% } else { %><div class="col-large-6"><a href="/requests/view/<%- id %>" class="button button-blue block js-cancel">Cancel</a></div><% } %></div></form><% if (!isNew) { %><div class="cage-large-12"><div class="col-large-12"><hr></div><div class="col-large-12"><h3 class="tight">Danger Zone:</h3><div class="error-message">Once deleted you won\'t be able to recover this request!</div></div><div class="col-large-6"><button class="button button-red block js-request-delete">Delete Request</button></div></div><% } %><div class="col-large-12"><hr></div></div><div class="cage-large-4 cage-medium-12"><div class="cage-large-12"><div class="col-large-12"><h3 class="tight"><span class="icon-image"></span> Images</h3><% if (isNew) { %><div class="info-message">Please fill and submit the info to the left/above, before uploading the files. :)</div><% } else { %><div class="alert-message">.jpg or .png, 512px by 512px min</div><% } %></div><div id="images-region" class="col-large-12"></div><div class="col-large-12"><hr></div></div><div class="cage-large-12"><div class="col-large-12"><h3 class="tight"><span class="icon-blender"></span> Blends <small>( optional )</small></h3><% if (isNew) { %><div class="info-message">Please fill and submit the info to the left/above, before uploading the files. :)</div><% } else { %><div class="alert-message">.blend or .zip, 90 MB max</div><% } %></div><div id="zips-region" class="col-large-12"></div></div><div class="col-large-12"><div class="success-message"><h5 class="tight">Notes:</h5><ul class="shrinkwrap"><li>Uploading blends to your request is optional.</li><li>The default image shows up first and is used in the indexes.</li><li>The default blend is the file other users download.</li><li>You have to set files as default manually if you want them to be downloadable or to show up first.</li></ul></div></div></div></div>'}),define("modules/requests/common/form_view",["app","to-markdown","backbone.syphon","text!templates/requests/form_view.html"],function(e,t,n,r){return n.InputWriters.register("checkbox",function(e,t){var n=_.contains(t,e.val());e.prop("checked",n)}),n.InputWriters.register("radio",function(e,t){var n=_.isEqual(t,e.val());e.prop("checked",n)}),n.InputReaders.register("checkbox",function(e){return e.val()}),n.KeyAssignmentValidators.register("checkbox",function(e){return e.is(":checked")}),e.module("BlendsApp.Views",function(e,i,s,o){e.FormView=o.LayoutView.extend({tagName:"article",className:"cage-large-12",events:{"submit form":"formSubmitted","click .js-form-accept":"acceptClicked","click .js-request-delete":"deleteClicked","click .js-request-cancel":"cancelClicked"},regions:{dataRegion:"#data-region",zipsRegion:"#zips-region",imagesRegion:"#images-region",termsRegion:"#terms-region"},template:_.template(r),serializeData:function(){var e=this.model.toJSON();return e.change_log="",e.isNew=this.model.isNew(),e.isAdmin=i.CurrentUser.isAdmin(),e.isFree=i.CurrentUser.isFree(),e.isComplete=!_.isEmpty(e.Image),"boolean"==typeof e.is_fan_art&&(e.is_fan_art=e.is_fan_art?"1":"0"),e},onShow:function(){var e=this.model.toJSON();e.body=t(e.body),n.deserialize(this,e)},formSubmitted:function(e){e&&e.preventDefault();var t=n.serialize(this);this.trigger("save",t)},acceptClicked:function(e){e&&e.preventDefault(),this.trigger("accept")},deleteClicked:function(e){e&&e.preventDefault(),this.trigger("delete",this.model)},cancelClicked:function(e){e&&e.preventDefault(),this.trigger("cancel",this.model)}})}),e.BlendsApp.Views.FormView}),define("modules/requests/add/add_view",["app","modules/requests/common/form_view"],function(e,t){return e.module("RequestsApp.Views",function(e,n,r,i){e.AddView=t.extend({})}),e.RequestsApp.Views.AddView}),define("text!templates/requests/requirement_item.html",[],function(){return'<input type="checkbox" name="requirements[]" id="request-requirements-<%- id %>" value="<%- id %>"><label for="request-requirements-<%- id %>"><%- name %></label>'}),define("modules/requests/common/requirement_item",["app","text!templates/requests/requirement_item.html"],function(e,t){return e.module("RequestsApp.Views",function(e,n,r,i){e.RequirementItem=i.ItemView.extend({className:"col-large-12",template:_.template(t)})}),e.RequestsApp.Views.RequirementItem}),define("text!templates/requests/requirements_view.html",[],function(){return'<div class="col-large-12"><h6 class="shrinkwrap"><%- name %>:</h6></div><div class="cage-large-12 three-columns terms-list"></div>'}),define("modules/requests/common/requirements_view",["app","modules/requests/common/requirement_item","text!templates/requests/requirements_view.html"],function(e,t,n){var r=Marionette.ItemView.extend({className:"col-large-12",template:_.template("<p>No requirements under this category</p>")});return e.module("BlendsApp.Views",function(e,i,s,o){e.Categories=o.CompositeView.extend({childView:t,emptyView:r,tagName:"div",className:"cage-large-12 margin-bottom-32",childViewContainer:".terms-list",template:_.template(n)})}),e.BlendsApp.Views.Categories}),define("text!templates/common/not_functional.html",[],function(){return'<div class="col-large-12"><h3>Error: This page in not functional.</h3><p>Something went very wrong when we were trying to build this page, please report you saw this error! Copy the address of this page and send it to <a href="/users/view/poifox">@poifox</a>.</p></div>'}),define("modules/common/views/not_functional",["app","text!templates/common/not_functional.html"],function(e,t){return e.module("CommonApp.Views",function(e,n,r,i){e.NotFunctionalView=i.ItemView.extend({events:{},template:_.template(t)})}),e.CommonApp.Views.NotFunctionalView}),define("text!templates/requests/not_allowed.html",[],function(){return'<div class="col-large-12"><h3>Welp... You can\'t create a new Request right now...</h3><p class="text-big-24">The last time you created a request was on <strong class="green"><%- prettyDate(created) %></strong> , you will have to wait until <strong class="green"><%- prettyDate(untilDate) %></strong></p><p class="text-big-24">You can become an <a href="/page/associate">Associate Member</a>, and create unlimited requests!</p><p><a href="/upgrade" class="button button-huge button-green"><span class="icon-high-power"></span> Upgrade now</a></p></div>'}),define("modules/requests/add/not_allowed",["app","text!templates/requests/not_allowed.html"],function(e,t){return e.module("RequestsApp.Views",function(e,n,r,i){e.Checking=i.ItemView.extend({events:{},template:_.template(t),serializeData:function(){var e=this.model.toJSON(),t=26784e5,n=convertSQLDate(e.created),r=n.getTime()+t;return e.untilDate=new Date(r),e.created=n,e}})}),e.RequestsApp.Views.Checking}),define("text!templates/requests/no_blends.html",[],function(){return'<div class="col-large-12"><h1>You can\'t publish requests</h1><p class="text-big-24">Requests are available for Blend Swap users who have shared at least one blend. This part of the site will become activated as soon as you get to publish a blend.</p><p class="text-big-24">Free users can create one Request a month, while <a href="/pages/view/associate">Associate</a> and <a href="/pages/view/deadline">Deadline</a> Members can create as many Requests as they like</p></div>'}),define("modules/requests/add/no_blends",["app","text!templates/requests/no_blends.html"],function(e,t){return e.module("RequestsApp.Views",function(e,n,r,i){e.NoBlendsView=i.ItemView.extend({events:{},template:_.template(t)})}),e.RequestsApp.Views.NoBlendsView}),define("modules/requests/add/add_controller",["app","entities/term","entities/request"],function(e,t){e.module("RequestsApp",function(e,n,r,i){e.BaseController=e.BaseController||{},e.BaseController.add=function(){n.CurrentUser.isLoggedIn()||(window.location="/requests"),$.when(this._checkAuth()).done(function(e,r){e?(requirementsCollection=n.request("entities:terms:type","requirement"),requirementsCollection.fetch({wait:!0}).success(function(){require(["modules/requests/add/add_view","modules/requests/common/requirements_view"],function(e,r){var i=n.request("entities:requests:new"),s=new e({model:i});s.listenTo(s,"cancel",function(e){window.location="/requests"}),s.listenTo(s,"accept",function(){s.$("#guidelines-region").slideUp(250),s.$("#form-region").slideDown(250),$("body").animate({scrollTop:0},250)}),s.listenTo(s,"save",function(e){i.save(e,{wait:!0,error:function(){n.trigger("app:error","There was an error when saving the request's data! Please report you saw this message.")},success:function(){n.trigger("app:success","The request's data has been successfully saved, your can now upload preview images and blend files (optional)."),n.trigger("requests:edit",i.get("id"))}})}),s.listenTo(s,"show",function(){requirementsCollection.each(function(e){var n=e.get("children"),i=new t.TermsCollection(n,{parse:!0}),o=new r({model:e,collection:i});s.$("#terms-region").append(o.render().el)})}),n.contentRegion.show(s)})}).error(function(){require(["modules/common/views/not_functional"],function(e){n.contentRegion.show(new e)})})):r?require(["modules/requests/add/not_allowed"],function(e){n.contentRegion.show(new e({model:r}))}):require(["modules/requests/add/no_blends"],function(e){n.contentRegion.show(new e)})})},e.BaseController._checkAuth=function(){var e=$.Deferred();return setTimeout(function(){if(n.CurrentUser.isFree()){var t=n.CurrentUser.get("blend_count");t=parseInt(t,10);if(t>=1){var r=n.request("entities:requests:index",{}),i=n.request("entities:terms:type","requirement");r.url=function(){return"/requests/user/"+n.CurrentUser.get("id")+".json"},r.fetch({wait:!0}).success(function(){if(r.models.length>0){var t=(new Date).getTime()-2592e6,n=r.at(0),i=n.get("created"),s=convertSQLDate(i),o=s.getTime();o<=t?e.resolve(!0,n):e.resolve(!1,n)}else e.resolve(!0,!1)}).error(function(){require(["modules/common/views/not_functional"],function(e){n.contentRegion.show(new e)})})}else e.resolve(!1,!1)}else e.resolve(!0)},10),e.promise()}})}),define("modules/requests/edit/edit_view",["app","modules/requests/common/form_view"],function(e,t){return e.module("RequestsApp.Views",function(e,n,r,i){e.EditView=t.extend({})}),e.RequestsApp.Views.EditView}),define("modules/requests/edit/edit_controller",["app","entities/term","collections/media"],function(e,t,n){e.module("RequestsApp",function(e,r,i,s){e.BaseController=e.BaseController||{},e.BaseController.edit=function(e){r.CurrentUser.isLoggedIn()||(window.location="/requests"),r.trigger("scroll:top");var i=r.request("entities:requests:single",e),s=r.request("entities:terms:type","requirement");s.fetch({wait:!0}).success(function(){i.fetch({wait:!0}).success(function(){if(!r.CurrentUser.isAdmin()&&!i.isOwn())return window.location="/requests/user/"+r.CurrentUser.get("id"),!1;var o={parse:!0,object_class:"Request",object_id:e},u=new n(i.get("Image"),o),a=new n(i.get("BlendFile"),o);require(["modules/requests/edit/edit_view","modules/requests/common/requirements_view","modules/common/views/media_manager"],function(e,n,o){var f=new e({model:i});f.listenTo(u,"add",function(){var e="incomplete"==i.get("status");if(!e)return;i.fetch({wait:!0,success:function(t){e&&"open"==t.get("status")&&r.trigger("app:success","Your request is now complete and has been automatically published. there's a link to the request at the top of this page.")}})}),f.listenTo(a,"add",function(e){var t="incomplete"==i.get("status");f.model.fetch({wait:!0})});var l=new o({collection:u,media_type:"image"});l.listenTo(l,"childview:default",function(e,t){t.save({status:"default"},{success:function(){r.trigger("media:default",t.get("id"))}})}),l.listenTo(l,"childview:delete",function(e,t){if("default"===t.get("status"))return r.trigger("app:error","This file is the default one, you'll have to set a new default file before deleting this one."),!1;confirm("The file will be deleted forever.\nAre you sure?")&&t.destroy({wait:!0,success:function(){r.trigger("app:success","The file was deleted correctly")},error:function(){r.trigger("app:error","Something went wrong and the file was not deleted. Please report you saw this error.")}})});var c=new o({collection:a,media_type:"blend"});c.listenTo(c,"childview:default",function(e,t){t.save({status:"default"},{success:function(){r.trigger("media:default",t.get("id"))}})}),c.listenTo(c,"childview:delete",function(e,t){if("default"===t.get("status"))return r.trigger("app:error","This file is the default one, you'll have to set a new default file before deleting this one."),!1;confirm("The file will be deleted forever.\nAre you sure?")&&t.destroy({wait:!0,success:function(){r.trigger("app:success","The file was deleted correctly")},error:function(){r.trigger("app:error","Something went wrong and the file was not deleted. Please report you saw this error.")}})}),f.listenTo(f,"cancel",function(e){window.location="/requests/view/"+e.get("id")}),f.listenTo(f,"save",function(e){i.save(e,{wait:!0,error:function(){r.trigger("app:error","There was an error when saving the request's data! Please report you saw this message.")},success:function(){r.trigger("app:success","The request's info was updated successfully.")}})}),f.listenTo(f,"delete",function(e){if(confirm("The request will be deleted permanently.\nAre you 100% sure?")){var t=e.get("user_id");e.destroy({wait:!0,error:function(){r.trigger("app:error","There was an error when saving the request's data! Please report you saw this message.")},success:function(){window.location="/requests/user/"+t}})}}),f.listenTo(f,"show",function(){f.imagesRegion.show(l),f.zipsRegion.show(c),s.each(function(e){var r=e.get("children"),i=new t.TermsCollection(r,{parse:!0}),s=new n({model:e,collection:i});f.$("#terms-region").append(s.render().el)})}),r.contentRegion.show(f)})}).error(function(){})}).error(function(){alert("Error when retrieving the requirements!")})}})}),define("entities/response",["app","entities/base"],function(e){return e.module("Entities",function(e,t,n){e.ResponseModel=e.BaseModel.extend({defaults:{user_id:t.CurrentUser.get("id"),blend_id:null,request_id:null},url:function(){return"/responses"+this.getUrlID()},parse:function(e){if(e.id)return e;if(e.Response)return e.User&&(e.Response.User=e.User),e.Blend&&(e.Response.Blend=e.Blend),e.Request&&(e.Response.Request=e.Request),e.Response;t.trigger("app:error","there was an error when parsing a response. Please report you saw thyis error message to the admins")}}),e.ResponsesCollection=e.BaseCollection.extend({model:e.ResponseModel,url:function(){return"/responses"}}),t.reqres.setHandler("entities:responses:new",function(t){return new e.ResponseModel}),t.reqres.setHandler("entities:responses:single",function(t){return new e.ResponseModel({id:t})}),t.reqres.setHandler("entities:responses:index",function(t){return new e.ResponsesCollection([],t)}),t.reqres.setHandler("entities:responses:collection",function(t){return new e.ResponsesCollection(t,{parse:!0})})}),e.Entities}),define("modules/requests/single/single_view",["app"],function(e,t){return e.module("RequestsApp.Views",function(e,t,n,r){e.SingleView=r.LayoutView.extend({object_class:"Request",events:{"click .js-follow":"followClicked","click .js-request-award":"awardClicked","click .js-request-report":"reportClicked","click .js-request-delete":"deleteClicked","click .js-request-respond":"respondClicked","click .js-request-download":"downloadClicked"},regions:{responsesRegion:"#responses-region",previewsRegion:"#previews-region"},onRender:function(){"closed"===this.model.get("status")&&this.$(".js-request-respond").prop({disabled:"disabled",title:"This request is closed now, responses can't be submitted any more."}),this.autoEmbed()},editClicked:function(e){e&&e.preventDefault(),this.trigger("edit",this.model.get("id"))},deleteClicked:function(e){e&&e.preventDefault(),this.trigger("delete",this.model)},awardClicked:function(e){e&&e.preventDefault(),this.trigger("award",this.model)},respondClicked:function(e){e&&e.preventDefault(),this.trigger("respond",this.model)},reportClicked:function(e){e&&e.preventDefault(),this.trigger("report",this.model)},downloadClicked:function(e){e&&e.preventDefault(),this.trigger("download",this.model)}})}),e.RequestsApp.Views.SingleView}),define("text!templates/requests/responses_item.html",[],function(){return'<div class="box-shadowy response-item"><img src="<%- Blend.Image[0].medium %>" alt="<%- Blend.title %>"><p class="bebas shrinkwrap continue"><a href="/blends/view/<%- Blend.id %>"><%- Blend.title %></a></p><p class="bebas shrinkwrap continue">By <a href="/user/<%- User.username %>"><%- User.username %></a></p><% if (isAdmin || isOwnRequest) { %><div class="actions"><a href="#" class="js-response-delete"><span class="icon-close" title="Click to remove this response"></span></a></div><% } %></div>'}),define("modules/requests/helpers/responses_item",["app","text!templates/requests/responses_item.html"],function(e,t){return e.module("RequestsApp.Views",function(e,n,r,i){e.ResponseItem=i.ItemView.extend({tagName:"li",className:"col-large-3 col-medium-4 col-small-6 col-tiny-12",events:{"click .js-response-delete":"deleteClicked"},template:_.template(t),serializeData:function(){var e=this.model.toJSON();return e.isAdmin=n.CurrentUser.isAdmin(),e.isOwnRequest=n.request("own:request:"+this.model.get("request_id")),e},deleteClicked:function(e){e&&e.preventDefault(),this.trigger("delete",this.model)}})}),e.RequestsApp.Views.ResponseItem}),define("text!templates/requests/responses_view.html",[],function(){return""}),define("modules/requests/helpers/responses_view",["app","modules/requests/helpers/responses_item","text!templates/requests/responses_view.html"],function(e,t,n){var r=Marionette.ItemView.extend({className:"col-large-12",template:_.template('<div class="success-message">No responses have been submitted yet. <a href="#" class="js-request-respond">Submit a response now!</a></div>')});return e.module("RequestsApp.Views",function(e,i,s,o){e.Responses=o.CollectionView.extend({events:{},childView:t,emptyView:r,tagName:"ul",className:"reset cage-large-12",template:_.template(n)})}),e.RequestsApp.Views.Responses}),define("text!templates/requests/modal_report.html",[],function(){return'<div class="modal contained"><form action="" method="POST"><header class="contained-header marker-red"><h3 class="contained-title continue">Report/Flag this Request</h3><div class="contained-actions"><span class="icon-close clk js-report-close"></span></div></header><section class="contained-body col-large-12"><div class="col-large-12"><label for="report-reason"><span class="icon-alert red"></span> Report Reason</label><select name="reason" id="report-reason"><option value="">Select a reason</option><option value="The Request is messy and unclear">The Request is messy and unclear</option><option value="The request\'s file is not the required file">The request\'s file is not the required file</option><option value="The request\'s file is broken/I can\'t open it">The request\'s file is broken/I can\'t open it</option><option value="The user is distributing an illegal/stolen asset">The user is distributing an illegal/stolen asset</option></select></div><div class="col-large-12"><label for="report-body"><span class="icon-alert red"></span> Notes and Evidence</label><textarea class="full" rows="6" name="body" id="report-body" placeholder="50 characters minimum, 5000 maximum. You can use Markdown."></textarea></div></section><div class="col-large-6 col-small-12"><button type="submit" class="button block">Report now</button></div><div class="col-large-6 col-small-12"><button type="reset" class="button button-blue block js-report-close">Cancel</button></div></form></div>'}),define("modules/requests/helpers/modal_report",["app","backbone.syphon","text!templates/requests/modal_report.html"],function(e,t,n){return e.module("RequestsApp.Views",function(e,r,i,s){e.ReportModal=s.ItemView.extend({className:"overlay",events:{"submit form":"formSubmitted",click:"clicked"},onShow:function(){this.$el.fadeIn(250)},template:_.template(n),clicked:function(e){$(e.target).is(".overlay, .js-report-close")&&this.close()},formSubmitted:function(e){e&&e.preventDefault();var n=t.serialize(this);this.trigger("save",n)}})}),e.RequestsApp.Views.ReportModal}),define("text!templates/requests/modal_award.html",[],function(){return'<div class="modal contained"><header class="contained-header"><h3 class="contained-title continue">Award and Close</h3><div class="contained-actions"><span class="icon-close clk js-award-close"></span></div></header><form><input type="hidden" value="closed" name="status"><section class="contained-body col-large-12"><div class="col-large-12"><p>Users who have responded to this Weekend Challenge will receive a bandwidth bonus calculated as <code>Factor</code> times the size of each model they uploaded as a response.</p><p><label for="request-award">Factor</label><input type="number" value="0" id="request-award" name="award" class="full"></p><p class="success-message">Users will receive <span class="value">0</span> times their uploaded megabytes.</p></div></section><footer class="contained-footer col-large-12"><div class="col-large-6 col-small-12"><button class="button block js-request-award">Award and Close</button></div><div class="col-large-6 col-small-12"><span class="button button-blue block js-award-close">Cancel</span></div></footer></form></div>'}),define("modules/requests/helpers/modal_award",["app","backbone.syphon","text!templates/requests/modal_award.html"],function(e,t,n){return e.module("RequestsApp.Views",function(e,r,i,s){e.AwardModal=s.ItemView.extend({className:"overlay",events:{"submit form":"formSubmitted","change input[name='award']":"factorChanged",click:"clicked"},template:_.template(n),onShow:function(){this.$el.fadeIn(250),this.factorSpan=this.$("p.success-message span.value")},factorChanged:function(e){var t=this.$("input[name='award']").val();this.factorSpan.text(t)},clicked:function(e){$(e.target).is(".overlay, .js-award-close")&&this.close()},formSubmitted:function(e){e&&e.preventDefault();var n=t.serialize(this);this.trigger("save",n)}})}),e.RequestsApp.Views.AwardModal}),define("text!templates/requests/blend_item.html",[],function(){return'<div class="clk <%- _.isEmpty(Response) ? \'box-pale-gray\' : \'box-green\' %>" title=\'Click to send "<%-title %>" as a response\'><img src="<%- Image[0].thumb %>" alt="" class="align-left"><h3 class="tight continue"><%- title %></h3><p class="tight"><span class="icon-blender orange"></span> Blender<%- (blender_version/100).toFixed(2) %></p></div>'}),define("modules/requests/helpers/blend_item",["app","text!templates/requests/blend_item.html"],function(e,t){return e.module("RequestsApp.Views",function(e,n,r,i){e.BlendItem=i.ItemView.extend({className:"col-large-6 col-small-12",events:{click:"clicked"},template:_.template(t),onShow:function(){this.listenTo(this.model,"change",this.render)},clicked:function(e){e&&e.preventDefault(),this.trigger("respond",this.model)}})}),e.RequestsApp.Views.BlendItem}),define("text!templates/requests/modal_respond.html",[],function(){return'<div class="modal contained"><header class="contained-header"><h3 class="contained-title continue">Reponding to "<%- title %>"</h3><div class="contained-actions"><span class="icon-close clk js-close"></span></div></header><section class="contained-body col-large-12"><div class="col-large-12"><div class="info-message with-icon">Click once to send a response, and again to remove it.</div></div><div class="cage-large-12" data-region="blends"></div></section><footer class="contained-footer col-large-12"><div class="col-large-6 col-small-12"><button class="button block js-close">I\'m Done</button></div></footer></div>'}),define("modules/requests/helpers/modal_respond",["app","modules/requests/helpers/blend_item","text!templates/requests/modal_respond.html"],function(e,t,n){return e.module("RequestsApp.Views",function(e,r,i,s){var o=s.ItemView.extend({className:"col-large-12",template:_.template('<div class="error-message">You have no published blends right now...</div>')});e.ModalDownloadView=s.CompositeView.extend({className:"overlay",events:{click:"clicked","click .js-respond":"respondClicked"},template:_.template(n),emptyView:o,childView:t,childViewContainer:"[data-region='blends']",onShow:function(){this.$el.fadeIn(250)},clicked:function(e){e&&(e.preventDefault(),e.stopPropagation());var t=$(e.target);t.is(".overlay, .js-close")&&(this.trigger("close"),this.close())},respondClicked:function(e){e&&(e.preventDefault(),e.stopPropagation()),this.trigger("respond")}})}),e.RequestsApp.Views.ModalDownloadView}),define("text!templates/requests/modal_download.html",[],function(){return'<div class="modal contained"><header class="contained-header"><h3 class="contained-title continue">Download Request Source File</h3><div class="contained-actions"><span class="icon-close clk js-close"></span></div></header><section class="contained-body col-large-12"><div class="col-large-12"><p>You\'re downloading the Source file for <a href="/requests/view/<%- id %>"><%- title %></a></p><p>You may modify this file as you need before uploading it back onto the site to respond to <a href="/user/<%- User.username %>"><%- User.username %>\'s</a> request.</p><p>Your version of this asset must be relaesed under the same license type: <span class="bebas"><%- blend_license %></span></p><p>Do not redistribute this source file anywhere else on the Internet unless <a href="/user/<%- User.username %>"><%- User.username %></a> gives your express permission.</p></div></section><footer class="contained-footer col-large-12"><div class="col-large-6 col-small-12"><button class="button block js-download">Download Now</button></div><div class="col-large-6 col-small-12"><button class="button button-blue block js-close">Cancel</button></div></footer></div>'}),define("modules/requests/helpers/modal_download",["app","text!templates/requests/modal_download.html"],function(e,t){return e.module("RequestsApp.Views",function(e,n,r,i){e.ModalDownloadView=i.ItemView.extend({className:"overlay",events:{click:"clicked","click .js-close":"close","click .js-download":"downloadClicked"},template:_.template(t),onShow:function(){this.$el.fadeIn(250)},clicked:function(e){e&&(e.preventDefault(),e.stopPropagation());var t=$(e.target);t.is(".overlay, .js-close")&&this.close()},downloadClicked:function(e){e&&(e.preventDefault(),e.stopPropagation()),this.trigger("download",this.model)}})}),e.RequestsApp.Views.ModalDownloadView}),define("modules/requests/single/single_controller",["app","entities/blend","entities/request","entities/response"],function(e,t){e.module("RequestsApp",function(e,n,r,i){e.BaseController=e.BaseController||{},e.BaseController.single=function(e){var r=$(".request.single-request"),i=r.find("script[type='application/json']");try{var s=JSON.parse(i.html()),o=new t.RequestModel(s,{parse:!0});n.reqres.setHandler("own:request:"+e,function(){return o.isOwn()}),require(["modules/requests/single/single_view","modules/common/views/accordion","modules/comments/controller","modules/requests/helpers/responses_view","modules/common/helpers/preview_area"],function(t,i,s,u,a){var f=new t({el:r,model:o}),l=new i({el:f.$(".accordion").eq(0),model:f.model}),c=n.request("entities:media:index","Request",e);c.fetch({wait:!0}).success(function(){var e=new a({model:o,collection:c});f.previewsRegion.show(e)}).error(function(){n.trigger("app:error","There was an error when loading the preview images")}),f.listenTo(f,"follow",function(e){n.CurrentUser.isLoggedIn()&&n.trigger("follow:manage","Request",e.get("id"))}),n.CurrentUser.isLoggedIn()&&f.initFollow(),f.listenTo(f,"delete",function(e){confirm("The Request will be deleted forever.\nAre you sure?")&&e.destroy({wait:!0,error:function(){n.trigger("app:error","There was an error when deleting this request. Please report you've seen this message when deleting the request.")},success:function(){window.location="/requests"}})}),f.listenTo(f,"report",function(t){require(["modules/requests/helpers/modal_report","entities/report"],function(t){var r=n.request("entities:reports:new");r.set({user_id:n.CurrentUser.get("id"),object_class:"Request",object_id:e});var i=new t({model:r});i.listenTo(i,"save",function(e){r.save(e,{wait:!0,error:function(){n.trigger("app:error","There was an error when saving this report. Please report you saw this error message to the admins.")},success:function(){n.trigger("app:success","Your report has been sent successfully to the admins. Thank you for helping us moderate the site!"),i.close()}})}),n.modalRegion.show(i)})}),f.listenTo(f,"award",function(e){require(["modules/requests/helpers/modal_award"],function(t){var r=new t({model:e});r.listenTo(r,"save",function(t){var i="/requests/award/"+e.get("id");$.ajax({method:"POST",url:i,data:t,dataType:"json",error:function(){n.trigger("app:error","Something went really wrong when trying to award the responders. Please report you saw this error to the development team.")},success:function(e){e.message.match(/error/gi)?n.trigger("app:alert",e.message):(r.close(),n.trigger("app:success",e.message+". Awarded users: "+e.awarded.join(", "))),f.onRender()}})}),n.modalRegion.show(r)})});var h=n.request("entities:responses:collection",o.get("Response"),{parse:!0}),p=new u({collection:h});p.listenTo(p,"childview:delete",function(e,t){confirm("The response will be deleted.\nAre you sure?")&&t.destroy({wait:!0,error:function(){n.trigger("app:error","There was an error when deleting this response. Please report you saw this error message to the admins.")},success:function(){n.trigger("app:success","Response deleted successfully")}})}),f.listenTo(f,"respond",function(e){"open"===e.get("status")?require(["modules/requests/helpers/modal_respond"],function(t){var r=n.request("entities:blends:collection");r.url=function(){return"/blends/respond.json?request_id="+e.get("id")},r.fetch({reset:!0,success:function(){n.modalRegion.show(i)},error:function(){n.trigger("app:error","There was an error when fetching your blends. Please report you saw this error message to the admins.")}});var i=new t({model:e,collection:r});i.on("close",function(){window.location.reload()}),i.listenTo(i,"childview:respond",function(t,r){var i=r.get("Response");i=_.isEmpty(i)?{blend_id:r.get("id"),request_id:e.get("id"),user_id:n.CurrentUser.get("id")}:i[0];var s=new n.Entities.ResponseModel(i);s.isNew()?s.save(i,{wait:!0,error:function(){n.trigger("app:error","There was an error when submitting the response.")},success:function(){r.set("Response",[s.toJSON()])}}):s.destroy({wait:!0,error:function(){n.trigger("app:error","There was an error when deleting the response.")},success:function(){r.set("Response",[])}})})}):n.trigger("app:info","Sorry! This request is closed now, nobody can submit responses.")}),f.listenTo(f,"download",function(t){require(["modules/requests/helpers/modal_download"],function(r){var i=new r({model:t});i.listenTo(i,"download",function(t){var n=e+"_SOURCE_"+t.get("title");n=n.replace(/[^a-z0-9_]/gi,"_"),n+=".zip",window.location="/media/download/"+t.get("BlendFile")[0].id}),n.modalRegion.show(i)})});var d=new s;d.prepare({object_class:"Request",object_id:o.get("id")}),f.responsesRegion.show(p),n.trigger("register:user",o.get("User")),f.onRender()})}catch(u){n.trigger("app:error","There was an error when parsing this request's data.Please report you saw this error to the admins!")}},e.BaseController._startReport=function(){}})}),define("modules/requests/requests_controller",["app","modules/requests/add/add_controller","modules/requests/edit/edit_controller","modules/requests/single/single_controller"],function(e){return e.module("RequestsApp",function(e,t,n,r){e.BaseController=e.BaseController||{},e.Controller=r.Controller.extend(e.BaseController)}),e.RequestsApp.Controller}),define("modules/requests/requests_router",["app","modules/requests/requests_controller"],function(e,t){return e.module("RequestsApp",function(e,n,r,i){var s=new t;e.Router=i.AppRouter.extend({controller:s,appRoutes:{"requests/add":"add","requests/edit/:id":"edit","requests/view/:id":"single"}}),n.on("requests:add",function(){n.navigate("/requests/add"),s.add()}),n.on("requests:index",function(e){n.navigate("/requests"+e),s.index(e)}),n.on("requests:single",function(e){n.navigate("/requests/view/"+e),s.single(e)}),n.on("requests:edit",function(e){n.navigate("/requests/edit/"+e),s.edit(e)}),n.addInitializer(function(){new e.Router})}),e.RequestsApp.Router}),define("text!templates/questions/form_view.html",[],function(){return'<div class="cage-large-12 <%- isNew ? \'\' : \'hidden\' %>" id="guidelines-region"><div class="col-large-12"><h1 class="shrinkwrap">What do you need help with?</h1></div><div class="cage-large-12"><div class="col-large-12"><h3 class="alert-message shrinkwrap"><span class="icon-close"></span> Blend Swap Support</h3></div><div class="col-large-8 col-small-12"><ul class="shrinkwrap"><li>I\'m experiencing problems while using the Blend Swap website.</li><li>I don\'t know how to use a Blend Swap feature.</li><li>I found a typo in the Blend Swap website.</li><li>I have a question for the admins.</li></ul></div><div class="col-large-4 col-small-12"><p class="alert-message">This is not the place for support queries</p><a href="/contact" class="button button-big block">Contact the admins &rarr;</a></div><div class="col-large-12"><hr class=""></div></div><div class="cage-large-12"><div class="col-large-12"><h3 class="alert-message shrinkwrap"><span class="icon-close"></span> I need collaborators</h3></div><div class="col-large-8 col-small-12"><ul class="shrinkwrap"><li>I need someone to complete my blend file for me.</li><li>I need to get collaborators into my movie/game project.</li><li>I don\'t have time to finish a blend, can someone do it for me?</li></ul></div><div class="col-large-4 col-small-12"><p class="alert-message">This is not the place for requesting blends</p><a href="/requests/add" class="button button-big block">Open a Request &rarr;</a></div><div class="col-large-12"><hr class=""></div></div><div class="cage-large-12"><div class="col-large-12"><h3 class="success-message shrinkwrap"><span class="icon-thumb-up"></span> Blender 3D</h3></div><div class="col-large-8 col-small-12"><ul class="shrinkwrap"><li>I don\'t understand a feature in Blender and want I to ask experienced users about it.</li><li>I have a question about what version of Blender supports certain feature.</li><li>I can\'t seem to find a setting or button in Blender, can someone help me?</li></ul></div><div class="col-large-4 col-small-12"><p class="success-message">Good, you\'re in the right place!</p><a href="/contact" class="button button-big button-green block js-accept"><span class="icon-alert"></span> Ask about Blender</a></div><div class="col-large-12"><hr class=""></div></div></div><div class="cage-large-12 <%- isNew ? \'hidden\' : \'\' %>" id="form-region"><div class="cage-large-8 cage-medium-12"><form action=""><div class="col-large-12"><h3 class="shrinkwrap"><% if (isNew) { %>Ask a new question<% } else { %>Editing Question <a href="/questions/view/<%- id %>">#<%- id %></a><% } %></h3></div><div class="col-large-12 required"><label for="question-title"><span class="icon-info"></span> Title</label><input required="required" type="text" class="full" name="title" id="question-title" placeholder="2 characters min"></div><div class="cage-large-12" id="suggestions-region"></div><div class="col-large-12 required"><label for="question-body"><span class="icon-info"></span> Details</label><div class="clearfix"><small>Be as specific as possible, provide datails and even screen shots, so other users know what you are talking about.</small></div><textarea required="required" rows="8" class="full" name="body" id="question-body" placeholder="You can use Markdown, 50 characters min, 5000 max"></textarea></div><div class="col-large-12 required"><label for="question-tags"><span class="icon-tag"></span> Tags</label><input required="required" type="text" class="full" name="tags" id="question-tags" placeholder="these are, just, some example, tags"></div><div class="col-large-6 col-tiny-12"><button type="submit" class="button block js-submit">Save Question</button></div><div class="col-large-6 col-tiny-12"><a class="button button-blue block" href="/questions<%- isNew ? \'\' : \'/view/\' + id %>">Cancel</a></div><% if (!isNew) { %><div class="col-large-12"><hr><h3 class="tight">Danger zone</h3><p><a class="button button-red js-question-delete">Delete Question</a></p></div><% } %></form></div><div class="cage-large-4 cage-medium-12"><div class="col-large-12"><h3 class="tight"><span class="icon-image"></span> Images <small>( optional )</small></h3><% if (isNew) { %><p class="info-message">Please submit the info to the left/above before uploading some images or screen shots</p><% } else { %><div class="success-message">.jpg or .png, 512px by 512px min</div><% } %></div><div class="col-large-12" id="images-region"></div></div></div>'}),define("modules/questions/common/form_view",["app","backbone.syphon","text!templates/questions/form_view.html"],function(e,t,n){return e.module("QuestionsApp.Views",function(e,r,i,s){e.FormView=s.LayoutView.extend({events:{"keyup input[name='title']":"keyupTitle","click .js-accept":"acceptClicked","submit form":"formSubmitted","click .js-question-delete":"deleteClicked"},regions:{imagesRegion:"#images-region",suggestionsRegion:"#suggestions-region"},template:_.template(n),onShow:function(){t.deserialize(this,this.model.toJSON())},serializeData:function(){var e=this.model.toJSON();return e.isNew=this.model.isNew(),e},keyupTitle:function(e){if(!keyboardGo(e))return;this.timer&&clearTimeout(this.timer);var t=e.target;this.timer=setTimeout(function(){t.value&&r.trigger("questions:suggestions",t.value)},400)},acceptClicked:function(e){e&&e.preventDefault(),this.trigger("accept")},formSubmitted:function(e){e&&e.preventDefault();var n=t.serialize(this);this.trigger("save",n)},deleteClicked:function(e){e&&(e.preventDefault(),e.stopPropagation()),this.trigger("delete",this.model)}})}),e.QuestionsApp.Views.FormView}),define("text!templates/questions/suggestion_item.html",[],function(){return'<a href="/questions/view/<%- id %>" target="_blank"><span class="icon-question"></span><%- title %> <small class="green">(<%- status.capitalize() %>/<%- comment_count %>Answers )</small></a>'}),define("modules/questions/common/suggestion_item",["app","text!templates/questions/suggestion_item.html"],function(e,t){return e.module("QuestionsApp.Views",function(e,n,r,i){e.SuggestionItem=i.ItemView.extend({tagName:"li",className:"suggestion-item",events:{},template:_.template(t)})}),e.QuestionsApp.Views.SuggestionItem}),define("text!templates/questions/suggestions_view.html",[],function(){return'<label for="question-suggestions">Suggested threads</label><br><small>Check out these answered questions, maybe someone has already solved your problem!</small><ul class="cage-large-12" id="questions-index"></ul>'}),define("modules/questions/common/suggestions_view",["app","modules/questions/common/suggestion_item","text!templates/questions/suggestions_view.html"],function(e,t,n){var r=Marionette.ItemView.extend({tagName:"li",className:"suggestion-item",template:_.template("No questions found...")});return e.module("QuestionsApp.Views",function(e,i,s,o){e.SuggestionsView=o.CompositeView.extend({events:{},childView:t,emptyView:r,tagName:"section",className:"col-large-12",childViewContainer:"#questions-index",template:_.template(n)})}),e.QuestionsApp.Views.SuggestionsView}),define("modules/questions/add/add_controller",["app","entities/question"],function(e){e.module("QuestionsApp",function(t){t.BaseController=t.BaseController||{},t.BaseController.add=function(){var t=e.request("entities:questions:new");require(["modules/questions/common/form_view","modules/questions/common/suggestions_view"],function(n,r){var i=new n({model:t});i.listenTo(i,"accept",function(){i.$("#guidelines-region").slideUp(250),i.$("#form-region").slideDown(250),e.trigger("scroll:top")}),i.listenTo(i,"save",function(n){t.save(n,{wait:!0,error:function(){e.trigger("app:error","There was an error when saving this question. Please report you saw this error to the admins.")},success:function(){e.trigger("app:success","The question was saved successfully! You can now upload some images if they are needed"),e.trigger("questions:edit",t.get("id"))}})}),i.on("show",function(){i.listenTo(e,"questions:suggestions",function(t){var n=e.request("entities:questions:collection");n.url="/questions/search?page=1&keywords="+fixedEncodeURIComponent(t),n.fetch({wait:!0,remove:!0,success:function(){var e=new r({collection:n});i.suggestionsRegion.show(e)}})})}),e.contentRegion.show(i)})}})}),define("text!templates/common/not_found.html",[],function(){return'<div class="col-large-12"><h1>Error 404: Not Found</h1><p>The content you requested was not found on this server. There maybe one or several causes to this error:</p><ul><li>The admins or the content author removed it from the site.</li><li>The content was moved to another address.</li><li>The content never even existed.</li></ul></div>'}),define("modules/common/views/not_found",["app","text!templates/common/not_found.html"],function(e,t){return e.module("CommonApp.Views",function(e,n,r,i){e.NotFoundView=i.ItemView.extend({events:{},template:_.template(t)})}),e.CommonApp.Views.NotFoundView}),define("modules/questions/edit/edit_controller",["app","entities/question","collections/media"],function(e,t,n){e.module("QuestionsApp",function(t){t.BaseController=t.BaseController||{},t.BaseController.edit=function(t){var r=e.request("entities:questions:single",t);r.fetch({wait:!0}).success(function(){if(!e.CurrentUser.isAdmin()&&!r.isOwn()){window.location="/questions";return}require(["modules/questions/common/form_view","modules/common/views/media_manager"],function(i,s){var o=new i({model:r});o.listenTo(o,"accept",function(){o.$("#guidelines-region").slideUp(250),o.$("#form-region").slideDown(250),e.trigger("scroll:top")}),o.listenTo(o,"delete",function(t){confirm("The question will be deleted permanently.\nAre you sure?")&&t.destroy({wait:!0,error:function(){e.trigger("app:error","there was an error when deleting this question. Please report you saw this error to the admins.")},success:function(){window.location="/questions"}})}),o.listenTo(o,"save",function(t){r.save(t,{wait:!0,error:function(){e.trigger("app:error","There was an error when saving this question. Please report you saw this error to the admins.")},success:function(){e.trigger("app:success","The question was saved successfully!")}})});var u={object_class:"Question",object_id:t,parse:!0},a=new n(r.get("Image"),u),f=new s({collection:a});f.listenTo(f,"childview:default",function(t,n){n.save({status:"default"},{wait:!0,error:function(){e.trigger("app:error","There was an error when setting this image as default. Please report you saw this error to the admins.")},success:function(){e.trigger("media:default",mediaModel.get("id"))}})}),f.listenTo(f,"childview:delete",function(t,n){confirm("the image will be deleted forever.\nAre you sure?")&&n.destroy({wait:!0,error:function(){e.trigger("app:error","there was an error when deleting the image. Please report you saw this error to the admins.")}})}),o.listenTo(o,"show",function(){o.imagesRegion.show(f),o.trigger("accept")}),e.contentRegion.show(o)})}).error(function(){require(["modules/common/views/not_found"],function(t){e.contentRegion.show(new t)})})}})}),define("modules/questions/questions_controller",["app","modules/questions/add/add_controller","modules/questions/edit/edit_controller"],function(e){return e.module("QuestionsApp",function(e,t,n,r){e.BaseController=e.BaseController||{},e.Controller=r.Controller.extend(e.BaseController)}),e.QuestionsApp.Controller}),define("modules/questions/questions_router",["app","modules/questions/questions_controller"],function(e,t){return e.module("QuestionsApp",function(e,n,r,i){var s=new t;e.Router=i.AppRouter.extend({controller:s,appRoutes:{"questions/add":"add","questions/edit/:id":"edit"}}),n.on("questions:add",function(){n.navigate("/questions/add"),s.add()}),n.on("questions:index",function(e){n.navigate("/questions"+e),s.index(e)}),n.on("questions:single",function(e){n.navigate("/questions/view/"+e),s.single(e)}),n.on("questions:edit",function(e){n.navigate("/questions/edit/"+e),s.edit(e)}),n.addInitializer(function(){new e.Router})}),e.QuestionsApp.Router}),define("modules/users/common/form_view",["app"],function(e,t){return e.module("UsersApp.Views",function(e,t,n,r){e.AddView=r.ItemView.extend({events:{"keyup #UserUsername":"checkUsername","keyup #UserPassword":"checkPassword","keyup #UserPasswordConfirm":"checkPassword"},initialize:function(){this.usernameField=this.$("#UserUsername"),this.passwordField=this.$("#UserPassword"),this.passwordConfirm=this.$("#UserPasswordConfirm")},checkUsername:function(){var e=this;e.timer&&clearTimeout(e.timer);var t=e.usernameField.val();e.timer=setTimeout(function(){e.trigger("check:username",t)},400)},checkPassword:function(){var e=this.passwordField.val(),t=this.passwordConfirm.val();this.trigger("check:password",e),this.trigger("confirm:password",e,t)}})}),e.UsersApp.Views.AddView}),define("modules/users/add/add_controller",["app","entities/user"],function(e){e.module("UsersApp",function(e,t,n,r){e.BaseController=e.BaseController||{},e.BaseController.add=function(){require(["modules/users/common/form_view"],function(e){var t=$("#UserAddForm"),n=new e({el:t});n.listenTo(n,"check:username",function(e){n.usernameField.parent().find("[class*='-message']").remove(),e&&$.getJSON("/users/search/available/"+e,function(){notice=$("<div>",{"class":"success-message",text:"That username is available :)"}),n.usernameField.parent().append(notice)}).fail(function(){notice=$("<div>",{"class":"error-message",text:"That username is already in use :/"}),n.usernameField.parent().append(notice)})}),n.listenTo(n,"check:password",function(e){var t,r=[];n.passwordField.parent().find("[class*='-message']").remove(),e&&(e.match(/.{8,}/)||r.push("The password is too short, 8 characters min"),e.match(/[a-z]+/)||r.push("Using lower case letters is recommended"),e.match(/[A-Z]+/)||r.push("Using upper case letters is recommended"),e.match(/[0-9]+/)||r.push("Using numbers is recommended"),_.isEmpty(r)?(t=$("<div>",{"class":"success-message",text:"That password looks good :)"}),n.passwordField.parent().append(t)):(t=$("<div>",{"class":"error-message",text:r.join(". ")}),n.passwordField.parent().append(t)))}),n.listenTo(n,"confirm:password",function(e,t){var r;n.passwordConfirm.parent().find("[class*='-message']").remove(),e===t?(r=$("<div>",{"class":"success-message",text:"That passwords match :)"}),n.passwordConfirm.parent().append(r)):(r=$("<div>",{"class":"error-message",text:"That passwords don't match :/"}),n.passwordConfirm.parent().append(r))})})}})}),define("modules/users/edit/edit_controller",["app","entities/user"],function(e){e.module("UsersApp",function(e,t,n,r){e.BaseController=e.BaseController||{},e.BaseController.edit=function(){require(["modules/users/common/form_view"],function(e){var n=$("#UserEditForm"),r=new e({el:n});r.listenTo(r,"check:username",function(e){r.usernameField.parent().find("[class*='-message']").remove();var n=t.CurrentUser.get("username");if(e===n)return!1;e&&$.getJSON("/users/search/available/"+e,function(){notice=$("<div>",{"class":"success-message",text:"That username is available :)"}),r.usernameField.parent().append(notice)}).fail(function(){notice=$("<div>",{"class":"error-message",text:"That username is already in use :/"}),r.usernameField.parent().append(notice)})}),r.listenTo(r,"check:password",function(e){var t,n=[];r.passwordField.parent().find("[class*='-message']").remove(),e&&(e.match(/.{8,}/)||n.push("The password is too short, 8 characters min"),e.match(/[a-z]+/)||n.push("Using lower case letters is recommended"),e.match(/[A-Z]+/)||n.push("Using upper case letters is recommended"),e.match(/[0-9]+/)||n.push("Using numbers is recommended"),_.isEmpty(n)?(t=$("<div>",{"class":"success-message",text:"That password looks good :)"}),r.passwordField.parent().append(t)):(t=$("<div>",{"class":"error-message",text:n.join(". ")}),r.passwordField.parent().append(t)))}),r.listenTo(r,"confirm:password",function(e,t){var n;r.passwordConfirm.parent().find("[class*='-message']").remove(),e===t?(n=$("<div>",{"class":"success-message",text:"That passwords match :)"}),r.passwordConfirm.parent().append(n)):(n=$("<div>",{"class":"error-message",text:"That passwords don't match :/"}),r.passwordConfirm.parent().append(n))})})}})}),define("modules/users/single/single_view",["app"],function(e,t){return e.module("UsersApp.Views",function(e,t,n,r){e.SingleView=r.LayoutView.extend({object_class:"User",events:{"click .js-follow":"followClicked","click .js-message":"messageClicked"},regions:{eventsRegion:"#user-events-region",portfolioRegion:"#user-portfolio-region"},followClicked:function(e){e&&e.preventDefault(),this.trigger("follow",this.model)},messageClicked:function(e){e&&e.preventDefault(),this.trigger("message",this.model)}})}),e.UsersApp.Views.SingleView}),define("modules/events/index/index_item",["app","backbone.syphon","text!templates/events/index_item.html"],function(e,t,n){return e.module("EventsApp.Views",function(e,r,i,s){e.IndexItem=s.ItemView.extend({className:"col-large-12",events:{"click .js-edit":"editClicked","click .js-save":"saveClicked","click .js-delete":"deleteClicked"},template:_.template(n),serializeData:function(){var e=this.model.toJSON();return e.is_own=this.model.isOwn(),e.can_edit=r.CurrentUser.isAdmin(),e.created=prettyDatetime(e.created),e.CurrentUser=r.CurrentUser.toJSON(),e.gravatar=gravatarUrl(e.User),e.action=eventAction(e.type,e.object_class),e},editClicked:function(e){e&&(e.preventDefault(),e.stopPropagation()),this.$(".body, .edit").toggle()},saveClicked:function(e){e&&(e.preventDefault(),e.stopPropagation());var n=t.serialize(this);this.trigger("save",n)},deleteClicked:function(e){e&&(e.preventDefault(),e.stopPropagation()),this.trigger("delete",this.model)}})}),e.EventsApp.Views.IndexItem}),define("modules/events/index/index_view",["app","modules/events/index/index_item"],function(e,t,n){var r=Marionette.ItemView.extend({template:_.template("<h3>No events have been created yet, please try again later.</h3>")});return e.module("EventsApp.Views",function(e,n,i,s){e.Index=s.CollectionView.extend({events:{},childView:t,emptyView:r,tagName:"div",className:"cage-large-12"})}),e.EventsApp.Views.Index}),define("modules/users/single/single_controller",["app","entities/user","entities/event","entities/medium"],function(e,t){e.module("UsersApp",function(e,n,r,i){e.BaseController=e.BaseController||{},e.BaseController.single=function(e){var r,i=$(".user.single-user");try{var s=i.find("script[type='application/json']").eq(0);r=JSON.parse(s.text())}catch(o){return n.trigger("app:error","There was an error when parsing this user's data. Please report that you saw this error to the admins."),!1}var u=new t.UserModel(r,{parse:!0});require(["modules/users/single/single_view","modules/events/index/index_view","modules/common/helpers/preview_area"],function(e,r,s){var o=new e({model:u,el:i});if(n.CurrentUser.isLoggedIn()){var a=new t.EventsCollection([],{});a.url=function(){return"/events/user/"+u.get("id")};var f=new r({collection:a});f.listenTo(f,"childview:delete",function(e,t){confirm("the event will be deleted forever.\nAre you sure?")&&t.destroy({wait:!0,error:function(){n.trigger("app:error","There was an error when deleting this event. Please report you saw this error to the admins.")},success:function(){n.trigger("app:success","The event was deleted successfully")}})}),f.listenTo(f,"childview:save",function(e,t){e.model.save(t,{wait:!0,error:function(){n.trigger("app:error","There was an error when deleting this event. Please report you saw this error to the admins.")},success:function(){e.render()}})}),a.fetch({wait:!0,success:function(){o.eventsRegion.show(f)}})}o.initFollow(),o.listenTo(o,"follow",function(e){n.CurrentUser.isLoggedIn()&&n.trigger("follow:manage","User",e.get("id"))}),o.listenTo(o,"message",function(e){require(["modules/conversations/views/modal_add"],function(t){var r=new t({user:e});n.modalRegion.show(r)})});if(u.isAssociate()||!0){var l=n.request("entities:media:index","User",u.get("id"));l.fetch({wait:!0}).success(function(){var e=new s({model:u,collection:l});o.portfolioRegion.show(e)}).error(function(){n.trigger("app:error","There was an error when requesting the portfolio images")})}})}})}),define("modules/users/forhire/forhire_item",["app"],function(e,t){return e.module("UsersApp.Views",function(e,t,n,r){e.ForHireItem=r.ItemView.extend({events:{"click .js-message":"messageClicked"},messageClicked:function(e){e&&e.preventDefault(),this.trigger("message",this.model)}})}),e.UsersApp.Views.ForHireItem}),define("modules/users/forhire/forhire_controller",["app","entities/user"],function(e,t){e.module("UsersApp",function(e,n,r,i){e.BaseController=e.BaseController||{},e.BaseController.forhire=function(){var e=$(".user.user-forhire");require(["modules/users/forhire/forhire_item"],function(r){_.each(e,function(e){var i={},s=$(e).find("script[type='application/json']");if(s){try{i=JSON.parse(s.text())}catch(o){return n.trigger("app:error","There wan an error when parsing the user's JSON data! Please report you saw this error tot eh admins!"),!1}var u=new t.UserModel(i,{parse:!0}),a=new r({model:u,el:e});a.listenTo(a,"message",function(e){require(["modules/conversations/views/modal_add"],function(t){var r=new t({user:e});n.modalRegion.show(r)})})}else n.trigger("app:error","There was an error when loading the user's JSON data! Please report you saw this error to the admins!")})})}})}),define("modules/users/password/password_controller",["app","entities/user"],function(e){e.module("UsersApp",function(e,t,n,r){e.BaseController=e.BaseController||{},e.BaseController.password=function(){require(["modules/users/common/form_view"],function(e){var t=$("#UserPasswordForm"),n=new e({el:t});n.listenTo(n,"check:password",function(e){var t,r=[];n.passwordField.parent().find("[class*='-message']").remove(),e&&(e.match(/.{8,}/)||r.push("The password is too short, 8 characters min"),e.match(/[a-z]+/)||r.push("Using lower case letters is recommended"),e.match(/[A-Z]+/)||r.push("Using upper case letters is recommended"),e.match(/[0-9]+/)||r.push("Using numbers is recommended"),_.isEmpty(r)?(t=$("<div>",{"class":"success-message",text:"That password looks good :)"}),n.passwordField.parent().append(t)):(t=$("<div>",{"class":"error-message",text:r.join(". ")}),n.passwordField.parent().append(t)))}),n.listenTo(n,"confirm:password",function(e,t){var r;n.passwordConfirm.parent().find("[class*='-message']").remove(),e===t?(r=$("<div>",{"class":"success-message",text:"That passwords match :)"}),n.passwordConfirm.parent().append(r)):(r=$("<div>",{"class":"error-message",text:"That passwords don't match :/"}),n.passwordConfirm.parent().append(r))})})}})}),define("modules/users/users_controller",["app","modules/users/add/add_controller","modules/users/edit/edit_controller","modules/users/single/single_controller","modules/users/forhire/forhire_controller","modules/users/password/password_controller"],function(e){return e.module("UsersApp",function(e,t,n,r){e.BaseController=e.BaseController||{},e.Controller=r.Controller.extend(e.BaseController)}),e.UsersApp.Controller}),define("modules/users/users_router",["app","modules/users/users_controller"],function(e,t){return e.module("UsersApp",function(e,n,r,i){var s=new t;e.Router=i.AppRouter.extend({controller:s,appRoutes:{signup:"add",register:"add","users/add":"add","users/edit/:id":"edit","users/password/:id":"password","user/:username":"single","users/view/:id":"single","users/forhire(*params)":"forhire"}}),n.on("users:add",function(){n.navigate("/users/add"),s.add()}),n.on("users:forhire",function(){n.navigate("/users/forhire"),s.forhire()}),n.on("users:index",function(e){n.navigate("/users"+e),s.index(e)}),n.on("users:single",function(e){n.navigate("/users/view/"+e),s.single(e)}),n.on("users:edit",function(e){n.navigate("/users/edit/"+e),s.edit(e)}),n.addInitializer(function(){new e.Router})}),e.UsersApp.Router}),define("modules/common/helpers/sorting_widget",["app","backbone"],function(e,t){e.Applications.SortingWidget=t.View.extend({el:"#sorting-widget",events:{"click [class*='trigger']":"toggle"},initialize:function(){this.currentSort=this.parse_sort(window.location.pathname),this.sortingLinksList=this.$(".dropdown-list"),this.listOffset=0,this.sortingLinksList.length>0&&this.layout()},toggle:function(){var e=this.$el.css("overflow");"hidden"===e?(this.unshift(),this.$el.css({overflow:"visible"})):(this.shift(),this.$el.css({overflow:"hidden"}))},layout:function(){_.each(this.$el.find("a"),function(e){this.is_current(e)&&($(e).addClass("marker-orange"),this.listOffset=e.offsetTop,this.shift())},this)},shift:function(){this.sortingLinksList.css({top:"-"+this.listOffset+"px"})},unshift:function(){this.sortingLinksList.css({top:0})},is_current:function(e){var t=$(e).attr("href");return this.sort_matches(t)},sort_matches:function(e){var t=this.parse_sort(e);return null===this.currentSort?!1:"string"==typeof t[0]&&"string"==typeof this.currentSort[0]?t[0]===this.currentSort[0]:!1},parse_sort:function(e){var t=e.match(/sort\:[a-z0-9_\.]+/gi);return t}})}),define("bootstrap.public",[],function(){var e=function(){require(["lib/extensions","modules/layout/layout_controller","modules/likes/app","modules/follows/follows_controller","modules/news/router","modules/pages/router","modules/media/router","modules/blends/router","modules/search/router","modules/requests/router","modules/questions/router","modules/dashboard/router","modules/collections/router","modules/memberships/router","modules/conversations/router","modules/blends/blends_router","modules/reports/reports_router","modules/requests/requests_router","modules/questions/questions_router","modules/users/users_router","modules/common/helpers/sorting_widget"],function(){if(!App.SUPORTS_LOCALSTORAGE)throw confirm("Your Web browser does not support Local Storage!\nWe can't serve your browser effectively.");_.each(App.Applications,function(e){new e}),$("#blendswap-header .sub-menu").dropdownMenu(),Backbone.history.start({pushState:!0});var e=function(){if(App.isFree()&&$(window).width()>860){var t=$(".bsarocks").eq(0);if(t.length<1||t.is(":hidden")){var n="Hi! It looks like you're using an ad-blocker plugin. Would you mind turnig it off on Blend Swap? We need every cent we can get to keep the site online. Thank you so much!",r=$("<div>",{"class":"alert-message with-icon",text:n});$("#app-sidebar").append(r)}}setTimeout(e,3e3)}})};return e}),define("text!templates/common/popup.html",[],function(){return'<div class="<%- \'undefined\' === typeof pclass ? \'info-message\' : pclass %>"><div class="popup-actions"><span class="icon-close clk js-close"></span></div><span class="popup-content"><%- message %></span></div>'}),define("modules/common/views/popup",["app","backbone","text!templates/common/popup.html"],function(e,t,n){return t.View.extend({className:"popup marker-pale-gray",template:_.template(n),events:{"click .js-close":"unrender"},initialize:function(t){this.popup_data=t.data||t.popup,$("#blendswap-flash").append(this.render().el),this.listenTo(e,"app:escape",this.unrender)},render:function(){return this.$el.hide(),this.$el.html(this.template(this.popup_data)),this.queueClose(),this},unrender:function(){var e=this;this.$el.slideUp(function(){e.close()})},queueClose:function(){var e=this;this.$el.slideDown(250,function(){var t=e.popup_data.message.length*85;setTimeout(function(){e.$el.slideUp(function(){e.unrender()})},t)})}})}),define("app",["marionette","bootstrap.public","markdown"],function(e,t){var n=new e.Application({regions:{modalRegion:"#modal-region",contentRegion:"#content-region",commentsRegion:"#comments-region",nagRegion:"#nag-region"}});n.navigate=function(e,t){e=e||"",t=t||{},Backbone.history.navigate(e,t)},n.isUploading=!1,n.on("upload:start",function(){console.log("Upload start"),n.isUploading=!0}),n.on("upload:done",function(){console.log("Upload done"),n.isUploading=!1}),n.reqres.setHandler("state:uploading",function(){return n.isUploading}),n.on("scroll:top",function(){$("body").animate({scrollTop:"0px"},250)}),n.goc=function(e){for(var t in e){if(e.hasOwnProperty(t))return t;continue}return null},n.scroll_to=function(e,t){var n=$(e).eq(0);t=t||500,n.length>0&&setTimeout(function(){$("html, body").animate({scrollTop:n.offset().top-80},t)},100)},n.Applications={},$(window).on("resize",function(e){n.trigger("app:resize",e)}),$(window).on("scroll",function(){n.trigger("app:scroll")}),$(window).on("keyup",function(e){ESCAPE_KEY===e.keyCode?n.trigger("app:escape",e):LEFT_ARR===e.keyCode?n.trigger("app:left",e):RIGHT_ARR===e.keyCode&&n.trigger("app:right",e)}),n.MAX_BLENDER_VERSION=277,n.MIN_BLENDER_VERSION=249,n.supportedBlendLicenses=function(){return{"CC-Attribution":"CC-BY","CC-Attribution-ShareAlike":"CC-BY-SA","CC-Attribution-NonCommercial":"CC-BY-NC","CC-Attribution-NonCommercial-ShareAlike":"CC-BY-NC-SA","CC Public Domain":"CC-0"}},n.supportedRenderEngines=function(){return{Blender:["Internal","Cycles","Freestyle"],External:["Mitsuba","LuxRender","Yafaray"]}},n.supportedBlenderVersions=function(e,t){e=e||n.MIN_BLENDER_VERSION,t=t||n.MAX_BLENDER_VERSION;var r={},i="";do i=String((t/100).toFixed(2)),r[i]=t,t--;while(t>=e);return r};var r=$("#loading-spinner");return n.on("spinner:on",function(){r.show()}),n.on("spinner:off",function(){r.hide()}),n.on("app:popup",function(e){require(["modules/common/views/popup"],function(t){new t(e)})}),n.on("app:error",function(e){n.trigger("app:popup",{popup:{pclass:"error-message",message:e}})}),n.on("app:success",function(e){n.trigger("app:popup",{popup:{pclass:"success-message",message:e}})}),n.on("app:alert",function(e){n.trigger("app:popup",{popup:{pclass:"alert-message",message:e}})}),n.on("app:info",function(e){n.trigger("app:popup",{popup:{pclass:"info-message",message:e}})}),n.minify=function(e){return e.replace(/\n\r?(\t?\s+)?/gi,"")},n.isOwn=function(e){if(undefined===e.user_id)return!1;var t=this.CurrentUser.get("id");return parseInt(e.user_id,10)==parseInt(t,10)},n.parseVideo=function(e){var t=window.parseVideo(e);return t?$("<iframe>",{src:t,"class":"margin-bottom-16",frameborder:"0",allowfullscreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}):null},window.VENT=window.VENT||_.extend({},Backbone.Events),n.on("start",t),n.SUPORTS_LOCALSTORAGE="object"==typeof window.localStorage,window.App=n,n}),define("lib/globals",["lib/extensions"],function(){this.EMAIL_REGEXP=/[a-z0-9\.\-_]+@[a-z0-9\.\-_]+/mgi,this.HTML_REGEXP=/<\w+(\s+?.+?)?>/i,this.ENTER_KEY=13,this.ESCAPE_KEY=27,this.BACKSPACE_KEY=8,this.DELETE_KEY=46,this.LEFT_ARR=37,this.RIGHT_ARR=39,this.keyboardGo=function(e){return e.keyCode>=48||e.keyCode<=90||e.keyCode>=96||e.keyCode<=105||e.keyCode===ENTER_KEY||e.keyCode===ESCAPE_KEY||e.keyCode===BACKSPACE_KEY||e.keyCode===DELETE_KEY},this.through=function(e,t){var n=[];if(e<=t)while(e<=t)n.push(e),e++;else while(e>=t)n.push(e),e--;return n},this.gravatarImage=function(e,t){t=(t||64)+"px";var n=this.gravatarUrl(e,t),r=$("<img/>",{src:n,width:t,height:"auto","class":"align-left"});return $("<div />").append(r).html()},this.gravatarUrl=function(e,t){t=(t||64)+"px";if(!e||!e.email)e={email:"blendswap"};var n="d=%2F%2Fwww.blendswap.com%2Fimg%2Fdefaults%2Fdefault_avatar.png";return"//www.gravatar.com/avatar/"+e.email+".jpg?"+n+"&s="+t+"&r=pg"},this.fixedEncodeURIComponent=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16)})},this.convertSQLDate=function(e){if(e instanceof Date)return e;var t=e.split(/\D/gi);return t[1]--,new Date(t[0],t[1],t[2],t[3],t[4],t[5])},this.prettyDatetime=function(e){return convertSQLDate(e).toLocaleString()},this.prettyDate=function(e){return convertSQLDate(e).toLocaleDateString()},this.prettyTime=function(e){return convertSQLDate(e).toLocaleTimeString()},this.getLicenseIcon=function(e){var t="cc";return e.match(/0|zero/gi)?t+="-0":e.match(/nc/gi)?t+="-nc":e.match(/sa/gi)?t+="-sa":e.match(/by/gi)&&(t+="-by"),t},this.eventAction=function(e){var t="";switch(e){case"blend":case"blend-new":t=" shared a new blend: ";break;case"request":case"request-new":t=" opened a new request: ";break;case"weekend":case"challenge-new":t=" opened a weekend challenge: ";break;case"question":case"question-new":t=" asked ";break;case"news":case"news-new":t=" posted to the site blog: ";break;case"comment":case"comment-new":t=" commented on ";break;case"user-follow":t=" started following ";break;case"user-new":t=" joined Blend Swap ";break;case"admin":case"admin-new":case"admin-notice":case"associate":case"welcome":t=" published an admin notice: ";break;default:t=" unrecognized action "}return t},this.TimeStamp={isExpired:function(e){e="timestamp-"+e;var t=parseInt(window.localStorage.getItem(e),10);if(null===t||0===t||!t)return!0;var n=(new Date(t)).getTime();if(null===n||0===n||"undefined"===n)return!0;n=parseInt(n,10);var r=(new Date).getTime()-36e5;return n<=r},updateTimeStamp:function(e){e="timestamp-"+e;var t=(new Date).getTime();return null===window.localStorage.setItem(e,t)}},this.licenseConditions=function(e,t){var n=[];return/0|zero/ig.test(e)?n.push("<li><span class='icon-cc-0'></span>This blend is in the Public Domain.</li>"):(/by/ig.test(e)&&n.push("<li><span class='icon-cc-by'></span>You must give credit to the blend author.</li>"),/sa/ig.test(e)&&n.push("<li><span class='icon-cc-sa'></span>You must distribute your derivatives under this same license.</li>"),/nc/ig.test(e)&&n.push("<li><span class='icon-cc-nc'></span>You can't use this blend for commercial purposes.</li>")),t&&n.push("<li class=red><span class='icon-alert'></span>This blend is Marked as Fan Art.</li>"),n.join("")},this.licenseURL=function(e){return e.match(/cc-0$/i)?"http://creativecommons.org/publicdomain/zero/1.0/":(e=e.replace(/cc-/i,""),"http://creativecommons.org/licenses/"+e.toLowerCase()+"/3.0/")},this.licenseFanArt=function(e){return e?'<li class="red">This blend is marked as Fan Art, you can not use it for commercial purposes under any circumstance.</li>':""},this.parseAt=function(e){return e.replace(/@[a-z0-9\._\-]+\b/gim,function(e){return" ["+e+"](/user/"+e.slice(1)+") "})};var e={youtube:{finders:[/https?:\/\/(www\.)?youtu\.be\/([a-z0-9\-_]+)/im,/https?:\/\/(www\.)?youtube\.com\/watch.+?v=([a-z0-9\-_]+)/im],src:"https://www.youtube.com/embed/"},vimeo:{finders:[/https?:\/\/(www\.)?vimeo(\.com)\/(\d+)/im],src:"https://player.vimeo.com/video/"}};return this.parseVideo=function(t){var n;for(var r in e){var i=e[r];for(var s in i.finders){var o=i.finders[s].exec(t);if(_.isEmpty(o))continue;"youtube"===r?n=o[2]:"vimeo"===r&&(n=o[3]);if(n)return i.src+n}}return null},{}}),define("entities/current_user",["app","entities/user"],function(e){e.module("Entities",function(e,t,n){e.CurrentUser=e.UserModel.extend({initialize:function(){this.on("change",function(){window.location.reload()})},url:function(){return this.id?"/user/"+this.get("username"):"/user/whoami"},isLoggedIn:function(){return!!this.id}}),t.addInitializer(function(){var n=$("#json-current-user").text();t.CurrentUser=new e.CurrentUser(JSON.parse(n),{parse:!0}),t.isLoggedIn=function(){return t.CurrentUser.isLoggedIn()},t.isFree=function(){return t.CurrentUser.isFree()},t.isAdmin=function(){return t.CurrentUser.isAdmin()},t.isAssociate=function(){return t.CurrentUser.isAssociate()},t.isDeadline=function(){return t.CurrentUser.isDeadline()}})})}),requirejs.config({paths:{underscore:"vendor/underscore/underscore",jquery:"vendor/jquery/dist/jquery",backbone:"vendor/backbone/backbone",consolelog:"vendor/consolelog/consolelog",marionette:"vendor/marionette/lib/backbone.marionette",localstorage:"vendor/backbone.localstorage/backbone.localStorage","backbone.syphon":"vendor/backbone.syphon/lib/amd/backbone.syphon",text:"vendor/text/text",raphael:"vendor/raphael/raphael",morris:"vendor/morris.js/morris",markdown:"vendor/markdown/lib/markdown",he:"vendor/he/he","to-markdown":"vendor/to-markdown/src/to-markdown",app:"app.public"},shim:{morris:{deps:["raphael"],exports:"Morris"},raphael:{exports:"raphael"},jquery:{exports:"$"},underscore:{exports:"_",deps:["jquery"]},backbone:{deps:["jquery","underscore","markdown","to-markdown"],exports:"Backbone"},marionette:{deps:["backbone"],exports:"Marionette"},markdown:{exports:"markdown"},"backbone.syphon":{deps:["backbone"]},"to-markdown":{deps:["he"],exports:"toMarkdown"}}}),requirejs(["app","lib/globals","lib/extensions","entities/current_user"],function(e){e.start()}),define("main.public",function(){});