diff --git a/dist/quill.js b/dist/quill.js
new file mode 100644
index 0000000000..f261adec4b
--- /dev/null
+++ b/dist/quill.js
@@ -0,0 +1,9964 @@
+/*! Quill Editor v0.15.3
+ * https://quilljs.com/
+ * Copyright (c) 2014, Jason Chen
+ * Copyright (c) 2013, salesforce.com
+ */
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Quill=e()}}(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);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o
+ * Build: `lodash modern include="difference,flatten,intersection,last,all,each,invoke,map,pluck,reduce,bind,defer,partial,clone,defaults,has,keys,omit,values,isArray,isElement,isEqual,isNumber,isObject,isString,uniqueId" --debug --output .build/lodash.js`
+ * Copyright 2012-2013 The Dojo Foundation
+ * Based on Underscore.js 1.5.2
+ * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ * Available under MIT license
+ */
+;(function() {
+
+ /** Used as a safe reference for `undefined` in pre ES5 environments */
+ var undefined;
+
+ /** Used to pool arrays and objects used internally */
+ var arrayPool = [],
+ objectPool = [];
+
+ /** Used to generate unique IDs */
+ var idCounter = 0;
+
+ /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */
+ var keyPrefix = +new Date + '';
+
+ /** Used as the size when optimizations are enabled for large arrays */
+ var largeArraySize = 75;
+
+ /** Used as the max size of the `arrayPool` and `objectPool` */
+ var maxPoolSize = 40;
+
+ /** Used to match regexp flags from their coerced string values */
+ var reFlags = /\w*$/;
+
+ /** Used to detected named functions */
+ var reFuncName = /^\s*function[ \n\r\t]+\w/;
+
+ /** Used to detect functions containing a `this` reference */
+ var reThis = /\bthis\b/;
+
+ /** `Object#toString` result shortcuts */
+ var argsClass = '[object Arguments]',
+ arrayClass = '[object Array]',
+ boolClass = '[object Boolean]',
+ dateClass = '[object Date]',
+ funcClass = '[object Function]',
+ numberClass = '[object Number]',
+ objectClass = '[object Object]',
+ regexpClass = '[object RegExp]',
+ stringClass = '[object String]';
+
+ /** Used to identify object classifications that `_.clone` supports */
+ var cloneableClasses = {};
+ cloneableClasses[funcClass] = false;
+ cloneableClasses[argsClass] = cloneableClasses[arrayClass] =
+ cloneableClasses[boolClass] = cloneableClasses[dateClass] =
+ cloneableClasses[numberClass] = cloneableClasses[objectClass] =
+ cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true;
+
+ /** Used as the property descriptor for `__bindData__` */
+ var descriptor = {
+ 'configurable': false,
+ 'enumerable': false,
+ 'value': null,
+ 'writable': false
+ };
+
+ /** Used to determine if values are of the language type Object */
+ var objectTypes = {
+ 'boolean': false,
+ 'function': true,
+ 'object': true,
+ 'number': false,
+ 'string': false,
+ 'undefined': false
+ };
+
+ /** Used as a reference to the global object */
+ var root = (objectTypes[typeof window] && window) || this;
+
+ /** Detect free variable `exports` */
+ var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;
+
+ /** Detect free variable `module` */
+ var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
+
+ /** Detect the popular CommonJS extension `module.exports` */
+ var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;
+
+ /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */
+ var freeGlobal = objectTypes[typeof global] && global;
+ if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
+ root = freeGlobal;
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * The base implementation of `_.indexOf` without support for binary searches
+ * or `fromIndex` constraints.
+ *
+ * @private
+ * @param {Array} array The array to search.
+ * @param {*} value The value to search for.
+ * @param {number} [fromIndex=0] The index to search from.
+ * @returns {number} Returns the index of the matched value or `-1`.
+ */
+ function baseIndexOf(array, value, fromIndex) {
+ var index = (fromIndex || 0) - 1,
+ length = array ? array.length : 0;
+
+ while (++index < length) {
+ if (array[index] === value) {
+ return index;
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * An implementation of `_.contains` for cache objects that mimics the return
+ * signature of `_.indexOf` by returning `0` if the value is found, else `-1`.
+ *
+ * @private
+ * @param {Object} cache The cache object to inspect.
+ * @param {*} value The value to search for.
+ * @returns {number} Returns `0` if `value` is found, else `-1`.
+ */
+ function cacheIndexOf(cache, value) {
+ var type = typeof value;
+ cache = cache.cache;
+
+ if (type == 'boolean' || value == null) {
+ return cache[value] ? 0 : -1;
+ }
+ if (type != 'number' && type != 'string') {
+ type = 'object';
+ }
+ var key = type == 'number' ? value : keyPrefix + value;
+ cache = (cache = cache[type]) && cache[key];
+
+ return type == 'object'
+ ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1)
+ : (cache ? 0 : -1);
+ }
+
+ /**
+ * Adds a given value to the corresponding cache object.
+ *
+ * @private
+ * @param {*} value The value to add to the cache.
+ */
+ function cachePush(value) {
+ var cache = this.cache,
+ type = typeof value;
+
+ if (type == 'boolean' || value == null) {
+ cache[value] = true;
+ } else {
+ if (type != 'number' && type != 'string') {
+ type = 'object';
+ }
+ var key = type == 'number' ? value : keyPrefix + value,
+ typeCache = cache[type] || (cache[type] = {});
+
+ if (type == 'object') {
+ (typeCache[key] || (typeCache[key] = [])).push(value);
+ } else {
+ typeCache[key] = true;
+ }
+ }
+ }
+
+ /**
+ * Creates a cache object to optimize linear searches of large arrays.
+ *
+ * @private
+ * @param {Array} [array=[]] The array to search.
+ * @returns {null|Object} Returns the cache object or `null` if caching should not be used.
+ */
+ function createCache(array) {
+ var index = -1,
+ length = array.length,
+ first = array[0],
+ mid = array[(length / 2) | 0],
+ last = array[length - 1];
+
+ if (first && typeof first == 'object' &&
+ mid && typeof mid == 'object' && last && typeof last == 'object') {
+ return false;
+ }
+ var cache = getObject();
+ cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false;
+
+ var result = getObject();
+ result.array = array;
+ result.cache = cache;
+ result.push = cachePush;
+
+ while (++index < length) {
+ result.push(array[index]);
+ }
+ return result;
+ }
+
+ /**
+ * Gets an array from the array pool or creates a new one if the pool is empty.
+ *
+ * @private
+ * @returns {Array} The array from the pool.
+ */
+ function getArray() {
+ return arrayPool.pop() || [];
+ }
+
+ /**
+ * Gets an object from the object pool or creates a new one if the pool is empty.
+ *
+ * @private
+ * @returns {Object} The object from the pool.
+ */
+ function getObject() {
+ return objectPool.pop() || {
+ 'array': null,
+ 'cache': null,
+ 'false': false,
+ 'null': false,
+ 'number': null,
+ 'object': null,
+ 'push': null,
+ 'string': null,
+ 'true': false,
+ 'undefined': false
+ };
+ }
+
+ /**
+ * Releases the given array back to the array pool.
+ *
+ * @private
+ * @param {Array} [array] The array to release.
+ */
+ function releaseArray(array) {
+ array.length = 0;
+ if (arrayPool.length < maxPoolSize) {
+ arrayPool.push(array);
+ }
+ }
+
+ /**
+ * Releases the given object back to the object pool.
+ *
+ * @private
+ * @param {Object} [object] The object to release.
+ */
+ function releaseObject(object) {
+ var cache = object.cache;
+ if (cache) {
+ releaseObject(cache);
+ }
+ object.array = object.cache =object.object = object.number = object.string =null;
+ if (objectPool.length < maxPoolSize) {
+ objectPool.push(object);
+ }
+ }
+
+ /**
+ * Slices the `collection` from the `start` index up to, but not including,
+ * the `end` index.
+ *
+ * Note: This function is used instead of `Array#slice` to support node lists
+ * in IE < 9 and to ensure dense arrays are returned.
+ *
+ * @private
+ * @param {Array|Object|string} collection The collection to slice.
+ * @param {number} start The start index.
+ * @param {number} end The end index.
+ * @returns {Array} Returns the new array.
+ */
+ function slice(array, start, end) {
+ start || (start = 0);
+ if (typeof end == 'undefined') {
+ end = array ? array.length : 0;
+ }
+ var index = -1,
+ length = end - start || 0,
+ result = Array(length < 0 ? 0 : length);
+
+ while (++index < length) {
+ result[index] = array[start + index];
+ }
+ return result;
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Used for `Array` method references.
+ *
+ * Normally `Array.prototype` would suffice, however, using an array literal
+ * avoids issues in Narwhal.
+ */
+ var arrayRef = [];
+
+ /** Used for native method references */
+ var objectProto = Object.prototype;
+
+ /** Used to resolve the internal [[Class]] of values */
+ var toString = objectProto.toString;
+
+ /** Used to detect if a method is native */
+ var reNative = RegExp('^' +
+ String(toString)
+ .replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+ .replace(/toString| for [^\]]+/g, '.*?') + '$'
+ );
+
+ /** Native method shortcuts */
+ var fnToString = Function.prototype.toString,
+ hasOwnProperty = objectProto.hasOwnProperty,
+ push = arrayRef.push,
+ unshift = arrayRef.unshift;
+
+ /** Used to set meta data on functions */
+ var defineProperty = (function() {
+ // IE 8 only accepts DOM elements
+ try {
+ var o = {},
+ func = isNative(func = Object.defineProperty) && func,
+ result = func(o, o, o) && func;
+ } catch(e) { }
+ return result;
+ }());
+
+ /* Native method shortcuts for methods with the same name as other `lodash` methods */
+ var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,
+ nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray,
+ nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys,
+ nativeMax = Math.max;
+
+ /** Used to lookup a built-in constructor by [[Class]] */
+ var ctorByClass = {};
+ ctorByClass[arrayClass] = Array;
+ ctorByClass[boolClass] = Boolean;
+ ctorByClass[dateClass] = Date;
+ ctorByClass[funcClass] = Function;
+ ctorByClass[objectClass] = Object;
+ ctorByClass[numberClass] = Number;
+ ctorByClass[regexpClass] = RegExp;
+ ctorByClass[stringClass] = String;
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Creates a `lodash` object which wraps the given value to enable intuitive
+ * method chaining.
+ *
+ * In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
+ * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`,
+ * and `unshift`
+ *
+ * Chaining is supported in custom builds as long as the `value` method is
+ * implicitly or explicitly included in the build.
+ *
+ * The chainable wrapper functions are:
+ * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`,
+ * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`,
+ * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`,
+ * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,
+ * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,
+ * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,
+ * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`,
+ * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`,
+ * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`,
+ * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`,
+ * and `zip`
+ *
+ * The non-chainable wrapper functions are:
+ * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`,
+ * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`,
+ * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,
+ * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`,
+ * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`,
+ * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`,
+ * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`,
+ * `template`, `unescape`, `uniqueId`, and `value`
+ *
+ * The wrapper functions `first` and `last` return wrapped values when `n` is
+ * provided, otherwise they return unwrapped values.
+ *
+ * Explicit chaining can be enabled by using the `_.chain` method.
+ *
+ * @name _
+ * @constructor
+ * @category Chaining
+ * @param {*} value The value to wrap in a `lodash` instance.
+ * @returns {Object} Returns a `lodash` instance.
+ * @example
+ *
+ * var wrapped = _([1, 2, 3]);
+ *
+ * // returns an unwrapped value
+ * wrapped.reduce(function(sum, num) {
+ * return sum + num;
+ * });
+ * // => 6
+ *
+ * // returns a wrapped value
+ * var squares = wrapped.map(function(num) {
+ * return num * num;
+ * });
+ *
+ * _.isArray(squares);
+ * // => false
+ *
+ * _.isArray(squares.value());
+ * // => true
+ */
+ function lodash() {
+ // no operation performed
+ }
+
+ /**
+ * An object used to flag environments features.
+ *
+ * @static
+ * @memberOf _
+ * @type Object
+ */
+ var support = lodash.support = {};
+
+ /**
+ * Detect if functions can be decompiled by `Function#toString`
+ * (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps).
+ *
+ * @memberOf _.support
+ * @type boolean
+ */
+ support.funcDecomp = !isNative(root.WinRTError) && reThis.test(function() { return this; });
+
+ /**
+ * Detect if `Function#name` is supported (all but IE).
+ *
+ * @memberOf _.support
+ * @type boolean
+ */
+ support.funcNames = typeof Function.name == 'string';
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * The base implementation of `_.bind` that creates the bound function and
+ * sets its meta data.
+ *
+ * @private
+ * @param {Array} bindData The bind data array.
+ * @returns {Function} Returns the new bound function.
+ */
+ function baseBind(bindData) {
+ var func = bindData[0],
+ partialArgs = bindData[2],
+ thisArg = bindData[4];
+
+ function bound() {
+ // `Function#bind` spec
+ // http://es5.github.io/#x15.3.4.5
+ if (partialArgs) {
+ // avoid `arguments` object deoptimizations by using `slice` instead
+ // of `Array.prototype.slice.call` and not assigning `arguments` to a
+ // variable as a ternary expression
+ var args = slice(partialArgs);
+ push.apply(args, arguments);
+ }
+ // mimic the constructor's `return` behavior
+ // http://es5.github.io/#x13.2.2
+ if (this instanceof bound) {
+ // ensure `new bound` is an instance of `func`
+ var thisBinding = baseCreate(func.prototype),
+ result = func.apply(thisBinding, args || arguments);
+ return isObject(result) ? result : thisBinding;
+ }
+ return func.apply(thisArg, args || arguments);
+ }
+ setBindData(bound, bindData);
+ return bound;
+ }
+
+ /**
+ * The base implementation of `_.clone` without argument juggling or support
+ * for `thisArg` binding.
+ *
+ * @private
+ * @param {*} value The value to clone.
+ * @param {boolean} [isDeep=false] Specify a deep clone.
+ * @param {Function} [callback] The function to customize cloning values.
+ * @param {Array} [stackA=[]] Tracks traversed source objects.
+ * @param {Array} [stackB=[]] Associates clones with source counterparts.
+ * @returns {*} Returns the cloned value.
+ */
+ function baseClone(value, isDeep, callback, stackA, stackB) {
+ if (callback) {
+ var result = callback(value);
+ if (typeof result != 'undefined') {
+ return result;
+ }
+ }
+ // inspect [[Class]]
+ var isObj = isObject(value);
+ if (isObj) {
+ var className = toString.call(value);
+ if (!cloneableClasses[className]) {
+ return value;
+ }
+ var ctor = ctorByClass[className];
+ switch (className) {
+ case boolClass:
+ case dateClass:
+ return new ctor(+value);
+
+ case numberClass:
+ case stringClass:
+ return new ctor(value);
+
+ case regexpClass:
+ result = ctor(value.source, reFlags.exec(value));
+ result.lastIndex = value.lastIndex;
+ return result;
+ }
+ } else {
+ return value;
+ }
+ var isArr = isArray(value);
+ if (isDeep) {
+ // check for circular references and return corresponding clone
+ var initedStack = !stackA;
+ stackA || (stackA = getArray());
+ stackB || (stackB = getArray());
+
+ var length = stackA.length;
+ while (length--) {
+ if (stackA[length] == value) {
+ return stackB[length];
+ }
+ }
+ result = isArr ? ctor(value.length) : {};
+ }
+ else {
+ result = isArr ? slice(value) : assign({}, value);
+ }
+ // add array properties assigned by `RegExp#exec`
+ if (isArr) {
+ if (hasOwnProperty.call(value, 'index')) {
+ result.index = value.index;
+ }
+ if (hasOwnProperty.call(value, 'input')) {
+ result.input = value.input;
+ }
+ }
+ // exit for shallow clone
+ if (!isDeep) {
+ return result;
+ }
+ // add the source value to the stack of traversed objects
+ // and associate it with its clone
+ stackA.push(value);
+ stackB.push(result);
+
+ // recursively populate clone (susceptible to call stack limits)
+ (isArr ? forEach : forOwn)(value, function(objValue, key) {
+ result[key] = baseClone(objValue, isDeep, callback, stackA, stackB);
+ });
+
+ if (initedStack) {
+ releaseArray(stackA);
+ releaseArray(stackB);
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.create` without support for assigning
+ * properties to the created object.
+ *
+ * @private
+ * @param {Object} prototype The object to inherit from.
+ * @returns {Object} Returns the new object.
+ */
+ function baseCreate(prototype, properties) {
+ return isObject(prototype) ? nativeCreate(prototype) : {};
+ }
+ // fallback for browsers without `Object.create`
+ if (!nativeCreate) {
+ baseCreate = (function() {
+ function Object() {}
+ return function(prototype) {
+ if (isObject(prototype)) {
+ Object.prototype = prototype;
+ var result = new Object;
+ Object.prototype = null;
+ }
+ return result || root.Object();
+ };
+ }());
+ }
+
+ /**
+ * The base implementation of `_.createCallback` without support for creating
+ * "_.pluck" or "_.where" style callbacks.
+ *
+ * @private
+ * @param {*} [func=identity] The value to convert to a callback.
+ * @param {*} [thisArg] The `this` binding of the created callback.
+ * @param {number} [argCount] The number of arguments the callback accepts.
+ * @returns {Function} Returns a callback function.
+ */
+ function baseCreateCallback(func, thisArg, argCount) {
+ if (typeof func != 'function') {
+ return identity;
+ }
+ // exit early for no `thisArg` or already bound by `Function#bind`
+ if (typeof thisArg == 'undefined' || !('prototype' in func)) {
+ return func;
+ }
+ var bindData = func.__bindData__;
+ if (typeof bindData == 'undefined') {
+ if (support.funcNames) {
+ bindData = !func.name;
+ }
+ bindData = bindData || !support.funcDecomp;
+ if (!bindData) {
+ var source = fnToString.call(func);
+ if (!support.funcNames) {
+ bindData = !reFuncName.test(source);
+ }
+ if (!bindData) {
+ // checks if `func` references the `this` keyword and stores the result
+ bindData = reThis.test(source);
+ setBindData(func, bindData);
+ }
+ }
+ }
+ // exit early if there are no `this` references or `func` is bound
+ if (bindData === false || (bindData !== true && bindData[1] & 1)) {
+ return func;
+ }
+ switch (argCount) {
+ case 1: return function(value) {
+ return func.call(thisArg, value);
+ };
+ case 2: return function(a, b) {
+ return func.call(thisArg, a, b);
+ };
+ 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);
+ };
+ }
+ return bind(func, thisArg);
+ }
+
+ /**
+ * The base implementation of `createWrapper` that creates the wrapper and
+ * sets its meta data.
+ *
+ * @private
+ * @param {Array} bindData The bind data array.
+ * @returns {Function} Returns the new function.
+ */
+ function baseCreateWrapper(bindData) {
+ var func = bindData[0],
+ bitmask = bindData[1],
+ partialArgs = bindData[2],
+ partialRightArgs = bindData[3],
+ thisArg = bindData[4],
+ arity = bindData[5];
+
+ var isBind = bitmask & 1,
+ isBindKey = bitmask & 2,
+ isCurry = bitmask & 4,
+ isCurryBound = bitmask & 8,
+ key = func;
+
+ function bound() {
+ var thisBinding = isBind ? thisArg : this;
+ if (partialArgs) {
+ var args = slice(partialArgs);
+ push.apply(args, arguments);
+ }
+ if (partialRightArgs || isCurry) {
+ args || (args = slice(arguments));
+ if (partialRightArgs) {
+ push.apply(args, partialRightArgs);
+ }
+ if (isCurry && args.length < arity) {
+ bitmask |= 16 & ~32;
+ return baseCreateWrapper([func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity]);
+ }
+ }
+ args || (args = arguments);
+ if (isBindKey) {
+ func = thisBinding[key];
+ }
+ if (this instanceof bound) {
+ thisBinding = baseCreate(func.prototype);
+ var result = func.apply(thisBinding, args);
+ return isObject(result) ? result : thisBinding;
+ }
+ return func.apply(thisBinding, args);
+ }
+ setBindData(bound, bindData);
+ return bound;
+ }
+
+ /**
+ * The base implementation of `_.difference` that accepts a single array
+ * of values to exclude.
+ *
+ * @private
+ * @param {Array} array The array to process.
+ * @param {Array} [values] The array of values to exclude.
+ * @returns {Array} Returns a new array of filtered values.
+ */
+ function baseDifference(array, values) {
+ var index = -1,
+ indexOf = getIndexOf(),
+ length = array ? array.length : 0,
+ isLarge = length >= largeArraySize && indexOf === baseIndexOf,
+ result = [];
+
+ if (isLarge) {
+ var cache = createCache(values);
+ if (cache) {
+ indexOf = cacheIndexOf;
+ values = cache;
+ } else {
+ isLarge = false;
+ }
+ }
+ while (++index < length) {
+ var value = array[index];
+ if (indexOf(values, value) < 0) {
+ result.push(value);
+ }
+ }
+ if (isLarge) {
+ releaseObject(values);
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.flatten` without support for callback
+ * shorthands or `thisArg` binding.
+ *
+ * @private
+ * @param {Array} array The array to flatten.
+ * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
+ * @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects.
+ * @param {number} [fromIndex=0] The index to start from.
+ * @returns {Array} Returns a new flattened array.
+ */
+ function baseFlatten(array, isShallow, isStrict, fromIndex) {
+ var index = (fromIndex || 0) - 1,
+ length = array ? array.length : 0,
+ result = [];
+
+ while (++index < length) {
+ var value = array[index];
+
+ if (value && typeof value == 'object' && typeof value.length == 'number'
+ && (isArray(value) || isArguments(value))) {
+ // recursively flatten arrays (susceptible to call stack limits)
+ if (!isShallow) {
+ value = baseFlatten(value, isShallow, isStrict);
+ }
+ var valIndex = -1,
+ valLength = value.length,
+ resIndex = result.length;
+
+ result.length += valLength;
+ while (++valIndex < valLength) {
+ result[resIndex++] = value[valIndex];
+ }
+ } else if (!isStrict) {
+ result.push(value);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * The base implementation of `_.isEqual`, without support for `thisArg` binding,
+ * that allows partial "_.where" style comparisons.
+ *
+ * @private
+ * @param {*} a The value to compare.
+ * @param {*} b The other value to compare.
+ * @param {Function} [callback] The function to customize comparing values.
+ * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons.
+ * @param {Array} [stackA=[]] Tracks traversed `a` objects.
+ * @param {Array} [stackB=[]] Tracks traversed `b` objects.
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+ */
+ function baseIsEqual(a, b, callback, isWhere, stackA, stackB) {
+ // used to indicate that when comparing objects, `a` has at least the properties of `b`
+ if (callback) {
+ var result = callback(a, b);
+ if (typeof result != 'undefined') {
+ return !!result;
+ }
+ }
+ // exit early for identical values
+ if (a === b) {
+ // treat `+0` vs. `-0` as not equal
+ return a !== 0 || (1 / a == 1 / b);
+ }
+ var type = typeof a,
+ otherType = typeof b;
+
+ // exit early for unlike primitive values
+ if (a === a &&
+ !(a && objectTypes[type]) &&
+ !(b && objectTypes[otherType])) {
+ return false;
+ }
+ // exit early for `null` and `undefined` avoiding ES3's Function#call behavior
+ // http://es5.github.io/#x15.3.4.4
+ if (a == null || b == null) {
+ return a === b;
+ }
+ // compare [[Class]] names
+ var className = toString.call(a),
+ otherClass = toString.call(b);
+
+ if (className == argsClass) {
+ className = objectClass;
+ }
+ if (otherClass == argsClass) {
+ otherClass = objectClass;
+ }
+ if (className != otherClass) {
+ return false;
+ }
+ switch (className) {
+ case boolClass:
+ case dateClass:
+ // coerce dates and booleans to numbers, dates to milliseconds and booleans
+ // to `1` or `0` treating invalid dates coerced to `NaN` as not equal
+ return +a == +b;
+
+ case numberClass:
+ // treat `NaN` vs. `NaN` as equal
+ return (a != +a)
+ ? b != +b
+ // but treat `+0` vs. `-0` as not equal
+ : (a == 0 ? (1 / a == 1 / b) : a == +b);
+
+ case regexpClass:
+ case stringClass:
+ // coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
+ // treat string primitives and their corresponding object instances as equal
+ return a == String(b);
+ }
+ var isArr = className == arrayClass;
+ if (!isArr) {
+ // unwrap any `lodash` wrapped values
+ var aWrapped = hasOwnProperty.call(a, '__wrapped__'),
+ bWrapped = hasOwnProperty.call(b, '__wrapped__');
+
+ if (aWrapped || bWrapped) {
+ return baseIsEqual(aWrapped ? a.__wrapped__ : a, bWrapped ? b.__wrapped__ : b, callback, isWhere, stackA, stackB);
+ }
+ // exit for functions and DOM nodes
+ if (className != objectClass) {
+ return false;
+ }
+ // in older versions of Opera, `arguments` objects have `Array` constructors
+ var ctorA = a.constructor,
+ ctorB = b.constructor;
+
+ // non `Object` object instances with different constructors are not equal
+ if (ctorA != ctorB &&
+ !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
+ ('constructor' in a && 'constructor' in b)
+ ) {
+ return false;
+ }
+ }
+ // assume cyclic structures are equal
+ // the algorithm for detecting cyclic structures is adapted from ES 5.1
+ // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
+ var initedStack = !stackA;
+ stackA || (stackA = getArray());
+ stackB || (stackB = getArray());
+
+ var length = stackA.length;
+ while (length--) {
+ if (stackA[length] == a) {
+ return stackB[length] == b;
+ }
+ }
+ var size = 0;
+ result = true;
+
+ // add `a` and `b` to the stack of traversed objects
+ stackA.push(a);
+ stackB.push(b);
+
+ // recursively compare objects and arrays (susceptible to call stack limits)
+ if (isArr) {
+ // compare lengths to determine if a deep comparison is necessary
+ length = a.length;
+ size = b.length;
+ result = size == length;
+
+ if (result || isWhere) {
+ // deep compare the contents, ignoring non-numeric properties
+ while (size--) {
+ var index = length,
+ value = b[size];
+
+ if (isWhere) {
+ while (index--) {
+ if ((result = baseIsEqual(a[index], value, callback, isWhere, stackA, stackB))) {
+ break;
+ }
+ }
+ } else if (!(result = baseIsEqual(a[size], value, callback, isWhere, stackA, stackB))) {
+ break;
+ }
+ }
+ }
+ }
+ else {
+ // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
+ // which, in this case, is more costly
+ forIn(b, function(value, key, b) {
+ if (hasOwnProperty.call(b, key)) {
+ // count the number of properties.
+ size++;
+ // deep compare each property value.
+ return (result = hasOwnProperty.call(a, key) && baseIsEqual(a[key], value, callback, isWhere, stackA, stackB));
+ }
+ });
+
+ if (result && !isWhere) {
+ // ensure both objects have the same number of properties
+ forIn(a, function(value, key, a) {
+ if (hasOwnProperty.call(a, key)) {
+ // `size` will be `-1` if `a` has more properties than `b`
+ return (result = --size > -1);
+ }
+ });
+ }
+ }
+ stackA.pop();
+ stackB.pop();
+
+ if (initedStack) {
+ releaseArray(stackA);
+ releaseArray(stackB);
+ }
+ return result;
+ }
+
+ /**
+ * Creates a function that, when called, either curries or invokes `func`
+ * with an optional `this` binding and partially applied arguments.
+ *
+ * @private
+ * @param {Function|string} func The function or method name to reference.
+ * @param {number} bitmask The bitmask of method flags to compose.
+ * The bitmask may be composed of the following flags:
+ * 1 - `_.bind`
+ * 2 - `_.bindKey`
+ * 4 - `_.curry`
+ * 8 - `_.curry` (bound)
+ * 16 - `_.partial`
+ * 32 - `_.partialRight`
+ * @param {Array} [partialArgs] An array of arguments to prepend to those
+ * provided to the new function.
+ * @param {Array} [partialRightArgs] An array of arguments to append to those
+ * provided to the new function.
+ * @param {*} [thisArg] The `this` binding of `func`.
+ * @param {number} [arity] The arity of `func`.
+ * @returns {Function} Returns the new function.
+ */
+ function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) {
+ var isBind = bitmask & 1,
+ isBindKey = bitmask & 2,
+ isCurry = bitmask & 4,
+ isCurryBound = bitmask & 8,
+ isPartial = bitmask & 16,
+ isPartialRight = bitmask & 32;
+
+ if (!isBindKey && !isFunction(func)) {
+ throw new TypeError;
+ }
+ if (isPartial && !partialArgs.length) {
+ bitmask &= ~16;
+ isPartial = partialArgs = false;
+ }
+ if (isPartialRight && !partialRightArgs.length) {
+ bitmask &= ~32;
+ isPartialRight = partialRightArgs = false;
+ }
+ var bindData = func && func.__bindData__;
+ if (bindData && bindData !== true) {
+ // clone `bindData`
+ bindData = slice(bindData);
+ if (bindData[2]) {
+ bindData[2] = slice(bindData[2]);
+ }
+ if (bindData[3]) {
+ bindData[3] = slice(bindData[3]);
+ }
+ // set `thisBinding` is not previously bound
+ if (isBind && !(bindData[1] & 1)) {
+ bindData[4] = thisArg;
+ }
+ // set if previously bound but not currently (subsequent curried functions)
+ if (!isBind && bindData[1] & 1) {
+ bitmask |= 8;
+ }
+ // set curried arity if not yet set
+ if (isCurry && !(bindData[1] & 4)) {
+ bindData[5] = arity;
+ }
+ // append partial left arguments
+ if (isPartial) {
+ push.apply(bindData[2] || (bindData[2] = []), partialArgs);
+ }
+ // append partial right arguments
+ if (isPartialRight) {
+ unshift.apply(bindData[3] || (bindData[3] = []), partialRightArgs);
+ }
+ // merge flags
+ bindData[1] |= bitmask;
+ return createWrapper.apply(null, bindData);
+ }
+ // fast path for `_.bind`
+ var creater = (bitmask == 1 || bitmask === 17) ? baseBind : baseCreateWrapper;
+ return creater([func, bitmask, partialArgs, partialRightArgs, thisArg, arity]);
+ }
+
+ /**
+ * Gets the appropriate "indexOf" function. If the `_.indexOf` method is
+ * customized, this method returns the custom method, otherwise it returns
+ * the `baseIndexOf` function.
+ *
+ * @private
+ * @returns {Function} Returns the "indexOf" function.
+ */
+ function getIndexOf() {
+ var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result;
+ return result;
+ }
+
+ /**
+ * Checks if `value` is a native function.
+ *
+ * @private
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if the `value` is a native function, else `false`.
+ */
+ function isNative(value) {
+ return typeof value == 'function' && reNative.test(value);
+ }
+
+ /**
+ * Sets `this` binding data on a given function.
+ *
+ * @private
+ * @param {Function} func The function to set data on.
+ * @param {Array} value The data array to set.
+ */
+ var setBindData = !defineProperty ? noop : function(func, value) {
+ descriptor.value = value;
+ defineProperty(func, '__bindData__', descriptor);
+ };
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Checks if `value` is an `arguments` object.
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`.
+ * @example
+ *
+ * (function() { return _.isArguments(arguments); })(1, 2, 3);
+ * // => true
+ *
+ * _.isArguments([1, 2, 3]);
+ * // => false
+ */
+ function isArguments(value) {
+ return value && typeof value == 'object' && typeof value.length == 'number' &&
+ toString.call(value) == argsClass || false;
+ }
+
+ /**
+ * Checks if `value` is an array.
+ *
+ * @static
+ * @memberOf _
+ * @type Function
+ * @category Objects
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if the `value` is an array, else `false`.
+ * @example
+ *
+ * (function() { return _.isArray(arguments); })();
+ * // => false
+ *
+ * _.isArray([1, 2, 3]);
+ * // => true
+ */
+ var isArray = nativeIsArray || function(value) {
+ return value && typeof value == 'object' && typeof value.length == 'number' &&
+ toString.call(value) == arrayClass || false;
+ };
+
+ /**
+ * A fallback implementation of `Object.keys` which produces an array of the
+ * given object's own enumerable property names.
+ *
+ * @private
+ * @type Function
+ * @param {Object} object The object to inspect.
+ * @returns {Array} Returns an array of property names.
+ */
+ var shimKeys = function(object) {
+ var index, iterable = object, result = [];
+ if (!iterable) return result;
+ if (!(objectTypes[typeof object])) return result;
+ for (index in iterable) {
+ if (hasOwnProperty.call(iterable, index)) {
+ result.push(index);
+ }
+ }
+ return result
+ };
+
+ /**
+ * Creates an array composed of the own enumerable property names of an object.
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {Object} object The object to inspect.
+ * @returns {Array} Returns an array of property names.
+ * @example
+ *
+ * _.keys({ 'one': 1, 'two': 2, 'three': 3 });
+ * // => ['one', 'two', 'three'] (property order is not guaranteed across environments)
+ */
+ var keys = !nativeKeys ? shimKeys : function(object) {
+ if (!isObject(object)) {
+ return [];
+ }
+ return nativeKeys(object);
+ };
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Assigns own enumerable properties of source object(s) to the destination
+ * object. Subsequent sources will overwrite property assignments of previous
+ * sources. If a callback is provided it will be executed to produce the
+ * assigned values. The callback is bound to `thisArg` and invoked with two
+ * arguments; (objectValue, sourceValue).
+ *
+ * @static
+ * @memberOf _
+ * @type Function
+ * @alias extend
+ * @category Objects
+ * @param {Object} object The destination object.
+ * @param {...Object} [source] The source objects.
+ * @param {Function} [callback] The function to customize assigning values.
+ * @param {*} [thisArg] The `this` binding of `callback`.
+ * @returns {Object} Returns the destination object.
+ * @example
+ *
+ * _.assign({ 'name': 'fred' }, { 'employer': 'slate' });
+ * // => { 'name': 'fred', 'employer': 'slate' }
+ *
+ * var defaults = _.partialRight(_.assign, function(a, b) {
+ * return typeof a == 'undefined' ? b : a;
+ * });
+ *
+ * var object = { 'name': 'barney' };
+ * defaults(object, { 'name': 'fred', 'employer': 'slate' });
+ * // => { 'name': 'barney', 'employer': 'slate' }
+ */
+ var assign = function(object, source, guard) {
+ var index, iterable = object, result = iterable;
+ if (!iterable) return result;
+ var args = arguments,
+ argsIndex = 0,
+ argsLength = typeof guard == 'number' ? 2 : args.length;
+ if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {
+ var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);
+ } else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {
+ callback = args[--argsLength];
+ }
+ while (++argsIndex < argsLength) {
+ iterable = args[argsIndex];
+ if (iterable && objectTypes[typeof iterable]) {
+ var ownIndex = -1,
+ ownProps = objectTypes[typeof iterable] && keys(iterable),
+ length = ownProps ? ownProps.length : 0;
+
+ while (++ownIndex < length) {
+ index = ownProps[ownIndex];
+ result[index] = callback ? callback(result[index], iterable[index]) : iterable[index];
+ }
+ }
+ }
+ return result
+ };
+
+ /**
+ * Creates a clone of `value`. If `isDeep` is `true` nested objects will also
+ * be cloned, otherwise they will be assigned by reference. If a callback
+ * is provided it will be executed to produce the cloned values. If the
+ * callback returns `undefined` cloning will be handled by the method instead.
+ * The callback is bound to `thisArg` and invoked with one argument; (value).
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {*} value The value to clone.
+ * @param {boolean} [isDeep=false] Specify a deep clone.
+ * @param {Function} [callback] The function to customize cloning values.
+ * @param {*} [thisArg] The `this` binding of `callback`.
+ * @returns {*} Returns the cloned value.
+ * @example
+ *
+ * var characters = [
+ * { 'name': 'barney', 'age': 36 },
+ * { 'name': 'fred', 'age': 40 }
+ * ];
+ *
+ * var shallow = _.clone(characters);
+ * shallow[0] === characters[0];
+ * // => true
+ *
+ * var deep = _.clone(characters, true);
+ * deep[0] === characters[0];
+ * // => false
+ *
+ * _.mixin({
+ * 'clone': _.partialRight(_.clone, function(value) {
+ * return _.isElement(value) ? value.cloneNode(false) : undefined;
+ * })
+ * });
+ *
+ * var clone = _.clone(document.body);
+ * clone.childNodes.length;
+ * // => 0
+ */
+ function clone(value, isDeep, callback, thisArg) {
+ // allows working with "Collections" methods without using their `index`
+ // and `collection` arguments for `isDeep` and `callback`
+ if (typeof isDeep != 'boolean' && isDeep != null) {
+ thisArg = callback;
+ callback = isDeep;
+ isDeep = false;
+ }
+ return baseClone(value, isDeep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1));
+ }
+
+ /**
+ * Assigns own enumerable properties of source object(s) to the destination
+ * object for all destination properties that resolve to `undefined`. Once a
+ * property is set, additional defaults of the same property will be ignored.
+ *
+ * @static
+ * @memberOf _
+ * @type Function
+ * @category Objects
+ * @param {Object} object The destination object.
+ * @param {...Object} [source] The source objects.
+ * @param- {Object} [guard] Allows working with `_.reduce` without using its
+ * `key` and `object` arguments as sources.
+ * @returns {Object} Returns the destination object.
+ * @example
+ *
+ * var object = { 'name': 'barney' };
+ * _.defaults(object, { 'name': 'fred', 'employer': 'slate' });
+ * // => { 'name': 'barney', 'employer': 'slate' }
+ */
+ var defaults = function(object, source, guard) {
+ var index, iterable = object, result = iterable;
+ if (!iterable) return result;
+ var args = arguments,
+ argsIndex = 0,
+ argsLength = typeof guard == 'number' ? 2 : args.length;
+ while (++argsIndex < argsLength) {
+ iterable = args[argsIndex];
+ if (iterable && objectTypes[typeof iterable]) {
+ var ownIndex = -1,
+ ownProps = objectTypes[typeof iterable] && keys(iterable),
+ length = ownProps ? ownProps.length : 0;
+
+ while (++ownIndex < length) {
+ index = ownProps[ownIndex];
+ if (typeof result[index] == 'undefined') result[index] = iterable[index];
+ }
+ }
+ }
+ return result
+ };
+
+ /**
+ * Iterates over own and inherited enumerable properties of an object,
+ * executing the callback for each property. The callback is bound to `thisArg`
+ * and invoked with three arguments; (value, key, object). Callbacks may exit
+ * iteration early by explicitly returning `false`.
+ *
+ * @static
+ * @memberOf _
+ * @type Function
+ * @category Objects
+ * @param {Object} object The object to iterate over.
+ * @param {Function} [callback=identity] The function called per iteration.
+ * @param {*} [thisArg] The `this` binding of `callback`.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * function Shape() {
+ * this.x = 0;
+ * this.y = 0;
+ * }
+ *
+ * Shape.prototype.move = function(x, y) {
+ * this.x += x;
+ * this.y += y;
+ * };
+ *
+ * _.forIn(new Shape, function(value, key) {
+ * console.log(key);
+ * });
+ * // => logs 'x', 'y', and 'move' (property order is not guaranteed across environments)
+ */
+ var forIn = function(collection, callback, thisArg) {
+ var index, iterable = collection, result = iterable;
+ if (!iterable) return result;
+ if (!objectTypes[typeof iterable]) return result;
+ callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
+ for (index in iterable) {
+ if (callback(iterable[index], index, collection) === false) return result;
+ }
+ return result
+ };
+
+ /**
+ * Iterates over own enumerable properties of an object, executing the callback
+ * for each property. The callback is bound to `thisArg` and invoked with three
+ * arguments; (value, key, object). Callbacks may exit iteration early by
+ * explicitly returning `false`.
+ *
+ * @static
+ * @memberOf _
+ * @type Function
+ * @category Objects
+ * @param {Object} object The object to iterate over.
+ * @param {Function} [callback=identity] The function called per iteration.
+ * @param {*} [thisArg] The `this` binding of `callback`.
+ * @returns {Object} Returns `object`.
+ * @example
+ *
+ * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
+ * console.log(key);
+ * });
+ * // => logs '0', '1', and 'length' (property order is not guaranteed across environments)
+ */
+ var forOwn = function(collection, callback, thisArg) {
+ var index, iterable = collection, result = iterable;
+ if (!iterable) return result;
+ if (!objectTypes[typeof iterable]) return result;
+ callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
+ var ownIndex = -1,
+ ownProps = objectTypes[typeof iterable] && keys(iterable),
+ length = ownProps ? ownProps.length : 0;
+
+ while (++ownIndex < length) {
+ index = ownProps[ownIndex];
+ if (callback(iterable[index], index, collection) === false) return result;
+ }
+ return result
+ };
+
+ /**
+ * Checks if the specified property name exists as a direct property of `object`,
+ * instead of an inherited property.
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {Object} object The object to inspect.
+ * @param {string} key The name of the property to check.
+ * @returns {boolean} Returns `true` if key is a direct property, else `false`.
+ * @example
+ *
+ * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
+ * // => true
+ */
+ function has(object, key) {
+ return object ? hasOwnProperty.call(object, key) : false;
+ }
+
+ /**
+ * Checks if `value` is a DOM element.
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if the `value` is a DOM element, else `false`.
+ * @example
+ *
+ * _.isElement(document.body);
+ * // => true
+ */
+ function isElement(value) {
+ return value && value.nodeType === 1 || false;
+ }
+
+ /**
+ * Performs a deep comparison between two values to determine if they are
+ * equivalent to each other. If a callback is provided it will be executed
+ * to compare values. If the callback returns `undefined` comparisons will
+ * be handled by the method instead. The callback is bound to `thisArg` and
+ * invoked with two arguments; (a, b).
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {*} a The value to compare.
+ * @param {*} b The other value to compare.
+ * @param {Function} [callback] The function to customize comparing values.
+ * @param {*} [thisArg] The `this` binding of `callback`.
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
+ * @example
+ *
+ * var object = { 'name': 'fred' };
+ * var copy = { 'name': 'fred' };
+ *
+ * object == copy;
+ * // => false
+ *
+ * _.isEqual(object, copy);
+ * // => true
+ *
+ * var words = ['hello', 'goodbye'];
+ * var otherWords = ['hi', 'goodbye'];
+ *
+ * _.isEqual(words, otherWords, function(a, b) {
+ * var reGreet = /^(?:hello|hi)$/i,
+ * aGreet = _.isString(a) && reGreet.test(a),
+ * bGreet = _.isString(b) && reGreet.test(b);
+ *
+ * return (aGreet || bGreet) ? (aGreet == bGreet) : undefined;
+ * });
+ * // => true
+ */
+ function isEqual(a, b, callback, thisArg) {
+ return baseIsEqual(a, b, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 2));
+ }
+
+ /**
+ * Checks if `value` is a function.
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if the `value` is a function, else `false`.
+ * @example
+ *
+ * _.isFunction(_);
+ * // => true
+ */
+ function isFunction(value) {
+ return typeof value == 'function';
+ }
+
+ /**
+ * Checks if `value` is the language type of Object.
+ * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if the `value` is an object, else `false`.
+ * @example
+ *
+ * _.isObject({});
+ * // => true
+ *
+ * _.isObject([1, 2, 3]);
+ * // => true
+ *
+ * _.isObject(1);
+ * // => false
+ */
+ function isObject(value) {
+ // check if the value is the ECMAScript language type of Object
+ // http://es5.github.io/#x8
+ // and avoid a V8 bug
+ // http://code.google.com/p/v8/issues/detail?id=2291
+ return !!(value && objectTypes[typeof value]);
+ }
+
+ /**
+ * Checks if `value` is a number.
+ *
+ * Note: `NaN` is considered a number. See http://es5.github.io/#x8.5.
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if the `value` is a number, else `false`.
+ * @example
+ *
+ * _.isNumber(8.4 * 5);
+ * // => true
+ */
+ function isNumber(value) {
+ return typeof value == 'number' ||
+ value && typeof value == 'object' && toString.call(value) == numberClass || false;
+ }
+
+ /**
+ * Checks if `value` is a string.
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {*} value The value to check.
+ * @returns {boolean} Returns `true` if the `value` is a string, else `false`.
+ * @example
+ *
+ * _.isString('fred');
+ * // => true
+ */
+ function isString(value) {
+ return typeof value == 'string' ||
+ value && typeof value == 'object' && toString.call(value) == stringClass || false;
+ }
+
+ /**
+ * Creates a shallow clone of `object` excluding the specified properties.
+ * Property names may be specified as individual arguments or as arrays of
+ * property names. If a callback is provided it will be executed for each
+ * property of `object` omitting the properties the callback returns truey
+ * for. The callback is bound to `thisArg` and invoked with three arguments;
+ * (value, key, object).
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {Object} object The source object.
+ * @param {Function|...string|string[]} [callback] The properties to omit or the
+ * function called per iteration.
+ * @param {*} [thisArg] The `this` binding of `callback`.
+ * @returns {Object} Returns an object without the omitted properties.
+ * @example
+ *
+ * _.omit({ 'name': 'fred', 'age': 40 }, 'age');
+ * // => { 'name': 'fred' }
+ *
+ * _.omit({ 'name': 'fred', 'age': 40 }, function(value) {
+ * return typeof value == 'number';
+ * });
+ * // => { 'name': 'fred' }
+ */
+ function omit(object, callback, thisArg) {
+ var result = {};
+ if (typeof callback != 'function') {
+ var props = [];
+ forIn(object, function(value, key) {
+ props.push(key);
+ });
+ props = baseDifference(props, baseFlatten(arguments, true, false, 1));
+
+ var index = -1,
+ length = props.length;
+
+ while (++index < length) {
+ var key = props[index];
+ result[key] = object[key];
+ }
+ } else {
+ callback = lodash.createCallback(callback, thisArg, 3);
+ forIn(object, function(value, key, object) {
+ if (!callback(value, key, object)) {
+ result[key] = value;
+ }
+ });
+ }
+ return result;
+ }
+
+ /**
+ * Creates an array composed of the own enumerable property values of `object`.
+ *
+ * @static
+ * @memberOf _
+ * @category Objects
+ * @param {Object} object The object to inspect.
+ * @returns {Array} Returns an array of property values.
+ * @example
+ *
+ * _.values({ 'one': 1, 'two': 2, 'three': 3 });
+ * // => [1, 2, 3] (property order is not guaranteed across environments)
+ */
+ function values(object) {
+ var index = -1,
+ props = keys(object),
+ length = props.length,
+ result = Array(length);
+
+ while (++index < length) {
+ result[index] = object[props[index]];
+ }
+ return result;
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Checks if the given callback returns truey value for **all** elements of
+ * a collection. The callback is bound to `thisArg` and invoked with three
+ * arguments; (value, index|key, collection).
+ *
+ * If a property name is provided for `callback` the created "_.pluck" style
+ * callback will return the property value of the given element.
+ *
+ * If an object is provided for `callback` the created "_.where" style callback
+ * will return `true` for elements that have the properties of the given object,
+ * else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @alias all
+ * @category Collections
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|Object|string} [callback=identity] The function called
+ * per iteration. If a property name or object is provided it will be used
+ * to create a "_.pluck" or "_.where" style callback, respectively.
+ * @param {*} [thisArg] The `this` binding of `callback`.
+ * @returns {boolean} Returns `true` if all elements passed the callback check,
+ * else `false`.
+ * @example
+ *
+ * _.every([true, 1, null, 'yes']);
+ * // => false
+ *
+ * var characters = [
+ * { 'name': 'barney', 'age': 36 },
+ * { 'name': 'fred', 'age': 40 }
+ * ];
+ *
+ * // using "_.pluck" callback shorthand
+ * _.every(characters, 'age');
+ * // => true
+ *
+ * // using "_.where" callback shorthand
+ * _.every(characters, { 'age': 36 });
+ * // => false
+ */
+ function every(collection, callback, thisArg) {
+ var result = true;
+ callback = lodash.createCallback(callback, thisArg, 3);
+
+ var index = -1,
+ length = collection ? collection.length : 0;
+
+ if (typeof length == 'number') {
+ while (++index < length) {
+ if (!(result = !!callback(collection[index], index, collection))) {
+ break;
+ }
+ }
+ } else {
+ forOwn(collection, function(value, index, collection) {
+ return (result = !!callback(value, index, collection));
+ });
+ }
+ return result;
+ }
+
+ /**
+ * Iterates over elements of a collection, executing the callback for each
+ * element. The callback is bound to `thisArg` and invoked with three arguments;
+ * (value, index|key, collection). Callbacks may exit iteration early by
+ * explicitly returning `false`.
+ *
+ * Note: As with other "Collections" methods, objects with a `length` property
+ * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
+ * may be used for object iteration.
+ *
+ * @static
+ * @memberOf _
+ * @alias each
+ * @category Collections
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} [callback=identity] The function called per iteration.
+ * @param {*} [thisArg] The `this` binding of `callback`.
+ * @returns {Array|Object|string} Returns `collection`.
+ * @example
+ *
+ * _([1, 2, 3]).forEach(function(num) { console.log(num); }).join(',');
+ * // => logs each number and returns '1,2,3'
+ *
+ * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
+ * // => logs each number and returns the object (property order is not guaranteed across environments)
+ */
+ function forEach(collection, callback, thisArg) {
+ var index = -1,
+ length = collection ? collection.length : 0;
+
+ callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
+ if (typeof length == 'number') {
+ while (++index < length) {
+ if (callback(collection[index], index, collection) === false) {
+ break;
+ }
+ }
+ } else {
+ forOwn(collection, callback);
+ }
+ return collection;
+ }
+
+ /**
+ * Invokes the method named by `methodName` on each element in the `collection`
+ * returning an array of the results of each invoked method. Additional arguments
+ * will be provided to each invoked method. If `methodName` is a function it
+ * will be invoked for, and `this` bound to, each element in the `collection`.
+ *
+ * @static
+ * @memberOf _
+ * @category Collections
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|string} methodName The name of the method to invoke or
+ * the function invoked per iteration.
+ * @param {...*} [arg] Arguments to invoke the method with.
+ * @returns {Array} Returns a new array of the results of each invoked method.
+ * @example
+ *
+ * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
+ * // => [[1, 5, 7], [1, 2, 3]]
+ *
+ * _.invoke([123, 456], String.prototype.split, '');
+ * // => [['1', '2', '3'], ['4', '5', '6']]
+ */
+ function invoke(collection, methodName) {
+ var args = slice(arguments, 2),
+ index = -1,
+ isFunc = typeof methodName == 'function',
+ length = collection ? collection.length : 0,
+ result = Array(typeof length == 'number' ? length : 0);
+
+ forEach(collection, function(value) {
+ result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args);
+ });
+ return result;
+ }
+
+ /**
+ * Creates an array of values by running each element in the collection
+ * through the callback. The callback is bound to `thisArg` and invoked with
+ * three arguments; (value, index|key, collection).
+ *
+ * If a property name is provided for `callback` the created "_.pluck" style
+ * callback will return the property value of the given element.
+ *
+ * If an object is provided for `callback` the created "_.where" style callback
+ * will return `true` for elements that have the properties of the given object,
+ * else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @alias collect
+ * @category Collections
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function|Object|string} [callback=identity] The function called
+ * per iteration. If a property name or object is provided it will be used
+ * to create a "_.pluck" or "_.where" style callback, respectively.
+ * @param {*} [thisArg] The `this` binding of `callback`.
+ * @returns {Array} Returns a new array of the results of each `callback` execution.
+ * @example
+ *
+ * _.map([1, 2, 3], function(num) { return num * 3; });
+ * // => [3, 6, 9]
+ *
+ * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
+ * // => [3, 6, 9] (property order is not guaranteed across environments)
+ *
+ * var characters = [
+ * { 'name': 'barney', 'age': 36 },
+ * { 'name': 'fred', 'age': 40 }
+ * ];
+ *
+ * // using "_.pluck" callback shorthand
+ * _.map(characters, 'name');
+ * // => ['barney', 'fred']
+ */
+ function map(collection, callback, thisArg) {
+ var index = -1,
+ length = collection ? collection.length : 0;
+
+ callback = lodash.createCallback(callback, thisArg, 3);
+ if (typeof length == 'number') {
+ var result = Array(length);
+ while (++index < length) {
+ result[index] = callback(collection[index], index, collection);
+ }
+ } else {
+ result = [];
+ forOwn(collection, function(value, key, collection) {
+ result[++index] = callback(value, key, collection);
+ });
+ }
+ return result;
+ }
+
+ /**
+ * Retrieves the value of a specified property from all elements in the collection.
+ *
+ * @static
+ * @memberOf _
+ * @type Function
+ * @category Collections
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {string} property The name of the property to pluck.
+ * @returns {Array} Returns a new array of property values.
+ * @example
+ *
+ * var characters = [
+ * { 'name': 'barney', 'age': 36 },
+ * { 'name': 'fred', 'age': 40 }
+ * ];
+ *
+ * _.pluck(characters, 'name');
+ * // => ['barney', 'fred']
+ */
+ var pluck = map;
+
+ /**
+ * Reduces a collection to a value which is the accumulated result of running
+ * each element in the collection through the callback, where each successive
+ * callback execution consumes the return value of the previous execution. If
+ * `accumulator` is not provided the first element of the collection will be
+ * used as the initial `accumulator` value. The callback is bound to `thisArg`
+ * and invoked with four arguments; (accumulator, value, index|key, collection).
+ *
+ * @static
+ * @memberOf _
+ * @alias foldl, inject
+ * @category Collections
+ * @param {Array|Object|string} collection The collection to iterate over.
+ * @param {Function} [callback=identity] The function called per iteration.
+ * @param {*} [accumulator] Initial value of the accumulator.
+ * @param {*} [thisArg] The `this` binding of `callback`.
+ * @returns {*} Returns the accumulated value.
+ * @example
+ *
+ * var sum = _.reduce([1, 2, 3], function(sum, num) {
+ * return sum + num;
+ * });
+ * // => 6
+ *
+ * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
+ * result[key] = num * 3;
+ * return result;
+ * }, {});
+ * // => { 'a': 3, 'b': 6, 'c': 9 }
+ */
+ function reduce(collection, callback, accumulator, thisArg) {
+ if (!collection) return accumulator;
+ var noaccum = arguments.length < 3;
+ callback = lodash.createCallback(callback, thisArg, 4);
+
+ var index = -1,
+ length = collection.length;
+
+ if (typeof length == 'number') {
+ if (noaccum) {
+ accumulator = collection[++index];
+ }
+ while (++index < length) {
+ accumulator = callback(accumulator, collection[index], index, collection);
+ }
+ } else {
+ forOwn(collection, function(value, index, collection) {
+ accumulator = noaccum
+ ? (noaccum = false, value)
+ : callback(accumulator, value, index, collection)
+ });
+ }
+ return accumulator;
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Creates an array excluding all values of the provided arrays using strict
+ * equality for comparisons, i.e. `===`.
+ *
+ * @static
+ * @memberOf _
+ * @category Arrays
+ * @param {Array} array The array to process.
+ * @param {...Array} [values] The arrays of values to exclude.
+ * @returns {Array} Returns a new array of filtered values.
+ * @example
+ *
+ * _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
+ * // => [1, 3, 4]
+ */
+ function difference(array) {
+ return baseDifference(array, baseFlatten(arguments, true, true, 1));
+ }
+
+ /**
+ * Flattens a nested array (the nesting can be to any depth). If `isShallow`
+ * is truey, the array will only be flattened a single level. If a callback
+ * is provided each element of the array is passed through the callback before
+ * flattening. The callback is bound to `thisArg` and invoked with three
+ * arguments; (value, index, array).
+ *
+ * If a property name is provided for `callback` the created "_.pluck" style
+ * callback will return the property value of the given element.
+ *
+ * If an object is provided for `callback` the created "_.where" style callback
+ * will return `true` for elements that have the properties of the given object,
+ * else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Arrays
+ * @param {Array} array The array to flatten.
+ * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level.
+ * @param {Function|Object|string} [callback=identity] The function called
+ * per iteration. If a property name or object is provided it will be used
+ * to create a "_.pluck" or "_.where" style callback, respectively.
+ * @param {*} [thisArg] The `this` binding of `callback`.
+ * @returns {Array} Returns a new flattened array.
+ * @example
+ *
+ * _.flatten([1, [2], [3, [[4]]]]);
+ * // => [1, 2, 3, 4];
+ *
+ * _.flatten([1, [2], [3, [[4]]]], true);
+ * // => [1, 2, 3, [[4]]];
+ *
+ * var characters = [
+ * { 'name': 'barney', 'age': 30, 'pets': ['hoppy'] },
+ * { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] }
+ * ];
+ *
+ * // using "_.pluck" callback shorthand
+ * _.flatten(characters, 'pets');
+ * // => ['hoppy', 'baby puss', 'dino']
+ */
+ function flatten(array, isShallow, callback, thisArg) {
+ // juggle arguments
+ if (typeof isShallow != 'boolean' && isShallow != null) {
+ thisArg = callback;
+ callback = (typeof isShallow != 'function' && thisArg && thisArg[isShallow] === array) ? null : isShallow;
+ isShallow = false;
+ }
+ if (callback != null) {
+ array = map(array, callback, thisArg);
+ }
+ return baseFlatten(array, isShallow);
+ }
+
+ /**
+ * Gets the index at which the first occurrence of `value` is found using
+ * strict equality for comparisons, i.e. `===`. If the array is already sorted
+ * providing `true` for `fromIndex` will run a faster binary search.
+ *
+ * @static
+ * @memberOf _
+ * @category Arrays
+ * @param {Array} array The array to search.
+ * @param {*} value The value to search for.
+ * @param {boolean|number} [fromIndex=0] The index to search from or `true`
+ * to perform a binary search on a sorted array.
+ * @returns {number} Returns the index of the matched value or `-1`.
+ * @example
+ *
+ * _.indexOf([1, 2, 3, 1, 2, 3], 2);
+ * // => 1
+ *
+ * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
+ * // => 4
+ *
+ * _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
+ * // => 2
+ */
+ function indexOf(array, value, fromIndex) {
+ if (typeof fromIndex == 'number') {
+ var length = array ? array.length : 0;
+ fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0);
+ } else if (fromIndex) {
+ var index = sortedIndex(array, value);
+ return array[index] === value ? index : -1;
+ }
+ return baseIndexOf(array, value, fromIndex);
+ }
+
+ /**
+ * Creates an array of unique values present in all provided arrays using
+ * strict equality for comparisons, i.e. `===`.
+ *
+ * @static
+ * @memberOf _
+ * @category Arrays
+ * @param {...Array} [array] The arrays to inspect.
+ * @returns {Array} Returns an array of shared values.
+ * @example
+ *
+ * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]);
+ * // => [1, 2]
+ */
+ function intersection() {
+ var args = [],
+ argsIndex = -1,
+ argsLength = arguments.length,
+ caches = getArray(),
+ indexOf = getIndexOf(),
+ trustIndexOf = indexOf === baseIndexOf,
+ seen = getArray();
+
+ while (++argsIndex < argsLength) {
+ var value = arguments[argsIndex];
+ if (isArray(value) || isArguments(value)) {
+ args.push(value);
+ caches.push(trustIndexOf && value.length >= largeArraySize &&
+ createCache(argsIndex ? args[argsIndex] : seen));
+ }
+ }
+ var array = args[0],
+ index = -1,
+ length = array ? array.length : 0,
+ result = [];
+
+ outer:
+ while (++index < length) {
+ var cache = caches[0];
+ value = array[index];
+
+ if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) {
+ argsIndex = argsLength;
+ (cache || seen).push(value);
+ while (--argsIndex) {
+ cache = caches[argsIndex];
+ if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) {
+ continue outer;
+ }
+ }
+ result.push(value);
+ }
+ }
+ while (argsLength--) {
+ cache = caches[argsLength];
+ if (cache) {
+ releaseObject(cache);
+ }
+ }
+ releaseArray(caches);
+ releaseArray(seen);
+ return result;
+ }
+
+ /**
+ * Gets the last element or last `n` elements of an array. If a callback is
+ * provided elements at the end of the array are returned as long as the
+ * callback returns truey. The callback is bound to `thisArg` and invoked
+ * with three arguments; (value, index, array).
+ *
+ * If a property name is provided for `callback` the created "_.pluck" style
+ * callback will return the property value of the given element.
+ *
+ * If an object is provided for `callback` the created "_.where" style callback
+ * will return `true` for elements that have the properties of the given object,
+ * else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Arrays
+ * @param {Array} array The array to query.
+ * @param {Function|Object|number|string} [callback] The function called
+ * per element or the number of elements to return. If a property name or
+ * object is provided it will be used to create a "_.pluck" or "_.where"
+ * style callback, respectively.
+ * @param {*} [thisArg] The `this` binding of `callback`.
+ * @returns {*} Returns the last element(s) of `array`.
+ * @example
+ *
+ * _.last([1, 2, 3]);
+ * // => 3
+ *
+ * _.last([1, 2, 3], 2);
+ * // => [2, 3]
+ *
+ * _.last([1, 2, 3], function(num) {
+ * return num > 1;
+ * });
+ * // => [2, 3]
+ *
+ * var characters = [
+ * { 'name': 'barney', 'blocked': false, 'employer': 'slate' },
+ * { 'name': 'fred', 'blocked': true, 'employer': 'slate' },
+ * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' }
+ * ];
+ *
+ * // using "_.pluck" callback shorthand
+ * _.pluck(_.last(characters, 'blocked'), 'name');
+ * // => ['fred', 'pebbles']
+ *
+ * // using "_.where" callback shorthand
+ * _.last(characters, { 'employer': 'na' });
+ * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }]
+ */
+ function last(array, callback, thisArg) {
+ var n = 0,
+ length = array ? array.length : 0;
+
+ if (typeof callback != 'number' && callback != null) {
+ var index = length;
+ callback = lodash.createCallback(callback, thisArg, 3);
+ while (index-- && callback(array[index], index, array)) {
+ n++;
+ }
+ } else {
+ n = callback;
+ if (n == null || thisArg) {
+ return array ? array[length - 1] : undefined;
+ }
+ }
+ return slice(array, nativeMax(0, length - n));
+ }
+
+ /**
+ * Uses a binary search to determine the smallest index at which a value
+ * should be inserted into a given sorted array in order to maintain the sort
+ * order of the array. If a callback is provided it will be executed for
+ * `value` and each element of `array` to compute their sort ranking. The
+ * callback is bound to `thisArg` and invoked with one argument; (value).
+ *
+ * If a property name is provided for `callback` the created "_.pluck" style
+ * callback will return the property value of the given element.
+ *
+ * If an object is provided for `callback` the created "_.where" style callback
+ * will return `true` for elements that have the properties of the given object,
+ * else `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Arrays
+ * @param {Array} array The array to inspect.
+ * @param {*} value The value to evaluate.
+ * @param {Function|Object|string} [callback=identity] The function called
+ * per iteration. If a property name or object is provided it will be used
+ * to create a "_.pluck" or "_.where" style callback, respectively.
+ * @param {*} [thisArg] The `this` binding of `callback`.
+ * @returns {number} Returns the index at which `value` should be inserted
+ * into `array`.
+ * @example
+ *
+ * _.sortedIndex([20, 30, 50], 40);
+ * // => 2
+ *
+ * // using "_.pluck" callback shorthand
+ * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
+ * // => 2
+ *
+ * var dict = {
+ * 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 }
+ * };
+ *
+ * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
+ * return dict.wordToNumber[word];
+ * });
+ * // => 2
+ *
+ * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
+ * return this.wordToNumber[word];
+ * }, dict);
+ * // => 2
+ */
+ function sortedIndex(array, value, callback, thisArg) {
+ var low = 0,
+ high = array ? array.length : low;
+
+ // explicitly reference `identity` for better inlining in Firefox
+ callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity;
+ value = callback(value);
+
+ while (low < high) {
+ var mid = (low + high) >>> 1;
+ (callback(array[mid]) < value)
+ ? low = mid + 1
+ : high = mid;
+ }
+ return low;
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Creates a function that, when called, invokes `func` with the `this`
+ * binding of `thisArg` and prepends any additional `bind` arguments to those
+ * provided to the bound function.
+ *
+ * @static
+ * @memberOf _
+ * @category Functions
+ * @param {Function} func The function to bind.
+ * @param {*} [thisArg] The `this` binding of `func`.
+ * @param {...*} [arg] Arguments to be partially applied.
+ * @returns {Function} Returns the new bound function.
+ * @example
+ *
+ * var func = function(greeting) {
+ * return greeting + ' ' + this.name;
+ * };
+ *
+ * func = _.bind(func, { 'name': 'fred' }, 'hi');
+ * func();
+ * // => 'hi fred'
+ */
+ function bind(func, thisArg) {
+ return arguments.length > 2
+ ? createWrapper(func, 17, slice(arguments, 2), null, thisArg)
+ : createWrapper(func, 1, null, null, thisArg);
+ }
+
+ /**
+ * Defers executing the `func` function until the current call stack has cleared.
+ * Additional arguments will be provided to `func` when it is invoked.
+ *
+ * @static
+ * @memberOf _
+ * @category Functions
+ * @param {Function} func The function to defer.
+ * @param {...*} [arg] Arguments to invoke the function with.
+ * @returns {number} Returns the timer id.
+ * @example
+ *
+ * _.defer(function(text) { console.log(text); }, 'deferred');
+ * // logs 'deferred' after one or more milliseconds
+ */
+ function defer(func) {
+ if (!isFunction(func)) {
+ throw new TypeError;
+ }
+ var args = slice(arguments, 1);
+ return setTimeout(function() { func.apply(undefined, args); }, 1);
+ }
+
+ /**
+ * Creates a function that, when called, invokes `func` with any additional
+ * `partial` arguments prepended to those provided to the new function. This
+ * method is similar to `_.bind` except it does **not** alter the `this` binding.
+ *
+ * @static
+ * @memberOf _
+ * @category Functions
+ * @param {Function} func The function to partially apply arguments to.
+ * @param {...*} [arg] Arguments to be partially applied.
+ * @returns {Function} Returns the new partially applied function.
+ * @example
+ *
+ * var greet = function(greeting, name) { return greeting + ' ' + name; };
+ * var hi = _.partial(greet, 'hi');
+ * hi('fred');
+ * // => 'hi fred'
+ */
+ function partial(func) {
+ return createWrapper(func, 16, slice(arguments, 1));
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * Produces a callback bound to an optional `thisArg`. If `func` is a property
+ * name the created callback will return the property value for a given element.
+ * If `func` is an object the created callback will return `true` for elements
+ * that contain the equivalent object properties, otherwise it will return `false`.
+ *
+ * @static
+ * @memberOf _
+ * @category Utilities
+ * @param {*} [func=identity] The value to convert to a callback.
+ * @param {*} [thisArg] The `this` binding of the created callback.
+ * @param {number} [argCount] The number of arguments the callback accepts.
+ * @returns {Function} Returns a callback function.
+ * @example
+ *
+ * var characters = [
+ * { 'name': 'barney', 'age': 36 },
+ * { 'name': 'fred', 'age': 40 }
+ * ];
+ *
+ * // wrap to create custom callback shorthands
+ * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) {
+ * var match = /^(.+?)__([gl]t)(.+)$/.exec(callback);
+ * return !match ? func(callback, thisArg) : function(object) {
+ * return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3];
+ * };
+ * });
+ *
+ * _.filter(characters, 'age__gt38');
+ * // => [{ 'name': 'fred', 'age': 40 }]
+ */
+ function createCallback(func, thisArg, argCount) {
+ var type = typeof func;
+ if (func == null || type == 'function') {
+ return baseCreateCallback(func, thisArg, argCount);
+ }
+ // handle "_.pluck" style callback shorthands
+ if (type != 'object') {
+ return property(func);
+ }
+ var props = keys(func),
+ key = props[0],
+ a = func[key];
+
+ // handle "_.where" style callback shorthands
+ if (props.length == 1 && a === a && !isObject(a)) {
+ // fast path the common case of providing an object with a single
+ // property containing a primitive value
+ return function(object) {
+ var b = object[key];
+ return a === b && (a !== 0 || (1 / a == 1 / b));
+ };
+ }
+ return function(object) {
+ var length = props.length,
+ result = false;
+
+ while (length--) {
+ if (!(result = baseIsEqual(object[props[length]], func[props[length]], null, true))) {
+ break;
+ }
+ }
+ return result;
+ };
+ }
+
+ /**
+ * This method returns the first argument provided to it.
+ *
+ * @static
+ * @memberOf _
+ * @category Utilities
+ * @param {*} value Any value.
+ * @returns {*} Returns `value`.
+ * @example
+ *
+ * var object = { 'name': 'fred' };
+ * _.identity(object) === object;
+ * // => true
+ */
+ function identity(value) {
+ return value;
+ }
+
+ /**
+ * A no-operation function.
+ *
+ * @static
+ * @memberOf _
+ * @category Utilities
+ * @example
+ *
+ * var object = { 'name': 'fred' };
+ * _.noop(object) === undefined;
+ * // => true
+ */
+ function noop() {
+ // no operation performed
+ }
+
+ /**
+ * Creates a "_.pluck" style function, which returns the `key` value of a
+ * given object.
+ *
+ * @static
+ * @memberOf _
+ * @category Utilities
+ * @param {string} key The name of the property to retrieve.
+ * @returns {Function} Returns the new function.
+ * @example
+ *
+ * var characters = [
+ * { 'name': 'fred', 'age': 40 },
+ * { 'name': 'barney', 'age': 36 }
+ * ];
+ *
+ * var getName = _.property('name');
+ *
+ * _.map(characters, getName);
+ * // => ['barney', 'fred']
+ *
+ * _.sortBy(characters, getName);
+ * // => [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }]
+ */
+ function property(key) {
+ return function(object) {
+ return object[key];
+ };
+ }
+
+ /**
+ * Generates a unique ID. If `prefix` is provided the ID will be appended to it.
+ *
+ * @static
+ * @memberOf _
+ * @category Utilities
+ * @param {string} [prefix] The value to prefix the ID with.
+ * @returns {string} Returns the unique ID.
+ * @example
+ *
+ * _.uniqueId('contact_');
+ * // => 'contact_104'
+ *
+ * _.uniqueId();
+ * // => '105'
+ */
+ function uniqueId(prefix) {
+ var id = ++idCounter;
+ return String(prefix == null ? '' : prefix) + id;
+ }
+
+ /*--------------------------------------------------------------------------*/
+
+ lodash.assign = assign;
+ lodash.bind = bind;
+ lodash.createCallback = createCallback;
+ lodash.defaults = defaults;
+ lodash.defer = defer;
+ lodash.difference = difference;
+ lodash.flatten = flatten;
+ lodash.forEach = forEach;
+ lodash.forIn = forIn;
+ lodash.forOwn = forOwn;
+ lodash.intersection = intersection;
+ lodash.invoke = invoke;
+ lodash.keys = keys;
+ lodash.map = map;
+ lodash.omit = omit;
+ lodash.partial = partial;
+ lodash.pluck = pluck;
+ lodash.property = property;
+ lodash.values = values;
+
+ // add aliases
+ lodash.collect = map;
+ lodash.each = forEach;
+ lodash.extend = assign;
+
+ /*--------------------------------------------------------------------------*/
+
+ // add functions that return unwrapped values when chaining
+ lodash.clone = clone;
+ lodash.every = every;
+ lodash.has = has;
+ lodash.identity = identity;
+ lodash.indexOf = indexOf;
+ lodash.isArguments = isArguments;
+ lodash.isArray = isArray;
+ lodash.isElement = isElement;
+ lodash.isEqual = isEqual;
+ lodash.isFunction = isFunction;
+ lodash.isNumber = isNumber;
+ lodash.isObject = isObject;
+ lodash.isString = isString;
+ lodash.noop = noop;
+ lodash.reduce = reduce;
+ lodash.sortedIndex = sortedIndex;
+ lodash.uniqueId = uniqueId;
+
+ // add aliases
+ lodash.all = every;
+ lodash.foldl = reduce;
+ lodash.inject = reduce;
+
+ /*--------------------------------------------------------------------------*/
+
+ lodash.last = last;
+
+ /*--------------------------------------------------------------------------*/
+
+ /**
+ * The semantic version number.
+ *
+ * @static
+ * @memberOf _
+ * @type string
+ */
+ lodash.VERSION = '2.4.1';
+
+ /*--------------------------------------------------------------------------*/
+
+ // some AMD build optimizers like r.js check for condition patterns like the following:
+ if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
+ // Expose Lo-Dash to the global object even when an AMD loader is present in
+ // case Lo-Dash is loaded with a RequireJS shim config.
+ // See http://requirejs.org/docs/api.html#config-shim
+ root._ = lodash;
+
+ // define as an anonymous module so, through path mapping, it can be
+ // referenced as the "underscore" module
+ define(function() {
+ return lodash;
+ });
+ }
+ // check for `exports` after `define` in case a build optimizer adds an `exports` object
+ else if (freeExports && freeModule) {
+ // in Node.js or RingoJS
+ if (moduleExports) {
+ (freeModule.exports = lodash)._ = lodash;
+ }
+ // in Narwhal or Rhino -require
+ else {
+ freeExports._ = lodash;
+ }
+ }
+ else {
+ // in a browser or Rhino
+ root._ = lodash;
+ }
+}.call(this));
+
+}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+},{}],"lodash":[function(_dereq_,module,exports){
+module.exports=_dereq_('M4+//f');
+},{}],3:[function(_dereq_,module,exports){
+/*!
+ * EventEmitter2
+ * https://github.com/hij1nx/EventEmitter2
+ *
+ * Copyright (c) 2013 hij1nx
+ * Licensed under the MIT license.
+ */
+;!function(undefined) {
+
+ var isArray = Array.isArray ? Array.isArray : function _isArray(obj) {
+ return Object.prototype.toString.call(obj) === "[object Array]";
+ };
+ var defaultMaxListeners = 10;
+
+ function init() {
+ this._events = {};
+ if (this._conf) {
+ configure.call(this, this._conf);
+ }
+ }
+
+ function configure(conf) {
+ if (conf) {
+
+ this._conf = conf;
+
+ conf.delimiter && (this.delimiter = conf.delimiter);
+ conf.maxListeners && (this._events.maxListeners = conf.maxListeners);
+ conf.wildcard && (this.wildcard = conf.wildcard);
+ conf.newListener && (this.newListener = conf.newListener);
+
+ if (this.wildcard) {
+ this.listenerTree = {};
+ }
+ }
+ }
+
+ function EventEmitter(conf) {
+ this._events = {};
+ this.newListener = false;
+ configure.call(this, conf);
+ }
+
+ //
+ // Attention, function return type now is array, always !
+ // It has zero elements if no any matches found and one or more
+ // elements (leafs) if there are matches
+ //
+ function searchListenerTree(handlers, type, tree, i) {
+ if (!tree) {
+ return [];
+ }
+ var listeners=[], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached,
+ typeLength = type.length, currentType = type[i], nextType = type[i+1];
+ if (i === typeLength && tree._listeners) {
+ //
+ // If at the end of the event(s) list and the tree has listeners
+ // invoke those listeners.
+ //
+ if (typeof tree._listeners === 'function') {
+ handlers && handlers.push(tree._listeners);
+ return [tree];
+ } else {
+ for (leaf = 0, len = tree._listeners.length; leaf < len; leaf++) {
+ handlers && handlers.push(tree._listeners[leaf]);
+ }
+ return [tree];
+ }
+ }
+
+ if ((currentType === '*' || currentType === '**') || tree[currentType]) {
+ //
+ // If the event emitted is '*' at this part
+ // or there is a concrete match at this patch
+ //
+ if (currentType === '*') {
+ for (branch in tree) {
+ if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
+ listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+1));
+ }
+ }
+ return listeners;
+ } else if(currentType === '**') {
+ endReached = (i+1 === typeLength || (i+2 === typeLength && nextType === '*'));
+ if(endReached && tree._listeners) {
+ // The next element has a _listeners, add it to the handlers.
+ listeners = listeners.concat(searchListenerTree(handlers, type, tree, typeLength));
+ }
+
+ for (branch in tree) {
+ if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
+ if(branch === '*' || branch === '**') {
+ if(tree[branch]._listeners && !endReached) {
+ listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], typeLength));
+ }
+ listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
+ } else if(branch === nextType) {
+ listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+2));
+ } else {
+ // No match on this one, shift into the tree but not in the type array.
+ listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
+ }
+ }
+ }
+ return listeners;
+ }
+
+ listeners = listeners.concat(searchListenerTree(handlers, type, tree[currentType], i+1));
+ }
+
+ xTree = tree['*'];
+ if (xTree) {
+ //
+ // If the listener tree will allow any match for this part,
+ // then recursively explore all branches of the tree
+ //
+ searchListenerTree(handlers, type, xTree, i+1);
+ }
+
+ xxTree = tree['**'];
+ if(xxTree) {
+ if(i < typeLength) {
+ if(xxTree._listeners) {
+ // If we have a listener on a '**', it will catch all, so add its handler.
+ searchListenerTree(handlers, type, xxTree, typeLength);
+ }
+
+ // Build arrays of matching next branches and others.
+ for(branch in xxTree) {
+ if(branch !== '_listeners' && xxTree.hasOwnProperty(branch)) {
+ if(branch === nextType) {
+ // We know the next element will match, so jump twice.
+ searchListenerTree(handlers, type, xxTree[branch], i+2);
+ } else if(branch === currentType) {
+ // Current node matches, move into the tree.
+ searchListenerTree(handlers, type, xxTree[branch], i+1);
+ } else {
+ isolatedBranch = {};
+ isolatedBranch[branch] = xxTree[branch];
+ searchListenerTree(handlers, type, { '**': isolatedBranch }, i+1);
+ }
+ }
+ }
+ } else if(xxTree._listeners) {
+ // We have reached the end and still on a '**'
+ searchListenerTree(handlers, type, xxTree, typeLength);
+ } else if(xxTree['*'] && xxTree['*']._listeners) {
+ searchListenerTree(handlers, type, xxTree['*'], typeLength);
+ }
+ }
+
+ return listeners;
+ }
+
+ function growListenerTree(type, listener) {
+
+ type = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
+
+ //
+ // Looks for two consecutive '**', if so, don't add the event at all.
+ //
+ for(var i = 0, len = type.length; i+1 < len; i++) {
+ if(type[i] === '**' && type[i+1] === '**') {
+ return;
+ }
+ }
+
+ var tree = this.listenerTree;
+ var name = type.shift();
+
+ while (name) {
+
+ if (!tree[name]) {
+ tree[name] = {};
+ }
+
+ tree = tree[name];
+
+ if (type.length === 0) {
+
+ if (!tree._listeners) {
+ tree._listeners = listener;
+ }
+ else if(typeof tree._listeners === 'function') {
+ tree._listeners = [tree._listeners, listener];
+ }
+ else if (isArray(tree._listeners)) {
+
+ tree._listeners.push(listener);
+
+ if (!tree._listeners.warned) {
+
+ var m = defaultMaxListeners;
+
+ if (typeof this._events.maxListeners !== 'undefined') {
+ m = this._events.maxListeners;
+ }
+
+ if (m > 0 && tree._listeners.length > m) {
+
+ tree._listeners.warned = true;
+ console.error('(node) warning: possible EventEmitter memory ' +
+ 'leak detected. %d listeners added. ' +
+ 'Use emitter.setMaxListeners() to increase limit.',
+ tree._listeners.length);
+ console.trace();
+ }
+ }
+ }
+ return true;
+ }
+ name = type.shift();
+ }
+ return true;
+ }
+
+ // By default EventEmitters will print a warning if more than
+ // 10 listeners are added to it. This is a useful default which
+ // helps finding memory leaks.
+ //
+ // Obviously not all Emitters should be limited to 10. This function allows
+ // that to be increased. Set to zero for unlimited.
+
+ EventEmitter.prototype.delimiter = '.';
+
+ EventEmitter.prototype.setMaxListeners = function(n) {
+ this._events || init.call(this);
+ this._events.maxListeners = n;
+ if (!this._conf) this._conf = {};
+ this._conf.maxListeners = n;
+ };
+
+ EventEmitter.prototype.event = '';
+
+ EventEmitter.prototype.once = function(event, fn) {
+ this.many(event, 1, fn);
+ return this;
+ };
+
+ EventEmitter.prototype.many = function(event, ttl, fn) {
+ var self = this;
+
+ if (typeof fn !== 'function') {
+ throw new Error('many only accepts instances of Function');
+ }
+
+ function listener() {
+ if (--ttl === 0) {
+ self.off(event, listener);
+ }
+ fn.apply(this, arguments);
+ }
+
+ listener._origin = fn;
+
+ this.on(event, listener);
+
+ return self;
+ };
+
+ EventEmitter.prototype.emit = function() {
+
+ this._events || init.call(this);
+
+ var type = arguments[0];
+
+ if (type === 'newListener' && !this.newListener) {
+ if (!this._events.newListener) { return false; }
+ }
+
+ // Loop through the *_all* functions and invoke them.
+ if (this._all) {
+ var l = arguments.length;
+ var args = new Array(l - 1);
+ for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
+ for (i = 0, l = this._all.length; i < l; i++) {
+ this.event = type;
+ this._all[i].apply(this, args);
+ }
+ }
+
+ // If there is no 'error' event listener then throw.
+ if (type === 'error') {
+
+ if (!this._all &&
+ !this._events.error &&
+ !(this.wildcard && this.listenerTree.error)) {
+
+ if (arguments[1] instanceof Error) {
+ throw arguments[1]; // Unhandled 'error' event
+ } else {
+ throw new Error("Uncaught, unspecified 'error' event.");
+ }
+ return false;
+ }
+ }
+
+ var handler;
+
+ if(this.wildcard) {
+ handler = [];
+ var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
+ searchListenerTree.call(this, handler, ns, this.listenerTree, 0);
+ }
+ else {
+ handler = this._events[type];
+ }
+
+ if (typeof handler === 'function') {
+ this.event = type;
+ if (arguments.length === 1) {
+ handler.call(this);
+ }
+ else if (arguments.length > 1)
+ switch (arguments.length) {
+ case 2:
+ handler.call(this, arguments[1]);
+ break;
+ case 3:
+ handler.call(this, arguments[1], arguments[2]);
+ break;
+ // slower
+ default:
+ var l = arguments.length;
+ var args = new Array(l - 1);
+ for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
+ handler.apply(this, args);
+ }
+ return true;
+ }
+ else if (handler) {
+ var l = arguments.length;
+ var args = new Array(l - 1);
+ for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
+
+ var listeners = handler.slice();
+ for (var i = 0, l = listeners.length; i < l; i++) {
+ this.event = type;
+ listeners[i].apply(this, args);
+ }
+ return (listeners.length > 0) || !!this._all;
+ }
+ else {
+ return !!this._all;
+ }
+
+ };
+
+ EventEmitter.prototype.on = function(type, listener) {
+
+ if (typeof type === 'function') {
+ this.onAny(type);
+ return this;
+ }
+
+ if (typeof listener !== 'function') {
+ throw new Error('on only accepts instances of Function');
+ }
+ this._events || init.call(this);
+
+ // To avoid recursion in the case that type == "newListeners"! Before
+ // adding it to the listeners, first emit "newListeners".
+ this.emit('newListener', type, listener);
+
+ if(this.wildcard) {
+ growListenerTree.call(this, type, listener);
+ return this;
+ }
+
+ if (!this._events[type]) {
+ // Optimize the case of one listener. Don't need the extra array object.
+ this._events[type] = listener;
+ }
+ else if(typeof this._events[type] === 'function') {
+ // Adding the second element, need to change to array.
+ this._events[type] = [this._events[type], listener];
+ }
+ else if (isArray(this._events[type])) {
+ // If we've already got an array, just append.
+ this._events[type].push(listener);
+
+ // Check for listener leak
+ if (!this._events[type].warned) {
+
+ var m = defaultMaxListeners;
+
+ if (typeof this._events.maxListeners !== 'undefined') {
+ m = this._events.maxListeners;
+ }
+
+ if (m > 0 && this._events[type].length > m) {
+
+ this._events[type].warned = true;
+ console.error('(node) warning: possible EventEmitter memory ' +
+ 'leak detected. %d listeners added. ' +
+ 'Use emitter.setMaxListeners() to increase limit.',
+ this._events[type].length);
+ console.trace();
+ }
+ }
+ }
+ return this;
+ };
+
+ EventEmitter.prototype.onAny = function(fn) {
+
+ if (typeof fn !== 'function') {
+ throw new Error('onAny only accepts instances of Function');
+ }
+
+ if(!this._all) {
+ this._all = [];
+ }
+
+ // Add the function to the event listener collection.
+ this._all.push(fn);
+ return this;
+ };
+
+ EventEmitter.prototype.addListener = EventEmitter.prototype.on;
+
+ EventEmitter.prototype.off = function(type, listener) {
+ if (typeof listener !== 'function') {
+ throw new Error('removeListener only takes instances of Function');
+ }
+
+ var handlers,leafs=[];
+
+ if(this.wildcard) {
+ var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
+ leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
+ }
+ else {
+ // does not use listeners(), so no side effect of creating _events[type]
+ if (!this._events[type]) return this;
+ handlers = this._events[type];
+ leafs.push({_listeners:handlers});
+ }
+
+ for (var iLeaf=0; iLeaf 0) {
+ fns = this._all;
+ for(i = 0, l = fns.length; i < l; i++) {
+ if(fn === fns[i]) {
+ fns.splice(i, 1);
+ return this;
+ }
+ }
+ } else {
+ this._all = [];
+ }
+ return this;
+ };
+
+ EventEmitter.prototype.removeListener = EventEmitter.prototype.off;
+
+ EventEmitter.prototype.removeAllListeners = function(type) {
+ if (arguments.length === 0) {
+ !this._events || init.call(this);
+ return this;
+ }
+
+ if(this.wildcard) {
+ var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
+ var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
+
+ for (var iLeaf=0; iLeaf index) {
+ deleteFn.call(context, index + offset, op.start - index);
+ offset -= op.start - index;
+ }
+ retains.push(new RetainOp(op.start + offset, op.end + offset, op.attributes));
+ return index = op.end;
+ }
+ };
+ })(this));
+ if (this.endLength < this.startLength + offset) {
+ deleteFn.call(context, this.endLength, this.startLength + offset - this.endLength);
+ }
+ return _.each(retains, (function(_this) {
+ return function(op) {
+ _.each(op.attributes, function(value, format) {
+ if (value === null) {
+ return applyAttrFn.call(context, op.start, op.end - op.start, format, value);
+ }
+ });
+ return _.each(op.attributes, function(value, format) {
+ if (value != null) {
+ return applyAttrFn.call(context, op.start, op.end - op.start, format, value);
+ }
+ });
+ };
+ })(this));
+ };
+
+ Delta.prototype.applyToText = function(text) {
+ var appliedText, delta, op, result, _i, _len, _ref;
+ delta = this;
+ if (text.length !== delta.startLength) {
+ throw new Error("Start length of delta: " + delta.startLength + " is not equal to the text: " + text.length);
+ }
+ appliedText = [];
+ _ref = delta.ops;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ op = _ref[_i];
+ if (Op.isInsert(op)) {
+ appliedText.push(op.value);
+ } else {
+ appliedText.push(text.substring(op.start, op.end));
+ }
+ }
+ result = appliedText.join("");
+ if (delta.endLength !== result.length) {
+ throw new Error("End length of delta: " + delta.endLength + " is not equal to result text: " + result.length);
+ }
+ return result;
+ };
+
+ Delta.prototype.canCompose = function(delta) {
+ return Delta.isDelta(delta) && this.endLength === delta.startLength;
+ };
+
+ Delta.prototype.compact = function() {
+ var compacted;
+ compacted = [];
+ _.each(this.ops, function(op) {
+ var last;
+ if (op.getLength() === 0) {
+ return;
+ }
+ if (compacted.length === 0) {
+ return compacted.push(op);
+ } else {
+ last = _.last(compacted);
+ if (Op.isInsert(last) && Op.isInsert(op) && last.attributesMatch(op)) {
+ return compacted[compacted.length - 1] = new InsertOp(last.value + op.value, op.attributes);
+ } else if (Op.isRetain(last) && Op.isRetain(op) && last.end === op.start && last.attributesMatch(op)) {
+ return compacted[compacted.length - 1] = new RetainOp(last.start, op.end, op.attributes);
+ } else {
+ return compacted.push(op);
+ }
+ }
+ });
+ return this.ops = compacted;
+ };
+
+ Delta.prototype.compose = function(deltaB) {
+ var composed, deltaA, opInB, opsInRange, _i, _len, _ref;
+ if (!this.canCompose(deltaB)) {
+ throw new Error('Cannot compose delta');
+ }
+ deltaA = this;
+ composed = [];
+ _ref = deltaB.ops;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ opInB = _ref[_i];
+ if (Op.isInsert(opInB)) {
+ composed.push(opInB);
+ } else if (Op.isRetain(opInB)) {
+ opsInRange = deltaA.getOpsAt(opInB.start, opInB.getLength());
+ opsInRange = _.map(opsInRange, function(opInA) {
+ if (Op.isInsert(opInA)) {
+ return new InsertOp(opInA.value, opInA.composeAttributes(opInB.attributes));
+ } else {
+ return new RetainOp(opInA.start, opInA.end, opInA.composeAttributes(opInB.attributes));
+ }
+ });
+ composed = composed.concat(opsInRange);
+ } else {
+ throw new Error('Invalid op in deltaB when composing');
+ }
+ }
+ return new Delta(deltaA.startLength, deltaB.endLength, composed);
+ };
+
+ Delta.prototype.decompose = function(deltaA) {
+ var decomposeAttributes, deltaB, deltaC, insertDelta, offset, ops;
+ deltaC = this;
+ if (!Delta.isDelta(deltaA)) {
+ throw new Error("Decompose called when deltaA is not a Delta, type: " + typeof deltaA);
+ }
+ if (deltaA.startLength !== this.startLength) {
+ throw new Error("startLength " + deltaA.startLength + " / startLength " + this.startLength + " mismatch");
+ }
+ if (!_.all(deltaA.ops, (function(op) {
+ return Op.isInsert(op);
+ }))) {
+ throw new Error("DeltaA has retain in decompose");
+ }
+ if (!_.all(deltaC.ops, (function(op) {
+ return Op.isInsert(op);
+ }))) {
+ throw new Error("DeltaC has retain in decompose");
+ }
+ decomposeAttributes = function(attrA, attrC) {
+ var decomposedAttributes, key, value;
+ decomposedAttributes = {};
+ for (key in attrC) {
+ value = attrC[key];
+ if (attrA[key] === void 0 || attrA[key] !== value) {
+ if (attrA[key] !== null && typeof attrA[key] === 'object' && value !== null && typeof value === 'object') {
+ decomposedAttributes[key] = decomposeAttributes(attrA[key], value);
+ } else {
+ decomposedAttributes[key] = value;
+ }
+ }
+ }
+ for (key in attrA) {
+ value = attrA[key];
+ if (attrC[key] === void 0) {
+ decomposedAttributes[key] = null;
+ }
+ }
+ return decomposedAttributes;
+ };
+ insertDelta = deltaA.diff(deltaC);
+ ops = [];
+ offset = 0;
+ _.each(insertDelta.ops, function(op) {
+ var offsetC, opsInC;
+ opsInC = deltaC.getOpsAt(offset, op.getLength());
+ offsetC = 0;
+ _.each(opsInC, function(opInC) {
+ var d, offsetA, opsInA;
+ if (Op.isInsert(op)) {
+ d = new InsertOp(op.value.substring(offsetC, offsetC + opInC.getLength()), opInC.attributes);
+ ops.push(d);
+ } else if (Op.isRetain(op)) {
+ opsInA = deltaA.getOpsAt(op.start + offsetC, opInC.getLength());
+ offsetA = 0;
+ _.each(opsInA, function(opInA) {
+ var attributes, e, start;
+ attributes = decomposeAttributes(opInA.attributes, opInC.attributes);
+ start = op.start + offsetA + offsetC;
+ e = new RetainOp(start, start + opInA.getLength(), attributes);
+ ops.push(e);
+ return offsetA += opInA.getLength();
+ });
+ } else {
+ throw new Error("Invalid delta in deltaB when composing");
+ }
+ return offsetC += opInC.getLength();
+ });
+ return offset += op.getLength();
+ });
+ deltaB = new Delta(insertDelta.startLength, insertDelta.endLength, ops);
+ return deltaB;
+ };
+
+ Delta.prototype.diff = function(other) {
+ var diff, finalLength, insertDelta, ops, originalLength, textA, textC, _ref;
+ _ref = _.map([this, other], function(delta) {
+ return _.map(delta.ops, function(op) {
+ if (op.value != null) {
+ return op.value;
+ } else {
+ return "";
+ }
+ }).join('');
+ }), textA = _ref[0], textC = _ref[1];
+ if (!(textA === '' && textC === '')) {
+ diff = jsdiff.diffChars(textA, textC);
+ if (diff.length <= 0) {
+ throw new Error("diffToDelta called with diff with length <= 0");
+ }
+ originalLength = 0;
+ finalLength = 0;
+ ops = [];
+ _.each(diff, function(part) {
+ if (part.added) {
+ ops.push(new InsertOp(part.value));
+ return finalLength += part.value.length;
+ } else if (part.removed) {
+ return originalLength += part.value.length;
+ } else {
+ ops.push(new RetainOp(originalLength, originalLength + part.value.length));
+ originalLength += part.value.length;
+ return finalLength += part.value.length;
+ }
+ });
+ insertDelta = new Delta(originalLength, finalLength, ops);
+ } else {
+ insertDelta = new Delta(0, 0, []);
+ }
+ return insertDelta;
+ };
+
+ _insertInsertCase = function(elemA, elemB, indexes, aIsRemote) {
+ var length, results;
+ results = _.extend({}, indexes);
+ length = Math.min(elemA.getLength(), elemB.getLength());
+ if (aIsRemote) {
+ results.transformOp = new RetainOp(results.indexA, results.indexA + length);
+ results.indexA += length;
+ if (length === elemA.getLength()) {
+ results.elemIndexA++;
+ } else if (length < elemA.getLength()) {
+ results.elemA = _.last(elemA.split(length));
+ } else {
+ throw new Error("Invalid elem length in transform");
+ }
+ } else {
+ results.transformOp = _.first(elemB.split(length));
+ results.indexB += length;
+ if (length === elemB.getLength()) {
+ results.elemIndexB++;
+ } else {
+ results.elemB = _.last(elemB.split(length));
+ }
+ }
+ return results;
+ };
+
+ _retainRetainCase = function(elemA, elemB, indexes) {
+ var addedAttributes, elemIndexA, elemIndexB, errMsg, indexA, indexB, length, results;
+ indexA = indexes.indexA, indexB = indexes.indexB, elemIndexA = indexes.elemIndexA, elemIndexB = indexes.elemIndexB;
+ results = _.extend({}, indexes);
+ if (elemA.end < elemB.start) {
+ results.indexA += elemA.getLength();
+ results.elemIndexA++;
+ } else if (elemB.end < elemA.start) {
+ results.indexB += elemB.getLength();
+ results.elemIndexB++;
+ } else {
+ if (elemA.start < elemB.start) {
+ results.indexA += elemB.start - elemA.start;
+ elemA = results.elemA = new RetainOp(elemB.start, elemA.end, elemA.attributes);
+ } else if (elemB.start < elemA.start) {
+ results.indexB += elemA.start - elemB.start;
+ elemB = results.elemB = new RetainOp(elemA.start, elemB.end, elemB.attributes);
+ }
+ errMsg = "RetainOps must have same start length in transform";
+ if (elemA.start !== elemB.start) {
+ throw new Error(errMsg);
+ }
+ length = Math.min(elemA.end, elemB.end) - elemA.start;
+ addedAttributes = elemA.addAttributes(elemB.attributes);
+ results.transformOp = new RetainOp(results.indexA, results.indexA + length, addedAttributes);
+ results.indexA += length;
+ results.indexB += length;
+ if (elemA.end === elemB.end) {
+ results.elemIndexA++;
+ results.elemIndexB++;
+ } else if (elemA.end < elemB.end) {
+ results.elemIndexA++;
+ results.elemB = _.last(elemB.split(length));
+ } else {
+ results.elemIndexB++;
+ results.elemA = _.last(elemA.split(length));
+ }
+ }
+ if (results.elemIndexA !== indexes.elemIndexA) {
+ results.elemA = null;
+ }
+ if (results.elemIndexB !== indexes.elemIndexB) {
+ results.elemB = null;
+ }
+ return results;
+ };
+
+ Delta.prototype.transform = function(deltaA, aIsRemote) {
+ var deltaB, elemA, elemB, elemIndexA, elemIndexB, errMsg, indexA, indexB, results, transformEndLength, transformOps, transformStartLength, _applyResults, _buildIndexes;
+ if (aIsRemote == null) {
+ aIsRemote = false;
+ }
+ if (!Delta.isDelta(deltaA)) {
+ errMsg = "Transform called when deltaA is not a Delta, type: ";
+ throw new Error(errMsg + typeof deltaA);
+ }
+ deltaA = new Delta(deltaA.startLength, deltaA.endLength, deltaA.ops);
+ deltaB = new Delta(this.startLength, this.endLength, this.ops);
+ transformOps = [];
+ indexA = indexB = 0;
+ elemIndexA = elemIndexB = 0;
+ _applyResults = function(results) {
+ if (results.indexA != null) {
+ indexA = results.indexA;
+ }
+ if (results.indexB != null) {
+ indexB = results.indexB;
+ }
+ if (results.elemIndexA != null) {
+ elemIndexA = results.elemIndexA;
+ }
+ if (results.elemIndexB != null) {
+ elemIndexB = results.elemIndexB;
+ }
+ if (results.elemA != null) {
+ deltaA.ops[elemIndexA] = results.elemA;
+ }
+ if (results.elemB != null) {
+ deltaB.ops[elemIndexB] = results.elemB;
+ }
+ if (results.transformOp != null) {
+ return transformOps.push(results.transformOp);
+ }
+ };
+ _buildIndexes = function() {
+ return {
+ indexA: indexA,
+ indexB: indexB,
+ elemIndexA: elemIndexA,
+ elemIndexB: elemIndexB
+ };
+ };
+ while (elemIndexA < deltaA.ops.length && elemIndexB < deltaB.ops.length) {
+ elemA = deltaA.ops[elemIndexA];
+ elemB = deltaB.ops[elemIndexB];
+ if (Op.isInsert(elemA) && Op.isInsert(elemB)) {
+ results = _insertInsertCase(elemA, elemB, _buildIndexes(), aIsRemote);
+ _applyResults(results);
+ } else if (Op.isRetain(elemA) && Op.isRetain(elemB)) {
+ results = _retainRetainCase(elemA, elemB, _buildIndexes());
+ _applyResults(results);
+ } else if (Op.isInsert(elemA) && Op.isRetain(elemB)) {
+ transformOps.push(new RetainOp(indexA, indexA + elemA.getLength()));
+ indexA += elemA.getLength();
+ elemIndexA++;
+ } else if (Op.isRetain(elemA) && Op.isInsert(elemB)) {
+ transformOps.push(elemB);
+ indexB += elemB.getLength();
+ elemIndexB++;
+ }
+ }
+ while (elemIndexA < deltaA.ops.length) {
+ elemA = deltaA.ops[elemIndexA];
+ if (Op.isInsert(elemA)) {
+ transformOps.push(new RetainOp(indexA, indexA + elemA.getLength()));
+ }
+ indexA += elemA.getLength();
+ elemIndexA++;
+ }
+ while (elemIndexB < deltaB.ops.length) {
+ elemB = deltaB.ops[elemIndexB];
+ if (Op.isInsert(elemB)) {
+ transformOps.push(elemB);
+ }
+ indexB += elemB.getLength();
+ elemIndexB++;
+ }
+ transformStartLength = deltaA.endLength;
+ transformEndLength = _.reduce(transformOps, function(transformEndLength, op) {
+ return transformEndLength + op.getLength();
+ }, 0);
+ return new Delta(transformStartLength, transformEndLength, transformOps);
+ };
+
+ Delta.prototype.getOpsAt = function(index, length) {
+ var changes, getLength, offset, op, opLength, start, _i, _len, _ref;
+ changes = [];
+ if ((this.savedOpOffset != null) && this.savedOpOffset < index) {
+ offset = this.savedOpOffset;
+ } else {
+ offset = this.savedOpOffset = this.savedOpIndex = 0;
+ }
+ _ref = this.ops.slice(this.savedOpIndex);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ op = _ref[_i];
+ if (offset >= index + length) {
+ break;
+ }
+ opLength = op.getLength();
+ if (index < offset + opLength) {
+ start = Math.max(index - offset, 0);
+ getLength = Math.min(opLength - start, index + length - offset - start);
+ changes.push(op.getAt(start, getLength));
+ }
+ offset += opLength;
+ this.savedOpIndex += 1;
+ this.savedOpOffset += opLength;
+ }
+ return changes;
+ };
+
+ Delta.prototype.invert = function(deltaB) {
+ var deltaA, deltaC, inverse;
+ if (!this.isInsertsOnly()) {
+ throw new Error("Invert called on invalid delta containing non-insert ops");
+ }
+ deltaA = this;
+ deltaC = deltaA.compose(deltaB);
+ inverse = deltaA.decompose(deltaC);
+ return inverse;
+ };
+
+ Delta.prototype.isEqual = function(other) {
+ if (!other) {
+ return false;
+ }
+ if (this.startLength !== other.startLength || this.endLength !== other.endLength) {
+ return false;
+ }
+ if (!_.isArray(other.ops) || this.ops.length !== other.ops.length) {
+ return false;
+ }
+ return _.all(this.ops, function(op, i) {
+ return op.isEqual(other.ops[i]);
+ });
+ };
+
+ Delta.prototype.isIdentity = function() {
+ var index, op, _i, _len, _ref;
+ if (this.startLength === this.endLength) {
+ if (this.ops.length === 0) {
+ return true;
+ }
+ index = 0;
+ _ref = this.ops;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ op = _ref[_i];
+ if (!Op.isRetain(op)) {
+ return false;
+ }
+ if (op.start !== index) {
+ return false;
+ }
+ if (!(op.numAttributes() === 0 || (op.numAttributes() === 1 && _.has(op.attributes, 'authorId')))) {
+ return false;
+ }
+ index = op.end;
+ }
+ if (index !== this.endLength) {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ };
+
+ Delta.prototype.isInsertsOnly = function() {
+ return _.every(this.ops, function(op) {
+ return Op.isInsert(op);
+ });
+ };
+
+ Delta.prototype.merge = function(other) {
+ var ops;
+ ops = _.map(other.ops, (function(_this) {
+ return function(op) {
+ if (Op.isRetain(op)) {
+ return new RetainOp(op.start + _this.startLength, op.end + _this.startLength, op.attributes);
+ } else {
+ return op;
+ }
+ };
+ })(this));
+ ops = this.ops.concat(ops);
+ return new Delta(this.startLength + other.startLength, ops);
+ };
+
+ Delta.prototype.split = function(index) {
+ var leftOps, rightOps;
+ if (!this.isInsertsOnly()) {
+ throw new Error("Split only implemented for inserts only");
+ }
+ if (!(0 <= index && index <= this.endLength)) {
+ throw new Error("Split at invalid index");
+ }
+ leftOps = [];
+ rightOps = [];
+ _.reduce(this.ops, function(offset, op) {
+ var left, right, _ref;
+ if (offset + op.getLength() <= index) {
+ leftOps.push(op);
+ } else if (offset >= index) {
+ rightOps.push(op);
+ } else {
+ _ref = op.split(index - offset), left = _ref[0], right = _ref[1];
+ leftOps.push(left);
+ rightOps.push(right);
+ }
+ return offset + op.getLength();
+ }, 0);
+ return [new Delta(0, leftOps), new Delta(0, rightOps)];
+ };
+
+ Delta.prototype.toString = function() {
+ return "{(" + this.startLength + "->" + this.endLength + ") [" + (this.ops.join(', ')) + "]}";
+ };
+
+ return Delta;
+
+ })();
+
+ module.exports = Delta;
+
+}).call(this);
+
+},{"./insert":6,"./op":7,"./retain":8,"diff":11,"lodash":"M4+//f"}],5:[function(_dereq_,module,exports){
+(function() {
+ var Delta, DeltaGenerator, InsertOp, RetainOp, getUtils, setDomain, _, _domain;
+
+ _ = _dereq_('lodash');
+
+ Delta = _dereq_('./delta');
+
+ InsertOp = _dereq_('./insert');
+
+ RetainOp = _dereq_('./retain');
+
+ _domain = {
+ alphabet: "abcdefghijklmnopqrstuvwxyz\n\n\n\n ",
+ booleanAttributes: {
+ 'bold': [true, false],
+ 'italic': [true, false],
+ 'strike': [true, false]
+ },
+ nonBooleanAttributes: {
+ 'back-color': ['white', 'black', 'red', 'blue', 'lime', 'teal', 'magenta', 'yellow'],
+ 'fore-color': ['white', 'black', 'red', 'blue', 'lime', 'teal', 'magenta', 'yellow'],
+ 'font-name': ['monospace', 'serif'],
+ 'font-size': ['huge', 'large', 'small']
+ },
+ defaultAttributeValue: {
+ 'back-color': 'white',
+ 'fore-color': 'black',
+ 'font-name': 'san-serif',
+ 'font-size': 'normal'
+ }
+ };
+
+ setDomain = function(domain) {
+ if (domain != null) {
+ return _domain = domain;
+ }
+ };
+
+ getUtils = function(domain) {
+ domain = domain || _domain;
+ if (domain == null) {
+ throw new Error("Must provide DeltaGenerator with a domain.");
+ }
+ if (domain.alphabet == null) {
+ throw new Error("Domain must define alphabet.");
+ }
+ if (domain.booleanAttributes == null) {
+ throw new Error("Domain must define booleanAttributes.");
+ }
+ if (domain.nonBooleanAttributes == null) {
+ throw new Error("Domain must define nonBooleanAttributes.");
+ }
+ if (domain.defaultAttributeValue == null) {
+ throw new Error("Domain must define defaultAttributeValue.");
+ }
+ return {
+ getDomain: function(domain) {
+ return _domain;
+ },
+ getRandomString: function(length) {
+ var _i, _ref, _results;
+ return _.map((function() {
+ _results = [];
+ for (var _i = 0, _ref = length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; 0 <= _ref ? _i++ : _i--){ _results.push(_i); }
+ return _results;
+ }).apply(this), function() {
+ return domain.alphabet[_.random(0, domain.alphabet.length - 1)];
+ }).join('');
+ },
+ getRandomLength: function() {
+ var rand;
+ rand = Math.random();
+ if (rand < 0.6) {
+ return _.random(1, 2);
+ } else if (rand < 0.8) {
+ return _.random(3, 4);
+ } else if (rand < 0.9) {
+ return _.random(5, 9);
+ } else {
+ return _.random(10, 50);
+ }
+ },
+ insertAt: function(delta, insertionPoint, insertions) {
+ var charIndex, head, op, opIndex, tail, _i, _len, _ref, _ref1;
+ charIndex = opIndex = 0;
+ _ref = delta.ops;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ op = _ref[_i];
+ if (charIndex === insertionPoint) {
+ break;
+ }
+ if (insertionPoint < charIndex + op.getLength()) {
+ _ref1 = op.split(insertionPoint - charIndex), head = _ref1[0], tail = _ref1[1];
+ delta.ops.splice(opIndex, 1, head, tail);
+ opIndex++;
+ break;
+ }
+ charIndex += op.getLength();
+ opIndex++;
+ }
+ delta.ops.splice(opIndex, 0, new InsertOp(insertions));
+ delta.endLength += insertions.length;
+ return delta.compact();
+ },
+ deleteAt: function(delta, deletionPoint, numToDelete) {
+ var charIndex, curDelete, head, newText, op, ops, reachedDeletionPoint, tail, _i, _len, _ref;
+ charIndex = 0;
+ ops = [];
+ _ref = delta.ops;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ op = _ref[_i];
+ reachedDeletionPoint = charIndex === deletionPoint || deletionPoint < charIndex + op.getLength();
+ if (numToDelete > 0 && reachedDeletionPoint) {
+ curDelete = Math.min(numToDelete, op.getLength() - (deletionPoint - charIndex));
+ numToDelete -= curDelete;
+ if (InsertOp.isInsert(op)) {
+ newText = op.value.substring(0, deletionPoint - charIndex) + op.value.substring(deletionPoint - charIndex + curDelete);
+ if (newText.length > 0) {
+ ops.push(new InsertOp(newText));
+ }
+ } else {
+ if (!RetainOp.isRetain(op)) {
+ throw new Error("Expected retain but got " + op);
+ }
+ head = new RetainOp(op.start, op.start + deletionPoint - charIndex, _.clone(op.attributes));
+ tail = new RetainOp(op.start + deletionPoint - charIndex + curDelete, op.end, _.clone(op.attributes));
+ if (head.start < head.end) {
+ ops.push(head);
+ }
+ if (tail.start < tail.end) {
+ ops.push(tail);
+ }
+ }
+ deletionPoint += curDelete;
+ } else {
+ ops.push(op);
+ }
+ charIndex += op.getLength();
+ }
+ delta.ops = ops;
+ return delta.endLength = _.reduce(ops, function(length, op) {
+ return length + op.getLength();
+ }, 0);
+ },
+ formatAt: function(delta, formatPoint, numToFormat, attrs, reference) {
+ var attr, charIndex, cur, curFormat, head, op, ops, reachedFormatPoint, tail, _formatBooleanAttribute, _formatNonBooleanAttribute, _i, _j, _len, _len1, _limitScope, _ref, _ref1, _splitOpInThree;
+ _splitOpInThree = function(elem, splitAt, length, reference) {
+ var cur, curStr, head, headStr, marker, newCur, op, origOps, tail, tailStr, _i, _len;
+ if (InsertOp.isInsert(elem)) {
+ headStr = elem.value.substring(0, splitAt);
+ head = new InsertOp(headStr, _.clone(elem.attributes));
+ curStr = elem.value.substring(splitAt, splitAt + length);
+ cur = new InsertOp(curStr, _.clone(elem.attributes));
+ tailStr = elem.value.substring(splitAt + length);
+ tail = new InsertOp(tailStr, _.clone(elem.attributes));
+ if (curStr.indexOf('\n') !== -1) {
+ newCur = curStr.substring(0, curStr.indexOf('\n'));
+ tailStr = curStr.substring(curStr.indexOf('\n')) + tailStr;
+ cur = new InsertOp(newCur, _.clone(elem.attributes));
+ tail = new InsertOp(tailStr, _.clone(elem.attributes));
+ }
+ } else {
+ if (!RetainOp.isRetain(elem)) {
+ throw new Error("Expected retain but got " + elem);
+ }
+ head = new RetainOp(elem.start, elem.start + splitAt, _.clone(elem.attributes));
+ cur = new RetainOp(head.end, head.end + length, _.clone(elem.attributes));
+ tail = new RetainOp(cur.end, elem.end, _.clone(elem.attributes));
+ origOps = reference.getOpsAt(cur.start, cur.getLength());
+ if (!_.every(origOps, function(op) {
+ return InsertOp.isInsert(op);
+ })) {
+ throw new Error("Non insert op in backref");
+ }
+ marker = cur.start;
+ for (_i = 0, _len = origOps.length; _i < _len; _i++) {
+ op = origOps[_i];
+ if (InsertOp.isInsert(op)) {
+ if (op.value.indexOf('\n') !== -1) {
+ cur = new RetainOp(cur.start, marker + op.value.indexOf('\n'), _.clone(cur.attributes));
+ tail = new RetainOp(marker + op.value.indexOf('\n'), tail.end, _.clone(tail.attributes));
+ break;
+ } else {
+ marker += op.getLength();
+ }
+ } else {
+ throw new Error("Got retainOp in reference delta!");
+ }
+ }
+ }
+ return [head, cur, tail];
+ };
+ _limitScope = function(op, tail, attr, referenceOps) {
+ var length, refOp, val, _i, _len, _results;
+ length = 0;
+ val = referenceOps[0].attributes[attr];
+ _results = [];
+ for (_i = 0, _len = referenceOps.length; _i < _len; _i++) {
+ refOp = referenceOps[_i];
+ if (refOp.attributes[attr] !== val) {
+ op.end = op.start + length;
+ tail.start = op.end;
+ break;
+ } else {
+ _results.push(length += refOp.getLength());
+ }
+ }
+ return _results;
+ };
+ _formatBooleanAttribute = function(op, tail, attr, reference) {
+ var referenceOps;
+ if (InsertOp.isInsert(op)) {
+ if (op.attributes[attr] != null) {
+ return delete op.attributes[attr];
+ } else {
+ return op.attributes[attr] = true;
+ }
+ } else {
+ if (!RetainOp.isRetain(op)) {
+ throw new Error("Expected retain but got " + op);
+ }
+ if (op.attributes[attr] != null) {
+ return delete op.attributes[attr];
+ } else {
+ referenceOps = reference.getOpsAt(op.start, op.getLength());
+ if (!_.every(referenceOps, function(op) {
+ return InsertOp.isInsert(op);
+ })) {
+ throw new Error("Formatting a retain that does not refer to an insert.");
+ }
+ if (referenceOps.length > 0) {
+ _limitScope(op, tail, attr, referenceOps);
+ if (referenceOps[0].attributes[attr] != null) {
+ if (!referenceOps[0].attributes[attr]) {
+ throw new Error("Boolean attribute on reference delta should only be true!");
+ }
+ return op.attributes[attr] = null;
+ } else {
+ return op.attributes[attr] = true;
+ }
+ }
+ }
+ }
+ };
+ _formatNonBooleanAttribute = (function(_this) {
+ return function(op, tail, attr, reference) {
+ var getNewAttrVal, referenceOps;
+ getNewAttrVal = function(prevVal) {
+ if (prevVal != null) {
+ return _.first(_.shuffle(_.without(domain.nonBooleanAttributes[attr], prevVal)));
+ } else {
+ return _.first(_.shuffle(_.without(domain.nonBooleanAttributes[attr], domain.defaultAttributeValue[attr])));
+ }
+ };
+ if (InsertOp.isInsert(op)) {
+ return op.attributes[attr] = getNewAttrVal(attr, op.attributes[attr]);
+ } else {
+ if (!RetainOp.isRetain(op)) {
+ throw new Error("Expected retain but got " + op);
+ }
+ referenceOps = reference.getOpsAt(op.start, op.getLength());
+ if (!_.every(referenceOps, function(op) {
+ return InsertOp.isInsert(op);
+ })) {
+ throw new Error("Formatting a retain that does not refer to an insert.");
+ }
+ if (referenceOps.length > 0) {
+ _limitScope(op, tail, attr, referenceOps);
+ if ((op.attributes[attr] != null) && Math.random() < 0.5) {
+ return delete op.attributes[attr];
+ } else {
+ return op.attributes[attr] = getNewAttrVal(op.attributes[attr]);
+ }
+ }
+ }
+ };
+ })(this);
+ charIndex = 0;
+ ops = [];
+ _ref = delta.ops;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ op = _ref[_i];
+ reachedFormatPoint = charIndex === formatPoint || charIndex + op.getLength() > formatPoint;
+ if (numToFormat > 0 && reachedFormatPoint) {
+ curFormat = Math.min(numToFormat, op.getLength() - (formatPoint - charIndex));
+ numToFormat -= curFormat;
+ _ref1 = _splitOpInThree(op, formatPoint - charIndex, curFormat, reference), head = _ref1[0], cur = _ref1[1], tail = _ref1[2];
+ ops.push(head);
+ ops.push(cur);
+ ops.push(tail);
+ for (_j = 0, _len1 = attrs.length; _j < _len1; _j++) {
+ attr = attrs[_j];
+ if (_.has(domain.booleanAttributes, attr)) {
+ _formatBooleanAttribute(cur, tail, attr, reference);
+ } else if (_.has(domain.nonBooleanAttributes, attr)) {
+ _formatNonBooleanAttribute(cur, tail, attr, reference);
+ } else {
+ throw new Error("Received unknown attribute: " + attr);
+ }
+ }
+ formatPoint += curFormat;
+ } else {
+ ops.push(op);
+ }
+ charIndex += op.getLength();
+ }
+ delta.endLength = _.reduce(ops, function(length, delta) {
+ return length + delta.getLength();
+ }, 0);
+ delta.ops = ops;
+ return delta.compact();
+ },
+ addRandomOp: function(newDelta, referenceDelta) {
+ var attrs, finalIndex, numAttrs, opIndex, opLength, rand, shuffled_attrs;
+ finalIndex = referenceDelta.endLength - 1;
+ opIndex = _.random(0, finalIndex);
+ rand = Math.random();
+ if (rand < 0.5) {
+ opLength = this.getRandomLength();
+ this.insertAt(newDelta, opIndex, this.getRandomString(opLength));
+ } else if (rand < 0.75) {
+ if (referenceDelta.endLength <= 1) {
+ return newDelta;
+ }
+ opIndex = _.random(0, finalIndex - 1);
+ opLength = _.random(1, finalIndex - opIndex);
+ this.deleteAt(newDelta, opIndex, opLength);
+ } else {
+ shuffled_attrs = _.shuffle(_.keys(domain.booleanAttributes).concat(_.keys(domain.nonBooleanAttributes)));
+ numAttrs = _.random(1, shuffled_attrs.length);
+ attrs = shuffled_attrs.slice(0, numAttrs);
+ opLength = _.random(1, finalIndex - opIndex);
+ this.formatAt(newDelta, opIndex, opLength, attrs, referenceDelta);
+ }
+ return newDelta;
+ },
+ getRandomDelta: function(referenceDelta, numOps) {
+ var i, newDelta, _i;
+ newDelta = new Delta(referenceDelta.endLength, referenceDelta.endLength, [new RetainOp(0, referenceDelta.endLength)]);
+ numOps || (numOps = _.random(1, 10));
+ for (i = _i = 0; 0 <= numOps ? _i < numOps : _i > numOps; i = 0 <= numOps ? ++_i : --_i) {
+ this.addRandomOp(newDelta, referenceDelta);
+ }
+ return newDelta;
+ }
+ };
+ };
+
+ DeltaGenerator = {
+ setDomain: setDomain,
+ getUtils: getUtils
+ };
+
+ module.exports = DeltaGenerator;
+
+}).call(this);
+
+},{"./delta":4,"./insert":6,"./retain":8,"lodash":"M4+//f"}],6:[function(_dereq_,module,exports){
+(function() {
+ var InsertOp, Op, _,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ = _dereq_('lodash');
+
+ Op = _dereq_('./op');
+
+ InsertOp = (function(_super) {
+ __extends(InsertOp, _super);
+
+ function InsertOp(value, attributes) {
+ this.value = value;
+ if (attributes == null) {
+ attributes = {};
+ }
+ this.attributes = _.clone(attributes);
+ }
+
+ InsertOp.prototype.getAt = function(start, length) {
+ return new InsertOp(this.value.substr(start, length), this.attributes);
+ };
+
+ InsertOp.prototype.getLength = function() {
+ return this.value.length;
+ };
+
+ InsertOp.prototype.isEqual = function(other) {
+ return (other != null) && this.value === other.value && _.isEqual(this.attributes, other.attributes);
+ };
+
+ InsertOp.prototype.join = function(other) {
+ if (_.isEqual(this.attributes, other.attributes)) {
+ return new InsertOp(this.value + second.value, this.attributes);
+ } else {
+ throw Error;
+ }
+ };
+
+ InsertOp.prototype.split = function(offset) {
+ var left, right;
+ left = new InsertOp(this.value.substr(0, offset), this.attributes);
+ right = new InsertOp(this.value.substr(offset), this.attributes);
+ return [left, right];
+ };
+
+ InsertOp.prototype.toString = function() {
+ return "{" + this.value + ", " + (this.printAttributes()) + "}";
+ };
+
+ return InsertOp;
+
+ })(Op);
+
+ module.exports = InsertOp;
+
+}).call(this);
+
+},{"./op":7,"lodash":"M4+//f"}],7:[function(_dereq_,module,exports){
+(function() {
+ var Op, _;
+
+ _ = _dereq_('lodash');
+
+ Op = (function() {
+ Op.isInsert = function(i) {
+ return (i != null) && typeof i.value === "string";
+ };
+
+ Op.isRetain = function(r) {
+ return (r != null) && typeof r.start === "number" && typeof r.end === "number";
+ };
+
+ function Op(attributes) {
+ if (attributes == null) {
+ attributes = {};
+ }
+ this.attributes = _.clone(attributes);
+ }
+
+ Op.prototype.addAttributes = function(attributes) {
+ var addedAttributes, key, value;
+ addedAttributes = {};
+ for (key in attributes) {
+ value = attributes[key];
+ if (this.attributes[key] === void 0) {
+ addedAttributes[key] = value;
+ }
+ }
+ return addedAttributes;
+ };
+
+ Op.prototype.attributesMatch = function(other) {
+ var otherAttributes;
+ otherAttributes = other.attributes || {};
+ return _.isEqual(this.attributes, otherAttributes);
+ };
+
+ Op.prototype.composeAttributes = function(attributes) {
+ var resolveAttributes;
+ resolveAttributes = (function(_this) {
+ return function(oldAttrs, newAttrs) {
+ var key, resolvedAttrs, value;
+ if (!newAttrs) {
+ return oldAttrs;
+ }
+ resolvedAttrs = _.clone(oldAttrs);
+ for (key in newAttrs) {
+ value = newAttrs[key];
+ if (Op.isInsert(_this) && value === null) {
+ delete resolvedAttrs[key];
+ } else if (typeof value !== 'undefined') {
+ if (typeof resolvedAttrs[key] === 'object' && typeof value === 'object' && _.all([resolvedAttrs[key], newAttrs[key]], (function(val) {
+ return val !== null;
+ }))) {
+ resolvedAttrs[key] = resolveAttributes(resolvedAttrs[key], value);
+ } else {
+ resolvedAttrs[key] = value;
+ }
+ }
+ }
+ return resolvedAttrs;
+ };
+ })(this);
+ return resolveAttributes(this.attributes, attributes);
+ };
+
+ Op.prototype.numAttributes = function() {
+ return _.keys(this.attributes).length;
+ };
+
+ Op.prototype.printAttributes = function() {
+ return JSON.stringify(this.attributes);
+ };
+
+ return Op;
+
+ })();
+
+ module.exports = Op;
+
+}).call(this);
+
+},{"lodash":"M4+//f"}],8:[function(_dereq_,module,exports){
+(function() {
+ var Op, RetainOp, _,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+ _ = _dereq_('lodash');
+
+ Op = _dereq_('./op');
+
+ RetainOp = (function(_super) {
+ __extends(RetainOp, _super);
+
+ function RetainOp(start, end, attributes) {
+ this.start = start;
+ this.end = end;
+ if (attributes == null) {
+ attributes = {};
+ }
+ this.attributes = _.clone(attributes);
+ }
+
+ RetainOp.prototype.getAt = function(start, length) {
+ return new RetainOp(this.start + start, this.start + start + length, this.attributes);
+ };
+
+ RetainOp.prototype.getLength = function() {
+ return this.end - this.start;
+ };
+
+ RetainOp.prototype.isEqual = function(other) {
+ return (other != null) && this.start === other.start && this.end === other.end && _.isEqual(this.attributes, other.attributes);
+ };
+
+ RetainOp.prototype.split = function(offset) {
+ var left, right;
+ left = new RetainOp(this.start, this.start + offset, this.attributes);
+ right = new RetainOp(this.start + offset, this.end, this.attributes);
+ return [left, right];
+ };
+
+ RetainOp.prototype.toString = function() {
+ return "{{" + this.start + " - " + this.end + "), " + (this.printAttributes()) + "}";
+ };
+
+ return RetainOp;
+
+ })(Op);
+
+ module.exports = RetainOp;
+
+}).call(this);
+
+},{"./op":7,"lodash":"M4+//f"}],9:[function(_dereq_,module,exports){
+(function() {
+ module.exports = {
+ Delta: _dereq_('./delta'),
+ DeltaGen: _dereq_('./delta_generator'),
+ Op: _dereq_('./op'),
+ InsertOp: _dereq_('./insert'),
+ RetainOp: _dereq_('./retain')
+ };
+
+}).call(this);
+
+},{"./delta":4,"./delta_generator":5,"./insert":6,"./op":7,"./retain":8}],10:[function(_dereq_,module,exports){
+module.exports = _dereq_('./build/tandem-core')
+
+},{"./build/tandem-core":9}],11:[function(_dereq_,module,exports){
+/* See LICENSE file for terms of use */
+
+/*
+ * Text diff implementation.
+ *
+ * This library supports the following APIS:
+ * JsDiff.diffChars: Character by character diff
+ * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
+ * JsDiff.diffLines: Line based diff
+ *
+ * JsDiff.diffCss: Diff targeted at CSS content
+ *
+ * These methods are based on the implementation proposed in
+ * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
+ * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
+ */
+var JsDiff = (function() {
+ /*jshint maxparams: 5*/
+ function clonePath(path) {
+ return { newPos: path.newPos, components: path.components.slice(0) };
+ }
+ function removeEmpty(array) {
+ var ret = [];
+ for (var i = 0; i < array.length; i++) {
+ if (array[i]) {
+ ret.push(array[i]);
+ }
+ }
+ return ret;
+ }
+ function escapeHTML(s) {
+ var n = s;
+ n = n.replace(/&/g, '&');
+ n = n.replace(//g, '>');
+ n = n.replace(/"/g, '"');
+
+ return n;
+ }
+
+ var Diff = function(ignoreWhitespace) {
+ this.ignoreWhitespace = ignoreWhitespace;
+ };
+ Diff.prototype = {
+ diff: function(oldString, newString) {
+ // Handle the identity case (this is due to unrolling editLength == 0
+ if (newString === oldString) {
+ return [{ value: newString }];
+ }
+ if (!newString) {
+ return [{ value: oldString, removed: true }];
+ }
+ if (!oldString) {
+ return [{ value: newString, added: true }];
+ }
+
+ newString = this.tokenize(newString);
+ oldString = this.tokenize(oldString);
+
+ var newLen = newString.length, oldLen = oldString.length;
+ var maxEditLength = newLen + oldLen;
+ var bestPath = [{ newPos: -1, components: [] }];
+
+ // Seed editLength = 0
+ var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
+ if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) {
+ return bestPath[0].components;
+ }
+
+ for (var editLength = 1; editLength <= maxEditLength; editLength++) {
+ for (var diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) {
+ var basePath;
+ var addPath = bestPath[diagonalPath-1],
+ removePath = bestPath[diagonalPath+1];
+ oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
+ if (addPath) {
+ // No one else is going to attempt to use this value, clear it
+ bestPath[diagonalPath-1] = undefined;
+ }
+
+ var canAdd = addPath && addPath.newPos+1 < newLen;
+ var canRemove = removePath && 0 <= oldPos && oldPos < oldLen;
+ if (!canAdd && !canRemove) {
+ bestPath[diagonalPath] = undefined;
+ continue;
+ }
+
+ // Select the diagonal that we want to branch from. We select the prior
+ // path whose position in the new string is the farthest from the origin
+ // and does not pass the bounds of the diff graph
+ if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
+ basePath = clonePath(removePath);
+ this.pushComponent(basePath.components, oldString[oldPos], undefined, true);
+ } else {
+ basePath = clonePath(addPath);
+ basePath.newPos++;
+ this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined);
+ }
+
+ var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath);
+
+ if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) {
+ return basePath.components;
+ } else {
+ bestPath[diagonalPath] = basePath;
+ }
+ }
+ }
+ },
+
+ pushComponent: function(components, value, added, removed) {
+ var last = components[components.length-1];
+ if (last && last.added === added && last.removed === removed) {
+ // We need to clone here as the component clone operation is just
+ // as shallow array clone
+ components[components.length-1] =
+ {value: this.join(last.value, value), added: added, removed: removed };
+ } else {
+ components.push({value: value, added: added, removed: removed });
+ }
+ },
+ extractCommon: function(basePath, newString, oldString, diagonalPath) {
+ var newLen = newString.length,
+ oldLen = oldString.length,
+ newPos = basePath.newPos,
+ oldPos = newPos - diagonalPath;
+ while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) {
+ newPos++;
+ oldPos++;
+
+ this.pushComponent(basePath.components, newString[newPos], undefined, undefined);
+ }
+ basePath.newPos = newPos;
+ return oldPos;
+ },
+
+ equals: function(left, right) {
+ var reWhitespace = /\S/;
+ if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) {
+ return true;
+ } else {
+ return left === right;
+ }
+ },
+ join: function(left, right) {
+ return left + right;
+ },
+ tokenize: function(value) {
+ return value;
+ }
+ };
+
+ var CharDiff = new Diff();
+
+ var WordDiff = new Diff(true);
+ var WordWithSpaceDiff = new Diff();
+ WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) {
+ return removeEmpty(value.split(/(\s+|\b)/));
+ };
+
+ var CssDiff = new Diff(true);
+ CssDiff.tokenize = function(value) {
+ return removeEmpty(value.split(/([{}:;,]|\s+)/));
+ };
+
+ var LineDiff = new Diff();
+ LineDiff.tokenize = function(value) {
+ var retLines = [],
+ lines = value.split(/^/m);
+
+ for(var i = 0; i < lines.length; i++) {
+ var line = lines[i],
+ lastLine = lines[i - 1];
+
+ // Merge lines that may contain windows new lines
+ if (line == '\n' && lastLine && lastLine[lastLine.length - 1] === '\r') {
+ retLines[retLines.length - 1] += '\n';
+ } else if (line) {
+ retLines.push(line);
+ }
+ }
+
+ return retLines;
+ };
+
+ return {
+ Diff: Diff,
+
+ diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); },
+ diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); },
+ diffWordsWithSpace: function(oldStr, newStr) { return WordWithSpaceDiff.diff(oldStr, newStr); },
+ diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); },
+
+ diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); },
+
+ createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) {
+ var ret = [];
+
+ ret.push('Index: ' + fileName);
+ ret.push('===================================================================');
+ ret.push('--- ' + fileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader));
+ ret.push('+++ ' + fileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader));
+
+ var diff = LineDiff.diff(oldStr, newStr);
+ if (!diff[diff.length-1].value) {
+ diff.pop(); // Remove trailing newline add
+ }
+ diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier
+
+ function contextLines(lines) {
+ return lines.map(function(entry) { return ' ' + entry; });
+ }
+ function eofNL(curRange, i, current) {
+ var last = diff[diff.length-2],
+ isLast = i === diff.length-2,
+ isLastOfType = i === diff.length-3 && (current.added !== last.added || current.removed !== last.removed);
+
+ // Figure out if this is the last line for the given file and missing NL
+ if (!/\n$/.test(current.value) && (isLast || isLastOfType)) {
+ curRange.push('\\ No newline at end of file');
+ }
+ }
+
+ var oldRangeStart = 0, newRangeStart = 0, curRange = [],
+ oldLine = 1, newLine = 1;
+ for (var i = 0; i < diff.length; i++) {
+ var current = diff[i],
+ lines = current.lines || current.value.replace(/\n$/, '').split('\n');
+ current.lines = lines;
+
+ if (current.added || current.removed) {
+ if (!oldRangeStart) {
+ var prev = diff[i-1];
+ oldRangeStart = oldLine;
+ newRangeStart = newLine;
+
+ if (prev) {
+ curRange = contextLines(prev.lines.slice(-4));
+ oldRangeStart -= curRange.length;
+ newRangeStart -= curRange.length;
+ }
+ }
+ curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?'+':'-') + entry; }));
+ eofNL(curRange, i, current);
+
+ if (current.added) {
+ newLine += lines.length;
+ } else {
+ oldLine += lines.length;
+ }
+ } else {
+ if (oldRangeStart) {
+ // Close out any changes that have been output (or join overlapping)
+ if (lines.length <= 8 && i < diff.length-2) {
+ // Overlapping
+ curRange.push.apply(curRange, contextLines(lines));
+ } else {
+ // end the range and output
+ var contextSize = Math.min(lines.length, 4);
+ ret.push(
+ '@@ -' + oldRangeStart + ',' + (oldLine-oldRangeStart+contextSize)
+ + ' +' + newRangeStart + ',' + (newLine-newRangeStart+contextSize)
+ + ' @@');
+ ret.push.apply(ret, curRange);
+ ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));
+ if (lines.length <= 4) {
+ eofNL(ret, i, current);
+ }
+
+ oldRangeStart = 0; newRangeStart = 0; curRange = [];
+ }
+ }
+ oldLine += lines.length;
+ newLine += lines.length;
+ }
+ }
+
+ return ret.join('\n') + '\n';
+ },
+
+ applyPatch: function(oldStr, uniDiff) {
+ var diffstr = uniDiff.split('\n');
+ var diff = [];
+ var remEOFNL = false,
+ addEOFNL = false;
+
+ for (var i = (diffstr[0][0]==='I'?4:0); i < diffstr.length; i++) {
+ if(diffstr[i][0] === '@') {
+ var meh = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);
+ diff.unshift({
+ start:meh[3],
+ oldlength:meh[2],
+ oldlines:[],
+ newlength:meh[4],
+ newlines:[]
+ });
+ } else if(diffstr[i][0] === '+') {
+ diff[0].newlines.push(diffstr[i].substr(1));
+ } else if(diffstr[i][0] === '-') {
+ diff[0].oldlines.push(diffstr[i].substr(1));
+ } else if(diffstr[i][0] === ' ') {
+ diff[0].newlines.push(diffstr[i].substr(1));
+ diff[0].oldlines.push(diffstr[i].substr(1));
+ } else if(diffstr[i][0] === '\\') {
+ if (diffstr[i-1][0] === '+') {
+ remEOFNL = true;
+ } else if(diffstr[i-1][0] === '-') {
+ addEOFNL = true;
+ }
+ }
+ }
+
+ var str = oldStr.split('\n');
+ for (var i = diff.length - 1; i >= 0; i--) {
+ var d = diff[i];
+ for (var j = 0; j < d.oldlength; j++) {
+ if(str[d.start-1+j] !== d.oldlines[j]) {
+ return false;
+ }
+ }
+ Array.prototype.splice.apply(str,[d.start-1,+d.oldlength].concat(d.newlines));
+ }
+
+ if (remEOFNL) {
+ while (!str[str.length-1]) {
+ str.pop();
+ }
+ } else if (addEOFNL) {
+ str.push('');
+ }
+ return str.join('\n');
+ },
+
+ convertChangesToXML: function(changes){
+ var ret = [];
+ for ( var i = 0; i < changes.length; i++) {
+ var change = changes[i];
+ if (change.added) {
+ ret.push('');
+ } else if (change.removed) {
+ ret.push('');
+ }
+
+ ret.push(escapeHTML(change.value));
+
+ if (change.added) {
+ ret.push('');
+ } else if (change.removed) {
+ ret.push('');
+ }
+ }
+ return ret.join('');
+ },
+
+ // See: http://code.google.com/p/google-diff-match-patch/wiki/API
+ convertChangesToDMP: function(changes){
+ var ret = [], change;
+ for ( var i = 0; i < changes.length; i++) {
+ change = changes[i];
+ ret.push([(change.added ? 1 : change.removed ? -1 : 0), change.value]);
+ }
+ return ret;
+ }
+ };
+})();
+
+if (typeof module !== 'undefined') {
+ module.exports = JsDiff;
+}
+
+},{}],12:[function(_dereq_,module,exports){
+// Underscore.string
+// (c) 2010 Esa-Matti Suuronen
+// Underscore.string is freely distributable under the terms of the MIT license.
+// Documentation: https://github.com/epeli/underscore.string
+// Some code is borrowed from MooTools and Alexandru Marasteanu.
+// Version '2.3.2'
+
+!function(root, String){
+ 'use strict';
+
+ // Defining helper functions.
+
+ var nativeTrim = String.prototype.trim;
+ var nativeTrimRight = String.prototype.trimRight;
+ var nativeTrimLeft = String.prototype.trimLeft;
+
+ var parseNumber = function(source) { return source * 1 || 0; };
+
+ var strRepeat = function(str, qty){
+ if (qty < 1) return '';
+ var result = '';
+ while (qty > 0) {
+ if (qty & 1) result += str;
+ qty >>= 1, str += str;
+ }
+ return result;
+ };
+
+ var slice = [].slice;
+
+ var defaultToWhiteSpace = function(characters) {
+ if (characters == null)
+ return '\\s';
+ else if (characters.source)
+ return characters.source;
+ else
+ return '[' + _s.escapeRegExp(characters) + ']';
+ };
+
+ // Helper for toBoolean
+ function boolMatch(s, matchers) {
+ var i, matcher, down = s.toLowerCase();
+ matchers = [].concat(matchers);
+ for (i = 0; i < matchers.length; i += 1) {
+ matcher = matchers[i];
+ if (!matcher) continue;
+ if (matcher.test && matcher.test(s)) return true;
+ if (matcher.toLowerCase() === down) return true;
+ }
+ }
+
+ var escapeChars = {
+ lt: '<',
+ gt: '>',
+ quot: '"',
+ amp: '&',
+ apos: "'"
+ };
+
+ var reversedEscapeChars = {};
+ for(var key in escapeChars) reversedEscapeChars[escapeChars[key]] = key;
+ reversedEscapeChars["'"] = '#39';
+
+ // sprintf() for JavaScript 0.7-beta1
+ // http://www.diveintojavascript.com/projects/javascript-sprintf
+ //
+ // Copyright (c) Alexandru Marasteanu
+ // All rights reserved.
+
+ var sprintf = (function() {
+ function get_type(variable) {
+ return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
+ }
+
+ var str_repeat = strRepeat;
+
+ var str_format = function() {
+ if (!str_format.cache.hasOwnProperty(arguments[0])) {
+ str_format.cache[arguments[0]] = str_format.parse(arguments[0]);
+ }
+ return str_format.format.call(null, str_format.cache[arguments[0]], arguments);
+ };
+
+ str_format.format = function(parse_tree, argv) {
+ var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;
+ for (i = 0; i < tree_length; i++) {
+ node_type = get_type(parse_tree[i]);
+ if (node_type === 'string') {
+ output.push(parse_tree[i]);
+ }
+ else if (node_type === 'array') {
+ match = parse_tree[i]; // convenience purposes only
+ if (match[2]) { // keyword argument
+ arg = argv[cursor];
+ for (k = 0; k < match[2].length; k++) {
+ if (!arg.hasOwnProperty(match[2][k])) {
+ throw new Error(sprintf('[_.sprintf] property "%s" does not exist', match[2][k]));
+ }
+ arg = arg[match[2][k]];
+ }
+ } else if (match[1]) { // positional argument (explicit)
+ arg = argv[match[1]];
+ }
+ else { // positional argument (implicit)
+ arg = argv[cursor++];
+ }
+
+ if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) {
+ throw new Error(sprintf('[_.sprintf] expecting number but found %s', get_type(arg)));
+ }
+ switch (match[8]) {
+ case 'b': arg = arg.toString(2); break;
+ case 'c': arg = String.fromCharCode(arg); break;
+ case 'd': arg = parseInt(arg, 10); break;
+ case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break;
+ case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break;
+ case 'o': arg = arg.toString(8); break;
+ case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break;
+ case 'u': arg = Math.abs(arg); break;
+ case 'x': arg = arg.toString(16); break;
+ case 'X': arg = arg.toString(16).toUpperCase(); break;
+ }
+ arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg);
+ pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' ';
+ pad_length = match[6] - String(arg).length;
+ pad = match[6] ? str_repeat(pad_character, pad_length) : '';
+ output.push(match[5] ? arg + pad : pad + arg);
+ }
+ }
+ return output.join('');
+ };
+
+ str_format.cache = {};
+
+ str_format.parse = function(fmt) {
+ var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;
+ while (_fmt) {
+ if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {
+ parse_tree.push(match[0]);
+ }
+ else if ((match = /^\x25{2}/.exec(_fmt)) !== null) {
+ parse_tree.push('%');
+ }
+ else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {
+ if (match[2]) {
+ arg_names |= 1;
+ var field_list = [], replacement_field = match[2], field_match = [];
+ if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
+ field_list.push(field_match[1]);
+ while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
+ if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
+ field_list.push(field_match[1]);
+ }
+ else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {
+ field_list.push(field_match[1]);
+ }
+ else {
+ throw new Error('[_.sprintf] huh?');
+ }
+ }
+ }
+ else {
+ throw new Error('[_.sprintf] huh?');
+ }
+ match[2] = field_list;
+ }
+ else {
+ arg_names |= 2;
+ }
+ if (arg_names === 3) {
+ throw new Error('[_.sprintf] mixing positional and named placeholders is not (yet) supported');
+ }
+ parse_tree.push(match);
+ }
+ else {
+ throw new Error('[_.sprintf] huh?');
+ }
+ _fmt = _fmt.substring(match[0].length);
+ }
+ return parse_tree;
+ };
+
+ return str_format;
+ })();
+
+
+
+ // Defining underscore.string
+
+ var _s = {
+
+ VERSION: '2.3.0',
+
+ isBlank: function(str){
+ if (str == null) str = '';
+ return (/^\s*$/).test(str);
+ },
+
+ stripTags: function(str){
+ if (str == null) return '';
+ return String(str).replace(/<\/?[^>]+>/g, '');
+ },
+
+ capitalize : function(str){
+ str = str == null ? '' : String(str);
+ return str.charAt(0).toUpperCase() + str.slice(1);
+ },
+
+ chop: function(str, step){
+ if (str == null) return [];
+ str = String(str);
+ step = ~~step;
+ return step > 0 ? str.match(new RegExp('.{1,' + step + '}', 'g')) : [str];
+ },
+
+ clean: function(str){
+ return _s.strip(str).replace(/\s+/g, ' ');
+ },
+
+ count: function(str, substr){
+ if (str == null || substr == null) return 0;
+
+ str = String(str);
+ substr = String(substr);
+
+ var count = 0,
+ pos = 0,
+ length = substr.length;
+
+ while (true) {
+ pos = str.indexOf(substr, pos);
+ if (pos === -1) break;
+ count++;
+ pos += length;
+ }
+
+ return count;
+ },
+
+ chars: function(str) {
+ if (str == null) return [];
+ return String(str).split('');
+ },
+
+ swapCase: function(str) {
+ if (str == null) return '';
+ return String(str).replace(/\S/g, function(c){
+ return c === c.toUpperCase() ? c.toLowerCase() : c.toUpperCase();
+ });
+ },
+
+ escapeHTML: function(str) {
+ if (str == null) return '';
+ return String(str).replace(/[&<>"']/g, function(m){ return '&' + reversedEscapeChars[m] + ';'; });
+ },
+
+ unescapeHTML: function(str) {
+ if (str == null) return '';
+ return String(str).replace(/\&([^;]+);/g, function(entity, entityCode){
+ var match;
+
+ if (entityCode in escapeChars) {
+ return escapeChars[entityCode];
+ } else if (match = entityCode.match(/^#x([\da-fA-F]+)$/)) {
+ return String.fromCharCode(parseInt(match[1], 16));
+ } else if (match = entityCode.match(/^#(\d+)$/)) {
+ return String.fromCharCode(~~match[1]);
+ } else {
+ return entity;
+ }
+ });
+ },
+
+ escapeRegExp: function(str){
+ if (str == null) return '';
+ return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
+ },
+
+ splice: function(str, i, howmany, substr){
+ var arr = _s.chars(str);
+ arr.splice(~~i, ~~howmany, substr);
+ return arr.join('');
+ },
+
+ insert: function(str, i, substr){
+ return _s.splice(str, i, 0, substr);
+ },
+
+ include: function(str, needle){
+ if (needle === '') return true;
+ if (str == null) return false;
+ return String(str).indexOf(needle) !== -1;
+ },
+
+ join: function() {
+ var args = slice.call(arguments),
+ separator = args.shift();
+
+ if (separator == null) separator = '';
+
+ return args.join(separator);
+ },
+
+ lines: function(str) {
+ if (str == null) return [];
+ return String(str).split("\n");
+ },
+
+ reverse: function(str){
+ return _s.chars(str).reverse().join('');
+ },
+
+ startsWith: function(str, starts){
+ if (starts === '') return true;
+ if (str == null || starts == null) return false;
+ str = String(str); starts = String(starts);
+ return str.length >= starts.length && str.slice(0, starts.length) === starts;
+ },
+
+ endsWith: function(str, ends){
+ if (ends === '') return true;
+ if (str == null || ends == null) return false;
+ str = String(str); ends = String(ends);
+ return str.length >= ends.length && str.slice(str.length - ends.length) === ends;
+ },
+
+ succ: function(str){
+ if (str == null) return '';
+ str = String(str);
+ return str.slice(0, -1) + String.fromCharCode(str.charCodeAt(str.length-1) + 1);
+ },
+
+ titleize: function(str){
+ if (str == null) return '';
+ str = String(str).toLowerCase();
+ return str.replace(/(?:^|\s|-)\S/g, function(c){ return c.toUpperCase(); });
+ },
+
+ camelize: function(str){
+ return _s.trim(str).replace(/[-_\s]+(.)?/g, function(match, c){ return c ? c.toUpperCase() : ""; });
+ },
+
+ underscored: function(str){
+ return _s.trim(str).replace(/([a-z\d])([A-Z]+)/g, '$1_$2').replace(/[-\s]+/g, '_').toLowerCase();
+ },
+
+ dasherize: function(str){
+ return _s.trim(str).replace(/([A-Z])/g, '-$1').replace(/[-_\s]+/g, '-').toLowerCase();
+ },
+
+ classify: function(str){
+ return _s.titleize(String(str).replace(/[\W_]/g, ' ')).replace(/\s/g, '');
+ },
+
+ humanize: function(str){
+ return _s.capitalize(_s.underscored(str).replace(/_id$/,'').replace(/_/g, ' '));
+ },
+
+ trim: function(str, characters){
+ if (str == null) return '';
+ if (!characters && nativeTrim) return nativeTrim.call(str);
+ characters = defaultToWhiteSpace(characters);
+ return String(str).replace(new RegExp('\^' + characters + '+|' + characters + '+$', 'g'), '');
+ },
+
+ ltrim: function(str, characters){
+ if (str == null) return '';
+ if (!characters && nativeTrimLeft) return nativeTrimLeft.call(str);
+ characters = defaultToWhiteSpace(characters);
+ return String(str).replace(new RegExp('^' + characters + '+'), '');
+ },
+
+ rtrim: function(str, characters){
+ if (str == null) return '';
+ if (!characters && nativeTrimRight) return nativeTrimRight.call(str);
+ characters = defaultToWhiteSpace(characters);
+ return String(str).replace(new RegExp(characters + '+$'), '');
+ },
+
+ truncate: function(str, length, truncateStr){
+ if (str == null) return '';
+ str = String(str); truncateStr = truncateStr || '...';
+ length = ~~length;
+ return str.length > length ? str.slice(0, length) + truncateStr : str;
+ },
+
+ /**
+ * _s.prune: a more elegant version of truncate
+ * prune extra chars, never leaving a half-chopped word.
+ * @author github.com/rwz
+ */
+ prune: function(str, length, pruneStr){
+ if (str == null) return '';
+
+ str = String(str); length = ~~length;
+ pruneStr = pruneStr != null ? String(pruneStr) : '...';
+
+ if (str.length <= length) return str;
+
+ var tmpl = function(c){ return c.toUpperCase() !== c.toLowerCase() ? 'A' : ' '; },
+ template = str.slice(0, length+1).replace(/.(?=\W*\w*$)/g, tmpl); // 'Hello, world' -> 'HellAA AAAAA'
+
+ if (template.slice(template.length-2).match(/\w\w/))
+ template = template.replace(/\s*\S+$/, '');
+ else
+ template = _s.rtrim(template.slice(0, template.length-1));
+
+ return (template+pruneStr).length > str.length ? str : str.slice(0, template.length)+pruneStr;
+ },
+
+ words: function(str, delimiter) {
+ if (_s.isBlank(str)) return [];
+ return _s.trim(str, delimiter).split(delimiter || /\s+/);
+ },
+
+ pad: function(str, length, padStr, type) {
+ str = str == null ? '' : String(str);
+ length = ~~length;
+
+ var padlen = 0;
+
+ if (!padStr)
+ padStr = ' ';
+ else if (padStr.length > 1)
+ padStr = padStr.charAt(0);
+
+ switch(type) {
+ case 'right':
+ padlen = length - str.length;
+ return str + strRepeat(padStr, padlen);
+ case 'both':
+ padlen = length - str.length;
+ return strRepeat(padStr, Math.ceil(padlen/2)) + str
+ + strRepeat(padStr, Math.floor(padlen/2));
+ default: // 'left'
+ padlen = length - str.length;
+ return strRepeat(padStr, padlen) + str;
+ }
+ },
+
+ lpad: function(str, length, padStr) {
+ return _s.pad(str, length, padStr);
+ },
+
+ rpad: function(str, length, padStr) {
+ return _s.pad(str, length, padStr, 'right');
+ },
+
+ lrpad: function(str, length, padStr) {
+ return _s.pad(str, length, padStr, 'both');
+ },
+
+ sprintf: sprintf,
+
+ vsprintf: function(fmt, argv){
+ argv.unshift(fmt);
+ return sprintf.apply(null, argv);
+ },
+
+ toNumber: function(str, decimals) {
+ if (!str) return 0;
+ str = _s.trim(str);
+ if (!str.match(/^-?\d+(?:\.\d+)?$/)) return NaN;
+ return parseNumber(parseNumber(str).toFixed(~~decimals));
+ },
+
+ numberFormat : function(number, dec, dsep, tsep) {
+ if (isNaN(number) || number == null) return '';
+
+ number = number.toFixed(~~dec);
+ tsep = typeof tsep == 'string' ? tsep : ',';
+
+ var parts = number.split('.'), fnums = parts[0],
+ decimals = parts[1] ? (dsep || '.') + parts[1] : '';
+
+ return fnums.replace(/(\d)(?=(?:\d{3})+$)/g, '$1' + tsep) + decimals;
+ },
+
+ strRight: function(str, sep){
+ if (str == null) return '';
+ str = String(str); sep = sep != null ? String(sep) : sep;
+ var pos = !sep ? -1 : str.indexOf(sep);
+ return ~pos ? str.slice(pos+sep.length, str.length) : str;
+ },
+
+ strRightBack: function(str, sep){
+ if (str == null) return '';
+ str = String(str); sep = sep != null ? String(sep) : sep;
+ var pos = !sep ? -1 : str.lastIndexOf(sep);
+ return ~pos ? str.slice(pos+sep.length, str.length) : str;
+ },
+
+ strLeft: function(str, sep){
+ if (str == null) return '';
+ str = String(str); sep = sep != null ? String(sep) : sep;
+ var pos = !sep ? -1 : str.indexOf(sep);
+ return ~pos ? str.slice(0, pos) : str;
+ },
+
+ strLeftBack: function(str, sep){
+ if (str == null) return '';
+ str += ''; sep = sep != null ? ''+sep : sep;
+ var pos = str.lastIndexOf(sep);
+ return ~pos ? str.slice(0, pos) : str;
+ },
+
+ toSentence: function(array, separator, lastSeparator, serial) {
+ separator = separator || ', ';
+ lastSeparator = lastSeparator || ' and ';
+ var a = array.slice(), lastMember = a.pop();
+
+ if (array.length > 2 && serial) lastSeparator = _s.rtrim(separator) + lastSeparator;
+
+ return a.length ? a.join(separator) + lastSeparator + lastMember : lastMember;
+ },
+
+ toSentenceSerial: function() {
+ var args = slice.call(arguments);
+ args[3] = true;
+ return _s.toSentence.apply(_s, args);
+ },
+
+ slugify: function(str) {
+ if (str == null) return '';
+
+ var from = "ąà áäâãåæăćęèéëêìÃïîłńòóöôõøśșțùúüûñçżź",
+ to = "aaaaaaaaaceeeeeiiiilnoooooosstuuuunczz",
+ regex = new RegExp(defaultToWhiteSpace(from), 'g');
+
+ str = String(str).toLowerCase().replace(regex, function(c){
+ var index = from.indexOf(c);
+ return to.charAt(index) || '-';
+ });
+
+ return _s.dasherize(str.replace(/[^\w\s-]/g, ''));
+ },
+
+ surround: function(str, wrapper) {
+ return [wrapper, str, wrapper].join('');
+ },
+
+ quote: function(str, quoteChar) {
+ return _s.surround(str, quoteChar || '"');
+ },
+
+ unquote: function(str, quoteChar) {
+ quoteChar = quoteChar || '"';
+ if (str[0] === quoteChar && str[str.length-1] === quoteChar)
+ return str.slice(1,str.length-1);
+ else return str;
+ },
+
+ exports: function() {
+ var result = {};
+
+ for (var prop in this) {
+ if (!this.hasOwnProperty(prop) || prop.match(/^(?:include|contains|reverse)$/)) continue;
+ result[prop] = this[prop];
+ }
+
+ return result;
+ },
+
+ repeat: function(str, qty, separator){
+ if (str == null) return '';
+
+ qty = ~~qty;
+
+ // using faster implementation if separator is not needed;
+ if (separator == null) return strRepeat(String(str), qty);
+
+ // this one is about 300x slower in Google Chrome
+ for (var repeat = []; qty > 0; repeat[--qty] = str) {}
+ return repeat.join(separator);
+ },
+
+ naturalCmp: function(str1, str2){
+ if (str1 == str2) return 0;
+ if (!str1) return -1;
+ if (!str2) return 1;
+
+ var cmpRegex = /(\.\d+)|(\d+)|(\D+)/g,
+ tokens1 = String(str1).toLowerCase().match(cmpRegex),
+ tokens2 = String(str2).toLowerCase().match(cmpRegex),
+ count = Math.min(tokens1.length, tokens2.length);
+
+ for(var i = 0; i < count; i++) {
+ var a = tokens1[i], b = tokens2[i];
+
+ if (a !== b){
+ var num1 = parseInt(a, 10);
+ if (!isNaN(num1)){
+ var num2 = parseInt(b, 10);
+ if (!isNaN(num2) && num1 - num2)
+ return num1 - num2;
+ }
+ return a < b ? -1 : 1;
+ }
+ }
+
+ if (tokens1.length === tokens2.length)
+ return tokens1.length - tokens2.length;
+
+ return str1 < str2 ? -1 : 1;
+ },
+
+ levenshtein: function(str1, str2) {
+ if (str1 == null && str2 == null) return 0;
+ if (str1 == null) return String(str2).length;
+ if (str2 == null) return String(str1).length;
+
+ str1 = String(str1); str2 = String(str2);
+
+ var current = [], prev, value;
+
+ for (var i = 0; i <= str2.length; i++)
+ for (var j = 0; j <= str1.length; j++) {
+ if (i && j)
+ if (str1.charAt(j - 1) === str2.charAt(i - 1))
+ value = prev;
+ else
+ value = Math.min(current[j], current[j - 1], prev) + 1;
+ else
+ value = i + j;
+
+ prev = current[j];
+ current[j] = value;
+ }
+
+ return current.pop();
+ },
+
+ toBoolean: function(str, trueValues, falseValues) {
+ if (typeof str === "number") str = "" + str;
+ if (typeof str !== "string") return !!str;
+ str = _s.trim(str);
+ if (boolMatch(str, trueValues || ["true", "1"])) return true;
+ if (boolMatch(str, falseValues || ["false", "0"])) return false;
+ }
+ };
+
+ // Aliases
+
+ _s.strip = _s.trim;
+ _s.lstrip = _s.ltrim;
+ _s.rstrip = _s.rtrim;
+ _s.center = _s.lrpad;
+ _s.rjust = _s.lpad;
+ _s.ljust = _s.rpad;
+ _s.contains = _s.include;
+ _s.q = _s.quote;
+ _s.toBool = _s.toBoolean;
+
+ // Exporting
+
+ // CommonJS module is defined
+ if (typeof exports !== 'undefined') {
+ if (typeof module !== 'undefined' && module.exports)
+ module.exports = _s;
+
+ exports._s = _s;
+ }
+
+ // Register as a named module with AMD.
+ if (typeof define === 'function' && define.amd)
+ define('underscore.string', [], function(){ return _s; });
+
+
+ // Integrate with Underscore.js if defined
+ // or create our own underscore object.
+ root._ = root._ || {};
+ root._.string = root._.str = _s;
+}(this, String);
+
+},{}],13:[function(_dereq_,module,exports){
+module.exports={
+ "name": "quilljs",
+ "version": "0.15.3",
+ "description": "Cross browser rich text editor",
+ "author": "Jason Chen ",
+ "homepage": "http://quilljs.com",
+ "contributors": [
+ "Byron Milligan ",
+ "Keegan Poppen "
+ ],
+ "main": "index.js",
+ "dependencies": {
+ "eventemitter2": "~0.4.13",
+ "lodash": "~2.4.1",
+ "tandem-core": "~0.6.2",
+ "underscore.string": "~2.3.3"
+ },
+ "devDependencies": {
+ "coffee-script": "~1.7.1",
+ "coffeeify": "~0.6.0",
+ "connect": "~3.0.1",
+ "grunt": "~0.4.3",
+ "grunt-browserify": "~2.1.0",
+ "grunt-contrib-clean": "~0.5.0",
+ "grunt-contrib-coffee": "~0.10.1",
+ "grunt-contrib-compress": "~0.9.1",
+ "grunt-contrib-concat": "~0.4.0",
+ "grunt-contrib-copy": "~0.5.0",
+ "grunt-contrib-stylus": "~0.18.0",
+ "grunt-contrib-uglify": "~0.4.0",
+ "grunt-karma": "~0.8.0",
+ "grunt-lodash": "~0.3.0",
+ "grunt-protractor-runner": "~0.2.4",
+ "grunt-shell": "~0.7.0",
+ "harp": "~0.12.1",
+ "istanbul": "~0.2.6",
+ "jquery": "~2.1.1",
+ "karma": "~0.12.0",
+ "karma-chrome-launcher": "~0.1.2",
+ "karma-coffee-preprocessor": "~0.2.1",
+ "karma-coverage": "~0.2.0",
+ "karma-firefox-launcher": "~0.1.3",
+ "karma-html2js-preprocessor": "~0.1.0",
+ "karma-jasmine": "~0.2.0",
+ "karma-phantomjs-launcher": "~0.1.2",
+ "karma-safari-launcher": "~0.1.1",
+ "karma-sauce-launcher": "~0.2.2",
+ "load-grunt-tasks": "~0.4.0",
+ "protractor": "~0.23.0",
+ "stylus": "~0.47.1",
+ "watchify": "~0.10.2"
+ },
+ "engines": {
+ "node": ">=0.10"
+ },
+ "license": "BSD-3-Clause",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/quilljs/quill"
+ },
+ "bugs": {
+ "url": "https://github.com/quilljs/quill/issues"
+ },
+ "scripts": {
+ "prepublish": "grunt coffee:src",
+ "postpublish": "grunt clean:coffee",
+ "test": "grunt test"
+ },
+ "keywords": [
+ "editor",
+ "rich text",
+ "wysiwyg"
+ ]
+}
+
+},{}],14:[function(_dereq_,module,exports){
+var DOM, Document, Format, Line, LinkedList, Normalizer, Tandem, Utils, _;
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('./dom');
+
+Format = _dereq_('./format');
+
+Line = _dereq_('./line');
+
+LinkedList = _dereq_('./lib/linked-list');
+
+Normalizer = _dereq_('./normalizer');
+
+Utils = _dereq_('./utils');
+
+Tandem = _dereq_('tandem-core');
+
+Document = (function() {
+ function Document(root, options) {
+ this.root = root;
+ if (options == null) {
+ options = {};
+ }
+ this.formats = {};
+ _.each(options.formats, _.bind(this.addFormat, this));
+ this.setHTML(this.root.innerHTML);
+ }
+
+ Document.prototype.addFormat = function(name, config) {
+ if (!_.isObject(config)) {
+ config = Format.FORMATS[name];
+ }
+ if (this.formats[name] != null) {
+ console.warn('Overwriting format', name, this.formats[name]);
+ }
+ return this.formats[name] = new Format(this.root.ownerDocument, config);
+ };
+
+ Document.prototype.appendLine = function(lineNode) {
+ return this.insertLineBefore(lineNode, null);
+ };
+
+ Document.prototype.findLeafAt = function(index, inclusive) {
+ var line, offset, _ref;
+ _ref = this.findLineAt(index), line = _ref[0], offset = _ref[1];
+ if (line != null) {
+ return line.findLeafAt(offset, inclusive);
+ } else {
+ return [null, offset];
+ }
+ };
+
+ Document.prototype.findLine = function(node) {
+ var line;
+ while ((node != null) && (DOM.BLOCK_TAGS[node.tagName] == null)) {
+ node = node.parentNode;
+ }
+ line = node != null ? this.lineMap[node.id] : null;
+ if ((line != null ? line.node : void 0) === node) {
+ return line;
+ } else {
+ return null;
+ }
+ };
+
+ Document.prototype.findLineAt = function(index) {
+ var curLine, length;
+ if (!(this.lines.length > 0)) {
+ return [null, index];
+ }
+ length = this.toDelta().endLength;
+ if (index === length) {
+ return [this.lines.last, this.lines.last.length];
+ }
+ if (index > length) {
+ return [null, index - length];
+ }
+ curLine = this.lines.first;
+ while (curLine != null) {
+ if (index < curLine.length) {
+ return [curLine, index];
+ }
+ index -= curLine.length;
+ curLine = curLine.next;
+ }
+ return [null, index];
+ };
+
+ Document.prototype.insertLineBefore = function(newLineNode, refLine) {
+ var line;
+ line = new Line(this, newLineNode);
+ if (refLine != null) {
+ if (!DOM.isElement(newLineNode.parentNode)) {
+ this.root.insertBefore(newLineNode, refLine.node);
+ }
+ this.lines.insertAfter(refLine.prev, line);
+ } else {
+ if (!DOM.isElement(newLineNode.parentNode)) {
+ this.root.appendChild(newLineNode);
+ }
+ this.lines.append(line);
+ }
+ this.lineMap[line.id] = line;
+ return line;
+ };
+
+ Document.prototype.mergeLines = function(line, lineToMerge) {
+ if (lineToMerge.length > 1) {
+ if (line.length === 1) {
+ DOM.removeNode(line.leaves.last.node);
+ }
+ _.each(DOM.getChildNodes(lineToMerge.node), function(child) {
+ if (child.tagName !== DOM.DEFAULT_BREAK_TAG) {
+ return line.node.appendChild(child);
+ }
+ });
+ }
+ this.removeLine(lineToMerge);
+ return line.rebuild();
+ };
+
+ Document.prototype.optimizeLines = function() {
+ return _.each(this.lines.toArray(), function(line, i) {
+ line.optimize();
+ return true;
+ });
+ };
+
+ Document.prototype.rebuild = function() {
+ var lineNode, lines, _results;
+ lines = this.lines.toArray();
+ lineNode = this.root.firstChild;
+ if ((lineNode != null) && (DOM.LIST_TAGS[lineNode.tagName] != null)) {
+ lineNode = lineNode.firstChild;
+ }
+ _.each(lines, (function(_this) {
+ return function(line, index) {
+ var newLine, _ref;
+ while (line.node !== lineNode) {
+ if (line.node.parentNode === _this.root || ((_ref = line.node.parentNode) != null ? _ref.parentNode : void 0) === _this.root) {
+ lineNode = Normalizer.normalizeLine(lineNode);
+ newLine = _this.insertLineBefore(lineNode, line);
+ lineNode = Utils.getNextLineNode(lineNode, _this.root);
+ } else {
+ return _this.removeLine(line);
+ }
+ }
+ if (line.outerHTML !== lineNode.outerHTML) {
+ line.node = Normalizer.normalizeLine(line.node);
+ line.rebuild();
+ }
+ return lineNode = Utils.getNextLineNode(lineNode, _this.root);
+ };
+ })(this));
+ _results = [];
+ while (lineNode != null) {
+ lineNode = Normalizer.normalizeLine(lineNode);
+ this.appendLine(lineNode);
+ _results.push(lineNode = Utils.getNextLineNode(lineNode, this.root));
+ }
+ return _results;
+ };
+
+ Document.prototype.removeLine = function(line) {
+ if (line.node.parentNode != null) {
+ if (DOM.LIST_TAGS[line.node.parentNode.tagName] && line.node.parentNode.childNodes.length === 1) {
+ DOM.removeNode(line.node.parentNode);
+ } else {
+ DOM.removeNode(line.node);
+ }
+ }
+ delete this.lineMap[line.id];
+ return this.lines.remove(line);
+ };
+
+ Document.prototype.setHTML = function(html) {
+ html = Normalizer.stripComments(html);
+ html = Normalizer.stripWhitespace(html);
+ this.root.innerHTML = html;
+ this.lines = new LinkedList();
+ this.lineMap = {};
+ return this.rebuild();
+ };
+
+ Document.prototype.splitLine = function(line, offset) {
+ var lineNode1, lineNode2, newLine, _ref;
+ offset = Math.min(offset, line.length - 1);
+ _ref = Utils.splitNode(line.node, offset, true), lineNode1 = _ref[0], lineNode2 = _ref[1];
+ line.node = lineNode1;
+ line.rebuild();
+ newLine = this.insertLineBefore(lineNode2, line.next);
+ newLine.formats = _.clone(line.formats);
+ newLine.resetContent();
+ return newLine;
+ };
+
+ Document.prototype.toDelta = function() {
+ var lines, ops;
+ lines = this.lines.toArray();
+ ops = _.flatten(_.map(lines, function(line) {
+ return _.clone(line.delta.ops);
+ }), true);
+ return new Tandem.Delta(0, ops);
+ };
+
+ return Document;
+
+})();
+
+module.exports = Document;
+
+
+},{"./dom":15,"./format":17,"./lib/linked-list":20,"./line":23,"./normalizer":33,"./utils":39,"lodash":"M4+//f","tandem-core":10}],15:[function(_dereq_,module,exports){
+var DOM, lastKeyEvent, _;
+
+_ = _dereq_('lodash');
+
+_.str = _dereq_('underscore.string');
+
+lastKeyEvent = null;
+
+DOM = {
+ ELEMENT_NODE: 1,
+ NOBREAK_SPACE: " ",
+ TEXT_NODE: 3,
+ ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF",
+ DEFAULT_BLOCK_TAG: 'P',
+ DEFAULT_BREAK_TAG: 'BR',
+ DEFAULT_INLINE_TAG: 'SPAN',
+ EMBED_TEXT: '!',
+ FONT_SIZES: {
+ '10px': 1,
+ '13px': 2,
+ '16px': 3,
+ '18px': 4,
+ '24px': 5,
+ '32px': 6,
+ '48px': 7
+ },
+ KEYS: {
+ BACKSPACE: 8,
+ TAB: 9,
+ ENTER: 13,
+ ESCAPE: 27,
+ LEFT: 37,
+ UP: 38,
+ RIGHT: 39,
+ DOWN: 40,
+ DELETE: 46
+ },
+ BLOCK_TAGS: {
+ 'ADDRESS': 'ADDRESS',
+ 'ARTICLE': 'ARTICLE',
+ 'ASIDE': 'ASIDE',
+ 'AUDIO': 'AUDIO',
+ 'BLOCKQUOTE': 'BLOCKQUOTE',
+ 'CANVAS': 'CANVAS',
+ 'DD': 'DD',
+ 'DIV': 'DIV',
+ 'DL': 'DL',
+ 'FIGCAPTION': 'FIGCAPTION',
+ 'FIGURE': 'FIGURE',
+ 'FOOTER': 'FOOTER',
+ 'FORM': 'FORM',
+ 'H1': 'H1',
+ 'H2': 'H2',
+ 'H3': 'H3',
+ 'H4': 'H4',
+ 'H5': 'H5',
+ 'H6': 'H6',
+ 'HEADER': 'HEADER',
+ 'HGROUP': 'HGROUP',
+ 'LI': 'LI',
+ 'OL': 'OL',
+ 'OUTPUT': 'OUTPUT',
+ 'P': 'P',
+ 'PRE': 'PRE',
+ 'SECTION': 'SECTION',
+ 'TABLE': 'TABLE',
+ 'TBODY': 'TBODY',
+ 'TD': 'TD',
+ 'TFOOT': 'TFOOT',
+ 'TH': 'TH',
+ 'THEAD': 'THEAD',
+ 'TR': 'TR',
+ 'UL': 'UL',
+ 'VIDEO': 'VIDEO'
+ },
+ EMBED_TAGS: {
+ 'IMG': 'IMG'
+ },
+ LIST_TAGS: {
+ 'OL': 'OL',
+ 'UL': 'UL'
+ },
+ VOID_TAGS: {
+ 'AREA': 'AREA',
+ 'BASE': 'BASE',
+ 'BR': 'BR',
+ 'COL': 'COL',
+ 'COMMAND': 'COMMAND',
+ 'EMBED': 'EMBED',
+ 'HR': 'HR',
+ 'IMG': 'IMG',
+ 'INPUT': 'INPUT',
+ 'KEYGEN': 'KEYGEN',
+ 'LINK': 'LINK',
+ 'META': 'META',
+ 'PARAM': 'PARAM',
+ 'SOURCE': 'SOURCE',
+ 'TRACK': 'TRACK',
+ 'WBR': 'WBR'
+ },
+ addClass: function(node, cssClass) {
+ if (DOM.hasClass(node, cssClass)) {
+ return;
+ }
+ if (node.classList != null) {
+ return node.classList.add(cssClass);
+ } else if (node.className != null) {
+ return node.className = _.str.trim(node.className + ' ' + cssClass);
+ }
+ },
+ addEventListener: function(node, eventName, listener) {
+ return node.addEventListener(eventName, function(event) {
+ var arg, propogate;
+ arg = lastKeyEvent && (eventName === 'keydown' || eventName === 'keyup') ? lastKeyEvent : event;
+ propogate = listener(arg);
+ if (!propogate) {
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ return propogate;
+ });
+ },
+ addStyles: function(node, styles) {
+ styles = _.defaults(styles, DOM.getStyles(node));
+ return DOM.setStyles(node, styles);
+ },
+ clearAttributes: function(node, exception) {
+ if (exception == null) {
+ exception = [];
+ }
+ if (_.isString(exception)) {
+ exception = [exception];
+ }
+ return _.each(DOM.getAttributes(node), function(value, name) {
+ if (!(_.indexOf(exception, name) > -1)) {
+ return node.removeAttribute(name);
+ }
+ });
+ },
+ getAttributes: function(node) {
+ var attr, attributes, i, value, _i, _len, _ref;
+ if (node.attributes == null) {
+ return {};
+ }
+ attributes = {};
+ _ref = node.attributes;
+ for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
+ value = _ref[i];
+ attr = node.attributes[i];
+ attributes[attr.name] = attr.value;
+ }
+ return attributes;
+ },
+ getChildNodes: function(parent) {
+ return _.map(parent.childNodes);
+ },
+ getChildren: function(parent) {
+ return _.map(parent.children);
+ },
+ getDescendants: function(parent) {
+ return _.map(parent.getElementsByTagName('*'));
+ },
+ getClasses: function(node) {
+ return node.className.split(/\s+/);
+ },
+ getDefaultOption: function(select) {
+ return select.querySelector('option[selected]');
+ },
+ getSelectValue: function(select) {
+ if (select.selectedIndex > -1) {
+ return select.options[select.selectedIndex].value;
+ } else {
+ return '';
+ }
+ },
+ getStyles: function(node) {
+ var obj, styleString;
+ styleString = node.getAttribute('style') || '';
+ obj = _.reduce(styleString.split(';'), function(styles, str) {
+ var name, value, _ref;
+ _ref = str.split(':'), name = _ref[0], value = _ref[1];
+ if (name && value) {
+ name = _.str.trim(name);
+ value = _.str.trim(value);
+ styles[name.toLowerCase()] = value;
+ }
+ return styles;
+ }, {});
+ return obj;
+ },
+ getText: function(node) {
+ switch (node.nodeType) {
+ case DOM.ELEMENT_NODE:
+ if (node.tagName === DOM.DEFAULT_BREAK_TAG) {
+ return "";
+ }
+ if (DOM.EMBED_TAGS[node.tagName] != null) {
+ return DOM.EMBED_TEXT;
+ }
+ if (node.textContent != null) {
+ return node.textContent;
+ }
+ return "";
+ case DOM.TEXT_NODE:
+ return node.data || "";
+ default:
+ return "";
+ }
+ },
+ getTextNodes: function(root) {
+ var node, nodes, walker;
+ walker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_TEXT, null, false);
+ nodes = [];
+ while (node = walker.nextNode()) {
+ nodes.push(node);
+ }
+ return nodes;
+ },
+ getWindow: function(node) {
+ return node.ownerDocument.defaultView || node.ownerDocument.parentWindow;
+ },
+ hasClass: function(node, cssClass) {
+ if (node.classList != null) {
+ return node.classList.contains(cssClass);
+ } else if (node.className != null) {
+ return _.indexOf(DOM.getClasses(node), cssClass) > -1;
+ }
+ return false;
+ },
+ isElement: function(node) {
+ return (node != null ? node.nodeType : void 0) === DOM.ELEMENT_NODE;
+ },
+ isTextNode: function(node) {
+ return (node != null ? node.nodeType : void 0) === DOM.TEXT_NODE;
+ },
+ moveChildren: function(newParent, oldParent) {
+ return _.each(DOM.getChildNodes(oldParent), function(child) {
+ return newParent.appendChild(child);
+ });
+ },
+ normalize: function(node) {
+ var curNode, newText, nextNode, _results;
+ curNode = node.firstChild;
+ _results = [];
+ while (curNode != null) {
+ nextNode = curNode.nextSibling;
+ if (DOM.isTextNode(curNode)) {
+ if (DOM.getText(curNode).length === 0) {
+ DOM.removeNode(curNode);
+ } else if (DOM.isTextNode(nextNode)) {
+ nextNode = nextNode.nextSibling;
+ newText = DOM.getText(curNode) + DOM.getText(curNode.nextSibling);
+ DOM.setText(curNode, newText);
+ DOM.removeNode(curNode.nextSibling);
+ }
+ }
+ _results.push(curNode = nextNode);
+ }
+ return _results;
+ },
+ isIE: function(maxVersion) {
+ var version;
+ version = document.documentMode;
+ return version && maxVersion >= version;
+ },
+ isIOS: function() {
+ return /iPhone|iPad/i.test(navigator.userAgent);
+ },
+ removeClass: function(node, cssClass) {
+ var classArray;
+ if (!DOM.hasClass(node, cssClass)) {
+ return;
+ }
+ if (node.classList != null) {
+ return node.classList.remove(cssClass);
+ } else if (node.className != null) {
+ classArray = DOM.getClasses(node);
+ classArray.splice(_.indexOf(classArray, cssClass), 1);
+ return node.className = classArray.join(' ');
+ }
+ },
+ removeNode: function(node) {
+ var _ref;
+ return (_ref = node.parentNode) != null ? _ref.removeChild(node) : void 0;
+ },
+ replaceNode: function(newNode, oldNode) {
+ oldNode.parentNode.replaceChild(newNode, oldNode);
+ return newNode;
+ },
+ resetSelect: function(select, trigger) {
+ var option;
+ if (trigger == null) {
+ trigger = true;
+ }
+ option = DOM.getDefaultOption(select);
+ if (option != null) {
+ option.selected = true;
+ } else {
+ select.selectedIndex = 0;
+ }
+ if (trigger) {
+ return DOM.triggerEvent(select, 'change');
+ }
+ },
+ selectOption: function(select, option, trigger) {
+ var value;
+ if (trigger == null) {
+ trigger = true;
+ }
+ value = _.isElement(option) ? option.value : option;
+ if (value) {
+ select.value = value;
+ } else {
+ select.selectedIndex = -1;
+ }
+ if (trigger) {
+ return DOM.triggerEvent(select, 'change');
+ }
+ },
+ setAttributes: function(node, attributes) {
+ return _.each(attributes, function(value, name) {
+ return node.setAttribute(name, value);
+ });
+ },
+ setStyles: function(node, styles) {
+ var styleString;
+ styleString = _.map(styles, function(style, name) {
+ return "" + name + ": " + style;
+ }).join('; ') + ';';
+ return node.setAttribute('style', styleString);
+ },
+ setText: function(node, text) {
+ switch (node.nodeType) {
+ case DOM.ELEMENT_NODE:
+ return node.textContent = text;
+ case DOM.TEXT_NODE:
+ return node.data = text;
+ }
+ },
+ switchTag: function(node, newTag) {
+ var attributes, newNode;
+ newTag = newTag.toUpperCase();
+ if (node.tagName === newTag) {
+ return node;
+ }
+ newNode = node.ownerDocument.createElement(newTag);
+ attributes = DOM.getAttributes(node);
+ if (DOM.VOID_TAGS[newTag] == null) {
+ this.moveChildren(newNode, node);
+ }
+ node.parentNode.replaceChild(newNode, node);
+ _.each(attributes, function(value, name) {
+ return newNode.setAttribute(name, value);
+ });
+ return newNode;
+ },
+ toggleClass: function(node, className, state) {
+ if (state == null) {
+ state = !DOM.hasClass(node, className);
+ }
+ if (state) {
+ return DOM.addClass(node, className);
+ } else {
+ return DOM.removeClass(node, className);
+ }
+ },
+ triggerEvent: function(elem, eventName, options) {
+ var event, initFn, modifiers;
+ if (options == null) {
+ options = {};
+ }
+ if (_.indexOf(['keypress', 'keydown', 'keyup'], eventName) < 0) {
+ event = elem.ownerDocument.createEvent('Event');
+ event.initEvent(eventName, options.bubbles, options.cancelable);
+ } else {
+ event = elem.ownerDocument.createEvent('KeyboardEvent');
+ lastKeyEvent = _.clone(options);
+ if (_.isNumber(options.key)) {
+ lastKeyEvent.which = options.key;
+ } else if (_.isString(options.key)) {
+ lastKeyEvent.which = options.key.toUpperCase().charCodeAt(0);
+ } else {
+ lastKeyEvent.which = 0;
+ }
+ if (DOM.isIE(10)) {
+ modifiers = [];
+ if (options.altKey) {
+ modifiers.push('Alt');
+ }
+ if (options.ctrlKey) {
+ modifiers.push('Control');
+ }
+ if (options.metaKey) {
+ modifiers.push('Meta');
+ }
+ if (options.shiftKey) {
+ modifiers.push('Shift');
+ }
+ event.initKeyboardEvent(eventName, options.bubbles, options.cancelable, elem.ownerDocument.defaultView.window, 0, 0, modifiers.join(' '), null, null);
+ } else {
+ initFn = _.isFunction(event.initKeyboardEvent) ? 'initKeyboardEvent' : 'initKeyEvent';
+ event[initFn](eventName, options.bubbles, options.cancelable, elem.ownerDocument.defaultView.window, options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, 0, 0);
+ }
+ }
+ elem.dispatchEvent(event);
+ return lastKeyEvent = null;
+ },
+ unwrap: function(node) {
+ var next, ret;
+ ret = node.firstChild;
+ next = node.nextSibling;
+ _.each(DOM.getChildNodes(node), function(child) {
+ return node.parentNode.insertBefore(child, next);
+ });
+ DOM.removeNode(node);
+ return ret;
+ },
+ wrap: function(wrapper, node) {
+ var parent;
+ if (node.parentNode != null) {
+ node.parentNode.insertBefore(wrapper, node);
+ }
+ parent = wrapper;
+ while (parent.firstChild != null) {
+ parent = wrapper.firstChild;
+ }
+ parent.appendChild(node);
+ return parent;
+ }
+};
+
+module.exports = DOM;
+
+
+},{"lodash":"M4+//f","underscore.string":12}],16:[function(_dereq_,module,exports){
+var DOM, Document, Editor, Line, Renderer, Selection, Tandem, _;
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('./dom');
+
+Document = _dereq_('./document');
+
+Line = _dereq_('./line');
+
+Renderer = _dereq_('./renderer');
+
+Selection = _dereq_('./selection');
+
+Tandem = _dereq_('tandem-core');
+
+Editor = (function() {
+ function Editor(iframeContainer, quill, options) {
+ this.iframeContainer = iframeContainer;
+ this.quill = quill;
+ this.options = options != null ? options : {};
+ this.renderer = new Renderer(this.iframeContainer, this.options);
+ this.root = this.renderer.root;
+ this.doc = new Document(this.root, this.options);
+ this.delta = this.doc.toDelta();
+ this.selection = new Selection(this.doc, this.renderer.iframe, this.quill);
+ this.timer = setInterval(_.bind(this.checkUpdate, this), this.options.pollInterval);
+ this.quill.on(this.quill.constructor.events.SELECTION_CHANGE, (function(_this) {
+ return function(range) {
+ return _this.savedRange = range;
+ };
+ })(this));
+ if (!this.options.readOnly) {
+ this.enable();
+ }
+ }
+
+ Editor.prototype.disable = function() {
+ return this.enable(false);
+ };
+
+ Editor.prototype.enable = function(enabled) {
+ if (enabled == null) {
+ enabled = true;
+ }
+ return this.root.setAttribute('contenteditable', enabled);
+ };
+
+ Editor.prototype.applyDelta = function(delta, source) {
+ var localDelta, tempDelta;
+ localDelta = this._update();
+ if (localDelta) {
+ tempDelta = localDelta;
+ localDelta = localDelta.transform(delta, true);
+ delta = delta.transform(tempDelta, false);
+ this.delta = this.doc.toDelta();
+ }
+ if (!delta.isIdentity()) {
+ if (delta.startLength !== this.delta.endLength) {
+ console.warn("Trying to apply delta to incorrect doc length", delta, this.delta);
+ }
+ delta = this._trackDelta((function(_this) {
+ return function() {
+ delta.apply(_this._insertAt, _this._deleteAt, _this._formatAt, _this);
+ return _this.selection.shiftAfter(0, 0, _.bind(_this.doc.optimizeLines, _this.doc));
+ };
+ })(this));
+ this.delta = this.doc.toDelta();
+ this.innerHTML = this.root.innerHTML;
+ if (delta && source !== 'silent') {
+ this.quill.emit(this.quill.constructor.events.TEXT_CHANGE, delta, source);
+ }
+ }
+ if (localDelta && !localDelta.isIdentity() && source !== 'silent') {
+ return this.quill.emit(this.quill.constructor.events.TEXT_CHANGE, localDelta, 'user');
+ }
+ };
+
+ Editor.prototype.checkUpdate = function(source) {
+ var delta, oldDelta;
+ if (source == null) {
+ source = 'user';
+ }
+ if ((this.renderer.iframe.parentNode == null) || (this.root.parentNode == null)) {
+ return clearInterval(this.timer);
+ }
+ delta = this._update();
+ if (delta) {
+ oldDelta = this.delta;
+ this.delta = oldDelta.compose(delta);
+ this.quill.emit(this.quill.constructor.events.TEXT_CHANGE, delta, source);
+ }
+ if (delta) {
+ source = 'silent';
+ }
+ return this.selection.update(source);
+ };
+
+ Editor.prototype.getDelta = function() {
+ return this.delta;
+ };
+
+ Editor.prototype._deleteAt = function(index, length) {
+ if (length <= 0) {
+ return;
+ }
+ return this.selection.shiftAfter(index, -1 * length, (function(_this) {
+ return function() {
+ var curLine, deleteLength, firstLine, mergeFirstLine, nextLine, offset, _ref;
+ _ref = _this.doc.findLineAt(index), firstLine = _ref[0], offset = _ref[1];
+ curLine = firstLine;
+ mergeFirstLine = firstLine.length - offset <= length && offset > 0;
+ while ((curLine != null) && length > 0) {
+ nextLine = curLine.next;
+ deleteLength = Math.min(curLine.length - offset, length);
+ if (offset === 0 && length >= curLine.length) {
+ _this.doc.removeLine(curLine);
+ } else {
+ curLine.deleteText(offset, deleteLength);
+ }
+ length -= deleteLength;
+ curLine = nextLine;
+ offset = 0;
+ }
+ if (mergeFirstLine && firstLine.next) {
+ return _this.doc.mergeLines(firstLine, firstLine.next);
+ }
+ };
+ })(this));
+ };
+
+ Editor.prototype._formatAt = function(index, length, name, value) {
+ return this.selection.shiftAfter(index, 0, (function(_this) {
+ return function() {
+ var formatLength, line, offset, _ref, _results;
+ _ref = _this.doc.findLineAt(index), line = _ref[0], offset = _ref[1];
+ _results = [];
+ while ((line != null) && length > 0) {
+ formatLength = Math.min(length, line.length - offset - 1);
+ line.formatText(offset, formatLength, name, value);
+ length -= formatLength;
+ if (length > 0) {
+ line.format(name, value);
+ }
+ length -= 1;
+ offset = 0;
+ _results.push(line = line.next);
+ }
+ return _results;
+ };
+ })(this));
+ };
+
+ Editor.prototype._insertAt = function(index, text, formatting) {
+ if (formatting == null) {
+ formatting = {};
+ }
+ return this.selection.shiftAfter(index, text.length, (function(_this) {
+ return function() {
+ var line, lineTexts, offset, _ref;
+ text = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
+ lineTexts = text.split('\n');
+ _ref = _this.doc.findLineAt(index), line = _ref[0], offset = _ref[1];
+ return _.each(lineTexts, function(lineText, i) {
+ var nextLine;
+ if ((line == null) || line.length <= offset) {
+ if (i < lineTexts.length - 1 || lineText.length > 0) {
+ line = _this.doc.appendLine(_this.root.ownerDocument.createElement(DOM.DEFAULT_BLOCK_TAG));
+ offset = 0;
+ line.insertText(offset, lineText, formatting);
+ line.format(formatting);
+ nextLine = null;
+ }
+ } else {
+ line.insertText(offset, lineText, formatting);
+ if (i < lineTexts.length - 1) {
+ nextLine = _this.doc.splitLine(line, offset + lineText.length);
+ _.each(_.defaults({}, formatting, line.formats), function(value, format) {
+ return line.format(format, formatting[format]);
+ });
+ offset = 0;
+ }
+ }
+ return line = nextLine;
+ });
+ };
+ })(this));
+ };
+
+ Editor.prototype._trackDelta = function(fn) {
+ var decompose, decomposeA, decomposeB, decomposeLeft, decomposeRight, ignored, lengthA, lengthB, newDelta, newIndex, newLeftDelta, newRightDelta, oldIndex, oldLeftDelta, oldRightDelta, _ref, _ref1, _ref2, _ref3, _ref4;
+ oldIndex = (_ref = this.savedRange) != null ? _ref.start : void 0;
+ fn();
+ newDelta = this.doc.toDelta();
+ try {
+ newIndex = (_ref1 = this.selection.getRange()) != null ? _ref1.start : void 0;
+ if ((oldIndex != null) && (newIndex != null) && oldIndex <= this.delta.endLength && newIndex <= newDelta.endLength) {
+ _ref2 = this.delta.split(oldIndex), oldLeftDelta = _ref2[0], oldRightDelta = _ref2[1];
+ _ref3 = newDelta.split(newIndex), newLeftDelta = _ref3[0], newRightDelta = _ref3[1];
+ decomposeLeft = newLeftDelta.decompose(oldLeftDelta);
+ decomposeRight = newRightDelta.decompose(oldRightDelta);
+ decomposeA = decomposeLeft.merge(decomposeRight);
+ }
+ } catch (_error) {
+ ignored = _error;
+ }
+ decomposeB = newDelta.decompose(this.delta);
+ if (decomposeA && decomposeB) {
+ _ref4 = _.map([decomposeA, decomposeB], function(delta) {
+ return _.reduce(delta.ops, function(count, op) {
+ if (op.value != null) {
+ count += op.value.length;
+ }
+ return count;
+ }, 0);
+ }), lengthA = _ref4[0], lengthB = _ref4[1];
+ decompose = lengthA < lengthA ? decomposeA : decomposeB;
+ } else {
+ decompose = decomposeA || decomposeB;
+ }
+ return decompose;
+ };
+
+ Editor.prototype._update = function() {
+ var delta;
+ if (this.innerHTML === this.root.innerHTML) {
+ return false;
+ }
+ delta = this._trackDelta((function(_this) {
+ return function() {
+ _this.selection.preserve(_.bind(_this.doc.rebuild, _this.doc));
+ return _this.selection.shiftAfter(0, 0, _.bind(_this.doc.optimizeLines, _this.doc));
+ };
+ })(this));
+ this.innerHTML = this.root.innerHTML;
+ if (delta.isIdentity()) {
+ return false;
+ } else {
+ return delta;
+ }
+ };
+
+ return Editor;
+
+})();
+
+module.exports = Editor;
+
+
+},{"./document":14,"./dom":15,"./line":23,"./renderer":35,"./selection":36,"lodash":"M4+//f","tandem-core":10}],17:[function(_dereq_,module,exports){
+var DOM, Format, Utils, _;
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('./dom');
+
+Utils = _dereq_('./utils');
+
+Format = (function() {
+ Format.types = {
+ LINE: 'line'
+ };
+
+ Format.FORMATS = {
+ bold: {
+ tag: 'B',
+ prepare: 'bold'
+ },
+ italic: {
+ tag: 'I',
+ prepare: 'italic'
+ },
+ underline: {
+ tag: 'U',
+ prepare: 'underline'
+ },
+ strike: {
+ tag: 'S',
+ prepare: 'strikeThrough'
+ },
+ color: {
+ style: 'color',
+ "default": 'rgb(0, 0, 0)',
+ prepare: 'foreColor'
+ },
+ background: {
+ style: 'backgroundColor',
+ "default": 'rgb(255, 255, 255)',
+ prepare: 'backColor'
+ },
+ font: {
+ style: 'fontFamily',
+ "default": "'Helvetica', 'Arial', sans-serif",
+ prepare: 'fontName'
+ },
+ size: {
+ style: 'fontSize',
+ "default": '13px',
+ prepare: function(doc, value) {
+ return doc.execCommand('fontSize', false, Utils.convertFontSize(value));
+ }
+ },
+ link: {
+ tag: 'A',
+ attribute: 'href'
+ },
+ image: {
+ tag: 'IMG',
+ attribute: 'src'
+ },
+ align: {
+ type: Format.types.LINE,
+ style: 'textAlign',
+ "default": 'left'
+ },
+ bullet: {
+ type: Format.types.LINE,
+ exclude: 'list',
+ parentTag: 'UL',
+ tag: 'LI'
+ },
+ list: {
+ type: Format.types.LINE,
+ exclude: 'bullet',
+ parentTag: 'OL',
+ tag: 'LI'
+ }
+ };
+
+ function Format(document, config) {
+ this.document = document;
+ this.config = config;
+ }
+
+ Format.prototype.add = function(node, value) {
+ var formatNode, parentNode, _ref, _ref1;
+ if (!value) {
+ return this.remove(node);
+ }
+ if (this.value(node) === value) {
+ return node;
+ }
+ if (_.isString(this.config.parentTag)) {
+ parentNode = this.document.createElement(this.config.parentTag);
+ DOM.wrap(parentNode, node);
+ if (node.parentNode.tagName === ((_ref = node.parentNode.previousSibling) != null ? _ref.tagName : void 0)) {
+ Utils.mergeNodes(node.parentNode.previousSibling, node.parentNode);
+ }
+ if (node.parentNode.tagName === ((_ref1 = node.parentNode.nextSibling) != null ? _ref1.tagName : void 0)) {
+ Utils.mergeNodes(node.parentNode, node.parentNode.nextSibling);
+ }
+ }
+ if (_.isString(this.config.tag)) {
+ formatNode = this.document.createElement(this.config.tag);
+ if (DOM.VOID_TAGS[formatNode.tagName] != null) {
+ if (node.parentNode != null) {
+ node.parentNode.insertBefore(formatNode, node);
+ }
+ DOM.removeNode(node);
+ node = formatNode;
+ } else if (this.isType(Format.types.LINE)) {
+ node = DOM.switchTag(node, this.config.tag);
+ } else {
+ node = DOM.wrap(formatNode, node);
+ }
+ }
+ if (_.isString(this.config.style) || _.isString(this.config.attribute) || _.isString(this.config["class"])) {
+ if (_.isString(this.config["class"])) {
+ node = this.remove(node);
+ }
+ if (DOM.isTextNode(node)) {
+ node = DOM.wrap(this.document.createElement(DOM.DEFAULT_INLINE_TAG), node);
+ }
+ if (_.isString(this.config.style)) {
+ if (value !== this.config["default"]) {
+ node.style[this.config.style] = value;
+ }
+ }
+ if (_.isString(this.config.attribute)) {
+ node.setAttribute(this.config.attribute, value);
+ }
+ if (_.isString(this.config["class"])) {
+ DOM.addClass(node, this.config["class"] + value);
+ }
+ }
+ return node;
+ };
+
+ Format.prototype.isType = function(type) {
+ return type === this.config.type;
+ };
+
+ Format.prototype.match = function(node) {
+ var c, _i, _len, _ref, _ref1;
+ if (!DOM.isElement(node)) {
+ return false;
+ }
+ if (_.isString(this.config.parentTag) && ((_ref = node.parentNode) != null ? _ref.tagName : void 0) !== this.config.parentTag) {
+ return false;
+ }
+ if (_.isString(this.config.tag) && node.tagName !== this.config.tag) {
+ return false;
+ }
+ if (_.isString(this.config.style) && (!node.style[this.config.style] || node.style[this.config.style] === this.config["default"])) {
+ return false;
+ }
+ if (_.isString(this.config.attribute) && !node.hasAttribute(this.config.attribute)) {
+ return false;
+ }
+ if (_.isString(this.config["class"])) {
+ _ref1 = DOM.getClasses(node);
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+ c = _ref1[_i];
+ if (c.indexOf(this.config["class"]) === 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+ return true;
+ };
+
+ Format.prototype.prepare = function(value) {
+ if (_.isString(this.config.prepare)) {
+ return this.document.execCommand(this.config.prepare, false, value);
+ } else if (_.isFunction(this.config.prepare)) {
+ return this.config.prepare(this.document, value);
+ }
+ };
+
+ Format.prototype.remove = function(node) {
+ var c, _i, _len, _ref;
+ if (!this.match(node)) {
+ return node;
+ }
+ if (_.isString(this.config.style)) {
+ node.style[this.config.style] = '';
+ if (!node.getAttribute('style')) {
+ node.removeAttribute('style');
+ }
+ }
+ if (_.isString(this.config.attribute)) {
+ node.removeAttribute(this.config.attribute);
+ }
+ if (_.isString(this.config["class"])) {
+ _ref = DOM.getClasses(node);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ c = _ref[_i];
+ if (c.indexOf(this.config["class"]) === 0) {
+ DOM.removeClass(node, c);
+ }
+ }
+ if (!node.getAttribute('class')) {
+ node.removeAttribute('class');
+ }
+ }
+ if (_.isString(this.config.tag)) {
+ if (this.isType(Format.types.LINE)) {
+ if (node.previousSibling != null) {
+ Utils.splitAncestors(node, node.parentNode.parentNode);
+ }
+ if (node.nextSibling != null) {
+ Utils.splitAncestors(node.nextSibling, node.parentNode.parentNode);
+ }
+ node = DOM.switchTag(node, DOM.DEFAULT_BLOCK_TAG);
+ } else {
+ node = DOM.switchTag(node, DOM.DEFAULT_INLINE_TAG);
+ if (DOM.EMBED_TAGS[this.config.tag] != null) {
+ DOM.setText(node, DOM.EMBED_TEXT);
+ }
+ }
+ }
+ if (_.isString(this.config.parentTag)) {
+ DOM.unwrap(node.parentNode);
+ }
+ if (node.tagName === DOM.DEFAULT_INLINE_TAG && !node.hasAttributes()) {
+ node = DOM.unwrap(node);
+ }
+ return node;
+ };
+
+ Format.prototype.value = function(node) {
+ var c, _i, _len, _ref;
+ if (!this.match(node)) {
+ return void 0;
+ }
+ if (_.isString(this.config.attribute)) {
+ return node.getAttribute(this.config.attribute) || void 0;
+ } else if (_.isString(this.config.style)) {
+ return node.style[this.config.style] || void 0;
+ } else if (_.isString(this.config["class"])) {
+ _ref = DOM.getClasses(node);
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ c = _ref[_i];
+ if (c.indexOf(this.config["class"]) === 0) {
+ return c.slice(this.config["class"].length);
+ }
+ }
+ } else if (_.isString(this.config.tag)) {
+ return true;
+ }
+ return void 0;
+ };
+
+ return Format;
+
+})();
+
+module.exports = Format;
+
+
+},{"./dom":15,"./utils":39,"lodash":"M4+//f"}],18:[function(_dereq_,module,exports){
+var DOM, Format, Leaf, LinkedList, Utils, _,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('./dom');
+
+Format = _dereq_('./format');
+
+LinkedList = _dereq_('./lib/linked-list');
+
+Utils = _dereq_('./utils');
+
+Leaf = (function(_super) {
+ __extends(Leaf, _super);
+
+ Leaf.ID_PREFIX = 'leaf-';
+
+ Leaf.isLeafNode = function(node) {
+ return DOM.isTextNode(node) || (node.firstChild == null);
+ };
+
+ function Leaf(node, formats) {
+ this.node = node;
+ this.formats = _.clone(formats);
+ this.id = _.uniqueId(Leaf.ID_PREFIX);
+ this.text = DOM.getText(this.node);
+ this.length = this.text.length;
+ }
+
+ Leaf.prototype.getFormats = function() {
+ return this.formats;
+ };
+
+ Leaf.prototype.deleteText = function(offset, length) {
+ var textNode;
+ if (!(length > 0)) {
+ return;
+ }
+ this.text = this.text.slice(0, offset) + this.text.slice(offset + length);
+ this.length = this.text.length;
+ if (DOM.EMBED_TAGS[this.node.tagName] != null) {
+ textNode = this.node.ownerDocument.createTextNode(this.text);
+ return this.node = DOM.replaceNode(textNode, this.node);
+ } else {
+ return DOM.setText(this.node, this.text);
+ }
+ };
+
+ Leaf.prototype.insertText = function(offset, text) {
+ var textNode;
+ this.text = this.text.slice(0, offset) + text + this.text.slice(offset);
+ if (DOM.isTextNode(this.node)) {
+ DOM.setText(this.node, this.text);
+ } else {
+ textNode = this.node.ownerDocument.createTextNode(text);
+ if (this.node.tagName === DOM.DEFAULT_BREAK_TAG) {
+ DOM.replaceNode(textNode, this.node);
+ } else {
+ this.node.appendChild(textNode);
+ }
+ this.node = textNode;
+ }
+ return this.length = this.text.length;
+ };
+
+ return Leaf;
+
+})(LinkedList.Node);
+
+module.exports = Leaf;
+
+
+},{"./dom":15,"./format":17,"./lib/linked-list":20,"./utils":39,"lodash":"M4+//f"}],19:[function(_dereq_,module,exports){
+var ColorPicker, DOM, Picker,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+DOM = _dereq_('../dom');
+
+Picker = _dereq_('./picker');
+
+ColorPicker = (function(_super) {
+ __extends(ColorPicker, _super);
+
+ function ColorPicker() {
+ ColorPicker.__super__.constructor.apply(this, arguments);
+ DOM.addClass(this.container, 'ql-color-picker');
+ }
+
+ ColorPicker.prototype.buildItem = function(picker, option, index) {
+ var item;
+ item = ColorPicker.__super__.buildItem.call(this, picker, option, index);
+ item.style.backgroundColor = option.value;
+ return item;
+ };
+
+ return ColorPicker;
+
+})(Picker);
+
+module.exports = ColorPicker;
+
+
+},{"../dom":15,"./picker":21}],20:[function(_dereq_,module,exports){
+var LinkedList, Node;
+
+Node = (function() {
+ function Node(data) {
+ this.data = data;
+ this.prev = this.next = null;
+ }
+
+ return Node;
+
+})();
+
+LinkedList = (function() {
+ LinkedList.Node = Node;
+
+ function LinkedList() {
+ this.length = 0;
+ this.first = this.last = null;
+ }
+
+ LinkedList.prototype.append = function(node) {
+ if (this.first != null) {
+ node.next = null;
+ this.last.next = node;
+ } else {
+ this.first = node;
+ }
+ node.prev = this.last;
+ this.last = node;
+ return this.length += 1;
+ };
+
+ LinkedList.prototype.insertAfter = function(refNode, newNode) {
+ newNode.prev = refNode;
+ if (refNode != null) {
+ newNode.next = refNode.next;
+ if (refNode.next != null) {
+ refNode.next.prev = newNode;
+ }
+ refNode.next = newNode;
+ if (refNode === this.last) {
+ this.last = newNode;
+ }
+ } else {
+ newNode.next = this.first;
+ this.first.prev = newNode;
+ this.first = newNode;
+ }
+ return this.length += 1;
+ };
+
+ LinkedList.prototype.remove = function(node) {
+ if (this.length > 1) {
+ if (node.prev != null) {
+ node.prev.next = node.next;
+ }
+ if (node.next != null) {
+ node.next.prev = node.prev;
+ }
+ if (node === this.first) {
+ this.first = node.next;
+ }
+ if (node === this.last) {
+ this.last = node.prev;
+ }
+ } else {
+ this.first = this.last = null;
+ }
+ node.prev = node.next = null;
+ return this.length -= 1;
+ };
+
+ LinkedList.prototype.toArray = function() {
+ var arr, cur;
+ arr = [];
+ cur = this.first;
+ while (cur != null) {
+ arr.push(cur);
+ cur = cur.next;
+ }
+ return arr;
+ };
+
+ return LinkedList;
+
+})();
+
+module.exports = LinkedList;
+
+
+},{}],21:[function(_dereq_,module,exports){
+var DOM, Normalizer, Picker, _;
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('../dom');
+
+Normalizer = _dereq_('../normalizer');
+
+Picker = (function() {
+ Picker.TEMPLATE = '';
+
+ function Picker(select) {
+ this.select = select;
+ this.container = this.select.ownerDocument.createElement('span');
+ this.buildPicker();
+ DOM.addClass(this.container, 'ql-picker');
+ this.select.style.display = 'none';
+ this.select.parentNode.insertBefore(this.container, this.select);
+ DOM.addEventListener(this.select.ownerDocument, 'click', (function(_this) {
+ return function() {
+ _this.close();
+ return true;
+ };
+ })(this));
+ DOM.addEventListener(this.label, 'click', (function(_this) {
+ return function() {
+ return _.defer(function() {
+ return DOM.toggleClass(_this.container, 'ql-expanded');
+ });
+ };
+ })(this));
+ DOM.addEventListener(this.select, 'change', (function(_this) {
+ return function() {
+ var item, option;
+ if (_this.select.selectedIndex > -1) {
+ item = _this.container.querySelectorAll('.ql-picker-item')[_this.select.selectedIndex];
+ option = _this.select.options[_this.select.selectedIndex];
+ }
+ _this.selectItem(item, false);
+ return DOM.toggleClass(_this.label, 'ql-active', option !== DOM.getDefaultOption(_this.select));
+ };
+ })(this));
+ }
+
+ Picker.prototype.buildItem = function(picker, option, index) {
+ var item;
+ item = this.select.ownerDocument.createElement('span');
+ item.setAttribute('data-value', option.getAttribute('value'));
+ DOM.addClass(item, 'ql-picker-item');
+ DOM.setText(item, DOM.getText(option));
+ if (this.select.selectedIndex === index) {
+ this.selectItem(item, false);
+ }
+ DOM.addEventListener(item, 'click', (function(_this) {
+ return function() {
+ _this.selectItem(item, true);
+ return _this.close();
+ };
+ })(this));
+ return item;
+ };
+
+ Picker.prototype.buildPicker = function() {
+ var picker;
+ _.each(DOM.getAttributes(this.select), (function(_this) {
+ return function(value, name) {
+ return _this.container.setAttribute(name, value);
+ };
+ })(this));
+ this.container.innerHTML = Normalizer.stripWhitespace(Picker.TEMPLATE);
+ this.label = this.container.querySelector('.ql-picker-label');
+ picker = this.container.querySelector('.ql-picker-options');
+ return _.each(this.select.options, (function(_this) {
+ return function(option, i) {
+ var item;
+ item = _this.buildItem(picker, option, i);
+ return picker.appendChild(item);
+ };
+ })(this));
+ };
+
+ Picker.prototype.close = function() {
+ return DOM.removeClass(this.container, 'ql-expanded');
+ };
+
+ Picker.prototype.selectItem = function(item, trigger) {
+ var selected, value;
+ selected = this.container.querySelector('.ql-selected');
+ if (selected != null) {
+ DOM.removeClass(selected, 'ql-selected');
+ }
+ if (item != null) {
+ value = item.getAttribute('data-value');
+ DOM.addClass(item, 'ql-selected');
+ DOM.setText(this.label, DOM.getText(item));
+ DOM.selectOption(this.select, value, trigger);
+ return this.label.setAttribute('data-value', value);
+ } else {
+ this.label.innerHTML = ' ';
+ return this.label.removeAttribute('data-value');
+ }
+ };
+
+ return Picker;
+
+})();
+
+module.exports = Picker;
+
+
+},{"../dom":15,"../normalizer":33,"lodash":"M4+//f"}],22:[function(_dereq_,module,exports){
+var Range, _;
+
+_ = _dereq_('lodash');
+
+Range = (function() {
+ Range.compare = function(r1, r2) {
+ if (r1 === r2) {
+ return true;
+ }
+ if (!((r1 != null) && (r2 != null))) {
+ return false;
+ }
+ return r1.equals(r2);
+ };
+
+ function Range(start, end) {
+ this.start = start;
+ this.end = end;
+ }
+
+ Range.prototype.equals = function(range) {
+ if (range == null) {
+ return false;
+ }
+ return this.start === range.start && this.end === range.end;
+ };
+
+ Range.prototype.shift = function(index, length) {
+ var _ref;
+ return _ref = _.map([this.start, this.end], function(pos) {
+ if (index > pos) {
+ return pos;
+ }
+ if (length >= 0) {
+ return pos + length;
+ } else {
+ return Math.max(index, pos + length);
+ }
+ }), this.start = _ref[0], this.end = _ref[1], _ref;
+ };
+
+ Range.prototype.isCollapsed = function() {
+ return this.start === this.end;
+ };
+
+ return Range;
+
+})();
+
+module.exports = Range;
+
+
+},{"lodash":"M4+//f"}],23:[function(_dereq_,module,exports){
+var DOM, Format, Leaf, Line, LinkedList, Normalizer, Tandem, Utils, _,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('./dom');
+
+Format = _dereq_('./format');
+
+Leaf = _dereq_('./leaf');
+
+Line = _dereq_('./line');
+
+LinkedList = _dereq_('./lib/linked-list');
+
+Normalizer = _dereq_('./normalizer');
+
+Utils = _dereq_('./utils');
+
+Tandem = _dereq_('tandem-core');
+
+Line = (function(_super) {
+ __extends(Line, _super);
+
+ Line.CLASS_NAME = 'line';
+
+ Line.ID_PREFIX = 'line-';
+
+ function Line(doc, node) {
+ this.doc = doc;
+ this.node = node;
+ this.id = _.uniqueId(Line.ID_PREFIX);
+ this.formats = {};
+ DOM.addClass(this.node, Line.CLASS_NAME);
+ this.rebuild();
+ Line.__super__.constructor.call(this, this.node);
+ }
+
+ Line.prototype.buildLeaves = function(node, formats) {
+ return _.each(DOM.getChildNodes(node), (function(_this) {
+ return function(node) {
+ var nodeFormats;
+ node = Normalizer.normalizeNode(node);
+ nodeFormats = _.clone(formats);
+ _.each(_this.doc.formats, function(format, name) {
+ if (!format.isType(Format.types.LINE) && format.match(node)) {
+ return nodeFormats[name] = format.value(node);
+ }
+ });
+ if (Leaf.isLeafNode(node)) {
+ return _this.leaves.append(new Leaf(node, nodeFormats));
+ } else {
+ return _this.buildLeaves(node, nodeFormats);
+ }
+ };
+ })(this));
+ };
+
+ Line.prototype.deleteText = function(offset, length) {
+ var deleteLength, leaf, _ref;
+ if (!(length > 0)) {
+ return;
+ }
+ _ref = this.findLeafAt(offset), leaf = _ref[0], offset = _ref[1];
+ while ((leaf != null) && length > 0) {
+ deleteLength = Math.min(length, leaf.length - offset);
+ leaf.deleteText(offset, deleteLength);
+ length -= deleteLength;
+ leaf = leaf.next;
+ offset = 0;
+ }
+ return this.rebuild();
+ };
+
+ Line.prototype.findLeaf = function(leafNode) {
+ var curLeaf;
+ curLeaf = this.leaves.first;
+ while (curLeaf != null) {
+ if (curLeaf.node === leafNode) {
+ return curLeaf;
+ }
+ curLeaf = curLeaf.next;
+ }
+ return null;
+ };
+
+ Line.prototype.findLeafAt = function(offset, inclusive) {
+ var leaf;
+ if (inclusive == null) {
+ inclusive = false;
+ }
+ if (offset >= this.length - 1) {
+ return [this.leaves.last, this.leaves.last.length];
+ }
+ leaf = this.leaves.first;
+ while (leaf != null) {
+ if (offset < leaf.length || (offset === leaf.length && inclusive)) {
+ return [leaf, offset];
+ }
+ offset -= leaf.length;
+ leaf = leaf.next;
+ }
+ return [this.leaves.last, offset - this.leaves.last.length];
+ };
+
+ Line.prototype.format = function(name, value) {
+ var formats;
+ if (_.isObject(name)) {
+ formats = name;
+ } else {
+ formats = {};
+ formats[name] = value;
+ }
+ _.each(formats, (function(_this) {
+ return function(value, name) {
+ var excludeFormat, format;
+ format = _this.doc.formats[name];
+ if (format.isType(Format.types.LINE)) {
+ if (format.config.exclude && _this.formats[format.config.exclude]) {
+ excludeFormat = _this.doc.formats[format.config.exclude];
+ if (excludeFormat != null) {
+ _this.node = excludeFormat.remove(_this.node);
+ delete _this.formats[format.config.exclude];
+ }
+ }
+ _this.node = format.add(_this.node, value);
+ }
+ if (value) {
+ return _this.formats[name] = value;
+ } else {
+ return delete _this.formats[name];
+ }
+ };
+ })(this));
+ return this.resetContent();
+ };
+
+ Line.prototype.formatText = function(offset, length, name, value) {
+ var format, leaf, leafOffset, leftNode, nextLeaf, rightNode, targetNode, _ref, _ref1, _ref2;
+ _ref = this.findLeafAt(offset), leaf = _ref[0], leafOffset = _ref[1];
+ format = this.doc.formats[name];
+ if (!((format != null) && format.config.type !== Format.types.LINE)) {
+ return;
+ }
+ while ((leaf != null) && length > 0) {
+ nextLeaf = leaf.next;
+ if ((value && leaf.formats[name] !== value) || (!value && (leaf.formats[name] != null))) {
+ targetNode = leaf.node;
+ if (leaf.formats[name] != null) {
+ Utils.splitAncestors(targetNode, this.node);
+ while (!format.match(targetNode)) {
+ targetNode = targetNode.parentNode;
+ }
+ }
+ if (leafOffset > 0) {
+ _ref1 = Utils.splitNode(targetNode, leafOffset), leftNode = _ref1[0], targetNode = _ref1[1];
+ }
+ if (leaf.length > leafOffset + length) {
+ _ref2 = Utils.splitNode(targetNode, length), targetNode = _ref2[0], rightNode = _ref2[1];
+ }
+ format.add(targetNode, value);
+ }
+ length -= leaf.length - leafOffset;
+ leafOffset = 0;
+ leaf = nextLeaf;
+ }
+ return this.rebuild();
+ };
+
+ Line.prototype.insertText = function(offset, text, formats) {
+ var leaf, leafOffset, nextNode, node, prevNode, _ref, _ref1;
+ if (formats == null) {
+ formats = {};
+ }
+ if (!(text.length > 0)) {
+ return;
+ }
+ _ref = this.findLeafAt(offset), leaf = _ref[0], leafOffset = _ref[1];
+ if (_.isEqual(leaf.formats, formats)) {
+ leaf.insertText(leafOffset, text);
+ return this.resetContent();
+ } else {
+ node = _.reduce(formats, (function(_this) {
+ return function(node, value, name) {
+ return _this.doc.formats[name].add(node, value);
+ };
+ })(this), this.node.ownerDocument.createTextNode(text));
+ _ref1 = Utils.splitNode(leaf.node, leafOffset), prevNode = _ref1[0], nextNode = _ref1[1];
+ if (nextNode) {
+ nextNode = Utils.splitAncestors(nextNode, this.node);
+ }
+ this.node.insertBefore(node, nextNode);
+ return this.rebuild();
+ }
+ };
+
+ Line.prototype.optimize = function() {
+ Normalizer.optimizeLine(this.node);
+ return this.rebuild();
+ };
+
+ Line.prototype.rebuild = function(force) {
+ if (force == null) {
+ force = false;
+ }
+ if (!force && (this.outerHTML != null) && this.outerHTML === this.node.outerHTML) {
+ if (_.all(this.leaves.toArray(), function(leaf) {
+ return leaf.node.parentNode != null;
+ })) {
+ return false;
+ }
+ }
+ this.node = Normalizer.normalizeNode(this.node);
+ if (Utils.getNodeLength(this.node) === 0 && !this.node.querySelector(DOM.DEFAULT_BREAK_TAG)) {
+ this.node.appendChild(this.node.ownerDocument.createElement(DOM.DEFAULT_BREAK_TAG));
+ }
+ this.leaves = new LinkedList();
+ this.formats = _.reduce(this.doc.formats, (function(_this) {
+ return function(formats, format, name) {
+ if (format.isType(Format.types.LINE)) {
+ if (format.match(_this.node)) {
+ formats[name] = format.value(_this.node);
+ } else {
+ delete formats[name];
+ }
+ }
+ return formats;
+ };
+ })(this), this.formats);
+ this.buildLeaves(this.node, {});
+ this.resetContent();
+ return true;
+ };
+
+ Line.prototype.resetContent = function() {
+ var ops;
+ if (this.node.id !== this.id) {
+ this.node.id = this.id;
+ }
+ this.outerHTML = this.node.outerHTML;
+ this.length = 1;
+ ops = _.map(this.leaves.toArray(), (function(_this) {
+ return function(leaf) {
+ _this.length += leaf.length;
+ return new Tandem.InsertOp(leaf.text, leaf.formats);
+ };
+ })(this));
+ ops.push(new Tandem.InsertOp('\n', this.formats));
+ return this.delta = new Tandem.Delta(0, this.length, ops);
+ };
+
+ return Line;
+
+})(LinkedList.Node);
+
+module.exports = Line;
+
+
+},{"./dom":15,"./format":17,"./leaf":18,"./lib/linked-list":20,"./line":23,"./normalizer":33,"./utils":39,"lodash":"M4+//f","tandem-core":10}],24:[function(_dereq_,module,exports){
+var Authorship, DOM, Format, Tandem, _;
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('../dom');
+
+Format = _dereq_('../format');
+
+Tandem = _dereq_('tandem-core');
+
+Authorship = (function() {
+ Authorship.DEFAULTS = {
+ authorId: null,
+ color: 'blue',
+ enabled: false
+ };
+
+ function Authorship(quill, options) {
+ this.quill = quill;
+ this.options = options;
+ if (this.options.button != null) {
+ this.attachButton(this.options.button);
+ }
+ if (this.options.enabled) {
+ this.enable();
+ }
+ this.quill.addFormat('author', {
+ "class": 'author-'
+ });
+ if (this.options.authorId == null) {
+ return;
+ }
+ this.quill.on(this.quill.constructor.events.PRE_EVENT, (function(_this) {
+ return function(eventName, delta, origin) {
+ var attribute, authorDelta;
+ if (eventName === _this.quill.constructor.events.TEXT_CHANGE && origin === 'user') {
+ _.each(delta.ops, function(op) {
+ if (Tandem.InsertOp.isInsert(op) || _.keys(op.attributes).length > 0) {
+ return op.attributes['author'] = _this.options.authorId;
+ }
+ });
+ authorDelta = new Tandem.Delta(delta.endLength, [new Tandem.RetainOp(0, delta.endLength)]);
+ attribute = {
+ author: _this.options.authorId
+ };
+ delta.apply(function(index, text) {
+ return authorDelta = authorDelta.compose(Tandem.Delta.makeRetainDelta(delta.endLength, index, text.length, attribute));
+ }, (function() {}), function(index, length, name, value) {
+ return authorDelta = authorDelta.compose(Tandem.Delta.makeRetainDelta(delta.endLength, index, length, attribute));
+ });
+ return _this.quill.updateContents(authorDelta, 'silent');
+ }
+ };
+ })(this));
+ this.addAuthor(this.options.authorId, this.options.color);
+ }
+
+ Authorship.prototype.addAuthor = function(id, color) {
+ var styles;
+ styles = {};
+ styles[".authorship .author-" + id] = {
+ "background-color": "" + color
+ };
+ return this.quill.addStyles(styles);
+ };
+
+ Authorship.prototype.attachButton = function(button) {
+ return DOM.addEventListener(button, 'click', (function(_this) {
+ return function() {
+ DOM.toggleClass(button, 'ql-on');
+ return _this.enable(DOM.hasClass(button, 'ql-on'));
+ };
+ })(this));
+ };
+
+ Authorship.prototype.enable = function(enabled) {
+ if (enabled == null) {
+ enabled = true;
+ }
+ return DOM.toggleClass(this.quill.root, 'authorship', enabled);
+ };
+
+ Authorship.prototype.disable = function() {
+ return this.enable(false);
+ };
+
+ return Authorship;
+
+})();
+
+module.exports = Authorship;
+
+
+},{"../dom":15,"../format":17,"lodash":"M4+//f","tandem-core":10}],25:[function(_dereq_,module,exports){
+var DOM, ImageTooltip, Tooltip, _,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('../dom');
+
+Tooltip = _dereq_('./tooltip');
+
+ImageTooltip = (function(_super) {
+ __extends(ImageTooltip, _super);
+
+ ImageTooltip.DEFAULTS = {
+ styles: {
+ '.image-tooltip-container': {
+ 'margin': '25px',
+ 'padding': '10px',
+ 'width': '300px'
+ },
+ '.image-tooltip-container:after': {
+ 'clear': 'both',
+ 'content': '""',
+ 'display': 'table'
+ },
+ '.image-tooltip-container .preview': {
+ 'margin': '10px 0px',
+ 'position': 'relative',
+ 'border': '1px dashed #000',
+ 'height': '200px'
+ },
+ '.image-tooltip-container .preview span': {
+ 'display': 'inline-block',
+ 'position': 'absolute',
+ 'text-align': 'center',
+ 'top': '40%',
+ 'width': '100%'
+ },
+ '.image-tooltip-container img': {
+ 'bottom': '0',
+ 'left': '0',
+ 'margin': 'auto',
+ 'max-height': '100%',
+ 'max-width': '100%',
+ 'position': 'absolute',
+ 'right': '0',
+ 'top': '0'
+ },
+ '.image-tooltip-container .input': {
+ 'box-sizing': 'border-box',
+ 'width': '100%'
+ },
+ '.image-tooltip-container a': {
+ 'border': '1px solid black',
+ 'box-sizing': 'border-box',
+ 'display': 'inline-block',
+ 'float': 'left',
+ 'padding': '5px',
+ 'text-align': 'center',
+ 'width': '50%'
+ }
+ },
+ template: ' Preview
Cancel Insert'
+ };
+
+ function ImageTooltip(quill, options) {
+ this.quill = quill;
+ this.options = options;
+ this.options.styles = _.defaults(this.options.styles, Tooltip.DEFAULTS.styles);
+ this.options = _.defaults(this.options, Tooltip.DEFAULTS);
+ ImageTooltip.__super__.constructor.call(this, this.quill, this.options);
+ this.preview = this.container.querySelector('.preview');
+ this.textbox = this.container.querySelector('.input');
+ DOM.addClass(this.container, 'image-tooltip-container');
+ this.initListeners();
+ }
+
+ ImageTooltip.prototype.initListeners = function() {
+ DOM.addEventListener(this.container.querySelector('.insert'), 'click', _.bind(this.insertImage, this));
+ DOM.addEventListener(this.container.querySelector('.cancel'), 'click', _.bind(this.hide, this));
+ DOM.addEventListener(this.textbox, 'input', _.bind(this._preview, this));
+ this.initTextbox(this.textbox, this.insertImage, this.hide);
+ return this.quill.onModuleLoad('toolbar', (function(_this) {
+ return function(toolbar) {
+ return toolbar.initFormat('image', _.bind(_this._onToolbar, _this));
+ };
+ })(this));
+ };
+
+ ImageTooltip.prototype.insertImage = function() {
+ var index, url;
+ url = this._normalizeURL(this.textbox.value);
+ if (this.range == null) {
+ this.range = new Range(0, 0);
+ }
+ if (this.range) {
+ this.preview.innerHTML = 'Preview';
+ this.textbox.value = '';
+ index = this.range.end;
+ this.quill.insertEmbed(index, 'image', url, 'user');
+ this.quill.setSelection(index + 1, index + 1);
+ }
+ return this.hide();
+ };
+
+ ImageTooltip.prototype._onToolbar = function(range, value) {
+ if (value) {
+ if (!this.textbox.value) {
+ this.textbox.value = 'http://';
+ }
+ this.show();
+ this.textbox.focus();
+ return _.defer((function(_this) {
+ return function() {
+ return _this.textbox.setSelectionRange(_this.textbox.value.length, _this.textbox.value.length);
+ };
+ })(this));
+ } else {
+ return this.quill.deleteText(range, 'user');
+ }
+ };
+
+ ImageTooltip.prototype._preview = function() {
+ var img;
+ if (!this._matchImageURL(this.textbox.value)) {
+ return;
+ }
+ if (this.preview.firstChild.tagName === 'IMG') {
+ return this.preview.firstChild.setAttribute('src', this.textbox.value);
+ } else {
+ img = this.preview.ownerDocument.createElement('img');
+ img.setAttribute('src', this.textbox.value);
+ return this.preview.replaceChild(img, this.preview.firstChild);
+ }
+ };
+
+ ImageTooltip.prototype._matchImageURL = function(url) {
+ return /^https?:\/\/.+\.(jp?g|gif|png)$/.test(url);
+ };
+
+ ImageTooltip.prototype._normalizeURL = function(url) {
+ if (!/^https?:\/\//.test(url)) {
+ url = 'http://' + url;
+ }
+ return url;
+ };
+
+ return ImageTooltip;
+
+})(Tooltip);
+
+module.exports = ImageTooltip;
+
+
+},{"../dom":15,"./tooltip":31,"lodash":"M4+//f"}],26:[function(_dereq_,module,exports){
+var DOM, Keyboard, Line, Tandem, _;
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('../dom');
+
+Line = _dereq_('../line');
+
+Tandem = _dereq_('tandem-core');
+
+Keyboard = (function() {
+ Keyboard.hotkeys = {
+ BOLD: {
+ key: 'B',
+ metaKey: true
+ },
+ INDENT: {
+ key: DOM.KEYS.TAB,
+ shiftKey: false
+ },
+ ITALIC: {
+ key: 'I',
+ metaKey: true
+ },
+ OUTDENT: {
+ key: DOM.KEYS.TAB,
+ shiftKey: true
+ },
+ UNDERLINE: {
+ key: 'U',
+ metaKey: true
+ }
+ };
+
+ function Keyboard(quill, options) {
+ this.quill = quill;
+ this.hotkeys = {};
+ this._initListeners();
+ this._initHotkeys();
+ this._initDeletes();
+ }
+
+ Keyboard.prototype.addHotkey = function(hotkey, callback) {
+ var which, _base;
+ hotkey = _.isObject(hotkey) ? _.clone(hotkey) : {
+ key: hotkey
+ };
+ hotkey.callback = callback;
+ which = _.isNumber(hotkey.key) ? hotkey.key : hotkey.key.toUpperCase().charCodeAt(0);
+ if ((_base = this.hotkeys)[which] == null) {
+ _base[which] = [];
+ }
+ return this.hotkeys[which].push(hotkey);
+ };
+
+ Keyboard.prototype.toggleFormat = function(range, format) {
+ var delta, toolbar, value;
+ if (range.isCollapsed()) {
+ delta = this.quill.getContents(Math.max(0, range.start - 1), range.end);
+ } else {
+ delta = this.quill.getContents(range);
+ }
+ value = delta.ops.length === 0 || !_.all(delta.ops, function(op) {
+ return op.attributes[format];
+ });
+ if (range.isCollapsed()) {
+ this.quill.prepareFormat(format, value);
+ } else {
+ this.quill.formatText(range, format, value, 'user');
+ }
+ toolbar = this.quill.getModule('toolbar');
+ if (toolbar != null) {
+ return toolbar.setActive(format, value);
+ }
+ };
+
+ Keyboard.prototype._initDeletes = function() {
+ return _.each([DOM.KEYS.DELETE, DOM.KEYS.BACKSPACE], (function(_this) {
+ return function(key) {
+ return _this.addHotkey(key, function() {
+ return _this.quill.getLength() > 1;
+ });
+ };
+ })(this));
+ };
+
+ Keyboard.prototype._initHotkeys = function() {
+ this.addHotkey(Keyboard.hotkeys.INDENT, (function(_this) {
+ return function(range) {
+ _this._onTab(range, false);
+ return false;
+ };
+ })(this));
+ this.addHotkey(Keyboard.hotkeys.OUTDENT, (function(_this) {
+ return function(range) {
+ return false;
+ };
+ })(this));
+ return _.each(['bold', 'italic', 'underline'], (function(_this) {
+ return function(format) {
+ return _this.addHotkey(Keyboard.hotkeys[format.toUpperCase()], function(range) {
+ _this.toggleFormat(range, format);
+ return false;
+ });
+ };
+ })(this));
+ };
+
+ Keyboard.prototype._initListeners = function() {
+ return DOM.addEventListener(this.quill.root, 'keydown', (function(_this) {
+ return function(event) {
+ var prevent, range;
+ prevent = false;
+ range = _this.quill.getSelection();
+ _.each(_this.hotkeys[event.which], function(hotkey) {
+ if ((hotkey.metaKey != null) && (event.metaKey !== hotkey.metaKey && event.ctrlKey !== hotkey.metaKey)) {
+ return;
+ }
+ if ((hotkey.shiftKey != null) && event.shiftKey !== hotkey.shiftKey) {
+ return;
+ }
+ return prevent = hotkey.callback(range) === false || prevent;
+ });
+ return !prevent;
+ };
+ })(this));
+ };
+
+ Keyboard.prototype._onTab = function(range, shift) {
+ var delta;
+ if (shift == null) {
+ shift = false;
+ }
+ delta = Tandem.Delta.makeDelta({
+ startLength: this.quill.getLength(),
+ ops: [
+ {
+ start: 0,
+ end: range.start
+ }, {
+ value: "\t"
+ }, {
+ start: range.end,
+ end: this.quill.getLength()
+ }
+ ]
+ });
+ this.quill.updateContents(delta);
+ return this.quill.setSelection(range.start + 1, range.start + 1);
+ };
+
+ return Keyboard;
+
+})();
+
+module.exports = Keyboard;
+
+
+},{"../dom":15,"../line":23,"lodash":"M4+//f","tandem-core":10}],27:[function(_dereq_,module,exports){
+var DOM, LinkTooltip, Tooltip, _,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('../dom');
+
+Tooltip = _dereq_('./tooltip');
+
+LinkTooltip = (function(_super) {
+ __extends(LinkTooltip, _super);
+
+ LinkTooltip.DEFAULTS = {
+ maxLength: 50,
+ styles: {
+ '.link-tooltip-container': {
+ 'padding': '5px 10px'
+ },
+ '.link-tooltip-container input.input': {
+ 'width': '170px'
+ },
+ '.link-tooltip-container input.input, .link-tooltip-container a.done, .link-tooltip-container.editing a.url, .link-tooltip-container.editing a.change': {
+ 'display': 'none'
+ },
+ '.link-tooltip-container.editing input.input, .link-tooltip-container.editing a.done': {
+ 'display': 'inline-block'
+ }
+ },
+ template: 'Visit URL: - Change Done'
+ };
+
+ function LinkTooltip(quill, options) {
+ this.quill = quill;
+ this.options = options;
+ this.options.styles = _.defaults(this.options.styles, Tooltip.DEFAULTS.styles);
+ this.options = _.defaults(this.options, Tooltip.DEFAULTS);
+ LinkTooltip.__super__.constructor.call(this, this.quill, this.options);
+ DOM.addClass(this.container, 'link-tooltip-container');
+ this.textbox = this.container.querySelector('.input');
+ this.link = this.container.querySelector('.url');
+ this.initListeners();
+ }
+
+ LinkTooltip.prototype.initListeners = function() {
+ this.quill.on(this.quill.constructor.events.SELECTION_CHANGE, (function(_this) {
+ return function(range) {
+ var anchor;
+ if (!((range != null) && range.isCollapsed())) {
+ return;
+ }
+ anchor = _this._findAnchor(range);
+ if (anchor) {
+ _this.setMode(anchor.href, false);
+ return _this.show(anchor);
+ } else {
+ _this.range = null;
+ return _this.hide();
+ }
+ };
+ })(this));
+ DOM.addEventListener(this.container.querySelector('.done'), 'click', _.bind(this.saveLink, this));
+ DOM.addEventListener(this.container.querySelector('.change'), 'click', (function(_this) {
+ return function() {
+ return _this.setMode(_this.link.href, true);
+ };
+ })(this));
+ this.initTextbox(this.textbox, this.saveLink, this.hide);
+ return this.quill.onModuleLoad('toolbar', (function(_this) {
+ return function(toolbar) {
+ return toolbar.initFormat('link', _.bind(_this._onToolbar, _this));
+ };
+ })(this));
+ };
+
+ LinkTooltip.prototype.saveLink = function() {
+ var anchor, url;
+ url = this._normalizeURL(this.textbox.value);
+ if (this.range != null) {
+ if (this.range.isCollapsed()) {
+ anchor = this._findAnchor(this.range);
+ if (anchor != null) {
+ anchor.href = url;
+ }
+ } else {
+ this.quill.formatText(this.range, 'link', url, 'user');
+ }
+ }
+ return this.setMode(url, false);
+ };
+
+ LinkTooltip.prototype.setMode = function(url, edit) {
+ var text;
+ if (edit == null) {
+ edit = false;
+ }
+ if (edit) {
+ this.textbox.value = url;
+ this.textbox.focus();
+ _.defer((function(_this) {
+ return function() {
+ return _this.textbox.setSelectionRange(url.length, url.length);
+ };
+ })(this));
+ } else {
+ this.link.href = url;
+ text = url.length > this.options.maxLength ? url.slice(0, this.options.maxLength) + '...' : url;
+ DOM.setText(this.link, text);
+ }
+ return DOM.toggleClass(this.container, 'editing', edit);
+ };
+
+ LinkTooltip.prototype._findAnchor = function(range) {
+ var leaf, node, offset, _ref;
+ _ref = this.quill.editor.doc.findLeafAt(range.start, true), leaf = _ref[0], offset = _ref[1];
+ if (leaf != null) {
+ node = leaf.node;
+ }
+ while (node != null) {
+ if (node.tagName === 'A') {
+ return node;
+ }
+ node = node.parentNode;
+ }
+ return null;
+ };
+
+ LinkTooltip.prototype._onToolbar = function(range, value) {
+ var nativeRange;
+ if (!(range && !range.isCollapsed())) {
+ return;
+ }
+ if (value) {
+ this.setMode(this._suggestURL(range), true);
+ nativeRange = this.quill.editor.selection._getNativeRange();
+ return this.show(nativeRange);
+ } else {
+ return this.quill.formatText(range, 'link', false, 'user');
+ }
+ };
+
+ LinkTooltip.prototype._normalizeURL = function(url) {
+ if (!/^https?:\/\//.test(url)) {
+ url = 'http://' + url;
+ }
+ return url;
+ };
+
+ LinkTooltip.prototype._suggestURL = function(range) {
+ var text;
+ text = this.quill.getText(range);
+ return this._normalizeURL(text);
+ };
+
+ return LinkTooltip;
+
+})(Tooltip);
+
+module.exports = LinkTooltip;
+
+
+},{"../dom":15,"./tooltip":31,"lodash":"M4+//f"}],28:[function(_dereq_,module,exports){
+var DOM, EventEmitter2, MultiCursor, Utils, _,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+_ = _dereq_('lodash');
+
+EventEmitter2 = _dereq_('eventemitter2').EventEmitter2;
+
+DOM = _dereq_('../dom');
+
+Utils = _dereq_('../utils');
+
+MultiCursor = (function(_super) {
+ __extends(MultiCursor, _super);
+
+ MultiCursor.DEFAULTS = {
+ template: ' ',
+ timeout: 2500
+ };
+
+ MultiCursor.events = {
+ CURSOR_ADDED: 'cursor-addded',
+ CURSOR_MOVED: 'cursor-moved',
+ CURSOR_REMOVED: 'cursor-removed'
+ };
+
+ function MultiCursor(quill, options) {
+ this.quill = quill;
+ this.options = options;
+ this.cursors = {};
+ this.container = this.quill.addContainer('cursor-container', true);
+ this.quill.addStyles({
+ '.cursor-container': {
+ 'position': 'absolute',
+ 'left': '0',
+ 'top': '0',
+ 'z-index': '1000'
+ },
+ '.cursor': {
+ 'margin-left': '-1px',
+ 'position': 'absolute'
+ },
+ '.cursor-flag': {
+ 'bottom': '100%',
+ 'position': 'absolute',
+ 'white-space': 'nowrap'
+ },
+ '.cursor-name': {
+ 'display': 'inline-block',
+ 'color': 'white',
+ 'padding': '2px 8px'
+ },
+ '.cursor-caret': {
+ 'height': '100%',
+ 'position': 'absolute',
+ 'width': '2px'
+ },
+ '.cursor.hidden .cursor-flag': {
+ 'display': 'none'
+ },
+ '.cursor.top > .cursor-flag': {
+ 'bottom': 'auto',
+ 'top': '100%'
+ },
+ '.cursor.right > .cursor-flag': {
+ 'right': '-2px'
+ }
+ });
+ this.quill.on(this.quill.constructor.events.TEXT_CHANGE, _.bind(this._applyDelta, this));
+ }
+
+ MultiCursor.prototype.clearCursors = function() {
+ _.each(_.keys(this.cursors), _.bind(this.removeCursor, this));
+ return this.cursors = {};
+ };
+
+ MultiCursor.prototype.moveCursor = function(userId, index) {
+ var cursor;
+ cursor = this.cursors[userId];
+ cursor.index = index;
+ DOM.removeClass(cursor.elem, 'hidden');
+ clearTimeout(cursor.timer);
+ cursor.timer = setTimeout((function(_this) {
+ return function() {
+ DOM.addClass(cursor.elem, 'hidden');
+ return cursor.timer = null;
+ };
+ })(this), this.options.timeout);
+ this._updateCursor(cursor);
+ return cursor;
+ };
+
+ MultiCursor.prototype.removeCursor = function(userId) {
+ var cursor;
+ cursor = this.cursors[userId];
+ this.emit(MultiCursor.events.CURSOR_REMOVED, cursor);
+ if (cursor != null) {
+ cursor.elem.parentNode.removeChild(cursor.elem);
+ }
+ return delete this.cursors[userId];
+ };
+
+ MultiCursor.prototype.setCursor = function(userId, index, name, color) {
+ var cursor;
+ if (this.cursors[userId] == null) {
+ this.cursors[userId] = cursor = {
+ userId: userId,
+ index: index,
+ color: color,
+ elem: this._buildCursor(name, color)
+ };
+ this.emit(MultiCursor.events.CURSOR_ADDED, cursor);
+ }
+ _.defer((function(_this) {
+ return function() {
+ return _this.moveCursor(userId, index);
+ };
+ })(this));
+ return this.cursors[userId];
+ };
+
+ MultiCursor.prototype.shiftCursors = function(index, length, authorId) {
+ if (authorId == null) {
+ authorId = null;
+ }
+ return _.each(this.cursors, (function(_this) {
+ return function(cursor, id) {
+ if (!(cursor && (cursor.index > index || cursor.userId === authorId))) {
+ return;
+ }
+ return cursor.index += Math.max(length, index - cursor.index);
+ };
+ })(this));
+ };
+
+ MultiCursor.prototype.update = function() {
+ return _.each(this.cursors, (function(_this) {
+ return function(cursor, id) {
+ if (cursor == null) {
+ return;
+ }
+ _this._updateCursor(cursor);
+ return true;
+ };
+ })(this));
+ };
+
+ MultiCursor.prototype._applyDelta = function(delta) {
+ delta.apply((function(_this) {
+ return function(index, text, formatting) {
+ return _this.shiftCursors(index, text.length, formatting['author']);
+ };
+ })(this), (function(_this) {
+ return function(index, length) {
+ return _this.shiftCursors(index, -1 * length, null);
+ };
+ })(this), (function(_this) {
+ return function(index, length, name, value) {
+ return _this.shiftCursors(index, 0, null);
+ };
+ })(this));
+ return this.update();
+ };
+
+ MultiCursor.prototype._buildCursor = function(name, color) {
+ var cursor, cursorCaret, cursorFlag, cursorName;
+ cursor = this.container.ownerDocument.createElement('span');
+ DOM.addClass(cursor, 'cursor');
+ cursor.innerHTML = this.options.template;
+ cursorFlag = cursor.querySelector('.cursor-flag');
+ cursorName = cursor.querySelector('.cursor-name');
+ DOM.setText(cursorName, name);
+ cursorCaret = cursor.querySelector('.cursor-caret');
+ cursorCaret.style.backgroundColor = cursorName.style.backgroundColor = color;
+ this.container.appendChild(cursor);
+ return cursor;
+ };
+
+ MultiCursor.prototype._moveCursor = function(cursor, reference, side) {
+ var bounds, flag;
+ if (side == null) {
+ side = 'left';
+ }
+ bounds = reference.getBoundingClientRect();
+ cursor.elem.style.top = bounds.top + 'px';
+ cursor.elem.style.left = bounds[side] + 'px';
+ cursor.elem.style.height = bounds.height + 'px';
+ flag = cursor.elem.querySelector('.cursor-flag');
+ DOM.toggleClass(cursor.elem, 'top', parseInt(cursor.elem.style.top) <= flag.offsetHeight);
+ DOM.toggleClass(cursor.elem, 'left', parseInt(cursor.elem.style.left) <= flag.offsetWidth);
+ DOM.toggleClass(cursor.elem, 'right', this.quill.root.offsetWidth - parseInt(cursor.elem.style.left) <= flag.offsetWidth);
+ return this.emit(MultiCursor.events.CURSOR_MOVED, cursor);
+ };
+
+ MultiCursor.prototype._updateCursor = function(cursor) {
+ var didSplit, guide, leaf, leftNode, offset, rightNode, _ref, _ref1;
+ this.quill.editor.checkUpdate();
+ _ref = this.quill.editor.doc.findLeafAt(cursor.index, true), leaf = _ref[0], offset = _ref[1];
+ guide = this.container.ownerDocument.createElement('span');
+ if (leaf != null) {
+ _ref1 = Utils.splitNode(leaf.node, offset), leftNode = _ref1[0], rightNode = _ref1[1], didSplit = _ref1[2];
+ DOM.setText(guide, DOM.ZERO_WIDTH_NOBREAK_SPACE);
+ leaf.node.parentNode.insertBefore(guide, rightNode);
+ } else {
+ DOM.setText(guide, DOM.NOBREAK_SPACE);
+ this.quill.root.appendChild(guide);
+ }
+ this._moveCursor(cursor, guide);
+ DOM.removeNode(guide);
+ if (didSplit) {
+ DOM.normalize(leaf.node.parentNode);
+ }
+ return this.quill.editor.selection.update('silent');
+ };
+
+ return MultiCursor;
+
+})(EventEmitter2);
+
+module.exports = MultiCursor;
+
+
+},{"../dom":15,"../utils":39,"eventemitter2":3,"lodash":"M4+//f"}],29:[function(_dereq_,module,exports){
+var DOM, Document, PasteManager, Tandem, _;
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('../dom');
+
+Document = _dereq_('../document');
+
+Tandem = _dereq_('tandem-core');
+
+PasteManager = (function() {
+ function PasteManager(quill, options) {
+ this.quill = quill;
+ this.options = options;
+ this.container = this.quill.addContainer('paste-container');
+ this.container.setAttribute('contenteditable', true);
+ this.quill.addStyles({
+ '.paste-container': {
+ 'left': '-10000px',
+ 'position': 'absolute',
+ 'top': '50%'
+ }
+ });
+ DOM.addEventListener(this.quill.root, 'paste', _.bind(this._paste, this));
+ }
+
+ PasteManager.prototype._paste = function() {
+ var iframe, oldDocLength, range, scrollY;
+ oldDocLength = this.quill.getLength();
+ range = this.quill.getSelection();
+ if (range == null) {
+ return;
+ }
+ this.container.innerHTML = "";
+ iframe = this.quill.root.ownerDocument.defaultView;
+ scrollY = iframe.scrollY;
+ this.container.focus();
+ return _.defer((function(_this) {
+ return function() {
+ var delta, doc, lengthAdded;
+ doc = new Document(_this.container, _this.quill.options);
+ delta = doc.toDelta();
+ delta = delta.compose(Tandem.Delta.makeDeleteDelta(delta.endLength, delta.endLength - 1, 1));
+ lengthAdded = delta.endLength;
+ if (range.start > 0) {
+ delta.ops.unshift(new Tandem.RetainOp(0, range.start));
+ }
+ if (range.end < oldDocLength) {
+ delta.ops.push(new Tandem.RetainOp(range.end, oldDocLength));
+ }
+ delta.endLength += _this.quill.getLength() - (range.end - range.start);
+ delta.startLength = oldDocLength;
+ _this.quill.updateContents(delta, 'user');
+ _this.quill.focus();
+ _this.quill.setSelection(range.start + lengthAdded, range.start + lengthAdded);
+ return iframe.scrollTo(0, scrollY);
+ };
+ })(this));
+ };
+
+ return PasteManager;
+
+})();
+
+module.exports = PasteManager;
+
+
+},{"../document":14,"../dom":15,"lodash":"M4+//f","tandem-core":10}],30:[function(_dereq_,module,exports){
+var DOM, Toolbar, Utils, _;
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('../dom');
+
+Utils = _dereq_('../utils');
+
+Toolbar = (function() {
+ Toolbar.DEFAULTS = {
+ container: null
+ };
+
+ Toolbar.formats = {
+ LINE: {
+ 'align': 'align',
+ 'bullet': 'bullet',
+ 'list': 'list'
+ },
+ SELECT: {
+ 'align': 'align',
+ 'background': 'background',
+ 'color': 'color',
+ 'font': 'font',
+ 'size': 'size'
+ },
+ TOGGLE: {
+ 'bold': 'bold',
+ 'bullet': 'bullet',
+ 'image': 'image',
+ 'italic': 'italic',
+ 'link': 'link',
+ 'list': 'list',
+ 'strike': 'strike',
+ 'underline': 'underline'
+ },
+ TOOLTIP: {
+ 'image': 'image',
+ 'link': 'link'
+ }
+ };
+
+ function Toolbar(quill, options) {
+ this.quill = quill;
+ this.options = options;
+ if (this.options.container == null) {
+ throw new Error('container required for toolbar', this.options);
+ }
+ this.container = _.isString(this.options.container) ? document.querySelector(this.options.container) : this.options.container;
+ this.inputs = {};
+ this.preventUpdate = false;
+ this.triggering = false;
+ _.each(this.quill.options.formats, (function(_this) {
+ return function(format) {
+ if (Toolbar.formats.TOOLTIP[format] != null) {
+ return;
+ }
+ return _this.initFormat(format, function(range, value) {
+ if (_this.triggering) {
+ return;
+ }
+ if (range.isCollapsed()) {
+ _this.quill.prepareFormat(format, value);
+ } else if (Toolbar.formats.LINE[format] != null) {
+ _this.quill.formatLine(range, format, value, 'user');
+ } else {
+ _this.quill.formatText(range, format, value, 'user');
+ }
+ return _.defer(function() {
+ _this.updateActive(range);
+ return _this.setActive(format, value);
+ });
+ });
+ };
+ })(this));
+ this.quill.on(this.quill.constructor.events.SELECTION_CHANGE, _.bind(this.updateActive, this));
+ DOM.addClass(this.container, 'ql-toolbar-container');
+ if (DOM.isIOS()) {
+ DOM.addClass(this.container, 'ios');
+ }
+ if (DOM.isIE(11) || DOM.isIOS()) {
+ DOM.addEventListener(this.container, 'mousedown', (function(_this) {
+ return function() {
+ return false;
+ };
+ })(this));
+ }
+ }
+
+ Toolbar.prototype.initFormat = function(format, callback) {
+ var eventName, input, selector;
+ selector = ".ql-" + format;
+ if (Toolbar.formats.SELECT[format] != null) {
+ selector = "select" + selector;
+ eventName = 'change';
+ } else {
+ eventName = 'click';
+ }
+ input = this.container.querySelector(selector);
+ if (input == null) {
+ return;
+ }
+ this.inputs[format] = input;
+ return DOM.addEventListener(input, eventName, (function(_this) {
+ return function() {
+ var range, value;
+ value = eventName === 'change' ? DOM.getSelectValue(input) : !DOM.hasClass(input, 'ql-active');
+ _this.preventUpdate = true;
+ _this.quill.focus();
+ range = _this.quill.getSelection();
+ if (range != null) {
+ callback(range, value);
+ }
+ _this.preventUpdate = false;
+ return true;
+ };
+ })(this));
+ };
+
+ Toolbar.prototype.setActive = function(format, value) {
+ var input, selectValue;
+ input = this.inputs[format];
+ if (input == null) {
+ return;
+ }
+ if (input.tagName === 'SELECT') {
+ this.triggering = true;
+ selectValue = DOM.getSelectValue(input);
+ if (_.isArray(value)) {
+ value = '';
+ }
+ if (value !== selectValue) {
+ if (value != null) {
+ DOM.selectOption(input, value);
+ } else {
+ DOM.resetSelect(input);
+ }
+ }
+ return this.triggering = false;
+ } else {
+ return DOM.toggleClass(input, 'ql-active', value || false);
+ }
+ };
+
+ Toolbar.prototype.updateActive = function(range) {
+ var activeFormats;
+ if (!((range != null) && !this.preventUpdate)) {
+ return;
+ }
+ activeFormats = this._getActive(range);
+ return _.each(this.inputs, (function(_this) {
+ return function(input, format) {
+ _this.setActive(format, activeFormats[format]);
+ return true;
+ };
+ })(this));
+ };
+
+ Toolbar.prototype._getActive = function(range) {
+ var leafFormats, lineFormats;
+ leafFormats = this._getLeafActive(range);
+ lineFormats = this._getLineActive(range);
+ return _.defaults({}, leafFormats, lineFormats);
+ };
+
+ Toolbar.prototype._getLeafActive = function(range) {
+ var contents, formatsArr, line, offset, _ref;
+ if (range.isCollapsed()) {
+ _ref = this.quill.editor.doc.findLineAt(range.start), line = _ref[0], offset = _ref[1];
+ if (offset === 0) {
+ contents = this.quill.getContents(range.start, range.end + 1);
+ } else {
+ contents = this.quill.getContents(range.start - 1, range.end);
+ }
+ } else {
+ contents = this.quill.getContents(range);
+ }
+ formatsArr = _.map(contents.ops, 'attributes');
+ return this._intersectFormats(formatsArr);
+ };
+
+ Toolbar.prototype._getLineActive = function(range) {
+ var firstLine, formatsArr, lastLine, offset, _ref, _ref1;
+ formatsArr = [];
+ _ref = this.quill.editor.doc.findLineAt(range.start), firstLine = _ref[0], offset = _ref[1];
+ _ref1 = this.quill.editor.doc.findLineAt(range.end), lastLine = _ref1[0], offset = _ref1[1];
+ if ((lastLine != null) && lastLine === firstLine) {
+ lastLine = lastLine.next;
+ }
+ while ((firstLine != null) && firstLine !== lastLine) {
+ formatsArr.push(_.clone(firstLine.formats));
+ firstLine = firstLine.next;
+ }
+ return this._intersectFormats(formatsArr);
+ };
+
+ Toolbar.prototype._intersectFormats = function(formatsArr) {
+ return _.reduce(formatsArr.slice(1), function(activeFormats, formats) {
+ var activeKeys, added, formatKeys, intersection, missing;
+ activeKeys = _.keys(activeFormats);
+ formatKeys = _.keys(formats);
+ intersection = _.intersection(activeKeys, formatKeys);
+ missing = _.difference(activeKeys, formatKeys);
+ added = _.difference(formatKeys, activeKeys);
+ _.each(intersection, function(name) {
+ if (Toolbar.formats.SELECT[name] != null) {
+ if (_.isArray(activeFormats[name])) {
+ if (_.indexOf(activeFormats[name], formats[name]) < 0) {
+ return activeFormats[name].push(formats[name]);
+ }
+ } else if (activeFormats[name] !== formats[name]) {
+ return activeFormats[name] = [activeFormats[name], formats[name]];
+ }
+ }
+ });
+ _.each(missing, function(name) {
+ if (Toolbar.formats.TOGGLE[name] != null) {
+ return delete activeFormats[name];
+ } else if ((Toolbar.formats.SELECT[name] != null) && !_.isArray(activeFormats[name])) {
+ return activeFormats[name] = [activeFormats[name]];
+ }
+ });
+ _.each(added, function(name) {
+ if (Toolbar.formats.SELECT[name] != null) {
+ return activeFormats[name] = [formats[name]];
+ }
+ });
+ return activeFormats;
+ }, formatsArr[0] || {});
+ };
+
+ return Toolbar;
+
+})();
+
+module.exports = Toolbar;
+
+
+},{"../dom":15,"../utils":39,"lodash":"M4+//f"}],31:[function(_dereq_,module,exports){
+var DOM, Normalizer, Tooltip, _;
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('../dom');
+
+Normalizer = _dereq_('../normalizer');
+
+Tooltip = (function() {
+ Tooltip.DEFAULTS = {
+ offset: 10,
+ styles: {
+ '.tooltip': {
+ 'background-color': '#fff',
+ 'border': '1px solid #000',
+ 'top': '0px',
+ 'white-space': 'nowrap',
+ 'z-index': '2000'
+ },
+ '.tooltip a': {
+ 'cursor': 'pointer',
+ 'text-decoration': 'none'
+ }
+ },
+ template: ''
+ };
+
+ Tooltip.HIDE_MARGIN = '-10000px';
+
+ function Tooltip(quill, options) {
+ this.quill = quill;
+ this.options = options;
+ this.quill.addStyles(this.options.styles);
+ this.container = this.quill.addContainer('tooltip');
+ this.container.innerHTML = Normalizer.stripWhitespace(this.options.template);
+ this.container.style.position = 'absolute';
+ DOM.addEventListener(this.quill.root, 'focus', _.bind(this.hide, this));
+ this.hide();
+ this.quill.on(this.quill.constructor.events.TEXT_CHANGE, (function(_this) {
+ return function(delta, source) {
+ if (source === 'user' && _this.container.style.left !== Tooltip.HIDE_MARGIN) {
+ _this.range = null;
+ return _this.hide();
+ }
+ };
+ })(this));
+ }
+
+ Tooltip.prototype.initTextbox = function(textbox, enterCallback, escapeCallback) {
+ return DOM.addEventListener(textbox, 'keyup', (function(_this) {
+ return function(event) {
+ switch (event.which) {
+ case DOM.KEYS.ENTER:
+ return enterCallback.call(_this);
+ case DOM.KEYS.ESCAPE:
+ return escapeCallback.call(_this);
+ default:
+ return true;
+ }
+ };
+ })(this));
+ };
+
+ Tooltip.prototype.hide = function() {
+ this.container.style.left = Tooltip.HIDE_MARGIN;
+ if (this.range) {
+ this.quill.setSelection(this.range);
+ }
+ return this.range = null;
+ };
+
+ Tooltip.prototype.show = function(reference) {
+ var left, top, _ref, _ref1;
+ this.range = this.quill.getSelection();
+ _ref = this._position(reference), left = _ref[0], top = _ref[1];
+ _ref1 = this._limit(left, top), left = _ref1[0], top = _ref1[1];
+ left += this.quill.root.ownerDocument.defaultView.window.pageXOffset;
+ top += this.quill.root.ownerDocument.defaultView.window.pageYOffset;
+ this.container.style.left = "" + left + "px";
+ this.container.style.top = "" + top + "px";
+ return this.container.focus();
+ };
+
+ Tooltip.prototype._getBounds = function() {
+ var bounds, scrollX, scrollY;
+ bounds = this.quill.root.getBoundingClientRect();
+ scrollX = this.quill.root.ownerDocument.defaultView.window.pageXOffset;
+ scrollY = this.quill.root.ownerDocument.defaultView.window.pageYOffset;
+ return {
+ left: bounds.left + scrollX,
+ right: bounds.right + scrollX,
+ top: bounds.top + scrollY,
+ bottom: bounds.bottom + scrollY,
+ width: bounds.width,
+ height: bounds.height
+ };
+ };
+
+ Tooltip.prototype._limit = function(left, top) {
+ var editorRect, toolbarRect;
+ editorRect = this._getBounds();
+ toolbarRect = this.container.getBoundingClientRect();
+ left = Math.min(editorRect.right - toolbarRect.width, left);
+ left = Math.max(editorRect.left, left);
+ top = Math.min(editorRect.bottom - toolbarRect.height, top);
+ top = Math.max(editorRect.top, top);
+ return [left, top];
+ };
+
+ Tooltip.prototype._position = function(reference) {
+ var editorRect, left, referenceBounds, toolbarRect, top;
+ toolbarRect = this.container.getBoundingClientRect();
+ editorRect = this._getBounds();
+ if (reference != null) {
+ referenceBounds = reference.getBoundingClientRect();
+ left = referenceBounds.left + referenceBounds.width / 2 - toolbarRect.width / 2;
+ top = referenceBounds.top + referenceBounds.height + this.options.offset;
+ if (top + toolbarRect.height > editorRect.bottom) {
+ top = referenceBounds.top - toolbarRect.height - this.options.offset;
+ }
+ } else {
+ left = editorRect.left + editorRect.width / 2 - toolbarRect.width / 2;
+ top = editorRect.top + editorRect.height / 2 - toolbarRect.height / 2;
+ }
+ return [left, top];
+ };
+
+ return Tooltip;
+
+})();
+
+module.exports = Tooltip;
+
+
+},{"../dom":15,"../normalizer":33,"lodash":"M4+//f"}],32:[function(_dereq_,module,exports){
+var Tandem, UndoManager, _;
+
+_ = _dereq_('lodash');
+
+Tandem = _dereq_('tandem-core');
+
+UndoManager = (function() {
+ UndoManager.DEFAULTS = {
+ delay: 1000,
+ maxStack: 100
+ };
+
+ UndoManager.hotkeys = {
+ UNDO: {
+ key: 'Z',
+ metaKey: true,
+ shiftKey: false
+ },
+ REDO: {
+ key: 'Z',
+ metaKey: true,
+ shiftKey: true
+ }
+ };
+
+ function UndoManager(quill, options) {
+ this.quill = quill;
+ this.options = options != null ? options : {};
+ this.lastRecorded = 0;
+ this.emittedDelta = null;
+ this.clear();
+ this.initListeners();
+ }
+
+ UndoManager.prototype.initListeners = function() {
+ this.quill.onModuleLoad('keyboard', (function(_this) {
+ return function(keyboard) {
+ keyboard.addHotkey(UndoManager.hotkeys.UNDO, function() {
+ _this.undo();
+ return false;
+ });
+ return keyboard.addHotkey(UndoManager.hotkeys.REDO, function() {
+ _this.redo();
+ return false;
+ });
+ };
+ })(this));
+ return this.quill.on(this.quill.constructor.events.TEXT_CHANGE, (function(_this) {
+ return function(delta, origin) {
+ if (delta.isEqual(_this.emittedDelta)) {
+ _this.emittedDelta = null;
+ return;
+ }
+ _this.record(delta, _this.oldDelta);
+ return _this.oldDelta = _this.quill.getContents();
+ };
+ })(this));
+ };
+
+ UndoManager.prototype.clear = function() {
+ this.stack = {
+ undo: [],
+ redo: []
+ };
+ return this.oldDelta = this.quill.getContents();
+ };
+
+ UndoManager.prototype.record = function(changeDelta, oldDelta) {
+ var change, ignored, timestamp, undoDelta;
+ if (changeDelta.isIdentity()) {
+ return;
+ }
+ this.stack.redo = [];
+ try {
+ undoDelta = oldDelta.invert(changeDelta);
+ timestamp = new Date().getTime();
+ if (this.lastRecorded + this.options.delay > timestamp && this.stack.undo.length > 0) {
+ change = this.stack.undo.pop();
+ if (undoDelta.canCompose(change.undo) && change.redo.canCompose(changeDelta)) {
+ undoDelta = undoDelta.compose(change.undo);
+ changeDelta = change.redo.compose(changeDelta);
+ } else {
+ this.clear();
+ this.lastRecorded = timestamp;
+ }
+ } else {
+ this.lastRecorded = timestamp;
+ }
+ this.stack.undo.push({
+ redo: changeDelta,
+ undo: undoDelta
+ });
+ if (this.stack.undo.length > this.options.maxStack) {
+ return this.stack.undo.unshift();
+ }
+ } catch (_error) {
+ ignored = _error;
+ return this.clear();
+ }
+ };
+
+ UndoManager.prototype.redo = function() {
+ return this._change('redo', 'undo');
+ };
+
+ UndoManager.prototype.undo = function() {
+ return this._change('undo', 'redo');
+ };
+
+ UndoManager.prototype._getLastChangeIndex = function(delta) {
+ var lastIndex;
+ lastIndex = 0;
+ delta.apply(function(index, text) {
+ return lastIndex = Math.max(index + text.length, lastIndex);
+ }, function(index, length) {
+ return lastIndex = Math.max(index, lastIndex);
+ }, function(index, length) {
+ return lastIndex = Math.max(index + length, lastIndex);
+ });
+ return lastIndex;
+ };
+
+ UndoManager.prototype._change = function(source, dest) {
+ var change, index;
+ if (this.stack[source].length > 0) {
+ change = this.stack[source].pop();
+ this.lastRecorded = 0;
+ this.emittedDelta = change[source];
+ this.quill.updateContents(change[source], 'user');
+ this.emittedDelta = null;
+ index = this._getLastChangeIndex(change[source]);
+ this.quill.setSelection(index, index);
+ return this.stack[dest].push(change);
+ }
+ };
+
+ return UndoManager;
+
+})();
+
+module.exports = UndoManager;
+
+
+},{"lodash":"M4+//f","tandem-core":10}],33:[function(_dereq_,module,exports){
+var DOM, Normalizer, Utils, _;
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('./dom');
+
+Utils = _dereq_('./utils');
+
+Normalizer = {
+ ALIASES: {
+ 'STRONG': 'B',
+ 'EM': 'I',
+ 'DEL': 'S',
+ 'STRIKE': 'S'
+ },
+ ATTRIBUTES: {
+ 'color': 'color',
+ 'face': 'fontFamily',
+ 'size': 'fontSize'
+ },
+ STYLES: {
+ 'background-color': 'background-color',
+ 'color': 'color',
+ 'font-family': 'font-family',
+ 'font-size': 'font-size',
+ 'text-align': 'text-align'
+ },
+ TAGS: {
+ 'P': 'P',
+ 'BR': 'BR',
+ 'SPAN': 'SPAN',
+ 'B': 'B',
+ 'I': 'I',
+ 'S': 'S',
+ 'U': 'U',
+ 'A': 'A',
+ 'IMG': 'IMG',
+ 'UL': 'UL',
+ 'LI': 'LI'
+ },
+ handleBreaks: function(lineNode) {
+ var breaks;
+ breaks = _.map(lineNode.querySelectorAll(DOM.DEFAULT_BREAK_TAG));
+ _.each(breaks, (function(_this) {
+ return function(br) {
+ if ((br.nextSibling != null) && (!DOM.isIE(10) || (br.previousSibling != null))) {
+ return Utils.splitAncestors(br.nextSibling, lineNode.parentNode);
+ }
+ };
+ })(this));
+ return lineNode;
+ },
+ normalizeLine: function(lineNode) {
+ lineNode = Normalizer.wrapInline(lineNode);
+ lineNode = Normalizer.handleBreaks(lineNode);
+ lineNode = Normalizer.pullBlocks(lineNode);
+ lineNode = Normalizer.normalizeNode(lineNode);
+ Normalizer.unwrapText(lineNode);
+ return lineNode;
+ },
+ normalizeNode: function(node) {
+ if (DOM.isTextNode(node)) {
+ return node;
+ }
+ _.each(Normalizer.ATTRIBUTES, function(style, attribute) {
+ var value;
+ if (node.hasAttribute(attribute)) {
+ value = node.getAttribute(attribute);
+ if (attribute === 'size') {
+ value = Utils.convertFontSize(value);
+ }
+ node.style[style] = value;
+ return node.removeAttribute(attribute);
+ }
+ });
+ Normalizer.whitelistStyles(node);
+ return Normalizer.whitelistTags(node);
+ },
+ optimizeLine: function(lineNode) {
+ var lineNodeLength, node, nodes, _results;
+ lineNodeLength = Utils.getNodeLength(lineNode);
+ nodes = DOM.getDescendants(lineNode);
+ _results = [];
+ while (nodes.length > 0) {
+ node = nodes.pop();
+ if ((node != null ? node.parentNode : void 0) == null) {
+ continue;
+ }
+ if (DOM.EMBED_TAGS[node.tagName] != null) {
+ continue;
+ }
+ if (node.tagName === DOM.DEFAULT_BREAK_TAG) {
+ if (lineNodeLength !== 0) {
+ _results.push(DOM.removeNode(node));
+ } else {
+ _results.push(void 0);
+ }
+ } else if (Utils.getNodeLength(node) === 0) {
+ nodes.push(node.nextSibling);
+ _results.push(DOM.unwrap(node));
+ } else if ((node.previousSibling != null) && node.tagName === node.previousSibling.tagName) {
+ if (_.isEqual(DOM.getAttributes(node), DOM.getAttributes(node.previousSibling))) {
+ nodes.push(node.firstChild);
+ _results.push(Utils.mergeNodes(node.previousSibling, node));
+ } else {
+ _results.push(void 0);
+ }
+ } else {
+ _results.push(void 0);
+ }
+ }
+ return _results;
+ },
+ pullBlocks: function(lineNode) {
+ var curNode;
+ curNode = lineNode.firstChild;
+ while (curNode != null) {
+ if ((DOM.BLOCK_TAGS[curNode.tagName] != null) && curNode.tagName !== 'LI') {
+ if (curNode.previousSibling != null) {
+ Utils.splitAncestors(curNode, lineNode.parentNode);
+ }
+ if (curNode.nextSibling != null) {
+ Utils.splitAncestors(curNode.nextSibling, lineNode.parentNode);
+ }
+ if (DOM.LIST_TAGS[curNode.tagName] == null) {
+ DOM.unwrap(curNode);
+ Normalizer.pullBlocks(lineNode);
+ } else {
+ DOM.unwrap(curNode.parentNode);
+ if (lineNode.parentNode == null) {
+ lineNode = curNode;
+ }
+ }
+ break;
+ }
+ curNode = curNode.nextSibling;
+ }
+ return lineNode;
+ },
+ stripComments: function(html) {
+ return html.replace(//g, '');
+ },
+ stripWhitespace: function(html) {
+ html = html.replace(/^\s+/, '').replace(/\s+$/, '');
+ html = html.replace(/\>\s+\<');
+ return html;
+ },
+ whitelistStyles: function(node) {
+ var original, styles;
+ original = DOM.getStyles(node);
+ styles = _.omit(original, function(value, key) {
+ return Normalizer.STYLES[key] == null;
+ });
+ if (_.keys(styles).length < _.keys(original).length) {
+ if (_.keys(styles).length > 0) {
+ return DOM.setStyles(node, styles);
+ } else {
+ return node.removeAttribute('style');
+ }
+ }
+ },
+ whitelistTags: function(node) {
+ if (!DOM.isElement(node)) {
+ return node;
+ }
+ if (Normalizer.ALIASES[node.tagName] != null) {
+ node = DOM.switchTag(node, Normalizer.ALIASES[node.tagName]);
+ }
+ if (Normalizer.TAGS[node.tagName] == null) {
+ if (DOM.BLOCK_TAGS[node.tagName] != null) {
+ node = DOM.switchTag(node, DOM.DEFAULT_BLOCK_TAG);
+ } else if (!node.hasAttributes() && (node.firstChild != null)) {
+ node = DOM.unwrap(node);
+ } else {
+ node = DOM.switchTag(node, DOM.DEFAULT_INLINE_TAG);
+ }
+ }
+ return node;
+ },
+ wrapInline: function(lineNode) {
+ var blockNode, nextNode;
+ if (DOM.BLOCK_TAGS[lineNode.tagName] != null) {
+ return lineNode;
+ }
+ blockNode = lineNode.ownerDocument.createElement(DOM.DEFAULT_BLOCK_TAG);
+ lineNode.parentNode.insertBefore(blockNode, lineNode);
+ while ((lineNode != null) && (DOM.BLOCK_TAGS[lineNode.tagName] == null)) {
+ nextNode = lineNode.nextSibling;
+ blockNode.appendChild(lineNode);
+ lineNode = nextNode;
+ }
+ return blockNode;
+ },
+ unwrapText: function(lineNode) {
+ var spans;
+ spans = _.map(lineNode.querySelectorAll(DOM.DEFAULT_INLINE_TAG));
+ return _.each(spans, function(span) {
+ var attributes;
+ attributes = DOM.getAttributes(span);
+ if (_.keys(attributes).length === 0) {
+ return DOM.unwrap(span);
+ }
+ });
+ }
+};
+
+module.exports = Normalizer;
+
+
+},{"./dom":15,"./utils":39,"lodash":"M4+//f"}],34:[function(_dereq_,module,exports){
+var DOM, Editor, EventEmitter2, Format, Modules, Quill, Range, Tandem, Themes, pkg, _,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+ __slice = [].slice;
+
+_ = _dereq_('lodash');
+
+_.str = _dereq_('underscore.string');
+
+pkg = _dereq_('../package.json');
+
+EventEmitter2 = _dereq_('eventemitter2').EventEmitter2;
+
+DOM = _dereq_('./dom');
+
+Editor = _dereq_('./editor');
+
+Format = _dereq_('./format');
+
+Range = _dereq_('./lib/range');
+
+Tandem = _dereq_('tandem-core');
+
+Modules = {
+ Authorship: _dereq_('./modules/authorship'),
+ ImageTooltip: _dereq_('./modules/image-tooltip'),
+ Keyboard: _dereq_('./modules/keyboard'),
+ LinkTooltip: _dereq_('./modules/link-tooltip'),
+ MultiCursor: _dereq_('./modules/multi-cursor'),
+ PasteManager: _dereq_('./modules/paste-manager'),
+ Toolbar: _dereq_('./modules/toolbar'),
+ UndoManager: _dereq_('./modules/undo-manager')
+};
+
+Themes = {
+ Default: _dereq_('./themes/default'),
+ Snow: _dereq_('./themes/snow')
+};
+
+Quill = (function(_super) {
+ __extends(Quill, _super);
+
+ Quill.version = pkg.version;
+
+ Quill.editors = [];
+
+ Quill.Module = Modules;
+
+ Quill.Theme = Themes;
+
+ Quill.DEFAULTS = {
+ formats: ['align', 'bold', 'italic', 'strike', 'underline', 'color', 'background', 'font', 'size', 'link', 'image', 'bullet', 'list'],
+ modules: {
+ 'keyboard': true,
+ 'paste-manager': true,
+ 'undo-manager': true
+ },
+ pollInterval: 100,
+ readOnly: false,
+ theme: 'default'
+ };
+
+ Quill.events = {
+ MODULE_INIT: 'module-init',
+ POST_EVENT: 'post-event',
+ PRE_EVENT: 'pre-event',
+ SELECTION_CHANGE: 'selection-change',
+ TEXT_CHANGE: 'text-change'
+ };
+
+ Quill.sources = {
+ API: 'api',
+ SILENT: 'silent',
+ USER: 'user'
+ };
+
+ function Quill(container, options) {
+ var html, moduleOptions, themeClass;
+ if (options == null) {
+ options = {};
+ }
+ if (_.isString(container)) {
+ container = document.querySelector(container);
+ }
+ if (container == null) {
+ throw new Error('Invalid Quill container');
+ }
+ moduleOptions = _.defaults(options.modules || {}, Quill.DEFAULTS.modules);
+ html = container.innerHTML;
+ this.options = _.defaults(options, Quill.DEFAULTS);
+ this.options.modules = moduleOptions;
+ this.options.id = this.id = "quill-" + (Quill.editors.length + 1);
+ this.options.emitter = this;
+ this.modules = {};
+ this.editor = new Editor(container, this, this.options);
+ this.root = this.editor.doc.root;
+ Quill.editors.push(this);
+ this.setHTML(html, Quill.sources.SILENT);
+ themeClass = _.str.capitalize(_.str.camelize(this.options.theme));
+ this.theme = new Quill.Theme[themeClass](this, this.options);
+ _.each(this.options.modules, (function(_this) {
+ return function(option, name) {
+ return _this.addModule(name, option);
+ };
+ })(this));
+ }
+
+ Quill.prototype.addContainer = function(className, before) {
+ if (before == null) {
+ before = false;
+ }
+ return this.editor.renderer.addContainer(className, before);
+ };
+
+ Quill.prototype.addFormat = function(name, format) {
+ return this.editor.doc.addFormat(name, format);
+ };
+
+ Quill.prototype.addModule = function(name, options) {
+ var className, moduleClass;
+ className = _.str.capitalize(_.str.camelize(name));
+ moduleClass = Quill.Module[className];
+ if (moduleClass == null) {
+ throw new Error("Cannot load " + name + " module. Are you sure you included it?");
+ }
+ if (!_.isObject(options)) {
+ options = {};
+ }
+ options = _.defaults(options, this.theme.constructor.OPTIONS[name] || {}, moduleClass.DEFAULTS || {});
+ this.modules[name] = new moduleClass(this, options);
+ this.emit(Quill.events.MODULE_INIT, name, this.modules[name]);
+ return this.modules[name];
+ };
+
+ Quill.prototype.addStyles = function(styles) {
+ return this.editor.renderer.addStyles(styles);
+ };
+
+ Quill.prototype.deleteText = function(start, end, source) {
+ var delta, formats, _ref;
+ if (source == null) {
+ source = Quill.sources.API;
+ }
+ _ref = this._buildParams(start, end, {}, source), start = _ref[0], end = _ref[1], formats = _ref[2], source = _ref[3];
+ if (!(end > start)) {
+ return;
+ }
+ delta = Tandem.Delta.makeDeleteDelta(this.getLength(), start, end - start);
+ return this.editor.applyDelta(delta, source);
+ };
+
+ Quill.prototype.emit = function() {
+ var args, eventName;
+ eventName = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+ Quill.__super__.emit.apply(this, [Quill.events.PRE_EVENT, eventName].concat(__slice.call(args)));
+ Quill.__super__.emit.apply(this, [eventName].concat(__slice.call(args)));
+ return Quill.__super__.emit.apply(this, [Quill.events.POST_EVENT, eventName].concat(__slice.call(args)));
+ };
+
+ Quill.prototype.focus = function() {
+ return this.root.focus();
+ };
+
+ Quill.prototype.formatLine = function(start, end, name, value, source) {
+ var formats, line, offset, _ref, _ref1;
+ _ref = this._buildParams(start, end, name, value, source), start = _ref[0], end = _ref[1], formats = _ref[2], source = _ref[3];
+ _ref1 = this.editor.doc.findLineAt(end), line = _ref1[0], offset = _ref1[1];
+ if (line != null) {
+ end += line.length - offset;
+ }
+ return this.formatText(start, end, formats, source);
+ };
+
+ Quill.prototype.formatText = function(start, end, name, value, source) {
+ var delta, formats, _ref;
+ _ref = this._buildParams(start, end, name, value, source), start = _ref[0], end = _ref[1], formats = _ref[2], source = _ref[3];
+ formats = _.reduce(formats, (function(_this) {
+ return function(formats, value, name) {
+ var format;
+ format = _this.editor.doc.formats[name];
+ if (!(value && value !== format.config["default"])) {
+ formats[name] = null;
+ }
+ return formats;
+ };
+ })(this), formats);
+ delta = Tandem.Delta.makeRetainDelta(this.getLength(), start, end - start, formats);
+ return this.editor.applyDelta(delta, source);
+ };
+
+ Quill.prototype.getContents = function(start, end) {
+ var ops;
+ if (start == null) {
+ start = 0;
+ }
+ if (end == null) {
+ end = null;
+ }
+ if (_.isObject(start)) {
+ end = start.end;
+ start = start.start;
+ } else {
+ if (end == null) {
+ end = this.getLength();
+ }
+ }
+ ops = this.editor.getDelta().getOpsAt(start, end - start);
+ return new Tandem.Delta(0, ops);
+ };
+
+ Quill.prototype.getHTML = function() {
+ return this.root.innerHTML;
+ };
+
+ Quill.prototype.getLength = function() {
+ return this.editor.getDelta().endLength;
+ };
+
+ Quill.prototype.getModule = function(name) {
+ return this.modules[name];
+ };
+
+ Quill.prototype.getSelection = function() {
+ this.editor.checkUpdate();
+ return this.editor.selection.getRange();
+ };
+
+ Quill.prototype.getText = function(start, end) {
+ if (start == null) {
+ start = 0;
+ }
+ if (end == null) {
+ end = null;
+ }
+ return _.pluck(this.getContents(start, end).ops, 'value').join('');
+ };
+
+ Quill.prototype.insertEmbed = function(index, type, url, source) {
+ return this.insertText(index, DOM.EMBED_TEXT, type, url, source);
+ };
+
+ Quill.prototype.insertText = function(index, text, name, value, source) {
+ var delta, end, formats, _ref;
+ _ref = this._buildParams(index, 0, name, value, source), index = _ref[0], end = _ref[1], formats = _ref[2], source = _ref[3];
+ if (!(text.length > 0)) {
+ return;
+ }
+ delta = Tandem.Delta.makeInsertDelta(this.getLength(), index, text, formats);
+ return this.editor.applyDelta(delta, source);
+ };
+
+ Quill.prototype.onModuleLoad = function(name, callback) {
+ if (this.modules[name]) {
+ return callback(this.modules[name]);
+ }
+ return this.on(Quill.events.MODULE_INIT, function(moduleName, module) {
+ if (moduleName === name) {
+ return callback(module);
+ }
+ });
+ };
+
+ Quill.prototype.prepareFormat = function(name, value) {
+ var format, range;
+ format = this.editor.doc.formats[name];
+ if (format == null) {
+ return;
+ }
+ range = this.getSelection();
+ if (!(range != null ? range.isCollapsed() : void 0)) {
+ return;
+ }
+ if (format.isType(Format.types.LINE)) {
+ return this.formatLine(range, name, value, Quill.sources.USER);
+ } else {
+ return format.prepare(value);
+ }
+ };
+
+ Quill.prototype.setContents = function(delta, source) {
+ if (source == null) {
+ source = Quill.sources.API;
+ }
+ if (_.isArray(delta)) {
+ delta = {
+ startLength: this.getLength(),
+ ops: delta
+ };
+ } else {
+ delta.startLength = this.getLength();
+ }
+ return this.updateContents(delta, source);
+ };
+
+ Quill.prototype.setHTML = function(html, source) {
+ if (source == null) {
+ source = Quill.sources.API;
+ }
+ if (!html) {
+ html = "<" + DOM.DEFAULT_BLOCK_TAG + "><" + DOM.DEFAULT_BREAK_TAG + ">" + DOM.DEFAULT_BLOCK_TAG + ">";
+ }
+ this.editor.doc.setHTML(html);
+ return this.editor.checkUpdate(source);
+ };
+
+ Quill.prototype.setSelection = function(start, end, source) {
+ var range;
+ if (source == null) {
+ source = Quill.sources.API;
+ }
+ if (_.isNumber(start) && _.isNumber(end)) {
+ range = new Range(start, end);
+ } else {
+ range = start;
+ source = end || source;
+ }
+ return this.editor.selection.setRange(range, source);
+ };
+
+ Quill.prototype.updateContents = function(delta, source) {
+ if (source == null) {
+ source = Quill.sources.API;
+ }
+ delta = Tandem.Delta.makeDelta(delta);
+ return this.editor.applyDelta(delta, source);
+ };
+
+ Quill.prototype._buildParams = function() {
+ var formats, params;
+ params = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
+ if (_.isObject(params[0])) {
+ params.splice(0, 1, params[0].start, params[0].end);
+ }
+ if (_.isString(params[2])) {
+ formats = {};
+ formats[params[2]] = params[3];
+ params.splice(2, 2, formats);
+ }
+ if (params[3] == null) {
+ params[3] = Quill.sources.API;
+ }
+ return params;
+ };
+
+ return Quill;
+
+})(EventEmitter2);
+
+module.exports = Quill;
+
+
+},{"../package.json":13,"./dom":15,"./editor":16,"./format":17,"./lib/range":22,"./modules/authorship":24,"./modules/image-tooltip":25,"./modules/keyboard":26,"./modules/link-tooltip":27,"./modules/multi-cursor":28,"./modules/paste-manager":29,"./modules/toolbar":30,"./modules/undo-manager":32,"./themes/default":37,"./themes/snow":38,"eventemitter2":3,"lodash":"M4+//f","tandem-core":10,"underscore.string":12}],35:[function(_dereq_,module,exports){
+var DEFAULT_STYLES, DOM, LIST_STYLES, Normalizer, Renderer, Utils, rule, _;
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('./dom');
+
+Utils = _dereq_('./utils');
+
+Normalizer = _dereq_('./normalizer');
+
+DEFAULT_STYLES = {
+ 'html': {
+ 'height': '100%',
+ 'width': '100%'
+ },
+ 'body': {
+ 'box-sizing': 'border-box',
+ 'cursor': 'text',
+ 'font-family': "'Helvetica', 'Arial', sans-serif",
+ 'font-size': '13px',
+ 'height': '100%',
+ 'line-height': '1.42',
+ 'margin': '0px',
+ 'overflow-x': 'hidden',
+ 'overflow-y': 'auto',
+ 'padding': '12px 15px'
+ },
+ '.editor-container': {
+ 'height': '100%',
+ 'outline': 'none',
+ 'position': 'relative',
+ 'tab-size': '4',
+ 'white-space': 'pre-wrap'
+ },
+ '.editor-container p': {
+ 'margin': '0',
+ 'padding': '0'
+ },
+ '.editor-container a': {
+ 'text-decoration': 'underline'
+ },
+ '.editor-container b': {
+ 'font-weight': 'bold'
+ },
+ '.editor-container i': {
+ 'font-style': 'italic'
+ },
+ '.editor-container s': {
+ 'text-decoration': 'line-through'
+ },
+ '.editor-container u': {
+ 'text-decoration': 'underline'
+ },
+ '.editor-container img': {
+ 'max-width': '100%'
+ },
+ '.editor-container blockquote': {
+ 'margin': '0 0 0 2em',
+ 'padding': '0'
+ },
+ '.editor-container ol': {
+ 'margin': '0 0 0 2em',
+ 'padding': '0',
+ 'list-style-type': 'decimal'
+ },
+ '.editor-container ul': {
+ 'margin': '0 0 0 2em',
+ 'padding': '0',
+ 'list-style-type': 'disc'
+ }
+};
+
+LIST_STYLES = ['decimal', 'lower-alpha', 'lower-roman'];
+
+rule = '.editor-container ol > li';
+
+_.each([1, 2, 3, 4, 5, 6, 7, 8, 9], function(i) {
+ rule += ' > ol';
+ DEFAULT_STYLES[rule] = {
+ 'list-style-type': LIST_STYLES[i % 3]
+ };
+ return rule += ' > li';
+});
+
+if (Utils.isIE(10)) {
+ DEFAULT_STYLES[DOM.DEFAULT_BREAK_TAG] = {
+ 'display': 'none'
+ };
+}
+
+Renderer = (function() {
+ Renderer.objToCss = function(obj) {
+ return _.map(obj, function(value, key) {
+ var innerStr;
+ innerStr = _.map(value, function(innerValue, innerKey) {
+ return "" + innerKey + ": " + innerValue + ";";
+ }).join(' ');
+ return "" + key + " { " + innerStr + " }";
+ }).join("\n");
+ };
+
+ Renderer.buildFrame = function(container) {
+ var iframe, iframeDoc, root;
+ iframe = container.ownerDocument.createElement('iframe');
+ DOM.setAttributes(iframe, {
+ frameBorder: '0',
+ height: '100%',
+ width: '100%',
+ title: 'Quill Rich Text Editor',
+ role: 'presentation'
+ });
+ container.appendChild(iframe);
+ iframeDoc = iframe.contentWindow.document;
+ iframeDoc.open();
+ iframeDoc.write('');
+ iframeDoc.close();
+ root = iframeDoc.createElement('div');
+ iframeDoc.body.appendChild(root);
+ return [root, iframe];
+ };
+
+ function Renderer(container, options) {
+ var _ref;
+ this.container = container;
+ this.options = options != null ? options : {};
+ this.container.innerHTML = '';
+ _ref = Renderer.buildFrame(this.container), this.root = _ref[0], this.iframe = _ref[1];
+ this.root.id = this.options.id;
+ DOM.addClass(this.root, 'editor-container');
+ DOM.addClass(this.container, 'ql-container');
+ DOM.addEventListener(this.container, 'focus', (function(_this) {
+ return function() {
+ return _this.root.focus();
+ };
+ })(this));
+ if (DOM.isIOS()) {
+ DOM.addStyles(this.container, {
+ 'overflow': 'auto',
+ '-webkit-overflow-scrolling': 'touch'
+ });
+ }
+ this.addStyles(DEFAULT_STYLES);
+ if (this.options.styles != null) {
+ _.defer(_.bind(this.addStyles, this, this.options.styles));
+ }
+ }
+
+ Renderer.prototype.addContainer = function(className, before) {
+ var container, refNode;
+ if (before == null) {
+ before = false;
+ }
+ refNode = before ? this.root : null;
+ container = this.root.ownerDocument.createElement('div');
+ DOM.addClass(container, className);
+ this.root.parentNode.insertBefore(container, refNode);
+ return container;
+ };
+
+ Renderer.prototype.addStyles = function(css) {
+ var link, style;
+ if (typeof css === 'object') {
+ style = this.root.ownerDocument.createElement('style');
+ style.type = 'text/css';
+ css = Renderer.objToCss(css);
+ style.appendChild(this.root.ownerDocument.createTextNode(css));
+ return this.root.ownerDocument.head.appendChild(style);
+ } else if (typeof css === 'string') {
+ link = this.root.ownerDocument.createElement('link');
+ DOM.setAttributes(link, {
+ type: 'text/css',
+ rel: 'stylesheet',
+ href: css
+ });
+ return this.root.ownerDocument.head.appendChild(link);
+ }
+ };
+
+ return Renderer;
+
+})();
+
+module.exports = Renderer;
+
+
+},{"./dom":15,"./normalizer":33,"./utils":39,"lodash":"M4+//f"}],36:[function(_dereq_,module,exports){
+var DOM, Leaf, Normalizer, Range, Selection, Utils, _;
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('./dom');
+
+Leaf = _dereq_('./leaf');
+
+Normalizer = _dereq_('./normalizer');
+
+Range = _dereq_('./lib/range');
+
+Utils = _dereq_('./utils');
+
+Selection = (function() {
+ function Selection(doc, iframe, emitter) {
+ this.doc = doc;
+ this.iframe = iframe;
+ this.emitter = emitter;
+ this.document = this.doc.root.ownerDocument;
+ this.range = this.getRange();
+ this.nullDelay = false;
+ }
+
+ Selection.prototype.checkFocus = function() {
+ if (this.document.activeElement !== this.doc.root) {
+ return false;
+ }
+ if ((document.activeElement != null) && document.activeElement.tagName === 'IFRAME') {
+ return document.activeElement === this.iframe;
+ }
+ return true;
+ };
+
+ Selection.prototype.getRange = function() {
+ var end, nativeRange, start;
+ if (!this.checkFocus()) {
+ return null;
+ }
+ nativeRange = this._getNativeRange();
+ if (nativeRange == null) {
+ return null;
+ }
+ start = this._positionToIndex(nativeRange.startContainer, nativeRange.startOffset);
+ if (nativeRange.startContainer === nativeRange.endContainer && nativeRange.startOffset === nativeRange.endOffset) {
+ end = start;
+ } else {
+ end = this._positionToIndex(nativeRange.endContainer, nativeRange.endOffset);
+ }
+ return new Range(Math.min(start, end), Math.max(start, end));
+ };
+
+ Selection.prototype.preserve = function(fn) {
+ var endNode, endOffset, nativeRange, startNode, startOffset, _ref, _ref1, _ref2, _ref3;
+ nativeRange = this._getNativeRange();
+ if ((nativeRange != null) && this.checkFocus()) {
+ _ref = this._encodePosition(nativeRange.startContainer, nativeRange.startOffset), startNode = _ref[0], startOffset = _ref[1];
+ _ref1 = this._encodePosition(nativeRange.endContainer, nativeRange.endOffset), endNode = _ref1[0], endOffset = _ref1[1];
+ fn();
+ _ref2 = this._decodePosition(startNode, startOffset), startNode = _ref2[0], startOffset = _ref2[1];
+ _ref3 = this._decodePosition(endNode, endOffset), endNode = _ref3[0], endOffset = _ref3[1];
+ return this._setNativeRange(startNode, startOffset, endNode, endOffset);
+ } else {
+ return fn();
+ }
+ };
+
+ Selection.prototype.setRange = function(range, source) {
+ var endNode, endOffset, startNode, startOffset, _ref, _ref1, _ref2;
+ if (range != null) {
+ _ref = this._indexToPosition(range.start), startNode = _ref[0], startOffset = _ref[1];
+ if (range.isCollapsed()) {
+ _ref1 = [startNode, startOffset], endNode = _ref1[0], endOffset = _ref1[1];
+ } else {
+ _ref2 = this._indexToPosition(range.end), endNode = _ref2[0], endOffset = _ref2[1];
+ }
+ this._setNativeRange(startNode, startOffset, endNode, endOffset);
+ } else {
+ this._setNativeRange(null);
+ }
+ return this.update(source);
+ };
+
+ Selection.prototype.shiftAfter = function(index, length, fn) {
+ var range;
+ range = this.getRange();
+ fn();
+ if (range != null) {
+ range.shift(index, length);
+ return this.setRange(range, 'silent');
+ }
+ };
+
+ Selection.prototype.update = function(source) {
+ var emit, range;
+ range = this.getRange();
+ emit = source !== 'silent' && !Range.compare(range, this.range);
+ if (range === null && source === 'user' && !this.nullDelay) {
+ return this.nullDelay = true;
+ } else {
+ this.nullDelay = false;
+ this.range = range;
+ if (emit) {
+ return this.emitter.emit(this.emitter.constructor.events.SELECTION_CHANGE, range, source);
+ }
+ }
+ };
+
+ Selection.prototype._decodePosition = function(node, offset) {
+ var childIndex;
+ if (DOM.isElement(node)) {
+ childIndex = _.indexOf(DOM.getChildNodes(node.parentNode), node);
+ offset += childIndex;
+ node = node.parentNode;
+ }
+ return [node, offset];
+ };
+
+ Selection.prototype._encodePosition = function(node, offset) {
+ var text;
+ while (true) {
+ if (DOM.isTextNode(node) || node.tagName === DOM.DEFAULT_BREAK_TAG || (DOM.EMBED_TAGS[node.tagName] != null)) {
+ return [node, offset];
+ } else if (offset < node.childNodes.length) {
+ node = node.childNodes[offset];
+ offset = 0;
+ } else if (node.childNodes.length === 0) {
+ if (Normalizer.TAGS[node.tagName] == null) {
+ text = node.ownerDocument.createTextNode('');
+ node.appendChild(text);
+ node = text;
+ }
+ return [node, 0];
+ } else {
+ node = node.lastChild;
+ if (DOM.isElement(node)) {
+ if (node.tagName === DOM.DEFAULT_BREAK_TAG || (DOM.EMBED_TAGS[node.tagName] != null)) {
+ return [node, 1];
+ } else {
+ offset = node.childNodes.length;
+ }
+ } else {
+ return [node, Utils.getNodeLength(node)];
+ }
+ }
+ }
+ };
+
+ Selection.prototype._getNativeSelection = function() {
+ if (this.document.getSelection != null) {
+ return this.document.getSelection();
+ } else {
+ return null;
+ }
+ };
+
+ Selection.prototype._getNativeRange = function() {
+ var selection;
+ selection = this._getNativeSelection();
+ if ((selection != null ? selection.rangeCount : void 0) > 0) {
+ return selection.getRangeAt(0);
+ } else {
+ return null;
+ }
+ };
+
+ Selection.prototype._indexToPosition = function(index) {
+ var leaf, offset, _ref;
+ if (this.doc.lines.length === 0) {
+ return [this.doc.root, 0];
+ }
+ _ref = this.doc.findLeafAt(index, true), leaf = _ref[0], offset = _ref[1];
+ return this._decodePosition(leaf.node, offset);
+ };
+
+ Selection.prototype._positionToIndex = function(node, offset) {
+ var leaf, leafNode, leafOffset, line, lineOffset, _ref;
+ _ref = this._encodePosition(node, offset), leafNode = _ref[0], offset = _ref[1];
+ line = this.doc.findLine(leafNode);
+ if (line == null) {
+ return 0;
+ }
+ leaf = line.findLeaf(leafNode);
+ lineOffset = 0;
+ while (line.prev != null) {
+ line = line.prev;
+ lineOffset += line.length;
+ }
+ if (leaf == null) {
+ return lineOffset;
+ }
+ leafOffset = 0;
+ while (leaf.prev != null) {
+ leaf = leaf.prev;
+ leafOffset += leaf.length;
+ }
+ return lineOffset + leafOffset + offset;
+ };
+
+ Selection.prototype._setNativeRange = function(startNode, startOffset, endNode, endOffset) {
+ var nativeRange, selection;
+ selection = this._getNativeSelection();
+ if (!selection) {
+ return;
+ }
+ if (startNode != null) {
+ this.doc.root.focus();
+ nativeRange = this._getNativeRange();
+ if ((nativeRange == null) || startNode !== nativeRange.startContainer || startOffset !== nativeRange.startOffset || endNode !== nativeRange.endContainer || endOffset !== nativeRange.endOffset) {
+ if (nativeRange != null) {
+ selection.removeAllRanges();
+ }
+ selection.removeAllRanges();
+ nativeRange = this.document.createRange();
+ nativeRange.setStart(startNode, startOffset);
+ nativeRange.setEnd(endNode, endOffset);
+ selection.addRange(nativeRange);
+ return this.doc.root.focus();
+ }
+ } else {
+ selection.removeAllRanges();
+ return this.doc.root.blur();
+ }
+ };
+
+ return Selection;
+
+})();
+
+module.exports = Selection;
+
+
+},{"./dom":15,"./leaf":18,"./lib/range":22,"./normalizer":33,"./utils":39,"lodash":"M4+//f"}],37:[function(_dereq_,module,exports){
+var DefaultTheme;
+
+DefaultTheme = (function() {
+ DefaultTheme.OPTIONS = {};
+
+ function DefaultTheme(quill) {
+ this.quill = quill;
+ this.editor = this.quill.editor;
+ this.editorContainer = this.editor.root;
+ }
+
+ return DefaultTheme;
+
+})();
+
+module.exports = DefaultTheme;
+
+
+},{}],38:[function(_dereq_,module,exports){
+var ColorPicker, DOM, DefaultTheme, Picker, SnowTheme, _,
+ __hasProp = {}.hasOwnProperty,
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
+
+_ = _dereq_('lodash');
+
+ColorPicker = _dereq_('../../lib/color-picker');
+
+DefaultTheme = _dereq_('../default');
+
+DOM = _dereq_('../../dom');
+
+Picker = _dereq_('../../lib/picker');
+
+SnowTheme = (function(_super) {
+ __extends(SnowTheme, _super);
+
+ SnowTheme.COLORS = ["#000000", "#e60000", "#ff9900", "#ffff00", "#008A00", "#0066cc", "#9933ff", "#ffffff", "#facccc", "#ffebcc", "#ffffcc", "#cce8cc", "#cce0f5", "#ebd6ff", "#bbbbbb", "#f06666", "#ffc266", "#ffff66", "#66b966", "#66a3e0", "#c285ff", "#888888", "#a10000", "#b26b00", "#b2b200", "#006100", "#0047b2", "#6b24b2", "#444444", "#5c0000", "#663d00", "#666600", "#003700", "#002966", "#3d1466"];
+
+ SnowTheme.OPTIONS = {
+ 'multi-cursor': {
+ template: ' '
+ }
+ };
+
+ SnowTheme.STYLES = {
+ '.snow .image-tooltip-container a': {
+ 'border': '1px solid #06c'
+ },
+ '.snow .image-tooltip-container a.insert': {
+ 'background-color': '#06c',
+ 'color': '#fff'
+ },
+ '.snow .cursor-name': {
+ 'border-radius': '4px',
+ 'font-size': '11px',
+ 'font-family': 'Arial',
+ 'margin-left': '-50%',
+ 'padding': '4px 10px'
+ },
+ '.snow .cursor-triangle': {
+ 'border-left': '4px solid transparent',
+ 'border-right': '4px solid transparent',
+ 'height': '0px',
+ 'margin-left': '-3px',
+ 'width': '0px'
+ },
+ '.snow .cursor.left .cursor-name': {
+ 'margin-left': '-8px'
+ },
+ '.snow .cursor.right .cursor-flag': {
+ 'right': 'auto'
+ },
+ '.snow .cursor.right .cursor-name': {
+ 'margin-left': '-100%',
+ 'margin-right': '-8px'
+ },
+ '.snow .cursor-triangle.bottom': {
+ 'border-top': '4px solid transparent',
+ 'display': 'block',
+ 'margin-bottom': '-1px'
+ },
+ '.snow .cursor-triangle.top': {
+ 'border-bottom': '4px solid transparent',
+ 'display': 'none',
+ 'margin-top': '-1px'
+ },
+ '.snow .cursor.top .cursor-triangle.bottom': {
+ 'display': 'none'
+ },
+ '.snow .cursor.top .cursor-triangle.top': {
+ 'display': 'block'
+ },
+ '.snow a': {
+ 'color': '#06c'
+ },
+ '.snow .tooltip': {
+ 'border': '1px solid #ccc',
+ 'box-shadow': '0px 0px 5px #ddd',
+ 'color': '#222'
+ },
+ '.snow .tooltip a': {
+ 'color': '#06c'
+ },
+ '.snow .tooltip .input': {
+ 'border': '1px solid #ccc',
+ 'margin': '0px',
+ 'padding': '5px'
+ },
+ '.snow .image-tooltip-container .preview': {
+ 'border-color': '#ccc',
+ 'color': '#ccc'
+ },
+ '.snow .link-tooltip-container a, .snow .link-tooltip-container span': {
+ 'display': 'inline-block',
+ 'line-height': '25px'
+ }
+ };
+
+ function SnowTheme(quill) {
+ this.quill = quill;
+ SnowTheme.__super__.constructor.apply(this, arguments);
+ this.quill.addStyles(SnowTheme.STYLES);
+ this.pickers = [];
+ this.quill.on(this.quill.constructor.events.SELECTION_CHANGE, (function(_this) {
+ return function(range) {
+ if (range != null) {
+ return _.invoke(_this.pickers, 'close');
+ }
+ };
+ })(this));
+ DOM.addClass(this.quill.root.ownerDocument.body, 'snow');
+ this.quill.onModuleLoad('multi-cursor', _.bind(this.extendMultiCursor, this));
+ this.quill.onModuleLoad('toolbar', _.bind(this.extendToolbar, this));
+ }
+
+ SnowTheme.prototype.extendMultiCursor = function(module) {
+ return module.on(module.constructor.events.CURSOR_ADDED, function(cursor) {
+ var bottomTriangle, topTriangle;
+ bottomTriangle = cursor.elem.querySelector('.cursor-triangle.bottom');
+ topTriangle = cursor.elem.querySelector('.cursor-triangle.top');
+ return bottomTriangle.style.borderTopColor = topTriangle.style.borderBottomColor = cursor.color;
+ });
+ };
+
+ SnowTheme.prototype.extendToolbar = function(module) {
+ _.each(['color', 'background', 'font', 'size', 'align'], (function(_this) {
+ return function(format) {
+ var picker, select;
+ select = module.container.querySelector(".ql-" + format);
+ if (select == null) {
+ return;
+ }
+ switch (format) {
+ case 'font':
+ case 'size':
+ case 'align':
+ picker = new Picker(select);
+ break;
+ case 'color':
+ case 'background':
+ picker = new ColorPicker(select);
+ _.each(picker.container.querySelectorAll('.ql-picker-item'), function(item, i) {
+ if (i < 7) {
+ return DOM.addClass(item, 'ql-primary-color');
+ }
+ });
+ }
+ if (picker != null) {
+ return _this.pickers.push(picker);
+ }
+ };
+ })(this));
+ return _.each(DOM.getTextNodes(module.container), function(node) {
+ if (DOM.getText(node).trim().length === 0) {
+ return DOM.removeNode(node);
+ }
+ });
+ };
+
+ return SnowTheme;
+
+})(DefaultTheme);
+
+module.exports = SnowTheme;
+
+
+},{"../../dom":15,"../../lib/color-picker":19,"../../lib/picker":21,"../default":37,"lodash":"M4+//f"}],39:[function(_dereq_,module,exports){
+var DOM, Utils, _;
+
+_ = _dereq_('lodash');
+
+DOM = _dereq_('./dom');
+
+Utils = {
+ convertFontSize: function(size) {
+ var i, s, sources, targets;
+ if (_.isString(size) && size.indexOf('px') > -1) {
+ sources = _.keys(DOM.FONT_SIZES);
+ targets = _.values(DOM.FONT_SIZES);
+ } else {
+ targets = _.keys(DOM.FONT_SIZES);
+ sources = _.values(DOM.FONT_SIZES);
+ }
+ for (i in sources) {
+ s = sources[i];
+ if (parseInt(size) <= parseInt(s)) {
+ return targets[i];
+ }
+ }
+ return _.last(targets);
+ },
+ getChildAtOffset: function(node, offset) {
+ var child, length;
+ child = node.firstChild;
+ length = Utils.getNodeLength(child);
+ while (child != null) {
+ if (offset < length) {
+ break;
+ }
+ offset -= length;
+ child = child.nextSibling;
+ length = Utils.getNodeLength(child);
+ }
+ if (child == null) {
+ child = node.lastChild;
+ offset = Utils.getNodeLength(child);
+ }
+ return [child, offset];
+ },
+ getNextLineNode: function(curNode, root) {
+ var nextNode;
+ nextNode = curNode.nextSibling;
+ if ((nextNode == null) && curNode.parentNode !== root) {
+ nextNode = curNode.parentNode.nextSibling;
+ }
+ if ((nextNode != null) && (DOM.LIST_TAGS[nextNode.tagName] != null)) {
+ nextNode = nextNode.firstChild;
+ }
+ return nextNode;
+ },
+ getNodeLength: function(node) {
+ var length;
+ if (node == null) {
+ return 0;
+ }
+ length = DOM.getText(node).length;
+ if (DOM.isElement(node)) {
+ length += node.querySelectorAll(_.keys(DOM.EMBED_TAGS).join(',')).length;
+ }
+ return length;
+ },
+ isIE: function(maxVersion) {
+ var version;
+ version = document.documentMode;
+ return version && maxVersion >= version;
+ },
+ mergeNodes: function(newNode, oldNode) {
+ var text;
+ if (DOM.isElement(newNode)) {
+ DOM.moveChildren(newNode, oldNode);
+ DOM.normalize(newNode);
+ } else {
+ text = DOM.getText(newNode) + DOM.getText(oldNode);
+ DOM.setText(newNode, text);
+ }
+ return DOM.removeNode(oldNode);
+ },
+ splitAncestors: function(refNode, root, force) {
+ var nextNode, parentClone, parentNode;
+ if (force == null) {
+ force = false;
+ }
+ if (refNode === root || refNode.parentNode === root) {
+ return refNode;
+ }
+ if ((refNode.previousSibling != null) || force) {
+ parentNode = refNode.parentNode;
+ parentClone = parentNode.cloneNode(false);
+ parentNode.parentNode.insertBefore(parentClone, parentNode.nextSibling);
+ while (refNode != null) {
+ nextNode = refNode.nextSibling;
+ parentClone.appendChild(refNode);
+ refNode = nextNode;
+ }
+ return Utils.splitAncestors(parentClone, root);
+ } else {
+ return Utils.splitAncestors(refNode.parentNode, root);
+ }
+ },
+ splitNode: function(node, offset, force) {
+ var after, child, childLeft, childRight, left, nextRight, nodeLength, right, _ref, _ref1;
+ if (force == null) {
+ force = false;
+ }
+ nodeLength = Utils.getNodeLength(node);
+ offset = Math.max(0, offset);
+ offset = Math.min(offset, nodeLength);
+ if (!(force || offset !== 0)) {
+ return [node.previousSibling, node, false];
+ }
+ if (!(force || offset !== nodeLength)) {
+ return [node, node.nextSibling, false];
+ }
+ if (node.nodeType === DOM.TEXT_NODE) {
+ after = node.splitText(offset);
+ return [node, after, true];
+ } else {
+ left = node;
+ right = node.cloneNode(false);
+ node.parentNode.insertBefore(right, left.nextSibling);
+ _ref = Utils.getChildAtOffset(node, offset), child = _ref[0], offset = _ref[1];
+ _ref1 = Utils.splitNode(child, offset), childLeft = _ref1[0], childRight = _ref1[1];
+ while (childRight !== null) {
+ nextRight = childRight.nextSibling;
+ right.appendChild(childRight);
+ childRight = nextRight;
+ }
+ return [left, right, true];
+ }
+ }
+};
+
+module.exports = Utils;
+
+
+},{"./dom":15,"lodash":"M4+//f"}]},{},[34])
+(34)
+});
\ No newline at end of file
diff --git a/dist/quill.min.js b/dist/quill.min.js
new file mode 100644
index 0000000000..4c0957c376
--- /dev/null
+++ b/dist/quill.min.js
@@ -0,0 +1,10 @@
+/*! Quill Editor v0.15.3
+ * https://quilljs.com/
+ * Copyright (c) 2014, Jason Chen
+ * Copyright (c) 2013, salesforce.com
+ */
+!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.Quill=a()}}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};a[g][0].call(j.exports,function(b){var c=a[g][1][b];return e(c?c:b)},j,j.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g-1?0:-1:a?0:-1}function g(a){var b=this.cache,c=typeof a;if("boolean"==c||null==a)b[a]=!0;else{"number"!=c&&"string"!=c&&(c="object");var d="number"==c?a:fb+a,e=b[c]||(b[c]={});"object"==c?(e[d]||(e[d]=[])).push(a):e[d]=!0}}function h(a){var b=-1,c=a.length,d=a[0],e=a[c/2|0],f=a[c-1];if(d&&"object"==typeof d&&e&&"object"==typeof e&&f&&"object"==typeof f)return!1;var h=j();h["false"]=h["null"]=h["true"]=h.undefined=!1;var i=j();for(i.array=a,i.cache=h,i.push=g;++be?0:e);++d=gb&&d===e,j=[];if(i){var k=h(b);k?(d=f,b=k):i=!1}for(;++c-1:void 0});return e.pop(),f.pop(),s&&(k(e),k(f)),g}function w(a,b,c,d,e,f){var g=1&b,h=2&b,i=4&b,j=16&b,k=32&b;if(!h&&!E(a))throw new TypeError;j&&!c.length&&(b&=-17,j=c=!1),k&&!d.length&&(b&=-33,k=d=!1);var l=a&&a.__bindData__;if(l&&l!==!0)return l=m(l),l[2]&&(l[2]=m(l[2])),l[3]&&(l[3]=m(l[3])),!g||1&l[1]||(l[4]=e),!g&&1&l[1]&&(b|=8),!i||4&l[1]||(l[5]=f),j&&Ib.apply(l[2]||(l[2]=[]),c),k&&Jb.apply(l[3]||(l[3]=[]),d),l[1]|=b,w.apply(null,l);var n=1==b||17===b?o:s;return n([a,b,c,d,e,f])}function x(){var a=(a=n.indexOf)===R?e:a;return a}function y(a){return"function"==typeof a&&Fb.test(a)}function z(a){return a&&"object"==typeof a&&"number"==typeof a.length&&Eb.call(a)==lb||!1}function A(a,b,c,d){return"boolean"!=typeof b&&null!=b&&(d=c,c=b,b=!1),p(a,b,"function"==typeof c&&r(c,d,1))}function B(a,b){return a?Hb.call(a,b):!1}function C(a){return a&&1===a.nodeType||!1}function D(a,b,c,d){return v(a,b,"function"==typeof c&&r(c,d,2))}function E(a){return"function"==typeof a}function F(a){return!(!a||!wb[typeof a])}function G(a){return"number"==typeof a||a&&"object"==typeof a&&Eb.call(a)==qb||!1}function H(a){return"string"==typeof a||a&&"object"==typeof a&&Eb.call(a)==tb||!1}function I(a,b,c){var d={};if("function"!=typeof b){var e=[];Xb(a,function(a,b){e.push(b)}),e=t(e,u(arguments,!0,!1,1));for(var f=-1,g=e.length;++fc?Ob(0,d+c):c||0}else if(c){var f=U(a,b);return a[f]===b?f:-1}return e(a,b,c)}function S(){for(var a=[],b=-1,c=arguments.length,d=i(),g=x(),j=g===e,m=i();++b=gb&&h(b?a[b]:m)))}var o=a[0],p=-1,q=o?o.length:0,r=[];a:for(;++pe;){var g=e+f>>>1;c(a[g])2?w(a,17,m(arguments,2),null,b):w(a,1,null,null,b)}function W(a){if(!E(a))throw new TypeError;var b=m(arguments,1);return setTimeout(function(){a.apply(bb,b)},1)}function X(a){return w(a,16,m(arguments,1))}function Y(a,b,c){var d=typeof a;if(null==a||"function"==d)return r(a,b,c);if("object"!=d)return _(a);var e=Ub(a),f=e[0],g=a[f];return 1!=e.length||g!==g||F(g)?function(b){for(var c=e.length,d=!1;c--&&(d=v(b[e[c]],a[e[c]],null,!0)););return d}:function(a){var b=a[f];return g===b&&(0!==g||1/g==1/b)}}function Z(a){return a}function $(){}function _(a){return function(b){return b[a]}}function ab(a){var b=++eb;return String(null==a?"":a)+b}var bb,cb=[],db=[],eb=0,fb=+new Date+"",gb=75,hb=40,ib=/\w*$/,jb=/^\s*function[ \n\r\t]+\w/,kb=/\bthis\b/,lb="[object Arguments]",mb="[object Array]",nb="[object Boolean]",ob="[object Date]",pb="[object Function]",qb="[object Number]",rb="[object Object]",sb="[object RegExp]",tb="[object String]",ub={};ub[pb]=!1,ub[lb]=ub[mb]=ub[nb]=ub[ob]=ub[qb]=ub[rb]=ub[sb]=ub[tb]=!0;var vb={configurable:!1,enumerable:!1,value:null,writable:!1},wb={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},xb=wb[typeof window]&&window||this,yb=wb[typeof d]&&d&&!d.nodeType&&d,zb=wb[typeof c]&&c&&!c.nodeType&&c,Ab=zb&&zb.exports===yb&&yb,Bb=wb[typeof b]&&b;!Bb||Bb.global!==Bb&&Bb.window!==Bb||(xb=Bb);var Cb=[],Db=Object.prototype,Eb=Db.toString,Fb=RegExp("^"+String(Eb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),Gb=Function.prototype.toString,Hb=Db.hasOwnProperty,Ib=Cb.push,Jb=Cb.unshift,Kb=function(){try{var a={},b=y(b=Object.defineProperty)&&b,c=b(a,a,a)&&b}catch(d){}return c}(),Lb=y(Lb=Object.create)&&Lb,Mb=y(Mb=Array.isArray)&&Mb,Nb=y(Nb=Object.keys)&&Nb,Ob=Math.max,Pb={};Pb[mb]=Array,Pb[nb]=Boolean,Pb[ob]=Date,Pb[pb]=Function,Pb[rb]=Object,Pb[qb]=Number,Pb[sb]=RegExp,Pb[tb]=String;var Qb=n.support={};Qb.funcDecomp=!y(xb.WinRTError)&&kb.test(function(){return this}),Qb.funcNames="string"==typeof Function.name,Lb||(q=function(){function a(){}return function(b){if(F(b)){a.prototype=b;var c=new a;a.prototype=null}return c||xb.Object()}}());var Rb=Kb?function(a,b){vb.value=b,Kb(a,"__bindData__",vb)}:$,Sb=Mb||function(a){return a&&"object"==typeof a&&"number"==typeof a.length&&Eb.call(a)==mb||!1},Tb=function(a){var b,c=a,d=[];if(!c)return d;if(!wb[typeof a])return d;for(b in c)Hb.call(c,b)&&d.push(b);return d},Ub=Nb?function(a){return F(a)?Nb(a):[]}:Tb,Vb=function(a,b,c){var d,e=a,f=e;if(!e)return f;var g=arguments,h=0,i="number"==typeof c?2:g.length;if(i>3&&"function"==typeof g[i-2])var j=r(g[--i-1],g[i--],2);else i>2&&"function"==typeof g[i-1]&&(j=g[--i]);for(;++he;e++)a&&a.push(c._listeners[e]);return[c]}if("*"===o||"**"===o||c[o]){if("*"===o){for(h in c)"_listeners"!==h&&c.hasOwnProperty(h)&&(m=m.concat(f(a,b,c[h],d+1)));return m}if("**"===o){l=d+1===n||d+2===n&&"*"===p,l&&c._listeners&&(m=m.concat(f(a,b,c,n)));for(h in c)"_listeners"!==h&&c.hasOwnProperty(h)&&("*"===h||"**"===h?(c[h]._listeners&&!l&&(m=m.concat(f(a,b,c[h],n))),m=m.concat(f(a,b,c[h],d))):m=m.concat(h===p?f(a,b,c[h],d+2):f(a,b,c[h],d)));return m}m=m.concat(f(a,b,c[o],d+1))}if(i=c["*"],i&&f(a,b,i,d+1),j=c["**"])if(n>d){j._listeners&&f(a,b,j,n);for(h in j)"_listeners"!==h&&j.hasOwnProperty(h)&&(h===p?f(a,b,j[h],d+2):h===o?f(a,b,j[h],d+1):(k={},k[h]=j[h],f(a,b,{"**":k},d+1)))}else j._listeners?f(a,b,j,n):j["*"]&&j["*"]._listeners&&f(a,b,j["*"],n);return m}function g(a,b){a="string"==typeof a?a.split(this.delimiter):a.slice();for(var c=0,d=a.length;d>c+1;c++)if("**"===a[c]&&"**"===a[c+1])return;for(var e=this.listenerTree,f=a.shift();f;){if(e[f]||(e[f]={}),e=e[f],0===a.length){if(e._listeners){if("function"==typeof e._listeners)e._listeners=[e._listeners,b];else if(h(e._listeners)&&(e._listeners.push(b),!e._listeners.warned)){var g=i;"undefined"!=typeof this._events.maxListeners&&(g=this._events.maxListeners),g>0&&e._listeners.length>g&&(e._listeners.warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",e._listeners.length),console.trace())}}else e._listeners=b;return!0}f=a.shift()}return!0}var h=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},i=10;e.prototype.delimiter=".",e.prototype.setMaxListeners=function(a){this._events||b.call(this),this._events.maxListeners=a,this._conf||(this._conf={}),this._conf.maxListeners=a},e.prototype.event="",e.prototype.once=function(a,b){return this.many(a,1,b),this},e.prototype.many=function(a,b,c){function d(){0===--b&&e.off(a,d),c.apply(this,arguments)}var e=this;if("function"!=typeof c)throw new Error("many only accepts instances of Function");return d._origin=c,this.on(a,d),e},e.prototype.emit=function(){this._events||b.call(this);var a=arguments[0];if("newListener"===a&&!this.newListener&&!this._events.newListener)return!1;if(this._all){for(var c=arguments.length,d=new Array(c-1),e=1;c>e;e++)d[e-1]=arguments[e];for(e=0,c=this._all.length;c>e;e++)this.event=a,this._all[e].apply(this,d)}if("error"===a&&!(this._all||this._events.error||this.wildcard&&this.listenerTree.error))throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");var g;if(this.wildcard){g=[];var h="string"==typeof a?a.split(this.delimiter):a.slice();f.call(this,g,h,this.listenerTree,0)}else g=this._events[a];if("function"==typeof g){if(this.event=a,1===arguments.length)g.call(this);else if(arguments.length>1)switch(arguments.length){case 2:g.call(this,arguments[1]);break;case 3:g.call(this,arguments[1],arguments[2]);break;default:for(var c=arguments.length,d=new Array(c-1),e=1;c>e;e++)d[e-1]=arguments[e];g.apply(this,d)}return!0}if(g){for(var c=arguments.length,d=new Array(c-1),e=1;c>e;e++)d[e-1]=arguments[e];for(var i=g.slice(),e=0,c=i.length;c>e;e++)this.event=a,i[e].apply(this,d);return i.length>0||!!this._all}return!!this._all},e.prototype.on=function(a,c){if("function"==typeof a)return this.onAny(a),this;if("function"!=typeof c)throw new Error("on only accepts instances of Function");if(this._events||b.call(this),this.emit("newListener",a,c),this.wildcard)return g.call(this,a,c),this;if(this._events[a]){if("function"==typeof this._events[a])this._events[a]=[this._events[a],c];else if(h(this._events[a])&&(this._events[a].push(c),!this._events[a].warned)){var d=i;"undefined"!=typeof this._events.maxListeners&&(d=this._events.maxListeners),d>0&&this._events[a].length>d&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),console.trace())}}else this._events[a]=c;return this},e.prototype.onAny=function(a){if("function"!=typeof a)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),this._all.push(a),this},e.prototype.addListener=e.prototype.on,e.prototype.off=function(a,b){if("function"!=typeof b)throw new Error("removeListener only takes instances of Function");var c,d=[];if(this.wildcard){var e="string"==typeof a?a.split(this.delimiter):a.slice();d=f.call(this,null,e,this.listenerTree,0)}else{if(!this._events[a])return this;c=this._events[a],d.push({_listeners:c})}for(var g=0;gk;k++)if(c[k]===b||c[k].listener&&c[k].listener===b||c[k]._origin&&c[k]._origin===b){j=k;break}if(0>j)continue;return this.wildcard?i._listeners.splice(j,1):this._events[a].splice(j,1),0===c.length&&(this.wildcard?delete i._listeners:delete this._events[a]),this}(c===b||c.listener&&c.listener===b||c._origin&&c._origin===b)&&(this.wildcard?delete i._listeners:delete this._events[a])}return this},e.prototype.offAny=function(a){var b,c=0,d=0;if(a&&this._all&&this._all.length>0){for(b=this._all,c=0,d=b.length;d>c;c++)if(a===b[c])return b.splice(c,1),this}else this._all=[];return this},e.prototype.removeListener=e.prototype.off,e.prototype.removeAllListeners=function(a){if(0===arguments.length)return!this._events||b.call(this),this;if(this.wildcard)for(var c="string"==typeof a?a.split(this.delimiter):a.slice(),d=f.call(this,null,c,this.listenerTree,0),e=0;ec;c++)if(b=f[c],!e.isRetain(b)&&!e.isInsert(b))return!1;return!0}return!1},a.makeDelta=function(b){return new a(b.startLength,b.endLength,h.map(b.ops,function(a){return e.isInsert(a)?new d(a.value,a.attributes):e.isRetain(a)?new f(a.start,a.end,a.attributes):null}))},a.makeDeleteDelta=function(b,c,d){var e;return e=[],c>0&&e.push(new f(0,c)),b>c+d&&e.push(new f(c+d,b)),new a(b,e)},a.makeInsertDelta=function(b,c,e,g){var h;return h=[new d(e,g)],c>0&&h.unshift(new f(0,c)),b>c&&h.push(new f(c,b)),new a(b,h)},a.makeRetainDelta=function(b,c,d,e){var g;return g=[new f(c,c+d,e)],c>0&&g.unshift(new f(0,c)),b>c+d&&g.push(new f(c+d,b)),new a(b,g)},a.prototype.apply=function(a,b,c,d){var g,i,j;return null==a&&(a=function(){}),null==b&&(b=function(){}),null==c&&(c=function(){}),null==d&&(d=null),this.isIdentity()?void 0:(g=0,i=0,j=[],h.each(this.ops,function(){return function(c){return e.isInsert(c)?(a.call(d,g+i,c.value,c.attributes),i+=c.getLength()):e.isRetain(c)?(c.start>g&&(b.call(d,g+i,c.start-g),i-=c.start-g),j.push(new f(c.start+i,c.end+i,c.attributes)),g=c.end):void 0}}(this)),this.endLengthg;g++)d=i[g],b.push(e.isInsert(d)?d.value:a.substring(d.start,d.end));if(f=b.join(""),c.endLength!==f.length)throw new Error("End length of delta: "+c.endLength+" is not equal to result text: "+f.length);return f},a.prototype.canCompose=function(b){return a.isDelta(b)&&this.endLength===b.startLength},a.prototype.compact=function(){var a;return a=[],h.each(this.ops,function(b){var c;if(0!==b.getLength())return 0===a.length?a.push(b):(c=h.last(a),e.isInsert(c)&&e.isInsert(b)&&c.attributesMatch(b)?a[a.length-1]=new d(c.value+b.value,b.attributes):e.isRetain(c)&&e.isRetain(b)&&c.end===b.start&&c.attributesMatch(b)?a[a.length-1]=new f(c.start,b.end,b.attributes):a.push(b))}),this.ops=a},a.prototype.compose=function(b){var c,g,i,j,k,l,m;if(!this.canCompose(b))throw new Error("Cannot compose delta");for(g=this,c=[],m=b.ops,k=0,l=m.length;l>k;k++)if(i=m[k],e.isInsert(i))c.push(i);else{if(!e.isRetain(i))throw new Error("Invalid op in deltaB when composing");j=g.getOpsAt(i.start,i.getLength()),j=h.map(j,function(a){return e.isInsert(a)?new d(a.value,a.composeAttributes(i.attributes)):new f(a.start,a.end,a.composeAttributes(i.attributes))}),c=c.concat(j)}return new a(g.startLength,b.endLength,c)},a.prototype.decompose=function(b){var c,g,i,j,k,l;if(i=this,!a.isDelta(b))throw new Error("Decompose called when deltaA is not a Delta, type: "+typeof b);if(b.startLength!==this.startLength)throw new Error("startLength "+b.startLength+" / startLength "+this.startLength+" mismatch");if(!h.all(b.ops,function(a){return e.isInsert(a)}))throw new Error("DeltaA has retain in decompose");if(!h.all(i.ops,function(a){return e.isInsert(a)}))throw new Error("DeltaC has retain in decompose");return c=function(a,b){var d,e,f;d={};for(e in b)f=b[e],(void 0===a[e]||a[e]!==f)&&(d[e]=null!==a[e]&&"object"==typeof a[e]&&null!==f&&"object"==typeof f?c(a[e],f):f);for(e in a)f=a[e],void 0===b[e]&&(d[e]=null);return d},j=b.diff(i),l=[],k=0,h.each(j.ops,function(a){var g,j;return j=i.getOpsAt(k,a.getLength()),g=0,h.each(j,function(i){var j,k,m;if(e.isInsert(a))j=new d(a.value.substring(g,g+i.getLength()),i.attributes),l.push(j);else{if(!e.isRetain(a))throw new Error("Invalid delta in deltaB when composing");m=b.getOpsAt(a.start+g,i.getLength()),k=0,h.each(m,function(b){var d,e,h;return d=c(b.attributes,i.attributes),h=a.start+k+g,e=new f(h,h+b.getLength(),d),l.push(e),k+=b.getLength()})}return g+=i.getLength()}),k+=a.getLength()}),g=new a(j.startLength,j.endLength,l)},a.prototype.diff=function(b){var c,e,i,j,k,l,m,n;if(n=h.map([this,b],function(a){return h.map(a.ops,function(a){return null!=a.value?a.value:""}).join("")}),l=n[0],m=n[1],""!==l||""!==m){if(c=g.diffChars(l,m),c.length<=0)throw new Error("diffToDelta called with diff with length <= 0");k=0,e=0,j=[],h.each(c,function(a){return a.added?(j.push(new d(a.value)),e+=a.value.length):a.removed?k+=a.value.length:(j.push(new f(k,k+a.value.length)),k+=a.value.length,e+=a.value.length)}),i=new a(k,e,j)}else i=new a(0,0,[]);return i},b=function(a,b,c,d){var e,g;if(g=h.extend({},c),e=Math.min(a.getLength(),b.getLength()),d)if(g.transformOp=new f(g.indexA,g.indexA+e),g.indexA+=e,e===a.getLength())g.elemIndexA++;else{if(!(ei&&(f=k[i],!(e>=a+b));i++)g=f.getLength(),e+g>a&&(h=Math.max(a-e,0),d=Math.min(g-h,a+b-e-h),c.push(f.getAt(h,d))),e+=g,this.savedOpIndex+=1,this.savedOpOffset+=g;return c},a.prototype.invert=function(a){var b,c,d;if(!this.isInsertsOnly())throw new Error("Invert called on invalid delta containing non-insert ops");return b=this,c=b.compose(a),d=b.decompose(c)},a.prototype.isEqual=function(a){return a?this.startLength!==a.startLength||this.endLength!==a.endLength?!1:h.isArray(a.ops)&&this.ops.length===a.ops.length?h.all(this.ops,function(b,c){return b.isEqual(a.ops[c])}):!1:!1},a.prototype.isIdentity=function(){var a,b,c,d,f;if(this.startLength===this.endLength){if(0===this.ops.length)return!0;for(a=0,f=this.ops,c=0,d=f.length;d>c;c++){if(b=f[c],!e.isRetain(b))return!1;if(b.start!==a)return!1;if(!(0===b.numAttributes()||1===b.numAttributes()&&h.has(b.attributes,"authorId")))return!1;a=b.end}return a!==this.endLength?!1:!0}return!1},a.prototype.isInsertsOnly=function(){return h.every(this.ops,function(a){return e.isInsert(a)})},a.prototype.merge=function(b){var c;return c=h.map(b.ops,function(a){return function(b){return e.isRetain(b)?new f(b.start+a.startLength,b.end+a.startLength,b.attributes):b}}(this)),c=this.ops.concat(c),new a(this.startLength+b.startLength,c)},a.prototype.split=function(b){var c,d;if(!this.isInsertsOnly())throw new Error("Split only implemented for inserts only");if(!(b>=0&&b<=this.endLength))throw new Error("Split at invalid index");return c=[],d=[],h.reduce(this.ops,function(a,e){var f,g,h;return a+e.getLength()<=b?c.push(e):a>=b?d.push(e):(h=e.split(b-a),f=h[0],g=h[1],c.push(f),d.push(g)),a+e.getLength()},0),[new a(0,c),new a(0,d)]},a.prototype.toString=function(){return"{("+this.startLength+"->"+this.endLength+") ["+this.ops.join(", ")+"]}"},a}(),b.exports=c}).call(this)},{"./insert":6,"./op":7,"./retain":8,diff:11,lodash:"M4+//f"}],5:[function(a,b){(function(){var c,d,e,f,g,h,i,j;i=a("lodash"),c=a("./delta"),e=a("./insert"),f=a("./retain"),j={alphabet:"abcdefghijklmnopqrstuvwxyz\n\n\n\n ",booleanAttributes:{bold:[!0,!1],italic:[!0,!1],strike:[!0,!1]},nonBooleanAttributes:{"back-color":["white","black","red","blue","lime","teal","magenta","yellow"],"fore-color":["white","black","red","blue","lime","teal","magenta","yellow"],"font-name":["monospace","serif"],"font-size":["huge","large","small"]},defaultAttributeValue:{"back-color":"white","fore-color":"black","font-name":"san-serif","font-size":"normal"}},h=function(a){return null!=a?j=a:void 0},g=function(a){if(a=a||j,null==a)throw new Error("Must provide DeltaGenerator with a domain.");if(null==a.alphabet)throw new Error("Domain must define alphabet.");if(null==a.booleanAttributes)throw new Error("Domain must define booleanAttributes.");if(null==a.nonBooleanAttributes)throw new Error("Domain must define nonBooleanAttributes.");if(null==a.defaultAttributeValue)throw new Error("Domain must define defaultAttributeValue.");return{getDomain:function(){return j},getRandomString:function(b){var c;return i.map(function(){c=[];for(var a=0,d=b-1;d>=0?d>=a:a>=d;d>=0?a++:a--)c.push(a);return c}.apply(this),function(){return a.alphabet[i.random(0,a.alphabet.length-1)]}).join("")},getRandomLength:function(){var a;return a=Math.random(),.6>a?i.random(1,2):.8>a?i.random(3,4):.9>a?i.random(5,9):i.random(10,50)},insertAt:function(a,b,c){var d,f,g,h,i,j,k,l,m;for(d=h=0,l=a.ops,j=0,k=l.length;k>j&&(g=l[j],d!==b);j++){if(bo;o++){if(k=q[o],m=d===b||b0&&m){if(g=Math.min(c,k.getLength()-(b-d)),c-=g,e.isInsert(k))j=k.value.substring(0,b-d)+k.value.substring(b-d+g),j.length>0&&l.push(new e(j));
+else{if(!f.isRetain(k))throw new Error("Expected retain but got "+k);h=new f(k.start,k.start+b-d,i.clone(k.attributes)),n=new f(k.start+b-d+g,k.end,i.clone(k.attributes)),h.startr;r++){if(n=o[r],!e.isInsert(n))throw new Error("Got retainOp in reference delta!");if(-1!==n.value.indexOf("\n")){g=new f(g.start,l+n.value.indexOf("\n"),i.clone(g.attributes)),p=new f(l+n.value.indexOf("\n"),p.end,i.clone(p.attributes));break}l+=n.getLength()}}return[j,g,p]},y=function(a,b,c,d){var e,f,g,h,i,j;for(e=0,g=d[0].attributes[c],j=[],h=0,i=d.length;i>h;h++){if(f=d[h],f.attributes[c]!==g){a.end=a.start+e,b.start=a.end;break}j.push(e+=f.getLength())}return j},s=function(a,b,c,d){var g;if(e.isInsert(a))return null!=a.attributes[c]?delete a.attributes[c]:a.attributes[c]=!0;if(!f.isRetain(a))throw new Error("Expected retain but got "+a);if(null!=a.attributes[c])return delete a.attributes[c];if(g=d.getOpsAt(a.start,a.getLength()),!i.every(g,function(a){return e.isInsert(a)}))throw new Error("Formatting a retain that does not refer to an insert.");if(g.length>0){if(y(a,b,c,g),null!=g[0].attributes[c]){if(!g[0].attributes[c])throw new Error("Boolean attribute on reference delta should only be true!");return a.attributes[c]=null}return a.attributes[c]=!0}},t=function(){return function(b,c,d,g){var h,j;if(h=function(b){return i.first(null!=b?i.shuffle(i.without(a.nonBooleanAttributes[d],b)):i.shuffle(i.without(a.nonBooleanAttributes[d],a.defaultAttributeValue[d])))},e.isInsert(b))return b.attributes[d]=h(d,b.attributes[d]);if(!f.isRetain(b))throw new Error("Expected retain but got "+b);if(j=g.getOpsAt(b.start,b.getLength()),!i.every(j,function(a){return e.isInsert(a)}))throw new Error("Formatting a retain that does not refer to an insert.");return j.length>0?(y(b,c,d,j),null!=b.attributes[d]&&Math.random()<.5?delete b.attributes[d]:b.attributes[d]=h(b.attributes[d])):void 0}}(this),k=0,p=[],z=b.ops,u=0,w=z.length;w>u;u++){if(o=z[u],q=k===c||k+o.getLength()>c,d>0&&q){for(m=Math.min(d,o.getLength()-(c-k)),d-=m,A=B(o,c-k,m,h),n=A[0],l=A[1],r=A[2],p.push(n),p.push(l),p.push(r),v=0,x=g.length;x>v;v++)if(j=g[v],i.has(a.booleanAttributes,j))s(l,r,j,h);else{if(!i.has(a.nonBooleanAttributes,j))throw new Error("Received unknown attribute: "+j);t(l,r,j,h)}c+=m}else p.push(o);k+=o.getLength()}return b.endLength=i.reduce(p,function(a,b){return a+b.getLength()},0),b.ops=p,b.compact()},addRandomOp:function(b,c){var d,e,f,g,h,j,k;if(e=c.endLength-1,g=i.random(0,e),j=Math.random(),.5>j)h=this.getRandomLength(),this.insertAt(b,g,this.getRandomString(h));else if(.75>j){if(c.endLength<=1)return b;g=i.random(0,e-1),h=i.random(1,e-g),this.deleteAt(b,g,h)}else k=i.shuffle(i.keys(a.booleanAttributes).concat(i.keys(a.nonBooleanAttributes))),f=i.random(1,k.length),d=k.slice(0,f),h=i.random(1,e-g),this.formatAt(b,g,h,d,c);return b},getRandomDelta:function(a,b){var d,e,g;for(e=new c(a.endLength,a.endLength,[new f(0,a.endLength)]),b||(b=i.random(1,10)),d=g=0;b>=0?b>g:g>b;d=b>=0?++g:--g)this.addRandomOp(e,a);return e}}},d={setDomain:h,getUtils:g},b.exports=d}).call(this)},{"./delta":4,"./insert":6,"./retain":8,lodash:"M4+//f"}],6:[function(a,b){(function(){var c,d,e,f={}.hasOwnProperty,g=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};e=a("lodash"),d=a("./op"),c=function(a){function b(a,b){this.value=a,null==b&&(b={}),this.attributes=e.clone(b)}return g(b,a),b.prototype.getAt=function(a,c){return new b(this.value.substr(a,c),this.attributes)},b.prototype.getLength=function(){return this.value.length},b.prototype.isEqual=function(a){return null!=a&&this.value===a.value&&e.isEqual(this.attributes,a.attributes)},b.prototype.join=function(a){if(e.isEqual(this.attributes,a.attributes))return new b(this.value+second.value,this.attributes);throw Error},b.prototype.split=function(a){var c,d;return c=new b(this.value.substr(0,a),this.attributes),d=new b(this.value.substr(a),this.attributes),[c,d]},b.prototype.toString=function(){return"{"+this.value+", "+this.printAttributes()+"}"},b}(d),b.exports=c}).call(this)},{"./op":7,lodash:"M4+//f"}],7:[function(a,b){(function(){var c,d;d=a("lodash"),c=function(){function a(a){null==a&&(a={}),this.attributes=d.clone(a)}return a.isInsert=function(a){return null!=a&&"string"==typeof a.value},a.isRetain=function(a){return null!=a&&"number"==typeof a.start&&"number"==typeof a.end},a.prototype.addAttributes=function(a){var b,c,d;b={};for(c in a)d=a[c],void 0===this.attributes[c]&&(b[c]=d);return b},a.prototype.attributesMatch=function(a){var b;return b=a.attributes||{},d.isEqual(this.attributes,b)},a.prototype.composeAttributes=function(b){var c;return(c=function(b){return function(e,f){var g,h,i;if(!f)return e;h=d.clone(e);for(g in f)i=f[g],a.isInsert(b)&&null===i?delete h[g]:"undefined"!=typeof i&&(h[g]="object"==typeof h[g]&&"object"==typeof i&&d.all([h[g],f[g]],function(a){return null!==a})?c(h[g],i):i);return h}}(this))(this.attributes,b)},a.prototype.numAttributes=function(){return d.keys(this.attributes).length},a.prototype.printAttributes=function(){return JSON.stringify(this.attributes)},a}(),b.exports=c}).call(this)},{lodash:"M4+//f"}],8:[function(a,b){(function(){var c,d,e,f={}.hasOwnProperty,g=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};e=a("lodash"),c=a("./op"),d=function(a){function b(a,b,c){this.start=a,this.end=b,null==c&&(c={}),this.attributes=e.clone(c)}return g(b,a),b.prototype.getAt=function(a,c){return new b(this.start+a,this.start+a+c,this.attributes)},b.prototype.getLength=function(){return this.end-this.start},b.prototype.isEqual=function(a){return null!=a&&this.start===a.start&&this.end===a.end&&e.isEqual(this.attributes,a.attributes)},b.prototype.split=function(a){var c,d;return c=new b(this.start,this.start+a,this.attributes),d=new b(this.start+a,this.end,this.attributes),[c,d]},b.prototype.toString=function(){return"{{"+this.start+" - "+this.end+"), "+this.printAttributes()+"}"},b}(c),b.exports=d}).call(this)},{"./op":7,lodash:"M4+//f"}],9:[function(a,b){(function(){b.exports={Delta:a("./delta"),DeltaGen:a("./delta_generator"),Op:a("./op"),InsertOp:a("./insert"),RetainOp:a("./retain")}}).call(this)},{"./delta":4,"./delta_generator":5,"./insert":6,"./op":7,"./retain":8}],10:[function(a,b){b.exports=a("./build/tandem-core")},{"./build/tandem-core":9}],11:[function(a,b){var c=function(){function a(a){return{newPos:a.newPos,components:a.components.slice(0)}}function b(a){for(var b=[],c=0;c/g,">"),b=b.replace(/"/g,""")}var d=function(a){this.ignoreWhitespace=a};d.prototype={diff:function(b,c){if(c===b)return[{value:c}];if(!c)return[{value:b,removed:!0}];if(!b)return[{value:c,added:!0}];c=this.tokenize(c),b=this.tokenize(b);var d=c.length,e=b.length,f=d+e,g=[{newPos:-1,components:[]}],h=this.extractCommon(g[0],c,b,0);if(g[0].newPos+1>=d&&h+1>=e)return g[0].components;for(var i=1;f>=i;i++)for(var j=-1*i;i>=j;j+=2){var k,l=g[j-1],m=g[j+1];h=(m?m.newPos:0)-j,l&&(g[j-1]=void 0);var n=l&&l.newPos+1=0&&e>h;if(n||o){!n||o&&l.newPos=d&&h+1>=e)return k.components;g[j]=k}else g[j]=void 0}},pushComponent:function(a,b,c,d){var e=a[a.length-1];e&&e.added===c&&e.removed===d?a[a.length-1]={value:this.join(e.value,b),added:c,removed:d}:a.push({value:b,added:c,removed:d})},extractCommon:function(a,b,c,d){for(var e=b.length,f=c.length,g=a.newPos,h=g-d;e>g+1&&f>h+1&&this.equals(b[g+1],c[h+1]);)g++,h++,this.pushComponent(a.components,b[g],void 0,void 0);return a.newPos=g,h},equals:function(a,b){var c=/\S/;return!this.ignoreWhitespace||c.test(a)||c.test(b)?a===b:!0},join:function(a,b){return a+b},tokenize:function(a){return a}};var e=new d,f=new d(!0),g=new d;f.tokenize=g.tokenize=function(a){return b(a.split(/(\s+|\b)/))};var h=new d(!0);h.tokenize=function(a){return b(a.split(/([{}:;,]|\s+)/))};var i=new d;return i.tokenize=function(a){for(var b=[],c=a.split(/^/m),d=0;d=0;g--){for(var j=d[g],k=0;k"):e.removed&&b.push(""),b.push(c(e.value)),e.added?b.push(""):e.removed&&b.push("")}return b.join("")},convertChangesToDMP:function(a){for(var b,c=[],d=0;db)return"";for(var c="";b>0;)1&b&&(c+=a),b>>=1,a+=a;return c},l=[].slice,m=function(a){return null==a?"\\s":a.source?a.source:"["+r.escapeRegExp(a)+"]"},n={lt:"<",gt:">",quot:'"',amp:"&",apos:"'"},o={};for(var p in n)o[n[p]]=p;o["'"]="#39";var q=function(){function a(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}var b=k,c=function(){return c.cache.hasOwnProperty(arguments[0])||(c.cache[arguments[0]]=c.parse(arguments[0])),c.format.call(null,c.cache[arguments[0]],arguments)};return c.format=function(c,d){var f,g,h,i,j,k,l,m=1,n=c.length,o="",p=[];for(g=0;n>g;g++)if(o=a(c[g]),"string"===o)p.push(c[g]);else if("array"===o){if(i=c[g],i[2])for(f=d[m],h=0;h=0?"+"+f:f,k=i[4]?"0"==i[4]?"0":i[4].charAt(1):" ",l=i[6]-e(f).length,j=i[6]?b(k,l):"",p.push(i[5]?f+j:j+f)}return p.join("")},c.cache={},c.parse=function(a){for(var b=a,c=[],d=[],e=0;b;){if(null!==(c=/^[^\x25]+/.exec(b)))d.push(c[0]);else if(null!==(c=/^\x25{2}/.exec(b)))d.push("%");else{if(null===(c=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(b)))throw new Error("[_.sprintf] huh?");if(c[2]){e|=1;var f=[],g=c[2],h=[];if(null===(h=/^([a-z_][a-z_\d]*)/i.exec(g)))throw new Error("[_.sprintf] huh?");for(f.push(h[1]);""!==(g=g.substring(h[0].length));)if(null!==(h=/^\.([a-z_][a-z_\d]*)/i.exec(g)))f.push(h[1]);else{if(null===(h=/^\[(\d+)\]/.exec(g)))throw new Error("[_.sprintf] huh?");f.push(h[1])}c[2]=f}else e|=2;if(3===e)throw new Error("[_.sprintf] mixing positional and named placeholders is not (yet) supported");d.push(c)}b=b.substring(c[0].length)}return d},c}(),r={VERSION:"2.3.0",isBlank:function(a){return null==a&&(a=""),/^\s*$/.test(a)},stripTags:function(a){return null==a?"":e(a).replace(/<\/?[^>]+>/g,"")},capitalize:function(a){return a=null==a?"":e(a),a.charAt(0).toUpperCase()+a.slice(1)},chop:function(a,b){return null==a?[]:(a=e(a),b=~~b,b>0?a.match(new RegExp(".{1,"+b+"}","g")):[a])},clean:function(a){return r.strip(a).replace(/\s+/g," ")},count:function(a,b){if(null==a||null==b)return 0;a=e(a),b=e(b);for(var c=0,d=0,f=b.length;;){if(d=a.indexOf(b,d),-1===d)break;c++,d+=f}return c},chars:function(a){return null==a?[]:e(a).split("")},swapCase:function(a){return null==a?"":e(a).replace(/\S/g,function(a){return a===a.toUpperCase()?a.toLowerCase():a.toUpperCase()})},escapeHTML:function(a){return null==a?"":e(a).replace(/[&<>"']/g,function(a){return"&"+o[a]+";"})},unescapeHTML:function(a){return null==a?"":e(a).replace(/\&([^;]+);/g,function(a,b){var c;return b in n?n[b]:(c=b.match(/^#x([\da-fA-F]+)$/))?e.fromCharCode(parseInt(c[1],16)):(c=b.match(/^#(\d+)$/))?e.fromCharCode(~~c[1]):a})},escapeRegExp:function(a){return null==a?"":e(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")},splice:function(a,b,c,d){var e=r.chars(a);return e.splice(~~b,~~c,d),e.join("")},insert:function(a,b,c){return r.splice(a,b,0,c)},include:function(a,b){return""===b?!0:null==a?!1:-1!==e(a).indexOf(b)},join:function(){var a=l.call(arguments),b=a.shift();return null==b&&(b=""),a.join(b)},lines:function(a){return null==a?[]:e(a).split("\n")},reverse:function(a){return r.chars(a).reverse().join("")},startsWith:function(a,b){return""===b?!0:null==a||null==b?!1:(a=e(a),b=e(b),a.length>=b.length&&a.slice(0,b.length)===b)},endsWith:function(a,b){return""===b?!0:null==a||null==b?!1:(a=e(a),b=e(b),a.length>=b.length&&a.slice(a.length-b.length)===b)},succ:function(a){return null==a?"":(a=e(a),a.slice(0,-1)+e.fromCharCode(a.charCodeAt(a.length-1)+1))},titleize:function(a){return null==a?"":(a=e(a).toLowerCase(),a.replace(/(?:^|\s|-)\S/g,function(a){return a.toUpperCase()}))},camelize:function(a){return r.trim(a).replace(/[-_\s]+(.)?/g,function(a,b){return b?b.toUpperCase():""})},underscored:function(a){return r.trim(a).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()},dasherize:function(a){return r.trim(a).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()},classify:function(a){return r.titleize(e(a).replace(/[\W_]/g," ")).replace(/\s/g,"")},humanize:function(a){return r.capitalize(r.underscored(a).replace(/_id$/,"").replace(/_/g," "))},trim:function(a,b){return null==a?"":!b&&g?g.call(a):(b=m(b),e(a).replace(new RegExp("^"+b+"+|"+b+"+$","g"),""))},ltrim:function(a,b){return null==a?"":!b&&i?i.call(a):(b=m(b),e(a).replace(new RegExp("^"+b+"+"),""))},rtrim:function(a,b){return null==a?"":!b&&h?h.call(a):(b=m(b),e(a).replace(new RegExp(b+"+$"),""))},truncate:function(a,b,c){return null==a?"":(a=e(a),c=c||"...",b=~~b,a.length>b?a.slice(0,b)+c:a)},prune:function(a,b,c){if(null==a)return"";if(a=e(a),b=~~b,c=null!=c?e(c):"...",a.length<=b)return a;var d=function(a){return a.toUpperCase()!==a.toLowerCase()?"A":" "},f=a.slice(0,b+1).replace(/.(?=\W*\w*$)/g,d);return f=f.slice(f.length-2).match(/\w\w/)?f.replace(/\s*\S+$/,""):r.rtrim(f.slice(0,f.length-1)),(f+c).length>a.length?a:a.slice(0,f.length)+c},words:function(a,b){return r.isBlank(a)?[]:r.trim(a,b).split(b||/\s+/)},pad:function(a,b,c,d){a=null==a?"":e(a),b=~~b;var f=0;switch(c?c.length>1&&(c=c.charAt(0)):c=" ",d){case"right":return f=b-a.length,a+k(c,f);case"both":return f=b-a.length,k(c,Math.ceil(f/2))+a+k(c,Math.floor(f/2));default:return f=b-a.length,k(c,f)+a}},lpad:function(a,b,c){return r.pad(a,b,c)},rpad:function(a,b,c){return r.pad(a,b,c,"right")},lrpad:function(a,b,c){return r.pad(a,b,c,"both")},sprintf:q,vsprintf:function(a,b){return b.unshift(a),q.apply(null,b)},toNumber:function(a,b){return a?(a=r.trim(a),a.match(/^-?\d+(?:\.\d+)?$/)?j(j(a).toFixed(~~b)):0/0):0},numberFormat:function(a,b,c,d){if(isNaN(a)||null==a)return"";a=a.toFixed(~~b),d="string"==typeof d?d:",";var e=a.split("."),f=e[0],g=e[1]?(c||".")+e[1]:"";return f.replace(/(\d)(?=(?:\d{3})+$)/g,"$1"+d)+g},strRight:function(a,b){if(null==a)return"";a=e(a),b=null!=b?e(b):b;var c=b?a.indexOf(b):-1;return~c?a.slice(c+b.length,a.length):a},strRightBack:function(a,b){if(null==a)return"";a=e(a),b=null!=b?e(b):b;var c=b?a.lastIndexOf(b):-1;return~c?a.slice(c+b.length,a.length):a},strLeft:function(a,b){if(null==a)return"";a=e(a),b=null!=b?e(b):b;var c=b?a.indexOf(b):-1;return~c?a.slice(0,c):a},strLeftBack:function(a,b){if(null==a)return"";a+="",b=null!=b?""+b:b;var c=a.lastIndexOf(b);return~c?a.slice(0,c):a},toSentence:function(a,b,c,d){b=b||", ",c=c||" and ";var e=a.slice(),f=e.pop();return a.length>2&&d&&(c=r.rtrim(b)+c),e.length?e.join(b)+c+f:f},toSentenceSerial:function(){var a=l.call(arguments);return a[3]=!0,r.toSentence.apply(r,a)},slugify:function(a){if(null==a)return"";var b="ąà áäâãåæăćęèéëêìÃïîłńòóöôõøśșțùúüûñçżź",c="aaaaaaaaaceeeeeiiiilnoooooosstuuuunczz",d=new RegExp(m(b),"g");return a=e(a).toLowerCase().replace(d,function(a){var d=b.indexOf(a);return c.charAt(d)||"-"}),r.dasherize(a.replace(/[^\w\s-]/g,""))},surround:function(a,b){return[b,a,b].join("")},quote:function(a,b){return r.surround(a,b||'"')},unquote:function(a,b){return b=b||'"',a[0]===b&&a[a.length-1]===b?a.slice(1,a.length-1):a},exports:function(){var a={};for(var b in this)this.hasOwnProperty(b)&&!b.match(/^(?:include|contains|reverse)$/)&&(a[b]=this[b]);return a},repeat:function(a,b,c){if(null==a)return"";if(b=~~b,null==c)return k(e(a),b);for(var d=[];b>0;d[--b]=a);return d.join(c)},naturalCmp:function(a,b){if(a==b)return 0;if(!a)return-1;if(!b)return 1;for(var c=/(\.\d+)|(\d+)|(\D+)/g,d=e(a).toLowerCase().match(c),f=e(b).toLowerCase().match(c),g=Math.min(d.length,f.length),h=0;g>h;h++){var i=d[h],j=f[h];if(i!==j){var k=parseInt(i,10);if(!isNaN(k)){var l=parseInt(j,10);if(!isNaN(l)&&k-l)return k-l}return j>i?-1:1}}return d.length===f.length?d.length-f.length:b>a?-1:1},levenshtein:function(a,b){if(null==a&&null==b)return 0;if(null==a)return e(b).length;if(null==b)return e(a).length;a=e(a),b=e(b);for(var c,d,f=[],g=0;g<=b.length;g++)for(var h=0;h<=a.length;h++)d=g&&h?a.charAt(h-1)===b.charAt(g-1)?c:Math.min(f[h],f[h-1],c)+1:g+h,c=f[h],f[h]=d;return f.pop()},toBoolean:function(a,b,c){return"number"==typeof a&&(a=""+a),"string"!=typeof a?!!a:(a=r.trim(a),f(a,b||["true","1"])?!0:f(a,c||["false","0"])?!1:void 0)}};r.strip=r.trim,r.lstrip=r.ltrim,r.rstrip=r.rtrim,r.center=r.lrpad,r.rjust=r.lpad,r.ljust=r.rpad,r.contains=r.include,r.q=r.quote,r.toBool=r.toBoolean,"undefined"!=typeof d&&("undefined"!=typeof c&&c.exports&&(c.exports=r),d._s=r),"function"==typeof a&&a.amd&&a("underscore.string",[],function(){return r}),b._=b._||{},b._.string=b._.str=r}(this,String)},{}],13:[function(a,b){b.exports={name:"quilljs",version:"0.15.3",description:"Cross browser rich text editor",author:"Jason Chen ",homepage:"http://quilljs.com",contributors:["Byron Milligan ","Keegan Poppen "],main:"index.js",dependencies:{eventemitter2:"~0.4.13",lodash:"~2.4.1","tandem-core":"~0.6.2","underscore.string":"~2.3.3"},devDependencies:{"coffee-script":"~1.7.1",coffeeify:"~0.6.0",connect:"~3.0.1",grunt:"~0.4.3","grunt-browserify":"~2.1.0","grunt-contrib-clean":"~0.5.0","grunt-contrib-coffee":"~0.10.1","grunt-contrib-compress":"~0.9.1","grunt-contrib-concat":"~0.4.0","grunt-contrib-copy":"~0.5.0","grunt-contrib-stylus":"~0.18.0","grunt-contrib-uglify":"~0.4.0","grunt-karma":"~0.8.0","grunt-lodash":"~0.3.0","grunt-protractor-runner":"~0.2.4","grunt-shell":"~0.7.0",harp:"~0.12.1",istanbul:"~0.2.6",jquery:"~2.1.1",karma:"~0.12.0","karma-chrome-launcher":"~0.1.2","karma-coffee-preprocessor":"~0.2.1","karma-coverage":"~0.2.0","karma-firefox-launcher":"~0.1.3","karma-html2js-preprocessor":"~0.1.0","karma-jasmine":"~0.2.0","karma-phantomjs-launcher":"~0.1.2","karma-safari-launcher":"~0.1.1","karma-sauce-launcher":"~0.2.2","load-grunt-tasks":"~0.4.0",protractor:"~0.23.0",stylus:"~0.47.1",watchify:"~0.10.2"},engines:{node:">=0.10"},license:"BSD-3-Clause",repository:{type:"git",url:"https://github.com/quilljs/quill"},bugs:{url:"https://github.com/quilljs/quill/issues"},scripts:{prepublish:"grunt coffee:src",postpublish:"grunt clean:coffee",test:"grunt test"},keywords:["editor","rich text","wysiwyg"]}},{}],14:[function(a,b){var c,d,e,f,g,h,i,j,k;k=a("lodash"),c=a("./dom"),e=a("./format"),f=a("./line"),g=a("./lib/linked-list"),h=a("./normalizer"),j=a("./utils"),i=a("tandem-core"),d=function(){function a(a,b){this.root=a,null==b&&(b={}),this.formats={},k.each(b.formats,k.bind(this.addFormat,this)),this.setHTML(this.root.innerHTML)}return a.prototype.addFormat=function(a,b){return k.isObject(b)||(b=e.FORMATS[a]),null!=this.formats[a]&&console.warn("Overwriting format",a,this.formats[a]),this.formats[a]=new e(this.root.ownerDocument,b)},a.prototype.appendLine=function(a){return this.insertLineBefore(a,null)},a.prototype.findLeafAt=function(a,b){var c,d,e;return e=this.findLineAt(a),c=e[0],d=e[1],null!=c?c.findLeafAt(d,b):[null,d]},a.prototype.findLine=function(a){for(var b;null!=a&&null==c.BLOCK_TAGS[a.tagName];)a=a.parentNode;return b=null!=a?this.lineMap[a.id]:null,(null!=b?b.node:void 0)===a?b:null},a.prototype.findLineAt=function(a){var b,c;if(!(this.lines.length>0))return[null,a];if(c=this.toDelta().endLength,a===c)return[this.lines.last,this.lines.last.length];if(a>c)return[null,a-c];for(b=this.lines.first;null!=b;){if(a1&&(1===a.length&&c.removeNode(a.leaves.last.node),k.each(c.getChildNodes(b.node),function(b){return b.tagName!==c.DEFAULT_BREAK_TAG?a.node.appendChild(b):void 0})),this.removeLine(b),a.rebuild()},a.prototype.optimizeLines=function(){return k.each(this.lines.toArray(),function(a){return a.optimize(),!0})},a.prototype.rebuild=function(){var a,b,d;for(b=this.lines.toArray(),a=this.root.firstChild,null!=a&&null!=c.LIST_TAGS[a.tagName]&&(a=a.firstChild),k.each(b,function(b){return function(c){for(var d,e;c.node!==a;){if(c.node.parentNode!==b.root&&(null!=(e=c.node.parentNode)?e.parentNode:void 0)!==b.root)return b.removeLine(c);a=h.normalizeLine(a),d=b.insertLineBefore(a,c),a=j.getNextLineNode(a,b.root)}return c.outerHTML!==a.outerHTML&&(c.node=h.normalizeLine(c.node),c.rebuild()),a=j.getNextLineNode(a,b.root)}}(this)),d=[];null!=a;)a=h.normalizeLine(a),this.appendLine(a),d.push(a=j.getNextLineNode(a,this.root));return d},a.prototype.removeLine=function(a){return null!=a.node.parentNode&&c.removeNode(c.LIST_TAGS[a.node.parentNode.tagName]&&1===a.node.parentNode.childNodes.length?a.node.parentNode:a.node),delete this.lineMap[a.id],this.lines.remove(a)},a.prototype.setHTML=function(a){return a=h.stripComments(a),a=h.stripWhitespace(a),this.root.innerHTML=a,this.lines=new g,this.lineMap={},this.rebuild()},a.prototype.splitLine=function(a,b){var c,d,e,f;return b=Math.min(b,a.length-1),f=j.splitNode(a.node,b,!0),c=f[0],d=f[1],a.node=c,a.rebuild(),e=this.insertLineBefore(d,a.next),e.formats=k.clone(a.formats),e.resetContent(),e},a.prototype.toDelta=function(){var a,b;return a=this.lines.toArray(),b=k.flatten(k.map(a,function(a){return k.clone(a.delta.ops)}),!0),new i.Delta(0,b)},a}(),b.exports=d},{"./dom":15,"./format":17,"./lib/linked-list":20,"./line":23,"./normalizer":33,"./utils":39,lodash:"M4+//f","tandem-core":10}],15:[function(a,b){var c,d,e;e=a("lodash"),e.str=a("underscore.string"),d=null,c={ELEMENT_NODE:1,NOBREAK_SPACE:" ",TEXT_NODE:3,ZERO_WIDTH_NOBREAK_SPACE:"",DEFAULT_BLOCK_TAG:"P",DEFAULT_BREAK_TAG:"BR",DEFAULT_INLINE_TAG:"SPAN",EMBED_TEXT:"!",FONT_SIZES:{"10px":1,"13px":2,"16px":3,"18px":4,"24px":5,"32px":6,"48px":7},KEYS:{BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},BLOCK_TAGS:{ADDRESS:"ADDRESS",ARTICLE:"ARTICLE",ASIDE:"ASIDE",AUDIO:"AUDIO",BLOCKQUOTE:"BLOCKQUOTE",CANVAS:"CANVAS",DD:"DD",DIV:"DIV",DL:"DL",FIGCAPTION:"FIGCAPTION",FIGURE:"FIGURE",FOOTER:"FOOTER",FORM:"FORM",H1:"H1",H2:"H2",H3:"H3",H4:"H4",H5:"H5",H6:"H6",HEADER:"HEADER",HGROUP:"HGROUP",LI:"LI",OL:"OL",OUTPUT:"OUTPUT",P:"P",PRE:"PRE",SECTION:"SECTION",TABLE:"TABLE",TBODY:"TBODY",TD:"TD",TFOOT:"TFOOT",TH:"TH",THEAD:"THEAD",TR:"TR",UL:"UL",VIDEO:"VIDEO"},EMBED_TAGS:{IMG:"IMG"},LIST_TAGS:{OL:"OL",UL:"UL"},VOID_TAGS:{AREA:"AREA",BASE:"BASE",BR:"BR",COL:"COL",COMMAND:"COMMAND",EMBED:"EMBED",HR:"HR",IMG:"IMG",INPUT:"INPUT",KEYGEN:"KEYGEN",LINK:"LINK",META:"META",PARAM:"PARAM",SOURCE:"SOURCE",TRACK:"TRACK",WBR:"WBR"},addClass:function(a,b){return c.hasClass(a,b)?void 0:null!=a.classList?a.classList.add(b):null!=a.className?a.className=e.str.trim(a.className+" "+b):void 0},addEventListener:function(a,b,c){return a.addEventListener(b,function(a){var e,f;return e=!d||"keydown"!==b&&"keyup"!==b?a:d,f=c(e),f||(a.preventDefault(),a.stopPropagation()),f})},addStyles:function(a,b){return b=e.defaults(b,c.getStyles(a)),c.setStyles(a,b)},clearAttributes:function(a,b){return null==b&&(b=[]),e.isString(b)&&(b=[b]),e.each(c.getAttributes(a),function(c,d){return e.indexOf(b,d)>-1?void 0:a.removeAttribute(d)})},getAttributes:function(a){var b,c,d,e,f,g,h;if(null==a.attributes)return{};for(c={},h=a.attributes,d=f=0,g=h.length;g>f;d=++f)e=h[d],b=a.attributes[d],c[b.name]=b.value;return c},getChildNodes:function(a){return e.map(a.childNodes)},getChildren:function(a){return e.map(a.children)},getDescendants:function(a){return e.map(a.getElementsByTagName("*"))},getClasses:function(a){return a.className.split(/\s+/)},getDefaultOption:function(a){return a.querySelector("option[selected]")},getSelectValue:function(a){return a.selectedIndex>-1?a.options[a.selectedIndex].value:""},getStyles:function(a){var b,c;return c=a.getAttribute("style")||"",b=e.reduce(c.split(";"),function(a,b){var c,d,f;return f=b.split(":"),c=f[0],d=f[1],c&&d&&(c=e.str.trim(c),d=e.str.trim(d),a[c.toLowerCase()]=d),a},{})},getText:function(a){switch(a.nodeType){case c.ELEMENT_NODE:return a.tagName===c.DEFAULT_BREAK_TAG?"":null!=c.EMBED_TAGS[a.tagName]?c.EMBED_TEXT:null!=a.textContent?a.textContent:"";case c.TEXT_NODE:return a.data||"";default:return""}},getTextNodes:function(a){var b,c,d;for(d=a.ownerDocument.createTreeWalker(a,NodeFilter.SHOW_TEXT,null,!1),c=[];b=d.nextNode();)c.push(b);return c},getWindow:function(a){return a.ownerDocument.defaultView||a.ownerDocument.parentWindow},hasClass:function(a,b){return null!=a.classList?a.classList.contains(b):null!=a.className?e.indexOf(c.getClasses(a),b)>-1:!1},isElement:function(a){return(null!=a?a.nodeType:void 0)===c.ELEMENT_NODE},isTextNode:function(a){return(null!=a?a.nodeType:void 0)===c.TEXT_NODE},moveChildren:function(a,b){return e.each(c.getChildNodes(b),function(b){return a.appendChild(b)})},normalize:function(a){var b,d,e,f;for(b=a.firstChild,f=[];null!=b;)e=b.nextSibling,c.isTextNode(b)&&(0===c.getText(b).length?c.removeNode(b):c.isTextNode(e)&&(e=e.nextSibling,d=c.getText(b)+c.getText(b.nextSibling),c.setText(b,d),c.removeNode(b.nextSibling))),f.push(b=e);return f},isIE:function(a){var b;return b=document.documentMode,b&&a>=b},isIOS:function(){return/iPhone|iPad/i.test(navigator.userAgent)},removeClass:function(a,b){var d;if(c.hasClass(a,b))return null!=a.classList?a.classList.remove(b):null!=a.className?(d=c.getClasses(a),d.splice(e.indexOf(d,b),1),a.className=d.join(" ")):void 0},removeNode:function(a){var b;return null!=(b=a.parentNode)?b.removeChild(a):void 0},replaceNode:function(a,b){return b.parentNode.replaceChild(a,b),a},resetSelect:function(a,b){var d;return null==b&&(b=!0),d=c.getDefaultOption(a),null!=d?d.selected=!0:a.selectedIndex=0,b?c.triggerEvent(a,"change"):void 0},selectOption:function(a,b,d){var f;return null==d&&(d=!0),f=e.isElement(b)?b.value:b,f?a.value=f:a.selectedIndex=-1,d?c.triggerEvent(a,"change"):void 0},setAttributes:function(a,b){return e.each(b,function(b,c){return a.setAttribute(c,b)})},setStyles:function(a,b){var c;return c=e.map(b,function(a,b){return""+b+": "+a}).join("; ")+";",a.setAttribute("style",c)},setText:function(a,b){switch(a.nodeType){case c.ELEMENT_NODE:return a.textContent=b;case c.TEXT_NODE:return a.data=b}},switchTag:function(a,b){var d,f;return b=b.toUpperCase(),a.tagName===b?a:(f=a.ownerDocument.createElement(b),d=c.getAttributes(a),null==c.VOID_TAGS[b]&&this.moveChildren(f,a),a.parentNode.replaceChild(f,a),e.each(d,function(a,b){return f.setAttribute(b,a)}),f)},toggleClass:function(a,b,d){return null==d&&(d=!c.hasClass(a,b)),d?c.addClass(a,b):c.removeClass(a,b)},triggerEvent:function(a,b,f){var g,h,i;return null==f&&(f={}),e.indexOf(["keypress","keydown","keyup"],b)<0?(g=a.ownerDocument.createEvent("Event"),g.initEvent(b,f.bubbles,f.cancelable)):(g=a.ownerDocument.createEvent("KeyboardEvent"),d=e.clone(f),d.which=e.isNumber(f.key)?f.key:e.isString(f.key)?f.key.toUpperCase().charCodeAt(0):0,c.isIE(10)?(i=[],f.altKey&&i.push("Alt"),f.ctrlKey&&i.push("Control"),f.metaKey&&i.push("Meta"),f.shiftKey&&i.push("Shift"),g.initKeyboardEvent(b,f.bubbles,f.cancelable,a.ownerDocument.defaultView.window,0,0,i.join(" "),null,null)):(h=e.isFunction(g.initKeyboardEvent)?"initKeyboardEvent":"initKeyEvent",g[h](b,f.bubbles,f.cancelable,a.ownerDocument.defaultView.window,f.ctrlKey,f.altKey,f.shiftKey,f.metaKey,0,0))),a.dispatchEvent(g),d=null
+},unwrap:function(a){var b,d;return d=a.firstChild,b=a.nextSibling,e.each(c.getChildNodes(a),function(c){return a.parentNode.insertBefore(c,b)}),c.removeNode(a),d},wrap:function(a,b){var c;for(null!=b.parentNode&&b.parentNode.insertBefore(a,b),c=a;null!=c.firstChild;)c=a.firstChild;return c.appendChild(b),c}},b.exports=c},{lodash:"M4+//f","underscore.string":12}],16:[function(a,b){var c,d,e,f,g,h,i,j;j=a("lodash"),c=a("./dom"),d=a("./document"),f=a("./line"),g=a("./renderer"),h=a("./selection"),i=a("tandem-core"),e=function(){function a(a,b,c){this.iframeContainer=a,this.quill=b,this.options=null!=c?c:{},this.renderer=new g(this.iframeContainer,this.options),this.root=this.renderer.root,this.doc=new d(this.root,this.options),this.delta=this.doc.toDelta(),this.selection=new h(this.doc,this.renderer.iframe,this.quill),this.timer=setInterval(j.bind(this.checkUpdate,this),this.options.pollInterval),this.quill.on(this.quill.constructor.events.SELECTION_CHANGE,function(a){return function(b){return a.savedRange=b}}(this)),this.options.readOnly||this.enable()}return a.prototype.disable=function(){return this.enable(!1)},a.prototype.enable=function(a){return null==a&&(a=!0),this.root.setAttribute("contenteditable",a)},a.prototype.applyDelta=function(a,b){var c,d;return c=this._update(),c&&(d=c,c=c.transform(a,!0),a=a.transform(d,!1),this.delta=this.doc.toDelta()),a.isIdentity()||(a.startLength!==this.delta.endLength&&console.warn("Trying to apply delta to incorrect doc length",a,this.delta),a=this._trackDelta(function(b){return function(){return a.apply(b._insertAt,b._deleteAt,b._formatAt,b),b.selection.shiftAfter(0,0,j.bind(b.doc.optimizeLines,b.doc))}}(this)),this.delta=this.doc.toDelta(),this.innerHTML=this.root.innerHTML,a&&"silent"!==b&&this.quill.emit(this.quill.constructor.events.TEXT_CHANGE,a,b)),c&&!c.isIdentity()&&"silent"!==b?this.quill.emit(this.quill.constructor.events.TEXT_CHANGE,c,"user"):void 0},a.prototype.checkUpdate=function(a){var b,c;return null==a&&(a="user"),null==this.renderer.iframe.parentNode||null==this.root.parentNode?clearInterval(this.timer):(b=this._update(),b&&(c=this.delta,this.delta=c.compose(b),this.quill.emit(this.quill.constructor.events.TEXT_CHANGE,b,a)),b&&(a="silent"),this.selection.update(a))},a.prototype.getDelta=function(){return this.delta},a.prototype._deleteAt=function(a,b){return 0>=b?void 0:this.selection.shiftAfter(a,-1*b,function(c){return function(){var d,e,f,g,h,i,j;for(j=c.doc.findLineAt(a),f=j[0],i=j[1],d=f,g=f.length-i<=b&&i>0;null!=d&&b>0;)h=d.next,e=Math.min(d.length-i,b),0===i&&b>=d.length?c.doc.removeLine(d):d.deleteText(i,e),b-=e,d=h,i=0;return g&&f.next?c.doc.mergeLines(f,f.next):void 0}}(this))},a.prototype._formatAt=function(a,b,c,d){return this.selection.shiftAfter(a,0,function(e){return function(){var f,g,h,i,j;for(i=e.doc.findLineAt(a),g=i[0],h=i[1],j=[];null!=g&&b>0;)f=Math.min(b,g.length-h-1),g.formatText(h,f,c,d),b-=f,b>0&&g.format(c,d),b-=1,h=0,j.push(g=g.next);return j}}(this))},a.prototype._insertAt=function(a,b,d){return null==d&&(d={}),this.selection.shiftAfter(a,b.length,function(e){return function(){var f,g,h,i;return b=b.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),g=b.split("\n"),i=e.doc.findLineAt(a),f=i[0],h=i[1],j.each(g,function(a,b){var i;return null==f||f.length<=h?(b0)&&(f=e.doc.appendLine(e.root.ownerDocument.createElement(c.DEFAULT_BLOCK_TAG)),h=0,f.insertText(h,a,d),f.format(d),i=null):(f.insertText(h,a,d),bh?c:d):b=c||d,b},a.prototype._update=function(){var a;return this.innerHTML===this.root.innerHTML?!1:(a=this._trackDelta(function(a){return function(){return a.selection.preserve(j.bind(a.doc.rebuild,a.doc)),a.selection.shiftAfter(0,0,j.bind(a.doc.optimizeLines,a.doc))}}(this)),this.innerHTML=this.root.innerHTML,a.isIdentity()?!1:a)},a}(),b.exports=e},{"./document":14,"./dom":15,"./line":23,"./renderer":35,"./selection":36,lodash:"M4+//f","tandem-core":10}],17:[function(a,b){var c,d,e,f;f=a("lodash"),c=a("./dom"),e=a("./utils"),d=function(){function a(a,b){this.document=a,this.config=b}return a.types={LINE:"line"},a.FORMATS={bold:{tag:"B",prepare:"bold"},italic:{tag:"I",prepare:"italic"},underline:{tag:"U",prepare:"underline"},strike:{tag:"S",prepare:"strikeThrough"},color:{style:"color","default":"rgb(0, 0, 0)",prepare:"foreColor"},background:{style:"backgroundColor","default":"rgb(255, 255, 255)",prepare:"backColor"},font:{style:"fontFamily","default":"'Helvetica', 'Arial', sans-serif",prepare:"fontName"},size:{style:"fontSize","default":"13px",prepare:function(a,b){return a.execCommand("fontSize",!1,e.convertFontSize(b))}},link:{tag:"A",attribute:"href"},image:{tag:"IMG",attribute:"src"},align:{type:a.types.LINE,style:"textAlign","default":"left"},bullet:{type:a.types.LINE,exclude:"list",parentTag:"UL",tag:"LI"},list:{type:a.types.LINE,exclude:"bullet",parentTag:"OL",tag:"LI"}},a.prototype.add=function(b,d){var g,h,i,j;return d?this.value(b)===d?b:(f.isString(this.config.parentTag)&&(h=this.document.createElement(this.config.parentTag),c.wrap(h,b),b.parentNode.tagName===(null!=(i=b.parentNode.previousSibling)?i.tagName:void 0)&&e.mergeNodes(b.parentNode.previousSibling,b.parentNode),b.parentNode.tagName===(null!=(j=b.parentNode.nextSibling)?j.tagName:void 0)&&e.mergeNodes(b.parentNode,b.parentNode.nextSibling)),f.isString(this.config.tag)&&(g=this.document.createElement(this.config.tag),null!=c.VOID_TAGS[g.tagName]?(null!=b.parentNode&&b.parentNode.insertBefore(g,b),c.removeNode(b),b=g):b=this.isType(a.types.LINE)?c.switchTag(b,this.config.tag):c.wrap(g,b)),(f.isString(this.config.style)||f.isString(this.config.attribute)||f.isString(this.config["class"]))&&(f.isString(this.config["class"])&&(b=this.remove(b)),c.isTextNode(b)&&(b=c.wrap(this.document.createElement(c.DEFAULT_INLINE_TAG),b)),f.isString(this.config.style)&&d!==this.config["default"]&&(b.style[this.config.style]=d),f.isString(this.config.attribute)&&b.setAttribute(this.config.attribute,d),f.isString(this.config["class"])&&c.addClass(b,this.config["class"]+d)),b):this.remove(b)},a.prototype.isType=function(a){return a===this.config.type},a.prototype.match=function(a){var b,d,e,g,h;if(!c.isElement(a))return!1;if(f.isString(this.config.parentTag)&&(null!=(g=a.parentNode)?g.tagName:void 0)!==this.config.parentTag)return!1;if(f.isString(this.config.tag)&&a.tagName!==this.config.tag)return!1;if(f.isString(this.config.style)&&(!a.style[this.config.style]||a.style[this.config.style]===this.config["default"]))return!1;if(f.isString(this.config.attribute)&&!a.hasAttribute(this.config.attribute))return!1;if(f.isString(this.config["class"])){for(h=c.getClasses(a),d=0,e=h.length;e>d;d++)if(b=h[d],0===b.indexOf(this.config["class"]))return!0;return!1}return!0},a.prototype.prepare=function(a){return f.isString(this.config.prepare)?this.document.execCommand(this.config.prepare,!1,a):f.isFunction(this.config.prepare)?this.config.prepare(this.document,a):void 0},a.prototype.remove=function(b){var d,g,h,i;if(!this.match(b))return b;if(f.isString(this.config.style)&&(b.style[this.config.style]="",b.getAttribute("style")||b.removeAttribute("style")),f.isString(this.config.attribute)&&b.removeAttribute(this.config.attribute),f.isString(this.config["class"])){for(i=c.getClasses(b),g=0,h=i.length;h>g;g++)d=i[g],0===d.indexOf(this.config["class"])&&c.removeClass(b,d);b.getAttribute("class")||b.removeAttribute("class")}return f.isString(this.config.tag)&&(this.isType(a.types.LINE)?(null!=b.previousSibling&&e.splitAncestors(b,b.parentNode.parentNode),null!=b.nextSibling&&e.splitAncestors(b.nextSibling,b.parentNode.parentNode),b=c.switchTag(b,c.DEFAULT_BLOCK_TAG)):(b=c.switchTag(b,c.DEFAULT_INLINE_TAG),null!=c.EMBED_TAGS[this.config.tag]&&c.setText(b,c.EMBED_TEXT))),f.isString(this.config.parentTag)&&c.unwrap(b.parentNode),b.tagName!==c.DEFAULT_INLINE_TAG||b.hasAttributes()||(b=c.unwrap(b)),b},a.prototype.value=function(a){var b,d,e,g;if(!this.match(a))return void 0;if(f.isString(this.config.attribute))return a.getAttribute(this.config.attribute)||void 0;if(f.isString(this.config.style))return a.style[this.config.style]||void 0;if(f.isString(this.config["class"])){for(g=c.getClasses(a),d=0,e=g.length;e>d;d++)if(b=g[d],0===b.indexOf(this.config["class"]))return b.slice(this.config["class"].length)}else if(f.isString(this.config.tag))return!0;return void 0},a}(),b.exports=d},{"./dom":15,"./utils":39,lodash:"M4+//f"}],18:[function(a,b){var c,d,e,f,g,h,i={}.hasOwnProperty,j=function(a,b){function c(){this.constructor=a}for(var d in b)i.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};h=a("lodash"),c=a("./dom"),d=a("./format"),f=a("./lib/linked-list"),g=a("./utils"),e=function(a){function b(a,d){this.node=a,this.formats=h.clone(d),this.id=h.uniqueId(b.ID_PREFIX),this.text=c.getText(this.node),this.length=this.text.length}return j(b,a),b.ID_PREFIX="leaf-",b.isLeafNode=function(a){return c.isTextNode(a)||null==a.firstChild},b.prototype.getFormats=function(){return this.formats},b.prototype.deleteText=function(a,b){var d;if(b>0)return this.text=this.text.slice(0,a)+this.text.slice(a+b),this.length=this.text.length,null!=c.EMBED_TAGS[this.node.tagName]?(d=this.node.ownerDocument.createTextNode(this.text),this.node=c.replaceNode(d,this.node)):c.setText(this.node,this.text)},b.prototype.insertText=function(a,b){var d;return this.text=this.text.slice(0,a)+b+this.text.slice(a),c.isTextNode(this.node)?c.setText(this.node,this.text):(d=this.node.ownerDocument.createTextNode(b),this.node.tagName===c.DEFAULT_BREAK_TAG?c.replaceNode(d,this.node):this.node.appendChild(d),this.node=d),this.length=this.text.length},b}(f.Node),b.exports=e},{"./dom":15,"./format":17,"./lib/linked-list":20,"./utils":39,lodash:"M4+//f"}],19:[function(a,b){var c,d,e,f={}.hasOwnProperty,g=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};d=a("../dom"),e=a("./picker"),c=function(a){function b(){b.__super__.constructor.apply(this,arguments),d.addClass(this.container,"ql-color-picker")}return g(b,a),b.prototype.buildItem=function(a,c,d){var e;return e=b.__super__.buildItem.call(this,a,c,d),e.style.backgroundColor=c.value,e},b}(e),b.exports=c},{"../dom":15,"./picker":21}],20:[function(a,b){var c,d;d=function(){function a(a){this.data=a,this.prev=this.next=null}return a}(),c=function(){function a(){this.length=0,this.first=this.last=null}return a.Node=d,a.prototype.append=function(a){return null!=this.first?(a.next=null,this.last.next=a):this.first=a,a.prev=this.last,this.last=a,this.length+=1},a.prototype.insertAfter=function(a,b){return b.prev=a,null!=a?(b.next=a.next,null!=a.next&&(a.next.prev=b),a.next=b,a===this.last&&(this.last=b)):(b.next=this.first,this.first.prev=b,this.first=b),this.length+=1},a.prototype.remove=function(a){return this.length>1?(null!=a.prev&&(a.prev.next=a.next),null!=a.next&&(a.next.prev=a.prev),a===this.first&&(this.first=a.next),a===this.last&&(this.last=a.prev)):this.first=this.last=null,a.prev=a.next=null,this.length-=1},a.prototype.toArray=function(){var a,b;for(a=[],b=this.first;null!=b;)a.push(b),b=b.next;return a},a}(),b.exports=c},{}],21:[function(a,b){var c,d,e,f;f=a("lodash"),c=a("../dom"),d=a("../normalizer"),e=function(){function a(a){this.select=a,this.container=this.select.ownerDocument.createElement("span"),this.buildPicker(),c.addClass(this.container,"ql-picker"),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),c.addEventListener(this.select.ownerDocument,"click",function(a){return function(){return a.close(),!0}}(this)),c.addEventListener(this.label,"click",function(a){return function(){return f.defer(function(){return c.toggleClass(a.container,"ql-expanded")})}}(this)),c.addEventListener(this.select,"change",function(a){return function(){var b,d;return a.select.selectedIndex>-1&&(b=a.container.querySelectorAll(".ql-picker-item")[a.select.selectedIndex],d=a.select.options[a.select.selectedIndex]),a.selectItem(b,!1),c.toggleClass(a.label,"ql-active",d!==c.getDefaultOption(a.select))}}(this))}return a.TEMPLATE='',a.prototype.buildItem=function(a,b,d){var e;return e=this.select.ownerDocument.createElement("span"),e.setAttribute("data-value",b.getAttribute("value")),c.addClass(e,"ql-picker-item"),c.setText(e,c.getText(b)),this.select.selectedIndex===d&&this.selectItem(e,!1),c.addEventListener(e,"click",function(a){return function(){return a.selectItem(e,!0),a.close()}}(this)),e},a.prototype.buildPicker=function(){var b;return f.each(c.getAttributes(this.select),function(a){return function(b,c){return a.container.setAttribute(c,b)}}(this)),this.container.innerHTML=d.stripWhitespace(a.TEMPLATE),this.label=this.container.querySelector(".ql-picker-label"),b=this.container.querySelector(".ql-picker-options"),f.each(this.select.options,function(a){return function(c,d){var e;return e=a.buildItem(b,c,d),b.appendChild(e)}}(this))},a.prototype.close=function(){return c.removeClass(this.container,"ql-expanded")},a.prototype.selectItem=function(a,b){var d,e;return d=this.container.querySelector(".ql-selected"),null!=d&&c.removeClass(d,"ql-selected"),null!=a?(e=a.getAttribute("data-value"),c.addClass(a,"ql-selected"),c.setText(this.label,c.getText(a)),c.selectOption(this.select,e,b),this.label.setAttribute("data-value",e)):(this.label.innerHTML=" ",this.label.removeAttribute("data-value"))},a}(),b.exports=e},{"../dom":15,"../normalizer":33,lodash:"M4+//f"}],22:[function(a,b){var c,d;d=a("lodash"),c=function(){function a(a,b){this.start=a,this.end=b}return a.compare=function(a,b){return a===b?!0:null==a||null==b?!1:a.equals(b)},a.prototype.equals=function(a){return null==a?!1:this.start===a.start&&this.end===a.end},a.prototype.shift=function(a,b){var c;return c=d.map([this.start,this.end],function(c){return a>c?c:b>=0?c+b:Math.max(a,c+b)}),this.start=c[0],this.end=c[1],c},a.prototype.isCollapsed=function(){return this.start===this.end},a}(),b.exports=c},{lodash:"M4+//f"}],23:[function(a,b){var c,d,e,f,g,h,i,j,k,l={}.hasOwnProperty,m=function(a,b){function c(){this.constructor=a}for(var d in b)l.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};k=a("lodash"),c=a("./dom"),d=a("./format"),e=a("./leaf"),f=a("./line"),g=a("./lib/linked-list"),h=a("./normalizer"),j=a("./utils"),i=a("tandem-core"),f=function(a){function b(a,d){this.doc=a,this.node=d,this.id=k.uniqueId(b.ID_PREFIX),this.formats={},c.addClass(this.node,b.CLASS_NAME),this.rebuild(),b.__super__.constructor.call(this,this.node)}return m(b,a),b.CLASS_NAME="line",b.ID_PREFIX="line-",b.prototype.buildLeaves=function(a,b){return k.each(c.getChildNodes(a),function(a){return function(c){var f;return c=h.normalizeNode(c),f=k.clone(b),k.each(a.doc.formats,function(a,b){return!a.isType(d.types.LINE)&&a.match(c)?f[b]=a.value(c):void 0}),e.isLeafNode(c)?a.leaves.append(new e(c,f)):a.buildLeaves(c,f)}}(this))},b.prototype.deleteText=function(a,b){var c,d,e;if(b>0){for(e=this.findLeafAt(a),d=e[0],a=e[1];null!=d&&b>0;)c=Math.min(b,d.length-a),d.deleteText(a,c),b-=c,d=d.next,a=0;return this.rebuild()}},b.prototype.findLeaf=function(a){var b;for(b=this.leaves.first;null!=b;){if(b.node===a)return b;b=b.next}return null},b.prototype.findLeafAt=function(a,b){var c;if(null==b&&(b=!1),a>=this.length-1)return[this.leaves.last,this.leaves.last.length];for(c=this.leaves.first;null!=c;){if(a0;){if(k=g.next,e&&g.formats[c]!==e||!e&&null!=g.formats[c]){if(m=g.node,null!=g.formats[c])for(j.splitAncestors(m,this.node);!f.match(m);)m=m.parentNode;h>0&&(o=j.splitNode(m,h),i=o[0],m=o[1]),g.length>h+b&&(p=j.splitNode(m,b),m=p[0],l=p[1]),f.add(m,e)}b-=g.length-h,h=0,g=k}return this.rebuild()}},b.prototype.insertText=function(a,b,c){var d,e,f,g,h,i,l;return null==c&&(c={}),b.length>0?(i=this.findLeafAt(a),d=i[0],e=i[1],k.isEqual(d.formats,c)?(d.insertText(e,b),this.resetContent()):(g=k.reduce(c,function(a){return function(b,c,d){return a.doc.formats[d].add(b,c)}}(this),this.node.ownerDocument.createTextNode(b)),l=j.splitNode(d.node,e),h=l[0],f=l[1],f&&(f=j.splitAncestors(f,this.node)),this.node.insertBefore(g,f),this.rebuild())):void 0},b.prototype.optimize=function(){return h.optimizeLine(this.node),this.rebuild()},b.prototype.rebuild=function(a){return null==a&&(a=!1),!a&&null!=this.outerHTML&&this.outerHTML===this.node.outerHTML&&k.all(this.leaves.toArray(),function(a){return null!=a.node.parentNode})?!1:(this.node=h.normalizeNode(this.node),0!==j.getNodeLength(this.node)||this.node.querySelector(c.DEFAULT_BREAK_TAG)||this.node.appendChild(this.node.ownerDocument.createElement(c.DEFAULT_BREAK_TAG)),this.leaves=new g,this.formats=k.reduce(this.doc.formats,function(a){return function(b,c,e){return c.isType(d.types.LINE)&&(c.match(a.node)?b[e]=c.value(a.node):delete b[e]),b}}(this),this.formats),this.buildLeaves(this.node,{}),this.resetContent(),!0)},b.prototype.resetContent=function(){var a;return this.node.id!==this.id&&(this.node.id=this.id),this.outerHTML=this.node.outerHTML,this.length=1,a=k.map(this.leaves.toArray(),function(a){return function(b){return a.length+=b.length,new i.InsertOp(b.text,b.formats)}}(this)),a.push(new i.InsertOp("\n",this.formats)),this.delta=new i.Delta(0,this.length,a)},b}(g.Node),b.exports=f},{"./dom":15,"./format":17,"./leaf":18,"./lib/linked-list":20,"./line":23,"./normalizer":33,"./utils":39,lodash:"M4+//f","tandem-core":10}],24:[function(a,b){var c,d,e,f,g;g=a("lodash"),d=a("../dom"),e=a("../format"),f=a("tandem-core"),c=function(){function a(a,b){this.quill=a,this.options=b,null!=this.options.button&&this.attachButton(this.options.button),this.options.enabled&&this.enable(),this.quill.addFormat("author",{"class":"author-"}),null!=this.options.authorId&&(this.quill.on(this.quill.constructor.events.PRE_EVENT,function(a){return function(b,c,d){var e,h;return b===a.quill.constructor.events.TEXT_CHANGE&&"user"===d?(g.each(c.ops,function(b){return f.InsertOp.isInsert(b)||g.keys(b.attributes).length>0?b.attributes.author=a.options.authorId:void 0}),h=new f.Delta(c.endLength,[new f.RetainOp(0,c.endLength)]),e={author:a.options.authorId},c.apply(function(a,b){return h=h.compose(f.Delta.makeRetainDelta(c.endLength,a,b.length,e))},function(){},function(a,b){return h=h.compose(f.Delta.makeRetainDelta(c.endLength,a,b,e))}),a.quill.updateContents(h,"silent")):void 0}}(this)),this.addAuthor(this.options.authorId,this.options.color))}return a.DEFAULTS={authorId:null,color:"blue",enabled:!1},a.prototype.addAuthor=function(a,b){var c;return c={},c[".authorship .author-"+a]={"background-color":""+b},this.quill.addStyles(c)},a.prototype.attachButton=function(a){return d.addEventListener(a,"click",function(b){return function(){return d.toggleClass(a,"ql-on"),b.enable(d.hasClass(a,"ql-on"))}}(this))},a.prototype.enable=function(a){return null==a&&(a=!0),d.toggleClass(this.quill.root,"authorship",a)},a.prototype.disable=function(){return this.enable(!1)},a}(),b.exports=c},{"../dom":15,"../format":17,lodash:"M4+//f","tandem-core":10}],25:[function(a,b){var c,d,e,f,g={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};f=a("lodash"),c=a("../dom"),e=a("./tooltip"),d=function(a){function b(a,d){this.quill=a,this.options=d,this.options.styles=f.defaults(this.options.styles,e.DEFAULTS.styles),this.options=f.defaults(this.options,e.DEFAULTS),b.__super__.constructor.call(this,this.quill,this.options),this.preview=this.container.querySelector(".preview"),this.textbox=this.container.querySelector(".input"),c.addClass(this.container,"image-tooltip-container"),this.initListeners()}return h(b,a),b.DEFAULTS={styles:{".image-tooltip-container":{margin:"25px",padding:"10px",width:"300px"},".image-tooltip-container:after":{clear:"both",content:'""',display:"table"},".image-tooltip-container .preview":{margin:"10px 0px",position:"relative",border:"1px dashed #000",height:"200px"},".image-tooltip-container .preview span":{display:"inline-block",position:"absolute","text-align":"center",top:"40%",width:"100%"},".image-tooltip-container img":{bottom:"0",left:"0",margin:"auto","max-height":"100%","max-width":"100%",position:"absolute",right:"0",top:"0"},".image-tooltip-container .input":{"box-sizing":"border-box",width:"100%"},".image-tooltip-container a":{border:"1px solid black","box-sizing":"border-box",display:"inline-block","float":"left",padding:"5px","text-align":"center",width:"50%"}},template:' Preview
Cancel Insert'},b.prototype.initListeners=function(){return c.addEventListener(this.container.querySelector(".insert"),"click",f.bind(this.insertImage,this)),c.addEventListener(this.container.querySelector(".cancel"),"click",f.bind(this.hide,this)),c.addEventListener(this.textbox,"input",f.bind(this._preview,this)),this.initTextbox(this.textbox,this.insertImage,this.hide),this.quill.onModuleLoad("toolbar",function(a){return function(b){return b.initFormat("image",f.bind(a._onToolbar,a))}}(this))},b.prototype.insertImage=function(){var a,b;return b=this._normalizeURL(this.textbox.value),null==this.range&&(this.range=new Range(0,0)),this.range&&(this.preview.innerHTML="Preview",this.textbox.value="",a=this.range.end,this.quill.insertEmbed(a,"image",b,"user"),this.quill.setSelection(a+1,a+1)),this.hide()},b.prototype._onToolbar=function(a,b){return b?(this.textbox.value||(this.textbox.value="http://"),this.show(),this.textbox.focus(),f.defer(function(a){return function(){return a.textbox.setSelectionRange(a.textbox.value.length,a.textbox.value.length)}}(this))):this.quill.deleteText(a,"user")},b.prototype._preview=function(){var a;if(this._matchImageURL(this.textbox.value))return"IMG"===this.preview.firstChild.tagName?this.preview.firstChild.setAttribute("src",this.textbox.value):(a=this.preview.ownerDocument.createElement("img"),a.setAttribute("src",this.textbox.value),this.preview.replaceChild(a,this.preview.firstChild))},b.prototype._matchImageURL=function(a){return/^https?:\/\/.+\.(jp?g|gif|png)$/.test(a)},b.prototype._normalizeURL=function(a){return/^https?:\/\//.test(a)||(a="http://"+a),a},b}(e),b.exports=d},{"../dom":15,"./tooltip":31,lodash:"M4+//f"}],26:[function(a,b){var c,d,e,f,g;g=a("lodash"),c=a("../dom"),e=a("../line"),f=a("tandem-core"),d=function(){function a(a){this.quill=a,this.hotkeys={},this._initListeners(),this._initHotkeys(),this._initDeletes()}return a.hotkeys={BOLD:{key:"B",metaKey:!0},INDENT:{key:c.KEYS.TAB,shiftKey:!1},ITALIC:{key:"I",metaKey:!0},OUTDENT:{key:c.KEYS.TAB,shiftKey:!0},UNDERLINE:{key:"U",metaKey:!0}},a.prototype.addHotkey=function(a,b){var c,d;return a=g.isObject(a)?g.clone(a):{key:a},a.callback=b,c=g.isNumber(a.key)?a.key:a.key.toUpperCase().charCodeAt(0),null==(d=this.hotkeys)[c]&&(d[c]=[]),this.hotkeys[c].push(a)},a.prototype.toggleFormat=function(a,b){var c,d,e;return c=a.isCollapsed()?this.quill.getContents(Math.max(0,a.start-1),a.end):this.quill.getContents(a),e=0===c.ops.length||!g.all(c.ops,function(a){return a.attributes[b]}),a.isCollapsed()?this.quill.prepareFormat(b,e):this.quill.formatText(a,b,e,"user"),d=this.quill.getModule("toolbar"),null!=d?d.setActive(b,e):void 0},a.prototype._initDeletes=function(){return g.each([c.KEYS.DELETE,c.KEYS.BACKSPACE],function(a){return function(b){return a.addHotkey(b,function(){return a.quill.getLength()>1})}}(this))},a.prototype._initHotkeys=function(){return this.addHotkey(a.hotkeys.INDENT,function(a){return function(b){return a._onTab(b,!1),!1}}(this)),this.addHotkey(a.hotkeys.OUTDENT,function(){return function(){return!1}}(this)),g.each(["bold","italic","underline"],function(b){return function(c){return b.addHotkey(a.hotkeys[c.toUpperCase()],function(a){return b.toggleFormat(a,c),!1})}}(this))},a.prototype._initListeners=function(){return c.addEventListener(this.quill.root,"keydown",function(a){return function(b){var c,d;return c=!1,d=a.quill.getSelection(),g.each(a.hotkeys[b.which],function(a){return null!=a.metaKey&&b.metaKey!==a.metaKey&&b.ctrlKey!==a.metaKey||null!=a.shiftKey&&b.shiftKey!==a.shiftKey?void 0:c=a.callback(d)===!1||c}),!c}}(this))},a.prototype._onTab=function(a,b){var c;return null==b&&(b=!1),c=f.Delta.makeDelta({startLength:this.quill.getLength(),ops:[{start:0,end:a.start},{value:" "},{start:a.end,end:this.quill.getLength()}]}),this.quill.updateContents(c),this.quill.setSelection(a.start+1,a.start+1)},a}(),b.exports=d},{"../dom":15,"../line":23,lodash:"M4+//f","tandem-core":10}],27:[function(a,b){var c,d,e,f,g={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};f=a("lodash"),c=a("../dom"),e=a("./tooltip"),d=function(a){function b(a,d){this.quill=a,this.options=d,this.options.styles=f.defaults(this.options.styles,e.DEFAULTS.styles),this.options=f.defaults(this.options,e.DEFAULTS),b.__super__.constructor.call(this,this.quill,this.options),c.addClass(this.container,"link-tooltip-container"),this.textbox=this.container.querySelector(".input"),this.link=this.container.querySelector(".url"),this.initListeners()}return h(b,a),b.DEFAULTS={maxLength:50,styles:{".link-tooltip-container":{padding:"5px 10px"},".link-tooltip-container input.input":{width:"170px"},".link-tooltip-container input.input, .link-tooltip-container a.done, .link-tooltip-container.editing a.url, .link-tooltip-container.editing a.change":{display:"none"},".link-tooltip-container.editing input.input, .link-tooltip-container.editing a.done":{display:"inline-block"}},template:'Visit URL: - Change Done'},b.prototype.initListeners=function(){return this.quill.on(this.quill.constructor.events.SELECTION_CHANGE,function(a){return function(b){var c;if(null!=b&&b.isCollapsed())return c=a._findAnchor(b),c?(a.setMode(c.href,!1),a.show(c)):(a.range=null,a.hide())}}(this)),c.addEventListener(this.container.querySelector(".done"),"click",f.bind(this.saveLink,this)),c.addEventListener(this.container.querySelector(".change"),"click",function(a){return function(){return a.setMode(a.link.href,!0)}}(this)),this.initTextbox(this.textbox,this.saveLink,this.hide),this.quill.onModuleLoad("toolbar",function(a){return function(b){return b.initFormat("link",f.bind(a._onToolbar,a))}}(this))},b.prototype.saveLink=function(){var a,b;return b=this._normalizeURL(this.textbox.value),null!=this.range&&(this.range.isCollapsed()?(a=this._findAnchor(this.range),null!=a&&(a.href=b)):this.quill.formatText(this.range,"link",b,"user")),this.setMode(b,!1)},b.prototype.setMode=function(a,b){var d;return null==b&&(b=!1),b?(this.textbox.value=a,this.textbox.focus(),f.defer(function(b){return function(){return b.textbox.setSelectionRange(a.length,a.length)}}(this))):(this.link.href=a,d=a.length>this.options.maxLength?a.slice(0,this.options.maxLength)+"...":a,c.setText(this.link,d)),c.toggleClass(this.container,"editing",b)},b.prototype._findAnchor=function(a){var b,c,d,e;for(e=this.quill.editor.doc.findLeafAt(a.start,!0),b=e[0],d=e[1],null!=b&&(c=b.node);null!=c;){if("A"===c.tagName)return c;c=c.parentNode}return null},b.prototype._onToolbar=function(a,b){var c;if(a&&!a.isCollapsed())return b?(this.setMode(this._suggestURL(a),!0),c=this.quill.editor.selection._getNativeRange(),this.show(c)):this.quill.formatText(a,"link",!1,"user")},b.prototype._normalizeURL=function(a){return/^https?:\/\//.test(a)||(a="http://"+a),a},b.prototype._suggestURL=function(a){var b;return b=this.quill.getText(a),this._normalizeURL(b)},b}(e),b.exports=d},{"../dom":15,"./tooltip":31,lodash:"M4+//f"}],28:[function(a,b){var c,d,e,f,g,h={}.hasOwnProperty,i=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};g=a("lodash"),d=a("eventemitter2").EventEmitter2,c=a("../dom"),f=a("../utils"),e=function(a){function b(a,b){this.quill=a,this.options=b,this.cursors={},this.container=this.quill.addContainer("cursor-container",!0),this.quill.addStyles({".cursor-container":{position:"absolute",left:"0",top:"0","z-index":"1000"},".cursor":{"margin-left":"-1px",position:"absolute"},".cursor-flag":{bottom:"100%",position:"absolute","white-space":"nowrap"},".cursor-name":{display:"inline-block",color:"white",padding:"2px 8px"},".cursor-caret":{height:"100%",position:"absolute",width:"2px"},".cursor.hidden .cursor-flag":{display:"none"},".cursor.top > .cursor-flag":{bottom:"auto",top:"100%"},".cursor.right > .cursor-flag":{right:"-2px"}}),this.quill.on(this.quill.constructor.events.TEXT_CHANGE,g.bind(this._applyDelta,this))}return i(b,a),b.DEFAULTS={template:' ',timeout:2500},b.events={CURSOR_ADDED:"cursor-addded",CURSOR_MOVED:"cursor-moved",CURSOR_REMOVED:"cursor-removed"},b.prototype.clearCursors=function(){return g.each(g.keys(this.cursors),g.bind(this.removeCursor,this)),this.cursors={}},b.prototype.moveCursor=function(a,b){var d;return d=this.cursors[a],d.index=b,c.removeClass(d.elem,"hidden"),clearTimeout(d.timer),d.timer=setTimeout(function(){return function(){return c.addClass(d.elem,"hidden"),d.timer=null}}(this),this.options.timeout),this._updateCursor(d),d},b.prototype.removeCursor=function(a){var c;return c=this.cursors[a],this.emit(b.events.CURSOR_REMOVED,c),null!=c&&c.elem.parentNode.removeChild(c.elem),delete this.cursors[a]},b.prototype.setCursor=function(a,c,d,e){var f;return null==this.cursors[a]&&(this.cursors[a]=f={userId:a,index:c,color:e,elem:this._buildCursor(d,e)},this.emit(b.events.CURSOR_ADDED,f)),g.defer(function(b){return function(){return b.moveCursor(a,c)}}(this)),this.cursors[a]},b.prototype.shiftCursors=function(a,b,c){return null==c&&(c=null),g.each(this.cursors,function(){return function(d){return d&&(d.index>a||d.userId===c)?d.index+=Math.max(b,a-d.index):void 0}}(this))},b.prototype.update=function(){return g.each(this.cursors,function(a){return function(b){return null!=b?(a._updateCursor(b),!0):void 0
+}}(this))},b.prototype._applyDelta=function(a){return a.apply(function(a){return function(b,c,d){return a.shiftCursors(b,c.length,d.author)}}(this),function(a){return function(b,c){return a.shiftCursors(b,-1*c,null)}}(this),function(a){return function(b){return a.shiftCursors(b,0,null)}}(this)),this.update()},b.prototype._buildCursor=function(a,b){var d,e,f,g;return d=this.container.ownerDocument.createElement("span"),c.addClass(d,"cursor"),d.innerHTML=this.options.template,f=d.querySelector(".cursor-flag"),g=d.querySelector(".cursor-name"),c.setText(g,a),e=d.querySelector(".cursor-caret"),e.style.backgroundColor=g.style.backgroundColor=b,this.container.appendChild(d),d},b.prototype._moveCursor=function(a,d,e){var f,g;return null==e&&(e="left"),f=d.getBoundingClientRect(),a.elem.style.top=f.top+"px",a.elem.style.left=f[e]+"px",a.elem.style.height=f.height+"px",g=a.elem.querySelector(".cursor-flag"),c.toggleClass(a.elem,"top",parseInt(a.elem.style.top)<=g.offsetHeight),c.toggleClass(a.elem,"left",parseInt(a.elem.style.left)<=g.offsetWidth),c.toggleClass(a.elem,"right",this.quill.root.offsetWidth-parseInt(a.elem.style.left)<=g.offsetWidth),this.emit(b.events.CURSOR_MOVED,a)},b.prototype._updateCursor=function(a){var b,d,e,g,h,i,j,k;return this.quill.editor.checkUpdate(),j=this.quill.editor.doc.findLeafAt(a.index,!0),e=j[0],h=j[1],d=this.container.ownerDocument.createElement("span"),null!=e?(k=f.splitNode(e.node,h),g=k[0],i=k[1],b=k[2],c.setText(d,c.ZERO_WIDTH_NOBREAK_SPACE),e.node.parentNode.insertBefore(d,i)):(c.setText(d,c.NOBREAK_SPACE),this.quill.root.appendChild(d)),this._moveCursor(a,d),c.removeNode(d),b&&c.normalize(e.node.parentNode),this.quill.editor.selection.update("silent")},b}(d),b.exports=e},{"../dom":15,"../utils":39,eventemitter2:3,lodash:"M4+//f"}],29:[function(a,b){var c,d,e,f,g;g=a("lodash"),c=a("../dom"),d=a("../document"),f=a("tandem-core"),e=function(){function a(a,b){this.quill=a,this.options=b,this.container=this.quill.addContainer("paste-container"),this.container.setAttribute("contenteditable",!0),this.quill.addStyles({".paste-container":{left:"-10000px",position:"absolute",top:"50%"}}),c.addEventListener(this.quill.root,"paste",g.bind(this._paste,this))}return a.prototype._paste=function(){var a,b,c,e;return b=this.quill.getLength(),c=this.quill.getSelection(),null!=c?(this.container.innerHTML="",a=this.quill.root.ownerDocument.defaultView,e=a.scrollY,this.container.focus(),g.defer(function(g){return function(){var h,i,j;return i=new d(g.container,g.quill.options),h=i.toDelta(),h=h.compose(f.Delta.makeDeleteDelta(h.endLength,h.endLength-1,1)),j=h.endLength,c.start>0&&h.ops.unshift(new f.RetainOp(0,c.start)),c.endb.bottom&&(f=d.top-e.height-this.options.offset)):(c=b.left+b.width/2-e.width/2,f=b.top+b.height/2-e.height/2),[c,f]},a}(),b.exports=e},{"../dom":15,"../normalizer":33,lodash:"M4+//f"}],32:[function(a,b){var c,d,e;e=a("lodash"),c=a("tandem-core"),d=function(){function a(a,b){this.quill=a,this.options=null!=b?b:{},this.lastRecorded=0,this.emittedDelta=null,this.clear(),this.initListeners()}return a.DEFAULTS={delay:1e3,maxStack:100},a.hotkeys={UNDO:{key:"Z",metaKey:!0,shiftKey:!1},REDO:{key:"Z",metaKey:!0,shiftKey:!0}},a.prototype.initListeners=function(){return this.quill.onModuleLoad("keyboard",function(b){return function(c){return c.addHotkey(a.hotkeys.UNDO,function(){return b.undo(),!1}),c.addHotkey(a.hotkeys.REDO,function(){return b.redo(),!1})}}(this)),this.quill.on(this.quill.constructor.events.TEXT_CHANGE,function(a){return function(b){return b.isEqual(a.emittedDelta)?void(a.emittedDelta=null):(a.record(b,a.oldDelta),a.oldDelta=a.quill.getContents())}}(this))},a.prototype.clear=function(){return this.stack={undo:[],redo:[]},this.oldDelta=this.quill.getContents()},a.prototype.record=function(a,b){var c,d,e,f;if(!a.isIdentity()){this.stack.redo=[];try{if(f=b.invert(a),e=(new Date).getTime(),this.lastRecorded+this.options.delay>e&&this.stack.undo.length>0?(c=this.stack.undo.pop(),f.canCompose(c.undo)&&c.redo.canCompose(a)?(f=f.compose(c.undo),a=c.redo.compose(a)):(this.clear(),this.lastRecorded=e)):this.lastRecorded=e,this.stack.undo.push({redo:a,undo:f}),this.stack.undo.length>this.options.maxStack)return this.stack.undo.unshift()}catch(g){return d=g,this.clear()}}},a.prototype.redo=function(){return this._change("redo","undo")},a.prototype.undo=function(){return this._change("undo","redo")},a.prototype._getLastChangeIndex=function(a){var b;return b=0,a.apply(function(a,c){return b=Math.max(a+c.length,b)},function(a){return b=Math.max(a,b)},function(a,c){return b=Math.max(a+c,b)}),b},a.prototype._change=function(a,b){var c,d;return this.stack[a].length>0?(c=this.stack[a].pop(),this.lastRecorded=0,this.emittedDelta=c[a],this.quill.updateContents(c[a],"user"),this.emittedDelta=null,d=this._getLastChangeIndex(c[a]),this.quill.setSelection(d,d),this.stack[b].push(c)):void 0},a}(),b.exports=d},{lodash:"M4+//f","tandem-core":10}],33:[function(a,b){var c,d,e,f;f=a("lodash"),c=a("./dom"),e=a("./utils"),d={ALIASES:{STRONG:"B",EM:"I",DEL:"S",STRIKE:"S"},ATTRIBUTES:{color:"color",face:"fontFamily",size:"fontSize"},STYLES:{"background-color":"background-color",color:"color","font-family":"font-family","font-size":"font-size","text-align":"text-align"},TAGS:{P:"P",BR:"BR",SPAN:"SPAN",B:"B",I:"I",S:"S",U:"U",A:"A",IMG:"IMG",UL:"UL",LI:"LI"},handleBreaks:function(a){var b;return b=f.map(a.querySelectorAll(c.DEFAULT_BREAK_TAG)),f.each(b,function(){return function(b){return null==b.nextSibling||c.isIE(10)&&null==b.previousSibling?void 0:e.splitAncestors(b.nextSibling,a.parentNode)}}(this)),a},normalizeLine:function(a){return a=d.wrapInline(a),a=d.handleBreaks(a),a=d.pullBlocks(a),a=d.normalizeNode(a),d.unwrapText(a),a},normalizeNode:function(a){return c.isTextNode(a)?a:(f.each(d.ATTRIBUTES,function(b,c){var d;return a.hasAttribute(c)?(d=a.getAttribute(c),"size"===c&&(d=e.convertFontSize(d)),a.style[b]=d,a.removeAttribute(c)):void 0}),d.whitelistStyles(a),d.whitelistTags(a))},optimizeLine:function(a){var b,d,g,h;for(b=e.getNodeLength(a),g=c.getDescendants(a),h=[];g.length>0;)d=g.pop(),null!=(null!=d?d.parentNode:void 0)&&null==c.EMBED_TAGS[d.tagName]&&(d.tagName===c.DEFAULT_BREAK_TAG?h.push(0!==b?c.removeNode(d):void 0):0===e.getNodeLength(d)?(g.push(d.nextSibling),h.push(c.unwrap(d))):null!=d.previousSibling&&d.tagName===d.previousSibling.tagName&&f.isEqual(c.getAttributes(d),c.getAttributes(d.previousSibling))?(g.push(d.firstChild),h.push(e.mergeNodes(d.previousSibling,d))):h.push(void 0));return h},pullBlocks:function(a){var b;for(b=a.firstChild;null!=b;){if(null!=c.BLOCK_TAGS[b.tagName]&&"LI"!==b.tagName){null!=b.previousSibling&&e.splitAncestors(b,a.parentNode),null!=b.nextSibling&&e.splitAncestors(b.nextSibling,a.parentNode),null==c.LIST_TAGS[b.tagName]?(c.unwrap(b),d.pullBlocks(a)):(c.unwrap(b.parentNode),null==a.parentNode&&(a=b));break}b=b.nextSibling}return a},stripComments:function(a){return a.replace(//g,"")},stripWhitespace:function(a){return a=a.replace(/^\s+/,"").replace(/\s+$/,""),a=a.replace(/\>\s+\
<")},whitelistStyles:function(a){var b,e;return b=c.getStyles(a),e=f.omit(b,function(a,b){return null==d.STYLES[b]}),f.keys(e).length0?c.setStyles(a,e):a.removeAttribute("style"):void 0},whitelistTags:function(a){return c.isElement(a)?(null!=d.ALIASES[a.tagName]&&(a=c.switchTag(a,d.ALIASES[a.tagName])),null==d.TAGS[a.tagName]&&(a=null!=c.BLOCK_TAGS[a.tagName]?c.switchTag(a,c.DEFAULT_BLOCK_TAG):a.hasAttributes()||null==a.firstChild?c.switchTag(a,c.DEFAULT_INLINE_TAG):c.unwrap(a)),a):a},wrapInline:function(a){var b,d;if(null!=c.BLOCK_TAGS[a.tagName])return a;for(b=a.ownerDocument.createElement(c.DEFAULT_BLOCK_TAG),a.parentNode.insertBefore(b,a);null!=a&&null==c.BLOCK_TAGS[a.tagName];)d=a.nextSibling,b.appendChild(a),a=d;return b},unwrapText:function(a){var b;return b=f.map(a.querySelectorAll(c.DEFAULT_INLINE_TAG)),f.each(b,function(a){var b;return b=c.getAttributes(a),0===f.keys(b).length?c.unwrap(a):void 0})}},b.exports=d},{"./dom":15,"./utils":39,lodash:"M4+//f"}],34:[function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n={}.hasOwnProperty,o=function(a,b){function c(){this.constructor=a}for(var d in b)n.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},p=[].slice;m=a("lodash"),m.str=a("underscore.string"),l=a("../package.json"),e=a("eventemitter2").EventEmitter2,c=a("./dom"),d=a("./editor"),f=a("./format"),i=a("./lib/range"),j=a("tandem-core"),g={Authorship:a("./modules/authorship"),ImageTooltip:a("./modules/image-tooltip"),Keyboard:a("./modules/keyboard"),LinkTooltip:a("./modules/link-tooltip"),MultiCursor:a("./modules/multi-cursor"),PasteManager:a("./modules/paste-manager"),Toolbar:a("./modules/toolbar"),UndoManager:a("./modules/undo-manager")},k={Default:a("./themes/default"),Snow:a("./themes/snow")},h=function(a){function b(a,c){var e,f,g;if(null==c&&(c={}),m.isString(a)&&(a=document.querySelector(a)),null==a)throw new Error("Invalid Quill container");f=m.defaults(c.modules||{},b.DEFAULTS.modules),e=a.innerHTML,this.options=m.defaults(c,b.DEFAULTS),this.options.modules=f,this.options.id=this.id="quill-"+(b.editors.length+1),this.options.emitter=this,this.modules={},this.editor=new d(a,this,this.options),this.root=this.editor.doc.root,b.editors.push(this),this.setHTML(e,b.sources.SILENT),g=m.str.capitalize(m.str.camelize(this.options.theme)),this.theme=new b.Theme[g](this,this.options),m.each(this.options.modules,function(a){return function(b,c){return a.addModule(c,b)}}(this))}return o(b,a),b.version=l.version,b.editors=[],b.Module=g,b.Theme=k,b.DEFAULTS={formats:["align","bold","italic","strike","underline","color","background","font","size","link","image","bullet","list"],modules:{keyboard:!0,"paste-manager":!0,"undo-manager":!0},pollInterval:100,readOnly:!1,theme:"default"},b.events={MODULE_INIT:"module-init",POST_EVENT:"post-event",PRE_EVENT:"pre-event",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change"},b.sources={API:"api",SILENT:"silent",USER:"user"},b.prototype.addContainer=function(a,b){return null==b&&(b=!1),this.editor.renderer.addContainer(a,b)},b.prototype.addFormat=function(a,b){return this.editor.doc.addFormat(a,b)},b.prototype.addModule=function(a,c){var d,e;if(d=m.str.capitalize(m.str.camelize(a)),e=b.Module[d],null==e)throw new Error("Cannot load "+a+" module. Are you sure you included it?");return m.isObject(c)||(c={}),c=m.defaults(c,this.theme.constructor.OPTIONS[a]||{},e.DEFAULTS||{}),this.modules[a]=new e(this,c),this.emit(b.events.MODULE_INIT,a,this.modules[a]),this.modules[a]},b.prototype.addStyles=function(a){return this.editor.renderer.addStyles(a)},b.prototype.deleteText=function(a,c,d){var e,f,g;return null==d&&(d=b.sources.API),g=this._buildParams(a,c,{},d),a=g[0],c=g[1],f=g[2],d=g[3],c>a?(e=j.Delta.makeDeleteDelta(this.getLength(),a,c-a),this.editor.applyDelta(e,d)):void 0},b.prototype.emit=function(){var a,c;return c=arguments[0],a=2<=arguments.length?p.call(arguments,1):[],b.__super__.emit.apply(this,[b.events.PRE_EVENT,c].concat(p.call(a))),b.__super__.emit.apply(this,[c].concat(p.call(a))),b.__super__.emit.apply(this,[b.events.POST_EVENT,c].concat(p.call(a)))},b.prototype.focus=function(){return this.root.focus()},b.prototype.formatLine=function(a,b,c,d,e){var f,g,h,i,j;return i=this._buildParams(a,b,c,d,e),a=i[0],b=i[1],f=i[2],e=i[3],j=this.editor.doc.findLineAt(b),g=j[0],h=j[1],null!=g&&(b+=g.length-h),this.formatText(a,b,f,e)},b.prototype.formatText=function(a,b,c,d,e){var f,g,h;return h=this._buildParams(a,b,c,d,e),a=h[0],b=h[1],g=h[2],e=h[3],g=m.reduce(g,function(a){return function(b,c,d){var e;return e=a.editor.doc.formats[d],c&&c!==e.config["default"]||(b[d]=null),b}}(this),g),f=j.Delta.makeRetainDelta(this.getLength(),a,b-a,g),this.editor.applyDelta(f,e)},b.prototype.getContents=function(a,b){var c;return null==a&&(a=0),null==b&&(b=null),m.isObject(a)?(b=a.end,a=a.start):null==b&&(b=this.getLength()),c=this.editor.getDelta().getOpsAt(a,b-a),new j.Delta(0,c)},b.prototype.getHTML=function(){return this.root.innerHTML},b.prototype.getLength=function(){return this.editor.getDelta().endLength},b.prototype.getModule=function(a){return this.modules[a]},b.prototype.getSelection=function(){return this.editor.checkUpdate(),this.editor.selection.getRange()},b.prototype.getText=function(a,b){return null==a&&(a=0),null==b&&(b=null),m.pluck(this.getContents(a,b).ops,"value").join("")},b.prototype.insertEmbed=function(a,b,d,e){return this.insertText(a,c.EMBED_TEXT,b,d,e)},b.prototype.insertText=function(a,b,c,d,e){var f,g,h,i;return i=this._buildParams(a,0,c,d,e),a=i[0],g=i[1],h=i[2],e=i[3],b.length>0?(f=j.Delta.makeInsertDelta(this.getLength(),a,b,h),this.editor.applyDelta(f,e)):void 0},b.prototype.onModuleLoad=function(a,c){return this.modules[a]?c(this.modules[a]):this.on(b.events.MODULE_INIT,function(b,d){return b===a?c(d):void 0})},b.prototype.prepareFormat=function(a,c){var d,e;return d=this.editor.doc.formats[a],null!=d&&(e=this.getSelection(),null!=e?e.isCollapsed():void 0)?d.isType(f.types.LINE)?this.formatLine(e,a,c,b.sources.USER):d.prepare(c):void 0},b.prototype.setContents=function(a,c){return null==c&&(c=b.sources.API),m.isArray(a)?a={startLength:this.getLength(),ops:a}:a.startLength=this.getLength(),this.updateContents(a,c)},b.prototype.setHTML=function(a,d){return null==d&&(d=b.sources.API),a||(a="<"+c.DEFAULT_BLOCK_TAG+"><"+c.DEFAULT_BREAK_TAG+">"+c.DEFAULT_BLOCK_TAG+">"),this.editor.doc.setHTML(a),this.editor.checkUpdate(d)},b.prototype.setSelection=function(a,c,d){var e;return null==d&&(d=b.sources.API),m.isNumber(a)&&m.isNumber(c)?e=new i(a,c):(e=a,d=c||d),this.editor.selection.setRange(e,d)},b.prototype.updateContents=function(a,c){return null==c&&(c=b.sources.API),a=j.Delta.makeDelta(a),this.editor.applyDelta(a,c)},b.prototype._buildParams=function(){var a,c;return c=1<=arguments.length?p.call(arguments,0):[],m.isObject(c[0])&&c.splice(0,1,c[0].start,c[0].end),m.isString(c[2])&&(a={},a[c[2]]=c[3],c.splice(2,2,a)),null==c[3]&&(c[3]=b.sources.API),c},b}(e),b.exports=h},{"../package.json":13,"./dom":15,"./editor":16,"./format":17,"./lib/range":22,"./modules/authorship":24,"./modules/image-tooltip":25,"./modules/keyboard":26,"./modules/link-tooltip":27,"./modules/multi-cursor":28,"./modules/paste-manager":29,"./modules/toolbar":30,"./modules/undo-manager":32,"./themes/default":37,"./themes/snow":38,eventemitter2:3,lodash:"M4+//f","tandem-core":10,"underscore.string":12}],35:[function(a,b){var c,d,e,f,g,h,i,j;j=a("lodash"),d=a("./dom"),h=a("./utils"),f=a("./normalizer"),c={html:{height:"100%",width:"100%"},body:{"box-sizing":"border-box",cursor:"text","font-family":"'Helvetica', 'Arial', sans-serif","font-size":"13px",height:"100%","line-height":"1.42",margin:"0px","overflow-x":"hidden","overflow-y":"auto",padding:"12px 15px"},".editor-container":{height:"100%",outline:"none",position:"relative","tab-size":"4","white-space":"pre-wrap"},".editor-container p":{margin:"0",padding:"0"},".editor-container a":{"text-decoration":"underline"},".editor-container b":{"font-weight":"bold"},".editor-container i":{"font-style":"italic"},".editor-container s":{"text-decoration":"line-through"},".editor-container u":{"text-decoration":"underline"},".editor-container img":{"max-width":"100%"},".editor-container blockquote":{margin:"0 0 0 2em",padding:"0"},".editor-container ol":{margin:"0 0 0 2em",padding:"0","list-style-type":"decimal"},".editor-container ul":{margin:"0 0 0 2em",padding:"0","list-style-type":"disc"}},e=["decimal","lower-alpha","lower-roman"],i=".editor-container ol > li",j.each([1,2,3,4,5,6,7,8,9],function(a){return i+=" > ol",c[i]={"list-style-type":e[a%3]},i+=" > li"}),h.isIE(10)&&(c[d.DEFAULT_BREAK_TAG]={display:"none"}),g=function(){function a(b,e){var f;this.container=b,this.options=null!=e?e:{},this.container.innerHTML="",f=a.buildFrame(this.container),this.root=f[0],this.iframe=f[1],this.root.id=this.options.id,d.addClass(this.root,"editor-container"),d.addClass(this.container,"ql-container"),d.addEventListener(this.container,"focus",function(a){return function(){return a.root.focus()}}(this)),d.isIOS()&&d.addStyles(this.container,{overflow:"auto","-webkit-overflow-scrolling":"touch"}),this.addStyles(c),null!=this.options.styles&&j.defer(j.bind(this.addStyles,this,this.options.styles))}return a.objToCss=function(a){return j.map(a,function(a,b){var c;return c=j.map(a,function(a,b){return""+b+": "+a+";"}).join(" "),""+b+" { "+c+" }"}).join("\n")},a.buildFrame=function(a){var b,c,e;return b=a.ownerDocument.createElement("iframe"),d.setAttributes(b,{frameBorder:"0",height:"100%",width:"100%",title:"Quill Rich Text Editor",role:"presentation"}),a.appendChild(b),c=b.contentWindow.document,c.open(),c.write(""),c.close(),e=c.createElement("div"),c.body.appendChild(e),[e,b]},a.prototype.addContainer=function(a,b){var c,e;return null==b&&(b=!1),e=b?this.root:null,c=this.root.ownerDocument.createElement("div"),d.addClass(c,a),this.root.parentNode.insertBefore(c,e),c},a.prototype.addStyles=function(b){var c,e;return"object"==typeof b?(e=this.root.ownerDocument.createElement("style"),e.type="text/css",b=a.objToCss(b),e.appendChild(this.root.ownerDocument.createTextNode(b)),this.root.ownerDocument.head.appendChild(e)):"string"==typeof b?(c=this.root.ownerDocument.createElement("link"),d.setAttributes(c,{type:"text/css",rel:"stylesheet",href:b}),this.root.ownerDocument.head.appendChild(c)):void 0},a}(),b.exports=g},{"./dom":15,"./normalizer":33,"./utils":39,lodash:"M4+//f"}],36:[function(a,b){var c,d,e,f,g,h,i;i=a("lodash"),c=a("./dom"),d=a("./leaf"),e=a("./normalizer"),f=a("./lib/range"),h=a("./utils"),g=function(){function a(a,b,c){this.doc=a,this.iframe=b,this.emitter=c,this.document=this.doc.root.ownerDocument,this.range=this.getRange(),this.nullDelay=!1}return a.prototype.checkFocus=function(){return this.document.activeElement!==this.doc.root?!1:null!=document.activeElement&&"IFRAME"===document.activeElement.tagName?document.activeElement===this.iframe:!0},a.prototype.getRange=function(){var a,b,c;return this.checkFocus()?(b=this._getNativeRange(),null==b?null:(c=this._positionToIndex(b.startContainer,b.startOffset),a=b.startContainer===b.endContainer&&b.startOffset===b.endOffset?c:this._positionToIndex(b.endContainer,b.endOffset),new f(Math.min(c,a),Math.max(c,a)))):null},a.prototype.preserve=function(a){var b,c,d,e,f,g,h,i,j;return d=this._getNativeRange(),null!=d&&this.checkFocus()?(g=this._encodePosition(d.startContainer,d.startOffset),e=g[0],f=g[1],h=this._encodePosition(d.endContainer,d.endOffset),b=h[0],c=h[1],a(),i=this._decodePosition(e,f),e=i[0],f=i[1],j=this._decodePosition(b,c),b=j[0],c=j[1],this._setNativeRange(e,f,b,c)):a()},a.prototype.setRange=function(a,b){var c,d,e,f,g,h,i;return null!=a?(g=this._indexToPosition(a.start),e=g[0],f=g[1],a.isCollapsed()?(h=[e,f],c=h[0],d=h[1]):(i=this._indexToPosition(a.end),c=i[0],d=i[1]),this._setNativeRange(e,f,c,d)):this._setNativeRange(null),this.update(b)},a.prototype.shiftAfter=function(a,b,c){var d;return d=this.getRange(),c(),null!=d?(d.shift(a,b),this.setRange(d,"silent")):void 0},a.prototype.update=function(a){var b,c;return c=this.getRange(),b="silent"!==a&&!f.compare(c,this.range),null!==c||"user"!==a||this.nullDelay?(this.nullDelay=!1,this.range=c,b?this.emitter.emit(this.emitter.constructor.events.SELECTION_CHANGE,c,a):void 0):this.nullDelay=!0},a.prototype._decodePosition=function(a,b){var d;return c.isElement(a)&&(d=i.indexOf(c.getChildNodes(a.parentNode),a),b+=d,a=a.parentNode),[a,b]},a.prototype._encodePosition=function(a,b){for(var d;;){if(c.isTextNode(a)||a.tagName===c.DEFAULT_BREAK_TAG||null!=c.EMBED_TAGS[a.tagName])return[a,b];if(b0?a.getRangeAt(0):null},a.prototype._indexToPosition=function(a){var b,c,d;return 0===this.doc.lines.length?[this.doc.root,0]:(d=this.doc.findLeafAt(a,!0),b=d[0],c=d[1],this._decodePosition(b.node,c))},a.prototype._positionToIndex=function(a,b){var c,d,e,f,g,h;if(h=this._encodePosition(a,b),d=h[0],b=h[1],f=this.doc.findLine(d),null==f)return 0;for(c=f.findLeaf(d),g=0;null!=f.prev;)f=f.prev,g+=f.length;if(null==c)return g;for(e=0;null!=c.prev;)c=c.prev,e+=c.length;return g+e+b},a.prototype._setNativeRange=function(a,b,c,d){var e,f;return(f=this._getNativeSelection())?null==a?(f.removeAllRanges(),this.doc.root.blur()):(this.doc.root.focus(),e=this._getNativeRange(),null==e||a!==e.startContainer||b!==e.startOffset||c!==e.endContainer||d!==e.endOffset?(null!=e&&f.removeAllRanges(),f.removeAllRanges(),e=this.document.createRange(),e.setStart(a,b),e.setEnd(c,d),f.addRange(e),this.doc.root.focus()):void 0):void 0},a}(),b.exports=g},{"./dom":15,"./leaf":18,"./lib/range":22,"./normalizer":33,"./utils":39,lodash:"M4+//f"}],37:[function(a,b){var c;c=function(){function a(a){this.quill=a,this.editor=this.quill.editor,this.editorContainer=this.editor.root}return a.OPTIONS={},a}(),b.exports=c},{}],38:[function(a,b){var c,d,e,f,g,h,i={}.hasOwnProperty,j=function(a,b){function c(){this.constructor=a}for(var d in b)i.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};h=a("lodash"),c=a("../../lib/color-picker"),e=a("../default"),d=a("../../dom"),f=a("../../lib/picker"),g=function(a){function b(a){this.quill=a,b.__super__.constructor.apply(this,arguments),this.quill.addStyles(b.STYLES),this.pickers=[],this.quill.on(this.quill.constructor.events.SELECTION_CHANGE,function(a){return function(b){return null!=b?h.invoke(a.pickers,"close"):void 0}}(this)),d.addClass(this.quill.root.ownerDocument.body,"snow"),this.quill.onModuleLoad("multi-cursor",h.bind(this.extendMultiCursor,this)),this.quill.onModuleLoad("toolbar",h.bind(this.extendToolbar,this))}return j(b,a),b.COLORS=["#000000","#e60000","#ff9900","#ffff00","#008A00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],b.OPTIONS={"multi-cursor":{template:' '}},b.STYLES={".snow .image-tooltip-container a":{border:"1px solid #06c"},".snow .image-tooltip-container a.insert":{"background-color":"#06c",color:"#fff"},".snow .cursor-name":{"border-radius":"4px","font-size":"11px","font-family":"Arial","margin-left":"-50%",padding:"4px 10px"},".snow .cursor-triangle":{"border-left":"4px solid transparent","border-right":"4px solid transparent",height:"0px","margin-left":"-3px",width:"0px"},".snow .cursor.left .cursor-name":{"margin-left":"-8px"},".snow .cursor.right .cursor-flag":{right:"auto"},".snow .cursor.right .cursor-name":{"margin-left":"-100%","margin-right":"-8px"},".snow .cursor-triangle.bottom":{"border-top":"4px solid transparent",display:"block","margin-bottom":"-1px"},".snow .cursor-triangle.top":{"border-bottom":"4px solid transparent",display:"none","margin-top":"-1px"},".snow .cursor.top .cursor-triangle.bottom":{display:"none"},".snow .cursor.top .cursor-triangle.top":{display:"block"},".snow a":{color:"#06c"},".snow .tooltip":{border:"1px solid #ccc","box-shadow":"0px 0px 5px #ddd",color:"#222"},".snow .tooltip a":{color:"#06c"},".snow .tooltip .input":{border:"1px solid #ccc",margin:"0px",padding:"5px"},".snow .image-tooltip-container .preview":{"border-color":"#ccc",color:"#ccc"},".snow .link-tooltip-container a, .snow .link-tooltip-container span":{display:"inline-block","line-height":"25px"}},b.prototype.extendMultiCursor=function(a){return a.on(a.constructor.events.CURSOR_ADDED,function(a){var b,c;return b=a.elem.querySelector(".cursor-triangle.bottom"),c=a.elem.querySelector(".cursor-triangle.top"),b.style.borderTopColor=c.style.borderBottomColor=a.color})},b.prototype.extendToolbar=function(a){return h.each(["color","background","font","size","align"],function(b){return function(e){var g,i;if(i=a.container.querySelector(".ql-"+e),null!=i){switch(e){case"font":case"size":case"align":g=new f(i);break;case"color":case"background":g=new c(i),h.each(g.container.querySelectorAll(".ql-picker-item"),function(a,b){return 7>b?d.addClass(a,"ql-primary-color"):void 0})}return null!=g?b.pickers.push(g):void 0}}}(this)),h.each(d.getTextNodes(a.container),function(a){return 0===d.getText(a).trim().length?d.removeNode(a):void 0})},b}(e),b.exports=g},{"../../dom":15,"../../lib/color-picker":19,"../../lib/picker":21,"../default":37,lodash:"M4+//f"}],39:[function(a,b){var c,d,e;e=a("lodash"),c=a("./dom"),d={convertFontSize:function(a){var b,d,f,g;e.isString(a)&&a.indexOf("px")>-1?(f=e.keys(c.FONT_SIZES),g=e.values(c.FONT_SIZES)):(g=e.keys(c.FONT_SIZES),f=e.values(c.FONT_SIZES));for(b in f)if(d=f[b],parseInt(a)<=parseInt(d))return g[b];return e.last(g)},getChildAtOffset:function(a,b){var c,e;for(c=a.firstChild,e=d.getNodeLength(c);null!=c&&!(e>b);)b-=e,c=c.nextSibling,e=d.getNodeLength(c);
+return null==c&&(c=a.lastChild,b=d.getNodeLength(c)),[c,b]},getNextLineNode:function(a,b){var d;return d=a.nextSibling,null==d&&a.parentNode!==b&&(d=a.parentNode.nextSibling),null!=d&&null!=c.LIST_TAGS[d.tagName]&&(d=d.firstChild),d},getNodeLength:function(a){var b;return null==a?0:(b=c.getText(a).length,c.isElement(a)&&(b+=a.querySelectorAll(e.keys(c.EMBED_TAGS).join(",")).length),b)},isIE:function(a){var b;return b=document.documentMode,b&&a>=b},mergeNodes:function(a,b){var d;return c.isElement(a)?(c.moveChildren(a,b),c.normalize(a)):(d=c.getText(a)+c.getText(b),c.setText(a,d)),c.removeNode(b)},splitAncestors:function(a,b,c){var e,f,g;if(null==c&&(c=!1),a===b||a.parentNode===b)return a;if(null!=a.previousSibling||c){for(g=a.parentNode,f=g.cloneNode(!1),g.parentNode.insertBefore(f,g.nextSibling);null!=a;)e=a.nextSibling,f.appendChild(a),a=e;return d.splitAncestors(f,b)}return d.splitAncestors(a.parentNode,b)},splitNode:function(a,b,e){var f,g,h,i,j,k,l,m,n,o;if(null==e&&(e=!1),l=d.getNodeLength(a),b=Math.max(0,b),b=Math.min(b,l),!e&&0===b)return[a.previousSibling,a,!1];if(!e&&b===l)return[a,a.nextSibling,!1];if(a.nodeType===c.TEXT_NODE)return f=a.splitText(b),[a,f,!0];for(j=a,m=a.cloneNode(!1),a.parentNode.insertBefore(m,j.nextSibling),n=d.getChildAtOffset(a,b),g=n[0],b=n[1],o=d.splitNode(g,b),h=o[0],i=o[1];null!==i;)k=i.nextSibling,m.appendChild(i),i=k;return[j,m,!0]}},b.exports=d},{"./dom":15,lodash:"M4+//f"}]},{},[34])(34)});
\ No newline at end of file
diff --git a/dist/quill.snow.css b/dist/quill.snow.css
new file mode 100644
index 0000000000..571a4bcb46
--- /dev/null
+++ b/dist/quill.snow.css
@@ -0,0 +1,246 @@
+/*! Quill Editor v0.15.3
+ * https://quilljs.com/
+ * Copyright (c) 2014, Jason Chen
+ * Copyright (c) 2013, salesforce.com
+ */
+@font-face {
+ font-family: 'quill-snow';
+ font-style: normal;
+ font-weight: normal;
+ src: url("data:application/vnd.ms-fontobject;base64,0CsAACgrAAABAAIAAAAAAAIABQMAAAAAAAABAJABAAAAAExQAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAII/0LwAAAAAAAAAAAAAAAAAAAAAAABAAZgBvAG4AdABlAGwAbABvAAAADgBSAGUAZwB1AGwAYQByAAAAFgBWAGUAcgBzAGkAbwBuACAAMQAuADAAAAAQAGYAbwBuAHQAZQBsAGwAbwAAAAAAAAEAAAAOAIAAAwBgT1MvMj4pST4AAADsAAAAVmNtYXDQJBm2AAABRAAAAUpjdnQgBtf/BgAAISAAAAAcZnBnbYoKeDsAACE8AAAJkWdhc3AAAAAQAAAhGAAAAAhnbHlmUjOb7wAAApAAABnKaGVhZAJfdPkAABxcAAAANmhoZWEH3wOrAAAclAAAACRobXR4RKAAAAAAHLgAAABMbG9jYT9UREkAAB0EAAAAKG1heHABkgpOAAAdLAAAACBuYW1lzJ0aHAAAHUwAAALNcG9zdAmK/O4AACAcAAAA+nByZXCSoZr/AAAq0AAAAFYAAQOdAZAABQAIAnoCvAAAAIwCegK8AAAB4AAxAQIAAAIABQMAAAAAAAAAAA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3Ky2wZCywMyuwOCstsGUssDQrLrEmARQrLbBmLLA0K7A2Ky2wZyywNCuwNystsGgssDQrsDgrLbBpLLA1Ky6xJgEUKy2waiywNSuwNistsGsssDUrsDcrLbBsLLA1K7A4Ky2wbSwrsAhlsAMkUHiwARUwLQAAAEu4AMhSWLEBAY5ZuQgACABjILABI0SwAyNwsgQoCUVSRLIKAgcqsQYBRLEkAYhRWLBAiFixBgNEsSYBiFFYuAQAiFixBgFEWVlZWbgB/4WwBI2xBQBEAAA=") format('embedded-opentype'), url("data:application/font-woff;base64,d09GRgABAAAAABg0AA4AAAAAKygAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABPUy8yAAABRAAAAEQAAABWPilJPmNtYXAAAAGIAAAAOgAAAUrQJBm2Y3Z0IAAAAcQAAAAUAAAAHAbX/wZmcGdtAAAB2AAABPkAAAmRigp4O2dhc3AAAAbUAAAACAAAAAgAAAAQZ2x5ZgAABtwAAA4aAAAZylIzm+9oZWFkAAAU+AAAADYAAAA2Al90+WhoZWEAABUwAAAAIAAAACQH3wOraG10eAAAFVAAAAAnAAAATESgAABsb2NhAAAVeAAAACgAAAAoP1RESW1heHAAABWgAAAAIAAAACABkgpObmFtZQAAFcAAAAF3AAACzcydGhxwb3N0AAAXOAAAAKMAAAD6CYr87nByZXAAABfcAAAAVgAAAFaSoZr/eJxjYGSeyziBgZWBg6mKaQ8DA0MPhGZ8wGDIyMTAwMTAysyAFQSkuaYwOLxgfCHEHPQ/iyGKOYhhGlCYESQHAPXgC+V4nGNgYGBmgGAZBkYGEHAB8hjBfBYGDSDNBqQZGZgYGF4I/f8PUvCCEURLMEDVAwEjG8OIBwB31wbAAAB4nGNgQANGDEbMQf+zQBgAEdAD4XicnVXZdtNWFJU8ZHASOmSgoA7X3DhQ68qEKRgwaSrFdiEdHAitBB2kDHTkncc+62uOQrtWH/m07n09JLR0rbYsls++R1tn2DrnRhwjKn0aiGvUoZKXA6msPZZK90lc13Uvj5UMBnFdthJPSZuonSRKat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A1AEBQgDAHG6BJJ4nGN+wcDALMjAwGQNpCOBGMRfwMDAog9l48OREAxSC9IPANK3C9oAAAAAAAC0AUACnANQBCYEmgZWBvIHkAgsCK4JLgmuCjAK/Au+DKAM5QABAAAAEwB+AAYAAAAAAAIAMAA9AG4AAADaCZEAAAAAeJx1kMtqwkAUhv/x0otCW1rotrMqSmm8YDeCIFh0026kuC0xxiQSMzIZBV+j79CH6Uv0WfqbjKUoTZjMd745c+ZkAFzjGwL588SRs8AZo5wLOEXPcpH+2XKJ/GK5jCreLJ/Qv1uu4AGB5Spu8MEKonTOaIFPywJX4tJyARfiznKR/tFyidyzXMateLV8Qu9ZrmAiUstV3IuvgVptdRSERtYGddlutjpyupWKKkrcWLprEyqdyr6cq8T4cawcTy33PPaDdezqfbifJ75OI5XIltPcq5Gf+No1/mxXPd0EbWPmcq7VUg5thlxptfA944TGrLqNxt/zMIDCCltoRLyqEAYSNdo65zaaaKFDmjJDMjPPipDARUzjYs0dYbaSMu5zzBkltD4zYrIDj9/lkR+TAu6PWUUfrR7GE9LujCjzkn057O4wa0RKskw3s7Pf3lNseFqb1nDXrkuddSUxPKgheR+7tQWNR+9kt2Jou2jw/ef/fgDdX4RLAHicbYxLEoIwEETTCigE/J6DQwmMOhojNZksvL0p4tJevdfVM2ZlchrzP2djsMIaBUpU2GCLGg0sWnTYYY8DjjjhXAxvN1WsF8djHf1E4thTFVT4SUXi52bmUaNQ5zho7+NrIKHJLjZE50hbTndee+HbXe1PHF21SV9vfkGbcZm0mcc0I+myPGJQvn5siDNJGIVnrUMcMpUxpLIIb1FjvoAxQk4AS7gAyFJYsQEBjlm5CAAIAGMgsAEjRLADI3CyBCgJRVJEsgoCByqxBgFEsSQBiFFYsECIWLEGA0SxJgGIUVi4BACIWLEGAURZWVlZuAH/hbAEjbEFAEQAAA==") format('woff');
+}
+.ql-toolbar-container {
+ box-sizing: border-box;
+ padding: 8px 8px 7px 8px;
+ user-select: none;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+}
+.ql-toolbar-container .ql-format-group {
+ display: inline-block;
+ margin-right: 15px;
+ vertical-align: middle;
+}
+.ql-toolbar-container .ql-format-separator {
+ box-sizing: border-box;
+ background-color: #ddd;
+ display: inline-block;
+ height: 18px;
+ margin-left: 4px;
+ margin-right: 4px;
+ vertical-align: middle;
+ width: 1px;
+}
+.ql-toolbar-container .ql-format-button {
+ box-sizing: border-box;
+ display: inline-block;
+ height: 24px;
+ line-height: 24px;
+ vertical-align: middle;
+ background-position: center center;
+ background-repeat: no-repeat;
+ box-sizing: border-box;
+ cursor: pointer;
+ font-family: 'quill-snow';
+ font-size: 12px;
+ margin-top: 1px;
+ text-align: center;
+ width: 24px;
+}
+.ql-toolbar-container .ql-format-button:hover,
+.ql-toolbar-container .ql-format-button.ql-active,
+.ql-toolbar-container .ql-format-button.ql-on {
+ color: #06c;
+}
+.ql-toolbar-container .ql-format-button.ql-bold:before {
+ content: "\e801";
+}
+.ql-toolbar-container .ql-format-button.ql-italic:before {
+ content: "\e802";
+}
+.ql-toolbar-container .ql-format-button.ql-underline:before {
+ content: "\e803";
+}
+.ql-toolbar-container .ql-format-button.ql-strike:before {
+ content: "\e804";
+}
+.ql-toolbar-container .ql-format-button.ql-link:before {
+ content: "\e805";
+}
+.ql-toolbar-container .ql-format-button.ql-image:before {
+ content: "\e806";
+}
+.ql-toolbar-container .ql-format-button.ql-list:before {
+ content: "\e807";
+}
+.ql-toolbar-container .ql-format-button.ql-bullet:before {
+ content: "\e808";
+}
+.ql-toolbar-container .ql-format-button.ql-indent:before {
+ content: "\e809";
+}
+.ql-toolbar-container .ql-format-button.ql-outdent:before {
+ content: "\e80A";
+}
+.ql-toolbar-container .ql-format-button.ql-superscript:before {
+ content: "\e80F";
+}
+.ql-toolbar-container .ql-format-button.ql-subscript:before {
+ content: "\e810";
+}
+.ql-toolbar-container .ql-format-button.ql-authorship:before {
+ content: "\e811";
+}
+/* Fix for iOS not losing hover state after click */
+.ql-toolbar-container.ios .ql-format-button:hover {
+ color: inherit;
+}
+.ql-toolbar-container.ios .ql-format-button.ql-active,
+.ql-toolbar-container.ios .ql-format-button.ql-on {
+ color: #06c;
+}
+.ql-picker {
+ box-sizing: border-box;
+ font-size: 13px;
+ display: inline-block;
+ font-family: 'Helvetica', 'Arial', sans-serif;
+ font-weight: bold;
+ position: relative;
+}
+.ql-picker .ql-picker-label {
+ box-sizing: border-box;
+ display: inline-block;
+ height: 24px;
+ line-height: 24px;
+ vertical-align: middle;
+ background-color: #fff;
+ border: 1px solid transparent;
+ cursor: pointer;
+ padding-left: 8px;
+ padding-right: 8px;
+ position: relative;
+ width: 100%;
+}
+.ql-picker .ql-picker-label:after {
+ content: "\e812";
+ float: right;
+ font-family: 'quill-snow';
+ font-size: 12px;
+ margin-left: 8px;
+}
+.ql-picker .ql-picker-label.ql-active,
+.ql-picker .ql-picker-label:hover {
+ color: #06c;
+}
+.ql-picker .ql-picker-options {
+ background-color: #fff;
+ border: 1px solid transparent;
+ box-sizing: border-box;
+ display: none;
+ padding: 4px 8px;
+ position: absolute;
+ width: 100%;
+}
+.ql-picker .ql-picker-options .ql-picker-item {
+ box-sizing: border-box;
+ cursor: pointer;
+ display: block;
+ padding-bottom: 6px;
+ padding-top: 6px;
+}
+.ql-picker .ql-picker-options .ql-picker-item.selected,
+.ql-picker .ql-picker-options .ql-picker-item:hover {
+ color: #06c;
+}
+.ql-picker.ql-expanded .ql-picker-label {
+ border-color: #ccc;
+ color: #ccc;
+ z-index: 2;
+}
+.ql-picker.ql-expanded .ql-picker-options {
+ border-color: #ccc;
+ box-shadow: rgba(0,0,0,0.2) 0 2px 8px;
+ display: block;
+ margin-top: -1px;
+ z-index: 1;
+}
+.ql-picker.ql-font {
+ width: 105px;
+}
+.ql-picker.ql-size {
+ width: 80px;
+}
+.ql-picker.ql-align {
+ font-family: 'quill-snow';
+}
+.ql-picker.ql-align .ql-picker-label {
+ margin-top: 1px;
+}
+.ql-picker.ql-align .ql-picker-label:after {
+ content: normal;
+}
+.ql-picker.ql-align .ql-picker-options {
+ width: 32px;
+}
+.ql-picker.ql-align .ql-picker-label[data-value=left]:before,
+.ql-picker.ql-align .ql-picker-item[data-value=left]:before {
+ content: "\e80B";
+}
+.ql-picker.ql-align .ql-picker-label[data-value=right]:before,
+.ql-picker.ql-align .ql-picker-item[data-value=right]:before {
+ content: "\e80C";
+}
+.ql-picker.ql-align .ql-picker-label[data-value=center]:before,
+.ql-picker.ql-align .ql-picker-item[data-value=center]:before {
+ content: "\e80D";
+}
+.ql-picker.ql-align .ql-picker-label[data-value=justify]:before,
+.ql-picker.ql-align .ql-picker-item[data-value=justify]:before {
+ content: "\e80E";
+}
+.ql-picker.ql-color-picker {
+ width: 32px;
+}
+.ql-picker.ql-color-picker .ql-picker-label {
+ background-position: center center;
+ background-repeat: no-repeat;
+}
+.ql-picker.ql-color-picker .ql-picker-label:after {
+ content: normal;
+}
+.ql-picker.ql-color-picker .ql-picker-options {
+ padding: 6px;
+ width: 154px;
+}
+.ql-picker.ql-color-picker .ql-picker-options .ql-picker-item {
+ border: 1px solid transparent;
+ float: left;
+ height: 16px;
+ margin: 2px;
+ padding: 0px;
+ width: 16px;
+}
+.ql-picker.ql-color-picker .ql-picker-options .ql-picker-item.ql-primary-color {
+ margin-bottom: 8px;
+}
+.ql-picker.ql-color-picker .ql-picker-options .ql-picker-item.selected,
+.ql-picker.ql-color-picker .ql-picker-options .ql-picker-item:hover {
+ border-color: #000;
+}
+.ql-picker.ql-color .ql-picker-label {
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNR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brnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAPNJREFUeNqkkzFOw0AQRd9agpaWBiFRubA4ABRuIhoqy5IpqSi4gntzA0TtylY6+wRJgaIcYE/ALRLJnyITQ0IU4fhLXzv7Z/RnVrvrJDEGASPhnHPH8h+2vp4ywTWwAi4tHmwwAZbAmcWDDWJgYSbxUIMbYA1cAF/AlWl/DZqmOaQ/AiHwDrwA56btoCzLzQRFUeznHoBn4N74aVqPPM9/jhBFEZK2nEq6lfRm+ztJT6ZNt3VhGG7eQdu2AEiiqirquu67ZFmG9x7vfa+laUqSJH3DHYPf7LruYLzPAJgBOpGz4Ngd/wNxAMxHGMzd2O/8PQB/SZTPHTSGPwAAAABJRU5ErkJggg==");
+}
+.ql-picker.ql-color .ql-picker-label.ql-active,
+.ql-picker.ql-color .ql-picker-label:hover,
+.ql-picker.ql-color.ql-expanded .ql-picker-label {
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhE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/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAAJdJREFUeNqskyEOAjEQRd9NCIQDoDkKioTkuz0CF8ChUBgkBgGeNVziO05SBCM2JGxaBvHSmd/OS9OklFLIQFqAPMYh+H5mZHOCvEe+RN0s2CCvkG9RNwtOyFPkbdRNghnyEXmBvEa+R1Yt6JAfH3QtgivyfNDvIqsSnJGfsYK8jH6YVT1iHf8Q9MjlR3oSw2/SN8j+xtcA4sDVwxxfMTsAAAAASUVORK5CYII=");
+}
+.ql-picker.ql-background .ql-picker-label {
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA/klEQVQ4T6WPvWoCQRSF3V4rxZ81AX/aFEJsBJs8hG5EkYQQm0Cq1HZ5BLHRztZSSCVY+lTrOcOZ5e5GRHHgm3vunTMHbi6O49w9uCsIgjIYglv0iw2INCRXaxvgU1+N6UlzQu3n3pNaoQJGqmSgjytxzjOyAWPz4HUDLMBOupf1ZFfgw0SV/Uz9n/Q/jw2ogqlqUeYNaIK5NGdcgR7ntwFv5qEPWmANOnrba5aXx/mzK9TAOyiBL3DIwFlBHoakVuDnD1X2W9CWJr+aea/z24BP83kJjqrsn9XbmfOnVsAJUbsyXIKekB+SAJwH8A3qt2gbEIFHCpyfa3UScA8nZ0rfoKKU4c8AAAAASUVORK5CYII=");
+}
+.ql-picker.ql-background .ql-picker-label.ql-active,
+.ql-picker.ql-background .ql-picker-label:hover,
+.ql-picker.ql-background.ql-expanded .ql-picker-label {
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA+ElEQVQ4y2P4//8/AyUYQqTdEgPiMBLZjsgGhEMFxUhhww1AMjUCSZEOkpwOkngETDOyC8SBOBJKg3AoVHwOCONQE4lsQDSSBIytAMRTgXgrlG2JrgbdCyCJGLhE2q00KH8HiI1NDbILJIA4DkoLQ8WWALEiENeB2FCxSKgasHpkAxKQJGyAWAmI5wKxAVRuH1SMB6oGrB7dC5JAnAjEIkCcDcQH0TBIjBeqRgLdCyDNySAayl8LxMpIhreCxJDUgtUjG5CKpHk6EJ8E0VC+MZSPLIZQj2SLFBCbEEz7QDUgtehekAHiPCCWJoWNnhdkoewSktiUZmcAal4Wl39PVNwAAAAASUVORK5CYII=");
+}