/*
Ractive.js v0.8.11-edge
Tue Feb 14 2017 19:01:17 GMT+0000 (UTC) - commit 4cda84369f1bad21776a0f892a1e20903881154d
http://ractivejs.org
http://twitter.com/RactiveJS
Released under the MIT License.
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
((function() { var current = global.Ractive; var next = factory(); next.noConflict = function() { global.Ractive = current; return next; }; return global.Ractive = next; })());
}(this, function () { 'use strict';
var defaults = {
// render placement:
el: void 0,
append: false,
// template:
template: null,
// parse:
delimiters: [ '{{', '}}' ],
tripleDelimiters: [ '{{{', '}}}' ],
staticDelimiters: [ '[[', ']]' ],
staticTripleDelimiters: [ '[[[', ']]]' ],
csp: true,
interpolate: false,
preserveWhitespace: false,
sanitize: false,
stripComments: true,
contextLines: 0,
// data & binding:
data: {},
computed: {},
magic: false,
modifyArrays: false,
adapt: [],
isolated: false,
twoway: true,
lazy: false,
// transitions:
noIntro: false,
transitionsEnabled: true,
complete: void 0,
// css:
css: null,
noCssTransform: false
};
// These are a subset of the easing equations found at
// https://raw.github.com/danro/easing-js - license info
// follows:
// --------------------------------------------------
// easing.js v0.5.4
// Generic set of easing functions with AMD support
// https://github.com/danro/easing-js
// This code may be freely distributed under the MIT license
// http://danro.mit-license.org/
// --------------------------------------------------
// All functions adapted from Thomas Fuchs & Jeremy Kahn
// Easing Equations (c) 2003 Robert Penner, BSD license
// https://raw.github.com/danro/easing-js/master/LICENSE
// --------------------------------------------------
// In that library, the functions named easeIn, easeOut, and
// easeInOut below are named easeInCubic, easeOutCubic, and
// (you guessed it) easeInOutCubic.
//
// You can add additional easing functions to this list, and they
// will be globally available.
var easing = {
linear: function ( pos ) { return pos; },
easeIn: function ( pos ) { return Math.pow( pos, 3 ); },
easeOut: function ( pos ) { return ( Math.pow( ( pos - 1 ), 3 ) + 1 ); },
easeInOut: function ( pos ) {
if ( ( pos /= 0.5 ) < 1 ) { return ( 0.5 * Math.pow( pos, 3 ) ); }
return ( 0.5 * ( Math.pow( ( pos - 2 ), 3 ) + 2 ) );
}
};
var legacy = null;
/*global console, navigator */
var win = typeof window !== 'undefined' ? window : null;
var doc = win ? document : null;
var isClient = !!doc;
var isJsdom = ( typeof navigator !== 'undefined' && /jsDom/.test( navigator.appName ) );
var hasConsole = ( typeof console !== 'undefined' && typeof console.warn === 'function' && typeof console.warn.apply === 'function' );
var magicSupported;
try {
Object.defineProperty({}, 'test', { value: 0 });
magicSupported = true;
} catch ( e ) {
magicSupported = false;
}
var svg = doc ?
doc.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1' ) :
false;
var vendors = [ 'o', 'ms', 'moz', 'webkit' ];
var html = 'http://www.w3.org/1999/xhtml';
var mathml = 'http://www.w3.org/1998/Math/MathML';
var svg$1 = 'http://www.w3.org/2000/svg';
var xlink = 'http://www.w3.org/1999/xlink';
var xml = 'http://www.w3.org/XML/1998/namespace';
var xmlns = 'http://www.w3.org/2000/xmlns';
var namespaces = { html: html, mathml: mathml, svg: svg$1, xlink: xlink, xml: xml, xmlns: xmlns };
var createElement;
var matches;
var div;
var methodNames;
var unprefixed;
var prefixed;
var i;
var j;
var makeFunction;
// Test for SVG support
if ( !svg ) {
createElement = function ( type, ns, extend ) {
if ( ns && ns !== html ) {
throw 'This browser does not support namespaces other than http://www.w3.org/1999/xhtml. The most likely cause of this error is that you\'re trying to render SVG in an older browser. See http://docs.ractivejs.org/latest/svg-and-older-browsers for more information';
}
return extend ?
doc.createElement( type, extend ) :
doc.createElement( type );
};
} else {
createElement = function ( type, ns, extend ) {
if ( !ns || ns === html ) {
return extend ?
doc.createElement( type, extend ) :
doc.createElement( type );
}
return extend ?
doc.createElementNS( ns, type, extend ) :
doc.createElementNS( ns, type );
};
}
function createDocumentFragment () {
return doc.createDocumentFragment();
}
function getElement ( input ) {
var output;
if ( !input || typeof input === 'boolean' ) { return; }
if ( !win || !doc || !input ) {
return null;
}
// We already have a DOM node - no work to do. (Duck typing alert!)
if ( input.nodeType ) {
return input;
}
// Get node from string
if ( typeof input === 'string' ) {
// try ID first
output = doc.getElementById( input );
// then as selector, if possible
if ( !output && doc.querySelector ) {
output = doc.querySelector( input );
}
// did it work?
if ( output && output.nodeType ) {
return output;
}
}
// If we've been given a collection (jQuery, Zepto etc), extract the first item
if ( input[0] && input[0].nodeType ) {
return input[0];
}
return null;
}
if ( !isClient ) {
matches = null;
} else {
div = createElement( 'div' );
methodNames = [ 'matches', 'matchesSelector' ];
makeFunction = function ( methodName ) {
return function ( node, selector ) {
return node[ methodName ]( selector );
};
};
i = methodNames.length;
while ( i-- && !matches ) {
unprefixed = methodNames[i];
if ( div[ unprefixed ] ) {
matches = makeFunction( unprefixed );
} else {
j = vendors.length;
while ( j-- ) {
prefixed = vendors[i] + unprefixed.substr( 0, 1 ).toUpperCase() + unprefixed.substring( 1 );
if ( div[ prefixed ] ) {
matches = makeFunction( prefixed );
break;
}
}
}
}
// IE8...
if ( !matches ) {
matches = function ( node, selector ) {
var nodes, parentNode, i;
parentNode = node.parentNode;
if ( !parentNode ) {
// empty dummy
div.innerHTML = '';
parentNode = div;
node = node.cloneNode();
div.appendChild( node );
}
nodes = parentNode.querySelectorAll( selector );
i = nodes.length;
while ( i-- ) {
if ( nodes[i] === node ) {
return true;
}
}
return false;
};
}
}
function detachNode ( node ) {
if ( node && typeof node.parentNode !== 'unknown' && node.parentNode ) {
node.parentNode.removeChild( node );
}
return node;
}
function safeToStringValue ( value ) {
return ( value == null || !value.toString ) ? '' : '' + value;
}
function safeAttributeString ( string ) {
return safeToStringValue( string )
.replace( /&/g, '&' )
.replace( /"/g, '"' )
.replace( /'/g, ''' );
}
var decamel = /[A-Z]/g;
function decamelize ( string ) {
return string.replace( decamel, function ( s ) { return ("-" + (s.toLowerCase())); } );
}
var create;
var defineProperty;
var defineProperties;
try {
Object.defineProperty({}, 'test', { get: function() {}, set: function() {} });
if ( doc ) {
Object.defineProperty( createElement( 'div' ), 'test', { value: 0 });
}
defineProperty = Object.defineProperty;
} catch ( err ) {
// Object.defineProperty doesn't exist, or we're in IE8 where you can
// only use it with DOM objects (what were you smoking, MSFT?)
defineProperty = function ( obj, prop, desc ) {
if ( desc.get ) obj[ prop ] = desc.get();
else obj[ prop ] = desc.value;
};
}
try {
try {
Object.defineProperties({}, { test: { value: 0 } });
} catch ( err ) {
// TODO how do we account for this? noMagic = true;
throw err;
}
if ( doc ) {
Object.defineProperties( createElement( 'div' ), { test: { value: 0 } });
}
defineProperties = Object.defineProperties;
} catch ( err ) {
defineProperties = function ( obj, props ) {
var prop;
for ( prop in props ) {
if ( props.hasOwnProperty( prop ) ) {
defineProperty( obj, prop, props[ prop ] );
}
}
};
}
try {
Object.create( null );
create = Object.create;
} catch ( err ) {
// sigh
create = (function () {
var F = function () {};
return function ( proto, props ) {
var obj;
if ( proto === null ) {
return {};
}
F.prototype = proto;
obj = new F();
if ( props ) {
Object.defineProperties( obj, props );
}
return obj;
};
}());
}
function extendObj ( target ) {
var sources = [], len = arguments.length - 1;
while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
var prop;
sources.forEach( function ( source ) {
for ( prop in source ) {
if ( hasOwn.call( source, prop ) ) {
target[ prop ] = source[ prop ];
}
}
});
return target;
}
function fillGaps ( target ) {
var sources = [], len = arguments.length - 1;
while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
sources.forEach( function ( s ) {
for ( var key in s ) {
if ( hasOwn.call( s, key ) && !( key in target ) ) {
target[ key ] = s[ key ];
}
}
});
return target;
}
var hasOwn = Object.prototype.hasOwnProperty;
var toString = Object.prototype.toString;
// thanks, http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
function isArray ( thing ) {
return toString.call( thing ) === '[object Array]';
}
function isEqual ( a, b ) {
if ( a === null && b === null ) {
return true;
}
if ( typeof a === 'object' || typeof b === 'object' ) {
return false;
}
return a === b;
}
// http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric
function isNumeric ( thing ) {
return !isNaN( parseFloat( thing ) ) && isFinite( thing );
}
function isObject ( thing ) {
return ( thing && toString.call( thing ) === '[object Object]' );
}
function noop () {}
var alreadyWarned = {};
var log;
var printWarning;
var welcome;
if ( hasConsole ) {
var welcomeIntro = [
("%cRactive.js %c0.8.11-edge-4cda84369f1bad21776a0f892a1e20903881154d %cin debug mode, %cmore..."),
'color: rgb(114, 157, 52); font-weight: normal;',
'color: rgb(85, 85, 85); font-weight: normal;',
'color: rgb(85, 85, 85); font-weight: normal;',
'color: rgb(82, 140, 224); font-weight: normal; text-decoration: underline;'
];
var welcomeMessage = "You're running Ractive 0.8.11-edge-4cda84369f1bad21776a0f892a1e20903881154d in debug mode - messages will be printed to the console to help you fix problems and optimise your application.\n\nTo disable debug mode, add this line at the start of your app:\n Ractive.DEBUG = false;\n\nTo disable debug mode when your app is minified, add this snippet:\n Ractive.DEBUG = /unminified/.test(function(){/*unminified*/});\n\nGet help and support:\n http://docs.ractivejs.org\n http://stackoverflow.com/questions/tagged/ractivejs\n http://groups.google.com/forum/#!forum/ractive-js\n http://twitter.com/ractivejs\n\nFound a bug? Raise an issue:\n https://github.com/ractivejs/ractive/issues\n\n";
welcome = function () {
if ( Ractive.WELCOME_MESSAGE === false ) {
welcome = noop;
return;
}
var message = 'WELCOME_MESSAGE' in Ractive ? Ractive.WELCOME_MESSAGE : welcomeMessage;
var hasGroup = !!console.groupCollapsed;
if ( hasGroup ) console.groupCollapsed.apply( console, welcomeIntro );
console.log( message );
if ( hasGroup ) {
console.groupEnd( welcomeIntro );
}
welcome = noop;
};
printWarning = function ( message, args ) {
welcome();
// extract information about the instance this message pertains to, if applicable
if ( typeof args[ args.length - 1 ] === 'object' ) {
var options = args.pop();
var ractive = options ? options.ractive : null;
if ( ractive ) {
// if this is an instance of a component that we know the name of, add
// it to the message
var name;
if ( ractive.component && ( name = ractive.component.name ) ) {
message = "<" + name + "> " + message;
}
var node;
if ( node = ( options.node || ( ractive.fragment && ractive.fragment.rendered && ractive.find( '*' ) ) ) ) {
args.push( node );
}
}
}
console.warn.apply( console, [ '%cRactive.js: %c' + message, 'color: rgb(114, 157, 52);', 'color: rgb(85, 85, 85);' ].concat( args ) );
};
log = function () {
console.log.apply( console, arguments );
};
} else {
printWarning = log = welcome = noop;
}
function format ( message, args ) {
return message.replace( /%s/g, function () { return args.shift(); } );
}
function fatal ( message ) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
message = format( message, args );
throw new Error( message );
}
function logIfDebug () {
if ( Ractive.DEBUG ) {
log.apply( null, arguments );
}
}
function warn ( message ) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
message = format( message, args );
printWarning( message, args );
}
function warnOnce ( message ) {
var args = [], len = arguments.length - 1;
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
message = format( message, args );
if ( alreadyWarned[ message ] ) {
return;
}
alreadyWarned[ message ] = true;
printWarning( message, args );
}
function warnIfDebug () {
if ( Ractive.DEBUG ) {
warn.apply( null, arguments );
}
}
function warnOnceIfDebug () {
if ( Ractive.DEBUG ) {
warnOnce.apply( null, arguments );
}
}
// Error messages that are used (or could be) in multiple places
var badArguments = 'Bad arguments';
var noRegistryFunctionReturn = 'A function was specified for "%s" %s, but no %s was returned';
var missingPlugin = function ( name, type ) { return ("Missing \"" + name + "\" " + type + " plugin. You may need to download a plugin via http://docs.ractivejs.org/latest/plugins#" + type + "s"); };
function findInViewHierarchy ( registryName, ractive, name ) {
var instance = findInstance( registryName, ractive, name );
return instance ? instance[ registryName ][ name ] : null;
}
function findInstance ( registryName, ractive, name ) {
while ( ractive ) {
if ( name in ractive[ registryName ] ) {
return ractive;
}
if ( ractive.isolated ) {
return null;
}
ractive = ractive.parent;
}
}
function interpolate ( from, to, ractive, type ) {
if ( from === to ) return null;
if ( type ) {
var interpol = findInViewHierarchy( 'interpolators', ractive, type );
if ( interpol ) return interpol( from, to ) || null;
fatal( missingPlugin( type, 'interpolator' ) );
}
return interpolators.number( from, to ) ||
interpolators.array( from, to ) ||
interpolators.object( from, to ) ||
null;
}
function snap ( to ) {
return function () { return to; };
}
var interpolators = {
number: function ( from, to ) {
var delta;
if ( !isNumeric( from ) || !isNumeric( to ) ) {
return null;
}
from = +from;
to = +to;
delta = to - from;
if ( !delta ) {
return function () { return from; };
}
return function ( t ) {
return from + ( t * delta );
};
},
array: function ( from, to ) {
var intermediate, interpolators, len, i;
if ( !isArray( from ) || !isArray( to ) ) {
return null;
}
intermediate = [];
interpolators = [];
i = len = Math.min( from.length, to.length );
while ( i-- ) {
interpolators[i] = interpolate( from[i], to[i] );
}
// surplus values - don't interpolate, but don't exclude them either
for ( i=len; i elements caused the binding on the