Plato on Github
Report Home
src\vendor\cycle-snabbdom.js
Maintainability
64.38
Lines of code
4897
Difficulty
163.29
Estimated Errors
60.45
Function weight
By Complexity
By SLOC
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.CycleSnabbdom = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ /*! * Cross-Browser Split 1.1.1 * Copyright 2007-2012 Steven Levithan <stevenlevithan.com> * Available under the MIT License * ECMAScript compliant, uniform cross-browser split method */ /** * Splits a string into an array of strings using a regex or string separator. Matches of the * separator are not included in the result array. However, if `separator` is a regex that contains * capturing groups, backreferences are spliced into the result each time `separator` is matched. * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably * cross-browser. * @param {String} str String to split. * @param {RegExp|String} separator Regex or string to use for separating the string. * @param {Number} [limit] Maximum number of items to include in the result array. * @returns {Array} Array of substrings. * @example * * // Basic use * split('a b c d', ' '); * // -> ['a', 'b', 'c', 'd'] * * // With limit * split('a b c d', ' ', 2); * // -> ['a', 'b'] * * // Backreferences in result array * split('..word1 word2..', /([a-z]+)(\d+)/i); * // -> ['..', 'word', '1', ' ', 'word', '2', '..'] */ module.exports = (function split(undef) { var nativeSplit = String.prototype.split, compliantExecNpcg = /()??/.exec("")[1] === undef, // NPCG: nonparticipating capturing group self; self = function(str, separator, limit) { // If `separator` is not a regex, use `nativeSplit` if (Object.prototype.toString.call(separator) !== "[object RegExp]") { return nativeSplit.call(str, separator, limit); } var output = [], flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.extended ? "x" : "") + // Proposed for ES6 (separator.sticky ? "y" : ""), // Firefox 3+ lastLastIndex = 0, // Make `global` and avoid `lastIndex` issues by working with a copy separator = new RegExp(separator.source, flags + "g"), separator2, match, lastIndex, lastLength; str += ""; // Type-convert if (!compliantExecNpcg) { // Doesn't need flags gy, but they don't hurt separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags); } /* Values for `limit`, per the spec: * If undefined: 4294967295 // Math.pow(2, 32) - 1 * If 0, Infinity, or NaN: 0 * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296; * If negative number: 4294967296 - Math.floor(Math.abs(limit)) * If other: Type-convert, then use the above rules */ limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1 limit >>> 0; // ToUint32(limit) while (match = separator.exec(str)) { // `separator.lastIndex` is not reliable cross-browser lastIndex = match.index + match[0].length; if (lastIndex > lastLastIndex) { output.push(str.slice(lastLastIndex, match.index)); // Fix browsers whose `exec` methods don't consistently return `undefined` for // nonparticipating capturing groups if (!compliantExecNpcg && match.length > 1) { match[0].replace(separator2, function() { for (var i = 1; i < arguments.length - 2; i++) { if (arguments[i] === undef) { match[i] = undef; } } }); } if (match.length > 1 && match.index < str.length) { Array.prototype.push.apply(output, match.slice(1)); } lastLength = match[0].length; lastLastIndex = lastIndex; if (output.length >= limit) { break; } } if (separator.lastIndex === match.index) { separator.lastIndex++; // Avoid an infinite loop } } if (lastLastIndex === str.length) { if (lastLength || !separator.test("")) { output.push(""); } } else { output.push(str.slice(lastLastIndex)); } return output.length > limit ? output.slice(0, limit) : output; }; return self; })(); },{}],2:[function(require,module,exports){ /** * lodash 3.1.4 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ var isArguments = require('lodash.isarguments'), isArray = require('lodash.isarray'); /** * Checks if `value` is object-like. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) * of an array-like value. */ var MAX_SAFE_INTEGER = 9007199254740991; /** * Appends the elements of `values` to `array`. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to append. * @returns {Array} Returns `array`. */ function arrayPush(array, values) { var index = -1, length = values.length, offset = array.length; while (++index < length) { array[offset + index] = values[index]; } return array; } /** * The base implementation of `_.flatten` with added support for restricting * flattening and specifying the start index. * * @private * @param {Array} array The array to flatten. * @param {boolean} [isDeep] Specify a deep flatten. * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. * @param {Array} [result=[]] The initial result value. * @returns {Array} Returns the new flattened array. */ function baseFlatten(array, isDeep, isStrict, result) { result || (result = []); var index = -1, length = array.length; while (++index < length) { var value = array[index]; if (isObjectLike(value) && isArrayLike(value) && (isStrict || isArray(value) || isArguments(value))) { if (isDeep) { // Recursively flatten arrays (susceptible to call stack limits). baseFlatten(value, isDeep, isStrict, result); } else { arrayPush(result, value); } } else if (!isStrict) { result[result.length] = value; } } return result; } /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } /** * Gets the "length" property value of `object`. * * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) * that affects Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. * @returns {*} Returns the "length" value. */ var getLength = baseProperty('length'); /** * Checks if `value` is array-like. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. */ function isArrayLike(value) { return value != null && isLength(getLength(value)); } /** * Checks if `value` is a valid array-like length. * * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } module.exports = baseFlatten; },{"lodash.isarguments":14,"lodash.isarray":15}],3:[function(require,module,exports){ /** * lodash 3.0.3 (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ /** * The base implementation of `baseForIn` and `baseForOwn` which iterates * over `object` properties returned by `keysFunc` invoking `iteratee` for * each property. Iteratee functions may exit iteration early by explicitly * returning `false`. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ var baseFor = createBaseFor(); /** * Creates a base function for methods like `_.forIn`. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseFor(fromRight) { return function(object, iteratee, keysFunc) { var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; while (length--) { var key = props[fromRight ? length : ++index]; if (iteratee(iterable[key], key, iterable) === false) { break; } } return object; }; } module.exports = baseFor; },{}],4:[function(require,module,exports){ /** * lodash 3.1.0 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ /** * The base implementation of `_.indexOf` without support for binary searches. * * @private * @param {Array} array The array to search. * @param {*} value The value to search for. * @param {number} fromIndex The index to search from. * @returns {number} Returns the index of the matched value, else `-1`. */ function baseIndexOf(array, value, fromIndex) { if (value !== value) { return indexOfNaN(array, fromIndex); } var index = fromIndex - 1, length = array.length; while (++index < length) { if (array[index] === value) { return index; } } return -1; } /** * Gets the index at which the first occurrence of `NaN` is found in `array`. * If `fromRight` is provided elements of `array` are iterated from right to left. * * @private * @param {Array} array The array to search. * @param {number} fromIndex The index to search from. * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {number} Returns the index of the matched `NaN`, else `-1`. */ function indexOfNaN(array, fromIndex, fromRight) { var length = array.length, index = fromIndex + (fromRight ? 0 : -1); while ((fromRight ? index-- : ++index < length)) { var other = array[index]; if (other !== other) { return index; } } return -1; } module.exports = baseIndexOf; },{}],5:[function(require,module,exports){ /** * lodash 3.0.3 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ var baseIndexOf = require('lodash._baseindexof'), cacheIndexOf = require('lodash._cacheindexof'), createCache = require('lodash._createcache'); /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** * The base implementation of `_.uniq` without support for callback shorthands * and `this` binding. * * @private * @param {Array} array The array to inspect. * @param {Function} [iteratee] The function invoked per iteration. * @returns {Array} Returns the new duplicate-value-free array. */ function baseUniq(array, iteratee) { var index = -1, indexOf = baseIndexOf, length = array.length, isCommon = true, isLarge = isCommon && length >= LARGE_ARRAY_SIZE, seen = isLarge ? createCache() : null, result = []; if (seen) { indexOf = cacheIndexOf; isCommon = false; } else { isLarge = false; seen = iteratee ? [] : result; } outer: while (++index < length) { var value = array[index], computed = iteratee ? iteratee(value, index, array) : value; if (isCommon && value === value) { var seenIndex = seen.length; while (seenIndex--) { if (seen[seenIndex] === computed) { continue outer; } } if (iteratee) { seen.push(computed); } result.push(value); } else if (indexOf(seen, computed, 0) < 0) { if (iteratee || isLarge) { seen.push(computed); } result.push(value); } } return result; } module.exports = baseUniq; },{"lodash._baseindexof":4,"lodash._cacheindexof":7,"lodash._createcache":8}],6:[function(require,module,exports){ /** * lodash 3.0.1 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ /** * A specialized version of `baseCallback` which only supports `this` binding * and specifying the number of arguments to provide to `func`. * * @private * @param {Function} func The function to bind. * @param {*} thisArg The `this` binding of `func`. * @param {number} [argCount] The number of arguments to provide to `func`. * @returns {Function} Returns the callback. */ function bindCallback(func, thisArg, argCount) { if (typeof func != 'function') { return identity; } if (thisArg === undefined) { return func; } switch (argCount) { case 1: return function(value) { return func.call(thisArg, value); }; case 3: return function(value, index, collection) { return func.call(thisArg, value, index, collection); }; case 4: return function(accumulator, value, index, collection) { return func.call(thisArg, accumulator, value, index, collection); }; case 5: return function(value, other, key, object, source) { return func.call(thisArg, value, other, key, object, source); }; } return function() { return func.apply(thisArg, arguments); }; } /** * This method returns the first argument provided to it. * * @static * @memberOf _ * @category Utility * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'user': 'fred' }; * * _.identity(object) === object; * // => true */ function identity(value) { return value; } module.exports = bindCallback; },{}],7:[function(require,module,exports){ /** * lodash 3.0.2 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ /** * Checks if `value` is in `cache` mimicking the return signature of * `_.indexOf` by returning `0` if the value is found, else `-1`. * * @private * @param {Object} cache The cache to search. * @param {*} value The value to search for. * @returns {number} Returns `0` if `value` is found, else `-1`. */ function cacheIndexOf(cache, value) { var data = cache.data, result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value]; return result ? 0 : -1; } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(1); * // => false */ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return !!value && (type == 'object' || type == 'function'); } module.exports = cacheIndexOf; },{}],8:[function(require,module,exports){ (function (global){ /** * lodash 3.1.2 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ var getNative = require('lodash._getnative'); /** Native method references. */ var Set = getNative(global, 'Set'); /* Native method references for those with the same name as other `lodash` methods. */ var nativeCreate = getNative(Object, 'create'); /** * * Creates a cache object to store unique values. * * @private * @param {Array} [values] The values to cache. */ function SetCache(values) { var length = values ? values.length : 0; this.data = { 'hash': nativeCreate(null), 'set': new Set }; while (length--) { this.push(values[length]); } } /** * Adds `value` to the cache. * * @private * @name push * @memberOf SetCache * @param {*} value The value to cache. */ function cachePush(value) { var data = this.data; if (typeof value == 'string' || isObject(value)) { data.set.add(value); } else { data.hash[value] = true; } } /** * Creates a `Set` cache object to optimize linear searches of large arrays. * * @private * @param {Array} [values] The values to cache. * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`. */ function createCache(values) { return (nativeCreate && Set) ? new SetCache(values) : null; } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(1); * // => false */ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return !!value && (type == 'object' || type == 'function'); } // Add functions to the `Set` cache. SetCache.prototype.push = cachePush; module.exports = createCache; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"lodash._getnative":9}],9:[function(require,module,exports){ /** * lodash 3.9.1 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ /** `Object#toString` result references. */ var funcTag = '[object Function]'; /** Used to detect host constructors (Safari > 5). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** * Checks if `value` is object-like. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** Used for native method references. */ var objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var fnToString = Function.prototype.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objToString = objectProto.toString; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = object == null ? undefined : object[key]; return isNative(value) ? value : undefined; } /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in older versions of Chrome and Safari which return 'function' for regexes // and Safari 8 equivalents which return 'object' for typed array constructors. return isObject(value) && objToString.call(value) == funcTag; } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(1); * // => false */ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is a native function. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, else `false`. * @example * * _.isNative(Array.prototype.push); * // => true * * _.isNative(_); * // => false */ function isNative(value) { if (value == null) { return false; } if (isFunction(value)) { return reIsNative.test(fnToString.call(value)); } return isObjectLike(value) && reIsHostCtor.test(value); } module.exports = getNative; },{}],10:[function(require,module,exports){ (function (global){ /** * lodash 3.0.1 (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ /** Used to determine if values are of the language type `Object`. */ var objectTypes = { 'function': true, 'object': true }; /** Detect free variable `exports`. */ var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : undefined; /** Detect free variable `module`. */ var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : undefined; /** Detect free variable `global` from Node.js. */ var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global); /** Detect free variable `self`. */ var freeSelf = checkGlobal(objectTypes[typeof self] && self); /** Detect free variable `window`. */ var freeWindow = checkGlobal(objectTypes[typeof window] && window); /** Detect `this` as the global object. */ var thisGlobal = checkGlobal(objectTypes[typeof this] && this); /** * Used as a reference to the global object. * * The `this` value is used if it's the global object to avoid Greasemonkey's * restricted `window` object, otherwise the `window` object is used. */ var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); /** * Checks if `value` is a global object. * * @private * @param {*} value The value to check. * @returns {null|Object} Returns `value` if it's a global object, else `null`. */ function checkGlobal(value) { return (value && value.Object === Object) ? value : null; } module.exports = root; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],11:[function(require,module,exports){ /** * lodash 3.2.0 (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ var root = require('lodash._root'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; /** Used to match latin-1 supplementary letters (excluding mathematical operators). */ var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g; /** Used to compose unicode character classes. */ var rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', rsComboSymbolsRange = '\\u20d0-\\u20f0'; /** Used to compose unicode capture groups. */ var rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']'; /** * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). */ var reComboMark = RegExp(rsCombo, 'g'); /** Used to map latin-1 supplementary letters to basic latin letters. */ var deburredLetters = { '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', '\xc7': 'C', '\xe7': 'c', '\xd0': 'D', '\xf0': 'd', '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', '\xcC': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', '\xeC': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', '\xd1': 'N', '\xf1': 'n', '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', '\xc6': 'Ae', '\xe6': 'ae', '\xde': 'Th', '\xfe': 'th', '\xdf': 'ss' }; /** * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters. * * @private * @param {string} letter The matched letter to deburr. * @returns {string} Returns the deburred letter. */ function deburrLetter(letter) { return deburredLetters[letter]; } /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Built-in value references. */ var Symbol = root.Symbol; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolToString = Symbol ? symbolProto.toString : undefined; /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && objectToString.call(value) == symbolTag); } /** * Converts `value` to a string if it's not one. An empty string is returned * for `null` and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @category Lang * @param {*} value The value to process. * @returns {string} Returns the string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (value == null) { return ''; } if (isSymbol(value)) { return Symbol ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to deburr. * @returns {string} Returns the deburred string. * @example * * _.deburr('déjà vu'); * // => 'deja vu' */ function deburr(string) { string = toString(string); return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, ''); } module.exports = deburr; },{"lodash._root":10}],12:[function(require,module,exports){ /** * lodash 3.2.0 (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ var root = require('lodash._root'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; /** Used to match HTML entities and HTML characters. */ var reUnescapedHtml = /[&<>"'`]/g, reHasUnescapedHtml = RegExp(reUnescapedHtml.source); /** Used to map characters to HTML entities. */ var htmlEscapes = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '`': '`' }; /** * Used by `_.escape` to convert characters to HTML entities. * * @private * @param {string} chr The matched character to escape. * @returns {string} Returns the escaped character. */ function escapeHtmlChar(chr) { return htmlEscapes[chr]; } /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Built-in value references. */ var Symbol = root.Symbol; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolToString = Symbol ? symbolProto.toString : undefined; /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && objectToString.call(value) == symbolTag); } /** * Converts `value` to a string if it's not one. An empty string is returned * for `null` and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @category Lang * @param {*} value The value to process. * @returns {string} Returns the string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (value == null) { return ''; } if (isSymbol(value)) { return Symbol ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * Converts the characters "&", "<", ">", '"', "'", and "\`" in `string` to * their corresponding HTML entities. * * **Note:** No other characters are escaped. To escape additional * characters use a third-party library like [_he_](https://mths.be/he). * * Though the ">" character is escaped for symmetry, characters like * ">" and "/" don't need escaping in HTML and have no special meaning * unless they're part of a tag or unquoted attribute value. * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands) * (under "semi-related fun fact") for more details. * * Backticks are escaped because in IE < 9, they can break out of * attribute values or HTML comments. See [#59](https://html5sec.org/#59), * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/) * for more details. * * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping) * to reduce XSS vectors. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped string. * @example * * _.escape('fred, barney, & pebbles'); * // => 'fred, barney, & pebbles' */ function escape(string) { string = toString(string); return (string && reHasUnescapedHtml.test(string)) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string; } module.exports = escape; },{"lodash._root":10}],13:[function(require,module,exports){ /** * lodash 3.0.2 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ var baseFor = require('lodash._basefor'), bindCallback = require('lodash._bindcallback'), keys = require('lodash.keys'); /** * The base implementation of `_.forOwn` without support for callback * shorthands and `this` binding. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Object} Returns `object`. */ function baseForOwn(object, iteratee) { return baseFor(object, iteratee, keys); } /** * Creates a function for `_.forOwn` or `_.forOwnRight`. * * @private * @param {Function} objectFunc The function to iterate over an object. * @returns {Function} Returns the new each function. */ function createForOwn(objectFunc) { return function(object, iteratee, thisArg) { if (typeof iteratee != 'function' || thisArg !== undefined) { iteratee = bindCallback(iteratee, thisArg, 3); } return objectFunc(object, iteratee); }; } /** * Iterates over own enumerable properties of an object invoking `iteratee` * for each property. The `iteratee` is bound to `thisArg` and invoked with * three arguments: (value, key, object). Iteratee functions may exit iteration * early by explicitly returning `false`. * * @static * @memberOf _ * @category Object * @param {Object} object The object to iterate over. * @param {Function} [iteratee=_.identity] The function invoked per iteration. * @param {*} [thisArg] The `this` binding of `iteratee`. * @returns {Object} Returns `object`. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.forOwn(new Foo, function(value, key) { * console.log(key); * }); * // => logs 'a' and 'b' (iteration order is not guaranteed) */ var forOwn = createForOwn(baseForOwn); module.exports = forOwn; },{"lodash._basefor":3,"lodash._bindcallback":6,"lodash.keys":17}],14:[function(require,module,exports){ /** * lodash 3.0.8 (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]'; /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Built-in value references. */ var propertyIsEnumerable = objectProto.propertyIsEnumerable; /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } /** * Gets the "length" property value of `object`. * * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) * that affects Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. * @returns {*} Returns the "length" value. */ var getLength = baseProperty('length'); /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ function isArguments(value) { // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(getLength(value)) && !isFunction(value); } /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 8 which returns 'object' for typed array and weak map constructors, // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } /** * Checks if `value` is a valid array-like length. * * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && typeof value == 'object'; } module.exports = isArguments; },{}],15:[function(require,module,exports){ /** * lodash 3.0.4 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ /** `Object#toString` result references. */ var arrayTag = '[object Array]', funcTag = '[object Function]'; /** Used to detect host constructors (Safari > 5). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** * Checks if `value` is object-like. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** Used for native method references. */ var objectProto = Object.prototype; /** Used to resolve the decompiled source of functions. */ var fnToString = Function.prototype.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objToString = objectProto.toString; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /* Native method references for those with the same name as other `lodash` methods. */ var nativeIsArray = getNative(Array, 'isArray'); /** * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) * of an array-like value. */ var MAX_SAFE_INTEGER = 9007199254740991; /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = object == null ? undefined : object[key]; return isNative(value) ? value : undefined; } /** * Checks if `value` is a valid array-like length. * * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(function() { return arguments; }()); * // => false */ var isArray = nativeIsArray || function(value) { return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; }; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in older versions of Chrome and Safari which return 'function' for regexes // and Safari 8 equivalents which return 'object' for typed array constructors. return isObject(value) && objToString.call(value) == funcTag; } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(1); * // => false */ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is a native function. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, else `false`. * @example * * _.isNative(Array.prototype.push); * // => true * * _.isNative(_); * // => false */ function isNative(value) { if (value == null) { return false; } if (isFunction(value)) { return reIsNative.test(fnToString.call(value)); } return isObjectLike(value) && reIsHostCtor.test(value); } module.exports = isArray; },{}],16:[function(require,module,exports){ /** * lodash 3.1.1 (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ var deburr = require('lodash.deburr'), words = require('lodash.words'); /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. * * @private * @param {Array} array The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, length = array.length; if (initAccum && length) { accumulator = array[++index]; } while (++index < length) { accumulator = iteratee(accumulator, array[index], index, array); } return accumulator; } /** * Creates a function like `_.camelCase`. * * @private * @param {Function} callback The function to combine each word. * @returns {Function} Returns the new compounder function. */ function createCompounder(callback) { return function(string) { return arrayReduce(words(deburr(string)), callback, ''); }; } /** * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to convert. * @returns {string} Returns the kebab cased string. * @example * * _.kebabCase('Foo Bar'); * // => 'foo-bar' * * _.kebabCase('fooBar'); * // => 'foo-bar' * * _.kebabCase('__foo_bar__'); * // => 'foo-bar' */ var kebabCase = createCompounder(function(result, word, index) { return result + (index ? '-' : '') + word.toLowerCase(); }); module.exports = kebabCase; },{"lodash.deburr":11,"lodash.words":20}],17:[function(require,module,exports){ /** * lodash 3.1.2 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ var getNative = require('lodash._getnative'), isArguments = require('lodash.isarguments'), isArray = require('lodash.isarray'); /** Used to detect unsigned integer values. */ var reIsUint = /^\d+$/; /** Used for native method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /* Native method references for those with the same name as other `lodash` methods. */ var nativeKeys = getNative(Object, 'keys'); /** * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) * of an array-like value. */ var MAX_SAFE_INTEGER = 9007199254740991; /** * The base implementation of `_.property` without support for deep paths. * * @private * @param {string} key The key of the property to get. * @returns {Function} Returns the new function. */ function baseProperty(key) { return function(object) { return object == null ? undefined : object[key]; }; } /** * Gets the "length" property value of `object`. * * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) * that affects Safari on at least iOS 8.1-8.3 ARM64. * * @private * @param {Object} object The object to query. * @returns {*} Returns the "length" value. */ var getLength = baseProperty('length'); /** * Checks if `value` is array-like. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. */ function isArrayLike(value) { return value != null && isLength(getLength(value)); } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; length = length == null ? MAX_SAFE_INTEGER : length; return value > -1 && value % 1 == 0 && value < length; } /** * Checks if `value` is a valid array-like length. * * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * A fallback implementation of `Object.keys` which creates an array of the * own enumerable property names of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function shimKeys(object) { var props = keysIn(object), propsLength = props.length, length = propsLength && object.length; var allowIndexes = !!length && isLength(length) && (isArray(object) || isArguments(object)); var index = -1, result = []; while (++index < propsLength) { var key = props[index]; if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { result.push(key); } } return result; } /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(1); * // => false */ function isObject(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) * for more details. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ var keys = !nativeKeys ? shimKeys : function(object) { var Ctor = object == null ? undefined : object.constructor; if ((typeof Ctor == 'function' && Ctor.prototype === object) || (typeof object != 'function' && isArrayLike(object))) { return shimKeys(object); } return isObject(object) ? nativeKeys(object) : []; }; /** * Creates an array of the own and inherited enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { if (object == null) { return []; } if (!isObject(object)) { object = Object(object); } var length = object.length; length = (length && isLength(length) && (isArray(object) || isArguments(object)) && length) || 0; var Ctor = object.constructor, index = -1, isProto = typeof Ctor == 'function' && Ctor.prototype === object, result = Array(length), skipIndexes = length > 0; while (++index < length) { result[index] = (index + ''); } for (var key in object) { if (!(skipIndexes && isIndex(key, length)) && !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } return result; } module.exports = keys; },{"lodash._getnative":9,"lodash.isarguments":14,"lodash.isarray":15}],18:[function(require,module,exports){ /** * lodash 3.6.1 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; /* Native method references for those with the same name as other `lodash` methods. */ var nativeMax = Math.max; /** * Creates a function that invokes `func` with the `this` binding of the * created function and arguments from `start` and beyond provided as an array. * * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters). * * @static * @memberOf _ * @category Function * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @returns {Function} Returns the new function. * @example * * var say = _.restParam(function(what, names) { * return what + ' ' + _.initial(names).join(', ') + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); * }); * * say('hello', 'fred', 'barney', 'pebbles'); * // => 'hello fred, barney, & pebbles' */ function restParam(func, start) { if (typeof func != 'function') { throw new TypeError(FUNC_ERROR_TEXT); } start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); return function() { var args = arguments, index = -1, length = nativeMax(args.length - start, 0), rest = Array(length); while (++index < length) { rest[index] = args[start + index]; } switch (start) { case 0: return func.call(this, rest); case 1: return func.call(this, args[0], rest); case 2: return func.call(this, args[0], args[1], rest); } var otherArgs = Array(start + 1); index = -1; while (++index < start) { otherArgs[index] = args[index]; } otherArgs[start] = rest; return func.apply(this, otherArgs); }; } module.exports = restParam; },{}],19:[function(require,module,exports){ /** * lodash 3.1.0 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.2 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ var baseFlatten = require('lodash._baseflatten'), baseUniq = require('lodash._baseuniq'), restParam = require('lodash.restparam'); /** * Creates an array of unique values, in order, of the provided arrays using * `SameValueZero` for equality comparisons. * * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) * comparisons are like strict equality comparisons, e.g. `===`, except that * `NaN` matches `NaN`. * * @static * @memberOf _ * @category Array * @param {...Array} [arrays] The arrays to inspect. * @returns {Array} Returns the new array of combined values. * @example * * _.union([1, 2], [4, 2], [2, 1]); * // => [1, 2, 4] */ var union = restParam(function(arrays) { return baseUniq(baseFlatten(arrays, false, true)); }); module.exports = union; },{"lodash._baseflatten":2,"lodash._baseuniq":5,"lodash.restparam":18}],20:[function(require,module,exports){ /** * lodash 3.2.0 (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ var root = require('lodash._root'); /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; /** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', rsComboSymbolsRange = '\\u20d0-\\u20f0', rsDingbatRange = '\\u2700-\\u27bf', rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', rsQuoteRange = '\\u2018\\u2019\\u201c\\u201d', rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', rsVarRange = '\\ufe0e\\ufe0f', rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange; /** Used to compose unicode capture groups. */ var rsBreak = '[' + rsBreakRange + ']', rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', rsDigits = '\\d+', rsDingbat = '[' + rsDingbatRange + ']', rsLower = '[' + rsLowerRange + ']', rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', rsFitz = '\\ud83c[\\udffb-\\udfff]', rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', rsNonAstral = '[^' + rsAstralRange + ']', rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsUpper = '[' + rsUpperRange + ']', rsZWJ = '\\u200d'; /** Used to compose unicode regexes. */ var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')', rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')', reOptMod = rsModifier + '?', rsOptVar = '[' + rsVarRange + ']?', rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq; /** Used to match non-compound words composed of alphanumeric characters. */ var reBasicWord = /[a-zA-Z0-9]+/g; /** Used to match complex or compound words. */ var reComplexWord = RegExp([ rsUpper + '?' + rsLower + '+(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', rsUpperMisc + '+(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', rsUpper + '?' + rsLowerMisc + '+', rsUpper + '+', rsDigits, rsEmoji ].join('|'), 'g'); /** Used to detect strings that need a more robust regexp to match words. */ var reHasComplexWord = /[a-z][A-Z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; /** Used for built-in method references. */ var objectProto = Object.prototype; /** * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Built-in value references. */ var Symbol = root.Symbol; /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolToString = Symbol ? symbolProto.toString : undefined; /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return typeof value == 'symbol' || (isObjectLike(value) && objectToString.call(value) == symbolTag); } /** * Converts `value` to a string if it's not one. An empty string is returned * for `null` and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @category Lang * @param {*} value The value to process. * @returns {string} Returns the string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (value == null) { return ''; } if (isSymbol(value)) { return Symbol ? symbolToString.call(value) : ''; } var result = (value + ''); return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } /** * Splits `string` into an array of its words. * * @static * @memberOf _ * @category String * @param {string} [string=''] The string to inspect. * @param {RegExp|string} [pattern] The pattern to match words. * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. * @returns {Array} Returns the words of `string`. * @example * * _.words('fred, barney, & pebbles'); * // => ['fred', 'barney', 'pebbles'] * * _.words('fred, barney, & pebbles', /[^, ]+/g); * // => ['fred', 'barney', '&', 'pebbles'] */ function words(string, pattern, guard) { string = toString(string); pattern = guard ? undefined : pattern; if (pattern === undefined) { pattern = reHasComplexWord.test(string) ? reComplexWord : reBasicWord; } return string.match(pattern) || []; } module.exports = words; },{"lodash._root":10}],21:[function(require,module,exports){ 'use strict'; var proto = Element.prototype; var vendor = proto.matches || proto.matchesSelector || proto.webkitMatchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector; module.exports = match; /** * Match `el` to `selector`. * * @param {Element} el * @param {String} selector * @return {Boolean} * @api public */ function match(el, selector) { if (vendor) return vendor.call(el, selector); var nodes = el.parentNode.querySelectorAll(selector); for (var i = 0; i < nodes.length; i++) { if (nodes[i] == el) return true; } return false; } },{}],22:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = classNameFromVNode; var _selectorParser2 = require('./selectorParser'); var _selectorParser3 = _interopRequireDefault(_selectorParser2); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function classNameFromVNode(vNode) { var _selectorParser = (0, _selectorParser3.default)(vNode.sel); var cn = _selectorParser.className; if (!vNode.data) { return cn; } var _vNode$data = vNode.data; var dataClass = _vNode$data.class; var props = _vNode$data.props; if (dataClass) { var c = Object.keys(vNode.data.class).filter(function (cl) { return vNode.data.class[cl]; }); cn += ' ' + c.join(' '); } if (props && props.className) { cn += ' ' + props.className; } return cn.trim(); } },{"./selectorParser":23}],23:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = selectorParser; var _browserSplit = require('browser-split'); var _browserSplit2 = _interopRequireDefault(_browserSplit); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var classIdSplit = /([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/; var notClassId = /^\.|#/; function selectorParser() { var selector = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; var tagName = void 0; var id = ''; var classes = []; var tagParts = (0, _browserSplit2.default)(selector, classIdSplit); if (notClassId.test(tagParts[1]) || selector === '') { tagName = 'div'; } var part = void 0; var type = void 0; var i = void 0; for (i = 0; i < tagParts.length; i++) { part = tagParts[i]; if (!part) { continue; } type = part.charAt(0); if (!tagName) { tagName = part; } else if (type === '.') { classes.push(part.substring(1, part.length)); } else if (type === '#') { id = part.substring(1, part.length); } } return { tagName: tagName, id: id, className: classes.join(' ') }; } },{"browser-split":1}],24:[function(require,module,exports){ // All SVG children elements, not in this list, should self-close module.exports = { // http://www.w3.org/TR/SVG/intro.html#TermContainerElement 'a': true, 'defs': true, 'glyph': true, 'g': true, 'marker': true, 'mask': true, 'missing-glyph': true, 'pattern': true, 'svg': true, 'switch': true, 'symbol': true, // http://www.w3.org/TR/SVG/intro.html#TermDescriptiveElement 'desc': true, 'metadata': true, 'title': true }; },{}],25:[function(require,module,exports){ var init = require('./init'); module.exports = init([require('./modules/attributes'), require('./modules/style')]); },{"./init":26,"./modules/attributes":27,"./modules/style":28}],26:[function(require,module,exports){ var parseSelector = require('./parse-selector'); var VOID_ELEMENTS = require('./void-elements'); var CONTAINER_ELEMENTS = require('./container-elements'); module.exports = function init(modules) { function parse(data) { return modules.reduce(function (arr, fn) { arr.push(fn(data)); return arr; }, []).filter(function (result) { return result !== ''; }); } return function renderToString(vnode) { if (!vnode.sel && vnode.text) { return vnode.text; } vnode.data = vnode.data || {}; // Support thunks if (typeof vnode.sel === 'string' && vnode.sel.slice(0, 5) === 'thunk') { vnode = vnode.data.fn.apply(null, vnode.data.args); } var tagName = parseSelector(vnode.sel).tagName; var attributes = parse(vnode); var svg = vnode.data.ns === 'http://www.w3.org/2000/svg'; var tag = []; // Open tag tag.push('<' + tagName); if (attributes.length) { tag.push(' ' + attributes.join(' ')); } if (svg && CONTAINER_ELEMENTS[tagName] !== true) { tag.push(' /'); } tag.push('>'); // Close tag, if needed if (VOID_ELEMENTS[tagName] !== true && !svg || svg && CONTAINER_ELEMENTS[tagName] === true) { if (vnode.data.props && vnode.data.props.innerHTML) { tag.push(vnode.data.props.innerHTML); } else if (vnode.text) { tag.push(vnode.text); } else if (vnode.children) { vnode.children.forEach(function (child) { tag.push(renderToString(child)); }); } tag.push('</' + tagName + '>'); } return tag.join(''); }; }; },{"./container-elements":24,"./parse-selector":29,"./void-elements":30}],27:[function(require,module,exports){ var forOwn = require('lodash.forown'); var escape = require('lodash.escape'); var union = require('lodash.union'); var parseSelector = require('../parse-selector'); // data.attrs, data.props, data.class module.exports = function attributes(vnode) { var selector = parseSelector(vnode.sel); var parsedClasses = selector.className.split(' '); var attributes = []; var classes = []; var values = {}; if (selector.id) { values.id = selector.id; } setAttributes(vnode.data.props, values); setAttributes(vnode.data.attrs, values); // `attrs` override `props`, not sure if this is good so if (vnode.data.class) { // Omit `className` attribute if `class` is set on vnode values.class = undefined; } forOwn(vnode.data.class, function (value, key) { if (value === true) { classes.push(key); } }); classes = union(classes, values.class, parsedClasses).filter(function (x) { return x !== ''; }); if (classes.length) { values.class = classes.join(' '); } forOwn(values, function (value, key) { attributes.push(value === true ? key : key + '="' + escape(value) + '"'); }); return attributes.length ? attributes.join(' ') : ''; }; function setAttributes(values, target) { forOwn(values, function (value, key) { if (key === 'htmlFor') { target['for'] = value; return; } if (key === 'className') { target['class'] = value.split(' '); return; } if (key === 'innerHTML') { return; } target[key] = value; }); } },{"../parse-selector":29,"lodash.escape":12,"lodash.forown":13,"lodash.union":19}],28:[function(require,module,exports){ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var forOwn = require('lodash.forown'); var escape = require('lodash.escape'); var kebabCase = require('lodash.kebabcase'); // data.style module.exports = function style(vnode) { var styles = []; var style = vnode.data.style || {}; // merge in `delayed` properties if (style.delayed) { _extends(style, style.delayed); } forOwn(style, function (value, key) { // omit hook objects if (typeof value === 'string') { styles.push(kebabCase(key) + ': ' + escape(value)); } }); return styles.length ? 'style="' + styles.join('; ') + '"' : ''; }; },{"lodash.escape":12,"lodash.forown":13,"lodash.kebabcase":16}],29:[function(require,module,exports){ // https://github.com/Matt-Esch/virtual-dom/blob/master/virtual-hyperscript/parse-tag.js var split = require('browser-split'); var classIdSplit = /([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/; var notClassId = /^\.|#/; module.exports = function parseSelector(selector, upper) { selector = selector || ''; var tagName; var id = ''; var classes = []; var tagParts = split(selector, classIdSplit); if (notClassId.test(tagParts[1]) || selector === '') { tagName = 'div'; } var part, type, i; for (i = 0; i < tagParts.length; i++) { part = tagParts[i]; if (!part) { continue; } type = part.charAt(0); if (!tagName) { tagName = part; } else if (type === '.') { classes.push(part.substring(1, part.length)); } else if (type === '#') { id = part.substring(1, part.length); } } return { tagName: upper === true ? tagName.toUpperCase() : tagName, id: id, className: classes.join(' ') }; }; },{"browser-split":1}],30:[function(require,module,exports){ // http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements module.exports = { area: true, base: true, br: true, col: true, embed: true, hr: true, img: true, input: true, keygen: true, link: true, meta: true, param: true, source: true, track: true, wbr: true }; },{}],31:[function(require,module,exports){ function createElement(tagName){ return document.createElement(tagName); } function createElementNS(namespaceURI, qualifiedName){ return document.createElementNS(namespaceURI, qualifiedName); } function createTextNode(text){ return document.createTextNode(text); } function insertBefore(parentNode, newNode, referenceNode){ parentNode.insertBefore(newNode, referenceNode); } function removeChild(node, child){ node.removeChild(child); } function appendChild(node, child){ node.appendChild(child); } function parentNode(node){ return node.parentElement; } function nextSibling(node){ return node.nextSibling; } function tagName(node){ return node.tagName; } function setTextContent(node, text){ node.textContent = text; } module.exports = { createElement: createElement, createElementNS: createElementNS, createTextNode: createTextNode, appendChild: appendChild, removeChild: removeChild, insertBefore: insertBefore, parentNode: parentNode, nextSibling: nextSibling, tagName: tagName, setTextContent: setTextContent }; },{}],32:[function(require,module,exports){ module.exports = { array: Array.isArray, primitive: function(s) { return typeof s === 'string' || typeof s === 'number'; }, }; },{}],33:[function(require,module,exports){ var booleanAttrs = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "compact", "controls", "declare", "default", "defaultchecked", "defaultmuted", "defaultselected", "defer", "disabled", "draggable", "enabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "itemscope", "loop", "multiple", "muted", "nohref", "noresize", "noshade", "novalidate", "nowrap", "open", "pauseonexit", "readonly", "required", "reversed", "scoped", "seamless", "selected", "sortable", "spellcheck", "translate", "truespeed", "typemustmatch", "visible"]; var booleanAttrsDict = {}; for(var i=0, len = booleanAttrs.length; i < len; i++) { booleanAttrsDict[booleanAttrs[i]] = true; } function updateAttrs(oldVnode, vnode) { var key, cur, old, elm = vnode.elm, oldAttrs = oldVnode.data.attrs || {}, attrs = vnode.data.attrs || {}; // update modified attributes, add new attributes for (key in attrs) { cur = attrs[key]; old = oldAttrs[key]; if (old !== cur) { // TODO: add support to namespaced attributes (setAttributeNS) if(!cur && booleanAttrsDict[key]) elm.removeAttribute(key); else elm.setAttribute(key, cur); } } //remove removed attributes // use `in` operator since the previous `for` iteration uses it (.i.e. add even attributes with undefined value) // the other option is to remove all attributes with value == undefined for (key in oldAttrs) { if (!(key in attrs)) { elm.removeAttribute(key); } } } module.exports = {create: updateAttrs, update: updateAttrs}; },{}],34:[function(require,module,exports){ function updateClass(oldVnode, vnode) { var cur, name, elm = vnode.elm, oldClass = oldVnode.data.class || {}, klass = vnode.data.class || {}; for (name in oldClass) { if (!klass[name]) { elm.classList.remove(name); } } for (name in klass) { cur = klass[name]; if (cur !== oldClass[name]) { elm.classList[cur ? 'add' : 'remove'](name); } } } module.exports = {create: updateClass, update: updateClass}; },{}],35:[function(require,module,exports){ function updateDataset(oldVnode, vnode) { var elm = vnode.elm, oldDataset = oldVnode.data.dataset || {}, dataset = vnode.data.dataset || {}, key for (key in oldDataset) { if (!dataset[key]) { delete elm.dataset[key]; } } for (key in dataset) { if (oldDataset[key] !== dataset[key]) { elm.dataset[key] = dataset[key]; } } } module.exports = {create: updateDataset, update: updateDataset} },{}],36:[function(require,module,exports){ var is = require('../is'); function arrInvoker(arr) { return function() { if (!arr.length) return; // Special case when length is two, for performance arr.length === 2 ? arr[0](arr[1]) : arr[0].apply(undefined, arr.slice(1)); }; } function fnInvoker(o) { return function(ev) { if (o.fn === null) return; o.fn(ev); }; } function updateEventListeners(oldVnode, vnode) { var name, cur, old, elm = vnode.elm, oldOn = oldVnode.data.on || {}, on = vnode.data.on; if (!on) return; for (name in on) { cur = on[name]; old = oldOn[name]; if (old === undefined) { if (is.array(cur)) { elm.addEventListener(name, arrInvoker(cur)); } else { cur = {fn: cur}; on[name] = cur; elm.addEventListener(name, fnInvoker(cur)); } } else if (is.array(old)) { // Deliberately modify old array since it's captured in closure created with `arrInvoker` old.length = cur.length; for (var i = 0; i < old.length; ++i) old[i] = cur[i]; on[name] = old; } else { old.fn = cur; on[name] = old; } } if (oldOn) { for (name in oldOn) { if (on[name] === undefined) { var old = oldOn[name]; if (is.array(old)) { old.length = 0; } else { old.fn = null; } } } } } module.exports = {create: updateEventListeners, update: updateEventListeners}; },{"../is":32}],37:[function(require,module,exports){ var raf = (typeof window !== 'undefined' && window.requestAnimationFrame) || setTimeout; var nextFrame = function(fn) { raf(function() { raf(fn); }); }; function setNextFrame(obj, prop, val) { nextFrame(function() { obj[prop] = val; }); } function getTextNodeRect(textNode) { var rect; if (document.createRange) { var range = document.createRange(); range.selectNodeContents(textNode); if (range.getBoundingClientRect) { rect = range.getBoundingClientRect(); } } return rect; } function calcTransformOrigin(isTextNode, textRect, boundingRect) { if (isTextNode) { if (textRect) { //calculate pixels to center of text from left edge of bounding box var relativeCenterX = textRect.left + textRect.width/2 - boundingRect.left; var relativeCenterY = textRect.top + textRect.height/2 - boundingRect.top; return relativeCenterX + 'px ' + relativeCenterY + 'px'; } } return '0 0'; //top left } function getTextDx(oldTextRect, newTextRect) { if (oldTextRect && newTextRect) { return ((oldTextRect.left + oldTextRect.width/2) - (newTextRect.left + newTextRect.width/2)); } return 0; } function getTextDy(oldTextRect, newTextRect) { if (oldTextRect && newTextRect) { return ((oldTextRect.top + oldTextRect.height/2) - (newTextRect.top + newTextRect.height/2)); } return 0; } function isTextElement(elm) { return elm.childNodes.length === 1 && elm.childNodes[0].nodeType === 3; } var removed, created; function pre(oldVnode, vnode) { removed = {}; created = []; } function create(oldVnode, vnode) { var hero = vnode.data.hero; if (hero && hero.id) { created.push(hero.id); created.push(vnode); } } function destroy(vnode) { var hero = vnode.data.hero; if (hero && hero.id) { var elm = vnode.elm; vnode.isTextNode = isTextElement(elm); //is this a text node? vnode.boundingRect = elm.getBoundingClientRect(); //save the bounding rectangle to a new property on the vnode vnode.textRect = vnode.isTextNode ? getTextNodeRect(elm.childNodes[0]) : null; //save bounding rect of inner text node var computedStyle = window.getComputedStyle(elm, null); //get current styles (includes inherited properties) vnode.savedStyle = JSON.parse(JSON.stringify(computedStyle)); //save a copy of computed style values removed[hero.id] = vnode; } } function post() { var i, id, newElm, oldVnode, oldElm, hRatio, wRatio, oldRect, newRect, dx, dy, origTransform, origTransition, newStyle, oldStyle, newComputedStyle, isTextNode, newTextRect, oldTextRect; for (i = 0; i < created.length; i += 2) { id = created[i]; newElm = created[i+1].elm; oldVnode = removed[id]; if (oldVnode) { isTextNode = oldVnode.isTextNode && isTextElement(newElm); //Are old & new both text? newStyle = newElm.style; newComputedStyle = window.getComputedStyle(newElm, null); //get full computed style for new element oldElm = oldVnode.elm; oldStyle = oldElm.style; //Overall element bounding boxes newRect = newElm.getBoundingClientRect(); oldRect = oldVnode.boundingRect; //previously saved bounding rect //Text node bounding boxes & distances if (isTextNode) { newTextRect = getTextNodeRect(newElm.childNodes[0]); oldTextRect = oldVnode.textRect; dx = getTextDx(oldTextRect, newTextRect); dy = getTextDy(oldTextRect, newTextRect); } else { //Calculate distances between old & new positions dx = oldRect.left - newRect.left; dy = oldRect.top - newRect.top; } hRatio = newRect.height / (Math.max(oldRect.height, 1)); wRatio = isTextNode ? hRatio : newRect.width / (Math.max(oldRect.width, 1)); //text scales based on hRatio // Animate new element origTransform = newStyle.transform; origTransition = newStyle.transition; if (newComputedStyle.display === 'inline') //inline elements cannot be transformed newStyle.display = 'inline-block'; //this does not appear to have any negative side effects newStyle.transition = origTransition + 'transform 0s'; newStyle.transformOrigin = calcTransformOrigin(isTextNode, newTextRect, newRect); newStyle.opacity = '0'; newStyle.transform = origTransform + 'translate('+dx+'px, '+dy+'px) ' + 'scale('+1/wRatio+', '+1/hRatio+')'; setNextFrame(newStyle, 'transition', origTransition); setNextFrame(newStyle, 'transform', origTransform); setNextFrame(newStyle, 'opacity', '1'); // Animate old element for (var key in oldVnode.savedStyle) { //re-apply saved inherited properties if (parseInt(key) != key) { var ms = key.substring(0,2) === 'ms'; var moz = key.substring(0,3) === 'moz'; var webkit = key.substring(0,6) === 'webkit'; if (!ms && !moz && !webkit) //ignore prefixed style properties oldStyle[key] = oldVnode.savedStyle[key]; } } oldStyle.position = 'absolute'; oldStyle.top = oldRect.top + 'px'; //start at existing position oldStyle.left = oldRect.left + 'px'; oldStyle.width = oldRect.width + 'px'; //Needed for elements who were sized relative to their parents oldStyle.height = oldRect.height + 'px'; //Needed for elements who were sized relative to their parents oldStyle.margin = 0; //Margin on hero element leads to incorrect positioning oldStyle.transformOrigin = calcTransformOrigin(isTextNode, oldTextRect, oldRect); oldStyle.transform = ''; oldStyle.opacity = '1'; document.body.appendChild(oldElm); setNextFrame(oldStyle, 'transform', 'translate('+ -dx +'px, '+ -dy +'px) scale('+wRatio+', '+hRatio+')'); //scale must be on far right for translate to be correct setNextFrame(oldStyle, 'opacity', '0'); oldElm.addEventListener('transitionend', function(ev) { if (ev.propertyName === 'transform') document.body.removeChild(ev.target); }); } } removed = created = undefined; } module.exports = {pre: pre, create: create, destroy: destroy, post: post}; },{}],38:[function(require,module,exports){ function updateProps(oldVnode, vnode) { var key, cur, old, elm = vnode.elm, oldProps = oldVnode.data.props || {}, props = vnode.data.props || {}; for (key in oldProps) { if (!props[key]) { delete elm[key]; } } for (key in props) { cur = props[key]; old = oldProps[key]; if (old !== cur && (key !== 'value' || elm[key] !== cur)) { elm[key] = cur; } } } module.exports = {create: updateProps, update: updateProps}; },{}],39:[function(require,module,exports){ var raf = (typeof window !== 'undefined' && window.requestAnimationFrame) || setTimeout; var nextFrame = function(fn) { raf(function() { raf(fn); }); }; function setNextFrame(obj, prop, val) { nextFrame(function() { obj[prop] = val; }); } function updateStyle(oldVnode, vnode) { var cur, name, elm = vnode.elm, oldStyle = oldVnode.data.style || {}, style = vnode.data.style || {}, oldHasDel = 'delayed' in oldStyle; for (name in oldStyle) { if (!style[name]) { elm.style[name] = ''; } } for (name in style) { cur = style[name]; if (name === 'delayed') { for (name in style.delayed) { cur = style.delayed[name]; if (!oldHasDel || cur !== oldStyle.delayed[name]) { setNextFrame(elm.style, name, cur); } } } else if (name !== 'remove' && cur !== oldStyle[name]) { elm.style[name] = cur; } } } function applyDestroyStyle(vnode) { var style, name, elm = vnode.elm, s = vnode.data.style; if (!s || !(style = s.destroy)) return; for (name in style) { elm.style[name] = style[name]; } } function applyRemoveStyle(vnode, rm) { var s = vnode.data.style; if (!s || !s.remove) { rm(); return; } var name, elm = vnode.elm, idx, i = 0, maxDur = 0, compStyle, style = s.remove, amount = 0, applied = []; for (name in style) { applied.push(name); elm.style[name] = style[name]; } compStyle = getComputedStyle(elm); var props = compStyle['transition-property'].split(', '); for (; i < props.length; ++i) { if(applied.indexOf(props[i]) !== -1) amount++; } elm.addEventListener('transitionend', function(ev) { if (ev.target === elm) --amount; if (amount === 0) rm(); }); } module.exports = {create: updateStyle, update: updateStyle, destroy: applyDestroyStyle, remove: applyRemoveStyle}; },{}],40:[function(require,module,exports){ // jshint newcap: false /* global require, module, document, Node */ 'use strict'; var VNode = require('./vnode'); var is = require('./is'); var domApi = require('./htmldomapi'); function isUndef(s) { return s === undefined; } function isDef(s) { return s !== undefined; } var emptyNode = VNode('', {}, [], undefined, undefined); function sameVnode(vnode1, vnode2) { return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel; } function createKeyToOldIdx(children, beginIdx, endIdx) { var i, map = {}, key; for (i = beginIdx; i <= endIdx; ++i) { key = children[i].key; if (isDef(key)) map[key] = i; } return map; } var hooks = ['create', 'update', 'remove', 'destroy', 'pre', 'post']; function init(modules, api) { var i, j, cbs = {}; if (isUndef(api)) api = domApi; for (i = 0; i < hooks.length; ++i) { cbs[hooks[i]] = []; for (j = 0; j < modules.length; ++j) { if (modules[j][hooks[i]] !== undefined) cbs[hooks[i]].push(modules[j][hooks[i]]); } } function emptyNodeAt(elm) { return VNode(api.tagName(elm).toLowerCase(), {}, [], undefined, elm); } function createRmCb(childElm, listeners) { return function() { if (--listeners === 0) { var parent = api.parentNode(childElm); api.removeChild(parent, childElm); } }; } function createElm(vnode, insertedVnodeQueue) { var i, data = vnode.data; if (isDef(data)) { if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode); data = vnode.data; } } var elm, children = vnode.children, sel = vnode.sel; if (isDef(sel)) { // Parse selector var hashIdx = sel.indexOf('#'); var dotIdx = sel.indexOf('.', hashIdx); var hash = hashIdx > 0 ? hashIdx : sel.length; var dot = dotIdx > 0 ? dotIdx : sel.length; var tag = hashIdx !== -1 || dotIdx !== -1 ? sel.slice(0, Math.min(hash, dot)) : sel; elm = vnode.elm = isDef(data) && isDef(i = data.ns) ? api.createElementNS(i, tag) : api.createElement(tag); if (hash < dot) elm.id = sel.slice(hash + 1, dot); if (dotIdx > 0) elm.className = sel.slice(dot+1).replace(/\./g, ' '); if (is.array(children)) { for (i = 0; i < children.length; ++i) { api.appendChild(elm, createElm(children[i], insertedVnodeQueue)); } } else if (is.primitive(vnode.text)) { api.appendChild(elm, api.createTextNode(vnode.text)); } for (i = 0; i < cbs.create.length; ++i) cbs.create[i](emptyNode, vnode); i = vnode.data.hook; // Reuse variable if (isDef(i)) { if (i.create) i.create(emptyNode, vnode); if (i.insert) insertedVnodeQueue.push(vnode); } } else { elm = vnode.elm = api.createTextNode(vnode.text); } return vnode.elm; } function addVnodes(parentElm, before, vnodes, startIdx, endIdx, insertedVnodeQueue) { for (; startIdx <= endIdx; ++startIdx) { api.insertBefore(parentElm, createElm(vnodes[startIdx], insertedVnodeQueue), before); } } function invokeDestroyHook(vnode) { var i, j, data = vnode.data; if (isDef(data)) { if (isDef(i = data.hook) && isDef(i = i.destroy)) i(vnode); for (i = 0; i < cbs.destroy.length; ++i) cbs.destroy[i](vnode); if (isDef(i = vnode.children)) { for (j = 0; j < vnode.children.length; ++j) { invokeDestroyHook(vnode.children[j]); } } } } function removeVnodes(parentElm, vnodes, startIdx, endIdx) { for (; startIdx <= endIdx; ++startIdx) { var i, listeners, rm, ch = vnodes[startIdx]; if (isDef(ch)) { if (isDef(ch.sel)) { invokeDestroyHook(ch); listeners = cbs.remove.length + 1; rm = createRmCb(ch.elm, listeners); for (i = 0; i < cbs.remove.length; ++i) cbs.remove[i](ch, rm); if (isDef(i = ch.data) && isDef(i = i.hook) && isDef(i = i.remove)) { i(ch, rm); } else { rm(); } } else { // Text node api.removeChild(parentElm, ch.elm); } } } } function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue) { var oldStartIdx = 0, newStartIdx = 0; var oldEndIdx = oldCh.length - 1; var oldStartVnode = oldCh[0]; var oldEndVnode = oldCh[oldEndIdx]; var newEndIdx = newCh.length - 1; var newStartVnode = newCh[0]; var newEndVnode = newCh[newEndIdx]; var oldKeyToIdx, idxInOld, elmToMove, before; while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) { if (isUndef(oldStartVnode)) { oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left } else if (isUndef(oldEndVnode)) { oldEndVnode = oldCh[--oldEndIdx]; } else if (sameVnode(oldStartVnode, newStartVnode)) { patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue); oldStartVnode = oldCh[++oldStartIdx]; newStartVnode = newCh[++newStartIdx]; } else if (sameVnode(oldEndVnode, newEndVnode)) { patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue); oldEndVnode = oldCh[--oldEndIdx]; newEndVnode = newCh[--newEndIdx]; } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue); api.insertBefore(parentElm, oldStartVnode.elm, api.nextSibling(oldEndVnode.elm)); oldStartVnode = oldCh[++oldStartIdx]; newEndVnode = newCh[--newEndIdx]; } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue); api.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm); oldEndVnode = oldCh[--oldEndIdx]; newStartVnode = newCh[++newStartIdx]; } else { if (isUndef(oldKeyToIdx)) oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); idxInOld = oldKeyToIdx[newStartVnode.key]; if (isUndef(idxInOld)) { // New element api.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm); newStartVnode = newCh[++newStartIdx]; } else { elmToMove = oldCh[idxInOld]; patchVnode(elmToMove, newStartVnode, insertedVnodeQueue); oldCh[idxInOld] = undefined; api.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm); newStartVnode = newCh[++newStartIdx]; } } } if (oldStartIdx > oldEndIdx) { before = isUndef(newCh[newEndIdx+1]) ? null : newCh[newEndIdx+1].elm; addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx, insertedVnodeQueue); } else if (newStartIdx > newEndIdx) { removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx); } } function patchVnode(oldVnode, vnode, insertedVnodeQueue) { var i, hook; if (isDef(i = vnode.data) && isDef(hook = i.hook) && isDef(i = hook.prepatch)) { i(oldVnode, vnode); } var elm = vnode.elm = oldVnode.elm, oldCh = oldVnode.children, ch = vnode.children; if (oldVnode === vnode) return; if (!sameVnode(oldVnode, vnode)) { var parentElm = api.parentNode(oldVnode.elm); elm = createElm(vnode, insertedVnodeQueue); api.insertBefore(parentElm, elm, oldVnode.elm); removeVnodes(parentElm, [oldVnode], 0, 0); return; } if (isDef(vnode.data)) { for (i = 0; i < cbs.update.length; ++i) cbs.update[i](oldVnode, vnode); i = vnode.data.hook; if (isDef(i) && isDef(i = i.update)) i(oldVnode, vnode); } if (isUndef(vnode.text)) { if (isDef(oldCh) && isDef(ch)) { if (oldCh !== ch) updateChildren(elm, oldCh, ch, insertedVnodeQueue); } else if (isDef(ch)) { if (isDef(oldVnode.text)) api.setTextContent(elm, ''); addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue); } else if (isDef(oldCh)) { removeVnodes(elm, oldCh, 0, oldCh.length - 1); } else if (isDef(oldVnode.text)) { api.setTextContent(elm, ''); } } else if (oldVnode.text !== vnode.text) { api.setTextContent(elm, vnode.text); } if (isDef(hook) && isDef(i = hook.postpatch)) { i(oldVnode, vnode); } } return function(oldVnode, vnode) { var i, elm, parent; var insertedVnodeQueue = []; for (i = 0; i < cbs.pre.length; ++i) cbs.pre[i](); if (isUndef(oldVnode.sel)) { oldVnode = emptyNodeAt(oldVnode); } if (sameVnode(oldVnode, vnode)) { patchVnode(oldVnode, vnode, insertedVnodeQueue); } else { elm = oldVnode.elm; parent = api.parentNode(elm); createElm(vnode, insertedVnodeQueue); if (parent !== null) { api.insertBefore(parent, vnode.elm, api.nextSibling(elm)); removeVnodes(parent, [oldVnode], 0, 0); } } for (i = 0; i < insertedVnodeQueue.length; ++i) { insertedVnodeQueue[i].data.hook.insert(insertedVnodeQueue[i]); } for (i = 0; i < cbs.post.length; ++i) cbs.post[i](); return vnode; }; } module.exports = {init: init}; },{"./htmldomapi":31,"./is":32,"./vnode":41}],41:[function(require,module,exports){ module.exports = function(sel, data, children, text, elm) { var key = data === undefined ? undefined : data.key; return {sel: sel, data: data, children: children, text: text, elm: elm, key: key}; }; },{}],42:[function(require,module,exports){ (function (global){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.DOMSource = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _rx = (typeof window !== "undefined" ? window['Rx'] : typeof global !== "undefined" ? global['Rx'] : null); var _fromEvent = require('./fromEvent'); var _isolation = require('./isolate/isolation'); var _EventDelegator = require('./EventDelegator'); var _ElementFinder = require('./ElementFinder'); var _util = require('./util'); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function determineUseCapture(eventType, options) { var result = false; if (typeof options.useCapture === 'boolean') { result = options.useCapture; } if (_util.eventTypesThatDontBubble.indexOf(eventType) !== -1) { result = true; } return result; } var DOMSource = exports.DOMSource = function () { function DOMSource(rootElement$, namespace, isolateModule, delegators) { _classCallCheck(this, DOMSource); this._rootElement$ = rootElement$; this._namespace = namespace; this._isolateModule = isolateModule; this._delegators = delegators; } _createClass(DOMSource, [{ key: 'select', value: function select(selector) { if (typeof selector !== 'string') { throw new Error('DOM driver\'s select() expects the argument to be a ' + 'string as a CSS selector'); } var trimmedSelector = selector.trim(); var childNamespace = trimmedSelector === ':root' ? this._namespace : this._namespace.concat(trimmedSelector); return new DOMSource(this._rootElement$, childNamespace, this._isolateModule, this._delegators); } }, { key: 'events', value: function events(eventType) { var _this = this; var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; // eslint-disable-line complexity if (typeof eventType !== 'string') { throw new Error('DOM driver\'s events() expects argument to be a ' + 'string representing the event type to listen for.'); } var useCapture = determineUseCapture(eventType, options); var namespace = this._namespace; var scope = (0, _util.getScope)(namespace); var key = scope ? eventType + '~' + useCapture + '~' + scope : eventType + '~' + useCapture; var domSource = this; var rootElement$ = void 0; if (scope) { (function () { var hadIsolatedMutable = false; rootElement$ = _this._rootElement$.filter(function filterScopedElements(rootElement) { var hasIsolated = !!domSource._isolateModule.getIsolatedElement(scope); var shouldPass = hasIsolated && !hadIsolatedMutable; hadIsolatedMutable = hasIsolated; return shouldPass; }); })(); } else { rootElement$ = this._rootElement$.take(2); } return rootElement$.flatMapLatest(function setupEventDelegators(rootElement) { if (!namespace || namespace.length === 0) { return (0, _fromEvent.fromEvent)(eventType, rootElement, useCapture); } var delegators = domSource._delegators; var top = scope ? domSource._isolateModule.getIsolatedElement(scope) : rootElement; var delegator = void 0; if (delegators.has(key)) { delegator = delegators.get(key); delegator.updateTopElement(top); } else { delegator = new _EventDelegator.EventDelegator(top, eventType, useCapture, domSource._isolateModule); delegators.set(key, delegator); } var stream = new _rx.Subject(); if (scope) { domSource._isolateModule.addEventDelegator(scope, delegator); } delegator.addDestination(stream, namespace); return stream; }).share(); } }, { key: 'dispose', value: function dispose() { this._isolateModule.reset(); } }, { key: 'isolateSource', value: function isolateSource(source, scope) { return (0, _isolation.isolateSource)(source, scope); } }, { key: 'isolateSink', value: function isolateSink(sink, scope) { return (0, _isolation.isolateSink)(sink, scope); } }, { key: 'elements', get: function get() { if (this._namespace.length === 0) { return this._rootElement$; } var elementFinder = new _ElementFinder.ElementFinder(this._namespace, this._isolateModule); return this._rootElement$.map(function (el) { return elementFinder.call(el); }); } }, { key: 'namespace', get: function get() { return this._namespace; } }]); return DOMSource; }(); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"./ElementFinder":43,"./EventDelegator":44,"./fromEvent":47,"./isolate/isolation":52,"./util":59}],43:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.ElementFinder = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _ScopeChecker = require('./ScopeChecker'); var _util = require('./util'); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function toElementArray(nodeList) { var length = nodeList.length; var arr = Array(length); for (var i = 0; i < length; ++i) { arr[i] = nodeList[i]; } return arr; } var ElementFinder = exports.ElementFinder = function () { function ElementFinder(namespace, isolateModule) { _classCallCheck(this, ElementFinder); this.namespace = namespace; this.isolateModule = isolateModule; } _createClass(ElementFinder, [{ key: 'call', value: function call(rootElement) { // eslint-disable-line complexity var namespace = this.namespace; if (namespace.join('') === '') { return rootElement; } var scope = (0, _util.getScope)(namespace); var selector = (0, _util.getSelectors)(namespace); var scopeChecker = new _ScopeChecker.ScopeChecker(scope, this.isolateModule); var topNode = rootElement; var topNodeMatches = []; if (scope.length > 0) { topNode = this.isolateModule.getIsolatedElement(scope) || rootElement; if (selector && (0, _util.matchesSelector)(topNode, selector)) { topNodeMatches[0] = topNode; } } return toElementArray(topNode.querySelectorAll(selector)).filter(scopeChecker.isStrictlyInRootScope, scopeChecker).concat(topNodeMatches); } }]); return ElementFinder; }(); },{"./ScopeChecker":45,"./util":59}],44:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.EventDelegator = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _ScopeChecker = require('./ScopeChecker'); var _util = require('./util'); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function patchEvent(event) { var pEvent = event; pEvent.propagationHasBeenStopped = false; var oldStopPropagation = pEvent.stopPropagation; pEvent.stopPropagation = function stopPropagation() { oldStopPropagation.call(this); this.propagationHasBeenStopped = true; }; return pEvent; } function mutateEventCurrentTarget(event, currentTargetElement) { try { Object.defineProperty(event, 'currentTarget', { value: currentTargetElement, configurable: true }); } catch (err) { console.log('please use event.ownerTarget'); } event.ownerTarget = currentTargetElement; } var EventDelegator = exports.EventDelegator = function () { function EventDelegator(topElement, eventType, useCapture, isolateModule) { var _this = this; _classCallCheck(this, EventDelegator); this.topElement = topElement; this.eventType = eventType; this.useCapture = useCapture; this.isolateModule = isolateModule; this.roof = topElement.parentElement; this.destinations = []; if (useCapture) { this.domListener = function (ev) { return _this.capture(ev); }; } else { this.domListener = function (ev) { return _this.bubble(ev); }; } topElement.addEventListener(eventType, this.domListener, useCapture); } _createClass(EventDelegator, [{ key: 'bubble', value: function bubble(rawEvent) { if (!document.body.contains(rawEvent.currentTarget)) { return; } var ev = patchEvent(rawEvent); for (var el = ev.target; el && el !== this.roof; el = el.parentElement) { if (ev.propagationHasBeenStopped) { return; } this.matchEventAgainstDestinations(el, ev); } } }, { key: 'matchEventAgainstDestinations', value: function matchEventAgainstDestinations(el, ev) { for (var i = 0, n = this.destinations.length; i < n; ++i) { var dest = this.destinations[i]; if (!dest.scopeChecker.isStrictlyInRootScope(el)) { continue; } if ((0, _util.matchesSelector)(el, dest.selector)) { mutateEventCurrentTarget(ev, el); dest.subject.onNext(ev); } } } }, { key: 'capture', value: function capture(ev) { for (var i = 0, n = this.destinations.length; i < n; i++) { var dest = this.destinations[i]; if ((0, _util.matchesSelector)(ev.target, dest.selector)) { dest.subject.onNext(ev); } } } }, { key: 'addDestination', value: function addDestination(subject, namespace) { var scope = (0, _util.getScope)(namespace); var selector = (0, _util.getSelectors)(namespace); var scopeChecker = new _ScopeChecker.ScopeChecker(scope, this.isolateModule); this.destinations.push({ subject: subject, scopeChecker: scopeChecker, selector: selector }); } }, { key: 'updateTopElement', value: function updateTopElement(newTopElement) { var eventType = this.eventType; var domListener = this.domListener; var useCapture = this.useCapture; this.topElement.removeEventListener(eventType, domListener, useCapture); newTopElement.addEventListener(eventType, domListener, useCapture); this.topElement = newTopElement; } }]); return EventDelegator; }(); },{"./ScopeChecker":45,"./util":59}],45:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var ScopeChecker = exports.ScopeChecker = function () { function ScopeChecker(scope, isolateModule) { _classCallCheck(this, ScopeChecker); this.scope = scope; this.isolateModule = isolateModule; } _createClass(ScopeChecker, [{ key: "isStrictlyInRootScope", value: function isStrictlyInRootScope(leaf) { // eslint-disable-line complexity for (var el = leaf; el; el = el.parentElement) { var scope = this.isolateModule.isIsolatedElement(el); if (scope && scope !== this.scope) { return false; } if (scope) { return true; } } return true; } }]); return ScopeChecker; }(); },{}],46:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.VNodeWrapper = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _h = require('./hyperscript/h'); var _classNameFromVNode = require('snabbdom-selector/lib/classNameFromVNode'); var _classNameFromVNode2 = _interopRequireDefault(_classNameFromVNode); var _selectorParser2 = require('snabbdom-selector/lib/selectorParser'); var _selectorParser3 = _interopRequireDefault(_selectorParser2); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var VNodeWrapper = exports.VNodeWrapper = function () { function VNodeWrapper(rootElement) { _classCallCheck(this, VNodeWrapper); this.rootElement = rootElement; } _createClass(VNodeWrapper, [{ key: 'call', value: function call(vnode) { // eslint-disable-line complexity var _selectorParser = (0, _selectorParser3.default)(vnode.sel); var selectorTagName = _selectorParser.tagName; var selectorId = _selectorParser.id; var vNodeClassName = (0, _classNameFromVNode2.default)(vnode); var vNodeData = vnode.data || {}; var vNodeDataProps = vNodeData.props || {}; var _vNodeDataProps$id = vNodeDataProps.id; var vNodeId = _vNodeDataProps$id === undefined ? selectorId : _vNodeDataProps$id; var isVNodeAndRootElementIdentical = vNodeId.toLowerCase() === this.rootElement.id.toLowerCase() && selectorTagName.toLowerCase() === this.rootElement.tagName.toLowerCase() && vNodeClassName.toLowerCase() === this.rootElement.className.toLowerCase(); if (isVNodeAndRootElementIdentical) { return vnode; } var _rootElement = this.rootElement; var tagName = _rootElement.tagName; var id = _rootElement.id; var className = _rootElement.className; var elementId = id ? '#' + id : ''; var elementClassName = className ? '.' + className.split(' ').join('.') : ''; return (0, _h.h)('' + tagName + elementId + elementClassName, {}, [vnode]); } }]); return VNodeWrapper; }(); },{"./hyperscript/h":48,"snabbdom-selector/lib/classNameFromVNode":22,"snabbdom-selector/lib/selectorParser":23}],47:[function(require,module,exports){ (function (global){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.fromEvent = fromEvent; var _rx = (typeof window !== "undefined" ? window['Rx'] : typeof global !== "undefined" ? global['Rx'] : null); function fromEvent(eventType, node, useCapture) { return _rx.Observable.create(function (observer) { var listener = function listener(ev) { return observer.next(ev); }; node.addEventListener(eventType, listener, useCapture); return function () { return node.removeEventListener(eventType, listener, useCapture); }; }); } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],48:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.h = h; var _is = require('snabbdom/is'); var _is2 = _interopRequireDefault(_is); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var vnode = require('snabbdom/vnode'); function isStream(stream) { return typeof stream.subscribe === 'function'; } function mutateStreamWithNS(vNode) { addNS(vNode.data, vNode.children); return vNode; } function addNS(data, children) { // eslint-disable-line complexity data.ns = 'http://www.w3.org/2000/svg'; if (typeof children !== 'undefined' && _is2.default.array(children)) { for (var i = 0; i < children.length; ++i) { if (isStream(children[i])) { children[i] = children[i].map(mutateStreamWithNS); } else { addNS(children[i].data, children[i].children); } } } } function h(sel, b, c) { // eslint-disable-line complexity var data = {}; var children = void 0; var text = void 0; var i = void 0; if (arguments.length === 3) { data = b; if (_is2.default.array(c)) { children = c; } else if (_is2.default.primitive(c)) { text = c; } } else if (arguments.length === 2) { if (_is2.default.array(b)) { children = b; } else if (_is2.default.primitive(b)) { text = b; } else { data = b; } } if (_is2.default.array(children)) { children = children.filter(function (x) { return x; }); // handle null/undef children for (i = 0; i < children.length; ++i) { if (_is2.default.primitive(children[i])) { children[i] = vnode(undefined, undefined, undefined, children[i]); } } } if (sel[0] === 's' && sel[1] === 'v' && sel[2] === 'g') { addNS(data, children); } return vnode(sel, data, children, text, undefined); }; },{"snabbdom/is":32,"snabbdom/vnode":41}],49:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _h = require('./h'); function isValidString(param) { return typeof param === 'string' && param.length > 0; } function isSelector(param) { return isValidString(param) && (param[0] === '.' || param[0] === '#'); } function createTagFunction(tagName) { return function hyperscript(first, b, c) { // eslint-disable-line complexity if (isSelector(first)) { if (!!b && !!c) { return (0, _h.h)(tagName + first, b, c); } else if (!!b) { // eslint-disable-line no-extra-boolean-cast return (0, _h.h)(tagName + first, b); } else { return (0, _h.h)(tagName + first, {}); } } else if (!!b) { // eslint-disable-line no-extra-boolean-cast return (0, _h.h)(tagName, first, b); } else if (!!first) { // eslint-disable-line no-extra-boolean-cast return (0, _h.h)(tagName, first); } else { return (0, _h.h)(tagName, {}); } }; } var SVG_TAG_NAMES = ['a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'animateTransform', 'circle', 'clipPath', 'colorProfile', 'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotlight', 'feTile', 'feTurbulence', 'filter', 'font', 'fontFace', 'fontFaceFormat', 'fontFaceName', 'fontFaceSrc', 'fontFaceUri', 'foreignObject', 'g', 'glyph', 'glyphRef', 'hkern', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'missingGlyph', 'mpath', 'path', 'pattern', 'polygon', 'polyling', 'radialGradient', 'rect', 'script', 'set', 'stop', 'style', 'switch', 'symbol', 'text', 'textPath', 'title', 'tref', 'tspan', 'use', 'view', 'vkern']; var svg = createTagFunction('svg'); SVG_TAG_NAMES.forEach(function (tag) { svg[tag] = createTagFunction(tag); }); var TAG_NAMES = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'dd', 'del', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'meta', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'p', 'param', 'pre', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'u', 'ul', 'video', 'progress']; var exported = { SVG_TAG_NAMES: SVG_TAG_NAMES, TAG_NAMES: TAG_NAMES, svg: svg, isSelector: isSelector, createTagFunction: createTagFunction }; for (var i = 0; i < TAG_NAMES.length; ++i) { exported[TAG_NAMES[i]] = createTagFunction(TAG_NAMES[i]); } exports.default = exported; },{"./h":48}],50:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.thunk = thunk; var _h = require('./h'); function copyToThunk(vnode, thunk) { thunk.elm = vnode.elm; vnode.data.fn = thunk.data.fn; vnode.data.args = thunk.data.args; thunk.data = vnode.data; thunk.children = vnode.children; thunk.text = vnode.text; thunk.elm = vnode.elm; } function init(thunk) { var cur = thunk.data; var vnode = cur.fn.apply(void 0, cur.args); copyToThunk(vnode, thunk); } function prepatch(oldVnode, thunk) { var old = oldVnode.data; var cur = thunk.data; var oldArgs = old.args; var args = cur.args; if (old.fn !== cur.fn || oldArgs.length !== args.length) { copyToThunk(cur.fn.apply(void 0, args), thunk); } for (var i = 0; i < args.length; ++i) { if (oldArgs[i] !== args[i]) { copyToThunk(cur.fn.apply(void 0, args), thunk); return; } } copyToThunk(oldVnode, thunk); } function thunk(sel, key, fn, args) { if (args === void 0) { args = fn; fn = key; key = void 0; } return (0, _h.h)(sel, { key: key, hook: { init: init, prepatch: prepatch }, fn: fn, args: args }); } },{"./h":48}],51:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.makeHTMLDriver = exports.mockDOMSource = exports.makeDOMDriver = exports.modules = exports.progress = exports.video = exports.ul = exports.u = exports.tr = exports.title = exports.thead = exports.th = exports.tfoot = exports.textarea = exports.td = exports.tbody = exports.table = exports.sup = exports.sub = exports.style = exports.strong = exports.span = exports.source = exports.small = exports.select = exports.section = exports.script = exports.samp = exports.s = exports.ruby = exports.rt = exports.rp = exports.q = exports.pre = exports.param = exports.p = exports.option = exports.optgroup = exports.ol = exports.object = exports.noscript = exports.nav = exports.meta = exports.menu = exports.mark = exports.map = exports.main = exports.link = exports.li = exports.legend = exports.label = exports.keygen = exports.kbd = exports.ins = exports.input = exports.img = exports.iframe = exports.i = exports.html = exports.hr = exports.hgroup = exports.header = exports.head = exports.h6 = exports.h5 = exports.h4 = exports.h3 = exports.h2 = exports.h1 = exports.form = exports.footer = exports.figure = exports.figcaption = exports.fieldset = exports.embed = exports.em = exports.dt = exports.dl = exports.div = exports.dir = exports.dfn = exports.del = exports.dd = exports.colgroup = exports.col = exports.code = exports.cite = exports.caption = exports.canvas = exports.button = exports.br = exports.body = exports.blockquote = exports.bdo = exports.bdi = exports.base = exports.b = exports.audio = exports.aside = exports.article = exports.area = exports.address = exports.abbr = exports.a = exports.svg = exports.thunk = exports.h = undefined; var _h = require('./hyperscript/h'); Object.defineProperty(exports, 'h', { enumerable: true, get: function get() { return _h.h; } }); var _thunk = require('./hyperscript/thunk'); Object.defineProperty(exports, 'thunk', { enumerable: true, get: function get() { return _thunk.thunk; } }); var _makeDOMDriver = require('./makeDOMDriver'); Object.defineProperty(exports, 'makeDOMDriver', { enumerable: true, get: function get() { return _makeDOMDriver.makeDOMDriver; } }); var _mockDOMSource = require('./mockDOMSource'); Object.defineProperty(exports, 'mockDOMSource', { enumerable: true, get: function get() { return _mockDOMSource.mockDOMSource; } }); var _makeHTMLDriver = require('./makeHTMLDriver'); Object.defineProperty(exports, 'makeHTMLDriver', { enumerable: true, get: function get() { return _makeHTMLDriver.makeHTMLDriver; } }); var _helpers = require('./hyperscript/helpers'); var _helpers2 = _interopRequireDefault(_helpers); var _modules = require('./modules'); var modules = _interopRequireWildcard(_modules); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var svg = _helpers2.default.svg; var a = _helpers2.default.a; var abbr = _helpers2.default.abbr; var address = _helpers2.default.address; var area = _helpers2.default.area; var article = _helpers2.default.article; var aside = _helpers2.default.aside; var audio = _helpers2.default.audio; var b = _helpers2.default.b; var base = _helpers2.default.base; var bdi = _helpers2.default.bdi; var bdo = _helpers2.default.bdo; var blockquote = _helpers2.default.blockquote; var body = _helpers2.default.body; var br = _helpers2.default.br; var button = _helpers2.default.button; var canvas = _helpers2.default.canvas; var caption = _helpers2.default.caption; var cite = _helpers2.default.cite; var code = _helpers2.default.code; var col = _helpers2.default.col; var colgroup = _helpers2.default.colgroup; var dd = _helpers2.default.dd; var del = _helpers2.default.del; var dfn = _helpers2.default.dfn; var dir = _helpers2.default.dir; var div = _helpers2.default.div; var dl = _helpers2.default.dl; var dt = _helpers2.default.dt; var em = _helpers2.default.em; var embed = _helpers2.default.embed; var fieldset = _helpers2.default.fieldset; var figcaption = _helpers2.default.figcaption; var figure = _helpers2.default.figure; var footer = _helpers2.default.footer; var form = _helpers2.default.form; var h1 = _helpers2.default.h1; var h2 = _helpers2.default.h2; var h3 = _helpers2.default.h3; var h4 = _helpers2.default.h4; var h5 = _helpers2.default.h5; var h6 = _helpers2.default.h6; var head = _helpers2.default.head; var header = _helpers2.default.header; var hgroup = _helpers2.default.hgroup; var hr = _helpers2.default.hr; var html = _helpers2.default.html; var i = _helpers2.default.i; var iframe = _helpers2.default.iframe; var img = _helpers2.default.img; var input = _helpers2.default.input; var ins = _helpers2.default.ins; var kbd = _helpers2.default.kbd; var keygen = _helpers2.default.keygen; var label = _helpers2.default.label; var legend = _helpers2.default.legend; var li = _helpers2.default.li; var link = _helpers2.default.link; var main = _helpers2.default.main; var map = _helpers2.default.map; var mark = _helpers2.default.mark; var menu = _helpers2.default.menu; var meta = _helpers2.default.meta; var nav = _helpers2.default.nav; var noscript = _helpers2.default.noscript; var object = _helpers2.default.object; var ol = _helpers2.default.ol; var optgroup = _helpers2.default.optgroup; var option = _helpers2.default.option; var p = _helpers2.default.p; var param = _helpers2.default.param; var pre = _helpers2.default.pre; var q = _helpers2.default.q; var rp = _helpers2.default.rp; var rt = _helpers2.default.rt; var ruby = _helpers2.default.ruby; var s = _helpers2.default.s; var samp = _helpers2.default.samp; var script = _helpers2.default.script; var section = _helpers2.default.section; var select = _helpers2.default.select; var small = _helpers2.default.small; var source = _helpers2.default.source; var span = _helpers2.default.span; var strong = _helpers2.default.strong; var style = _helpers2.default.style; var sub = _helpers2.default.sub; var sup = _helpers2.default.sup; var table = _helpers2.default.table; var tbody = _helpers2.default.tbody; var td = _helpers2.default.td; var textarea = _helpers2.default.textarea; var tfoot = _helpers2.default.tfoot; var th = _helpers2.default.th; var thead = _helpers2.default.thead; var title = _helpers2.default.title; var tr = _helpers2.default.tr; var u = _helpers2.default.u; var ul = _helpers2.default.ul; var video = _helpers2.default.video; var progress = _helpers2.default.progress; exports.svg = svg; exports.a = a; exports.abbr = abbr; exports.address = address; exports.area = area; exports.article = article; exports.aside = aside; exports.audio = audio; exports.b = b; exports.base = base; exports.bdi = bdi; exports.bdo = bdo; exports.blockquote = blockquote; exports.body = body; exports.br = br; exports.button = button; exports.canvas = canvas; exports.caption = caption; exports.cite = cite; exports.code = code; exports.col = col; exports.colgroup = colgroup; exports.dd = dd; exports.del = del; exports.dfn = dfn; exports.dir = dir; exports.div = div; exports.dl = dl; exports.dt = dt; exports.em = em; exports.embed = embed; exports.fieldset = fieldset; exports.figcaption = figcaption; exports.figure = figure; exports.footer = footer; exports.form = form; exports.h1 = h1; exports.h2 = h2; exports.h3 = h3; exports.h4 = h4; exports.h5 = h5; exports.h6 = h6; exports.head = head; exports.header = header; exports.hgroup = hgroup; exports.hr = hr; exports.html = html; exports.i = i; exports.iframe = iframe; exports.img = img; exports.input = input; exports.ins = ins; exports.kbd = kbd; exports.keygen = keygen; exports.label = label; exports.legend = legend; exports.li = li; exports.link = link; exports.main = main; exports.map = map; exports.mark = mark; exports.menu = menu; exports.meta = meta; exports.nav = nav; exports.noscript = noscript; exports.object = object; exports.ol = ol; exports.optgroup = optgroup; exports.option = option; exports.p = p; exports.param = param; exports.pre = pre; exports.q = q; exports.rp = rp; exports.rt = rt; exports.ruby = ruby; exports.s = s; exports.samp = samp; exports.script = script; exports.section = section; exports.select = select; exports.small = small; exports.source = source; exports.span = span; exports.strong = strong; exports.style = style; exports.sub = sub; exports.sup = sup; exports.table = table; exports.tbody = tbody; exports.td = td; exports.textarea = textarea; exports.tfoot = tfoot; exports.th = th; exports.thead = thead; exports.title = title; exports.tr = tr; exports.u = u; exports.ul = ul; exports.video = video; exports.progress = progress; exports.modules = modules; },{"./hyperscript/h":48,"./hyperscript/helpers":49,"./hyperscript/thunk":50,"./makeDOMDriver":54,"./makeHTMLDriver":55,"./mockDOMSource":56,"./modules":57}],52:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.isolateSource = isolateSource; exports.isolateSink = isolateSink; var _util = require('../util'); function isolateSource(source, scope) { return source.select(_util.SCOPE_PREFIX + scope); } function isolateSink(sink, scope) { return sink.do(function (vTree) { if (vTree.data.isolate) { var existingScope = parseInt(vTree.data.isolate.split(_util.SCOPE_PREFIX + 'cycle')[1]); var _scope = parseInt(scope.split('cycle')[1]); if (Number.isNaN(existingScope) || Number.isNaN(_scope) || existingScope > _scope) { return vTree; } } vTree.data.isolate = _util.SCOPE_PREFIX + scope; }); } },{"../util":59}],53:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var IsolateModule = exports.IsolateModule = function () { function IsolateModule(isolatedElements) { _classCallCheck(this, IsolateModule); this.isolatedElements = isolatedElements; this.eventDelegators = new Map([]); } _createClass(IsolateModule, [{ key: 'setScope', value: function setScope(elm, scope) { this.isolatedElements.set(scope, elm); } }, { key: 'removeScope', value: function removeScope(scope) { this.isolatedElements.delete(scope); } }, { key: 'getIsolatedElement', value: function getIsolatedElement(scope) { return this.isolatedElements.get(scope); } }, { key: 'isIsolatedElement', value: function isIsolatedElement(elm) { var elements = Array.from(this.isolatedElements.entries()); for (var i = 0; i < elements.length; ++i) { if (elm === elements[i][1]) { return elements[i][0]; } } return false; } }, { key: 'addEventDelegator', value: function addEventDelegator(scope, eventDelegator) { var delegators = this.eventDelegators.get(scope); if (!delegators) { delegators = []; this.eventDelegators.set(scope, delegators); } delegators[delegators.length] = eventDelegator; } }, { key: 'reset', value: function reset() { this.isolatedElements.clear(); } }, { key: 'createModule', value: function createModule() { var self = this; return { create: function create(oldVNode, vNode) { // eslint-disable-line complexity var _oldVNode$data = oldVNode.data; var oldData = _oldVNode$data === undefined ? {} : _oldVNode$data; var elm = vNode.elm; var _vNode$data = vNode.data; var data = _vNode$data === undefined ? {} : _vNode$data; var oldScope = oldData.isolate || ''; var scope = data.isolate || ''; if (scope) { if (oldScope) { self.removeScope(oldScope); } self.setScope(elm, scope); var delegators = self.eventDelegators.get(scope); if (delegators) { for (var i = 0, len = delegators.length; i < len; ++i) { delegators[i].updateTopElement(elm); } } else if (delegators === void 0) { self.eventDelegators.set(scope, []); } } if (oldScope && !scope) { self.removeScope(scope); } }, update: function update(oldVNode, vNode) { // eslint-disable-line complexity var _oldVNode$data2 = oldVNode.data; var oldData = _oldVNode$data2 === undefined ? {} : _oldVNode$data2; var elm = vNode.elm; var _vNode$data2 = vNode.data; var data = _vNode$data2 === undefined ? {} : _vNode$data2; var oldScope = oldData.isolate || ''; var scope = data.isolate || ''; if (scope) { if (oldScope) { self.removeScope(oldScope); } self.setScope(elm, scope); } if (oldScope && !scope) { self.removeScope(scope); } }, remove: function remove(_ref, cb) { var _ref$data = _ref.data; var data = _ref$data === undefined ? {} : _ref$data; var scope = data.isolate; if (scope) { self.removeScope(scope); if (self.eventDelegators.get(scope)) { self.eventDelegators.set(scope, []); } } cb(); }, destroy: function destroy(_ref2) { var _ref2$data = _ref2.data; var data = _ref2$data === undefined ? {} : _ref2$data; var scope = data.isolate; if (scope) { self.removeScope(scope); if (self.eventDelegators.get(scope)) { self.eventDelegators.set(scope, []); } } } }; } }]); return IsolateModule; }(); },{}],54:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.makeDOMDriver = makeDOMDriver; var _snabbdom = require('snabbdom'); var _DOMSource = require('./DOMSource'); var _VNodeWrapper = require('./VNodeWrapper'); var _module = require('./isolate/module'); var _modules = require('./modules'); var _modules2 = _interopRequireDefault(_modules); var _transposition = require('./transposition'); var _util = require('./util'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function makeDOMDriverInputGuard(modules) { if (!Array.isArray(modules)) { throw new Error('Optional modules option must be ' + 'an array for snabbdom modules'); } } function domDriverInputGuard(view$) { // eslint-disable-line complexity if (!view$ || typeof view$.subscribe !== 'function') // eslint-disable-line brace-style { throw new Error('The DOM driver function expects as input an Observable ' + 'of virtual DOM elements'); } } function makeDOMDriver(container) { var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; var transposition = options.transposition || false; var modules = options.modules || _modules2.default; var isolateModule = new _module.IsolateModule(new Map([])); var patch = (0, _snabbdom.init)([isolateModule.createModule()].concat(modules)); var rootElement = (0, _util.getElement)(container); var vNodeWrapper = new _VNodeWrapper.VNodeWrapper(rootElement); var delegators = new Map([]); makeDOMDriverInputGuard(modules); return function DOMDriver(vNode$) { domDriverInputGuard(vNode$); var preprocessedVNode$ = transposition ? vNode$.map(_transposition.transposeVNode).switch() : vNode$; var rootElement$ = preprocessedVNode$.map(function (vNode) { return vNodeWrapper.call(vNode); }).scan(patch, rootElement).startWith(rootElement).map(function (vNode) { return vNode.elm || vNode; }).replay(null, 1); rootElement$.connect(); return new _DOMSource.DOMSource(rootElement$, [], isolateModule, delegators); }; } },{"./DOMSource":42,"./VNodeWrapper":46,"./isolate/module":53,"./modules":57,"./transposition":58,"./util":59,"snabbdom":40}],55:[function(require,module,exports){ (function (global){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); exports.makeHTMLDriver = makeHTMLDriver; var _rx = (typeof window !== "undefined" ? window['Rx'] : typeof global !== "undefined" ? global['Rx'] : null); var _snabbdomToHtml = require('snabbdom-to-html'); var _snabbdomToHtml2 = _interopRequireDefault(_snabbdomToHtml); var _transposition = require('./transposition'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var HTMLSource = function () { function HTMLSource(vNode$) { _classCallCheck(this, HTMLSource); this._html$ = vNode$.last().map(_snabbdomToHtml2.default); } _createClass(HTMLSource, [{ key: 'select', value: function select() { return new HTMLSource(_rx.Observable.empty()); } }, { key: 'events', value: function events() { return _rx.Observable.empty(); } }, { key: 'elements', get: function get() { return this._html$; } }]); return HTMLSource; }(); function makeHTMLDriver() { var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; var transposition = options.transposition || false; return function htmlDriver(vNode$) { var preprocessedVNode$ = transposition ? vNode$.map(_transposition.transposeVNode).switch() : vNode$; return new HTMLSource(preprocessedVNode$); }; } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"./transposition":58,"snabbdom-to-html":25}],56:[function(require,module,exports){ (function (global){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.MockedDOMSource = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); exports.mockDOMSource = mockDOMSource; var _rx = (typeof window !== "undefined" ? window['Rx'] : typeof global !== "undefined" ? global['Rx'] : null); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var MockedDOMSource = exports.MockedDOMSource = function () { function MockedDOMSource(_mockConfig) { _classCallCheck(this, MockedDOMSource); this._mockConfig = _mockConfig; if (_mockConfig['elements']) { this.elements = _mockConfig['elements']; } else { this.elements = _rx.Observable.empty(); } } _createClass(MockedDOMSource, [{ key: 'events', value: function events(eventType) { var mockConfig = this._mockConfig; var keys = Object.keys(mockConfig); var keysLen = keys.length; for (var i = 0; i < keysLen; i++) { var key = keys[i]; if (key === eventType) { return mockConfig[key]; } } return _rx.Observable.empty(); } }, { key: 'select', value: function select(selector) { var mockConfig = this._mockConfig; var keys = Object.keys(mockConfig); var keysLen = keys.length; for (var i = 0; i < keysLen; i++) { var key = keys[i]; if (key === selector) { return new MockedDOMSource(mockConfig[key]); } } return new MockedDOMSource({}); } }]); return MockedDOMSource; }(); function mockDOMSource(mockConfig) { return new MockedDOMSource(mockConfig); } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],57:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.DatasetModule = exports.EventsModule = exports.HeroModule = exports.AttrsModule = exports.PropsModule = exports.ClassModule = exports.StyleModule = undefined; var _class = require('snabbdom/modules/class'); var _class2 = _interopRequireDefault(_class); var _props = require('snabbdom/modules/props'); var _props2 = _interopRequireDefault(_props); var _attributes = require('snabbdom/modules/attributes'); var _attributes2 = _interopRequireDefault(_attributes); var _eventlisteners = require('snabbdom/modules/eventlisteners'); var _eventlisteners2 = _interopRequireDefault(_eventlisteners); var _style = require('snabbdom/modules/style'); var _style2 = _interopRequireDefault(_style); var _hero = require('snabbdom/modules/hero'); var _hero2 = _interopRequireDefault(_hero); var _dataset = require('snabbdom/modules/dataset'); var _dataset2 = _interopRequireDefault(_dataset); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = [_style2.default, _class2.default, _props2.default, _attributes2.default]; exports.StyleModule = _style2.default; exports.ClassModule = _class2.default; exports.PropsModule = _props2.default; exports.AttrsModule = _attributes2.default; exports.HeroModule = _hero2.default; exports.EventsModule = _eventlisteners2.default; exports.DatasetModule = _dataset2.default; },{"snabbdom/modules/attributes":33,"snabbdom/modules/class":34,"snabbdom/modules/dataset":35,"snabbdom/modules/eventlisteners":36,"snabbdom/modules/hero":37,"snabbdom/modules/props":38,"snabbdom/modules/style":39}],58:[function(require,module,exports){ (function (global){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; exports.transposeVNode = transposeVNode; var _rx = (typeof window !== "undefined" ? window['Rx'] : typeof global !== "undefined" ? global['Rx'] : null); function createVTree(vNode, children) { return { sel: vNode.sel, data: vNode.data, text: vNode.text, elm: vNode.elm, key: vNode.key, children: children }; } function transposeVNode(vNode) { // eslint-disable-line complexity if (vNode && vNode.data && vNode.data.static) { return _rx.Observable.just(vNode); } else if (typeof vNode.subscribe === 'function') { return vNode.map(transposeVNode).switch(); } else if (vNode !== null && (typeof vNode === 'undefined' ? 'undefined' : _typeof(vNode)) === 'object') { if (!vNode.children || vNode.children.length === 0) { return _rx.Observable.just(vNode); } return _rx.Observable.combineLatest(vNode.children.map(transposeVNode), function () { for (var _len = arguments.length, children = Array(_len), _key = 0; _key < _len; _key++) { children[_key] = arguments[_key]; } return createVTree(vNode, children); }); } else { throw new TypeError('transposition: Unhandled vNode type'); } } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],59:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; exports.getElement = getElement; exports.getScope = getScope; exports.getSelectors = getSelectors; var matchesSelector = void 0; try { exports.matchesSelector = matchesSelector = require('matches-selector'); } catch (e) { exports.matchesSelector = matchesSelector = Function.prototype; } exports.matchesSelector = matchesSelector; function isElement(obj) { // eslint-disable-line complexity return (typeof HTMLElement === 'undefined' ? 'undefined' : _typeof(HTMLElement)) === 'object' ? obj instanceof HTMLElement || obj instanceof DocumentFragment // eslint-disable-line : obj && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null && (obj.nodeType === 1 || obj.nodeType === 11) && typeof obj.nodeName === 'string'; } var SCOPE_PREFIX = exports.SCOPE_PREFIX = '$$CYCLEDOM$$-'; function getElement(selectors) { // eslint-disable-line complexity var domElement = typeof selectors === 'string' ? document.querySelector(selectors) : selectors; if (typeof selectors === 'string' && domElement === null) { throw new Error('Cannot render into unknown element \'' + selectors + '\''); } else if (!isElement(domElement)) { throw new Error('Given container is not a DOM element neither a ' + 'selector string.'); } return domElement; } function getScope(namespace) { return namespace.filter(function (c) { return c.indexOf(SCOPE_PREFIX) > -1; }).slice(-1) // only need the latest, most specific, isolated boundary .join(''); } function getSelectors(namespace) { return namespace.filter(function (c) { return c.indexOf(SCOPE_PREFIX) === -1; }).join(' '); } var eventTypesThatDontBubble = exports.eventTypesThatDontBubble = ['load', 'unload', 'focus', 'blur', 'mouseenter', 'mouseleave', 'submit', 'change', 'reset', 'timeupdate', 'playing', 'waiting', 'seeking', 'seeked', 'ended', 'loadedmetadata', 'loadeddata', 'canplay', 'canplaythrough', 'durationchange', 'play', 'pause', 'ratechange', 'volumechange', 'suspend', 'emptied', 'stalled', 'scroll']; },{"matches-selector":21}]},{},[51])(51) });