/* eslint-disable no-unused-vars /* eslint-disable fecs-camelcase 
组件编译的模板函数

@inner
163893
function compileSourcePreCode() {
    var $version = '##version##';

    var componentRenderers = {};

    function extend(target, source) {
        if (source) {
            Object.keys(source).forEach(function (key) {
                var value = source[key];
                if (typeof value !== 'undefined') {
                    target[key] = value;
                }
            });
        }

        return target;
    }

    function each(array, iterator) {
        if (array && array.length > 0) {
            for (var i = 0, l = array.length; i < l; i++) {
                if (iterator(array[i], i) === false) {
                    break;
                }
            }
        }
    }

    function contains(array, value) {
        var result;
        each(array, function (item) {
            result = item === value;
            return !result;
        });

        return result;
    }

    var HTML_ENTITY = {
        /* jshint ignore:start */
        '&': '&amp;',
        '<': '&lt;',
        '>': '&gt;',
        '"': '&quot;',
        /* eslint-disable quotes */
        "'": '&#39;'
        /* eslint-enable quotes */
        /* jshint ignore:end */
    };

    function htmlFilterReplacer(c) {
        return HTML_ENTITY[c];
    }

    function escapeHTML(source) {
        if (source == null) {
            return '';
        }

        if (typeof source === 'string') {
            return source ? source.replace(/[&<>"']/g, htmlFilterReplacer) : '';
        }

        return '' + source;
    }

    function _classFilter(source) {
        if (source instanceof Array) {
            return source.join(' ');
        }

        return source;
    }

    function _styleFilter(source) {
        if (typeof source === 'object') {
            var result = '';
            if (source) {
                Object.keys(source).forEach(function (key) {
                    result += key + ':' + source[key] + ';';
                });
            }

            return result;
        }

        return source;
    }

    function _xclassFilter(source) {
        if (source instanceof Array) {
            source = source.join(' ');
        }

        return source ? ' ' + source : '';
    }

    function _xstyleFilter(source) {
        var result;
        if (typeof source === 'object') {
            result = '';
            if (source) {
                Object.keys(source).forEach(function (key) {
                    result += key + ':' + source[key] + ';';
                });
            }
        }
        else {
            result = source;
        }

        return result ? ';' + result : '';
    }

    function attrFilter(name, value) {
        if (value) {
            return ' ' + name + '="' + value + '"';
        }

        return '';
    }

    function boolAttrFilter(name, value) {
        if (value && value !== 'false' && value !== '0') {
            return ' ' + name;
        }

        return '';
    }

    function callFilter(ctx, name, args) {
        var filter = ctx.proto.filters[name];
        if (typeof filter === 'function') {
            return filter.apply(ctx, args);
        }
    }
}
414467
function camelCase(str) {
  if (str.indexOf('-') > -1) {
    str = str.replace(/-\w/g, function (letter) {
      return letter.substr(1).toUpperCase();
    });
  }

  return str;
}
927893
function stamp(obj) {
    if (!obj.__fe_id) {
        lastId += 1;
        obj.__fe_id = lastId; // eslint-disable-line camelcase
    }

    return obj.__fe_id;
}
711146
function(_dest, _src){
                var _nodeName, _attr;

                if (_dest.nodeType !== 1) {
                    return;
                }
                // lt ie9 才有
                if (_dest.clearAttributes) {
                    _dest.clearAttributes();
                    _dest.mergeAttributes(_src);
                }
                // 判断是否有需要处理属性的节点
                _nodeName = _dest.nodeName.toLowerCase();
                if(_prop = _definitions.fixProps[_nodeName]){
                    _dest[_prop] = _src[_prop];
                }
                //移除节点标示
                _dest.removeAttribute($._$signal);
                // 移除ID:  TODO? 是否允许有重复ID?
                _dest.removeAttribute("id");
            }
415432
private String[] underscoreName(String camelCaseName) {
        StringBuilder result = new StringBuilder();
        if (camelCaseName != null && camelCaseName.length() > 0) {
            result.append(camelCaseName.substring(0, 1).toLowerCase());
            for (int i = 1; i < camelCaseName.length(); i++) {
                char ch = camelCaseName.charAt(i);
                if (Character.isUpperCase(ch)) {
                    result.append("_");
                    result.append(Character.toLowerCase(ch));
                } else {
                    result.append(ch);
                }
            }
        }
        String name = result.toString();
        // 当name为user1_name2时，使name2为user_1_name_2
        // 这使得列user_1_name_2的列能映射到user1Name2属性
        String name2 = null;
        boolean digitFound = false;
        for (int i = name.length() - 1; i >= 0; i--) {
            if (Character.isDigit(name.charAt(i))) {
            	// 遇到数字就做一个标识并continue,直到不是时才不continue
                digitFound = true;
                continue;
            }
            // 只有上一个字符是数字才做下划线
            if (digitFound && i < name.length() - 1 && i > 0) {
                if (name2 == null) {
                    name2 = name;
                }
                name2 = name2.substring(0, i + 1) + "_" + name2.substring(i + 1);
            }
            digitFound = false;
        }
        return new String[] { name, name2 };
    }
900479
function deleteCodeComments(code) {
    // 另一种思路更简便的办法
    // 将'://'全部替换为特殊字符，删除注释代码后再将其恢复回来
    var tmp1 = ':\/\/';
    var regTmp1 = /:\/\//g;
    var tmp2 = '@:@/@/@';
    var regTmp2 = /@:@\/@\/@/g;
    code = code.replace(regTmp1, tmp2);
    code = code.replace(rComments, '');
    return code.replace(regTmp2, tmp1);
}
788716
function (rawStyle) {
    this.styles = {};
    rawStyle.split(';').forEach(function (style) {
      style = style.trim();
      var firstColon = style.indexOf(':');
      var key = style.substr(0, firstColon);
      var value = style.substr(firstColon + 1).trim();
      if (key !== '') {
        // Style key should be case insensitive
        key = key.toLowerCase();
        this.styles[key] = value;
      }
    }, this);
  }
923750
function(s, v) {
    if (arguments.length == 0) {
      // get full style
      return this.node.style.cssText || ''

    } else if (arguments.length < 2) {
      // apply every style individually if an object is passed
      if (typeof s == 'object') {
        for (v in s) this.style(v, s[v])

      } else if (SVG.regex.isCss.test(s)) {
        // parse css string
        s = s.split(';')

        // apply every definition individually
        for (var i = 0; i < s.length; i++) {
          v = s[i].split(':')
          this.style(v[0].replace(/\s+/g, ''), v[1])
        }
      } else {
        // act as a getter if the first and only argument is not an object
        return this.node.style[camelCase(s)]
      }

    } else {
      this.node.style[camelCase(s)] = v === null || SVG.regex.isBlank.test(v) ? '' : v
    }

    return this
  }
836386
function transformPropertiesToCamelCase (object) {
  var output = {}

  for (var _key in object) {
    if (typeof object === 'string') { return object.replace(' !important', '') }
    var key = _key
    var value = object[_key]
    if (~key.indexOf('-')) {
      var splittedKeys = key.split('-')
      splittedKeys = splittedKeys.map(function (v, i) {
        return i > 0
        // UCFIRST if ! first element
        ? v.charAt(0).toUpperCase() + v.substr(1) : v
      })
      key = splittedKeys.join('')
    }
    output[key] = transformPropertiesToCamelCase(value)
  }
  return output
}
214407
function createNthFilter(isNext, isType) {
    var next, prev, cacheKey, getStart;
    if (isNext) {
      cacheKey = isType ? "type" : "child";
      // if(typeof isType === "function") cacheKey = "match"
      next = nthNext;
      prev = nthPrev;
      getStart = nthChild;
    } else {
      // Fixed:!!! 这里cache是首次生成的cache被写死了，即使后面clear了也没有用,
      // 即永远无法被释放
      cacheKey = "last" + (isType ? "type" : "child");
      // if(typeof isType === "function") cacheKey = "last-match"
      prev = nthNext;
      next = nthPrev;
      getStart = nthLastChild;
    }
    // 实际返回函数, param即pesudo的action定义的参数形如
    // `{step:1, start:1}` 所有的类似even、odd或者其他形如n、-3n-11都会标准化
    // 成这种形势
    return function(node, param) {
      var cache = nthPositionCache[cacheKey];
      if (node === root) return false; // 如果是html直接返回false 坑爹啊
      var _uid = getUid(node),
        parent = node.parentNode,
        traverse = param.step > 0 ? next : prev,
        step = param.step,
        start = param.start,
        type = isType && node.nodeName;
        //Fixed
      if (step === null) return false; //means always false
      if (!cache[_uid]) {
        var startNode = getStart(parent, type),
          index = 0;
          do {
            cache[getUid(startNode)] = ++index;
            nthPositionCache.length++;
          } while (startNode = next(startNode, type));
      }
      var position = cache[_uid];
      if (step === 0) return position === start;
      return ((position - start) / step >= 0) && ((position - start) % step === 0);
    };
  }
278993
function configureESLint(options) {
	const ESLintConfig = {
		rules: options.rules
	}

	ESLintConfig.extends = 'xo'
	if (options.esnext) {
		ESLintConfig.extends = 'xo/esnext'
	}

	if (!options.semicolon) {
		ESLintConfig.rules.semi = [2, 'never']
	}

	if (options.space === false) {
		ESLintConfig.rules.indent = [
			2, 'tab', {
				SwitchCase: 1
			}
		]
	} else {
		ESLintConfig.rules.indent = [
			2, parseInt(options.space, 10), {
				SwitchCase: 0
			}
		]
	}

	ESLintConfig.rules['valid-jsdoc'] = [0]
	ESLintConfig.rules['require-jsdoc'] = [0]

	console.debug(stripIndent`
		${clr.title}ESlint Options${clr.title.out}:
	`)
	if (console.canWrite(5)) {
		console.pretty(ESLintConfig, 2)
	}

	return () => new ESLint({
		baseConfig: ESLintConfig,
		fix: true,
		rules: options.rules
	})
}
21790
function camelCase(str) {
    return str
        .replace(/[-_\s]+(.)/gu, (_, c) => c.toUpperCase())
        .replace(/^./u, c => c.toLowerCase())
}
943689
function camelCase(str, delim) {
        var delims = delim || ['_', '.', '-'];

        if (!_.isArray(delims)) {
            delims = [delims];
        }

        _.each(delims, function (adelim) {
            var codeParts = str.split(adelim);
            var i, codePart;

            for (i = 1; i < codeParts.length; i++) {
                codePart = codeParts[i];
                codeParts[i] = codePart.substring(0, 1).toUpperCase() + codePart.substring(1);
            }

            str = codeParts.join('');
        });

        return str;
    }
661415
function camelize(obj) {
        var _this = this;

        var _camelize = function _camelize(str) {
            str = stringHelpers.underscore(str);
            str = stringHelpers.slugifyText(str);

            return str.replace(/[_.-\s](\w|$)/g, function (_, x) {
                return x.toUpperCase();
            });
        };

        if (validateHelpers.isDate(obj) || validateHelpers.isRegExp(obj)) {
            return obj;
        }

        if (validateHelpers.isArray(obj)) {
            return obj.map(function (item, index) {
                if (validateHelpers.isObject(item)) {
                    return _this.camelize(item);
                }

                return item;
            });
        }

        if (validateHelpers.isString(obj)) {
            return _camelize(obj);
        }

        return Object.keys(obj).reduce(function (acc, key) {
            var camel = _camelize(key);
            acc[camel] = obj[key];

            if (validateHelpers.isObject(obj[key])) {
                acc[camel] = _this.camelize(obj[key]);
            }

            return acc;
        }, {});
    }
1347447
function(data, vmodels) {
            var text = data.value.trim(),
                    simple = true
            if (text.indexOf(openTag) > -1 && text.indexOf(closeTag) > 2) {
                simple = false
                if (rexpr.test(text) && RegExp.rightContext === "" && RegExp.leftContext === "") {
                    simple = true
                    text = RegExp.$1
                }
            }
            data.handlerName = "attr" //handleName用于处理多种绑定共用同一种bindingExecutor的情况
            parseExprProxy(text, vmodels, data, (simple ? null : scanExpr(data.value)))
        }
754568
function errNameFromDesc(desc) {

    assert.string(desc, 'desc');

    // takes an error description, split on spaces, camel case it correctly,
    // then append 'Error' at the end of it.
    // e.g., the passed in description is 'Internal Server Error'
    //       the output is 'InternalServerError'
    var pieces = desc.split(/\s+/);
    var name = _.reduce(pieces, function(acc, piece) {
        // lowercase all, then capitalize it.
        var normalizedPiece = _.capitalize(piece.toLowerCase());
        return acc + normalizedPiece;
    }, '');

    // strip all non word characters
    name = name.replace(/\W+/g, '');

    // append 'Error' at the end of it only if it doesn't already end with it.
    if (!_.endsWith(name, 'Error')) {
        name += 'Error';
    }

    return name;
}
683782
function beforeCreate () { // eslint-disable-line no-inner-declarations
    // 将 element 挂到 vue 下方便使用
    this.$element = element

    this.$emit = function emit (eventName, ...args) {
      customEmit(element, eventName, ...args)
      viewer.eventAction.execute(eventName, element, ...args)
      this.__proto__ && this.__proto__.$emit.call(this, eventName, ...args) // eslint-disable-line no-proto
    }

    this.$on = function on (eventName, callback) {
      this.__proto__ && this.__proto__.$on.call(this, eventName, callback) // eslint-disable-line no-proto
      element.customElement.addEventAction(eventName, callback)
    }
  }