对系统的判断来自：https://github.com/madrobby/zepto/blob/master/src/detect.js
341128
function isIos() {
  const ua = navigator.userAgent;
  const ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
  const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
  const iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
  const os = {};
  if (iphone && !ipod) {
    os.ios = true;
    os.iphone = true;
    os.version = iphone[2].replace(/_/g, '.');
  }
  if (ipad) {
    os.ios = true;
    os.ipad = true;
    os.version = ipad[2].replace(/_/g, '.');
  }
  if (ipod) {
    os.ios = true;
    os.ipod = true;
    os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
  }
  return os.ios;
}
486506
function stageFiles (patterns, ignorePatterns) {
  const baseDir = getBaseDir()

  // 如果 baseDir 根本不存在 sgf 会抛出异常
  if (!fs.existsSync(baseDir)) {
    return Promise.resolve([])
  }

  sgf.cwd = baseDir

  return new Promise(resolve => {
    sgf((err, result) => {
      if (err) {
        debug('staged-git-files error: %o', err)
        return resolve([])
      }

      const fileList = result
        .filter(item => item.status !== 'Deleted') // 过滤已删除的文件
        .filter(item => match(item.filename, patterns, ignorePatterns))
        .map(item => item.filename)

      resolve(fileList)
    })
  })
}
1306595
function installHooks () {
  // 开发过程中不执行
  if (!cwd.includes('node_modules')) {
    return
  }

  // 确保目录存在
  fs.ensureDirSync(destDirPath)

  // 部署 scripts
  fs.copySync(scriptPath, destScriptPath)

  // 兼容 windows
  if (process.platform === 'win32') {
    const cmdScriptPath = path.join(__dirname, '../scripts/postinstall.cmd')
    const destCmdScriptPath = path.join(destDirPath, 'postinstall.cmd')

    fs.copySync(cmdScriptPath, destCmdScriptPath)
  }

  // 添加执行权限
  fs.chmodSync(destScriptPath, 0o755)
}
904062
function pHandle(e) {
            const $selectionElem = editor.selection.getSelectionContainerElem()
            const $parentElem = $selectionElem.parent()

            if ($parentElem.html() === '<code><br></code>') {
                // 回车之前光标所在一个 <p><code>.....</code></p> ，忽然回车生成一个空的 <p><code><br></code></p>
                // 而且继续回车跳不出去，因此只能特殊处理
                insertEmptyP($selectionElem)
                return
            }

            if (!$parentElem.equal($textElem)) {
                // 不是顶级标签
                return
            }

            const nodeName = $selectionElem.getNodeName()
            if (nodeName === 'P') {
                // 当前的标签是 P ，不用做处理
                return
            }

            if ($selectionElem.text()) {
                // 有内容，不做处理
                return
            }

            // 插入 <p> ，并将选取定位到 <p>，删除当前标签
            insertEmptyP($selectionElem)
        }
