{"version":3,"file":"ractive.js","sources":["../src/Ractive.js","../src/Ractive/static/findPlugin.js","../src/Ractive/static/keypaths.js","../src/extend/_extend.js","../src/Ractive/static/sharedSet.js","../src/Ractive/static/isInstance.js","../src/Ractive/prototype.js","../src/Ractive/prototype/updateModel.js","../src/Ractive/prototype/unshift.js","../src/Ractive/prototype/unrender.js","../src/Ractive/prototype/unlink.js","../src/Ractive/prototype/transition.js","../src/Ractive/prototype/toText.js","../src/Ractive/prototype/toHTML.js","../src/Ractive/prototype/toCSS.js","../src/Ractive/prototype/toggle.js","../src/Ractive/prototype/subtract.js","../src/Ractive/prototype/splice.js","../src/Ractive/prototype/sort.js","../src/Ractive/prototype/shift.js","../src/Ractive/prototype/set.js","../src/Ractive/prototype/reverse.js","../src/Ractive/prototype/resetTemplate.js","../src/Ractive/prototype/resetPartial.js","../src/Ractive/prototype/reset.js","../src/Ractive/prototype/render.js","../src/Ractive/render.js","../src/Ractive/initialise.js","../src/events/HookQueue.js","../src/view/Fragment.js","../src/view/helpers/processItems.js","../src/view/items/createItem.js","../src/view/items/component/getComponentConstructor.js","../src/view/items/Triple.js","../src/view/items/triple/insertHtml.js","../src/view/items/element/Transition.js","../src/view/items/element/transitions/createTransitions.js","../src/view/items/element/transitions/hyphenate.js","../src/view/items/element/transitions/prefix.js","../src/config/visibility.js","../src/view/items/Text.js","../src/view/items/element/specials/Textarea.js","../src/view/items/element/specials/Select.js","../src/view/items/Section.js","../src/view/RepeatedFragment.js","../src/view/items/Partial.js","../src/view/items/partial/getPartialTemplate.js","../src/view/items/element/specials/Option.js","../src/view/items/component/Mapping.js","../src/utils/parseJSON.js","../src/view/items/element/specials/Input.js","../src/view/items/Interpolator.js","../src/view/items/shared/Mustache.js","../src/view/items/shared/progressiveText.js","../src/view/items/shared/EventDirective.js","../src/view/items/component/RactiveEvent.js","../src/view/items/element/ElementEvents.js","../src/view/items/element/specials/Form.js","../src/view/items/Element.js","../src/view/items/element/binding/selectBinding.js","../src/view/items/element/binding/SingleSelectBinding.js","../src/view/items/element/binding/RadioNameBinding.js","../src/view/items/element/binding/RadioBinding.js","../src/view/items/element/binding/NumericBinding.js","../src/view/items/element/binding/MultipleSelectBinding.js","../src/utils/getSelectedOptions.js","../src/view/items/element/binding/FileBinding.js","../src/view/items/element/binding/GenericBinding.js","../src/view/items/element/binding/ContentEditableBinding.js","../src/view/items/element/binding/CheckboxNameBinding.js","../src/view/items/element/binding/getBindingGroup.js","../src/view/items/element/binding/CheckboxBinding.js","../src/view/items/element/binding/handleDomEvent.js","../src/view/items/element/binding/Binding.js","../src/view/items/Doctype.js","../src/view/items/element/Decorator.js","../src/view/items/shared/directiveArgs.js","../src/view/items/Component.js","../src/Ractive/construct.js","../src/Ractive/helpers/subscribe.js","../src/utils/object.js","../src/Ractive/helpers/getComputationSignature.js","../src/model/RootModel.js","../src/model/specials/RactiveModel.js","../src/Ractive/prototype/teardown.js","../src/view/items/element/BindingFlag.js","../src/view/items/element/Attribute.js","../src/view/items/element/ConditionalAttribute.js","../src/view/items/element/attribute/propertyNames.js","../src/view/items/element/attribute/getUpdateDelegate.js","../src/view/helpers/specialAttrs.js","../src/utils/hyphenateCamel.js","../src/view/items/Alias.js","../src/view/resolvers/resolve.js","../src/view/resolvers/ReferenceExpressionProxy.js","../src/view/resolvers/ExpressionProxy.js","../src/model/Computation.js","../src/model/ComputationChild.js","../src/view/items/shared/Item.js","../src/Ractive/config/config.js","../src/Ractive/config/deprecate.js","../src/Ractive/config/wrapPrototypeMethod.js","../src/Ractive/config/registries.js","../src/Ractive/config/custom/template.js","../src/shared/getFunction.js","../src/Ractive/config/runtime-parser.js","../src/parse/_parse.js","../src/Ractive/shared.js","../src/parse/utils/insertExpressions.js","../src/parse/converters/readTemplate.js","../src/parse/converters/readPartialDefinitionSection.js","../src/parse/converters/readText.js","../src/parse/converters/readElement.js","../src/parse/converters/element/readClosingTag.js","../src/parse/utils/cleanup.js","../src/parse/utils/trimWhitespace.js","../src/parse/utils/stripStandalones.js","../src/parse/converters/readHtmlComment.js","../src/parse/converters/mustache/readSection.js","../src/parse/converters/mustache/handlebarsBlockCodes.js","../src/parse/converters/mustache/section/readElseIf.js","../src/parse/converters/mustache/section/readElse.js","../src/parse/converters/mustache/section/readClosing.js","../src/parse/converters/mustache/readInterpolator.js","../src/parse/converters/mustache/readMustacheComment.js","../src/parse/converters/mustache/readPartial.js","../src/parse/converters/mustache/readAliases.js","../src/parse/converters/mustache/readUnescaped.js","../src/parse/converters/mustache/readTriple.js","../src/parse/converters/readMustache.js","../src/parse/converters/element/readAttribute.js","../src/parse/utils/refineExpression.js","../src/parse/utils/flattenExpression.js","../src/parse/converters/readExpressionOrReference.js","../src/parse/converters/expressions/shared/readExpressionList.js","../src/parse/converters/readExpression.js","../src/parse/converters/expressions/readConditional.js","../src/parse/converters/expressions/readLogicalOr.js","../src/parse/converters/expressions/readTypeof.js","../src/parse/converters/expressions/readMemberOrInvocation.js","../src/parse/converters/expressions/shared/readRefinement.js","../src/parse/converters/expressions/readPrimary.js","../src/parse/converters/expressions/primary/readBracketedExpression.js","../src/parse/converters/expressions/primary/readReference.js","../src/parse/converters/expressions/primary/readLiteral.js","../src/parse/converters/expressions/primary/literal/readArrayLiteral.js","../src/parse/converters/expressions/primary/literal/readObjectLiteral.js","../src/parse/converters/expressions/primary/literal/objectLiteral/keyValuePairs.js","../src/parse/converters/expressions/primary/literal/objectLiteral/keyValuePair.js","../src/parse/converters/expressions/shared/readKey.js","../src/parse/converters/expressions/shared/patterns.js","../src/parse/converters/expressions/primary/literal/readTemplateStringLiteral.js","../src/parse/converters/expressions/primary/literal/readStringLiteral.js","../src/parse/converters/expressions/primary/literal/stringLiteral/makeQuotedStringMatcher.js","../src/parse/converters/expressions/primary/literal/readBooleanLiteral.js","../src/parse/converters/expressions/primary/literal/readNumberLiteral.js","../src/parse/converters/expressions/shared/errors.js","../src/utils/html.js","../src/parse/converters/utils/getLowestIndex.js","../src/utils/escapeRegExp.js","../src/parse/converters/expressions/primary/literal/readRegexpLiteral.js","../src/parse/converters/mustache/readDelimiterChange.js","../src/parse/Parser.js","../src/parse/utils/createFunction.js","../src/config/template.js","../src/Ractive/config/custom/data.js","../src/Ractive/config/custom/css/css.js","../src/model/specials/CSSModel.js","../src/Ractive/static/styleSet.js","../src/utils/id.js","../src/Ractive/config/custom/css/transform.js","../src/utils/cleanCss.js","../src/Ractive/config/custom/adapt.js","../src/global/css.js","../src/Ractive/prototype/readLink.js","../src/Ractive/prototype/push.js","../src/Ractive/prototype/pop.js","../src/Ractive/prototype/once.js","../src/Ractive/prototype/on.js","../src/Ractive/prototype/off.js","../src/Ractive/prototype/shared/notEmptyString.js","../src/Ractive/prototype/shared/trim.js","../src/Ractive/prototype/observeOnce.js","../src/Ractive/prototype/observe.js","../src/Ractive/prototype/observe/Array.js","../src/Ractive/prototype/observe/Pattern.js","../src/Ractive/prototype/observe/Observer.js","../src/Ractive/prototype/link.js","../src/Ractive/prototype/insert.js","../src/utils/dom.js","../src/config/namespaces.js","../src/Ractive/prototype/getContext.js","../src/Ractive/static/getContext.js","../src/Ractive/prototype/get.js","../src/Ractive/prototype/fire.js","../src/shared/Context.js","../src/Ractive/prototype/update.js","../src/Ractive/prototype/shared/makeArrayMethod.js","../src/shared/getNewIndices.js","../src/view/items/shared/findElement.js","../src/config/types.js","../src/Ractive/prototype/findParent.js","../src/Ractive/prototype/findContainer.js","../src/Ractive/prototype/findComponent.js","../src/Ractive/prototype/findAllComponents.js","../src/Ractive/prototype/findAll.js","../src/Ractive/prototype/find.js","../src/Ractive/prototype/detachChild.js","../src/Ractive/prototype/detach.js","../src/Ractive/prototype/attachChild.js","../src/shared/anchors.js","../src/events/Hook.js","../src/events/fireEvent.js","../src/events/eventStack.js","../src/Ractive/prototype/animate.js","../src/Ractive/prototype/add.js","../src/Ractive/prototype/shared/add.js","../src/shared/set.js","../src/shared/getRactiveContext.js","../src/view/resolvers/resolveReference.js","../src/model/specials/SharedModel.js","../src/model/Model.js","../src/model/helpers/getPrefixer.js","../src/shared/Ticker.js","../src/global/runloop.js","../src/global/TransitionManager.js","../src/model/LinkModel.js","../src/shared/rebind.js","../src/model/ModelBase.js","../src/utils/bind.js","../src/model/specials/KeypathModel.js","../src/shared/methodCallers.js","../src/model/specials/KeyModel.js","../src/global/capture.js","../src/utils/array.js","../src/shared/keypaths.js","../src/Ractive/static/interpolators.js","../src/shared/interpolate.js","../src/shared/registry.js","../src/config/errors.js","../src/utils/log.js","../src/utils/noop.js","../src/config/environment.js","../src/utils/is.js","../src/Ractive/static/easing.js","../src/Ractive/config/defaults.js","../src/polyfills/requestAnimationFrame.js","../src/polyfills/Promise.js","../src/polyfills/performance.now.js","../src/polyfills/Object.assign.js","../src/polyfills/node.contains.js","../src/polyfills/array.find.js"],"sourcesContent":["import './polyfills/array.find';\nimport './polyfills/node.contains';\nimport './polyfills/Object.assign';\nimport './polyfills/performance.now';\nimport './polyfills/Promise';\nimport './polyfills/requestAnimationFrame';\n\nimport defaults from './Ractive/config/defaults';\nimport easing from './Ractive/static/easing';\nimport interpolators from './Ractive/static/interpolators';\nimport { svg, win } from './config/environment';\nimport proto from './Ractive/prototype';\nimport { extend, extendWith } from './extend/_extend';\nimport parse from './parse/_parse';\nimport getContext, { getNodeInfo } from './Ractive/static/getContext';\nimport isInstance from './Ractive/static/isInstance';\nimport construct from './Ractive/construct';\nimport initialise from './Ractive/initialise';\nimport { getCSS } from './global/css';\nimport { escapeKey, unescapeKey, normalise } from './shared/keypaths';\nimport { joinKeys, splitKeypath } from './Ractive/static/keypaths';\nimport shared from './Ractive/shared';\nimport { findPlugin } from './Ractive/static/findPlugin';\nimport parseJSON from './utils/parseJSON';\nimport CSSModel from './model/specials/CSSModel';\nimport { data as sharedData } from './model/specials/SharedModel';\nimport { extern } from './shared/getRactiveContext';\n\nexport default function Ractive ( options ) {\n\tif ( !( this instanceof Ractive ) ) return new Ractive( options );\n\n\tconstruct( this, options || {} );\n\tinitialise( this, options || {}, {} );\n}\n\n// check to see if we're being asked to force Ractive as a global for some weird environments\nif ( win && !win.Ractive ) {\n\tlet opts = '';\n\tconst script = document.currentScript || /* istanbul ignore next */ document.querySelector( 'script[data-ractive-options]' );\n\n\tif ( script ) opts = script.getAttribute( 'data-ractive-options' ) || '';\n\n\t/* istanbul ignore next */\n\tif ( ~opts.indexOf( 'ForceGlobal' ) ) win.Ractive = Ractive;\n}\n\nObject.assign( Ractive.prototype, proto, defaults );\nRactive.prototype.constructor = Ractive;\n\n// alias prototype as `defaults`\nRactive.defaults = Ractive.prototype;\n\n// share defaults with the parser\nshared.defaults = Ractive.defaults;\nshared.Ractive = Ractive;\n\n// static properties\nObject.defineProperties( Ractive, {\n\n\t// debug flag\n\tDEBUG: { writable: true, value: true },\n\tDEBUG_PROMISES: { writable: true, value: true },\n\n\t// static methods:\n\textend: { value: extend },\n\textendWith: { value: extendWith },\n\tescapeKey: { value: escapeKey },\n\tevalObjectString: { value: parseJSON },\n\tfindPlugin: { value: findPlugin },\n\tgetContext: { value: getContext },\n\tgetCSS: { value: getCSS },\n\tgetNodeInfo: { value: getNodeInfo },\n\tisInstance: { value: isInstance },\n\tjoinKeys: { value: joinKeys },\n\tnormaliseKeypath: { value: normalise },\n\tparse: { value: parse },\n\tsplitKeypath: { value: splitKeypath },\n\t// sharedSet and styleSet are in _extend because circular refs\n\tunescapeKey: { value: unescapeKey },\n\n\t// support\n\tenhance: { writable: true, value: false },\n\tsvg: { value: svg },\n\n\t// version\n\tVERSION: { value: 'BUILD_PLACEHOLDER_VERSION' },\n\n\t// plugins\n\tadaptors: { writable: true, value: {} },\n\tcomponents: { writable: true, value: {} },\n\tdecorators: { writable: true, value: {} },\n\teasing: { writable: true, value: easing },\n\tevents: { writable: true, value: {} },\n\textensions: { value: [] },\n\tinterpolators: { writable: true, value: interpolators },\n\tpartials: { writable: true, value: {} },\n\ttransitions: { writable: true, value: {} },\n\n\t// CSS variables\n\tcssData: { configurable: true, value: {} },\n\n\t// access to @shared without an instance\n\tsharedData: { value: sharedData },\n\n\t// for getting the source Ractive lib from a constructor\n\tRactive: { value: Ractive },\n\n\t// to allow extending contexts\n\tContext: { value: extern.Context.prototype }\n});\n\nObject.defineProperty( Ractive, '_cssModel', { configurable: true, value: new CSSModel( Ractive ) } );\n","import { findInViewHierarchy } from 'shared/registry';\n\nexport function findPlugin(name, type, instance) {\n\treturn findInViewHierarchy(type, instance, name);\n}\n","import { escapeKey, splitKeypath as splitKeypathI, unescapeKey } from 'shared/keypaths';\n\nexport function joinKeys ( ...keys ) {\n\treturn keys.map( escapeKey ).join( '.' );\n}\n\nexport function splitKeypath ( keypath ) {\n\treturn splitKeypathI( keypath ).map( unescapeKey );\n}\n","import { toPairs } from 'utils/object';\nimport config from '../Ractive/config/config';\nimport dataConfigurator from '../Ractive/config/custom/data';\nimport construct from '../Ractive/construct';\nimport initialise from '../Ractive/initialise';\nimport Ractive from '../Ractive';\nimport isInstance from '../Ractive/static/isInstance';\nimport styleSet from '../Ractive/static/styleSet';\nimport sharedSet from '../Ractive/static/sharedSet';\n\nconst callsSuper = /super\\s*\\(|\\.call\\s*\\(\\s*this/;\n\nexport function extend ( ...options ) {\n\tif( !options.length ) {\n\t\treturn extendOne( this );\n\t} else {\n\t\treturn options.reduce( extendOne, this );\n\t}\n}\n\nexport function extendWith ( Class, options = {} ) {\n\treturn extendOne( this, options, Class );\n}\n\nfunction extendOne ( Parent, options = {}, Target ) {\n\tlet proto;\n\tlet Child = typeof Target === 'function' && Target;\n\n\tif ( options.prototype instanceof Ractive ) {\n\t\tthrow new Error( `Ractive no longer supports multiple inheritance.` );\n\t}\n\n\tif ( Child ) {\n\t\tif ( !( Child.prototype instanceof Parent ) ) {\n\t\t\tthrow new Error( `Only classes that inherit the appropriate prototype may be used with extend` );\n\t\t}\n\t\tif ( !callsSuper.test( Child.toString() ) ) {\n\t\t\tthrow new Error( `Only classes that call super in their constructor may be used with extend` );\n\t\t}\n\n\t\tproto = Child.prototype;\n\t} else {\n\t\tChild = function ( options ) {\n\t\t\tif ( !( this instanceof Child ) ) return new Child( options );\n\n\t\t\tconstruct( this, options || {} );\n\t\t\tinitialise( this, options || {}, {} );\n\t\t};\n\n\t\tproto = Object.create( Parent.prototype );\n\t\tproto.constructor = Child;\n\n\t\tChild.prototype = proto;\n\t}\n\n\t// Static properties\n\tObject.defineProperties( Child, {\n\t\t// alias prototype as defaults\n\t\tdefaults: { value: proto },\n\n\t\textend: { value: extend, writable: true, configurable: true },\n\t\textendWith: { value: extendWith, writable: true, configurable: true },\n\t\textensions: { value: [] },\n\n\t\tisInstance: { value: isInstance },\n\n\t\tParent: { value: Parent },\n\t\tRactive: { value: Ractive },\n\n\t\tstyleSet: { value: styleSet.bind( Child ), configurable: true }\n\t});\n\n\t// extend configuration\n\tconfig.extend( Parent, proto, options, Child );\n\n\t// store event and observer registries on the constructor when extending\n\tChild._on = ( Parent._on || [] ).concat( toPairs( options.on ) );\n\tChild._observe = ( Parent._observe || [] ).concat( toPairs( options.observe ) );\n\n\tParent.extensions.push( Child );\n\n\t// attribute defs are not inherited, but they need to be stored\n\tif ( options.attributes ) {\n\t\tlet attrs;\n\n\t\t// allow an array of optional props or an object with arrays for optional and required props\n\t\tif ( Array.isArray( options.attributes ) ) {\n\t\t\tattrs = { optional: options.attributes, required: [] };\n\t\t} else {\n\t\t\tattrs = options.attributes;\n\t\t}\n\n\t\t// make sure the requisite keys actually store arrays\n\t\tif ( !Array.isArray( attrs.required ) ) attrs.required = [];\n\t\tif ( !Array.isArray( attrs.optional ) ) attrs.optional = [];\n\n\t\tChild.attributes = attrs;\n\t}\n\n\tdataConfigurator.extend( Parent, proto, options, Child );\n\n\tif ( options.computed ) {\n\t\tproto.computed = Object.assign( Object.create( Parent.prototype.computed ), options.computed );\n\t}\n\n\treturn Child;\n}\n\n// styleSet for Ractive\nObject.defineProperty( Ractive, 'styleSet', { configurable: true, value: styleSet.bind( Ractive ) } );\n\n// sharedSet for Ractive\nObject.defineProperty( Ractive, 'sharedSet', { value: sharedSet } );\n","import { build, set } from '../../shared/set';\nimport SharedModel from '../../model/specials/SharedModel';\n\nexport default function sharedSet ( keypath, value, options ) {\n\tconst opts = typeof keypath === 'object' ? value : options;\n\tconst model = SharedModel;\n\n\treturn set( build( { viewmodel: model }, keypath, value, true ), opts );\n}\n","export default function isInstance ( object ) {\n\treturn object && object instanceof this;\n}\n","import add from './prototype/add';\nimport animate from './prototype/animate';\nimport attachChild from './prototype/attachChild';\nimport detach from './prototype/detach';\nimport detachChild from './prototype/detachChild';\nimport find from './prototype/find';\nimport findAll from './prototype/findAll';\nimport findAllComponents from './prototype/findAllComponents';\nimport findComponent from './prototype/findComponent';\nimport findContainer from './prototype/findContainer';\nimport findParent from './prototype/findParent';\nimport fire from './prototype/fire';\nimport get from './prototype/get';\nimport getContext, { getNodeInfo } from './prototype/getContext';\nimport insert from './prototype/insert';\nimport link from './prototype/link';\nimport observe from './prototype/observe';\nimport observeOnce from './prototype/observeOnce';\nimport off from './prototype/off';\nimport on from './prototype/on';\nimport once from './prototype/once';\nimport pop from './prototype/pop';\nimport push from './prototype/push';\nimport readLink from './prototype/readLink';\nimport render from './prototype/render';\nimport reset from './prototype/reset';\nimport resetPartial from './prototype/resetPartial';\nimport resetTemplate from './prototype/resetTemplate';\nimport reverse from './prototype/reverse';\nimport set from './prototype/set';\nimport shift from './prototype/shift';\nimport sort from './prototype/sort';\nimport splice from './prototype/splice';\nimport subtract from './prototype/subtract';\nimport teardown from './prototype/teardown';\nimport toggle from './prototype/toggle';\nimport toCSS from './prototype/toCSS';\nimport toHTML from './prototype/toHTML';\nimport toText from './prototype/toText';\nimport transition from './prototype/transition';\nimport unlink from './prototype/unlink';\nimport unrender from './prototype/unrender';\nimport unshift from './prototype/unshift';\nimport update from './prototype/update';\nimport updateModel from './prototype/updateModel';\n\nconst proto = {\n\tadd,\n\tanimate,\n\tattachChild,\n\tdetach,\n\tdetachChild,\n\tfind,\n\tfindAll,\n\tfindAllComponents,\n\tfindComponent,\n\tfindContainer,\n\tfindParent,\n\tfire,\n\tget,\n\tgetContext,\n\tgetNodeInfo,\n\tinsert,\n\tlink,\n\tobserve,\n\tobserveOnce,\n\toff,\n\ton,\n\tonce,\n\tpop,\n\tpush,\n\treadLink,\n\trender,\n\treset,\n\tresetPartial,\n\tresetTemplate,\n\treverse,\n\tset,\n\tshift,\n\tsort,\n\tsplice,\n\tsubtract,\n\tteardown,\n\ttoggle,\n\ttoCSS,\n\ttoCss: toCSS,\n\ttoHTML,\n\ttoHtml: toHTML,\n\ttoText,\n\ttransition,\n\tunlink,\n\tunrender,\n\tunshift,\n\tupdate,\n\tupdateModel\n};\n\nObject.defineProperty( proto, 'target', {\n\tget() { return this.el; }\n});\n\nexport default proto;\n","import { splitKeypath } from 'shared/keypaths';\nimport runloop from 'src/global/runloop';\n\nexport default function Ractive$updateModel ( keypath, cascade ) {\n\tconst promise = runloop.start();\n\n\tif ( !keypath ) {\n\t\tthis.viewmodel.updateFromBindings( true );\n\t} else {\n\t\tthis.viewmodel.joinAll( splitKeypath( keypath ) ).updateFromBindings( cascade !== false );\n\t}\n\n\trunloop.end();\n\n\treturn promise;\n}\n","import makeArrayMethod from './shared/makeArrayMethod';\nexport default makeArrayMethod( 'unshift' ).path;\n","import Hook from 'src/events/Hook';\nimport { warnIfDebug } from 'utils/log';\nimport { removeFromArray } from 'utils/array';\nimport runloop from 'src/global/runloop';\n\nconst unrenderHook = new Hook( 'unrender' );\n\nexport default function Ractive$unrender () {\n\tif ( !this.fragment.rendered ) {\n\t\twarnIfDebug( 'ractive.unrender() was called on a Ractive instance that was not rendered' );\n\t\treturn Promise.resolve();\n\t}\n\n\tthis.unrendering = true;\n\tconst promise = runloop.start();\n\n\t// If this is a component, and the component isn't marked for destruction,\n\t// don't detach nodes from the DOM unnecessarily\n\tconst shouldDestroy = !this.component || ( this.component.anchor || {} ).shouldDestroy || this.component.shouldDestroy || this.shouldDestroy;\n\tthis.fragment.unrender( shouldDestroy );\n\tif ( shouldDestroy ) this.destroyed = true;\n\n\tremoveFromArray( this.el.__ractive_instances__, this );\n\n\tunrenderHook.fire( this );\n\n\trunloop.end();\n\tthis.unrendering = false;\n\n\treturn promise;\n}\n","import { splitKeypath } from 'shared/keypaths';\nimport runloop from 'src/global/runloop';\n\nexport default function unlink( here ) {\n\tconst promise = runloop.start();\n\tthis.viewmodel.joinAll( splitKeypath( here ), { lastLink: false } ).unlink();\n\trunloop.end();\n\treturn promise;\n}\n","import runloop from '../../global/runloop';\nimport Transition from '../../view/items/element/Transition';\nimport { fatal } from '../../utils/log';\nimport { isObject } from '../../utils/is';\n\nexport default function Ractive$transition ( name, node, params ) {\n\n\tif ( node instanceof HTMLElement ) {\n\t\t// good to go\n\t}\n\telse if ( isObject( node ) ) {\n\t\t// omitted, use event node\n\t\tparams = node;\n\t}\n\n\t// if we allow query selector, then it won't work\n\t// simple params like \"fast\"\n\n\t// else if ( typeof node === 'string' ) {\n\t// \t// query selector\n\t// \tnode = this.find( node )\n\t// }\n\n\tnode = node || this.event.node;\n\n\tif ( !node || !node._ractive ) {\n\t\tfatal( `No node was supplied for transition ${name}` );\n\t}\n\n\tparams = params || {};\n\tconst owner = node._ractive.proxy;\n\tconst transition = new Transition({ owner, parentFragment: owner.parentFragment, name, params });\n\ttransition.bind();\n\n\tconst promise = runloop.start();\n\trunloop.registerTransition( transition );\n\trunloop.end();\n\n\tpromise.then( () => transition.unbind() );\n\treturn promise;\n}\n","export default function toText () {\n\treturn this.fragment.toString( false );\n}\n","export default function Ractive$toHTML () {\n\treturn this.fragment.toString( true );\n}\n","import { getCSS } from 'src/global/css';\n\nexport default function Ractive$toCSS() {\n\tconst cssIds = [ this.cssId, ...this.findAllComponents().map( c => c.cssId ) ];\n\tconst uniqueCssIds = Object.keys(cssIds.reduce( ( ids, id ) => (ids[id] = true, ids), {}));\n\treturn getCSS( uniqueCssIds );\n}\n","import { badArguments } from 'config/errors';\nimport { gather, set } from 'shared/set';\n\nexport default function Ractive$toggle ( keypath, options ) {\n\tif ( typeof keypath !== 'string' ) {\n\t\tthrow new TypeError( badArguments );\n\t}\n\n\treturn set( gather( this, keypath, null, options && options.isolated ).map( m => [ m, !m.get() ] ), options );\n}\n","import add from './shared/add';\n\nexport default function Ractive$subtract ( keypath, d, options ) {\n\tconst num = typeof d === 'number' ? -d : -1;\n\tconst opts = typeof d === 'object' ? d : options;\n\treturn add( this, keypath, num, opts );\n}\n","import makeArrayMethod from './shared/makeArrayMethod';\nexport default makeArrayMethod( 'splice' ).path;\n","import makeArrayMethod from './shared/makeArrayMethod';\nexport default makeArrayMethod( 'sort' ).path;\n","import makeArrayMethod from './shared/makeArrayMethod';\nexport default makeArrayMethod( 'shift' ).path;\n","import { build, set } from 'shared/set';\n\nexport default function Ractive$set ( keypath, value, options ) {\n\tconst ractive = this;\n\n\tconst opts = typeof keypath === 'object' ? value : options;\n\n\treturn set( build( ractive, keypath, value, opts && opts.isolated ), opts );\n}\n\n","import makeArrayMethod from './shared/makeArrayMethod';\nexport default makeArrayMethod( 'reverse' ).path;\n","import { createDocumentFragment } from 'utils/dom';\nimport Fragment from 'src/view/Fragment';\nimport runloop from 'src/global/runloop';\nimport { default as templateConfigurator } from '../config/custom/template';\n\n// TODO should resetTemplate be asynchronous? i.e. should it be a case\n// of outro, update template, intro? I reckon probably not, since that\n// could be achieved with unrender-resetTemplate-render. Also, it should\n// conceptually be similar to resetPartial, which couldn't be async\n\nexport default function Ractive$resetTemplate ( template ) {\n\ttemplateConfigurator.init( null, this, { template });\n\n\tconst transitionsEnabled = this.transitionsEnabled;\n\tthis.transitionsEnabled = false;\n\n\t// Is this is a component, we need to set the `shouldDestroy`\n\t// flag, otherwise it will assume by default that a parent node\n\t// will be detached, and therefore it doesn't need to bother\n\t// detaching its own nodes\n\tconst component = this.component;\n\tif ( component ) component.shouldDestroy = true;\n\tthis.unrender();\n\tif ( component ) component.shouldDestroy = false;\n\n\tconst promise = runloop.start();\n\n\t// remove existing fragment and create new one\n\tthis.fragment.unbind().unrender( true );\n\n\tthis.fragment = new Fragment({\n\t\ttemplate: this.template,\n\t\troot: this,\n\t\towner: this\n\t});\n\n\tconst docFrag = createDocumentFragment();\n\tthis.fragment.bind( this.viewmodel ).render( docFrag );\n\n\t// if this is a component, its el may not be valid, so find a\n\t// target based on the component container\n\tif ( component && !component.external ) {\n\t\tthis.fragment.findParentNode().insertBefore( docFrag, component.findNextNode() );\n\t} else {\n\t\tthis.el.insertBefore( docFrag, this.anchor );\n\t}\n\n\trunloop.end();\n\n\tthis.transitionsEnabled = transitionsEnabled;\n\n\treturn promise;\n}\n","import runloop from 'src/global/runloop';\nimport { PARTIAL, COMPONENT, ELEMENT } from 'config/types';\n\nfunction collect( source, name, attr, dest ) {\n\tsource.forEach( item => {\n\t\t// queue to rerender if the item is a partial and the current name matches\n\t\tif ( item.type === PARTIAL && ( item.refName === name || item.name === name ) ) {\n\t\t\titem.inAttribute = attr;\n\t\t\tdest.push( item );\n\t\t\treturn; // go no further\n\t\t}\n\n\t\t// if it has a fragment, process its items\n\t\tif ( item.fragment ) {\n\t\t\tcollect( item.fragment.iterations || item.fragment.items, name, attr, dest );\n\t\t}\n\n\t\t// or if it is itself a fragment, process its items\n\t\telse if ( Array.isArray( item.items ) ) {\n\t\t\tcollect( item.items, name, attr, dest );\n\t\t}\n\n\t\t// or if it is a component, step in and process its items\n\t\telse if ( item.type === COMPONENT && item.instance ) {\n\t\t\t// ...unless the partial is shadowed\n\t\t\tif ( item.instance.partials[ name ] ) return;\n\t\t\tcollect( item.instance.fragment.items, name, attr, dest );\n\t\t}\n\n\t\t// if the item is an element, process its attributes too\n\t\tif ( item.type === ELEMENT ) {\n\t\t\tif ( Array.isArray( item.attributes ) ) {\n\t\t\t\tcollect( item.attributes, name, true, dest );\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction forceResetTemplate ( partial ) {\n\tpartial.forceResetTemplate();\n}\n\nexport default function ( name, partial ) {\n\tconst collection = [];\n\tcollect( this.fragment.items, name, false, collection );\n\n\tconst promise = runloop.start();\n\n\tthis.partials[ name ] = partial;\n\tcollection.forEach( forceResetTemplate );\n\n\trunloop.end();\n\n\treturn promise;\n}\n","import runloop from 'src/global/runloop';\nimport config from '../config/config';\nimport Hook from '../../events/Hook';\nimport dataConfigurator from '../config/custom/data';\n\nconst shouldRerender = [ 'template', 'partials', 'components', 'decorators', 'events' ];\n\nconst completeHook = new Hook( 'complete' );\nconst resetHook = new Hook( 'reset' );\nconst renderHook = new Hook( 'render' );\nconst unrenderHook = new Hook( 'unrender' );\n\nexport default function Ractive$reset ( data ) {\n\tdata = data || {};\n\n\tif ( typeof data !== 'object' ) {\n\t\tthrow new Error( 'The reset method takes either no arguments, or an object containing new data' );\n\t}\n\n\t// TEMP need to tidy this up\n\tdata = dataConfigurator.init( this.constructor, this, { data });\n\n\tconst promise = runloop.start();\n\n\t// If the root object is wrapped, try and use the wrapper's reset value\n\tconst wrapper = this.viewmodel.wrapper;\n\tif ( wrapper && wrapper.reset ) {\n\t\tif ( wrapper.reset( data ) === false ) {\n\t\t\t// reset was rejected, we need to replace the object\n\t\t\tthis.viewmodel.set( data );\n\t\t}\n\t} else {\n\t\tthis.viewmodel.set( data );\n\t}\n\n\t// reset config items and track if need to rerender\n\tconst changes = config.reset( this );\n\tlet rerender;\n\n\tlet i = changes.length;\n\twhile ( i-- ) {\n\t\tif ( shouldRerender.indexOf( changes[i] ) > -1 ) {\n\t\t\trerender = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif ( rerender ) {\n\t\tunrenderHook.fire( this );\n\t\tthis.fragment.resetTemplate( this.template );\n\t\trenderHook.fire( this );\n\t\tcompleteHook.fire( this );\n\t}\n\n\trunloop.end();\n\n\tresetHook.fire( this, data );\n\n\treturn promise;\n}\n","import { getElement } from 'utils/dom';\nimport { toArray } from 'utils/array';\nimport { warnIfDebug } from 'utils/log';\nimport render from '../render';\nimport { teardown } from 'shared/methodCallers';\n\nexport default function Ractive$render ( target, anchor ) {\n\tif ( this.torndown ) {\n\t\twarnIfDebug( 'ractive.render() was called on a Ractive instance that was already torn down' );\n\t\treturn Promise.resolve();\n\t}\n\n\ttarget = getElement( target ) || this.el;\n\n\tif ( !this.append && target ) {\n\t\t// Teardown any existing instances *before* trying to set up the new one -\n\t\t// avoids certain weird bugs\n\t\tconst others = target.__ractive_instances__;\n\t\tif ( others ) others.forEach( teardown );\n\n\t\t// make sure we are the only occupants\n\t\tif ( !this.enhance ) {\n\t\t\ttarget.innerHTML = ''; // TODO is this quicker than removeChild? Initial research inconclusive\n\t\t}\n\t}\n\n\tconst occupants = this.enhance ? toArray( target.childNodes ) : null;\n\tconst promise = render( this, target, anchor, occupants );\n\n\tif ( occupants ) {\n\t\twhile ( occupants.length ) target.removeChild( occupants.pop() );\n\t}\n\n\treturn promise;\n}\n","import { doc } from 'config/environment';\nimport { applyCSS } from 'src/global/css';\nimport Hook from 'src/events/Hook';\nimport { getElement } from 'utils/dom';\nimport runloop from 'src/global/runloop';\nimport { createFragment } from './initialise';\n\nconst renderHook = new Hook( 'render' );\nconst completeHook = new Hook( 'complete' );\n\nexport default function render ( ractive, target, anchor, occupants ) {\n\t// set a flag to let any transitions know that this instance is currently rendering\n\tractive.rendering = true;\n\n\tconst promise = runloop.start();\n\trunloop.scheduleTask( () => renderHook.fire( ractive ), true );\n\n\tif ( ractive.fragment.rendered ) {\n\t\tthrow new Error( 'You cannot call ractive.render() on an already rendered instance! Call ractive.unrender() first' );\n\t}\n\n\tif ( ractive.destroyed ) {\n\t\tractive.destroyed = false;\n\t\tractive.fragment = createFragment( ractive ).bind( ractive.viewmodel );\n\t}\n\n\tanchor = getElement( anchor ) || ractive.anchor;\n\n\tractive.el = ractive.target = target;\n\tractive.anchor = anchor;\n\n\t// ensure encapsulated CSS is up-to-date\n\tif ( ractive.cssId ) applyCSS();\n\n\tif ( target ) {\n\t\t( target.__ractive_instances__ || ( target.__ractive_instances__ = [] ) ).push( ractive );\n\n\t\tif ( anchor ) {\n\t\t\tconst docFrag = doc.createDocumentFragment();\n\t\t\tractive.fragment.render( docFrag );\n\t\t\ttarget.insertBefore( docFrag, anchor );\n\t\t} else {\n\t\t\tractive.fragment.render( target, occupants );\n\t\t}\n\t}\n\n\trunloop.end();\n\tractive.rendering = false;\n\n\treturn promise.then( () => {\n\t\tif (ractive.torndown) return;\n\n\t\tcompleteHook.fire( ractive );\n\t});\n}\n","import { logIfDebug, warnIfDebug, warnOnceIfDebug } from 'utils/log';\nimport { getElement } from 'utils/dom';\nimport config from './config/config';\nimport Fragment from 'src/view/Fragment';\nimport Hook from 'src/events/Hook';\nimport HookQueue from 'src/events/HookQueue';\nimport Ractive from '../Ractive';\nimport subscribe from './helpers/subscribe';\n\nconst configHook = new Hook( 'config' );\nconst initHook = new HookQueue( 'init' );\n\nexport default function initialise ( ractive, userOptions, options ) {\n\tObject.keys( ractive.viewmodel.computations ).forEach( key => {\n\t\tconst computation = ractive.viewmodel.computations[ key ];\n\n\t\tif ( ractive.viewmodel.value.hasOwnProperty( key ) ) {\n\t\t\tcomputation.set( ractive.viewmodel.value[ key ] );\n\t\t}\n\t});\n\n\t// init config from Parent and options\n\tconfig.init( ractive.constructor, ractive, userOptions );\n\n\tconfigHook.fire( ractive );\n\n\tinitHook.begin( ractive );\n\n\tconst fragment = ractive.fragment = createFragment( ractive, options );\n\tif ( fragment ) fragment.bind( ractive.viewmodel );\n\n\tinitHook.end( ractive );\n\n\t// general config done, set up observers\n\tsubscribe( ractive, userOptions, 'observe' );\n\n\tif ( fragment ) {\n\t\t// render automatically ( if `el` is specified )\n\t\tconst el = getElement( ractive.el || ractive.target );\n\t\tif ( el ) {\n\t\t\tconst promise = ractive.render( el, ractive.append );\n\n\t\t\tif ( Ractive.DEBUG_PROMISES ) {\n\t\t\t\tpromise.catch( err => {\n\t\t\t\t\twarnOnceIfDebug( 'Promise debugging is enabled, to help solve errors that happen asynchronously. Some browsers will log unhandled promise rejections, in which case you can safely disable promise debugging:\\n Ractive.DEBUG_PROMISES = false;' );\n\t\t\t\t\twarnIfDebug( 'An error happened during rendering', { ractive });\n\t\t\t\t\tlogIfDebug( err );\n\n\t\t\t\t\tthrow err;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function createFragment ( ractive, options = {} ) {\n\tif ( ractive.template ) {\n\t\tconst cssIds = [].concat( ractive.constructor._cssIds || [], options.cssIds || [] );\n\n\t\treturn new Fragment({\n\t\t\towner: ractive,\n\t\t\ttemplate: ractive.template,\n\t\t\tcssIds\n\t\t});\n\t}\n}\n","import Hook from './Hook';\n\nfunction getChildQueue ( queue, ractive ) {\n\treturn queue[ ractive._guid ] || ( queue[ ractive._guid ] = [] );\n}\n\nfunction fire ( hookQueue, ractive ) {\n\tconst childQueue = getChildQueue( hookQueue.queue, ractive );\n\n\thookQueue.hook.fire( ractive );\n\n\t// queue is \"live\" because components can end up being\n\t// added while hooks fire on parents that modify data values.\n\twhile ( childQueue.length ) {\n\t\tfire( hookQueue, childQueue.shift() );\n\t}\n\n\tdelete hookQueue.queue[ ractive._guid ];\n}\n\nexport default class HookQueue {\n\tconstructor ( event ) {\n\t\tthis.hook = new Hook( event );\n\t\tthis.inProcess = {};\n\t\tthis.queue = {};\n\t}\n\n\tbegin ( ractive ) {\n\t\tthis.inProcess[ ractive._guid ] = true;\n\t}\n\n\tend ( ractive ) {\n\t\tconst parent = ractive.parent;\n\n\t\t// If this is *isn't* a child of a component that's in process,\n\t\t// it should call methods or fire at this point\n\t\tif ( !parent || !this.inProcess[ parent._guid ] ) {\n\t\t\tfire( this, ractive );\n\t\t}\n\t\t// elsewise, handoff to parent to fire when ready\n\t\telse {\n\t\t\tgetChildQueue( this.queue, parent ).push( ractive );\n\t\t}\n\n\t\tdelete this.inProcess[ ractive._guid ];\n\t}\n}\n","import { ELEMENT, YIELDER } from 'config/types';\nimport runloop from 'src/global/runloop';\nimport { findMap } from 'utils/array';\nimport { getContext, findParentWithContext } from 'shared/getRactiveContext';\nimport { bind, destroyed, shuffled, toEscapedString, toString, unbind, unrender, update } from 'shared/methodCallers';\nimport createItem from './items/createItem';\nimport processItems from './helpers/processItems';\nimport parseJSON from 'utils/parseJSON';\nimport { createDocumentFragment } from 'utils/dom';\n\nfunction unrenderAndDestroy ( item ) {\n\titem.unrender( true );\n}\n\nexport default class Fragment {\n\tconstructor ( options ) {\n\t\tthis.owner = options.owner; // The item that owns this fragment - an element, section, partial, or attribute\n\n\t\tthis.isRoot = !options.owner.parentFragment;\n\t\tthis.parent = this.isRoot ? null : this.owner.parentFragment;\n\t\tthis.ractive = options.ractive || ( this.isRoot ? options.owner : this.parent.ractive );\n\n\t\tthis.componentParent = ( this.isRoot && this.ractive.component ) ? this.ractive.component.parentFragment : null;\n\t\tthis.delegate = ( this.parent ? this.parent.delegate : ( this.componentParent && this.componentParent.delegate ) ) ||\n\t\t\t( this.owner.containerFragment && this.owner.containerFragment.delegate );\n\n\t\tthis.context = null;\n\t\tthis.rendered = false;\n\n\t\t// encapsulated styles should be inherited until they get applied by an element\n\t\tif ( 'cssIds' in options ) {\n\t\t\tthis.cssIds = options.cssIds && options.cssIds.length && options.cssIds;\n\t\t} else {\n\t\t\tthis.cssIds = this.parent ? this.parent.cssIds : null;\n\t\t}\n\n\t\tthis.dirty = false;\n\t\tthis.dirtyValue = true; // used for attribute values\n\n\t\tthis.template = options.template || [];\n\t\tthis.createItems();\n\t}\n\n\tbind ( context ) {\n\t\tthis.context = context;\n\t\tthis.items.forEach( bind );\n\t\tthis.bound = true;\n\n\t\t// in rare cases, a forced resolution (or similar) will cause the\n\t\t// fragment to be dirty before it's even finished binding. In those\n\t\t// cases we update immediately\n\t\tif ( this.dirty ) this.update();\n\n\t\treturn this;\n\t}\n\n\tbubble () {\n\t\tthis.dirtyValue = true;\n\n\t\tif ( !this.dirty ) {\n\t\t\tthis.dirty = true;\n\n\t\t\tif ( this.isRoot ) { // TODO encapsulate 'is component root, but not overall root' check?\n\t\t\t\tif ( this.ractive.component ) {\n\t\t\t\t\tthis.ractive.component.bubble();\n\t\t\t\t} else if ( this.bound ) {\n\t\t\t\t\trunloop.addFragment( this );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.owner.bubble( this.index );\n\t\t\t}\n\t\t}\n\t}\n\n\tcreateItems () {\n\t\t// this is a hot code path\n\t\tconst max = this.template.length;\n\t\tthis.items = [];\n\t\tfor ( let i = 0; i < max; i++ ) {\n\t\t\tthis.items[i] = createItem({ parentFragment: this, template: this.template[i], index: i });\n\t\t}\n\t}\n\n\tdestroyed () {\n\t\tthis.items.forEach( destroyed );\n\t}\n\n\tdetach () {\n\t\tconst docFrag = createDocumentFragment();\n\t\tconst xs = this.items;\n\t\tconst len = xs.length;\n\t\tfor ( let i = 0; i < len; i++ ) {\n\t\t\tdocFrag.appendChild( xs[i].detach() );\n\t\t}\n\t\treturn docFrag;\n\t}\n\n\tfind ( selector, options ) {\n\t\treturn findMap( this.items, i => i.find( selector, options ) );\n\t}\n\n\tfindAll ( selector, options ) {\n\t\tif ( this.items ) {\n\t\t\tthis.items.forEach( i => i.findAll && i.findAll( selector, options ) );\n\t\t}\n\t}\n\n\tfindComponent ( name, options ) {\n\t\treturn findMap( this.items, i => i.findComponent( name, options ) );\n\t}\n\n\tfindAllComponents ( name, options ) {\n\t\tif ( this.items ) {\n\t\t\tthis.items.forEach( i => i.findAllComponents && i.findAllComponents( name, options ) );\n\t\t}\n\t}\n\n\tfindContext () {\n\t\tconst base = findParentWithContext( this );\n\t\tif ( !base || !base.context ) return this.ractive.viewmodel;\n\t\telse return base.context;\n\t}\n\n\tfindNextNode ( item ) {\n\t\t// search for the next node going forward\n\t\tif ( item ) {\n\t\t\tlet it;\n\t\t\tfor ( let i = item.index + 1; i < this.items.length; i++ ) {\n\t\t\t\tit = this.items[i];\n\t\t\t\tif ( !it || !it.firstNode ) continue;\n\n\t\t\t\tconst node = it.firstNode( true );\n\t\t\t\tif ( node ) return node;\n\t\t\t}\n\t\t}\n\n\t\t// if this is the root fragment, and there are no more items,\n\t\t// it means we're at the end...\n\t\tif ( this.isRoot ) {\n\t\t\tif ( this.ractive.component ) {\n\t\t\t\treturn this.ractive.component.parentFragment.findNextNode( this.ractive.component );\n\t\t\t}\n\n\t\t\t// TODO possible edge case with other content\n\t\t\t// appended to this.ractive.el?\n\t\t\treturn null;\n\t\t}\n\n\t\tif ( this.parent ) return this.owner.findNextNode( this ); // the argument is in case the parent is a RepeatedFragment\n\t}\n\n\tfindParentNode () {\n\t\tlet fragment = this;\n\n\t\tdo {\n\t\t\tif ( fragment.owner.type === ELEMENT ) {\n\t\t\t\treturn fragment.owner.node;\n\t\t\t}\n\n\t\t\tif ( fragment.isRoot && !fragment.ractive.component ) { // TODO encapsulate check\n\t\t\t\treturn fragment.ractive.el;\n\t\t\t}\n\n\t\t\tif ( fragment.owner.type === YIELDER ) {\n\t\t\t\tfragment = fragment.owner.containerFragment;\n\t\t\t} else {\n\t\t\t\tfragment = fragment.componentParent || fragment.parent; // TODO ugh\n\t\t\t}\n\t\t} while ( fragment );\n\n\t\tthrow new Error( 'Could not find parent node' ); // TODO link to issue tracker\n\t}\n\n\tfindRepeatingFragment () {\n\t\tlet fragment = this;\n\t\t// TODO better check than fragment.parent.iterations\n\t\twhile ( ( fragment.parent || fragment.componentParent ) && !fragment.isIteration ) {\n\t\t\tfragment = fragment.parent || fragment.componentParent;\n\t\t}\n\n\t\treturn fragment;\n\t}\n\n\tfirstNode ( skipParent ) {\n\t\tconst node = findMap( this.items, i => i.firstNode( true ) );\n\t\tif ( node ) return node;\n\t\tif ( skipParent ) return null;\n\n\t\treturn this.parent.findNextNode( this.owner );\n\t}\n\n\trebind ( next ) {\n\t\tthis.context = next;\n\t}\n\n\trender ( target, occupants ) {\n\t\tif ( this.rendered ) throw new Error( 'Fragment is already rendered!' );\n\t\tthis.rendered = true;\n\n\t\tconst xs = this.items;\n\t\tconst len = xs.length;\n\t\tfor ( let i = 0; i < len; i++ ) {\n\t\t\txs[i].render( target, occupants );\n\t\t}\n\t}\n\n\tresetTemplate ( template ) {\n\t\tconst wasBound = this.bound;\n\t\tconst wasRendered = this.rendered;\n\n\t\t// TODO ensure transitions are disabled globally during reset\n\n\t\tif ( wasBound ) {\n\t\t\tif ( wasRendered ) this.unrender( true );\n\t\t\tthis.unbind();\n\t\t}\n\n\t\tthis.template = template;\n\t\tthis.createItems();\n\n\t\tif ( wasBound ) {\n\t\t\tthis.bind( this.context );\n\n\t\t\tif ( wasRendered ) {\n\t\t\t\tconst parentNode = this.findParentNode();\n\t\t\t\tconst anchor = this.findNextNode();\n\n\t\t\t\tif ( anchor ) {\n\t\t\t\t\tconst docFrag = createDocumentFragment();\n\t\t\t\t\tthis.render( docFrag );\n\t\t\t\t\tparentNode.insertBefore( docFrag, anchor );\n\t\t\t\t} else {\n\t\t\t\t\tthis.render( parentNode );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tshuffled () {\n\t\tthis.items.forEach( shuffled );\n\t}\n\n\ttoString ( escape ) {\n\t\treturn this.items.map( escape ? toEscapedString : toString ).join( '' );\n\t}\n\n\tunbind () {\n\t\tthis.context = null;\n\t\tthis.items.forEach( unbind );\n\t\tthis.bound = false;\n\n\t\treturn this;\n\t}\n\n\tunrender ( shouldDestroy ) {\n\t\tthis.items.forEach( shouldDestroy ? unrenderAndDestroy : unrender );\n\t\tthis.rendered = false;\n\t}\n\n\tupdate () {\n\t\tif ( this.dirty ) {\n\t\t\tif ( !this.updating ) {\n\t\t\t\tthis.dirty = false;\n\t\t\t\tthis.updating = true;\n\t\t\t\tthis.items.forEach( update );\n\t\t\t\tthis.updating = false;\n\t\t\t} else if ( this.isRoot ) {\n\t\t\t\trunloop.addFragmentToRoot( this );\n\t\t\t}\n\t\t}\n\t}\n\n\tvalueOf () {\n\t\tif ( this.items.length === 1 ) {\n\t\t\treturn this.items[0].valueOf();\n\t\t}\n\n\t\tif ( this.dirtyValue ) {\n\t\t\tconst values = {};\n\t\t\tconst source = processItems( this.items, values, this.ractive._guid );\n\t\t\tconst parsed = parseJSON( source, values );\n\n\t\t\tthis.value = parsed ?\n\t\t\t\tparsed.value :\n\t\t\t\tthis.toString();\n\n\t\t\tthis.dirtyValue = false;\n\t\t}\n\n\t\treturn this.value;\n\t}\n}\nFragment.prototype.getContext = getContext;\n","import { TEXT } from 'config/types';\n\n// TODO all this code needs to die\nexport default function processItems ( items, values, guid, counter = 0 ) {\n\treturn items.map( item => {\n\t\tif ( item.type === TEXT ) {\n\t\t\treturn item.template;\n\t\t}\n\n\t\tif ( item.fragment ) {\n\t\t\tif ( item.fragment.iterations ) {\n\t\t\t\treturn item.fragment.iterations.map( fragment => {\n\t\t\t\t\treturn processItems( fragment.items, values, guid, counter );\n\t\t\t\t}).join( '' );\n\t\t\t} else {\n\t\t\t\treturn processItems( item.fragment.items, values, guid, counter );\n\t\t\t}\n\t\t}\n\n\t\tconst placeholderId = `${guid}-${counter++}`;\n\t\tconst model = item.model || item.newModel;\n\n\t\tvalues[ placeholderId ] = model ?\n\t\t\tmodel.wrapper ?\n\t\t\t\tmodel.wrapperValue :\n\t\t\t\tmodel.get() :\n\t\t\tundefined;\n\n\t\treturn '${' + placeholderId + '}';\n\t}).join( '' );\n}\n","import { ALIAS, ANCHOR, COMPONENT, DOCTYPE, ELEMENT, INTERPOLATOR, PARTIAL, SECTION, TRIPLE, YIELDER } from 'config/types';\nimport { ATTRIBUTE, BINDING_FLAG, DECORATOR, EVENT, TRANSITION } from 'config/types';\nimport Alias from './Alias';\nimport Attribute from './element/Attribute';\nimport BindingFlag from './element/BindingFlag';\nimport Component from './Component';\nimport Decorator from './element/Decorator';\nimport Doctype from './Doctype';\nimport Form from './element/specials/Form';\nimport Element from './Element';\nimport EventDirective from './shared/EventDirective';\nimport Interpolator from './Interpolator';\nimport Input from './element/specials/Input';\nimport Mapping from './component/Mapping';\nimport Option from './element/specials/Option';\nimport Partial from './Partial';\nimport Section from './Section';\nimport Select from './element/specials/Select';\nimport Textarea from './element/specials/Textarea';\nimport Text from './Text';\nimport Transition from './element/Transition';\nimport Triple from './Triple';\n//import Yielder from './Yielder';\nimport getComponentConstructor from './component/getComponentConstructor';\nimport findElement from './shared/findElement';\n\nconst constructors = {};\nconstructors[ ALIAS ] = Alias;\nconstructors[ ANCHOR ] = Component;\nconstructors[ DOCTYPE ] = Doctype;\nconstructors[ INTERPOLATOR ] = Interpolator;\nconstructors[ PARTIAL ] = Partial;\nconstructors[ SECTION ] = Section;\nconstructors[ TRIPLE ] = Triple;\nconstructors[ YIELDER ] = Partial;\n\nconstructors[ ATTRIBUTE ] = Attribute;\nconstructors[ BINDING_FLAG ] = BindingFlag;\nconstructors[ DECORATOR ] = Decorator;\nconstructors[ EVENT ] = EventDirective;\nconstructors[ TRANSITION ] = Transition;\n\nconst specialElements = {\n\tdoctype: Doctype,\n\tform: Form,\n\tinput: Input,\n\toption: Option,\n\tselect: Select,\n\ttextarea: Textarea\n};\n\nexport default function createItem ( options ) {\n\tif ( typeof options.template === 'string' ) {\n\t\treturn new Text( options );\n\t}\n\n\tif ( options.template.t === ELEMENT ) {\n\t\t// could be component or element\n\t\tconst ComponentConstructor = getComponentConstructor( options.parentFragment.ractive, options.template.e );\n\t\tif ( ComponentConstructor ) {\n\t\t\treturn new Component( options, ComponentConstructor );\n\t\t}\n\n\t\tconst tagName = options.template.e.toLowerCase();\n\n\t\tconst ElementConstructor = specialElements[ tagName ] || Element;\n\t\treturn new ElementConstructor( options );\n\t}\n\n\tlet Item;\n\n\t// component mappings are a special case of attribute\n\tif ( options.template.t === ATTRIBUTE ) {\n\t\tlet el = options.owner;\n\t\tif ( !el || ( el.type !== ANCHOR && el.type !== COMPONENT && el.type !== ELEMENT ) ) {\n\t\t\tel = findElement( options.parentFragment );\n\t\t}\n\t\toptions.element = el;\n\n\t\tItem = el.type === COMPONENT || el.type === ANCHOR ? Mapping : Attribute;\n\t} else {\n\t\tItem = constructors[ options.template.t ];\n\t}\n\n\tif ( !Item ) throw new Error( `Unrecognised item type ${options.template.t}` );\n\n\treturn new Item( options );\n}\n","import { noRegistryFunctionReturn } from '../../../config/errors';\nimport { warnIfDebug } from '../../../utils/log';\nimport { findInstance } from '../../../shared/registry';\n\n// finds the component constructor in the registry or view hierarchy registries\nexport default function getComponentConstructor ( ractive, name ) {\n\tconst instance = findInstance( 'components', ractive, name );\n\tlet Component;\n\n\tif ( instance ) {\n\t\tComponent = instance.components[ name ];\n\n\t\t// best test we have for not Ractive.extend\n\t\tif ( Component && !Component.Parent ) {\n\t\t\t// function option, execute and store for reset\n\t\t\tconst fn = Component.bind( instance );\n\t\t\tfn.isOwner = instance.components.hasOwnProperty( name );\n\t\t\tComponent = fn();\n\n\t\t\tif ( !Component ) {\n\t\t\t\twarnIfDebug( noRegistryFunctionReturn, name, 'component', 'component', { ractive });\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( typeof Component === 'string' ) {\n\t\t\t\t// allow string lookup\n\t\t\t\tComponent = getComponentConstructor( ractive, Component );\n\t\t\t}\n\n\t\t\tComponent._fn = fn;\n\t\t\tinstance.components[ name ] = Component;\n\t\t}\n\t}\n\n\treturn Component;\n}\n","import { createDocumentFragment, matches } from 'utils/dom';\nimport { detachNode } from 'utils/dom';\nimport { decodeCharacterReferences } from 'utils/html';\nimport runloop from 'src/global/runloop';\nimport Mustache from './shared/Mustache';\nimport insertHtml from './triple/insertHtml';\nimport { inAttribute } from './element/Attribute';\n\nexport default class Triple extends Mustache {\n\tconstructor ( options ) {\n\t\tsuper( options );\n\t}\n\n\tdetach () {\n\t\tconst docFrag = createDocumentFragment();\n\t\tif ( this.nodes ) this.nodes.forEach( node => docFrag.appendChild( node ) );\n\t\treturn docFrag;\n\t}\n\n\tfind ( selector ) {\n\t\tconst len = this.nodes.length;\n\t\tlet i;\n\n\t\tfor ( i = 0; i < len; i += 1 ) {\n\t\t\tconst node = this.nodes[i];\n\n\t\t\tif ( node.nodeType !== 1 ) continue;\n\n\t\t\tif ( matches( node, selector ) ) return node;\n\n\t\t\tconst queryResult = node.querySelector( selector );\n\t\t\tif ( queryResult ) return queryResult;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tfindAll ( selector, options ) {\n\t\tconst { result } = options;\n\t\tconst len = this.nodes.length;\n\t\tlet i;\n\n\t\tfor ( i = 0; i < len; i += 1 ) {\n\t\t\tconst node = this.nodes[i];\n\n\t\t\tif ( node.nodeType !== 1 ) continue;\n\n\t\t\tif ( matches( node, selector ) ) result.push( node );\n\n\t\t\tconst queryAllResult = node.querySelectorAll( selector );\n\t\t\tif ( queryAllResult ) {\n\t\t\t\tresult.push.apply( result, queryAllResult );\n\t\t\t}\n\t\t}\n\t}\n\n\tfindComponent () {\n\t\treturn null;\n\t}\n\n\tfirstNode () {\n\t\treturn this.rendered && this.nodes[0];\n\t}\n\n\trender ( target, occupants ) {\n\t\tconst parentNode = this.parentFragment.findParentNode();\n\n\t\tif ( !this.nodes ) {\n\t\t\tconst html = this.model ? this.model.get() : '';\n\t\t\tthis.nodes = insertHtml( html, this.parentFragment.findParentNode(), target );\n\t\t}\n\n\t\tlet nodes = this.nodes;\n\t\tlet anchor = this.parentFragment.findNextNode( this );\n\n\t\t// progressive enhancement\n\t\tif ( occupants ) {\n\t\t\tlet i = -1;\n\t\t\tlet next;\n\n\t\t\t// start with the first node that should be rendered\n\t\t\twhile ( occupants.length && ( next = this.nodes[ i + 1 ] ) ) {\n\t\t\t\tlet n;\n\t\t\t\t// look through the occupants until a matching node is found\n\t\t\t\twhile ( n = occupants.shift() ) {\n\t\t\t\t\tconst t = n.nodeType;\n\n\t\t\t\t\tif ( t === next.nodeType && ( ( t === 1 && n.outerHTML === next.outerHTML ) || ( ( t === 3 || t === 8 ) && n.nodeValue === next.nodeValue ) ) ) {\n\t\t\t\t\t\tthis.nodes.splice( ++i, 1, n ); // replace the generated node with the existing one\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttarget.removeChild( n ); // remove the non-matching existing node\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( i >= 0 ) {\n\t\t\t\t// update the list of remaining nodes to attach, excluding any that were replaced by existing nodes\n\t\t\t\tnodes = this.nodes.slice( i );\n\t\t\t}\n\n\t\t\t// update the anchor to be the next occupant\n\t\t\tif ( occupants.length ) anchor = occupants[0];\n\t\t}\n\n\t\t// attach any remainging nodes to the parent\n\t\tif ( nodes.length ) {\n\t\t\tconst frag = createDocumentFragment();\n\t\t\tnodes.forEach( n => frag.appendChild( n ) );\n\n\t\t\tif ( anchor ) {\n\t\t\t\tanchor.parentNode.insertBefore( frag, anchor );\n\t\t\t} else {\n\t\t\t\tparentNode.appendChild( frag );\n\t\t\t}\n\t\t}\n\n\t\tthis.rendered = true;\n\t}\n\n\ttoString () {\n\t\tlet value = this.model && this.model.get();\n\t\tvalue = value != null ? '' + value : '';\n\n\t\treturn inAttribute() ? decodeCharacterReferences( value ) : value;\n\t}\n\n\tunrender () {\n\t\tif ( this.nodes ) this.nodes.forEach( node => {\n\t\t\t// defer detachment until all relevant outros are done\n\t\t\trunloop.detachWhenReady( { node, detach() { detachNode( node ); } } );\n\t\t});\n\t\tthis.rendered = false;\n\t\tthis.nodes = null;\n\t}\n\n\tupdate () {\n\t\tif ( this.rendered && this.dirty ) {\n\t\t\tthis.dirty = false;\n\n\t\t\tthis.unrender();\n\t\t\tthis.render();\n\t\t} else {\n\t\t\t// make sure to reset the dirty flag even if not rendered\n\t\t\tthis.dirty = false;\n\t\t}\n\t}\n}\n","import { svg } from 'config/namespaces';\nimport { createElement } from 'utils/dom';\n\nconst elementCache = {};\n\nlet ieBug;\nlet ieBlacklist;\n\ntry {\n\tcreateElement( 'table' ).innerHTML = 'foo';\n} catch /* istanbul ignore next */ ( err ) {\n\tieBug = true;\n\n\tieBlacklist = {\n\t\tTABLE: [ '