{"version":3,"file":"ractive.mjs","sources":["../../../src/Ractive/config/defaults.js","../../../src/Ractive/static/easing.js","../../../src/utils/is.js","../../../src/config/environment.js","../../../src/utils/noop.js","../../../src/utils/log.js","../../../src/config/errors.js","../../../src/shared/registry.js","../../../src/shared/interpolate.js","../../../src/Ractive/static/interpolators.js","../../../src/utils/array.js","../../../src/global/TransitionManager.js","../../../src/global/runloop.js","../../../src/shared/keypaths.js","../../../src/global/capture.js","../../../src/model/specials/KeyModel.js","../../../src/shared/methodCallers.js","../../../src/model/specials/KeypathModel.js","../../../src/utils/bind.js","../../../src/model/ModelBase.js","../../../src/shared/rebind.js","../../../src/model/LinkModel.js","../../../src/shared/Ticker.js","../../../src/model/helpers/getPrefixer.js","../../../src/model/Model.js","../../../src/model/specials/SharedModel.js","../../../src/view/resolvers/resolveReference.js","../../../src/shared/getRactiveContext.js","../../../src/shared/set.js","../../../src/Ractive/prototype/shared/add.js","../../../src/Ractive/prototype/add.js","../../../src/Ractive/prototype/animate.js","../../../src/events/eventStack.js","../../../src/events/fireEvent.js","../../../src/events/Hook.js","../../../src/shared/anchors.js","../../../src/Ractive/prototype/attachChild.js","../../../src/Ractive/prototype/detach.js","../../../src/Ractive/prototype/detachChild.js","../../../src/Ractive/prototype/find.js","../../../src/Ractive/prototype/findAll.js","../../../src/Ractive/prototype/findAllComponents.js","../../../src/Ractive/prototype/findComponent.js","../../../src/Ractive/prototype/findContainer.js","../../../src/Ractive/prototype/findParent.js","../../../src/shared/getNewIndices.js","../../../src/Ractive/prototype/shared/makeArrayMethod.js","../../../src/Ractive/prototype/update.js","../../../src/config/types.js","../../../src/view/items/shared/findElement.js","../../../src/shared/Context.js","../../../src/Ractive/prototype/fire.js","../../../src/Ractive/prototype/get.js","../../../src/Ractive/static/getContext.js","../../../src/Ractive/prototype/getContext.js","../../../src/config/namespaces.js","../../../src/utils/dom.js","../../../src/Ractive/prototype/insert.js","../../../src/Ractive/prototype/link.js","../../../src/Ractive/prototype/observe/Observer.js","../../../src/Ractive/prototype/observe/Pattern.js","../../../src/Ractive/prototype/observe/Array.js","../../../src/Ractive/prototype/observe.js","../../../src/Ractive/prototype/observeOnce.js","../../../src/Ractive/prototype/shared/trim.js","../../../src/Ractive/prototype/shared/notEmptyString.js","../../../src/Ractive/prototype/off.js","../../../src/Ractive/prototype/on.js","../../../src/Ractive/prototype/once.js","../../../src/Ractive/prototype/pop.js","../../../src/Ractive/prototype/push.js","../../../src/Ractive/prototype/readLink.js","../../../src/global/css.js","../../../src/utils/object.js","../../../src/Ractive/config/custom/adapt.js","../../../src/utils/cleanCss.js","../../../src/Ractive/config/custom/css/transform.js","../../../src/utils/id.js","../../../src/Ractive/config/custom/css/css.js","../../../src/Ractive/config/custom/data.js","../../../src/config/template.js","../../../src/parse/utils/createFunction.js","../../../src/shared/getFunction.js","../../../src/parse/Parser.js","../../../src/parse/converters/mustache/readDelimiterChange.js","../../../src/parse/converters/expressions/primary/literal/readRegexpLiteral.js","../../../src/utils/escapeRegExp.js","../../../src/parse/converters/utils/getLowestIndex.js","../../../src/utils/html.js","../../../src/parse/converters/expressions/shared/errors.js","../../../src/parse/converters/expressions/primary/literal/readNumberLiteral.js","../../../src/parse/converters/expressions/primary/literal/readBooleanLiteral.js","../../../src/parse/converters/expressions/primary/literal/stringLiteral/makeQuotedStringMatcher.js","../../../src/parse/converters/expressions/primary/literal/readStringLiteral.js","../../../src/parse/converters/expressions/primary/literal/readTemplateStringLiteral.js","../../../src/parse/converters/expressions/shared/patterns.js","../../../src/parse/converters/expressions/shared/readKey.js","../../../src/parse/converters/expressions/primary/literal/objectLiteral/keyValuePair.js","../../../src/parse/converters/expressions/primary/literal/objectLiteral/keyValuePairs.js","../../../src/parse/converters/expressions/primary/literal/readObjectLiteral.js","../../../src/parse/converters/expressions/primary/literal/readArrayLiteral.js","../../../src/parse/converters/expressions/primary/readLiteral.js","../../../src/parse/converters/expressions/primary/readReference.js","../../../src/parse/converters/expressions/primary/readBracketedExpression.js","../../../src/parse/converters/expressions/readPrimary.js","../../../src/parse/converters/expressions/shared/readRefinement.js","../../../src/parse/converters/expressions/readMemberOrInvocation.js","../../../src/parse/converters/expressions/readTypeof.js","../../../src/parse/converters/expressions/readLogicalOr.js","../../../src/parse/converters/expressions/readConditional.js","../../../src/parse/converters/readExpression.js","../../../src/parse/converters/expressions/shared/readExpressionList.js","../../../src/parse/converters/readExpressionOrReference.js","../../../src/parse/utils/flattenExpression.js","../../../src/parse/utils/refineExpression.js","../../../src/parse/converters/element/readAttribute.js","../../../src/parse/converters/readMustache.js","../../../src/parse/converters/mustache/readTriple.js","../../../src/parse/converters/mustache/readUnescaped.js","../../../src/parse/converters/mustache/readAliases.js","../../../src/parse/converters/mustache/readPartial.js","../../../src/parse/converters/mustache/readMustacheComment.js","../../../src/parse/converters/mustache/readInterpolator.js","../../../src/parse/converters/mustache/section/readClosing.js","../../../src/parse/converters/mustache/section/readElse.js","../../../src/parse/converters/mustache/section/readElseIf.js","../../../src/parse/converters/mustache/handlebarsBlockCodes.js","../../../src/parse/converters/mustache/readSection.js","../../../src/parse/converters/readHtmlComment.js","../../../src/parse/utils/stripStandalones.js","../../../src/parse/utils/trimWhitespace.js","../../../src/parse/utils/cleanup.js","../../../src/parse/converters/element/readClosingTag.js","../../../src/parse/converters/readElement.js","../../../src/parse/converters/readText.js","../../../src/parse/converters/readPartialDefinitionSection.js","../../../src/parse/converters/readTemplate.js","../../../src/parse/utils/insertExpressions.js","../../../src/Ractive/shared.js","../../../src/parse/_parse.js","../../../src/Ractive/config/runtime-parser.js","../../../src/Ractive/config/custom/template.js","../../../src/Ractive/config/registries.js","../../../src/Ractive/config/wrapPrototypeMethod.js","../../../src/Ractive/config/deprecate.js","../../../src/Ractive/config/config.js","../../../src/view/items/shared/Item.js","../../../src/model/ComputationChild.js","../../../src/model/Computation.js","../../../src/view/resolvers/ExpressionProxy.js","../../../src/view/resolvers/ReferenceExpressionProxy.js","../../../src/view/resolvers/resolve.js","../../../src/view/items/Alias.js","../../../src/view/helpers/specialAttrs.js","../../../src/utils/hyphenateCamel.js","../../../src/view/items/element/attribute/getUpdateDelegate.js","../../../src/view/items/element/attribute/propertyNames.js","../../../src/view/items/element/ConditionalAttribute.js","../../../src/view/items/element/Attribute.js","../../../src/view/items/element/BindingFlag.js","../../../src/model/specials/RactiveModel.js","../../../src/model/RootModel.js","../../../src/Ractive/helpers/getComputationSignature.js","../../../src/Ractive/construct.js","../../../src/Ractive/prototype/teardown.js","../../../src/view/items/Component.js","../../../src/view/items/shared/directiveArgs.js","../../../src/view/items/element/Decorator.js","../../../src/view/items/Doctype.js","../../../src/view/items/element/binding/Binding.js","../../../src/view/items/element/binding/handleDomEvent.js","../../../src/view/items/element/binding/CheckboxBinding.js","../../../src/view/items/element/binding/getBindingGroup.js","../../../src/view/items/element/binding/CheckboxNameBinding.js","../../../src/view/items/element/binding/ContentEditableBinding.js","../../../src/view/items/element/binding/GenericBinding.js","../../../src/view/items/element/binding/FileBinding.js","../../../src/utils/getSelectedOptions.js","../../../src/view/items/element/binding/MultipleSelectBinding.js","../../../src/view/items/element/binding/NumericBinding.js","../../../src/view/items/element/binding/RadioBinding.js","../../../src/view/items/element/binding/RadioNameBinding.js","../../../src/view/items/element/binding/SingleSelectBinding.js","../../../src/view/items/element/binding/selectBinding.js","../../../src/view/items/Element.js","../../../src/view/items/element/specials/Form.js","../../../src/view/items/element/ElementEvents.js","../../../src/view/items/component/RactiveEvent.js","../../../src/view/items/shared/EventDirective.js","../../../src/view/items/shared/progressiveText.js","../../../src/view/items/shared/Mustache.js","../../../src/view/items/Interpolator.js","../../../src/view/items/element/specials/Input.js","../../../src/utils/parseJSON.js","../../../src/view/items/component/Mapping.js","../../../src/view/items/element/specials/Option.js","../../../src/view/items/partial/getPartialTemplate.js","../../../src/view/items/Partial.js","../../../src/view/RepeatedFragment.js","../../../src/view/items/Section.js","../../../src/view/items/element/specials/Select.js","../../../src/view/items/element/specials/Textarea.js","../../../src/view/items/Text.js","../../../src/view/items/element/transitions/prefix.js","../../../src/config/visibility.js","../../../src/view/items/element/transitions/hyphenate.js","../../../src/view/items/element/transitions/createTransitions.js","../../../src/view/items/element/Transition.js","../../../src/view/items/triple/insertHtml.js","../../../src/view/items/Triple.js","../../../src/view/items/component/getComponentConstructor.js","../../../src/view/items/createItem.js","../../../src/view/helpers/processItems.js","../../../src/view/Fragment.js","../../../src/events/HookQueue.js","../../../src/Ractive/initialise.js","../../../src/Ractive/render.js","../../../src/Ractive/prototype/render.js","../../../src/Ractive/prototype/reset.js","../../../src/Ractive/prototype/resetPartial.js","../../../src/Ractive/prototype/resetTemplate.js","../../../src/Ractive/prototype/reverse.js","../../../src/Ractive/prototype/set.js","../../../src/Ractive/prototype/shift.js","../../../src/Ractive/prototype/sort.js","../../../src/Ractive/prototype/splice.js","../../../src/Ractive/prototype/subtract.js","../../../src/Ractive/prototype/toggle.js","../../../src/Ractive/prototype/toCSS.js","../../../src/Ractive/prototype/toHTML.js","../../../src/Ractive/prototype/toText.js","../../../src/Ractive/prototype/transition.js","../../../src/Ractive/prototype/unlink.js","../../../src/Ractive/prototype/unrender.js","../../../src/Ractive/prototype/unshift.js","../../../src/Ractive/prototype/updateModel.js","../../../src/Ractive/prototype.js","../../../src/Ractive/static/isInstance.js","../../../src/extend/_extend.js","../../../src/Ractive/static/keypaths.js","../../../src/Ractive/static/findPlugin.js","../../../src/Ractive.js"],"sourcesContent":["export default {\n\t// render placement:\n\tel: void 0,\n\tappend: false,\n\tdelegate: true,\n\n\t// template:\n\ttemplate: null,\n\n\t// parse:\n\tdelimiters: [ '{{', '}}' ],\n\ttripleDelimiters: [ '{{{', '}}}' ],\n\tstaticDelimiters: [ '[[', ']]' ],\n\tstaticTripleDelimiters: [ '[[[', ']]]' ],\n\tcsp: true,\n\tinterpolate: false,\n\tpreserveWhitespace: false,\n\tsanitize: false,\n\tstripComments: true,\n\tcontextLines: 0,\n\tparserTransforms: [],\n\n\t// data & binding:\n\tdata: {},\n\tcomputed: {},\n\tsyncComputedChildren: false,\n\tresolveInstanceMembers: true,\n\twarnAboutAmbiguity: false,\n\tadapt: [],\n\tisolated: true,\n\ttwoway: true,\n\tlazy: false,\n\n\t// transitions:\n\tnoIntro: false,\n\tnoOutro: false,\n\ttransitionsEnabled: true,\n\tcomplete: void 0,\n\tnestedTransitions: true,\n\n\t// css:\n\tcss: null,\n\tnoCssTransform: false\n};\n","// These are a subset of the easing equations found at\n// https://raw.github.com/danro/easing-js - license info\n// follows:\n\n// --------------------------------------------------\n// easing.js v0.5.4\n// Generic set of easing functions with AMD support\n// https://github.com/danro/easing-js\n// This code may be freely distributed under the MIT license\n// http://danro.mit-license.org/\n// --------------------------------------------------\n// All functions adapted from Thomas Fuchs & Jeremy Kahn\n// Easing Equations (c) 2003 Robert Penner, BSD license\n// https://raw.github.com/danro/easing-js/master/LICENSE\n// --------------------------------------------------\n\n// In that library, the functions named easeIn, easeOut, and\n// easeInOut below are named easeInCubic, easeOutCubic, and\n// (you guessed it) easeInOutCubic.\n//\n// You can add additional easing functions to this list, and they\n// will be globally available.\n\n\nexport default {\n\tlinear ( pos ) { return pos; },\n\teaseIn ( pos ) {\n\t\t/* istanbul ignore next */\n\t\treturn Math.pow( pos, 3 );\n\t},\n\teaseOut ( pos ) { return ( Math.pow( ( pos - 1 ), 3 ) + 1 ); },\n\teaseInOut ( pos ) {\n\t\t/* istanbul ignore next */\n\t\tif ( ( pos /= 0.5 ) < 1 ) { return ( 0.5 * Math.pow( pos, 3 ) ); }\n\t\t/* istanbul ignore next */\n\t\treturn ( 0.5 * ( Math.pow( ( pos - 2 ), 3 ) + 2 ) );\n\t}\n};\n","const toString = Object.prototype.toString;\nconst arrayLikePattern = /^\\[object (?:Array|FileList)\\]$/;\n\nexport function isArrayLike ( obj ) {\n\treturn arrayLikePattern.test( toString.call( obj ) );\n}\n\nexport function isEqual ( a, b ) {\n\tif ( a === null && b === null ) {\n\t\treturn true;\n\t}\n\n\tif ( typeof a === 'object' || typeof b === 'object' ) {\n\t\treturn false;\n\t}\n\n\treturn a === b;\n}\n\n// http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric\nexport function isNumeric ( thing ) {\n\treturn !isNaN( parseFloat( thing ) ) && isFinite( thing );\n}\n\nexport function isObject ( thing ) {\n\treturn ( thing && toString.call( thing ) === '[object Object]' );\n}\n\nexport function isObjectLike ( thing ) {\n\tif ( !thing ) return false;\n\tconst type = typeof thing;\n\tif ( type === 'object' || type === 'function' ) return true;\n}\n","/* eslint no-console:\"off\" */\nconst win = typeof window !== 'undefined' ? window : null;\nconst doc = win ? document : null;\nconst isClient = !!doc;\nconst hasConsole = ( typeof console !== 'undefined' && typeof console.warn === 'function' && typeof console.warn.apply === 'function' );\n\nconst svg = doc ?\n\tdoc.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1' ) :\n\tfalse;\n\nconst vendors = [ 'o', 'ms', 'moz', 'webkit' ];\n\nexport { win, doc, isClient, hasConsole, svg, vendors };\n","export default function () {}\n","/* global console */\n/* eslint no-console:\"off\" */\n\nimport { hasConsole } from '../config/environment';\nimport Ractive from '../Ractive';\nimport noop from './noop';\n\nconst alreadyWarned = {};\nlet log, printWarning, welcome;\n\nif ( hasConsole ) {\n\tconst welcomeIntro = [\n\t\t`%cRactive.js %c1.0.0-edge %cin debug mode, %cmore...`,\n\t\t'color: rgb(114, 157, 52); font-weight: normal;',\n\t\t'color: rgb(85, 85, 85); font-weight: normal;',\n\t\t'color: rgb(85, 85, 85); font-weight: normal;',\n\t\t'color: rgb(82, 140, 224); font-weight: normal; text-decoration: underline;'\n\t];\n\tconst welcomeMessage = `You're running Ractive 1.0.0-edge 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`;\n\n\twelcome = () => {\n\t\tif ( Ractive.WELCOME_MESSAGE === false ) {\n\t\t\twelcome = noop;\n\t\t\treturn;\n\t\t}\n\t\tconst message = 'WELCOME_MESSAGE' in Ractive ? Ractive.WELCOME_MESSAGE : welcomeMessage;\n\t\tconst hasGroup = !!console.groupCollapsed;\n\t\tif ( hasGroup ) console.groupCollapsed.apply( console, welcomeIntro );\n\t\tconsole.log( message );\n\t\tif ( hasGroup ) {\n\t\t\tconsole.groupEnd( welcomeIntro );\n\t\t}\n\n\t\twelcome = noop;\n\t};\n\n\tprintWarning = ( message, args ) => {\n\t\twelcome();\n\n\t\t// extract information about the instance this message pertains to, if applicable\n\t\tif ( typeof args[ args.length - 1 ] === 'object' ) {\n\t\t\tconst options = args.pop();\n\t\t\tconst ractive = options ? options.ractive : null;\n\n\t\t\tif ( ractive ) {\n\t\t\t\t// if this is an instance of a component that we know the name of, add\n\t\t\t\t// it to the message\n\t\t\t\tlet name;\n\t\t\t\tif ( ractive.component && ( name = ractive.component.name ) ) {\n\t\t\t\t\tmessage = `<${name}> ${message}`;\n\t\t\t\t}\n\n\t\t\t\tlet node;\n\t\t\t\tif ( node = ( options.node || ( ractive.fragment && ractive.fragment.rendered && ractive.find( '*' ) ) ) ) {\n\t\t\t\t\targs.push( node );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconsole.warn.apply( console, [ '%cRactive.js: %c' + message, 'color: rgb(114, 157, 52);', 'color: rgb(85, 85, 85);' ].concat( args ) );\n\t};\n\n\tlog = function () {\n\t\tconsole.log.apply( console, arguments );\n\t};\n} else {\n\tprintWarning = log = welcome = noop;\n}\n\nfunction format ( message, args ) {\n\treturn message.replace( /%s/g, () => args.shift() );\n}\n\nfunction fatal ( message, ...args ) {\n\tmessage = format( message, args );\n\tthrow new Error( message );\n}\n\nfunction logIfDebug () {\n\tif ( Ractive.DEBUG ) {\n\t\tlog.apply( null, arguments );\n\t}\n}\n\nfunction warn ( message, ...args ) {\n\tmessage = format( message, args );\n\tprintWarning( message, args );\n}\n\nfunction warnOnce ( message, ...args ) {\n\tmessage = format( message, args );\n\n\tif ( alreadyWarned[ message ] ) {\n\t\treturn;\n\t}\n\n\talreadyWarned[ message ] = true;\n\tprintWarning( message, args );\n}\n\nfunction warnIfDebug () {\n\tif ( Ractive.DEBUG ) {\n\t\twarn.apply( null, arguments );\n\t}\n}\n\nfunction warnOnceIfDebug () {\n\tif ( Ractive.DEBUG ) {\n\t\twarnOnce.apply( null, arguments );\n\t}\n}\n\nexport { fatal, log, logIfDebug, warn, warnOnce, warnIfDebug, warnOnceIfDebug, welcome };\n","// Error messages that are used (or could be) in multiple places\nexport const badArguments = 'Bad arguments';\nexport const noRegistryFunctionReturn = 'A function was specified for \"%s\" %s, but no %s was returned';\nexport const missingPlugin = ( name, type ) => `Missing \"${name}\" ${type} plugin. You may need to download a plugin via http://docs.ractivejs.org/latest/plugins#${type}s`;\n","export function findInViewHierarchy ( registryName, ractive, name ) {\n\tconst instance = findInstance( registryName, ractive, name );\n\treturn instance ? instance[ registryName ][ name ] : null;\n}\n\nexport function findInstance ( registryName, ractive, name ) {\n\twhile ( ractive ) {\n\t\tif ( name in ractive[ registryName ] ) {\n\t\t\treturn ractive;\n\t\t}\n\n\t\tif ( ractive.isolated ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tractive = ractive.parent;\n\t}\n}","import { fatal } from '../utils/log';\nimport { missingPlugin } from '../config/errors';\nimport interpolators from '../Ractive/static/interpolators';\nimport { findInViewHierarchy } from './registry';\n\nexport default function interpolate ( from, to, ractive, type ) {\n\tif ( from === to ) return null;\n\n\tif ( type ) {\n\t\tconst interpol = findInViewHierarchy( 'interpolators', ractive, type );\n\t\tif ( interpol ) return interpol( from, to ) || null;\n\n\t\tfatal( missingPlugin( type, 'interpolator' ) );\n\t}\n\n\treturn interpolators.number( from, to ) ||\n\t interpolators.array( from, to ) ||\n\t interpolators.object( from, to ) ||\n\t null;\n}\n","import { isObject, isNumeric } from '../../utils/is';\nimport interpolate from '../../shared/interpolate';\n\nconst interpolators = {\n\tnumber ( from, to ) {\n\t\tif ( !isNumeric( from ) || !isNumeric( to ) ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tfrom = +from;\n\t\tto = +to;\n\n\t\tconst delta = to - from;\n\n\t\tif ( !delta ) {\n\t\t\treturn function () { return from; };\n\t\t}\n\n\t\treturn function ( t ) {\n\t\t\treturn from + ( t * delta );\n\t\t};\n\t},\n\n\tarray ( from, to ) {\n\t\tlet len, i;\n\n\t\tif ( !Array.isArray( from ) || !Array.isArray( to ) ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst intermediate = [];\n\t\tconst interpolators = [];\n\n\t\ti = len = Math.min( from.length, to.length );\n\t\twhile ( i-- ) {\n\t\t\tinterpolators[i] = interpolate( from[i], to[i] );\n\t\t}\n\n\t\t// surplus values - don't interpolate, but don't exclude them either\n\t\tfor ( i=len; i to[ prop ] );\n\t\t\t\t}\n\n\t\t\t\telse {\n\t\t\t\t\tintermediate[ prop ] = from[ prop ];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor ( const prop in to ) {\n\t\t\tif ( to.hasOwnProperty( prop ) && !from.hasOwnProperty( prop ) ) {\n\t\t\t\tintermediate[ prop ] = to[ prop ];\n\t\t\t}\n\t\t}\n\n\t\tconst len = properties.length;\n\n\t\treturn function ( t ) {\n\t\t\tlet i = len;\n\n\t\t\twhile ( i-- ) {\n\t\t\t\tconst prop = properties[i];\n\n\t\t\t\tintermediate[ prop ] = interpolators[ prop ]( t );\n\t\t\t}\n\n\t\t\treturn intermediate;\n\t\t};\n\t}\n};\n\nexport default interpolators;\n","export function addToArray ( array, value ) {\n\tconst index = array.indexOf( value );\n\n\tif ( index === -1 ) {\n\t\tarray.push( value );\n\t}\n}\n\nexport function arrayContains ( array, value ) {\n\tfor ( let i = 0, c = array.length; i < c; i++ ) {\n\t\tif ( array[i] == value ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n\nexport function arrayContentsMatch ( a, b ) {\n\tlet i;\n\n\tif ( !Array.isArray( a ) || !Array.isArray( b ) ) {\n\t\treturn false;\n\t}\n\n\tif ( a.length !== b.length ) {\n\t\treturn false;\n\t}\n\n\ti = a.length;\n\twhile ( i-- ) {\n\t\tif ( a[i] !== b[i] ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\nexport function ensureArray ( x ) {\n\tif ( typeof x === 'string' ) {\n\t\treturn [ x ];\n\t}\n\n\tif ( x === undefined ) {\n\t\treturn [];\n\t}\n\n\treturn x;\n}\n\nexport function lastItem ( array ) {\n\treturn array[ array.length - 1 ];\n}\n\nexport function removeFromArray ( array, member ) {\n\tif ( !array ) {\n\t\treturn;\n\t}\n\n\tconst index = array.indexOf( member );\n\n\tif ( index !== -1 ) {\n\t\tarray.splice( index, 1 );\n\t}\n}\n\nexport function combine ( ...arrays ) {\n\tconst res = arrays.concat.apply( [], arrays );\n\tlet i = res.length;\n\twhile ( i-- ) {\n\t\tconst idx = res.indexOf( res[i] );\n\t\tif ( ~idx && idx < i ) res.splice( i, 1 );\n\t}\n\n\treturn res;\n}\n\nexport function toArray ( arrayLike ) {\n\tconst array = [];\n\tlet i = arrayLike.length;\n\twhile ( i-- ) {\n\t\tarray[i] = arrayLike[i];\n\t}\n\n\treturn array;\n}\n\nexport function findMap ( array, fn ) {\n\tconst len = array.length;\n\tfor ( let i = 0; i < len; i++ ) {\n\t\tconst result = fn( array[i] );\n\t\tif ( result ) return result;\n\t}\n}\n","import { removeFromArray } from '../utils/array';\n\nexport default class TransitionManager {\n\tconstructor ( callback, parent ) {\n\t\tthis.callback = callback;\n\t\tthis.parent = parent;\n\n\t\tthis.intros = [];\n\t\tthis.outros = [];\n\n\t\tthis.children = [];\n\t\tthis.totalChildren = this.outroChildren = 0;\n\n\t\tthis.detachQueue = [];\n\t\tthis.outrosComplete = false;\n\n\t\tif ( parent ) {\n\t\t\tparent.addChild( this );\n\t\t}\n\t}\n\n\tadd ( transition ) {\n\t\tconst list = transition.isIntro ? this.intros : this.outros;\n\t\ttransition.starting = true;\n\t\tlist.push( transition );\n\t}\n\n\taddChild ( child ) {\n\t\tthis.children.push( child );\n\n\t\tthis.totalChildren += 1;\n\t\tthis.outroChildren += 1;\n\t}\n\n\tdecrementOutros () {\n\t\tthis.outroChildren -= 1;\n\t\tcheck( this );\n\t}\n\n\tdecrementTotal () {\n\t\tthis.totalChildren -= 1;\n\t\tcheck( this );\n\t}\n\n\tdetachNodes () {\n\t\tthis.detachQueue.forEach( detach );\n\t\tthis.children.forEach( _detachNodes );\n\t\tthis.detachQueue = [];\n\t}\n\n\tready () {\n\t\tif ( this.detachQueue.length ) detachImmediate( this );\n\t}\n\n\tremove ( transition ) {\n\t\tconst list = transition.isIntro ? this.intros : this.outros;\n\t\tremoveFromArray( list, transition );\n\t\tcheck( this );\n\t}\n\n\tstart () {\n\t\tthis.children.forEach( c => c.start() );\n\t\tthis.intros.concat( this.outros ).forEach( t => t.start() );\n\t\tthis.ready = true;\n\t\tcheck( this );\n\t}\n}\n\nfunction detach ( element ) {\n\telement.detach();\n}\n\nfunction _detachNodes ( tm ) { // _ to avoid transpiler quirk\n\ttm.detachNodes();\n}\n\nfunction check ( tm ) {\n\tif ( !tm.ready || tm.outros.length || tm.outroChildren ) return;\n\n\t// If all outros are complete, and we haven't already done this,\n\t// we notify the parent if there is one, otherwise\n\t// start detaching nodes\n\tif ( !tm.outrosComplete ) {\n\t\ttm.outrosComplete = true;\n\n\t\tif ( tm.parent && !tm.parent.outrosComplete ) {\n\t\t\ttm.parent.decrementOutros( tm );\n\t\t} else {\n\t\t\ttm.detachNodes();\n\t\t}\n\t}\n\n\t// Once everything is done, we can notify parent transition\n\t// manager and call the callback\n\tif ( !tm.intros.length && !tm.totalChildren ) {\n\t\tif ( typeof tm.callback === 'function' ) {\n\t\t\ttm.callback();\n\t\t}\n\n\t\tif ( tm.parent && !tm.notifiedTotal ) {\n\t\t\ttm.notifiedTotal = true;\n\t\t\ttm.parent.decrementTotal();\n\t\t}\n\t}\n}\n\n// check through the detach queue to see if a node is up or downstream from a\n// transition and if not, go ahead and detach it\nfunction detachImmediate ( manager ) {\n\tconst queue = manager.detachQueue;\n\tconst outros = collectAllOutros( manager );\n\n\tlet i = queue.length;\n\tlet j = 0;\n\tlet node, trans;\n\tstart: while ( i-- ) {\n\t\tnode = queue[i].node;\n\t\tj = outros.length;\n\t\twhile ( j-- ) {\n\t\t\ttrans = outros[j].element.node;\n\t\t\t// check to see if the node is, contains, or is contained by the transitioning node\n\t\t\tif ( trans === node || trans.contains( node ) || node.contains( trans ) ) continue start;\n\t\t}\n\n\t\t// no match, we can drop it\n\t\tqueue[i].detach();\n\t\tqueue.splice( i, 1 );\n\t}\n}\n\nfunction collectAllOutros ( manager, _list ) {\n\tlet list = _list;\n\n\t// if there's no list, we're starting at the root to build one\n\tif ( !list ) {\n\t\tlist = [];\n\t\tlet parent = manager;\n\t\twhile ( parent.parent ) parent = parent.parent;\n\t\treturn collectAllOutros( parent, list );\n\t} else {\n\t\t// grab all outros from child managers\n\t\tlet i = manager.children.length;\n\t\twhile ( i-- ) {\n\t\t\tlist = collectAllOutros( manager.children[i], list );\n\t\t}\n\n\t\t// grab any from this manager if there are any\n\t\tif ( manager.outros.length ) list = list.concat( manager.outros );\n\n\t\treturn list;\n\t}\n}\n","import { addToArray } from '../utils/array';\nimport TransitionManager from './TransitionManager';\n\nlet batch;\n\nconst runloop = {\n\tstart ( instance ) {\n\t\tlet fulfilPromise;\n\t\tconst promise = new Promise( f => ( fulfilPromise = f ) );\n\n\t\tbatch = {\n\t\t\tpreviousBatch: batch,\n\t\t\ttransitionManager: new TransitionManager( fulfilPromise, batch && batch.transitionManager ),\n\t\t\tfragments: [],\n\t\t\ttasks: [],\n\t\t\timmediateObservers: [],\n\t\t\tdeferredObservers: [],\n\t\t\tinstance,\n\t\t\tpromise\n\t\t};\n\n\t\treturn promise;\n\t},\n\n\tend () {\n\t\tflushChanges();\n\n\t\tif ( !batch.previousBatch ) batch.transitionManager.start();\n\n\t\tbatch = batch.previousBatch;\n\t},\n\n\taddFragment ( fragment ) {\n\t\taddToArray( batch.fragments, fragment );\n\t},\n\n\t// TODO: come up with a better way to handle fragments that trigger their own update\n\taddFragmentToRoot ( fragment ) {\n\t\tif ( !batch ) return;\n\n\t\tlet b = batch;\n\t\twhile ( b.previousBatch ) {\n\t\t\tb = b.previousBatch;\n\t\t}\n\n\t\taddToArray( b.fragments, fragment );\n\t},\n\n\taddObserver ( observer, defer ) {\n\t\tif ( !batch ) {\n\t\t\tobserver.dispatch();\n\t\t} else {\n\t\t\taddToArray( defer ? batch.deferredObservers : batch.immediateObservers, observer );\n\t\t}\n\t},\n\n\tregisterTransition ( transition ) {\n\t\ttransition._manager = batch.transitionManager;\n\t\tbatch.transitionManager.add( transition );\n\t},\n\n\t// synchronise node detachments with transition ends\n\tdetachWhenReady ( thing ) {\n\t\tbatch.transitionManager.detachQueue.push( thing );\n\t},\n\n\tscheduleTask ( task, postRender ) {\n\t\tlet _batch;\n\n\t\tif ( !batch ) {\n\t\t\ttask();\n\t\t} else {\n\t\t\t_batch = batch;\n\t\t\twhile ( postRender && _batch.previousBatch ) {\n\t\t\t\t// this can't happen until the DOM has been fully updated\n\t\t\t\t// otherwise in some situations (with components inside elements)\n\t\t\t\t// transitions and decorators will initialise prematurely\n\t\t\t\t_batch = _batch.previousBatch;\n\t\t\t}\n\n\t\t\t_batch.tasks.push( task );\n\t\t}\n\t},\n\n\tpromise () {\n\t\tif ( !batch ) return Promise.resolve();\n\n\t\tlet target = batch;\n\t\twhile ( target.previousBatch ) {\n\t\t\ttarget = target.previousBatch;\n\t\t}\n\n\t\treturn target.promise || Promise.resolve();\n\t}\n};\n\nexport default runloop;\n\nfunction dispatch ( observer ) {\n\tobserver.dispatch();\n}\n\nfunction flushChanges () {\n\tlet which = batch.immediateObservers;\n\tbatch.immediateObservers = [];\n\twhich.forEach( dispatch );\n\n\t// Now that changes have been fully propagated, we can update the DOM\n\t// and complete other tasks\n\tlet i = batch.fragments.length;\n\tlet fragment;\n\n\twhich = batch.fragments;\n\tbatch.fragments = [];\n\n\twhile ( i-- ) {\n\t\tfragment = which[i];\n\t\tfragment.update();\n\t}\n\n\tbatch.transitionManager.ready();\n\n\twhich = batch.deferredObservers;\n\tbatch.deferredObservers = [];\n\twhich.forEach( dispatch );\n\n\tconst tasks = batch.tasks;\n\tbatch.tasks = [];\n\n\tfor ( i = 0; i < tasks.length; i += 1 ) {\n\t\ttasks[i]();\n\t}\n\n\t// If updating the view caused some model blowback - e.g. a triple\n\t// containing