109693
function _doMain(jsonObj,isDir2TreeStr){
    if(false!==jsonObj){
        isDir2TreeStr = !!isDir2TreeStr;
        let treeStr;
        try{
            // console.time(colorful.green("\nConvert takes"));
            treeStr = jsonToy.treeString(jsonObj,{
                rootName: jsonName,
                space: s,
                vSpace: v,
                needValueOut: outputVal,
                msReturnChar: needMsEol
            });
            // console.timeEnd(colorful.green("\nConvert takes"));
        }catch(e2){
            errorOut(e2.toString());
        }
        if(!!treeStr){
            if(!isDir2TreeStr){
                console.log(treeStr);
            }else{
                // 当显示的是文件目录，将"文件夹"字段变成蓝色显示，这里仅仅是对显示进行转换，而不对源内容转换，因为远内容还要用做复制到剪切板
                let newTreeStr = "" + treeStr;
                let resArr = [];
                let filterOutStr = " (ignored) /";
                newTreeStr.split("\n").forEach(k=>{
                    k = k.replace(/\r/g,"");
                    let mt = k.match(/[└├─]\s([\S]+[\s\S]*\s\/$)/);
                    if(mt && mt[1]){
                        let ov = mt[1],nv;
                        if(ov.substr(-filterOutStr.length) === filterOutStr){
                          let foArr = ov.split(filterOutStr);
                          nv = colorful.cyan(foArr[0]) + colorful.gray(filterOutStr);
                        }else{
                            nv = colorful.cyan(ov);
                        }
                        k = k.replace(ov,nv);
                    }
                    resArr.push(k);
                });
                console.log(resArr.join("\n"));
            }
            if(!Type.isObject.isEmptyOwn(jsonObj) && needCopy){
                clipboardy.write(treeStr)
                    .then(()=>console.log(colorful.success("Copy tree-string success!")));
            }
        }
    }
}
446412
function unzip(src, dist) {
    if (isString(src)) {

        // 获取输出目录
        if (arguments.length === 1) {
            dist = src.replace(/\.zip$/, '');
        }

        // 校验参数
        if (isString(dist)) {
            return new Promise((resolve, reject) => {
                let archive = fs.createReadStream(src),
                    output = unarchiver.Extract({ path: dist });

                // 监听回调
                archive.on('error', reject);
                output.on('error', reject);
                output.on('close', resolve);

                // 设置管道输出
                archive.pipe(output);
            });
        }
    }
}
317255
function resolve(dir, model = null) {

    // 解析模块
    try {
        let data = require(path.cwd(dir));
        return model && data ? { ...model, ...data } : data;
    } catch (err) {
        // do nothing;
    }

    // 执行回调
    return model;
}
918489
function changeSrc (childList, imgIndex, arraySrc) {
  // 由于懒加载方案是修改 src，所以在第一次加载图片的时候需要修改所有图片的 src，如若不是图片('no-src')则重定向，防止404。
  let src = arraySrc[imgIndex] !== 'no-src' ? arraySrc[imgIndex] : '?mip_img_ori=1'
  for (let i = 0; i < childList.length; i++) {
    if (childList[i].tagName === 'MIP-IMG') {
      childList[i].setAttribute('src', src)
    } else {
      let mipImg = childList[i].querySelector('mip-img')
      mipImg && mipImg.setAttribute('src', src)
    }
  }
  return childList
}
674154
function checkAndInitVars(doc, src, $dataKeys, $optsKeys){
	let scope;
	try{
		scope = acornGlobals(src);
		if ( !scope.length ) return src; // 正常，直接返回
	}catch(e){
		throw Err.cat('source syntax error', '\n-----------------', src, '\n-----------------', 'file='+ doc.file, e); // 多数表达式中有语法错误导致
	}

	// 函数内部添加变量声明赋值后返回
	let vars = [];

	for ( let i=0, v; i<scope.length; i++ ) {
		v = scope[i];
		let inc$data = $dataKeys.includes(v.name);
		let inc$opts = $optsKeys.includes(v.name);
		let incJsVars = JS_VARS.includes(v.name);
		if ( !inc$data && !inc$opts && !incJsVars) {
			let msg = 'template variable undefined: ' + v.name;
			throw Err.cat(MODULE + doc.file, $dataKeys, new Err(msg));		// 变量不在$state或$options的属性范围内
		}
		if ( inc$data && inc$opts ) {
			let msg = 'template variable uncertainty: ' + v.name;
			throw Err.cat(MODULE + doc.file, new Err(msg));					// 变量同时存在于$state和$options，无法自动识别来源，需指定
		}


		if ( inc$data ) {
			vars.push(`let ${v.name} = $state.${v.name};`)
		}else if ( inc$opts ) {
			vars.push(`let ${v.name} = $options.${v.name};`)
		}
	}

	return FN_TMPL_DEF + vars.join('\n') + src.substring(FN_TMPL_DEF.length);
}
157576
function checkError( id, hard ) {
            if ( visited[ id ] || modIs( id, MODULE_DEFINED ) ) {
                return;
            }

            visited[ id ] = 1;

            if ( !modIs( id, MODULE_PREPARED ) ) {
                // HACK: 为gzip后体积优化，不做抽取
                if ( !hangModulesMap[ id ] ) {
                    hangModulesMap[ id ] = 1;
                    hangModules.push( id );
                }
            }

            var module = modModules[ id ];
            if ( !module ) {
                if ( !missModulesMap[ id ] ) {
                    missModulesMap[ id ] = 1;
                    missModules.push( id );
                }
            }
            else if ( hard ) {
                if ( !hangModulesMap[ id ] ) {
                    hangModulesMap[ id ] = 1;
                    hangModules.push( id );
                }

                each(
                    module.depMs,
                    function ( dep ) {
                        checkError( dep.absId, dep.hard );
                    }
                );
            }
        }
1206613
function getOriginApi(apiMap, apiName) {
    // 如果为全局mock模式，则直接修改apiName对应的mock路径，例如：
    // http://127.0.0.1:3000/__MOCK__/blog/blogApi
    if (config.isFullMock) {
      return `${config.mockPath}/${apiName}/`
    } else {
      const originApi = apiMap[apiName];

      // 如果在api配置中查找不到对应的api则报错
      if (!originApi) {
        throw `Undefined proxy url：${path} , please check your api config!`;
      }

      // 对于路由结尾强制添加"/"
      return originApi.replace(/([^\/])$/,'$1/');
    }


  }
817205
function watchOnFile(file, callback) {
  let lastIndex = 0
  let timer

  function read() {
    const stat = fs.statSync(file)

    if (stat.size !== lastIndex) {
      const fd = fs.openSync(file, 'r')
      const buffer = Buffer.alloc(stat.size - lastIndex)

      try {
        fs.readSync(fd, buffer, lastIndex, stat.size - lastIndex)
        const content = buffer.toString('utf8')
        lastIndex = stat.size

        callback(content)
      } catch (error) {
        // 从头读起
        lastIndex = 0
      }
    }

    timer = setTimeout(read, 200)
  }

  read()
  return function() {
    clearTimeout(timer)
  }
}
1104765
function (unloadedMods, errorList, stack, cache, ret) {
            var i, m, mod, modStatus,
                stackDepth,
                self = this;

            if ('@DEBUG@') {
                stack = stack || [];
            }
            ret = ret || [];
            // 提高性能，不用每个模块都再次全部依赖计算
            // 做个缓存，每个模块对应的待动态加载模块
            cache = cache || {};

            for (i = 0; i < unloadedMods.length; i++) {
                mod = unloadedMods[i];
                m = mod.name;

                if (cache[m]) {
                    continue;
                }

                if ('@DEBUG@') {
                    stackDepth = stack.length;
                }

                modStatus = mod.status;
                if (modStatus === ERROR) {
                    errorList.push(mod);
                    cache[m] = 1;
                    continue;
                }
                if (modStatus > LOADED) {
                    cache[m] = 1;
                    continue;
                } else if (modStatus !== LOADED && !mod.contains(self)) {
                    if (modStatus !== LOADING) {
                        mod.status = LOADING;
                        ret.push(mod);
                    }
                    mod.add(self);
                    self.wait(mod);
                }

                if ('@DEBUG@') {
                    // do not use indexOf, poor performance in ie8
                    if (stack[m]) {
                        S.log('find cyclic dependency between mods: ' + stack, 'warn');
                        cache[m] = 1;
                        continue;
                    } else {
                        stack[m] = 1;
                        stack.push(m);
                    }
                }

                self.calculate(mod.getNormalizedRequiredModules(), errorList, stack, cache, ret);
                cache[m] = 1;
                if ('@DEBUG@') {
                    for (var si = stackDepth; si < stack.length; si++) {
                        stack[stack[si]] = 0;
                    }
                    stack.length = stackDepth;
                }
            }

            return ret;
        }
107846
function matchState(model) {
    return function match(...args) {
        let url = model.pathname,
            path = resolve(...args);

        // 完全匹配
        if (url === path) {
            return { url, path, matched: true, isExact: true };
        }

        // 部分匹配
        if (path === '/' || url.startsWith(path + '/')) {
            return { url, path, matched: true, isExact: false };
        }

        // 不匹配
        return { url, path, matched: false, isExact: false };
    };
}
1015541
function EventSystem() {
	//索引要用甚麼?
	this.iEventInx = "";
	//事件名稱
	this.strEventName = "";
	//事件等級 1:一般 2:警告 3:急迫
	this.iEventLevel = 1;
	//事件開關(就開跟關)
	this.bSwitch = false;
	//觸發群組
	this.groupID = "";
	//信箱通知勾選
	this.bEmail = false;
	//簡訊通知
	this.bSMS = false;
	//觸發快照
	this.bSnapshot = false;
	//電子郵件通知管理者
	this.bEmailAdmin = false;
	//簡訊通知管理者
	this.bSMSAdmin = false;
	//畫面外框閃爍紅色線框
	this.bScreenFlash = false;
	//報警提示
	this.bCallPolice = false;
	//畫面彈跳
	this.bScreenBounce = false;
	//回播跳出
	this.bPlaybackJump = false;
	//FTP上傳
	this.bFTP = false;
	//可設定一首MP3上傳檔案(每個事件獨立音檔)。
	this.strMp3 = "";
	//可讓使用者設定播放秒數(開始)
	this.iMp3PlayBin = 0;
	//可讓使用者設定播放秒數(結束)
	this.iMp3PlayEnd = 0;
	//Loop
	this.bLoop = false;
}
566808
function parseChildren() {

		let ary = [], node;

		// 循环直到遇见标签闭合Token
		while ( !reader.eof() && reader.getCurrentToken().type != options.TypeTagClose ) {
			node = parseTag();
			node && ary.push(node);

			node = parseComment();
			node && ary.push(node);

			node = parseCodeBlock();
			node && ary.push(node);

			node = parseText();
			node && ary.push(node);

			node = parseExpression();
			node && ary.push(node);
		}

		return ary;
	}
914647
function init() {
  const {supportCordova = false} = this.config;

  onReady = onReady.bind(this);

  /***
   * 如果开启了对cordova的支持
   */
  if (supportCordova) {
    /***
     * 如果开启了对cordova的支持，那么页面完成事件和cordova的deviceReady事件必须同时完成后才能支持后续代码
     */
    Promise.all([
      readyPromise(),
      DOMContentLoadedPromise(),
      devicereadyPromise()
    ]).then(() => {
      onReady();
      fireEvent(window.document, "DOMContentAndDeviceReady");
    }).catch((error) => {

    });
  }
  else {
    /***
     * 页面载入完成事件
     */
    $(window.document).ready(onReady);

    /***
     * 自动 init
     */
    window.addEventListener("DOMContentLoaded", onReady);
  }
}