[
  {
    "path": ".editorconfig",
    "content": "# http://editorconfig.org\nroot = true\n\n[*]\nindent_style = space\nindent_size = 2\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n[*.md]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": ".gitattributes",
    "content": "* text=auto\n"
  },
  {
    "path": ".gitignore",
    "content": ".DS_Store\nThumbs.db\n.sass-cache\n.idea\nlib-cov\n*.seed\n*.log\n*.csv\n*.dat\n*.out\n*.pid\n*.gz\n\npids\nlogs\nresults\n\nnpm-debug.log\nnode_modules\ndist\n"
  },
  {
    "path": ".jshintrc",
    "content": "{\n  \"node\": true,\n  \"esnext\": true,\n  \"bitwise\": true,\n  \"camelcase\": true,\n  \"curly\": true,\n  \"eqeqeq\": true,\n  \"immed\": true,\n  \"indent\": 2,\n  \"latedef\": true,\n  \"newcap\": true,\n  \"noarg\": true,\n  \"quotmark\": \"single\",\n  \"undef\": true,\n  \"unused\": true,\n  \"strict\": true\n}\n"
  },
  {
    "path": ".travis.yml",
    "content": "sudo: false\nlanguage: node_js\nnode_js:\n  - 'iojs'\n  - '0.12'\n  - '0.10'\n"
  },
  {
    "path": ".yo-rc.json",
    "content": "{\n  \"generator-generator\": {}\n}"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 unbug\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "[![NPM](https://nodei.co/npm/generator-webappstarter.png?downloads=true&downloadRank=true)](https://nodei.co/npm/generator-webappstarter/)\n  \n  >Note: This generator is supporting a very early stage app,things gonna change very frequently,so please do not fork it or do any pull request.\n  \nReadme\n=================\nwebappstarter generator will give you a Simple Mobile Web App Boilerplate and Structure!\n\n  >The App will automatically adjusts according to a device’s screen size without any extra work. \n\nInstall\n========\n```shell\nnpm install -g generator-webappstarter\n```\n\nPrereqs and installation requirements\n=====================================\n1.install [node](https://nodejs.org/) and [Python](https://www.python.org/).\n\n2.install [yeoman](http://yeoman.io/).\n```shell\nnpm install -g yo\n```\n3.[optional]Clone this git repo to your local,and from the root of the repo,run\n```shell\nnpm link\n```\nto developing the generator locally.\n\nGenerator commands\n==================\n1.generate a new project,run\n\n```shell\nmkdir myProject\ncd myProject\nyo webappstarter\n```\nor run with `--skip-install` option to skip install dependencies\n\n```shell\nmkdir myProject\ncd myProject\nyo webappstarter --skip-install\n```\ninstall dependencies manually with `npm install` or just copy `node_modules` folder from another project which was generated by webappstarter.\n\n2.generate a new module,run\n\n```shell\n//this command will do:\n//add \"html/include/view-modulename.html\" and inlude it to \"html/include/views.html\"\n//add \"scss/_view-modulename.scss\" and import it to \"scss/_view.scss\"\n//add \"src/app/view/ModuleNameView.js\"\n//add \"src/app/controller/ModuleNameController.js\" and require it in src/app/App.js\n\nyo webappstarter:module ModuleName\n```\n3.generate a new model,run\n\n```shell\n//this command will do:\n//add \"src/app/model/ModelNameModel.js\"\n\nyo webappstarter:model ModelName\n```\n4.update your project's boilerplate and structure\n\n```shell\n//this command will update\n//\"./src/core\" directory\n//\"./src/lib\" directory\n//\"./src/util\" directory\n//\"./src/widget\" directory\n//some files in \"./src/app/\" directory\n//some files in \"./scss/\" directory\n//some files in \"./html/\" directory\n\nyo webappstarter:update\n```\n > Warning: When you are asked before an overwrite can occur,please be careful.Default \"Y\" is overwrite,\"n\" is skip.\n \n\nMore configurations,please take a look at \"project\" property of \"package.json\" file after the generator is done.\nRun ```gulp``` to re-build project is required after change the \"package.json\" file.\n\nProject commands\n=================\nrun this command before you get started.\n\n```shell\nnpm install -g gulp\n```\n\n1.build project,watch change and start browserSync,run\n\n```shell\ngulp\n```\nor run with forever\n```shell\nforever ./node_modules/.bin/gulp\n```\n2.deploy to test server,run\n\n```shell\ngulp deploytest\n```\nPlease update your ftp auth name and password in \".ftppass\".\nView the page on test server [http://office.mozat.com:8083/PROJECTNAME/](http://office.mozat.com:8083/PROJECTNAME/).\nThis command require [openssl](https://www.openssl.org/).\nFor windows,you might needd to add openssl path to classpath.\n\n\n3.deploy to offical server,run\n\n```shell\ngulp deploy\n```\nView the page on offical server [http://m.deja.me/PROJECTNAME/](http://m.deja.me/PROJECTNAME/).\nThis command require [rsync](https://rsync.samba.org/).\nFor windows,unzip  /tools/rsync.zip to a local path and add the path to classpath.\n\n4.run this command to copy source images to project's `resources/images/` path,then generate `scss/_sprites.csss` and `resources/images/sprites.png` for sourceSprites in `package.json`.\n\n```shell\ngulp copy\n``` \n\n5.run this command to start jshint.\n\n```shell\ngulp jshint\n```\n\n6.run this command to start browserSync,Change browserSync options in `package.json`.\n\n```shell\ngulp serve\n``` \n\n7.run this command to start pagespeed,Change pagespeed options in `package.json`.\n\n```shell\ngulp pagespeed\n``` \n\nStructure\n================\nThe structure is modular design,follow the DOOR-KEY rule you only take minutes to understand it:\n  * The DOOR for javascript is in ```/src/app/App.js```,and the KEY is ```require```,see [webpack](https://webpack.github.io/docs/commonjs.html) and [commonjs](http://www.commonjs.org/specs/modules/1.0/)\n  * The DOOR for stylesheets is in ```/scss/styles.scss```,and the KEY is ```@import```,see [SASS](http://sass-lang.com/)\n  * The DOOR for HTML is in ```/html/debug/index.html```,and the KEY is ```@@include```,see [gulp-file-include](https://www.npmjs.com/package/gulp-file-include)\n  \n\nGit\n==========\nRandom git commit message\n\n```shell\n git commit -m\"`curl -s http://whatthecommit.com/index.txt`\"\n ```\n"
  },
  {
    "path": "app/index.js",
    "content": "'use strict';\nvar yeoman = require('yeoman-generator');\nvar chalk = require('chalk');\nvar yosay = require('yosay');\n\nmodule.exports = yeoman.generators.Base.extend({\n  constructor: function () {\n    yeoman.generators.Base.apply(this, arguments);\n\n    this.option('skip-install', {\n      desc: 'Whether dependencies should be installed',\n      defaults: false\n    });\n  },\n\n  askFor: function () {\n    var done = this.async();\n\n    // Have Yeoman greet the user.\n    this.log(yosay('I will give you a Simple Mobile Web App Boilerplate and Structure!'));\n\n    var prompts = [{\n      type: 'input',\n      name: 'name',\n      message: 'Give your project a name:(products|account|config|favorite|creation|feed|feedback|dilog|invite|vote|event|share|monitor|follow,are invalid names).',\n      default: this.appname // Default to current folder name\n    }];\n\n    this.prompt(prompts, function (answers) {\n      this.projectName = answers.name;\n\n      // Save user configuration options to .yo-rc.json file\n      this.config.set({\n        projectName: this.projectName\n      });\n      this.config.save();\n\n      done();\n    }.bind(this));\n  },\n\n  writing: {\n    app: function () {\n      this.template('_package.json', 'package.json');\n\n      this.directory('app', './');\n    },\n\n    projectfiles: function () {\n      this.fs.copy(\n        this.templatePath('ftppass'),\n        this.destinationPath('.ftppass')\n      );\n      this.fs.copy(\n        this.templatePath('gitignore'),\n        this.destinationPath('.gitignore')\n      );\n      this.fs.copy(\n        this.templatePath('editorconfig'),\n        this.destinationPath('.editorconfig')\n      );\n      this.fs.copy(\n        this.templatePath('jshintrc'),\n        this.destinationPath('.jshintrc')\n      );\n    }\n  },\n\n  install: function () {\n    this.installDependencies({\n      bower: false,\n      npm: true,\n      skipInstall: this.options['skip-install'],\n      callback: function () {\n        console.log('Everything is ready!');\n      }\n    });\n  }\n});\n"
  },
  {
    "path": "app/templates/_package.json",
    "content": "{\n  \"name\": \"<%=projectName%>\",\n  \"version\": \"0.0.1\",\n  \"description\": \"Hello <%=projectName%>\",\n  \"project\": {\n    \"invalidNames\": \"products|account|config|favorite|creation|feed|feedback|dilog|invite|vote|event|share|monitor|follow\",\n    \"title\": \"Title - <%=projectName%>\",\n    \"viewport\": 750,\n    \"manifest\": false,\n    \"sourceImg\": \"statics/UI/build/img/**/*.{png,jpg}\",\n    \"sourceSprites\": \"statics/UI/build/assets/*.png\",\n    \"watchJshint\": true,\n    \"watchScsslint\": false,\n    \"babel\": false,\n    \"browserSync\": {\n      \"open\": true,\n      \"server\": {\n        \"baseDir\": \"./\"\n      }\n    },\n    \"pagespeed\": {\n      \"url\": \"http://m.deja.me/<%=projectName%>/\",\n      \"options\": {\n        \"strategy\": \"mobile\"\n      }\n    }\n  },\n  \"dependencies\": {},\n  \"devDependencies\": {\n    \"babel\": \"^5.6.14\",\n    \"babel-core\": \"^6.6.5\",\n    \"babel-loader\": \"^6.2.4\",\n    \"babel-preset-es2015\": \"^6.6.0\",\n    \"babel-preset-react\": \"^6.5.0\",\n    \"browser-sync\": \"^2.11.1\",\n    \"chai\": \"^3.0.0\",\n    \"chai-as-promised\": \"^5.1.0\",\n    \"date-utils\": \"^1.2.16\",\n    \"del\": \"^1.1.1\",\n    \"eslint-config-unstandard\": \"^1.1.0\",\n    \"gulp\": \"^3.9.0\",\n    \"gulp-autoprefixer\": \"^2.1.0\",\n    \"gulp-cachebust\": \"0.0.5\",\n    \"gulp-cached\": \"^1.0.4\",\n    \"gulp-csso\": \"^1.0.0\",\n    \"gulp-file-include\": \"^0.8.0\",\n    \"gulp-if\": \"^1.2.5\",\n    \"gulp-imagemin\": \"^2.2.1\",\n    \"gulp-jshint\": \"^1.9.2\",\n    \"gulp-load-plugins\": \"^0.8.1\",\n    \"gulp-minify-html\": \"^1.0.6\",\n    \"gulp-replace\": \"^0.5.3\",\n    \"gulp-sass\": \"^2.2.0\",\n    \"gulp-scsslint\": \"0.0.5\",\n    \"gulp-sftp\": \"^0.1.4\",\n    \"gulp-size\": \"^1.2.1\",\n    \"gulp-sourcemaps\": \"^1.5.1\",\n    \"gulp-uglify\": \"^1.1.0\",\n    \"gulp-util\": \"^3.0.4\",\n    \"gulp-eslint\": \"^2.0.0\",\n    \"imagemin-pngquant\": \"^4.0.0\",\n    \"jshint-stylish\": \"^1.0.1\",\n    \"log4js\": \"^0.6.26\",\n    \"mocha\": \"^2.2.5\",\n    \"pem\": \"^1.7.1\",\n    \"protractor\": \"^2.5.1\",\n    \"psi\": \"^1.0.6\",\n    \"q\": \"^1.2.0\",\n    \"rsync\": \"^0.4.0\",\n    \"run-sequence\": \"^1.0.2\",\n    \"sprity\": \"^1.0.8\",\n    \"strip-ansi\": \"^3.0.1\",\n    \"through2\": \"^0.6.3\",\n    \"vinyl-source-stream\": \"^1.1.0\",\n    \"wd\": \"^0.3.12\",\n    \"wd-bridge\": \"0.0.2\",\n    \"webpack\": \"^1.12.14\",\n    \"webpack-dev-middleware\": \"^1.5.1\",\n    \"webpack-stream\": \"^3.1.0\"\n  },\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"keywords\": [\n    \"web app\",\n    \"mozat\"\n  ],\n  \"author\": \"unbug\",\n  \"license\": \"MIT\"\n}\n"
  },
  {
    "path": "app/templates/app/.babelrc",
    "content": "{ \"presets\": [\"es2015\",\"react\"] }\n"
  },
  {
    "path": "app/templates/app/README.md",
    "content": "Readme\n=================\nThis project require [node](https://nodejs.org/).\nRun `npm install` to install dependencies before get started.\nThis project is generated by [generator-webappstarter](https://github.com/unbug/generator-webappstarter)\n\n\nProject commands\n=================\nrun this command before you get started.\n\n```shell\nnpm install -g gulp\n```\n\n1.build project,watch change and start browserSync,run\n\n```shell\ngulp\n```\nor run with forever\n```shell\nforever ./node_modules/.bin/gulp\n```\n2.deploy to test server,run\n\n```shell\ngulp deploytest\n```\nPlease update your ftp auth name and password in \".ftppass\".\nView the page on test server [http://office.mozat.com:8083/PROJECTNAME/](http://office.mozat.com:8083/PROJECTNAME/).\nThis command require [openssl](https://www.openssl.org/).\nFor windows,you might needd to add openssl path to classpath.\n\n\n3.deploy to offical server,run\n\n```shell\ngulp deploy\n```\nView the page on offical server [http://m.deja.me/PROJECTNAME/](http://m.deja.me/PROJECTNAME/).\nThis command require [rsync](https://rsync.samba.org/).\nFor windows,unzip  /tools/rsync.zip to a local path and add the path to classpath.\n\n4.run this command to copy source images to project's `resources/images/` path,then generate `scss/_dubug-sprites.csss` and `resources/images/sprites.png` for sourceSprites in `package.json`.\n\n```shell\ngulp copy\n``` \n\n5.run this command to start jshint.\n\n```shell\ngulp jshint\n```\n\n6.run this command to start browserSync,Change browserSync options in `package.json`.\n\n```shell\ngulp serve\n``` \n\n7.run this command to start pagespeed,Change pagespeed options in `package.json`.\n\n```shell\ngulp pagespeed\n``` \n\nStructure\n================\nThe structure is modular design,follow the DOOR-KEY rule you only take minutes to understand it:\n  * The DOOR for javascript is in ```/src/app/App.js```,and the KEY is ```require```,see [webpack](https://webpack.github.io/docs/commonjs.html) and [commonjs](http://www.commonjs.org/specs/modules/1.0/)\n  * The DOOR for stylesheets is in ```/scss/styles.scss```,and the KEY is ```@import```,see [SASS](http://sass-lang.com/)\n  * The DOOR for HTML is in ```/html/debug/index.html```,and the KEY is ```@@include```,see [gulp-file-include](https://www.npmjs.com/package/gulp-file-include)\n  \n\nGit\n==========\nRandom git commit message\n\n```shell\n git commit -m\"`curl -s http://whatthecommit.com/index.txt`\"\n ```\n"
  },
  {
    "path": "app/templates/app/data/user.json",
    "content": "[\n  {\"name\": \"Peter\"},\n  {\"name\": \"Joy\"},\n  {\"name\": \"Brian\"}\n]\n"
  },
  {
    "path": "app/templates/app/gulpfile.js",
    "content": "var spawn = require('child_process').spawn;\nvar exec = require('child_process').exec;\nvar fs = require('fs');\nvar path = require('path');\n\nvar gulp = require('gulp');\nvar source = require('vinyl-source-stream');\nvar through2 = require('through2');\nvar $ = require('gulp-load-plugins')();\nvar del = require('del');\nvar pem = require('pem');\nvar rsync = require('rsync');\nvar sprity = require('sprity');\nvar pngquant = require('imagemin-pngquant');\nvar runSequence = require('run-sequence');\nvar browserSync = require('browser-sync').create();//http://www.browsersync.io/docs/gulp/\nvar pagespeed = require('psi');\nvar cachebust = new $.cachebust();\nvar webpackStream = require(\"webpack-stream\");\nrequire('date-utils');\n\n//values\nvar conf = require('./package.json');\nvar projectName = conf.name;\n//not available project names\nvar notAvailableNames = conf.project.invalidNames;\nif (notAvailableNames.split('|').indexOf(projectName) != -1) {\n  console.log('\\n\"' + notAvailableNames + '\" are not available project names!\\n');\n  return;\n}\nvar title = conf.project.title || conf.name;\nvar viewport = conf.project.viewport || 'device-width';\nvar globalVersion = conf.version;\nvar distPath = './dist/';\nvar distProjectPath = distPath + projectName;\nvar sourceImg = conf.project.sourceImg;//source images path to copy to this project\nvar sourceSprites = conf.project.sourceSprites;//source images path to generate sprites\nvar isBuild = false;\n\n//build version:\n//script version\n//style version\n//manifest version\nvar startTime = 0;\nvar buildVersion = 0;\ngulp.task('build_version', function (cb) {\n  var startDate = new Date();\n  startTime = startDate.getTime();\n  buildVersion = startDate.toFormat('YYYYMMDDHHMISS');\n\n  cb();\n});\n\n//clear images\ngulp.task('clean:images', function (cb) {\n  del(['./resources/images/*'], {force: true}, cb);\n});\n\n//copy source images to \"/resources/images\"\ngulp.task('copy:source_imgs', function () {\n  return gulp.src([sourceImg])\n    .pipe(gulp.dest('./resources/images'))\n    .pipe($.size({title: 'copy source images'}));\n});\n\n//generate sprites.png and _debug-sprites.scss\ngulp.task('sprites', function () {\n  return sprity.src({\n      src: sourceSprites,\n      name: 'sprites',\n      style: '_sprites.scss',\n      cssPath: '../images/',\n      processor: 'css'\n    })\n    .pipe($.if('*.png', gulp.dest('./resources/images/'), gulp.dest('./scss/')))\n    .pipe($.size({title: 'sprites'}));\n});\n\n//watching script change to start default task\ngulp.task('watch', function () {\n  return gulp.watch([\n    'src/**/*.js', '!src/app.js',\n    'scss/**/*.scss',\n    'html/**/*.html'\n  ], function (event) {\n    console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');\n    var tasks = ['prepare'];\n    if (/.*\\.js$/.test(event.path)) {\n      //jshint\n      conf.project.watchJshint && gulp.src(event.path)\n        .pipe($.jshint())\n        .pipe($.jshint.reporter('jshint-stylish'));\n\n      tasks.push('webpackjs');\n    }\n    else if (/.*\\.scss$/.test(event.path)) {\n      //scsslint\n      //https://github.com/noahmiller/gulp-scsslint\n      conf.project.watchScsslint && gulp.src(event.path)\n        .pipe($.scsslint())\n        .pipe($.scsslint.reporter());\n\n      tasks.push('sass');\n    }\n    else if (/.*\\.html$/.test(event.path)) {\n      tasks.push('html');\n    }\n    tasks.push('manifest');\n    runSequence.apply(null,tasks);\n  });\n});\n\n//compile sass files\nvar AUTOPREFIXER_BROWSERS = [\n  'ie >= 10',\n  'ie_mob >= 10',\n  'ff >= 30',\n  'chrome >= 34',\n  'safari >= 7',\n  'opera >= 23',\n  'ios >= 7',\n  'android >= 4.4',\n  'bb >= 10'\n];\ngulp.task('sass', function (cb) {\n  gulp.src(['./scss/**/*.scss'], {buffer: true})\n    .pipe($.replace(/_VIEWPORT_WIDTH_/g, viewport == 'device-width'?'100%': viewport+'px'))\n    .pipe(gulp.dest('./.scss'))//fix replace not working\n    .on('end', function () {\n      gulp.src(['./.scss/**/*.scss'], {buffer: true})\n        .pipe($.sourcemaps.init())\n        .pipe($.sass({errLogToConsole: true}))\n        .pipe($.cached('sass-cache', {\n          optimizeMemory: true\n        }))\n        .pipe($.autoprefixer({browsers: AUTOPREFIXER_BROWSERS}))\n        .pipe($.sourcemaps.write())\n        .pipe(gulp.dest('./resources/css/'))\n        .on('end', function () {\n          del(['./.scss'], {force: true});\n          cb();\n        });\n    });\n});\n\n//compile js files\nvar webpackConfig = require('./webpack.config');\ngulp.task('webpackjs', function() {\n  return gulp.src(['./src/**/*.js'])\n    .pipe($.cached('webpackjs-cache', {\n      optimizeMemory: true\n    }))\n    .pipe(webpackStream(webpackConfig[isBuild?'build':'dev']))\n    .pipe(gulp.dest('./src'));\n});\n\n//compile html files\ngulp.task('html', function () {\n  return gulp.src(['./html/debug/*.html'])\n    .pipe($.fileInclude({\n      basepath: './html/'\n    }))\n    .pipe($.cached('html-cache', {\n      optimizeMemory: true\n    }))\n    .pipe($.replace(/_BUILD_VERSION_/g, buildVersion))\n    .pipe($.replace(/_GLOBAL_VERSION_/g, globalVersion))\n    .pipe($.replace(/_VIEWPORT_WIDTH_/g, viewport))\n    .pipe($.replace(/_TITLE_/g, title))\n    .pipe($.replace(/_MANIFEST_/g, conf.project.manifest?'manifest=\"cache.manifest\"':''))\n    .pipe(gulp.dest('./'));\n});\n\n//generate cache.manifest\ngulp.task('manifest', function (cb) {\n  var resources = ['src/app.js'];\n  gulp.src(['./resources/**/*.*'])\n    .pipe(through2.obj(function (file, enc, next) {\n      this.push(file.path.replace(__dirname+'/',''));\n      next();\n    }))\n    .on('data', function (data) {\n      resources.push(data)\n    })\n    .on('end', function () {\n      gulp.src(['./html/include/cache.manifest'])\n        .pipe($.replace(/_BUILD_VERSION_/g, buildVersion))\n        .pipe($.replace(/_GLOBAL_VERSION_/g, globalVersion))\n        .pipe($.replace(/_FILES_/g, resources.join('\\n')))\n        .pipe(gulp.dest('./'))\n        .on('end', function () {\n          cb();\n        });\n    });\n});\n\n//clear dist folder\ngulp.task('clean:dist', function (cb) {\n  del([distPath + '*'], {force: true}, cb);\n});\n\n//copy resources to \"/dist/resources/\"\ngulp.task('dist:resources', function () {\n  return gulp.src('./resources/**/*.*')\n    .pipe(gulp.dest(distProjectPath + '/resources/'))\n    .pipe($.size({title: 'dist:resources'}));\n});\n\n//compress images to dist\ngulp.task('dist:images', function () {\n  return gulp.src(['./resources/**/*.*g'])\n    .pipe($.imagemin({\n      use: [pngquant()]\n    }))\n    .pipe(cachebust.resources())\n    .pipe(gulp.dest(distProjectPath + '/resources/'))\n    .pipe($.size({title: 'dist:images'}));\n});\n\n//compress css to dist\ngulp.task('dist:css', function () {\n  return gulp.src('./resources/**/*.css')\n    .pipe(cachebust.references())\n    .pipe($.csso())\n    .pipe(cachebust.resources())\n    .pipe(gulp.dest(distProjectPath + '/resources'))\n    .pipe($.size({title: 'dist:css'}));\n});\n\n//compress js to dist\ngulp.task('dist:js', function () {\n  return gulp.src(['./src/app.js'])\n    //remove //_DEBUG_ in files,\n    //such as: \"///_DEBUG_*Todo: debug actions //*/ \"\n    //will become \"/*Todo: debug actions //*/\",so uglify could remove all comments\n    .pipe($.replace(/\\/\\/_DEBUG_/g, ''))\n    .pipe(cachebust.references())\n    .pipe($.uglify())\n    .pipe(cachebust.resources())\n    .pipe(gulp.dest(distProjectPath + '/src/'))\n    .pipe($.size({title: 'dist:js'}));\n});\n\n//compress html to dist\ngulp.task('dist:html', function () {\n  return gulp.src(['html/official/*.html'])\n    .pipe($.fileInclude({\n      basepath: './html/'\n    }))\n    .pipe($.replace(/_BUILD_VERSION_/g, buildVersion))\n    .pipe($.replace(/_GLOBAL_VERSION_/g, globalVersion))\n    .pipe($.replace(/_VIEWPORT_WIDTH_/g, viewport))\n    .pipe($.replace(/_TITLE_/g, title))\n    .pipe($.replace(/_MANIFEST_/g, conf.project.manifest?'manifest=\"cache.manifest\"':''))\n    .pipe(cachebust.references())\n    .pipe($.minifyHtml({\n      empty: true,\n      cdata: true,\n      conditionals: true,\n      spare: true,\n      quotes: true\n    }))\n    .pipe(gulp.dest(distProjectPath))\n    .pipe($.size({title: 'dist:html'}));\n});\n\n//copy cache.manifest to dist\ngulp.task('dist:manifest', function () {\n  return gulp.src('./cache.manifest')\n    .pipe(cachebust.references())\n    .pipe(gulp.dest(distProjectPath + '/'))\n    .pipe($.size({title: 'dist:manifest'}));\n});\n\n//deploy to test server\n//view http://office.mozat.com:8081/m/PROJECTNAME/\ngulp.task('deploy:test', function (cb) {\n  pem.createCertificate({}, function (err, kyes) {\n    gulp.src(distPath + '**/*')\n      .pipe($.sftp({\n        host: '172.28.2.62',\n        port: 22,\n        auth: 'testServer',\n        key: kyes.clientKey,\n        keyContents: kyes.keyContents,\n        remotePath: '/home/gaolu/m/'\n      }, cb));\n  });\n});\n\n//deploy to offical server\n//view http://m.deja.me/PROJECTNAME/\ngulp.task('deploy:offical', function (cb) {\n  //set rsync proxy\n  process.env.RSYNC_PROXY = 'proxy.lan:8080';\n  var client = new rsync()\n    .executable('rsync')\n    .flags('azv')\n    .source(distPath)\n    .destination('rsync://10.160.241.153/m.deja.me/');\n\n  client.execute(function (error, code, cmd) {\n    console.log('\\t' + cmd);\n    //reset rsync proxy\n    process.env.RSYNC_PROXY = '';\n    cb();\n  });\n});\n//deploy to offical server\n//view http://m.deja.me/PROJECTNAME/\n// deploy guide\n// 1. get rsync's port\n// grep rsync /etc/services\n// 2. open tunnel\n// sudo ssh -N -L 127.0.0.1:873:10.160.241.153:873 tunnel@ssh.mozat.com\ngulp.task('_deploy:offical', function (cb) {\n  //set rsync proxy\n  var client = new rsync()\n    .executable('rsync')\n    .flags('azv')\n    .source(distPath)\n    .destination('rsync://localhost/m.deja.me/');\n\n  client.execute(function (error, code, cmd) {\n    console.log('\\t' + cmd);\n    //reset rsync proxy\n    process.env.RSYNC_PROXY = '';\n    cb();\n  });\n});\n\n// Lint JavaScript\ngulp.task('jshint', function () {\n  return gulp.src(['./src/**/*.js', '!./src/*.js', '!./src/lib/zepto.js'])\n    .pipe($.jshint())\n    .pipe($.jshint.reporter('jshint-stylish'))\n    .pipe($.if(!browserSync.active, $.jshint.reporter('fail')));\n});\n\n//browser-sync serve\nvar browserSyncOptions = conf.project.browserSync || {};\ngulp.task('serve', function () {\n  browserSync.init(browserSyncOptions);\n\n  gulp.watch(['./*.html'], browserSync.reload);\n  gulp.watch(['./src/*.js'], browserSync.reload);\n  gulp.watch(['./resources/**/*.css'], browserSync.reload);\n  gulp.watch(['./resources/**/*.*g'], browserSync.reload);\n});\n\n// Run PageSpeed Insights\ngulp.task('pagespeed', function (cb) {\n  // By default we use the PageSpeed Insights free (no API key) tier.\n  // Use a Google Developer API key if you have one: http://goo.gl/RkN0vE\n  // key: 'YOUR_API_KEY'\n  pagespeed.output(conf.project.pagespeed.url, conf.project.pagespeed.options, function (err, data) {\n    cb();\n  });\n});\n\n//print after tasks all done\ngulp.task('_endlog', function (cb) {\n  var endDate = new Date();\n  var logs = [];\n  logs.push('\\nBuild version is ' + buildVersion);\n  logs.push(', Completed in ' + ((endDate.getTime() - startTime) / 1000) + 's at ' + endDate + '\\n');\n  console.log(logs.join(''));\n  cb();\n});\n\n//test\nfunction getProtractorBinary(binaryName){\n  var winExt = /^win/.test(process.platform)? '.cmd' : '';\n  var pkgPath = require.resolve('protractor');\n  var protractorDir = path.resolve(path.join(path.dirname(pkgPath), '..', 'bin'));\n  return path.join(protractorDir, '/'+binaryName+winExt);\n}\n\ngulp.task('protractor-install', function(done){\n  spawn(getProtractorBinary('webdriver-manager'), ['update'], {\n    stdio: 'inherit'\n  }).once('close', done);\n});\n\ngulp.task('wd', function(done){\n  spawn(getProtractorBinary('webdriver-manager'), ['start'], {\n    stdio: 'inherit'\n  }).once('close', done);\n});\n\ngulp.task('scenario', function (done) {\n  var argv = process.argv.slice(3); // forward args to protractor\n  argv.push('test/protractor.conf.js');\n  spawn(getProtractorBinary('protractor'), argv, {\n    stdio: 'inherit'\n  }).once('close', done);\n});\n//end test\n\nfunction handleError(err) {\n  console.log(err.toString());\n  this.emit('end');\n}\n\n//task queues\ngulp.task('copy', function (cb) {\n  runSequence('clean:images', 'copy:source_imgs', 'sprites', cb);\n});\ngulp.task('prepare', function (cb) {\n  runSequence('build_version', cb);\n});\ngulp.task('compile', function (cb) {\n  runSequence('sass', 'webpackjs', 'manifest', 'html', cb);\n});\ngulp.task('dist', function (cb) {\n  isBuild = true;\n  runSequence('clean:dist', 'prepare', 'compile','dist:resources', 'dist:images', 'dist:css', 'dist:js', 'dist:manifest','dist:html', '_endlog', cb);\n});\ngulp.task('default', function (cb) {\n  runSequence('prepare', 'compile', 'watch', 'serve', cb);\n});\n\n//deploy to test server\ngulp.task('deploytest', function (cb) {\n  runSequence('dist', 'deploy:test', cb);\n});\n//deploy to offical server\ngulp.task('deploy', function (cb) {\n  runSequence('dist', 'deploy:offical', cb);\n});\n//deploy to offical server\ngulp.task('deployrc', function (cb) {\n  distProjectPath = distProjectPath +'_rc';\n  runSequence('deploy', cb);\n});\n//deploy to offical server from home\ngulp.task('_deploy', function (cb) {\n  runSequence('dist', '_deploy:offical', cb);\n});\ngulp.task('_deployrc', function (cb) {\n  distProjectPath = distProjectPath +'_rc';\n  runSequence('_deploy', cb);\n});\ngulp.task('test', function (done) {\n  runSequence('scenario',done);\n});\n"
  },
  {
    "path": "app/templates/app/html/debug/analytics.html",
    "content": "<!DOCTYPE HTML>\n<html>\n<head>\n</head>\n<body>\n</body>\n</html>\n"
  },
  {
    "path": "app/templates/app/html/debug/index.html",
    "content": "<!DOCTYPE HTML>\n<html>\n<head>\n  <!-- htmlhead -->\n  @@include('include/htmlhead.html')\n  <!-- end htmlhead -->\n  <!-- styles -->\n  @@include('include/styles-version.html')\n  <!--end styles -->\n</head>\n<body ontouchstart=\"\" class=\"\" style=\"visibility: hidden;\">\n<!-- views -->\n@@include('include/views.html')\n<!--end views -->\n\n<!-- components -->\n@@include('include/components.html')\n<!-- end components -->\n\n<!-- scripts -->\n@@include('include/scripts-version.html')\n<!--end scripts -->\n</body>\n</html>\n"
  },
  {
    "path": "app/templates/app/html/include/cache.manifest",
    "content": "CACHE MANIFEST\n# Version: _GLOBAL_VERSION_\n# Build: _BUILD_VERSION_\n\nCACHE:\n_FILES_\n\nNETWORK:\n*\n"
  },
  {
    "path": "app/templates/app/html/include/components.html",
    "content": "<!-- msgbox -->\n@@include('include/msgbox.html')\n<!-- end msgbox -->\n<!-- tooltip -->\n@@include('include/tooltip.html')\n<!-- end tooltip -->\n"
  },
  {
    "path": "app/templates/app/html/include/download.html",
    "content": "<section class=\"section-download hide\" data-eventname=\"appDownload\" data-eventparams=\"0,1\">\n  <div class=\"sd-logo\"><img src=\"resources/images/logo.png\"></div>\n  <div class=\"sd-info\">\n    <div class=\"name\">Deja</div>\n    <div class=\"dest\">Get your style on.</div>\n  </div>\n  <div class=\"sd-btns\">\n    <div class=\"btn bt-primary size-s\">OPEN APP</div>\n  </div>\n</section>\n"
  },
  {
    "path": "app/templates/app/html/include/footer.html",
    "content": "<section class=\"footer-section hide\">\n  <div class=\"stores\">\n    <a class=\"apple\" data-analytics=\"store=apple\"\n       href=\"https://itunes.apple.com/us/app/deja-fashion/id971025031?mt=8&111111\"><i\n      class=\"icon icon-bt_Appbutton\"></i></a>\n    <a class=\"google\" data-analytics=\"store=google\" href=\"http://deja.me/\"><i class=\"icon icon-bt_google\"></i></a>\n  </div>\n  <div class=\"about\">\n    <p>For further enquires, contact us at <a href=\"mailto:event@dejafashion.com?subject=Deja Fashion\">event@dejafashion.com</a>\n    </p>\n\n    <p>© 2015 Deja Fashion Pte Ltd. All Rights Reserved.</p>\n  </div>\n</section>\n"
  },
  {
    "path": "app/templates/app/html/include/htmlhead.html",
    "content": "<meta charset=\"UTF-8\">\n<meta content=\"target-densitydpi=device-dpi,width=_VIEWPORT_WIDTH_\" name=\"viewport\">\n<title>_TITLE_</title>\n<meta name=\"author\" content=\"Mozat\"/>\n<meta name=\"Copyright\" content=\"Mozat Pte Ltd\"/>\n<meta name=\"format-detection\" content=\"email=no,address=no,telephone=no\">\n"
  },
  {
    "path": "app/templates/app/html/include/manifest-version.html",
    "content": "<html manifest=\"_GLOBAL_VERSION_.manifest\">\n"
  },
  {
    "path": "app/templates/app/html/include/msgbox-deja.html",
    "content": "<div class=\"box-ct signin\">\n  <div class=\"box-bd\">\n    <div>\n      <div class=\"msg fix-break-word\">Please sign in</div>\n      <div class=\"plf\">\n        <div class=\"b\" data-plf=\"fb\"><i class=\"icon icon-btn_fb_login\"></i></div>\n      </div>\n    </div>\n    <div class=\"no\"><i class=\"icon icon-ic_s_close_nor_2x\"></i></div>\n  </div>\n</div>\n"
  },
  {
    "path": "app/templates/app/html/include/msgbox.html",
    "content": "<section class=\"msgbox\">\n  <div class=\"box-mask\"></div>\n  <div class=\"msgbox-ct\">\n    <div class=\"msgbox-bd\">\n      <div class=\"box-ct dialog\">\n        <div class=\"box-bd\">\n          <div>\n            <div class=\"content\">\n              <div class=\"title\">Confirm your information</div>\n              <div class=\"msg\"></div>\n            </div>\n            <div class=\"bbts\">\n              <div class=\"no\">Cancel</div>\n              <div class=\"yes\">Confirm</div>\n            </div>\n          </div>\n        </div>\n      </div>\n      <div class=\"box-ct menu absolute\">\n        <div class=\"box-bd\">\n          <div class=\"options\"></div>\n          <div class=\"opt no\">Cancel</div>\n        </div>\n      </div>\n      <div class=\"box-ct loading\">\n        <div class=\"box-bd\">\n          <div>\n            <div class=\"loading-spinner\">\n              <span class=\"loading-top\"></span>\n              <span class=\"loading-right\"></span>\n              <span class=\"loading-bottom\"></span>\n              <span class=\"loading-left\"></span>\n            </div>\n            <div class=\"msg\">Submitting</div>\n          </div>\n        </div>\n      </div>\n      <!-- msgbox deja -->\n      @@include('include/msgbox-deja.html')\n      <!-- end msgbox deja -->\n    </div>\n  </div>\n</section>\n"
  },
  {
    "path": "app/templates/app/html/include/scripts-version.html",
    "content": "<script src=\"src/app.js\" defer></script>"
  },
  {
    "path": "app/templates/app/html/include/styles-version.html",
    "content": "<link rel=\"stylesheet\" href=\"resources/css/styles.css\">"
  },
  {
    "path": "app/templates/app/html/include/tooltip.html",
    "content": "<script type=\"text/html\" id=\"tpl_tooltip\">\n<section class=\"tooltip <%=theme%> <%=rootCls%>\" id=\"<%=rootId%>\">\n  <section class=\"tooltip__ct\">\n    <div class=\"tooltip__bd animated\">\n      <div class=\"tooltip__content <%=bodyCls%>\"><%=body%></div>\n      <div class=\"tooltip__arrow <%=arrow.type%>\" style=\"<%=arrow.style%>\">\n        <div></div>\n      </div>\n    </div>\n  </section>\n</section>\n</script>\n"
  },
  {
    "path": "app/templates/app/html/include/view-home.html",
    "content": "<section class=\"view view-home\">\n  <section class=\"main\">\n    <section class=\"btn bt-default\" data-fake-link=\"#/user/\">View Users!</section>\n  </section>\n</section>\n"
  },
  {
    "path": "app/templates/app/html/include/view-user.html",
    "content": "<section class=\"view view-user\">\n  <section class=\"users\">\n    <section class=\"list user-item-default\" data-element=\"list\">\n      <script type=\"text/html\" data-template=\"listItem\">\n        <article class=\"item\">\n          <%=name%>\n        </article>\n      </script>\n    </section>\n    <section class=\"btn bt-primary back\">Go back!</section>\n  </section>\n</section>\n"
  },
  {
    "path": "app/templates/app/html/include/views.html",
    "content": "<!-- view-home -->\n@@include('include/view-home.html')\n<!--end view-home -->\n<!-- view-user -->\n@@include('include/view-user.html')\n<!--end view-user -->\n"
  },
  {
    "path": "app/templates/app/html/official/analytics.html",
    "content": "<!DOCTYPE HTML>\n<html>\n<head>\n</head>\n<body>\n</body>\n</html>\n"
  },
  {
    "path": "app/templates/app/html/official/index.html",
    "content": "<!DOCTYPE HTML>\n<html _MANIFEST_>\n<head>\n  <!-- htmlhead -->\n  @@include('include/htmlhead.html')\n  <!-- end htmlhead -->\n  <!-- styles -->\n  @@include('include/styles-version.html')\n  <!--end styles -->\n</head>\n<body ontouchstart=\"\" class=\"\" style=\"visibility: hidden;\">\n<!-- views -->\n@@include('include/views.html')\n<!--end views -->\n\n<!-- components -->\n@@include('include/components.html')\n<!-- end components -->\n\n<!-- scripts -->\n@@include('include/scripts-version.html')\n<!--end scripts -->\n</body>\n</html>\n"
  },
  {
    "path": "app/templates/app/scss/_animate.scss",
    "content": "@charset \"UTF-8\";\n\n/*\n参考自 http://daneden.github.io/animate.css/\n*/\n/*\n@-webkit-keyframes rotateRight{\n    @for $i from 0 through 45 {\n      none:2.22%*$i;-webkit-transform: rotate(8deg*$i);\n    }\n}\n*/\n@-webkit-keyframes tada {\n  0% {\n    -webkit-transform: scale(1);\n  }\n  10%, 20% {\n    -webkit-transform: scale(0.6) rotate(-3deg);\n  }\n  30%, 50% {\n    -webkit-transform: scale(0.9) rotate(3deg);\n  }\n  70%, 90% {\n    -webkit-transform: scale(1.0) rotate(3deg);\n  }\n  40%, 60%, 80% {\n    -webkit-transform: scale(1.1) rotate(-3deg);\n  }\n  100% {\n    -webkit-transform: scale(1) rotate(0deg);\n  }\n}\n\n@-webkit-keyframes bounceIn {\n  0% {\n    opacity: 0;\n    -webkit-transform: scale(.3);\n  }\n\n  50% {\n    opacity: 1;\n    -webkit-transform: scale(1.05);\n  }\n\n  70% {\n    -webkit-transform: scale(.9);\n  }\n\n  100% {\n    opacity: 1;\n    -webkit-transform: scale(1);\n  }\n}\n\n@-webkit-keyframes MicroBounceOut {\n  0% {\n    opacity: 0;\n    -webkit-transform: scale3d(1, 1.03, 1) translate3d(0, 1, 0);\n  }\n  99% {\n    -webkit-transform: scale3d(1, .999, 1);\n  }\n  100% {\n    opacity: 1;\n    -webkit-transform: scale3d(1, 1, 1);\n  }\n}\n\n@-webkit-keyframes MicroPopUp {\n  0% {\n    opacity: 0;\n    -webkit-transform: scale3d(1.1, 1.1, 1);\n  }\n\n  90% {\n    -webkit-transform: scale3d(.99, .99, 1);\n  }\n  100% {\n    opacity: 1;\n    -webkit-transform: scale3d(1, 1, 1);\n  }\n}\n\n@-webkit-keyframes MicroMask {\n  0% {\n    opacity: 0;\n  }\n  100% {\n    opacity: .5;\n  }\n}\n\n@-webkit-keyframes bounceInDown {\n  0% {\n    opacity: 0;\n    -webkit-transform: translateY(-2000px);\n  }\n\n  60% {\n    opacity: 1;\n    -webkit-transform: translateY(30px);\n  }\n\n  80% {\n    -webkit-transform: translateY(-10px);\n  }\n\n  100% {\n    -webkit-transform: translateY(0);\n    opacity: 1;\n  }\n}\n\n@-webkit-keyframes fadeIn {\n  0% {\n    opacity: 0;\n  }\n  100% {\n    opacity: 1;\n  }\n}\n\n@-webkit-keyframes fadeInOut {\n  0%, 100% {\n    opacity: 0;\n  }\n  40% {\n    opacity: 1;\n  }\n}\n@-webkit-keyframes fadeOut {\n  from {\n    opacity: 1;\n  }\n\n  to {\n    opacity: 0;\n  }\n}\n@-webkit-keyframes flash {\n  0%, 50%, 100% {\n    opacity: 1;\n  }\n\n  25%, 75% {\n    opacity: 0;\n  }\n}\n\n@-webkit-keyframes fadeInUp {\n  0% {\n    opacity: 0;\n    -webkit-transform: translateY(20px);\n  }\n\n  100% {\n    opacity: 1;\n    -webkit-transform: translateY(0);\n  }\n}\n\n@-webkit-keyframes fadeInUpMax {\n  0% {\n    opacity: 0;\n    -webkit-transform: translateY(100%);\n  }\n\n  100% {\n    opacity: 1;\n    -webkit-transform: translateY(0);\n  }\n}\n\n@-webkit-keyframes fadeInDown {\n  0% {\n    opacity: 0;\n    -webkit-transform: translateY(-20px);\n  }\n\n  100% {\n    opacity: 1;\n    -webkit-transform: translateY(0);\n  }\n}\n\n@-webkit-keyframes fadeInLeft {\n  0% {\n    opacity: 0;\n    -webkit-transform: translate3d(-100%, 0, 0);\n  }\n\n  90% {\n    opacity: .9;\n    -webkit-transform: translate3d(1%, 0, 0);\n  }\n  100% {\n    opacity: 1;\n    -webkit-transform: none;\n  }\n}\n\n@-webkit-keyframes fadeInRight {\n  0% {\n    opacity: 0;\n    -webkit-transform: translate3d(100%, 0, 0);\n  }\n\n  90% {\n    opacity: .9;\n    -webkit-transform: translate3d(-1%, 0, 0);\n  }\n  100% {\n    opacity: 1;\n    -webkit-transform: none;\n  }\n}\n\n@-webkit-keyframes flipInY {\n  0% {\n    -webkit-transform: perspective(400px) rotateY(90deg);\n    transform: perspective(400px) rotateY(90deg);\n    opacity: 0;\n  }\n\n  40% {\n    -webkit-transform: perspective(400px) rotateY(-10deg);\n    transform: perspective(400px) rotateY(-10deg);\n  }\n\n  70% {\n    -webkit-transform: perspective(400px) rotateY(10deg);\n    transform: perspective(400px) rotateY(10deg);\n  }\n\n  100% {\n    -webkit-transform: perspective(400px) rotateY(0deg);\n    transform: perspective(400px) rotateY(0deg);\n    opacity: 1;\n  }\n}\n\n@-webkit-keyframes flipInX {\n  from {\n    -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n    transform: perspective(400px) rotate3d(1, 0, 0, 90deg);\n    -webkit-animation-timing-function: ease-in;\n    animation-timing-function: ease-in;\n    opacity: 0;\n  }\n\n  40% {\n    -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n    transform: perspective(400px) rotate3d(1, 0, 0, -20deg);\n    -webkit-animation-timing-function: ease-in;\n    animation-timing-function: ease-in;\n  }\n\n  60% {\n    -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\n    transform: perspective(400px) rotate3d(1, 0, 0, 10deg);\n    opacity: 1;\n  }\n\n  80% {\n    -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg);\n    transform: perspective(400px) rotate3d(1, 0, 0, -5deg);\n  }\n\n  to {\n    -webkit-transform: perspective(400px);\n    transform: perspective(400px);\n  }\n}\n\n@-webkit-keyframes zoomIn {\n  0% {\n    opacity: 0;\n    -webkit-transform: scale3d(.3, .3, .3);\n    transform: scale3d(.3, .3, .3);\n  }\n\n  50% {\n    opacity: 1;\n  }\n}\n\n@-webkit-keyframes slideInUp {\n  0% {\n    -webkit-transform: translateY(100%);\n    transform: translateY(100%);\n    visibility: visible;\n  }\n\n  100% {\n    -webkit-transform: translateY(0);\n    transform: translateY(0);\n  }\n}\n\n@-webkit-keyframes slideInDown {\n  0% {\n    -webkit-transform: translateY(-100%);\n    transform: translateY(-100%);\n    visibility: visible;\n  }\n\n  100% {\n    -webkit-transform: translateY(0);\n    transform: translateY(0);\n  }\n}\n\n@-webkit-keyframes slideOutDown {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0);\n    transform: translate3d(0, 0, 0);\n  }\n\n  100% {\n    visibility: hidden;\n    -webkit-transform: translate3d(0, 100%, 0);\n    transform: translate3d(0, 100%, 0);\n  }\n}\n\n@keyframes slideOutDown {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0);\n    transform: translate3d(0, 0, 0);\n  }\n\n  100% {\n    visibility: hidden;\n    -webkit-transform: translate3d(0, 100%, 0);\n    transform: translate3d(0, 100%, 0);\n  }\n}\n\n@-webkit-keyframes slideOutLeft {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0);\n    transform: translate3d(0, 0, 0);\n  }\n\n  100% {\n    visibility: hidden;\n    -webkit-transform: translate3d(-100%, 0, 0);\n    transform: translate3d(-100%, 0, 0);\n  }\n}\n\n@keyframes slideOutLeft {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0);\n    transform: translate3d(0, 0, 0);\n  }\n\n  100% {\n    visibility: hidden;\n    -webkit-transform: translate3d(-100%, 0, 0);\n    transform: translate3d(-100%, 0, 0);\n  }\n}\n\n@-webkit-keyframes slideOutRight {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0);\n    transform: translate3d(0, 0, 0);\n  }\n\n  100% {\n    visibility: hidden;\n    -webkit-transform: translate3d(100%, 0, 0);\n    transform: translate3d(100%, 0, 0);\n  }\n}\n\n@keyframes slideOutRight {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0);\n    transform: translate3d(0, 0, 0);\n  }\n\n  100% {\n    visibility: hidden;\n    -webkit-transform: translate3d(100%, 0, 0);\n    transform: translate3d(100%, 0, 0);\n  }\n}\n\n@-webkit-keyframes slideOutUp {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0);\n    transform: translate3d(0, 0, 0);\n  }\n\n  100% {\n    visibility: hidden;\n    -webkit-transform: translate3d(0, -100%, 0);\n    transform: translate3d(0, -100%, 0);\n  }\n}\n\n@keyframes slideOutUp {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0);\n    transform: translate3d(0, 0, 0);\n  }\n\n  100% {\n    visibility: hidden;\n    -webkit-transform: translate3d(0, -100%, 0);\n    transform: translate3d(0, -100%, 0);\n  }\n}\n\n@-webkit-keyframes spinnerRotateRight {\n  0% {\n    -webkit-transform: rotate(0deg);\n  }\n  8.32% {\n    -webkit-transform: rotate(0deg);\n  }\n\n  8.33% {\n    -webkit-transform: rotate(30deg);\n  }\n  16.65% {\n    -webkit-transform: rotate(30deg);\n  }\n\n  16.66% {\n    -webkit-transform: rotate(60deg);\n  }\n  24.99% {\n    -webkit-transform: rotate(60deg);\n  }\n\n  25% {\n    -webkit-transform: rotate(90deg);\n  }\n  33.32% {\n    -webkit-transform: rotate(90deg);\n  }\n\n  33.33% {\n    -webkit-transform: rotate(120deg);\n  }\n  41.65% {\n    -webkit-transform: rotate(120deg);\n  }\n\n  41.66% {\n    -webkit-transform: rotate(150deg);\n  }\n  49.99% {\n    -webkit-transform: rotate(150deg);\n  }\n\n  50% {\n    -webkit-transform: rotate(180deg);\n  }\n  58.32% {\n    -webkit-transform: rotate(180deg);\n  }\n\n  58.33% {\n    -webkit-transform: rotate(210deg);\n  }\n  66.65% {\n    -webkit-transform: rotate(210deg);\n  }\n\n  66.66% {\n    -webkit-transform: rotate(240deg);\n  }\n  74.99% {\n    -webkit-transform: rotate(240deg);\n  }\n\n  75% {\n    -webkit-transform: rotate(270deg);\n  }\n  83.32% {\n    -webkit-transform: rotate(270deg);\n  }\n\n  83.33% {\n    -webkit-transform: rotate(300deg);\n  }\n  91.65% {\n    -webkit-transform: rotate(300deg);\n  }\n\n  91.66% {\n    -webkit-transform: rotate(330deg);\n  }\n  100% {\n    -webkit-transform: rotate(330deg);\n  }\n}\n"
  },
  {
    "path": "app/templates/app/scss/_box.scss",
    "content": "@charset \"UTF-8\";\n\n.box-h{\n  @include box-h;\n}\n.box-h-c-c{\n  @include box-h-c-c;\n}\n.box-h-c-r{\n  @include box-h-c-r;\n}\n.box-h-c-l{\n  @include box-h-c-l;\n}\n.box-h-t-c{\n  @include box-h-t-c;\n}\n.box-h-t-l{\n  @include box-h-t-l;\n}\n.box-h-t-r{\n  @include box-h-t-r;\n}\n.box-h-b-c{\n  @include box-h-b-c;\n}\n.box-h-b-l{\n  @include box-h-b-l;\n}\n.box-h-b-r{\n  @include box-h-b-r;\n}\n\n.box-v{\n  @include box-v;\n}\n.box-v-c-c{\n  @include box-v-c-c;\n}\n.box-v-c-l{\n  @include box-v-c-l;\n}\n.box-v-c-r{\n  @include box-v-c-r;\n}\n.box-v-t-c{\n  @include box-v-t-c;\n}\n.box-v-t-l{\n  @include box-v-t-l;\n}\n.box-v-t-r{\n  @include box-v-t-r;\n}\n.box-v-b-c{\n  @include box-v-b-c;\n}\n.box-v-b-l{\n  @include box-v-b-l;\n}\n.box-v-b-r{\n  @include box-v-b-r;\n}\n"
  },
  {
    "path": "app/templates/app/scss/_button.scss",
    "content": "@charset \"UTF-8\";\n.btn {\n  display: inline-block;\n  text-align: center;\n  @include active-default;\n  @include disabled-select;\n}\n\n.btn-2i {\n  i {\n    &:nth-child(2), &.active {\n      display: none;\n    }\n  }\n  &:active,&.on {\n    i {\n      &:nth-child(1), &.normal {\n        display: none;\n      }\n      &:nth-child(2), &.active {\n        display: inline-block;\n      }\n    }\n  }\n  &.dis-active{\n    &:active{\n      i {\n        &:nth-child(1), &.normal {\n          display: inline-block;\n        }\n        &:nth-child(2), &.active {\n          display: none;\n        }\n      }\n    }\n  }\n}\n\n.bt-primary,.bt-default {\n  height: 100px;\n  line-height: 98px;\n  font-size: 38px;\n  padding: 0 30px;\n  text-transform: uppercase;\n  &.size-s{\n    padding: 0 20px;\n    font-size: 28px;\n    height: 70px;\n    line-height: 68px;\n  }\n}\n.bt-primary{\n  color: #fff;\n  background-color: $color-black-fourth;\n  &:active {\n    background-color: $color-red;\n  }\n  &.disabled{\n    background-color: $color-gray-third;\n    &:active{\n      background-color: $color-gray-third;\n    }\n  }\n}\n\n.bt-default {\n  border: 2px solid $color-black-second;\n  color: $color-black-fourth;\n  background: #fff;\n  &:active {\n    border: 2px solid $color-red;\n    color: #fff;\n    background-color: $color-red;\n  }\n  &.disabled{\n    color: #cfcfcf;\n    &:active{\n      border: 2px solid $color-gray;\n      color: #f1f1f1;\n      background-color: inherit;\n    }\n  }\n}\n"
  },
  {
    "path": "app/templates/app/scss/_common.scss",
    "content": "@charset \"UTF-8\";\n/* http://css-tricks.com/poll-results-how-do-you-order-your-css-properties/ */\nbody, html {\n  text-align: left;\n  height: 100%; /*高度必须为100%*/\n  width: 100%;\n  font-family: Roboto, HelveticaNeue, Helvetica, Arial, sans-serif;\n  font-size: 16px;\n  font-weight: normal;\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n  -webkit-box-align: center;\n}\n\nbody {\n  width: $layout-with;\n  min-height: 100%;\n  height: auto;\n}\n\n* {\n  margin: 0;\n  padding: 0;\n  border: 0;\n  -webkit-user-select: text;\n  word-break: normal;\n}\n\n*, :after, :before {\n  -webkit-box-sizing: border-box; /*高宽不算padding,margin*/\n  -webkit-text-size-adjust: none;\n  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\na, img {\n  -webkit-touch-callout: none; /*禁用长按弹出系统菜单*/\n}\n\na {\n  text-decoration: none;\n}\n\nsection, p, div {\n  max-height: 999999px;\n}\n\ntextarea, input[type=\"password\"], input[type=\"text\"] {\n  resize: none; /*禁用可缩放*/\n  outline: none; /*禁用发光效果*/\n  -webkit-appearance: none; /*禁用增加外观效果*/\n  white-space: pre-wrap;\n  word-wrap: break-word;\n  background: #fff;\n  overflow: scroll;\n}\n\naudio {\n  width: 0;\n  height: 0;\n  padding: 0;\n  margin: 0;\n  opacity: 0;\n  visibility: hidden;\n  display: none;\n  position: absolute;\n  top: 0;\n  left: 0;\n}\n"
  },
  {
    "path": "app/templates/app/scss/_components.scss",
    "content": "@charset \"UTF-8\";\n/*debug-button.scss*/\n@import \"button.scss\";\n/*end debug-button.scss*/\n\n/*debug-slide.scss*/\n@import \"slide.scss\";\n/*end debug-slide.scss*/\n\n/*debug-msgbox.scss*/\n@import \"msgbox.scss\";\n/*end debug-msgbox.scss*/\n\n/*debug-tooltip.scss*/\n@import \"tooltip.scss\";\n/*end debug-tooltip.scss*/\n\n/*debug-loading-spinner.scss*/\n@import \"loading-spinner.scss\";\n/*end debug-loading-spinner.scss*/\n\n/*debug-section-download.scss*/\n@import \"section-download.scss\";\n/*end debug-section-download.scss*/\n"
  },
  {
    "path": "app/templates/app/scss/_fonts.scss",
    "content": "@charset \"UTF-8\";\n"
  },
  {
    "path": "app/templates/app/scss/_footer.scss",
    "content": "@charset \"UTF-8\";\n.footer-section {\n  margin-top: -1px;\n  width: 100%;\n  background-color: #3d1c21;\n  padding: 45px 0;\n  color: #fff;\n  > .stores {\n    @include box-h-c-c;\n    a {\n      display: inline-block;\n      margin: 0 20px;\n    }\n  }\n  > .about {\n    font-size: 24px;\n    margin-top: 18px;\n    p {\n      line-height: 30px;\n      text-align: center;\n    }\n    .a, a:active, a:link, a:hover {\n      color: #fff;\n      text-decoration: underline;\n    }\n  }\n}\n"
  },
  {
    "path": "app/templates/app/scss/_header.scss",
    "content": "@charset \"UTF-8\";\n.tabs-title-default {\n  @include box-h;\n  -webkit-border-radius: 10px;\n  background-color: #eeeeee;\n  overflow: hidden;\n  border: 2px solid #acacac;\n  > div {\n    @include box-h-c-c;\n    -webkit-box-flex: 1;\n    width: 50%;\n    font-size: 28px;\n    padding: 12px 0;\n    color: #acacac;\n    background-color: #f0f0f0;\n    @include active-default;\n\n    &.first {\n      -webkit-border-top-left-radius: 8px;\n      -webkit-border-bottom-left-radius: 8px;\n    }\n\n    &.last {\n      -webkit-border-top-right-radius: 8px;\n      -webkit-border-bottom-right-radius: 8px;\n    }\n    &.on {\n      color: #fff;\n      background-color: #acacac;\n    }\n  }\n}\n\n.tabs-title-underline {\n  position: relative;\n  @include box-h;\n  height: 70px;\n  width: 100%;\n  padding: 0 28px;\n  background-color: #fff;\n  color: #747474;\n  > article {\n    position: relative;\n    @include box-h-c-c;\n    height: 100%;\n    -webkit-box-flex: 1;\n    @include active-default;\n    > .title {\n      height: 100%;\n      width: 100%;\n      text-align: center;\n      line-height: 70px;\n      font-size: 32px;\n    }\n    > .underline {\n      position: absolute;\n      bottom: 0;\n      left: 0;\n      @include box-h-c-c;\n      height: 5px;\n      width: 100%;;\n      > div {\n        opacity: 0;\n        height: 0;\n        width: 0;\n        background-color: #e84142;\n        -webkit-transition: all .35s ease-in-out;\n      }\n    }\n    > .notify {\n      display: none;\n      z-index: 2;\n      position: absolute;\n      width: 8px;\n      height: 8px;\n      top: 14px;\n      right: 14px;\n      background-color: #e84142;\n      -webkit-border-radius: 100%;\n      &.on {\n        @include box-h;\n      }\n    }\n    &.on {\n      color: #292929;\n      > .underline {\n        > div {\n          opacity: 1;\n          height: 100%;\n          width: 80%;\n        }\n      }\n    }\n  }\n}\n\n.section-title-default {\n  @include box-h-c-l;\n  height: 100px;\n  line-height: 100px;\n  padding: 0 20px;\n  > div {\n    display: -webkit-box;\n  }\n  > .dot {\n    width: 10px;\n    height: 10px;\n    -webkit-border-radius: 5px;\n    background-color: $color-black-third;\n  }\n  > .title {\n    padding-left: 12px;\n    font-size: 36px;\n    line-height: 38px;\n    color: $color-black-third;\n    -webkit-box-flex: 1;\n    /*\n    &.animated{\n      @include animated-1s;\n      -webkit-animation-name: fadeInLeft;\n    }\n    */\n  }\n  > .link {\n    > a, > a:active, > a:hover, > a:visited {\n      font-size: 32px;\n      color: #00a0e9;\n    }\n  }\n  &.bar {\n    height: 120px;\n    line-height: 120px;\n    > .dot {\n      width: 4px;\n      height: 30px;\n      background-color: $color-red;\n      -webkit-border-radius: 0;\n    }\n    > .title {\n      color: $color-black-second;\n      padding-left: 20px;\n    }\n  }\n  &.center {\n    @include box-h-c-c;\n    .title {\n      display: inline-block;\n    }\n    .dot {\n      margin-top: -14px;\n    }\n  }\n}\n.section-title-similar{\n  width: 100%;\n  height: 48px;\n  padding: 0 40px;\n  line-height: 48px;\n  font-size: 28px;\n  color: $color-gray-second;\n  background-color: #f9f9f9;\n}\n"
  },
  {
    "path": "app/templates/app/scss/_icon.scss",
    "content": "@charset \"UTF-8\";\n/*debug-sprites.scss*/\n@import \"sprites.scss\";\n\n/*end debug-sprites.scss*/\n\n.icon {\n  background-repeat: no-repeat;\n  display: inline-block;\n  @include disabled-select;\n}\n"
  },
  {
    "path": "app/templates/app/scss/_list.scss",
    "content": "@charset \"UTF-8\";\n.tabs-content-default {\n  display: none;\n  &.show {\n    display: block;\n    @include animated-1s;\n  }\n  &.animated {\n    -webkit-animation-name: fadeInUp;\n  }\n}\n.user-item-default {\n  @include box-v;\n  width: 100%;\n  font-size: 38px;\n  > .item {\n    @include box-h;\n    width: 100%;\n    padding: 30px;\n    text-align: center;\n  }\n}\n"
  },
  {
    "path": "app/templates/app/scss/_loading-spinner.scss",
    "content": "@charset \"UTF-8\";\n.loading-spinner {\n  font-size: 120%;\n  height: 1em;\n  width: 1em;\n  position: relative;\n  -webkit-transform-origin: 0.5em 0.5em;\n  > span {\n    display: block;\n    position: absolute;\n    width: 0.1em;\n    height: 0.25em;\n    top: 0;\n    -webkit-transform-origin: 0.05em 0.5em;\n    -webkit-border-radius: 0.05em;\n    border-radius: 0.05em;\n    content: \" \";\n    &:before, &:after {\n      display: block;\n      position: absolute;\n      width: 0.1em;\n      height: 0.25em;\n      top: 0;\n      -webkit-transform-origin: 0.05em 0.5em;\n      -webkit-border-radius: 0.05em;\n      border-radius: 0.05em;\n      content: \" \";\n    }\n    &.loading-top {\n      background-color: rgba(0, 0, 0, 0.99);\n      &:after {\n        background-color: rgba(0, 0, 0, 0.9);\n      }\n    }\n    &.loading-left {\n      background-color: rgba(0, 0, 0, 0.7);\n      &:before {\n        background-color: rgba(0, 0, 0, 0.8);\n      }\n      &:after {\n        background-color: rgba(0, 0, 0, 0.6);\n      }\n    }\n    &.loading-bottom {\n      background-color: rgba(0, 0, 0, 0.4);\n      &:before {\n        background-color: rgba(0, 0, 0, 0.5);\n      }\n      &:after {\n        background-color: rgba(0, 0, 0, 0.35);\n      }\n    }\n    &.loading-right {\n      background-color: rgba(0, 0, 0, 0.25);\n      &:before {\n        background-color: rgba(0, 0, 0, 0.3);\n      }\n      &:after {\n        background-color: rgba(0, 0, 0, 0.2);\n      }\n    }\n    &.loading-top {\n      &:before {\n        background-color: rgba(0, 0, 0, 0.15);\n      }\n      -webkit-transform: rotate(0deg);\n    }\n    left: 50%;\n    margin-left: -0.05em;\n    &.loading-right {\n      -webkit-transform: rotate(90deg);\n    }\n    &.loading-bottom {\n      -webkit-transform: rotate(180deg);\n    }\n    &.loading-left {\n      -webkit-transform: rotate(270deg);\n    }\n    &:before {\n      -webkit-transform: rotate(30deg);\n    }\n    &:after {\n      -webkit-transform: rotate(-30deg);\n    }\n  }\n  -webkit-animation-name: spinnerRotateRight;\n  -webkit-animation-duration: .8s;\n  -webkit-animation-iteration-count: infinite;\n  -webkit-animation-timing-function: linear;\n}\n"
  },
  {
    "path": "app/templates/app/scss/_mixin.scss",
    "content": "@charset \"UTF-8\";\n@mixin animated-1s {\n  animation-duration: 1s;\n  animation-iteration-count: 1;\n  animation-fill-mode: both;\n  animation-timing-function: ease-in-out;\n  -webkit-animation-duration: 1s;\n  -webkit-animation-iteration-count: 1;\n  -webkit-animation-fill-mode: both;\n  -webkit-animation-timing-function: ease-in-out;\n}\n\n@mixin blank-bg {\n\n  background-image: url('about:blank');\n  /*\n  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABBJREFUeNpi+P//PwNAgAEACPwC/tuiTRYAAAAASUVORK5CYII=);\n  background-repeat: repeat;\n  */\n  display: block !important;\n}\n\n@mixin box-h {\n  display: -webkit-box;\n  -webkit-box-orient: horizontal;\n}\n\n@mixin box-h-c-c {\n  display: -webkit-box;\n  -webkit-box-orient: horizontal;\n  -webkit-box-pack: center;\n  -webkit-box-align: center;\n}\n\n@mixin box-h-c-r {\n  display: -webkit-box;\n  -webkit-box-orient: horizontal;\n  -webkit-box-pack: end;\n  -webkit-box-align: center;\n}\n\n@mixin box-h-c-l {\n  display: -webkit-box;\n  -webkit-box-orient: horizontal;\n  -webkit-box-align: center;\n  -webkit-box-pack: start;\n}\n\n@mixin box-h-t-c {\n  display: -webkit-box;\n  -webkit-box-orient: horizontal;\n  -webkit-box-align: start;\n  -webkit-box-pack: center;\n}\n\n@mixin box-h-t-l {\n  display: -webkit-box;\n  -webkit-box-orient: horizontal;\n  -webkit-box-align: start;\n  -webkit-box-pack: start;\n}\n\n@mixin box-h-t-r {\n  display: -webkit-box;\n  -webkit-box-orient: horizontal;\n  -webkit-box-align: start;\n  -webkit-box-pack: end;\n}\n\n@mixin box-h-b-c {\n  display: -webkit-box;\n  -webkit-box-orient: horizontal;\n  -webkit-box-pack: center;\n  -webkit-box-align: end;\n}\n@mixin box-h-b-l {\n  display: -webkit-box;\n  -webkit-box-orient: horizontal;\n  -webkit-box-pack: start;\n  -webkit-box-align: end;\n}\n@mixin box-h-b-r {\n  display: -webkit-box;\n  -webkit-box-orient: horizontal;\n  -webkit-box-pack: end;\n  -webkit-box-align: end;\n}\n\n@mixin box-v {\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n}\n\n@mixin box-v-c-c {\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n  -webkit-box-align: center;\n  -webkit-box-pack: center;\n}\n@mixin box-v-c-l {\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n  -webkit-box-pack: center;\n  -webkit-box-align: start;\n}\n@mixin box-v-c-r {\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n  -webkit-box-pack: center;\n  -webkit-box-align: end;\n}\n@mixin box-v-t-c {\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n  -webkit-box-align: center;\n}\n@mixin box-v-t-l {\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n  -webkit-box-align: start;\n  -webkit-box-pack: start;\n}\n@mixin box-v-t-r {\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n  -webkit-box-align: start;\n  -webkit-box-pack: end;\n}\n@mixin box-v-b-c {\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n  -webkit-box-pack: end;\n  -webkit-box-align: center;\n}\n@mixin box-v-b-l {\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n  -webkit-box-pack: end;\n  -webkit-box-align: start;\n}\n@mixin box-v-b-r {\n  display: -webkit-box;\n  -webkit-box-orient: vertical;\n  -webkit-box-pack: end;\n  -webkit-box-align: end;\n}\n\n@mixin active-default {\n  &:active {\n    opacity: $active-opacity;\n  }\n}\n@mixin active-ripple {\n  position: relative;\n  overflow: hidden;\n  &:after {\n    content: \"\";\n    position: absolute;\n    left: 50%;\n    top: 50%;\n    display: inherit;\n    padding-top: $layout-with;\n    padding-left: $layout-with;\n    margin-top: -$layout-with/2;\n    margin-left: -$layout-with/2;\n    border-radius: 50%;\n    opacity: 0;\n    background: rgba(255,255,255,0.5);\n    transition: all 1s;\n  }\n  &:active:after {\n    padding-top: 0;\n    padding-left: 0;\n    margin-top: 0;\n    margin-left: 0;\n    opacity: 1;\n    transition: 0s;\n  }\n}\n\n@mixin gpu-accelerate {\n  -webkit-transform: translateZ(0);\n}\n\n@mixin disabled-select {\n  -webkit-user-select: none;\n}\n\n@mixin disabled-select-all {\n  * {\n    @include disabled-select;\n  }\n}\n"
  },
  {
    "path": "app/templates/app/scss/_msgbox-android.scss",
    "content": "@charset \"UTF-8\";\n$android-border-radius: 8px;\n/* android */\n.msgbox{\n  .msgbox-bd.android{\n    color: #000;\n    > .box-ct.dialog{\n      $dialog-w: $layout-with * 0.86;\n      > .box-bd {\n        width: $dialog-w;\n        -webkit-border-radius: $android-border-radius;\n        .content {\n          background-color: #fff;\n          -webkit-border-radius: $android-border-radius $android-border-radius 0 0;\n        }\n        .bbts {\n          @include box-h-c-r;\n          width: 100%;\n          background-color: #fff;\n          padding: 14px 30px;\n          > div {\n            display: inline-block;\n            min-width: 172px;\n            height: 76px;\n            padding: 20px 22px;\n            color: #009688;\n            text-align: center;\n            text-transform: uppercase;\n            background-color: #fff;\n            -webkit-border-radius: 0 !important;\n            &:active {\n              background-color: #b6b6b6;\n            }\n            margin-top: 0;\n            &.no {\n              margin-right: 0;\n            }\n          }\n        }\n      }\n    }\n    > .box-ct.menu {\n      $dialog-w: $layout-with * 0.98;\n      $option-h: 120px;\n      //position: fixed;\n      left: ($layout-with - $dialog-w)/2;\n      bottom: 0px;\n      > .box-bd {\n        width: $dialog-w;\n        padding-bottom: 0;\n        > div {\n          @include box-v;\n        }\n        .opt {\n          &:active {\n            background-color: #b6b6b6;\n          }\n          @include box-h-c-c;\n          -webkit-box-flex: 1;\n          padding: 20px 0;\n          height: $option-h;\n          background-color: #fff;\n          text-transform: uppercase;\n          color: #009688;\n          &.msg{\n            height: auto;\n            min-height: $option-h;\n            padding: 20px;\n            color: #7b7b7b;\n            text-transform: none;\n            &:active{\n              background-color: #fff;\n            }\n          }\n          &.no {\n            margin-top: 20px;\n            background-color: #fff;\n            -webkit-border-radius: 0 !important;\n            font-weight: normal;\n            &:active{\n              background-color: #b6b6b6;\n            }\n          }\n          &.highlight{\n            color: #009688;\n          }\n        }\n        .options{\n          -webkit-border-radius: $android-border-radius;\n          overflow: hidden;\n          > div {\n            margin-top: 0;\n            &:first-child{\n              -webkit-border-radius: $android-border-radius $android-border-radius 0 0;\n              margin-top: 0;\n            }\n          }\n        }\n      }\n    }\n  }\n}\n/* end android */\n"
  },
  {
    "path": "app/templates/app/scss/_msgbox-deja.scss",
    "content": "@charset \"UTF-8\";\n/* deja */\n.msgbox {\n  .msgbox-bd.deja{\n    > .box-ct.dialog {\n      $dialog-w: $layout-with * 0.82;\n      color: $color-black-second;\n      > .box-bd {\n        width: $dialog-w;\n        -webkit-border-radius: 0;\n        .content {\n          padding-top: 68px;\n          line-height: 42px;\n          background-color: #fff;\n          -webkit-border-radius: 0;\n        }\n        .msg {\n          color: $color-black-second;\n          padding: 0 30px 68px 30px;\n        }\n        .title {\n          line-height: 60px;\n        }\n        .bbts {\n          background-color: #fff;\n          > div {\n            margin-top: 0;\n            height: 110px;\n            border-top: 1px solid #e1e1e1;\n            font-size: 34px;\n            color: #fff;\n            &:first-child {\n              -webkit-border-radius: 0;\n            }\n            &:last-child {\n              -webkit-border-radius: 0;\n            }\n            &.no {\n              margin-right: 0;\n              color: $color-black-second;\n              background-color: #f6f6f6;\n              &:active{\n                background-color: #fff;\n              }\n            }\n            &.yes {\n              background-color: $color-red;\n              font-weight: normal;\n              &:active{\n                background-color: rgba(248,31,52,0.5);\n              }\n            }\n          }\n        }\n      }\n    }\n\n    > .box-ct.signin {\n      $dialog-w: 620px;\n      > .box-bd {\n        position: relative;\n        width: $dialog-w;\n        min-height: 340px;\n        background-color: #fff;\n        padding: 30px;\n        > div {\n          @include box-v-c-c;\n        }\n        .msg {\n          font-size: 34px;\n          color: $color-black-second;\n          min-height: 200px;\n          text-align: center;\n          padding-top: 100px;\n        }\n        .plf {\n          .b {\n            @include active-default;\n          }\n        }\n        .no {\n          position: absolute;\n          top: 0;\n          left: 0;\n          width: 80px;\n          height: 80px;\n          background-color: #e1e1e1;\n          &:active {\n            background-color: $color-red;\n          }\n        }\n      }\n    }\n    > .box-ct.winfaceanalysis {\n      $dialog-w: 536px;\n      > .box-bd {\n        position: relative;\n        width: $dialog-w;\n        > div {\n          @include box-v-c-c;\n          position: absolute;\n        }\n        .no {\n          top: 0;\n          left: 0;\n          width: 100px;\n          height: 100px;\n        }\n        .share{\n          left: 0;\n          bottom: 0;\n          width: 100%;\n          height: 200px;\n        }\n      }\n    }\n  }\n}\n/* end deja */\n"
  },
  {
    "path": "app/templates/app/scss/_msgbox.scss",
    "content": "@charset \"UTF-8\";\n$ios-border-radius: 30px;\n\n/* default */\n.msgbox {\n  position: fixed;\n  z-index: 999;\n  top: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  display: none;\n  background-color: transparent;\n  word-break: break-all;\n  overflow: hidden;\n  &.show {\n    display: -webkit-box;\n    > .box-mask {\n      -webkit-animation-name: MicroMask;\n      @include animated-1s;\n      -webkit-animation-timing-function: linear;\n      -webkit-animation-duration: 250ms;\n    }\n  }\n  > .box-mask, > .msgbox-ct {\n    width: 100%;\n    height: 100%;\n    top: 0;\n    left: 0;\n    right: 0;\n    bottom: 0;\n  }\n  > .box-mask {\n    position: absolute;\n    background-color: #000;\n    opacity: 0;\n  }\n  > .msgbox-ct {\n    position: relative;\n    -webkit-transform: translateZ(0);\n    background-color: transparent;\n    display: -webkit-box;\n    -webkit-box-pack: center;\n    > .msgbox-bd {\n      position: relative;\n      @include box-v-c-c;\n      width: $layout-with;\n      height: 100%;\n      > .box-ct {\n        display: -webkit-box;\n        font-size: 40px;\n        color: #f6f6f6;\n        -webkit-animation-name: MicroPopUp;\n        @include animated-1s;\n        -webkit-animation-duration: 250ms;\n        > .box-bd {\n          -webkit-transform: translateZ(0);\n          > div {\n            width: 100%;\n            height: 100%;\n          }\n        }\n        &.absolute{\n          position: absolute;\n        }\n      }\n      > .box-ct.dialog {\n        $dialog-w: $layout-with * 0.72;\n        color: #000;\n        > .box-bd {\n          width: $dialog-w;\n          overflow: hidden;\n          -webkit-border-radius: $ios-border-radius;\n          > div {\n            @include box-v;\n          }\n          .content {\n            padding-top: 30px;\n            background-color: rgba(225, 225, 225, .9);\n            -webkit-border-radius: $ios-border-radius $ios-border-radius 0 0;\n          }\n          .title {\n            @include box-h-c-c;\n            font-size: 36px;\n          }\n          .msg {\n            font-size: 28px;\n            padding: 0 30px 30px 30px;\n            line-height: 36px;\n            @include box-v-c-c;\n            .simley {\n              margin-left: 40px;\n              -webkit-animation-name: bounceIn;\n              @include animated-1s;\n              -webkit-animation-duration: .6s;\n            }\n            > p {\n              width: 100%;\n              @include box-h-t-l;\n              &.c {\n                text-align: center;\n                @include box-h-c-c;\n              }\n            }\n          }\n          .bbts {\n            @include box-h-c-c;\n            > div {\n              &:active {\n                background-color: #d0d0d0;\n              }\n              @include box-h-c-c;\n              -webkit-box-flex: 1;\n              font-size: 36px;\n              color: #007aff;\n              margin-top: 1px;\n              padding: 20px 0;\n              height: 88px;\n              background-color: rgba(225, 225, 225, .9);\n              &:first-child {\n                -webkit-border-radius: 0 0 0 $ios-border-radius;\n              }\n              &:last-child {\n                -webkit-border-radius: 0 0 $ios-border-radius 0;\n              }\n              &.no {\n                margin-right: 1px;\n              }\n              &.yes {\n                font-weight: bold;\n              }\n            }\n          }\n        }\n      }\n      > .box-ct.menu {\n        $dialog-w: $layout-with * 0.95;\n        $option-h: 115px;\n        //position: fixed;\n        left: ($layout-with - $dialog-w)/2;\n        bottom: 0px;\n        color: #000;\n        -webkit-animation-name: slideInUp;\n        &.close{\n          -webkit-animation-name: slideOutDown;\n        }\n        > .box-bd {\n          width: $dialog-w;\n          padding-bottom: 18px;\n          > div {\n            @include box-v;\n          }\n          .opt {\n            &:active {\n              background-color: #e9e9e9;\n            }\n            @include box-h-c-c;\n            -webkit-box-flex: 1;\n            font-size: 36px;\n            color: #007aff;\n            padding: 20px 0;\n            height: $option-h;\n            background-color: #f6f7f8;\n            &.msg{\n              height: auto;\n              min-height: $option-h;\n              padding: 20px;\n              color: #8f8f8f;\n              font-size: 28px;\n              text-align: center;\n              &:active{\n                background-color: #f6f7f8;\n              }\n            }\n            &.no {\n              margin-top: 18px;\n              background-color: #fff;\n              -webkit-border-radius: $ios-border-radius;\n              font-weight: bold;\n              &:active{\n                background-color: #f5f5f5;\n              }\n            }\n            &.highlight{\n              color: #f1442c;\n            }\n          }\n          .options{\n            -webkit-border-radius: $ios-border-radius;\n            overflow: hidden;\n            > div {\n              margin-top: 1px;\n              &:first-child{\n                -webkit-border-radius: $ios-border-radius $ios-border-radius 0 0;\n                margin-top: 0;\n              }\n            }\n          }\n        }\n      }\n      > .box-ct.loading {\n        $dialog-w: 240px;\n        > .box-bd {\n          padding-top: 50px;\n          width: $dialog-w;\n          height: 240px;\n          background-color: rgba(225, 225, 225, .9);\n          -webkit-border-radius: 10px;\n          > div {\n            @include box-v-c-c;\n          }\n          .msg {\n            font-size: 34px;\n            color: #000;\n            margin-top: 40px;\n          }\n        }\n      }\n    }\n  }\n}\n/* end default */\n\n/*debug-msgbox-android.scss*/\n@import \"msgbox-android.scss\";\n/*end debug-msgbox-android.scss*/\n\n/*debug-msgbox-deja.scss*/\n@import \"msgbox-deja.scss\";\n/*end debug-msgbox-deja.scss*/\n"
  },
  {
    "path": "app/templates/app/scss/_section-download.scss",
    "content": "@charset \"UTF-8\";\n.section-download{\n  @include box-h-c-c;\n  padding: 20px;\n  background-color: #fdfdfd;\n  .sd-logo{\n    width: 114px;\n    height: 114px;\n    img{\n      width: 100%;\n      height: 100%;\n    }\n  }\n  .sd-info{\n    @include box-v;\n    padding: 23px 20px;\n    -webkit-box-flex: 1;\n    .name{\n      font-size: 36px;\n      font-weight: bold;\n    }\n    .dest{\n      font-size: 28px;\n      color: $color-black-third;\n    }\n  }\n}\n"
  },
  {
    "path": "app/templates/app/scss/_slide.scss",
    "content": "@charset \"UTF-8\";\n.slide {\n  position: relative;\n}\n\n.slide > * {\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n}\n\n.slide > *:not(.selected):not([animate]) {\n  display: none !important;\n}\n\n.slide-from-right > *, .slide-from-bottom > * {\n  -webkit-transition: -webkit-transform .6s cubic-bezier(0.4, 0, 0.2, 1);\n  transition: transform .6s cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n.slide-from-right > .selected ~ [animate]:not(.selected) {\n  -webkit-transform: translateX(100%);\n  transform: translateX(100%);\n}\n\n.slide-from-right > [animate]:not(.selected) {\n  -webkit-transform: translateX(-100%);\n  transform: translateX(-100%);\n}\n\n.slide-from-bottom > .selected ~ [animate]:not(.selected) {\n  -webkit-transform: translateY(100%);\n  transform: translateY(100%);\n}\n\n.slide-from-bottom > [animate]:not(.selected) {\n  -webkit-transform: translateY(-100%);\n  transform: translateY(-100%);\n}\n\n.slide-from-right > .selected, .slide-from-bottom > .selected {\n  -webkit-transform: none;\n  transform: none;\n}\n"
  },
  {
    "path": "app/templates/app/scss/_sprites.scss",
    "content": ".icon {\n  background-image: url('../images/sprites.png');\n}\n\n.icon-ic_s_close_pre_2x {\n  background-position: -4px -4px;\n  width: 30px;\n  height: 30px;\n}\n\n.icon-ic_s_close_nor_2x {\n  background-position: -4px -42px;\n  width: 30px;\n  height: 30px;\n}\n\n.icon-bt_google {\n  background-position: -4px -80px;\n  width: 180px;\n  height: 60px;\n}\n\n.icon-bt_Appbutton {\n  background-position: -4px -148px;\n  width: 180px;\n  height: 60px;\n}\n\n.icon-btn_fb_login {\n  background-position: -4px -216px;\n  width: 460px;\n  height: 95px;\n}\n\n.icon-ic_url_copy_pre_2x {\n  background-position: -4px -319px;\n  width: 120px;\n  height: 120px;\n}\n\n.icon-ic_about_ins_pre {\n  background-position: -4px -447px;\n  width: 120px;\n  height: 120px;\n}\n\n.icon-ic_about_tw_nor {\n  background-position: -4px -575px;\n  width: 120px;\n  height: 120px;\n}\n\n.icon-ic_about_tw_pre {\n  background-position: -4px -703px;\n  width: 120px;\n  height: 120px;\n}\n\n.icon-ic_about_fb_nor {\n  background-position: -4px -831px;\n  width: 120px;\n  height: 120px;\n}\n\n.icon-ic_about_fb_pre {\n  background-position: -4px -959px;\n  width: 120px;\n  height: 120px;\n}\n\n.icon-ic_url_copy_nor_2x {\n  background-position: -4px -1087px;\n  width: 120px;\n  height: 120px;\n}\n\n.icon-ic_about_ins_nor {\n  background-position: -4px -1215px;\n  width: 120px;\n  height: 120px;\n}\n\n.icon-logo {\n  background-position: -4px -1343px;\n  width: 140px;\n  height: 140px;\n}\n\n.icon-ic_vote_skip_nor_2x {\n  background-position: -4px -1491px;\n  width: 154px;\n  height: 154px;\n}\n\n.icon-ic_vote_skip_pre_2x {\n  background-position: -4px -1653px;\n  width: 154px;\n  height: 154px;\n}\n\n.icon-ic_vote_vote_nor_2x {\n  background-position: -4px -1815px;\n  width: 154px;\n  height: 154px;\n}\n\n.icon-ic_vote_vote_pre_2x {\n  background-position: -4px -1977px;\n  width: 154px;\n  height: 154px;\n}\n\n.icon-pic_vote_good_2x {\n  background-position: -4px -2139px;\n  width: 290px;\n  height: 240px;\n}\n\n.icon-pic_vote_skip_2x {\n  background-position: -4px -2387px;\n  width: 290px;\n  height: 240px;\n}\n\n"
  },
  {
    "path": "app/templates/app/scss/_tooltip.scss",
    "content": "@charset \"UTF-8\";\n$tooltip-color-default: #fff;\n.tooltip {\n  position: fixed;\n  z-index: 90;\n  left: 0;\n  width: 100%;\n  display: none;\n  background-color: transparent;\n  &.show {\n    @include box-h-c-c;\n  }\n  >.tooltip__ct{\n    width: $layout-with;\n    padding-top: 20px;\n    padding-bottom: 20px;\n    overflow-x: hidden;\n    >.tooltip__bd{\n      position: relative;\n      display: inline-block;\n      top: 0;\n      padding: 20px;\n      background-color: $tooltip-color-default;\n      font-size: 30px;\n      color: $color-black-second;\n      border: 1px solid rgba(0, 0, 0, 0.3);\n      -webkit-box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.3);\n      -webkit-border-radius: 5px;\n      @include gpu-accelerate;\n      &.animated{\n        @include animated-1s;\n        -webkit-animation-duration: 350ms;\n        &.fadeIn{\n          -webkit-animation-name: fadeIn;\n        }\n        &.flipInY{\n          -webkit-animation-name: flipInY;\n        }\n        &.flipInX{\n          -webkit-animation-name: flipInX;\n        }\n        &.slideInUp{\n          -webkit-animation-name: slideInUp;\n        }\n        &.slideInDown{\n          -webkit-animation-name: slideInDown;\n        }\n        &.zoomIn{\n          -webkit-animation-name: zoomIn;\n        }\n        &.fadeInLeft{\n          -webkit-animation-name: fadeInLeft;\n        }\n        &.fadeInRight{\n          -webkit-animation-name: fadeInRight;\n        }\n        &.fadeInUp{\n          -webkit-animation-name: fadeInUp;\n        }\n        &.fadeInDown{\n          -webkit-animation-name: fadeInDown;\n        }\n        &.fadeOut{\n          -webkit-animation-name: fadeOut;\n        }\n      }\n      >.tooltip__content{\n        text-align: center;\n      }\n      >.tooltip__arrow{\n        position: absolute;\n        background-color: $tooltip-color-default;\n        width: 16px;\n        height: 16px;\n        overflow: hidden;\n        @include gpu-accelerate;\n        >div{\n          width: 32px;\n          height: 32px;\n          border: 1px solid rgba(0, 0, 0, 0.3);\n        }\n        &.left{\n          left: -9px;\n          -webkit-transform: rotate(-45deg);\n        }\n        &.right{\n          right: -9px;\n          -webkit-transform: rotate(135deg);\n        }\n        &.top{\n          top: -9px;\n          -webkit-transform: rotate(45deg);\n        }\n        &.bottom{\n          bottom: -9px;\n          -webkit-transform: rotate(-135deg);\n        }\n      }\n    }\n  }\n  &.clear{\n    >.tooltip__ct{\n      >.tooltip__bd{\n        background-color: transparent;\n        color: $tooltip-color-default;\n        border: 0;\n        -webkit-box-shadow: none;\n        -webkit-border-radius: 0;\n        >.tooltip__arrow {\n          display: none;\n        }\n      }\n    }\n  }\n  //theme\n  &.red{\n    >.tooltip__ct{\n     >.tooltip__bd{\n       background-color: $color-red;\n       color: $tooltip-color-default;\n       border: 0;\n       -webkit-box-shadow: none;\n       -webkit-border-radius: 0;\n       >.tooltip__arrow {\n         background-color: $color-red;\n         >div {\n           border: 0;\n         }\n       }\n     }\n    }\n  }\n  &.black{\n    font-family: \"Segoe Print\",Roboto, HelveticaNeue, Helvetica, Arial, sans-serif;\n    >.tooltip__ct{\n      >.tooltip__bd{\n        //background-color: rgba(38,39,41,0.9);\n        background-color: $color-black-fourth;\n        color: #fff;\n        border: 0;\n        -webkit-box-shadow: none;\n        -webkit-border-radius: 0;\n        >.tooltip__arrow {\n          //background-color: rgba(38,39,41,0.9);\n          background-color: $color-black-fourth;\n          >div {\n            border: 0;\n          }\n        }\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "app/templates/app/scss/_util.scss",
    "content": "@charset \"UTF-8\";\n\n.ellipsis {\n  text-overflow: ellipsis;\n  display: block;\n  white-space: nowrap;\n  overflow: hidden;\n}\n\n.clearfix::before,\n.clearfix::after {\n  content: \"\";\n  display: table;\n}\n\n.clearfix::after {\n  clear: both;\n}\n\n.fix-break-word, p {\n  @include blank-bg;\n  background-color: transparent;\n  word-break: break-all;\n  // Non standard for webkit\n  word-break: break-word;\n  -webkit-hyphens: auto;\n  hyphens: auto;\n}\n\n.hide {\n  display: none !important;\n}\n\n.uppercase {\n  text-transform: uppercase;\n}\nimg{\n  &.lazy{\n    opacity: 0;\n    //transition: opacity .3s ease-in;\n    min-height: 1px;\n    min-width: 1px;\n  }\n  &.lazy[src]:not(.animated){\n    opacity: 1;\n  }\n  &.lazy--loaded,&+.lazy__real{\n    &.animated{\n      @include animated-1s;\n      -webkit-animation-name: fadeIn;\n      -webkit-animation-duration: .3s;\n    }\n  }\n  &.lazy__virtual{\n    opacity: 0 !important;\n    &+.lazy__real{\n      display: none;\n    }\n    &.lazy--loaded{\n      display: none;\n      &+.lazy__real{\n        display: inherit;\n      }\n    }\n  }\n  &.fix-space{\n    display: block;\n  }\n}\n\n.img-loading-placeholder{\n  background: url(../images/loading_logo_2x.png) 50% 50% no-repeat;\n}\n\n.default-active {\n  @include active-default;\n}\n.ripple-active {\n  @include active-ripple;\n}\n\n.disabled-select {\n  @include disabled-select;\n}\n\n.disabled-select-all {\n  @include disabled-select-all;\n}\n"
  },
  {
    "path": "app/templates/app/scss/_value.scss",
    "content": "@charset \"UTF-8\";\n/*size*/\n$layout-with: _VIEWPORT_WIDTH_;/*see viewport:viewport package.json*/\n/*end size*/\n\n/*color*/\n$color-black: #2f2f2f;\n$color-black-second: #414141;\n$color-black-third: #818181;\n$color-black-fourth: #262729;\n$color-gray: #b5b7b6;\n$color-gray-second: #cecece;\n$color-gray-third: #eaeaea;\n$color-gray-fourth: #e1e1e1;\n$color-red: #f81f34;\n$color-blue: #71b0ea;\n/*end color*/\n\n$active-opacity: .8;\n\n"
  },
  {
    "path": "app/templates/app/scss/_view-home.scss",
    "content": "@charset \"UTF-8\";\n.view-home {\n  width: 100%;\n  min-height: 100%;\n  background-color: #35161f;\n  font-size: 38px;\n\n  .main {\n    @include box-h-c-c;\n    padding: 200px 30px;\n  }\n}\n\n"
  },
  {
    "path": "app/templates/app/scss/_view-user.scss",
    "content": "@charset \"UTF-8\";\n.view-user {\n  width: 100%;\n  background-color: #fff;\n  color: #292929;\n  .users {\n    @include box-v-c-c;\n    padding: 50px 30px;\n    .list {\n      padding: 50px;\n    }\n  }\n}\n\n"
  },
  {
    "path": "app/templates/app/scss/_view.scss",
    "content": "body > .view {\n  width: 100%;\n  visibility: hidden;\n  display: none;\n  &.animated {\n    @include animated-1s;\n    -webkit-animation-fill-mode: none; /*transform的动效会使当前view里fixed的元素将无效*/\n    -webkit-animation-name: MicroBounceOut;\n    -webkit-animation-duration: 350ms;\n  }\n  &.show {\n    visibility: visible !important;\n    display: block !important;\n  }\n}\n\n/*debug-view-home.scss*/\n@import \"view-home.scss\";\n/*end debug-view-home.scss*/\n\n/*debug-view-user.scss*/\n@import \"view-user.scss\";\n/*end debug-view-user.scss*/\n"
  },
  {
    "path": "app/templates/app/scss/styles.scss",
    "content": "@charset \"UTF-8\";\n\n/*_value.scss*/\n@import \"value.scss\";\n/*end _value.scss*/\n/*_mixin.scss*/\n@import \"mixin.scss\";\n/*end _mixin.scss*/\n/*_util.scss*/\n@import \"util.scss\";\n/*end _util.scss*/\n/*_box.scss*/\n@import \"box.scss\";\n/*end _box.scss*/\n/*_fonts.scss*/\n@import \"fonts.scss\";\n/*end _fonts.scss*/\n/*_common.scss*/\n@import \"common.scss\";\n/*end _common.scss*/\n/*_animate.scss*/\n@import \"animate.scss\";\n/*end _animate.scss*/\n/*_icon.scss*/\n@import \"icon.scss\";\n/*end _icon.scss*/\n/*_components.scss*/\n@import \"components.scss\";\n/*end _components.scss*/\n/*_header.scss*/\n@import \"header.scss\";\n/*end _header.scss*/\n/*_list.scss*/\n@import \"list.scss\";\n/*end _list.scss*/\n/*_footer.scss*/\n@import \"footer.scss\";\n/*end _footer.scss*/\n/*_view.scss*/\n@import \"view.scss\";\n/*end _view.scss*/\n"
  },
  {
    "path": "app/templates/app/src/app/App.js",
    "content": "//require('util/AppCache');\nrequire('lib/zepto');\nrequire('lib/Core');\nrequire('app/resources/i18n');\n\nvar BasicController = require('app/controller/Controller');\nvar HomeController = require('app/controller/HomeController');\nvar UserController = require('app/controller/UserController');\n//__INSERT_POINT__ Don't delete!!\n\nfunction App() {\n  var params = Core.localParam(),\n    standalone = params.search['standalone'];//如果带此参数，初始页非首页的浏览器历史返回将不会回首页\n  setTimeout(function () {\n    //Core.Router.init(standalone?'':'/home/');\n    Core.Router.init();\n  }, 50);\n}\n\nwindow.App = new App;\n"
  },
  {
    "path": "app/templates/app/src/app/controller/Controller.js",
    "content": "var Actions = require('app/resources/Actions');\nvar ThirdVendor = require('util/ThirdVendor');\nvar BasicModel = require('app/model/Model');\nvar BasicView = require('app/view/View');\n\nfunction Controller() {\n  this.models = {\n    Basic: BasicModel\n  };\n  this.views = {\n    Basic: BasicView\n  };\n  //所有视图初始化前，需要获得客户端的用户登录信息\n  //Core.Router.onReady(onUserinfo);\n\n  Core.Router.onChanged(onViewChanged);\n\n  var CTRL = this,\n    isApp = Core.NativeBridge.isApp(),\n    params = Core.localParam(),\n    _userid = params.search['userid'],\n    _sig = params.search['sig'];\n  ///*Todo: debug user\n  _userid && CTRL.models.Basic.setUserId(_userid);\n  _sig && CTRL.models.Basic.setUserSig(_sig);\n  //*/\n\n  //更新数据缓存时间\n  Core.Event.on('resetModelUpdateTimeout', CTRL.models.Basic.modelUpdate.timer.resetAll);\n  //通过API名称，调用客户API\n  Core.Event.on('appAPI', appAPI);\n  //分享\n  Core.Event.on('share', appShare);\n  //去下载\n  Core.Event.on('appDownload', redirectToDownload);\n  //直接到Store去下载\n  Core.Event.on('openAppInStore', downloadDejaInApp);\n  //去更新\n  Core.Event.on('appUpdate', appUpdate);\n  //去deja.me\n  Core.Event.on('redirectToDejame', redirectToDejame);\n  //跳转出商城\n  Core.Event.on('redirect', redirectToPage);\n  //去登录\n  Core.Event.on('login', onLogin);\n  //去WEB登录\n  Core.Event.on('webLogin', webLogin);\n  //去App登录\n  Core.Event.on('appLogin', appLogin);\n  //从App获取用户信息\n  Core.Event.on('appUserinfo', onUserinfo);\n  //去反馈\n  Core.Event.on('feedback', onFeedback);\n  //复制文本\n  Core.Event.on('appCopyText', appCopyText);\n  //更新标题\n  Core.Event.on('appModifyTitle', appModifyTitle);\n  //修改右上角功能菜单\n  Core.Event.on('appActionbutton', appActionButton);\n  //修改右上角功能菜单成默认\n  Core.Event.on('appActionDefaultButton', appActionDefaultButton);\n  //修改右上角功能菜单成分享\n  Core.Event.on('appActionShareButton', appActionShareButton);\n  //修改右上角功能菜单成Filter\n  Core.Event.on('appActionFilterButton', appActionFilterButton);\n  //修改右上角功能菜单成add\n  Core.Event.on('appActionAddButton', appActionAddButton);\n  //注册webview关闭事件\n  Core.Event.on('appOnUnload', appOnUnload);\n  //关闭webview\n  Core.Event.on('appCloseWebView', appCloseWebView);\n  //Update Profile\n  Core.Event.on('appUpdateProfile', appUpdateProfile);\n  //tab 切换\n  Core.Event.on('switchTab', switchTab);\n  //触发暂时性动画\n  Core.Event.on('trigerAnimate', trigerAnimate);\n  //text 收展\n  Core.Event.on('toggleTextSectionExpand', toggleTextSectionExpand);\n  //统计\n  Core.Event.on('analytics', analytics);\n\n  //滚动到顶部\n  Core.Event.on('scrollTop', scrollTop);\n  //back\n  Core.Event.on('back', function (action) {\n    Core.Router.back(action || -1);\n  });\n  function analytics(params, title) {\n    setTimeout(function () {\n      var url = Actions.analytics + '?devevent=1' + (params ? ('&' + params) : '');\n      //android和iOS\n      if ($.os.ios && !$.os.android) {\n        url += '&ios';\n      } else if ($.os.android) {\n        url += '&android';\n      }\n      if (ThirdVendor) {\n        url += '&plf=' + ThirdVendor.code;\n      }\n      if (CTRL.models.Basic.isLogined()) {\n        url += '&logined';\n      }\n      url += '&t=' + (new Date().getTime());\n\n      Core.Navigator.protocol(url, true);\n    }, 0);\n  }\n\n  function scrollTop() {\n    var top = Math.min(Math.min(window.pageYOffset, document.documentElement.scrollTop || document.body.scrollTop), window.scrollY),\n      start = top,\n      to = 0,\n      timer = 0,\n      change = to - start,\n      currentTime = 0,\n      increment = 20,\n      duration = 500;\n    (function animloop() {\n      // increment the time\n      currentTime += increment;\n      if (start < 2 || CTRL.views.Basic.GlobalTouch.touched || currentTime > duration) {\n        if (start < 2) {\n          window.scrollTo(0, 1);\n        }\n        cancelRequestAnimFrame(timer);\n        return;\n      }\n      window.scrollTo(0, Math.easeInOutQuad(currentTime, start, change, duration));\n      timer = requestAnimFrame(animloop);\n    })();\n  }\n\n  function onViewChanged() {\n    appModifyTitle();\n    CTRL.views.Basic.msgbox.hideLoading();\n  }\n\n  function onUserinfo() {\n    if (isApp) {\n      Core.NativeBridge.userInfo(null, function (rs) {\n        CTRL.models.Basic.setAppUserMeta(rs);\n        if (rs && !!rs.userid) {\n          if (CTRL.models.Basic.verifyLoginCookie() && CTRL.models.Basic.verifyLoginCookieTimeout(30)) {\n            Core.Router.run();\n          } else {\n            rs.sig ? appLogin() : appAnonymousLogin();\n          }\n        } else {\n          Core.Router.run();\n        }\n      });\n      //Core.NativeBridge.device(function(rs){\n      //    if(rs){\n      //        CTRL.models.Basic.setNativeBridgeDeviceMeta(rs);\n      //    }\n      //});\n    } else {\n      Core.Router.run();\n    }\n  }\n\n  function onLogin(arg, msg, callback) {\n    if (isApp) {\n      appLogin(callback);\n    } else {\n      CTRL.views.Basic.msgbox.showSignin({\n        msg: msg,\n        yesCallback: function (plf) {\n          webLogin(Actions.main + (arg || ''), null, plf);\n        }\n      });\n      //CTRL.views.Basic.msgbox.showDownload({\n      //  yesCallback: function () {\n      //    redirectToDownload(Actions.main + (arg || ''));\n      //  }\n      //});\n    }\n  }\n\n  function onFeedback(email) {\n    Core.Navigator.protocol('mailto:' + (email || 'mozat@mozat.com?subject=Suggestion'), true);\n  }\n\n  function switchTab(el, tabs, tabContents) {\n    if (!tabs || !tabContents) {\n      return;\n    }\n    var isClicked = !!el;\n    el = el || tabs[0];\n    for (var i = 0; i < tabs.length; i++) {\n      if (tabs[i] == el) {\n        tabs[i].classList.add('on');\n        trigerAnimate(tabContents.eq(i));\n        tabContents[i] && tabContents[i].classList.add('show');\n        isClicked && Core.Event.trigger('analyticsCurView', 'tab=' + i);\n      } else {\n        tabs[i].classList.remove('on');\n        tabContents[i] && tabContents[i].classList.remove('show');\n      }\n    }\n    Core.Event.trigger('analyticsCurView');\n  }\n\n  function trigerAnimate(el, classname, timeout) {\n    if (!el) {\n      return;\n    }\n    classname = classname || 'animated';\n    timeout = timeout || 1200;\n    el.animTimer && clearTimeout(el.animTimer);\n    el.addClass(classname);\n    el.animTimer = setTimeout(function () {\n      el.removeClass(classname);\n    }, timeout);\n  }\n\n  function toggleTextSectionExpand(el) {\n    el && el.classList.toggle('expand');\n  }\n\n  function webLogin(surl, furl, pf) {\n    var murl = window.location.href;\n    surl = surl || murl;\n    furl = furl || murl;\n    pf = pf || 'fb';\n\n    redirectToPage(Actions.login\n      .replace('{SURL}', encodeURIComponent(surl))\n      .replace('{FURL}', encodeURIComponent(furl))\n      .replace('{PF}', pf));\n  }\n\n  function appLogin(callback, subProtocol) {\n    Core.NativeBridge.login(null, function (rs) {\n      if (rs) {\n        CTRL.models.Basic.saveLoginCookieTimeout();\n        CTRL.models.Basic.setAppUserMeta(rs);\n        if (callback) {\n          callback();\n        } else {\n          Core.Router.run();\n        }\n      }\n    }, subProtocol);\n  }\n\n  function appAnonymousLogin(callback) {\n    appLogin(callback, '?anonymous=1')\n  }\n\n  function appUpdate(msg, force) {\n    redirectToApp(function () {\n      CTRL.views.Basic.msgbox.showDialog({\n        msg: msg || 'Please up to date your App',\n        noText: force ? null : 'Close',\n        yesText: 'Update',\n        yesCallback: function () {\n          downloadDejaInApp();\n        }\n      });\n    });\n  }\n\n  function appShare(callback, plf) {\n    redirectToApp(function () {\n      var fn = Core.NativeBridge['share' + (plf ? ('_' + plf) : '')];\n      fn && fn(null, callback);\n    });\n  }\n\n  function appCopyText(text) {\n    if (isApp) {\n      Core.NativeBridge.copy(text);\n    }\n  }\n\n  function appModifyTitle(title) {\n    title = title || document.title;\n    document.title = title;\n    if (isApp) {\n      Core.NativeBridge.modifytitle(title);\n    }\n  }\n\n  function appActionButton(name, callback) {\n    if (isApp) {\n      Core.NativeBridge.updateBarButton(name, !Core.isDebug && callback);\n    }\n  }\n\n  function appActionShareButton() {\n    appActionButton('share');\n  }\n\n  function appActionFilterButton(callback) {\n    appActionButton('filter', callback);\n  }\n\n  function appActionAddButton(callback) {\n    appActionButton('add', callback);\n  }\n\n  function appActionDefaultButton() {\n    appActionButton('', function () {\n    });\n  }\n\n  function appOnUnload(callback) {\n    if (isApp) {\n      Core.NativeBridge.set_before_for_unload(callback);\n    }\n  }\n\n  function appCloseWebView() {\n    if (isApp) {\n      Core.NativeBridge.closeweb();\n    }\n  }\n\n  /**\n   * @param subProtocol String creationLike,creationDelete,productLike,follow\n   */\n  function appUpdateProfile(subProtocol) {\n    appAPI('updateProfile', null, null, subProtocol);\n  }\n\n  /**\n   * dejafashion://name/subProtocol\n   * window.__dejafashion_data_name = data;\n   * window.__dejafashion_after_name = callback;\n   */\n  function appAPI(name, data, callback, subProtocol, redirect) {\n    if (isApp) {\n      Core.NativeBridge.trigger.apply(null, arguments);\n    } else if (redirect) {\n      var proto = [name];\n      subProtocol && proto.push(subProtocol);\n      redirectToDownload(null, true, Actions.dejafashionSchema + proto.join('/'));\n    }\n  }\n\n  function downloadDejaInApp() {\n    var url = Actions.dejaAppAndroid;\n    if ($.os.ios && !$.os.android) {\n      url = Actions.dejaAppIos;\n    }\n    window.location = url;\n  }\n\n  function redirectToDejame() {\n    redirectToPage(Actions.dejame);\n  }\n\n  //打开客户端原生视图\n  function redirectToApp(callback, link) {\n    if (isApp) {\n      callback && callback();\n    } else {\n      CTRL.views.Basic.msgbox.showDownload({\n        yesCallback: function () {\n          redirectToDownload(link || window.location.href);\n        }\n      });\n    }\n  }\n\n  /**\n   * open a web site in app,or just op\n   * @param link\n   * @param autoopen\n   * @param schema\n   */\n  function redirectToDownload(link, autoopen, schema) {\n    link = !!link && link != '0' ? ('#url=dejafashion://web/' + link) : '';\n    link = !!schema ? ('#url=' + schema) : link;\n    redirectToPage(Actions.dejaDwonloadBridge + (autoopen ? '?autoopen=1' : '') + link);\n  }\n\n  function redirectToPage(link) {\n    if (link) {\n      !(/__NativeBridge_target/g.test(link)) && appActionDefaultButton();\n      window.location = link;\n    }\n  }\n\n}//end Controller\nmodule.exports = new Controller;\n"
  },
  {
    "path": "app/templates/app/src/app/controller/HomeController.js",
    "content": "var Actions = require('../resources/Actions');\nvar BasicModel = require('app/model/Model');\nvar BasicView = require('app/view/View');\nvar HomeView = require('app/view/HomeView');\n\nfunction HomeController() {\n  this.models = {\n    Basic: BasicModel\n  }\n  this.views = {\n    Basic: BasicView,\n    Home: HomeView\n  };\n\n  var CTRL = this,\n    viewNames,\n    curViewId = '',\n    viewHomeQuery = {};\n\n  viewNames = {\n    'home': 'Home'\n  }\n  Core.Router\n    .onUnsubscribed(onViewUnnamed,unViewUnnamed)\n    .subscribe('/home/', onViewHome, unViewHome);\n\n  //统计视图\n  Core.Event.on('analyticsCurView', analyticsCurView);\n  //forwardHome\n  Core.Event.on('forwardHome', forwardHome);\n\n  function unViewUnnamed() {\n    unViewHome();\n  }\n\n  function unViewHome() {\n    CTRL.views.Home.hide();\n  }\n\n  function onViewUnnamed(req) {\n    onViewHome(req);\n    Core.Event.trigger('analytics');\n  }\n\n  function onViewHome(req) {\n    curViewId = 'home';\n    viewHomeQuery = req.query;\n    CTRL.views.Home.show();\n\n    //追加统计\n    analyticsCurView();\n  }\n\n  function forwardHome(arg) {\n    Core.Router.forward('/home/' + (arg || ''));\n  }\n\n  function analyticsCurView(params, title) {\n    if (!Core.Router.currentMatch(['/home/', Core.Router.getUnsubscribedAction()])) {\n      return;\n    }\n    params = params ? ('&' + params) : '';\n    title = title || viewNames[curViewId] || document.title;\n\n    Core.Event.trigger('analytics', 'viewid=' + curViewId + params, title);\n  }\n}\n\nmodule.exports = new HomeController;\n"
  },
  {
    "path": "app/templates/app/src/app/controller/UserController.js",
    "content": "var Actions = require('../resources/Actions');\nvar BasicModel = require('app/model/Model');\nvar UserModel = require('app/model/UserModel');\nvar BasicView = require('app/view/View');\nvar UserView = require('app/view/UserView');\n\nfunction UserController() {\n  this.models = {\n    Basic: BasicModel,\n    User: UserModel\n  }\n  this.views = {\n    Basic: BasicView,\n    User: UserView\n  };\n\n  var CTRL = this,\n    viewNames,\n    curViewId = '',\n    viewUserQuery = {};\n\n  viewNames = {\n    'user': 'User'\n  }\n  Core.Router.subscribe('/user/', onViewUser, unViewUser);\n\n  //统计视图\n  Core.Event.on('analyticsCurView', analyticsCurView);\n  //forwardUser\n  Core.Event.on('forwardUser', forwardUser);\n\n\n  function unViewUser() {\n    CTRL.views.User.hide();\n  }\n\n  function onViewUser(req) {\n    curViewId = 'user';\n    viewUserQuery = req.query;\n    CTRL.views.User.show();\n\n    CTRL.views.Basic.msgbox.hideLoading();\n    CTRL.models.User.user.request({id: viewUserQuery.userid},afterRequestUser);\n\n    //追加统计\n    analyticsCurView();\n  }\n\n  function afterRequestUser(success) {\n    CTRL.views.Basic.msgbox.hideLoading();\n    if (success) {\n      CTRL.models.User.user.timer.update();\n    } else {\n      CTRL.views.Basic.msgbox.showFailed();\n    }\n  }\n\n  function forwardUser(arg) {\n    Core.Router.forward('/user/' + (arg || ''));\n  }\n\n  function analyticsCurView(params, title) {\n    if (!Core.Router.currentMatch(['/user/'])) {\n      return;\n    }\n    params = params ? ('&' + params) : '';\n    title = title || viewNames[curViewId] || document.title;\n\n    Core.Event.trigger('analytics', 'viewid=' + curViewId + params, title);\n  }\n}\n\nmodule.exports = new UserController;\n"
  },
  {
    "path": "app/templates/app/src/app/model/Model.js",
    "content": "var RequestHelper = require('app/model/RequestHelper');\nvar Actions = require('app/resources/Actions');\n\nvar Mdl = Core.Class.Model,\n  lcStorage = Core.localStorage;\n\nfunction Model() {\n  var MODEL = this,\n    userId, udid, appUserMeta,sig,\n    loginCookieTimerPrefix = 'loginCookieTimer_';\n\n  this.getCookie = function (sKey) {\n    return decodeURIComponent(document.cookie.replace(new RegExp(\"(?:(?:^|.*;)\\\\s*\" + encodeURIComponent(sKey).replace(/[\\-\\.\\+\\*]/g, \"\\\\$&\") + \"\\\\s*\\\\=\\\\s*([^;]*).*$)|^.*$\"), \"$1\")) || null;\n  }\n  this.setCookie = function (name, value, days) {\n    if (days) {\n      var date = new Date();\n      date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));\n      var expires = \"; expires=\" + date.toGMTString();\n    }\n    else var expires = \"\";\n    document.cookie = name + \"=\" + value + expires + \"; path=/\";\n  }\n  //校验登录 cookies\n  this.verifyLoginCookie = function () {\n    var uid = this.getCookie('uid');\n    this.setUserId(uid);\n\n    return uid;\n  }\n  this.saveLoginCookieTimeout = function () {\n    var key = loginCookieTimerPrefix + this.getUserId();\n    lcStorage.set(key, new Date().getTime());\n  }\n  //校验 cookies 有效期，这里用 1 天\n  this.verifyLoginCookieTimeout = function (minutes) {\n    var key = loginCookieTimerPrefix + this.getUserId(),\n      last = lcStorage.get(key) || 0;\n    minutes = minutes || 1 * 60 * 24 * 1;\n    return ( (new Date().getTime()) - last ) < minutes * 60 * 1000;\n  }\n  this.setUdId = function (id) {\n    udid = id;\n  }\n  this.getUdId = function () {\n    return udid;\n  }\n  this.setUserId = function (id) {\n    userId = id || userId;\n  }\n  this.getUserId = function () {\n    return userId || (appUserMeta && appUserMeta.userid) || this.getCookie('uid');\n  }\n  this.getAppUserMeta = function () {\n    return appUserMeta;\n  }\n  this.setAppUserMeta = function (data) {\n    appUserMeta = data;\n  }\n  this.getUserSig = function () {\n    return sig || (appUserMeta && appUserMeta.sig) || this.getCookie('sig');\n  }\n  this.setUserSig = function (val) {\n    sig = val;\n  }\n  this.isLogined = function () {\n    return !!this.getUserId() && !!this.getUserSig();\n  }\n\n  //数据缓存更新\n  this.modelUpdate = new Mdl();\n\n}\nmodule.exports = new Model;\n"
  },
  {
    "path": "app/templates/app/src/app/model/RequestHelper.js",
    "content": "var getJSON = Core.RequestHandler.getJSON,\n  postJSON = Core.RequestHandler.postJSON,\n  JSONP = Core.RequestHandler.JSONP;\n\nfunction request(action, data, callback, scope, options) {\n  options = options || {};\n  var __STORE_ID, conf;\n  data = data || {};\n  data._t = new Date().getTime();\n  __STORE_ID = data.__STORE_ID;\n  delete data.__STORE_ID;\n  conf = {\n    action: action,\n    data: data,\n    complete: function (data) {\n      if (data.success) {\n        scope && scope.set && scope.set(data.data, __STORE_ID);\n      }\n      callback && callback(data.success);\n    }\n  };\n  for (var name in options) conf[name] = options[name];\n  conf.action = action;\n  conf.data = data;\n  getJSON(conf);\n}\n\nfunction post(action, data, callback, scope, options) {\n  options = options || {};\n  var conf = {\n    action: action,\n    data: data,\n    contentType: options.contentType || \"application/json;charset=utf-8\",\n    complete: function (data) {\n      if (data.success) {\n        scope && scope.set && scope.set(data.data);\n      }\n      callback && callback(data.success);\n    }\n  };\n  for (var name in options) conf[name] = options[name];\n  conf.action = action;\n  conf.data = data;\n  postJSON(conf);\n}\n\nmodule.exports = {\n  getJSON: getJSON,\n  postJSON: postJSON,\n  JSONP: JSONP,\n  request: request,\n  post: post\n};\n"
  },
  {
    "path": "app/templates/app/src/app/model/StoreHelper.js",
    "content": "var RequestHelper = require('app/model/RequestHelper');\n\nfunction pagingStore(action, options) {\n  var option = {\n    isFromStore: false,\n    page: 0,\n    page_size: 20,\n    setWithStoreData: function (data) {\n      this.resetPage(data.__page);\n      this.set(data, data.__STORE_ID);\n    },\n    resetPage: function (storePage) {\n      if (storePage == undefined || storePage == null) {\n        this.isFromStore = false;\n        this.page = 0;\n      }\n      //reset page by history\n      else {\n        this.isFromStore = true;\n        this.page = storePage + 1;\n      }\n    },\n    request: function (data, callback) {\n      this.isFromStore = false;\n      data = data || {};\n      var _this = this;\n      var __STORE_ID;\n      __STORE_ID = data.__STORE_ID;\n      delete data.__STORE_ID;\n      data.page = this.page;\n      data.page_size = this.page_size;\n      RequestHelper.getJSON({\n        data: data,\n        action: action,\n        complete: function (data) {\n          if (data.success) {\n            _this.set(function (storeData) {\n              //set __STORE_ID's cache data\n              if (storeData) {\n                storeData.__page = _this.page;\n                storeData.end = data.data.end;\n                storeData.data = storeData.data.concat(data.data.data);\n              }\n              //set model's data\n              else {\n                storeData = data.data;\n                storeData.__page = _this.page;\n              }\n              return storeData;\n            }, __STORE_ID);\n            _this.page++;\n          }\n          callback && callback(data.success);\n        }\n      });\n    }\n  };\n  Core.Class.apply(option, options);\n  return new Core.Class.Model(option);\n}\n\nfunction requestStore(action, options) {\n  var option = {\n    request: function (data,callback) {\n      RequestHelper.request(action,data,callback,this);\n    }\n  };\n\n  Core.Class.apply(option, options);\n  return new Core.Class.Model(option);\n}\n\nfunction postStore(action, options) {\n  var option = {\n    post: function (data,callback) {\n      RequestHelper.post(action,data,callback,this);\n    }\n  };\n\n  Core.Class.apply(option, options);\n  return new Core.Class.Model(option);\n}\n\nfunction JSONPStore(action, options) {\n  var option = {\n    request: function(data, callback){\n      data = data || {};\n      var _this = this,\n        __STORE_ID = data.__STORE_ID,\n        callbackName;\n      callbackName = '__JSCB_'+Core.GUID(8);\n      data.callback = callbackName;\n      delete data.__STORE_ID;\n      window[callbackName] = function(data){\n        _this.set(data, __STORE_ID);\n        callback && callback(data);\n      }\n      RequestHelper.JSONP({\n        url: action,\n        data: data\n      });\n    }\n  };\n\n  Core.Class.apply(option, options);\n  return new Core.Class.Model(option);\n}\n\n\nfunction pagingJSONPStore(action, options) {\n  var option = {\n    isFromStore: false,\n    page: 0,\n    page_size: 20,\n    setWithStoreData: function (data) {\n      this.resetPage(data.__page);\n      this.set(data, data.__STORE_ID);\n    },\n    resetPage: function (storePage) {\n      if (storePage == undefined || storePage == null) {\n        this.isFromStore = false;\n        this.page = 0;\n      }\n      //reset page by history\n      else {\n        this.isFromStore = true;\n        this.page = storePage + 1;\n      }\n    },\n    request: function (data, callback) {\n      this.isFromStore = false;\n      data = data || {};\n      var _this = this,\n        __STORE_ID = data.__STORE_ID,\n        callbackName;\n      callbackName = '__JSCB_'+Core.GUID(8);\n      data.callback = callbackName;\n      delete data.__STORE_ID;\n      window[callbackName] = function(data){\n        _this.set(function (storeData) {\n          //set __STORE_ID's cache data\n          if (storeData) {\n            storeData.__page = _this.page;\n            storeData.data = storeData.data.concat(data.data.data);\n          }\n          //set model's data\n          else {\n            storeData = data;\n            storeData.__page = _this.page;\n          }\n          return storeData;\n        }, __STORE_ID);\n        _this.page++;\n\n        callback && callback(data);\n      }\n      data.page = this.page;\n      data.page_size = this.page_size;\n      RequestHelper.JSONP({\n        url: action,\n        data: data\n      });\n    }\n  };\n\n  Core.Class.apply(option, options);\n  return new Core.Class.Model(option);\n}\n\nmodule.exports = {\n  pagingStore: pagingStore,\n  requestStore: requestStore,\n  postStore: postStore,\n  JSONPStore: JSONPStore,\n  pagingJSONPStore: pagingJSONPStore\n};\n"
  },
  {
    "path": "app/templates/app/src/app/model/UserModel.js",
    "content": "var StoreHelper = require('app/model/StoreHelper');\nvar Actions = require('app/resources/Actions');\nvar Basic = require('app/model/Model');\n\nvar Mdl = Core.Class.Model,\n  lcStorage = Core.localStorage;\n\nfunction User() {\n\n}\n\nUser.prototype.user = StoreHelper.requestStore(Actions.user);\n\nUser.prototype.userInfo = StoreHelper.JSONPStore(Actions.user);\n\nmodule.exports = new User();\n"
  },
  {
    "path": "app/templates/app/src/app/resources/Actions.js",
    "content": "var thisPage = window.location.href\n  //注意，保留search 是为了避免微信自动追加的应用检测状态值\n  //.replace(window.location.search,'')\n  .replace(window.location.hash, '');\nvar thisPath = thisPage.substring(0, thisPage.lastIndexOf('/') + 1);\n\n///*official\nvar Actions = {\n  user: Core.localHost + '/user/list.php',\n\n  login: Core.localHost + '/account/login_third?success={SURL}&fail={FURL}&pf={PF}',\n  main: thisPath + 'index.html',\n  analytics: thisPath + 'analytics.html',\n  dejame: 'http://deja.me/u/XPKab9',\n  dejaAppAndroid: 'http://deja.me/u/XPKab9',\n  dejaAppIos: 'http://deja.me/u/fzb1KO',\n  dejaDwonloadBridge: 'http://m.deja.me/bridge/',\n  dejaShareLogo: thisPath + 'resources/images/deja_icon_ios_228.png'\n}\n//*/\n\n///_DEBUG_*Todo: debug actions\nvar Actions = {\n  user: 'data/user.json',\n\n  login: Core.localHost + '/account/login_third?success={SURL}&fail={FURL}&pf={PF}',\n  main: thisPath + 'index.html',\n  analytics: thisPath + 'analytics.html',\n  dejame: 'http://deja.me/u/XPKab9',\n  dejaAppAndroid: 'http://deja.me/u/XPKab9',\n  dejaAppIos: 'http://deja.me/u/fzb1KO',\n  dejaDwonloadBridge: 'http://m.deja.me/bridge/',\n  dejaShareLogo: thisPath + 'resources/images/deja_icon_ios_228.png'\n}\n//*/\nmodule.exports = Actions;\n"
  },
  {
    "path": "app/templates/app/src/app/resources/Audios.js",
    "content": "var Audios = {}\nmodule.exports = Audios;\n"
  },
  {
    "path": "app/templates/app/src/app/resources/i18n/en_US/Msgbox.js",
    "content": "module.exports = {\n  ok: 'OK',\n  no: 'Cancel',\n  sure: 'Sure',\n  loading: 'Loading...',\n  submitting: 'Submitting...'\n}\n"
  },
  {
    "path": "app/templates/app/src/app/resources/i18n/en_US/index.js",
    "content": "var Msgbox = require('./Msgbox');\n\nvar en_US = {\n  Msgbox: Msgbox\n}\nmodule.exports = en_US;\n"
  },
  {
    "path": "app/templates/app/src/app/resources/i18n/index.js",
    "content": "var en_US = require('./en_US');\nvar zh_CN = require('./zh_CN');\n\nvar langs = {\n  zh_CN: zh_CN\n}\n\n//https://github.com/jquery-i18n-properties/jquery-i18n-properties/blob/master/jquery.i18n.properties.js\nfunction getLangName(lang) {\n  if (!lang || lang.length < 2) {\n    lang = (navigator.languages) ? navigator.languages[0]\n      : (navigator.language || navigator.userLanguage /* IE */ || 'en');\n  }\n\n  lang = lang.toLowerCase();\n  lang = lang.replace(/-/,\"_\"); // some browsers report language as en-US instead of en_US\n  if (lang.length > 3) {\n    lang = lang.substring(0, 3) + lang.substring(3).toUpperCase();\n  }\n  return lang;\n}\n\nfunction i18n() {\n  this.getLangName = getLangName;\n}\ni18n.prototype = en_US;\n\nfunction createI18n(lang) {\n  var lang = langs[lang];\n\n  if(lang) {\n    Core.extend(i18n, lang);\n  }else{\n    lang = i18n;\n  }\n  return new lang;\n}\nvar oI18n = createI18n(getLangName());\nwindow.i18n = oI18n;\n\nmodule.exports = oI18n;\n"
  },
  {
    "path": "app/templates/app/src/app/resources/i18n/zh_CN/Msgbox.js",
    "content": "module.exports = {\n  ok: '好的',\n  no: '取消',\n  sure: '确定',\n  loading: '正在加载...',\n  submitting: '正在提交...'\n}\n"
  },
  {
    "path": "app/templates/app/src/app/resources/i18n/zh_CN/index.js",
    "content": "var Msgbox = require('./Msgbox');\n\nfunction zh_CN() {\n  //extend from super\n  zh_CN.superclass.constructor.call(this);\n\n  this.Msgbox = Msgbox;\n}\nmodule.exports = zh_CN;\n"
  },
  {
    "path": "app/templates/app/src/app/view/HomeView.js",
    "content": "var BasicView = require('app/view/View');\nvar BasicModel = require('app/model/Model');\n\n\nfunction HomeView() {\n  this.models = {\n    Basic: BasicModel\n  }\n  this.viewCls = 'view-home';\n  this._BasicView = BasicView;\n\n  var VIEW = this,\n    isApp = Core.NativeBridge.isApp(),\n    Tpl, els,\n    tap = VIEW._BasicView.tapEvent;\n\n  //model listeners\n\n  function initEls() {\n    if(els){return;}\n    els = VIEW._BasicView.getElements(VIEW.viewCls);\n    bindEvent();\n  }//end initEls\n  function initTpls(){\n    if(Tpl){return;}\n    Tpl = Tpl || VIEW._BasicView.getTemplates(VIEW.viewCls);\n  }\n  function initResources() {\n    initEls();\n    initTpls();\n  }\n  this.getEls = function () {\n    initEls();\n    return els;\n  }\n  this.getTpls = function(){\n    initTpls();\n    return Tpl;\n  }\n  function bindEvent() {\n\n  }//end bindEvent\n\n  this.show = function () {\n    initResources();\n\n    if (!els.main.hasClass('show')) {\n      Core.Event.trigger('trigerAnimate', els.main);\n      VIEW._BasicView.show(VIEW.viewCls);\n    }\n  }\n  this.hide = function () {\n    if (!els) {\n      return;\n    }\n  }\n  function render(data) {\n    initResources();\n  }//end render\n\n\n}//end View\nmodule.exports = new HomeView();\n"
  },
  {
    "path": "app/templates/app/src/app/view/UserView.js",
    "content": "var BasicView = require('app/view/View');\nvar BasicModel = require('app/model/Model');\nvar UserModel = require('app/model/UserModel');\n\nfunction UserView() {\n  this.models = {\n    Basic: BasicModel,\n    User: UserModel\n  }\n  this.viewCls = 'view-user';\n  this._BasicView = BasicView;\n\n  var VIEW = this,\n    isApp = Core.NativeBridge.isApp(),\n    Tpl, els,\n    tap = VIEW._BasicView.tapEvent;\n\n  //model listeners\n  VIEW.models.User.user.updated(render);\n\n  function initEls() {\n    if(els){return;}\n    els = VIEW._BasicView.getElements(VIEW.viewCls,function(){\n      return {\n        back: this.main.find('.back')\n      }\n    });\n    bindEvent();\n  }//end initEls\n  function initTpls(){\n    if(Tpl){return;}\n    Tpl = Tpl || VIEW._BasicView.getTemplates(VIEW.viewCls);\n  }\n  function initResources() {\n    initEls();\n    initTpls();\n  }\n  this.getEls = function () {\n    initEls();\n    return els;\n  }\n  this.getTpls = function(){\n    initTpls();\n    return Tpl;\n  }\n  function bindEvent() {\n    els.back.on(tap, Core.Router.back);\n  }//end bindEvent\n\n  this.show = function () {\n    initResources();\n\n    Core.Event.trigger('trigerAnimate',els.main);\n    VIEW._BasicView.show(VIEW.viewCls);\n  }\n  this.hide = function () {\n    if (!els) {\n      return;\n    }\n  }\n  function render(data) {\n    initResources();\n\n    data = data || VIEW.models.User.user.get();\n\n    if (!data || !data.length) {\n      return;\n    }\n\n    var list = [];\n    data.forEach(function (key, index) {\n      list.push(Tpl.listItem(key));\n    });\n    els.list.html(list.join(''));\n    list = null;\n  }//end render\n\n\n}//end View\nmodule.exports = new UserView();\n"
  },
  {
    "path": "app/templates/app/src/app/view/View.js",
    "content": "var Actions = require('app/resources/Actions');\nvar Msgbox = require('widget/Msgbox');\nvar WechatShare = require('util/WechatShare');\nvar YiXinShare = require('util/YiXinShare');\n\nvar BasicModel = require('app/model/Model');\n\nfunction View() {\n  this.models = {\n    Basic: BasicModel\n  }\n\n  var VIEW = this,\n    els, shareStore = {},\n    params = Core.localParam(),\n    isApp = Core.NativeBridge.isApp();\n  //click事件\n  this.tapEvent = $.os.ios || $.os.android ? 'tap' : 'click';\n\n  function init() {\n    Core.MetaHandler.fixViewportWidth();\n    initEls();\n    bindEvent();\n    VIEW.hide();\n    els.body.css({'visibility': 'visible'});\n  };//end init\n\n  function initEls() {\n    var body = $('body');\n    els = {\n      window: $(window),\n      body: body,\n      views: body.children('.view')\n    }\n    VIEW.GlobalTouch = {\n      preventMove: false,\n      touched: false\n    }\n    window.GlobalTouch = VIEW.GlobalTouch;\n    VIEW.msgbox = new Msgbox({\n      // themeCls: 'deja',\n      GlobalTouch: VIEW.GlobalTouch\n    });\n  }\n\n  this.getEls = function () {\n    return els;\n  }\n  this.getView = function (viewCls) {\n    return els.views.filter('.' + viewCls);\n  }\n  //parse elements have \"data-template\" into templates\n  this.getTemplates = function (viewCls) {\n    var el = this.getView(viewCls);\n    if (el.$Templates) {\n      return el.$Templates;\n    }\n    var Templates = {};\n    el.find('*[data-template]').each(function () {\n      var key = $(this),\n        name = key.attr('data-template');\n      if (name) {\n        Templates[name] = Core.microTmpl(key.text());\n      }\n    });\n    el.$Templates = Templates;\n    return Templates;\n  }\n  /**\n   * find all elements have \"data-element\"\n   * @param viewCls\n   * @param extra object\n   * e.g.:\n   * //1.  pass an object\n   * {\n   *   defaultUserid: 'user_id_xxxx'\n   * }\n   *\n   * //2. pass a function that return an obeject,\"this\" is the elements' own object\n   * function(){\n   *  return {\n   *    userList: this.main.find('.list')\n   *  }\n   * }\n   *\n   * @returns {*}\n   */\n  this.getElements = function (viewCls,extra) {\n    var el = this.getView(viewCls);\n    if (el.$Elements) {\n      return el.$Elements;\n    }\n    var Elements = {\n      window: els.window,\n      body: els.body,\n      main: el,\n      apply: function(conf){\n        Core.Class.apply(Elements,conf);\n      }\n    };\n    el.find('*[data-element]').each(function () {\n      var name = $(this).attr('data-element');\n      if (name) {\n        Elements[name] = Elements[name] || el.find('*[data-element=\"'+name+'\"]');\n      }\n    });\n    Elements.apply(extra);\n    el.$Elements = Elements;\n    return Elements;\n  }\n\n  this.resizeCalculateWindow = function () {\n    els.window = $(window);\n    els.body = $('body');\n    setTimeout(function () {\n      els.bodyHeight = els.body.height();\n      els.windowMaxScroll = els.bodyHeight - els.window.height() * 2;\n    }, 300);\n  }\n\n  this.isMaxWindowScroll = function (budget) {\n    var top = Math.min(Math.min(window.pageYOffset, document.documentElement.scrollTop || document.body.scrollTop), window.scrollY),\n      maxScroll = budget ? (els.bodyHeight - budget) : els.windowMaxScroll;\n    return top > maxScroll;\n  }\n\n  function bindEvent() {\n    document.addEventListener('touchmove', function (e) {\n      VIEW.GlobalTouch.preventMove && e.preventDefault();\n    }, false);\n    document.addEventListener('touchstart', function (e) {\n      VIEW.GlobalTouch.touched = true;\n    }, false);\n    document.addEventListener('touchend', function (e) {\n      VIEW.GlobalTouch.touched = false;\n    }, false);\n    //data-prevent-move=\"start\" prevent document to move ontouchstart and cancel ontouchend,\n    //data-prevent-move=\"all\" will always prevent the whole document to move\n    els.body.on('touchstart', '* [data-prevent-move]', function () {\n      VIEW._BasicView.GlobalTouch.preventMove = true;\n    });\n    els.body.on('touchend', '* [data-prevent-move=\"start\"]', function () {\n      VIEW._BasicView.GlobalTouch.preventMove = false;\n    });\n    if (VIEW.tapEvent == 'tap') {\n      els.body.on('click', 'a', function (e) {\n        e.preventDefault();\n        return false;\n      });\n      els.body.on('tap', 'a', function () {\n        Core.Event.trigger('redirect', this.href);\n      });\n    }\n    //fix chrome for android active effect remain issue\n    $.os.android && /Chrome/i.test(window.navigator.userAgent) && els.body.on('touchstart', '* [data-fix-active]', function (e) {\n      e.preventDefault();\n    });\n    els.body.on(VIEW.tapEvent, '* [data-fake-link]', function () {\n      Core.Event.trigger('redirect', this.getAttribute('data-fake-link'));\n    });\n    els.body.on(VIEW.tapEvent == 'tap' ? 'touchstart' : VIEW.tapEvent, '* [data-analytics]', function () {\n      Core.Event.trigger(this.getAttribute('data-analytics-global') ? 'analytics' : 'analyticsCurView', this.getAttribute('data-analytics'));\n    });\n    els.body.on(VIEW.tapEvent, '* [data-eventname]', function () {\n      var ename = this.getAttribute('data-eventname'),\n        eparam = this.getAttribute('data-eventparam') || '',\n        eparams = this.getAttribute('data-eventparams') || '';\n\n      if (ename) {\n        var params = [];\n        params.push(ename);\n        if (eparams) {\n          Array.prototype.push.apply(params, eparams.split(','));\n        } else if (eparam) {\n          params.push(eparam);\n        }\n        Core.Event.trigger.apply(null, params);\n      }\n    });\n  }\n\n  this.show = function (viewCls, autoRevert) {\n    this.hide(viewCls);\n\n    var view = this.getView(viewCls);\n    !view.hasClass('show') && view.addClass('show');\n    //auto scroll to history position,and restore title\n    if (autoRevert === undefined || autoRevert) {\n      Core.Event.trigger('appModifyTitle', Core.Router.getHistoryTitle());\n      setTimeout(Core.Router.scrollToHistoryPosition, 100);\n      restoreShare();\n    }\n    return this;\n  }\n  this.hide = function (notCls) {\n    (notCls ? els.views.not('.' + notCls) : els.views).removeClass('show');\n    return this;\n  }\n\n  /**\n   *\n   * option = {\n             title String 'share title',\n             text String 'share text',\n             summary String 'share summary',\n             imageurl String 'share image url',\n             thumburl String 'share image thumb url',\n             link String 'share link'\n             }\n   */\n  this.renderShare = function (option) {\n    option = option || {};\n    option.link = option.link || window.location.href;\n    option.title = option.title || document.title;\n    option.summary = option.summary || option.title;\n    option.text = option.text || option.summary;\n    option.thumburl = option.thumburl || Actions.dejaShareLogo;\n    option.imageurl = option.imageurl || option.thumburl;\n\n\n    Core.NativeBridge.set_data_for_share(option);\n    shareStore[Core.Router.getCurrentHashStr()] = option;\n\n    updateWechatShareMeta(option.title, option.summary, option.thumburl || option.imageurl);\n    updateYiXinShareMeta(option.summary, option.thumburl || option.imageurl);\n    return this;\n  }\n\n  function updateWechatShareMeta(title, content, link, img) {\n    WechatShare({\n      \"appid\": \"\",\n      \"img_url\": img || Actions.dejaShareLogo,\n      \"img_width\": \"200\",\n      \"img_height\": \"200\",\n      \"link\": link || window.location.href,\n      \"url\": link || window.location.href,\n      \"desc\": content || document.title,\n      \"content\": content || document.title,\n      \"title\": title || document.title\n    });\n  }\n\n  function updateYiXinShareMeta(content, img) {\n    YiXinShare({\n      content: content || document.title,\n      img: img || Actions.dejaShareLogo\n    });\n  }\n\n  function restoreShare() {\n    if(shareStore[Core.Router.getCurrentHashStr()]){\n      VIEW.renderShare(shareStore[Core.Router.getCurrentHashStr()]);\n    }\n  }\n\n  this.lazyLoadImg = function (el) {\n    el && setTimeout(function () {\n      el.find(\"img\").unveil(200, function () {\n        this.onload = function () {\n          if (/lazy/.test(this.className)) {\n            this.classList.add('lazy--loaded');\n            //this.style.opacity = 1;\n          }\n        }\n      });\n    }, 0);\n  }\n\n  this.renderI18n = function(el){\n    el.find('*[data-i18n]').each(function () {\n      var currEl = $(this),\n        name = currEl.attr('data-i18n');\n\n      if (name) {\n        var attrs = name.split('.'),\n          text = window[attrs.shift()];\n        attrs.forEach(function (key) {\n          if(key.length && text!==undefined){\n            text = text[key];\n          }\n        });\n        if(text!==undefined){\n          currEl.html(text);\n        }\n      }\n    });\n  }\n\n  init();\n}//end View\nmodule.exports = new View;\n"
  },
  {
    "path": "app/templates/app/src/core/Class.js",
    "content": "var Subject = require('./Subject');\nvar Class;\n\n/**\n * @param obj\n * @param config\n * @param promise\n */\nfunction apply(obj, config, promise) {\n  var conf = typeof config=='function'?config.call(obj):config;\n  if (conf) {\n    var attr;\n    for (attr in conf) {\n      obj[attr] = promise ? promise(conf[attr]) : conf[attr];\n    }\n  }\n}\n\n/**\n *\n * @param obj\n * @param config\n * @param promise\n */\nfunction applyIf(obj, config, promise) {\n  var conf = typeof config=='function'?config.call(obj):config;\n  if (conf) {\n    var attr;\n    for (attr in conf) {\n      if (!obj[attr]) {\n        obj[attr] = promise ? promise(conf[attr]) : conf[attr];\n      }\n    }\n  }\n}\n\n// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys\nif (!Object.keys) {\n  Object.keys = (function () {\n    'use strict';\n    var hasOwnProperty = Object.prototype.hasOwnProperty,\n      hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'),\n      dontEnums = [\n        'toString',\n        'toLocaleString',\n        'valueOf',\n        'hasOwnProperty',\n        'isPrototypeOf',\n        'propertyIsEnumerable',\n        'constructor'\n      ],\n      dontEnumsLength = dontEnums.length;\n\n    return function (obj) {\n      if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) {\n        throw new TypeError('Object.keys called on non-object');\n      }\n\n      var result = [], prop, i;\n\n      for (prop in obj) {\n        if (hasOwnProperty.call(obj, prop)) {\n          result.push(prop);\n        }\n      }\n\n      if (hasDontEnumBug) {\n        for (i = 0; i < dontEnumsLength; i++) {\n          if (hasOwnProperty.call(obj, dontEnums[i])) {\n            result.push(dontEnums[i]);\n          }\n        }\n      }\n      return result;\n    };\n  }());\n}\n//http://stackoverflow.com/a/16788517/479039\nfunction objectEquals(x, y) {\n  if (x === null || x === undefined || y === null || y === undefined) {\n    return x === y;\n  }\n  // after this just checking type of one would be enough\n  if (x.constructor !== y.constructor) {\n    return false;\n  }\n  // if they are functions, they should exactly refer to same one (because of closures)\n  if (x instanceof Function) {\n    return x === y;\n  }\n  // if they are regexps, they should exactly refer to same one (it is hard to better equality check on current ES)\n  if (x instanceof RegExp) {\n    return x === y;\n  }\n  if (x === y || x.valueOf() === y.valueOf()) {\n    return true;\n  }\n  if (Array.isArray(x) && x.length !== y.length) {\n    return false;\n  }\n\n  // if they are dates, they must had equal valueOf\n  if (x instanceof Date) {\n    return false;\n  }\n\n  // if they are strictly equal, they both need to be object at least\n  if (!(x instanceof Object)) {\n    return false;\n  }\n  if (!(y instanceof Object)) {\n    return false;\n  }\n\n  // recursive object equality check\n  var p = Object.keys(x);\n  return Object.keys(y).every(function (i) {\n      return p.indexOf(i) !== -1;\n    }) &&\n    p.every(function (i) {\n      return objectEquals(x[i], y[i]);\n    });\n}\n\n/**\n *\n * @param superClass\n * @param subClass\n */\nvar extend = (function () {\n  var F = function () {\n  };\n  return function (superClass, subClass) {\n    F.prototype = superClass.prototype;\n    subClass.prototype = new F();//空函数避免创建超类的新实例(超类可能较庞大或有大量计算)\n    subClass.prototype.constructor = subClass;\n    subClass.superclass = superClass.prototype;//superclass减少子类与超类之间的偶合\n    //http://stackoverflow.com/questions/12691020/why-javascripts-extend-function-has-to-set-objects-prototypes-constructor-pro\n    if (superClass.prototype.constructor == Object.prototype.constructor) {\n      superClass.prototype.constructor = superClass;\n    }\n    return subClass;\n  }\n})();\n\nfunction updateFactory() {\n  var lastUpdate = 0,\n    _timeout = 1000 * 60 * 5,\n    names = {};\n  /**\n   *\n   * @param timeout 时间倍数，默认是1\n   * @param name\n   * @returns {boolean}\n   */\n  this.isTimeout = function (timeout, name) {\n    timeout = _timeout * (timeout || 1);\n    name = name !== undefined ? names[name] : lastUpdate;\n    return !name || ( (new Date().getTime()) - name > timeout );\n  }\n  this.update = function (name) {\n    var now = new Date().getTime();\n    if (name !== undefined) {\n      if (names[name] === undefined) {\n        this.reset(name);\n      } else {\n        names[name] = now;\n      }\n    } else {\n      lastUpdate = now;\n    }\n  }\n  this.reset = function (name) {\n    if (name !== undefined) {\n      names[name] = 0;\n    } else {\n      lastUpdate = 0;\n    }\n  }\n  this.resetAll = function () {\n    names = {};\n    lastUpdate = 0;\n  }\n}\n/**\n *\n * Model\n *\n *\n * Nested Model:\n * e.g.\n *    var testModel = new Model({\n   *           store: new Model({\n   *               request: function(){\n   *                   console.log('store.request',this);\n   *               }\n   *           }),\n   *           request: function(){\n   *               console.log('request',this);\n   *           }\n   *       });\n *\n *    testModel.updated(function(){\n   *           console.log(testModel.get());\n   *           testModel.request();\n   *       });\n *    testModel.set('1');\n *\n *    testModel.store.updated(function(){\n   *           console.log(testModel.store.get());\n   *           testModel.store.request();\n   *       });\n *    testModel.store.set('2');\n */\nfunction Model(option) {\n  Model.superclass.constructor.call(this);\n  this.updated = this.register;\n  this.refresh = this.notify;\n  this.data;\n  apply(this, option);\n\n  //数据缓存更新\n  this.updateFactory = updateFactory;\n  this.timer = new updateFactory;\n}\nextend(Subject, Model);\nModel.prototype.store = function (storeid, data) {\n  this._cacheStore = this._cacheStore || {};\n  if (data && storeid) {\n    if (toString.call(data) == '[object Array]') {\n      this._cacheStore[storeid] = {\n        __STORE_ID: storeid,\n        data: data\n      };\n    } else {\n      this._cacheStore[storeid] = /function/i.test(typeof data)\n        ? data.call(this, this._cacheStore[storeid])\n        : data;\n      if (typeof this._cacheStore[storeid] == 'object') {\n        this._cacheStore[storeid].__STORE_ID = storeid;\n      }\n    }\n  }\n}\n/**\n *\n * @param data\n * @param storeid ,will cache in store,use getFromStoreById(storeid) to get access it\n * @param diff ,if true,and nothing changed between the new data in the old data,data observers will not got notify\n */\nModel.prototype.set = function (data, storeid, diff) {\n  var _data = /function/i.test(typeof data) ? data.call(this) : data;\n  diff = diff && objectEquals(this.data, _data);\n  this.data = _data;\n  if (storeid) {\n    this.store(storeid, data);\n  }\n  !diff && this.refresh();\n  this.timer.update();\n}\n/**\n *\n * @param clone will return a copy of the data\n * @returns {*}\n */\nModel.prototype.get = function (clone) {\n  return (clone && typeof this.data == 'object') ? JSON.parse(JSON.stringify(this.data)) : this.data;\n}\n/**\n *\n * @param clone will return a copy of the data\n * @returns {*}\n */\nModel.prototype.getStore = function (clone) {\n  return (clone && typeof this._cacheStore == 'object') ? JSON.parse(JSON.stringify(this._cacheStore)) : this._cacheStore;\n}\n/**\n *\n * @param storeid\n * @param clone ,will return a copy of the data\n * @returns {*|{}}\n */\nModel.prototype.getFromStoreById = function (storeid, clone) {\n  return storeid\n    && this._cacheStore\n    && ( (clone && typeof this._cacheStore[storeid] == 'object')\n      ? JSON.parse(JSON.stringify(this._cacheStore[storeid]))\n      : this._cacheStore[storeid]);\n}\n/**\n *\n * @param storeid\n * @returns {*|{}}\n */\nModel.prototype.deleteFromStoreById = function (storeid) {\n  storeid\n  && this._cacheStore\n  && delete this._cacheStore[storeid];\n}\n//end Model\n\nClass = {\n  objectEquals: objectEquals,\n  apply: apply,\n  applyIf: applyIf,\n  extend: extend,\n  Model: Model\n}\n//end Class\n\nmodule.exports = Class;\n"
  },
  {
    "path": "app/templates/app/src/core/Event.js",
    "content": "var Class = require('./Class');\nvar Pubsub = require('./Pubsub');\nvar Subject = require('./Subject');\n\n\nfunction Event(Subject) {\n  Event.superclass.constructor.call(this, Subject);\n  this.on = this.subscribe;\n  this.off = this.unsubscribe;\n  this.trigger = this.publish;\n}\n\nClass.extend(Pubsub, Event);\nmodule.exports = new Event(Subject);\n"
  },
  {
    "path": "app/templates/app/src/core/HashHandler.js",
    "content": "var HashHandler = (function () {\n  var lc = window.location;\n\n  function getByURL(url) {\n    var hash;\n    url && decodeURIComponent(url).replace(new RegExp('#(.*)', 'g'), function ($1, $2) {\n      hash = $2;\n    });\n    return hash;\n  }\n\n  function get() {\n    return getByURL(lc.hash);\n  }\n\n  function set(hash) {\n    lc.hash = hash;\n  }\n\n  return {\n    get: get,\n    set: set,\n    getByURL: getByURL\n  }\n})();\nmodule.exports = HashHandler;\n"
  },
  {
    "path": "app/templates/app/src/core/MicroTmpl.js",
    "content": "/**\n * 模板解析\n * 1. 可接收 DOM Element,不支持 DOM Element 模板里嵌套模板\n * 2. 如果 DOM Element 中的元素的属性可加前缀micro-(或ntes-)，如img的src改为micro-src；及内样式style改为micro-style。以避免模板没有使用前生效。最终模板将会替换掉micro-(或ntes-)前缀。\n *\n * e.g.\n * <section>\n *     <script type=\"text/html\">\n *     <h1><%=TITLE%></h1>\n *     <% for(var i=0;i<list.length;i++){ %>\n     *         <article><%=list[i]%></article>\n     *     <%}%>\n *     </script>\n * </section>\n *\n * 如果 mustache 参数为true,默认为false,可使用{{}},不支持JS表达式\n * e.g\n * <section>\n *     <script type=\"text/html\">\n *     <h1>{{TITLE}}</h1>\n *     </script>\n * </section>\n */\nvar microTmpl = function (mustache) {\n  var intro = mustache ? '{{' : '<%',\n    outro = mustache ? '}}' : '%>',\n    tmplAttrs = ['micro-template', 'ntes-template'],\n    childTmplAttrs = ['micro-template-child', 'ntes-template-child'];\n  //http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object?answertab=votes#tab-top\n  function isElement(o) {\n    return (\n      typeof HTMLElement === \"object\" ? o instanceof HTMLElement : //DOM2\n      o && typeof o === \"object\" && o !== null && o.nodeType === 1 && typeof o.nodeName === \"string\"\n    );\n  }\n\n  function hasChildTmplAttr(el) {\n    var i = 0;\n    for (; i < childTmplAttrs.length; i++) {\n      if (el.hasAttribute(childTmplAttrs[i])) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  function removeChildTmplAttrs(el) {\n    var i = 0;\n    for (; i < childTmplAttrs.length; i++) {\n      el.removeAttribute(childTmplAttrs[i]);\n    }\n  }\n\n  function getTmpl(str) {\n    //如果是DOM节点则取outerHTML或者innerHTML\n    if (isElement(str)) {\n      if (hasChildTmplAttr(str) || str.tagName.toLowerCase() == 'script') {\n        var text = str.innerHTML;\n        str.innerHTML = '';\n        removeChildTmplAttrs(str);\n        str = text;\n      } else {\n        str = str.outerHTML;\n      }\n    }\n    //将模板中所有 micro-(或者micro-template,ntes-,ntes-template)替换为空\n    return str && str.toString().replace(/(micro|ntes)-(template)?/g, '');\n  }\n\n  //http://ejohn.org/blog/javascript-micro-templating/\n  var cache = {};\n\n  function tmpl(str, data) {\n    str = getTmpl(str);\n    var reg1 = new RegExp('((^|' + outro + \")[^\\t]*)'\", 'g');\n    var reg2 = new RegExp('\\t' + (mustache ? '' : '=') + '(.*?)' + outro, 'g');\n    var fn = !/\\W/.test(str) ? //W大写，可以匹配任何一个字母或者数字或者下划线以外的字符\n      cache[str] = cache[str] :\n      new Function(\"obj\",\n        \"var p=[],print=function(){p.push.apply(p,arguments);};\"\n        + \"with(obj){p.push('\"\n        + str\n          .replace(/[\\r\\t\\n]/g, \" \") //将\"\\r\\t\\n\"先替换成\" \"\n          //.split(\"<%\").join(\"\\t\") //将模板开始符号\"<%\"全部替换成\"\\t\"\n          .split(intro).join(\"\\t\")//--> split(\"<%\").join(\"\\t\")\n          //.replace(/((^|%>)[^\\t]*)'/g, \"$1\\r\") //将将模板结束符号%>全部替换成\\r\n          .replace(reg1, \"$1\\r\")//--> replace(/((^|%>)[^\\t]*)'/g, \"$1\\r\")\n          //.replace(/\\t=(.*?)%>/g, \"',$1,'\") //将=与%>之间的变量替换成\",变量,\"\n          .replace(reg2, \"',$1,'\")//--> replace(/\\t=(.*?)%>/g, \"',$1,'\")\n          .split(\"\\t\").join(\"');\") //将之前替换的\"\\t\"再替换成\");\"\n          //.split(\"%>\").join(\"p.push('\")\n          .split(outro).join(\"p.push('\")//-->split(\"%>\").join(\"p.push('\")\n          .split(\"\\r\").join(\"\\\\'\")\n        + \"');}return p.join('');\");\n    return data ? fn(data) : fn;\n  }\n\n  return tmpl;\n};\nmodule.exports = microTmpl;\n"
  },
  {
    "path": "app/templates/app/src/core/NativeBridge.js",
    "content": "var Navigator = require('./Navigator');\n\n/**\n * 与客户端交互\n *\n *    前端与客户端交互的流程主要为前端调用，客户端读取，客户端回调三个步骤：\n *    前端调用客户端规则为：dejafashion://NAME（android 前端调用window.__dejafashion_NAME()）\n *    客户端读取前端的数据规则为 window.__dejafashion_data_NAME，前端返回JSON {default:'',...}\n *    【如果有】客户端处理完逻辑回调前端的方法规则为： window.__dejafashion_after_NAME([json])\n *    拿分享为例:\n *    1 -------> 前端调用dejafashion://share（android 前端调用window.__dejafashion_share()）\n *    2 --------> 客户端接收到请求，向前端读取必要参数window.__dejafashion_data_share\n *    3 ------- >【如果有】 客户端处理完逻辑回调通知前端处理完毕调用window.__dejafashion_after_share([json])\n *    4 ------>前端接收客户端传回来的参数该干嘛干嘛\n *    注意，客户端在调用前端方法之前一定要先做判断，如 window.__dejafashion_after_share && window.__dejafashion_after_share([json])\n *\n */\nfunction NativeBridge(protocolHandler) {\n  var _NB = this,\n    global = window,\n    emptyFn = function () {\n    },\n    appUA = (/Deja/ig).test(navigator.userAgent),\n    debug = false,\n    afterCallbacks = {},\n    Protocols = {},\n    baseName = 'dejafashion',\n    baseProtocol = baseName + '://',\n    baseObjName = '__' + baseName,\n    baseDataName = baseObjName + '_data_',\n    baseBeforeName = baseObjName + '_before_',\n    baseAfterName = baseObjName + '_after_',\n    baseUpdateDataName = 'set_data_for_',\n    baseUpdateBeforeName = 'set_before_for_';\n\n  afterCallbacks = {};\n  Protocols = {};\n\n\n  function enableDebug() {\n    debug = true;\n  }\n\n  function isApp() {\n    return appUA || debug;\n  }\n\n  function protocol(action, callback) {\n    protocolHandler(action, true);\n    //开启调试\n    if (debug && callback) {\n      var _data = action.match(/[\\w]:\\/\\/(.*)/);\n      if (typeof callback == 'function') {\n        callback(_data && _data[1]);\n      }\n    }\n  }\n\n  function afterCallback(rs, callback) {\n    callback = callback || emptyFn;\n    if (typeof callback == 'function') {\n      callback(rs);\n    }\n    callback = emptyFn;\n  }\n\n  function updateData(name, data) {\n    if (data != null && data != undefined) {\n      if (!/object/i.test(typeof data)) {\n        data = {default: data};\n      }\n\n      global[baseDataName + name] = data;\n    }\n  }\n\n  function updateBefore(name, fn) {\n    if (/function/i.test(typeof fn)) {\n      global[baseBeforeName + name] = fn;\n    } else {\n      delete global[baseBeforeName + name];\n    }\n  }\n\n  /**\n   * set_data_for_NAME = function(data)\n   * @param name\n   * @param fn\n   */\n  function registerUpdateDataFn(name, fn) {\n    var updateName = baseUpdateDataName + name;\n    _NB[updateName] = fn || function (data) {\n        updateData(name, data);\n      }\n  }\n\n  /**\n   * set_before_for_NAME = function(callback)\n   * @param name\n   */\n  function registerBeforeFn(name) {\n    var beforeName = baseUpdateBeforeName + name;\n    _NB[beforeName] = function (fn) {\n      updateBefore(name, fn);\n    }\n  }\n\n  /**\n   * register a native API\n   *\n   * @param name\n   * @param fn\n   * @returns {*}\n   */\n  function registerFn(name, fn) {\n    Protocols[name] = baseProtocol + name;\n    afterCallbacks[name] = emptyFn;\n    global[baseAfterName + name] = function (rs) {\n      afterCallback(rs, afterCallbacks[name]);\n    }\n    registerUpdateDataFn(name);\n    _NB[name] = fn\n      || function (data, callback, subProtocol) {\n        updateData(name, data);\n        afterCallbacks[name] = callback;\n        if (isApp()) {\n          if (global[baseObjName] && global[baseObjName][name]) {\n            global[baseObjName][name]();\n          } else {\n            protocol(Protocols[name] + (subProtocol ? ('/' + subProtocol) : ''), callback);\n          }\n        }\n      };\n\n    return _NB[name];\n  }\n\n  /**\n   *\n   * execute a native API  by it's name\n   * if it's not exist then register it and execute it\n   *\n   * @param name\n   */\n  function trigger(name) {\n    var fn = _NB[name],\n      args = [].slice.call(arguments, 1);\n    if (!fn) {\n      fn = registerFn(name);\n    }\n    fn.apply(_NB, args);\n  }\n\n  this.isApp = isApp;\n  this.enableDebug = enableDebug;\n  this.trigger = trigger;\n\n  ['userInfo', 'login', 'share', 'modifytitle', 'updateBarButton', 'setBgColor', 'copy', 'closeweb'].forEach(function (key, index) {\n    registerFn(key);\n  });\n\n  ['facebook', 'twitter', 'instagram'].forEach(function (key, index) {\n    _NB['share_' + key] = function (data, callback) {\n      _NB['share'](data, callback, key);\n    }\n    _NB[baseUpdateDataName + 'share_' + key] = _NB[baseUpdateDataName + 'share'];\n  });\n\n  ['unload'].forEach(function (key, index) {\n    registerBeforeFn(key);\n  });\n\n}\n\nmodule.exports = new NativeBridge(Navigator.protocol);\n"
  },
  {
    "path": "app/templates/app/src/core/Navigator.js",
    "content": "var Navigator = (function () {\n  var frame,\n    androidReg = /Android/gi,\n    isAndroid = androidReg.test(navigator.platform) || androidReg.test(navigator.userAgent);\n  /**\n   * iframe 元素\n   *\n   * @property {Element} frame\n   */\n  frame = null;\n  /**\n   * append iframe\n   *\n   * @param frame\n   */\n  function appendFrame(frame) {\n    frame && document.body.appendChild(frame);\n  }\n\n  /**\n   * 删除iframe\n   *\n   * @method removeFrame\n   * @param {Element} frame 执行的方法\n   */\n  function removeFrame(frame) {\n    frame && frame.parentNode.removeChild(frame);\n  }\n\n  /**\n   * 创建iframe,帮助解决iOS的UIWebView没有JS API\n   *\n   * @method getFrame\n   * @return {Element} iframe\n   */\n  function getFrame(src, name) {\n    var _frame = document.createElement(\"iframe\");\n    _frame.setAttribute(\"style\", \"display:none;width:0;height:0;position: absolute;top:0;left:0;border:0;\");\n    _frame.setAttribute(\"height\", \"0px\");\n    _frame.setAttribute(\"width\", \"0px\");\n    _frame.setAttribute(\"frameborder\", \"0\");\n    name && _frame.setAttribute(\"name\", name);\n    if (src) {\n      _frame.setAttribute(\"src\", src);\n    } else {\n      appendFrame(_frame);\n    }\n    return _frame;\n  }\n\n  /**\n   * 执行与客户端交互方法的命令\n   *\n   * @method excute\n   * @param {String} ns 与客户端交互的协议server/类Class\n   * @param {String} fn 执行的方法\n   * @param {Object} option 参数\n   * @param {boolean} single 是否是使用独立的iframe,默认false\n   * @param {boolean} noframe 是否不通过iframe,默认false\n   */\n  function excute(ns, fn, option, single, noframe) {\n    var data, command;\n    data = option ? JSON.stringify(option) : '';//将JSON转换成字符串\n    if (ns && (typeof ns == 'object') && ns[fn]) {//android\n      ns[fn](data);\n    } else {//iOS\n      command = ns;\n      if (typeof fn == 'string' && fn.length > 0) {\n        command += fn + '/' + data;\n      }\n      protocol(command, single, noframe);\n    }\n  }\n\n  /**\n   * 执行与客户端交互的协议\n   *\n   * @method protocol\n   * @param {String} command 执行的协议及命令\n   * @param {boolean} single 是否是使用独立的iframe,默认false\n   * @param {boolean} noframe 是否不通过iframe,默认false\n   */\n  function protocol(command, single, noframe) {\n    var _frame, timer;\n    //不通过iframe\n    if (noframe) {\n      window.location.href = command;\n      return;\n    }\n    //通过iframe\n    if (single) {\n      if (isAndroid) {\n        _frame = getFrame();\n        _frame.setAttribute(\"src\", command);\n      } else {\n        _frame = getFrame(command);\n        appendFrame(_frame);\n      }\n      timer = setTimeout(function () {\n        _frame && removeFrame(_frame);\n      }, 30000);\n      _frame.onload = _frame.onreadystatechange = function () {\n        timer && clearTimeout(timer);\n        setTimeout(function () {\n          _frame && removeFrame(_frame);\n        }, 3500);\n      }\n    } else {\n      frame = frame || getFrame();\n      frame.setAttribute(\"src\", command);\n    }\n  }\n\n  return {\n    protocol: protocol,\n    excute: excute,\n    getFrame: getFrame,\n    appendFrame: appendFrame,\n    removeFrame: removeFrame\n  }\n})();//end Object Navigator\n\nmodule.exports = Navigator;\n"
  },
  {
    "path": "app/templates/app/src/core/Pubsub.js",
    "content": "function Pubsub(Subject) {\n  var topics = {};\n\n  function subscribe(topic, observer) {\n    var subject;\n    for (var key in topics) {\n      if (key === topic) {\n        subject = topics[key];\n        break;\n      }\n    }\n    if (!subject) {\n      subject = new Subject();\n      addTopic(topic, subject);\n    }\n    subject.register(observer);\n    return this;\n  }\n\n  function unsubscribe(topic) {\n    removeTopic(topic);\n    return this;\n  }\n\n  function publish(topic) {\n    var args = [].slice.call(arguments);\n    topics[topic] && topics[topic].notify.apply(topics[topic], args.slice(1));\n    return this;\n  }\n\n  function addTopic(topic, subject) {\n    topics[topic] = subject;\n  }\n\n  function removeTopic(topic) {\n    delete topics[topic];\n  }\n\n  function getTopics() {\n    var _topics = [];\n    for (var key in topics) {\n      (typeof key === 'string') && _topics.push(key);\n    }\n    return _topics;\n  }\n\n  this.getTopics = getTopics;\n  this.subscribe = subscribe;\n  this.unsubscribe = unsubscribe;\n  this.publish = publish;\n}\n\nmodule.exports = Pubsub;\n"
  },
  {
    "path": "app/templates/app/src/core/Router.js",
    "content": "var Pubsub = require('./Pubsub');\nvar Subject = require('./Subject');\nvar HashHandler = require('./HashHandler');\n\n/**\n *\n * Router 初始化流程：\n * init(withAction) --> onReady 是否注册有 Callback  --> (是)执行所有 Callback (在关键Callback里，手动执行 run 来强制刷新是推荐的）\n *                                                  --> (否)执行 run\n *\n *\n * Hash 变化事件执行流程：\n * Hash变化（或者显示调用 run,forward,back方法） --> 执行 onChanged 注册的所有事件 --> 执行 subscribe 注册的与 Hash 关联的所有事件\n *\n * subscribe 注册的事件回调方法传递参数:\n * actionValue - 当前 action 之后的字符串，如/user/id=1&name=test 对应 action 是 /user/ ，actionValue 是 id=1&name=test\n * request - { action: 当前action字符串,\n                   valeu: actionValue,\n                   hash: {\n                    curHash: String,\n                    newHash: String,\n                    oldHash: String\n                   },\n                   query: actionValue的键值对，如 {id:1,name:test}\n                 }\n *\n * 本 Router 暂不支持正则表达式\n */\nfunction Router(Pubsub, HashHandler) {\n  var _Router = this,\n    subscribe = Pubsub.subscribe,\n    android = /Android/gi.test(navigator.userAgent),\n    iOS = /(iPad|iPhone|iPod)/gi.test(navigator.userAgent) && !android,\n    UN_SUB_NAME = '__UN_SUBSCRIBED_ACTION',\n    INIT_HASH_STR = formatHash(HashHandler.get()),\n    currentHash,\n    currentHashStr = INIT_HASH_STR || UN_SUB_NAME,\n    currentQureyStr = '',\n    lastActionKey,\n    leavePrefix = '__',\n    _isFroward = true,\n    isReady = false,\n    initCallback,\n    readyCallbacks = [],\n    changedCallbacks = [],\n    actionsHistory = [INIT_HASH_STR],\n    queryHistory = {},\n    historyPositions = {},\n    historyTitles = {},\n    anchorEl;\n\n  //iOS使用pushstate,解决iOS7没有历史的问题\n  if (iOS) {\n    window.addEventListener('popstate', locationHashChanged, false);\n  } else {\n    window.addEventListener('hashchange', locationHashChanged, false);\n  }\n\n  function getQuery(search) {\n    search = search || currentQureyStr || '';\n    var fn = function (str, reg) {\n      if (str) {\n        var data = {};\n        str.replace(reg, function ($0, $1, $2, $3) {\n          data[$1] = $3;\n        });\n        return data;\n      }\n    }\n    return fn(search, new RegExp(\"([^?=&]+)(=([^&]*))?\", \"g\")) || {};\n  }\n\n  function saveQuery(key, query) {\n    queryHistory[key] = queryHistory[key] || [];\n    queryHistory[key].push(query);\n  }\n\n  function getLastQuery(key) {\n    return queryHistory[key]?(queryHistory[key][queryHistory[key].length-1]||{}):{};\n  }\n\n  function formatHash(hash) {\n    if (hash) {\n      //hash后不能带search值\n      hash = hash.replace(/\\?.*/g, '');\n    }\n    return hash;\n  }\n\n  function locationHashChanged(e) {\n    e && e.preventDefault();\n    var args = arguments[0] || {},\n      hash;\n    hash = {\n      curHash: formatHash(HashHandler.get()),\n      newHash: formatHash(HashHandler.getByURL(args.newURL)),\n      oldHash: formatHash(HashHandler.getByURL(args.oldURL))\n    }\n    setHistoryPosition();\n    setHistoryTitle();\n    currentHash = hash;\n    currentHashStr = hash.curHash || UN_SUB_NAME;\n    setLastAction(hash.curHash);\n    initCallback && initCallback(hash.curHash, hash);\n    if (isReady) {\n      doChanged(hash.curHash, hash);\n      dispatch(hash);\n    }\n    hash.curHash && addAnchor(hash.curHash);\n    return false;\n  }\n\n  function dispatch(hash) {\n    var topics = Pubsub.getTopics(),\n      published = false;\n    if (hash.curHash !== undefined) {\n      for (var i = 0; i < topics.length; i++) {\n        var key = topics[i];\n        if (key !== UN_SUB_NAME) {\n          hash.curHash.replace(new RegExp('^' + key + '(.*)', 'g'), function ($1, $2) {\n            if ($1) {\n              currentQureyStr = $2;\n              published = true;\n              lastActionKey = key;\n              restoreHistoryTitle();\n\n              var query = getQuery($2);\n              Pubsub.publish(key, {\n                action: key,\n                param: $2,\n                hash: hash,\n                preQuery: getLastQuery(key),\n                query: query\n              });\n              saveQuery(key, query);\n            }\n          });\n        }\n      }\n    }\n    if (!published) {\n      lastActionKey = UN_SUB_NAME;\n      currentQureyStr = hash.curHash;\n      restoreHistoryTitle();\n\n      var query = getQuery(hash.curHash);\n      Pubsub.publish(UN_SUB_NAME, {\n        action: hash.curHash,\n        param: hash.curHash,\n        hash: hash,\n        preQuery: getLastQuery(UN_SUB_NAME),\n        query: query\n      });\n      saveQuery(UN_SUB_NAME, query);\n    }\n  }\n\n  /**\n   * 手动初始化\n   * 如在onReady里注册了很多的callback，可以通过此方法手动初始化它们\n   * 如果带上 withAction 可实现：\n   *      在所有主题被订阅之前，在页面首次加载之初，初始化一个与源hash不同且暂未被订阅的主题,最终仍然跳转到源hash\n   *\n   * 此方法并不是必要的\n   * @param {String} withAction 初始化的action\n   */\n  function init(withAction) {\n    if ((withAction === null) || (withAction === undefined) || (withAction === '' )) {\n      ready();\n    } else {\n      //注意原初始化的action不应该包含在将初始化的hash里\n      var reg = new RegExp('^' + withAction + '(.*)', 'i');\n      if (INIT_HASH_STR && !reg.test(INIT_HASH_STR)) {\n        initCallback = function (curHash) {\n          if (curHash === INIT_HASH_STR) {\n            initCallback = null;\n            setTimeout(function () {\n              ready();\n            }, 0);\n          } else if (curHash === withAction) {\n            forward(INIT_HASH_STR);\n          }\n        };\n        forward(withAction);\n      } else {\n        ready();\n      }\n    }\n    return Pubsub;\n  }\n\n  /**\n   * 强制刷新\n   * 在无需引起 hash 变化情况下，强制执行与当前 hash 关联的所有主题一次\n   * 流程：\n   * 执行 onChanged 注册的所有事件 --> 执行 subscribe 注册的与 Hash 关联的所有事件\n   * 如果：action 不为空，则仅执行 subscribe 注册的与 action 关联的所有事件\n   * @param action {Array}|{String}\n   * @returns {Pubsub}\n   */\n  function run(action) {\n\n    action ?\n      Pubsub.publish(action, {\n        action: action,\n        param: currentQureyStr,\n        hash: currentHash,\n        preQuery: getLastQuery(action),\n        query: getQuery()\n      })\n      : locationHashChanged();\n    return Pubsub;\n  }\n\n  /**\n   * 订阅所有没有被注册的主题\n   * @param {Object} observer\n   */\n  function onUnsubscribed(enterObserver, leaveObserver) {\n    onSubscribe(UN_SUB_NAME, enterObserver, leaveObserver);\n    return Pubsub;\n  }\n\n  /**\n   * 订阅所有没有被注册的主题\n   * @param action {Array}|{String}\n   * @param {Object} observer\n   * @param {Object} observer\n   */\n  function onSubscribe(action, enterObserver, leaveObserver) {\n    subscribe.call(Pubsub, action, enterObserver);\n    leaveObserver && subscribe.call(Pubsub, leavePrefix + action, leaveObserver);\n    return Pubsub;\n  }\n\n  /**\n   * 当hash发生变化时触发,会先于所有订阅的主题触发\n   */\n  function onChanged(callback) {\n    if (typeof callback === 'function') {\n      changedCallbacks.push(callback);\n    }\n    return Pubsub;\n  }\n\n  /**\n   * 手动执行init方法会执行通过此方法注册的所有callback方法\n   * @param callback\n   */\n  function onReady(callback) {\n    if (typeof callback === 'function') {\n      readyCallbacks.push(callback);\n    }\n    return Pubsub;\n  }\n\n  function ready() {\n    isReady = true;\n    //如果 onReady 方法中有回调则执行回调\n    //注意，onReady 的回调里需要有且仅有一个要显示调用 run 来强制执行所有主题的调回\n    if (readyCallbacks.length) {\n      while (readyCallbacks.length) {\n        readyCallbacks.shift().call(_Router, Pubsub)\n      }\n    }\n    //否则自动强制执行所有主题\n    else {\n      run();\n    }\n  }\n\n  function doChanged() {\n    var i = 0,\n      l = changedCallbacks.length;\n    for (; i < l; i++) {\n      changedCallbacks[i].apply(undefined, arguments);\n    }\n    lastActionKey && Pubsub.publish(leavePrefix + lastActionKey);\n  }\n\n  /**\n   * 跳转到一个指定的主题\n   * @param {String}|{Number} action\n   */\n  function forward(action) {\n    _isFroward = true;\n    if (action === null) {\n      window.history.forward();\n    } else if (typeof action === 'number') {\n      if (action == -1) {\n        _isFroward = false;\n      }\n      window.history.go(action);\n    } else if (typeof action === 'string') {\n      if (iOS) {\n        window.history.pushState(null, null, '#' + action);\n        run();\n      } else {\n        HashHandler.set(action);\n      }\n    }\n    return Pubsub;\n  }\n\n  /**\n   * 返回上一主题\n   * action仅在解决当不确实是否有浏览历史，并且又需要跳转到一个指定的hash值时\n   * 优先级是： 浏览器历史 > actionsHistory > action\n   * @param {String}|{Number} action\n   */\n  function back(action) {\n    var ac = popLastAction() || action || -1;\n    //如果浏览器有历史则走历史\n    if (window.history.length > 1) {\n      ac = -1;\n    }\n    forward(ac);\n    return Pubsub;\n  }\n\n  function setLastAction(action) {\n    var ac = [].concat.call(actionsHistory).pop();\n    if (ac != action) {\n      actionsHistory.push(action);\n    }\n  }\n\n  function getLastAction() {\n    var last = [].concat.call(actionsHistory);\n    last.pop();\n    return last.pop();\n  }\n  function popLastAction() {\n    //pop两次是因为最后一次是当前的\n    actionsHistory.pop();\n    return actionsHistory.pop();\n  }\n\n  function setFirstAction(action) {\n    var ac = [].concat.call(actionsHistory).shift();\n    if (ac != action) {\n      actionsHistory.unshift(action);\n    }\n  }\n\n  function getFirstAction() {\n    return actionsHistory.shift();\n  }\n\n  function isFroward() {\n    return _isFroward;\n  }\n\n  /**\n   * 解决历史滚动位置记录的问题，保证视图切换总在最顶部\n   * @param id\n   */\n  function addAnchor(id) {\n    return;//暂停使用\n\n    if (!anchorEl) {\n      var st = document.createElement('style');\n      anchorEl = document.createElement('div');\n      st.innerText = '.Router-anchor{position: fixed; top: 0; left: 0;}';\n      anchorEl.className = 'Router-anchor';\n      document.body.appendChild(st);\n      document.body.appendChild(anchorEl);\n    }\n\n    var cd = document.createElement('div'),\n      od = document.getElementById(id);\n    cd.id = id;\n    anchorEl.appendChild(cd);\n    if (od) {\n      anchorEl.removeChild(od);\n    }\n  }\n\n  /**\n   * 校验是否存在与当前的 action 匹配的 action\n   * @param action {Array}|{String}\n   * @returns {boolean}\n   */\n  function actionMatch(expected, actual) {\n    var ac = [], i = 0, l;\n    if (typeof expected === 'string') {\n      ac.push(expected)\n    } else if (toString.call(expected) == '[object Array]') {\n      ac = ac.concat(expected)\n    }\n    l = ac.length;\n    for (; i < l; i++) {\n      if ((new RegExp('^' + ac[i] + '(.*)', 'i')).test(actual)) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  /**\n   * 校验是否存在与当前的 action 匹配的 action\n   * @param action {Array}|{String}\n   * @returns {boolean}\n   */\n  function currentMatch(action) {\n    return actionMatch(action, currentHashStr || UN_SUB_NAME);\n  }\n\n  /**\n   * 校验是否存在与上一个 action 匹配的 action\n   * @param action {Array}|{String}\n   * @returns {boolean}\n   */\n  function lastMatch(action) {\n    return actionMatch(action, getLastAction() || UN_SUB_NAME);\n  }\n\n  function setHistoryPosition(id, position) {\n    id = id || currentHashStr;\n    if (id) {\n      historyPositions[id] = position || window.pageYOffset || window.scrollY || document.body.scrollTop;\n    }\n  }\n\n  function getHistoryPosition(id) {\n    id = id || currentHashStr;\n    return id && historyPositions[id];\n  }\n\n  function scrollToHistoryPosition(id) {\n    window.scrollTo(0, getHistoryPosition(id) || 1);\n    setHistoryPosition(id, 0);\n  }\n\n  function setHistoryTitle(id, title) {\n    id = id || currentHashStr;\n    if (id) {\n      historyTitles[id] = title || document.title;\n    }\n  }\n\n  function getHistoryTitle(id) {\n    id = id || currentHashStr;\n    return id && historyTitles[id];\n  }\n\n  function restoreHistoryTitle(id) {\n    var title = getHistoryTitle(id);\n    if (title) {\n      document.title = title;\n    }\n  }\n\n  function getCurrentHashStr() {\n    return currentHashStr;\n  }\n\n  Pubsub.initHash = INIT_HASH_STR;\n  Pubsub.init = init;\n  Pubsub.run = run;\n  Pubsub.forward = forward;\n  Pubsub.back = back;\n  Pubsub.isFroward = isFroward;\n  Pubsub.currentMatch = currentMatch;\n  Pubsub.lastMatch = lastMatch;\n  Pubsub.onReady = onReady;\n  Pubsub.onChanged = onChanged;\n  Pubsub.subscribe = onSubscribe;\n  Pubsub.onUnsubscribed = onUnsubscribed;\n  Pubsub.getQuery = getQuery;\n  Pubsub.getHistoryPosition = getHistoryPosition;\n  Pubsub.scrollToHistoryPosition = scrollToHistoryPosition;\n  Pubsub.getHistoryTitle = getHistoryTitle;\n  Pubsub.getCurrentHashStr = getCurrentHashStr;\n  Pubsub.getUnsubscribedAction = function () {\n    return UN_SUB_NAME;\n  };\n\n\n  return Pubsub;\n}\n\nmodule.exports = Router(new Pubsub(Subject), HashHandler);\n"
  },
  {
    "path": "app/templates/app/src/core/Subject.js",
    "content": "function Subject(subject) {\n  this._subject = subject;\n  this.observers = [];\n}\n\nSubject.prototype = {\n  /**\n   * @param {Function}|{Boject} observer\n   */\n  register: function (observer) {\n    if (!observer) {\n      throw new Error('An observer can not be undefined!');\n    } else if (typeof observer === 'object' && typeof observer.update !== 'function') {\n      throw {\n        name: 'Error',\n        method: 'Subject.register',\n        message: 'An observer object can not register without an update method!'\n      }\n    }\n    this.unregister(observer);//防止重复注册\n    this.observers.push(observer);\n    return this;\n  },\n  /**\n   * @param {Function}|{Boject} observer\n   */\n  unregister: function (observer) {\n    this.observers = this.observers.filter(function (obsv) {\n      if (obsv !== observer) {\n        return obsv;\n      }\n    });\n    return this;\n  },\n  notify: function () {\n    var args = [].slice.call(arguments);\n    this.observers.forEach(function (obsv) {\n      if (typeof obsv === 'function') {\n        obsv.apply(obsv, args);\n      } else {\n        obsv.update.apply(obsv, args);\n      }\n    });\n    return this;\n  }\n}\nmodule.exports = Subject;\n"
  },
  {
    "path": "app/templates/app/src/lib/Core.js",
    "content": "require('util/RequestAnimationFrame');\nrequire('util/Easing');\nrequire('util/Unveil');\nrequire('util/VirtualDOMLite');\n\nvar Navigator = require('core/Navigator');\nvar Subject = require('core/Subject');\nvar MicroTmpl = require('core/MicroTmpl');\nvar Class = require('core/Class');\nvar NativeBridge = require('core/NativeBridge');\nvar Router = require('core/Router');\nvar HashHandler = require('core/HashHandler');\nvar Event = require('core/Event');\n\nvar localStorage = require('util/LocalStorage');\nvar LocalHost = require('util/LocalHost');\nvar localParam = require('util/LocalParam');\nvar MetaHandler = require('util/MetaHandler');\nvar RequestHandler = require('util/RequestHandler');\nvar versionCompare = require('util/versionCompare');\nvar FormHandler = require('util/FormHandler');\n\nvar randomList = require('util/RandomList');\nvar Num = require('util/Number');\nvar GUID = require('util/GUID');\nvar DateHandler = require('util/DateHandler');\n\nvar Core = {\n  localStorage: localStorage,\n  localHost: LocalHost,\n  localParam: localParam,\n  Navigator: Navigator,\n  MetaHandler: MetaHandler,\n  Subject: Subject,\n  microTmpl: MicroTmpl(),\n  Class: Class,\n  extend: Class.extend,\n  HashHandler: HashHandler,\n  RequestHandler: RequestHandler,\n  NativeBridge: NativeBridge,\n  versionCompare: versionCompare,\n  FormHandler: FormHandler,\n  Event: Event,\n  Router: Router,\n\n  Num: Num,\n  GUID: GUID,\n  randomList: randomList,\n  DateHandler: DateHandler,\n\n  isDebug: localParam().search['debug'] == 1\n};\n\n//enable debug model\nCore.isDebug && Core.NativeBridge.enableDebug();\n\nwindow.Core = Core;\nmodule.exports = Core;\n"
  },
  {
    "path": "app/templates/app/src/lib/Core.standalone.js",
    "content": "require('util/RequestAnimationFrame');\n\nvar localStorage = require('core/LocalStorage');\nvar Navigator = require('core/Navigator');\nvar Subject = require('core/Subject');\nvar Class = require('core/Class');\nvar Event = require('core/Event');\n\nvar LocalHost = require('util/LocalHost');\nvar localParam = require('util/LocalParam');\nvar RequestHandler = require('util/RequestHandler');\n\nvar randomList = require('util/RandomList');\nvar Num = require('util/Number');\nvar DateHandler = require('util/DateHandler');\n\nvar Core = {\n  localStorage: localStorage,\n  localHost: LocalHost,\n  localParam: localParam,\n  Navigator: Navigator,\n  Class: Class,\n  extend: Class.extend,\n  RequestHandler: RequestHandler,\n  Event: Event,\n\n  Num: Num,\n  randomList: randomList,\n  DateHandler: DateHandler\n};\n\nwindow.Core = Core;\nmodule.exports = Core;\n"
  },
  {
    "path": "app/templates/app/src/lib/diffDOM.js",
    "content": "\"use strict\";\n\nvar diffcount;\n\nvar Diff = function (options) {\n  var diff = this;\n  Object.keys(options).forEach(function (option) {\n    diff[option] = options[option];\n  });\n};\n\nDiff.prototype = {\n  toString: function () {\n    return JSON.stringify(this);\n  }\n\n  // TODO: compress diff output by replacing these keys with numbers or alike:\n  /*        'addAttribute' = 0,\n   'modifyAttribute' = 1,\n   'removeAttribute' = 2,\n   'modifyTextElement' = 3,\n   'relocateGroup' = 4,\n   'removeElement' = 5,\n   'addElement' = 6,\n   'removeTextElement' = 7,\n   'addTextElement' = 8,\n   'replaceElement' = 9,\n   'modifyValue' = 10,\n   'modifyChecked' = 11,\n   'modifySelected' = 12,\n   'modifyComment' = 13,\n   'action' = 14,\n   'route' = 15,\n   'oldValue' = 16,\n   'newValue' = 17,\n   'element' = 18,\n   'group' = 19,\n   'from' = 20,\n   'to' = 21,\n   'name' = 22,\n   'value' = 23,\n   'data' = 24,\n   'attributes' = 25,\n   'nodeName' = 26,\n   'childNodes' = 27,\n   'checked' = 28,\n   'selected' = 29;*/\n};\n\nvar SubsetMapping = function SubsetMapping(a, b) {\n  this.old = a;\n  this.new = b;\n};\n\nSubsetMapping.prototype = {\n  contains: function contains(subset) {\n    if (subset.length < this.length) {\n      return subset.new >= this.new && subset.new < this.new + this.length;\n    }\n    return false;\n  },\n  toString: function toString() {\n    return this.length + \" element subset, first mapping: old \" + this.old + \" → new \" + this.new;\n  }\n};\n\nvar elementDescriptors = function (el) {\n  var output = [];\n  if (el.nodeName != '#text' && el.nodeName != '#comment') {\n    output.push(el.nodeName);\n    if (el.attributes) {\n      if (el.attributes.class) {\n        output.push(el.nodeName + '.' + el.attributes.class.replace(/ /g, '.'));\n      }\n      if (el.attributes.id) {\n        output.push(el.nodeName + '#' + el.attributes.id);\n      }\n    }\n\n  }\n  return output;\n};\n\nvar findUniqueDescriptors = function (li) {\n  var uniqueDescriptors = {},\n    duplicateDescriptors = {};\n\n  li.forEach(function (node) {\n    elementDescriptors(node).forEach(function (descriptor) {\n      var inUnique = descriptor in uniqueDescriptors,\n        inDupes = descriptor in duplicateDescriptors;\n      if (!inUnique && !inDupes) {\n        uniqueDescriptors[descriptor] = true;\n      } else if (inUnique) {\n        delete uniqueDescriptors[descriptor];\n        duplicateDescriptors[descriptor] = true;\n      }\n    });\n\n  });\n\n  return uniqueDescriptors;\n};\n\nvar uniqueInBoth = function (l1, l2) {\n  var l1Unique = findUniqueDescriptors(l1),\n    l2Unique = findUniqueDescriptors(l2),\n    inBoth = {};\n\n  Object.keys(l1Unique).forEach(function (key) {\n    if (l2Unique[key]) {\n      inBoth[key] = true;\n    }\n  });\n\n  return inBoth;\n};\n\nvar removeDone = function (tree) {\n  delete tree.outerDone;\n  delete tree.innerDone;\n  delete tree.valueDone;\n  if (tree.childNodes) {\n    return tree.childNodes.every(removeDone);\n  } else {\n    return true;\n  }\n};\n\nvar isEqual = function (e1, e2) {\n\n  var e1Attributes, e2Attributes;\n\n  if (!['nodeName', 'value', 'checked', 'selected', 'data'].every(function (element) {\n      if (e1[element] !== e2[element]) {\n        return false;\n      }\n      return true;\n    })) {\n    return false;\n  }\n\n  if (Boolean(e1.attributes) !== Boolean(e2.attributes)) {\n    return false;\n  }\n\n  if (Boolean(e1.childNodes) !== Boolean(e2.childNodes)) {\n    return false;\n  }\n\n  if (e1.attributes) {\n    e1Attributes = Object.keys(e1.attributes);\n    e2Attributes = Object.keys(e2.attributes);\n\n    if (e1Attributes.length != e2Attributes.length) {\n      return false;\n    }\n    if (!e1Attributes.every(function (attribute) {\n        if (e1.attributes[attribute] !== e2.attributes[attribute]) {\n          return false;\n        }\n      })) {\n      return false;\n    }\n  }\n\n  if (e1.childNodes) {\n    if (e1.childNodes.length !== e2.childNodes.length) {\n      return false;\n    }\n    if (!e1.childNodes.every(function (childNode, index) {\n        return isEqual(childNode, e2.childNodes[index]);\n      })) {\n\n      return false;\n    }\n\n  }\n\n  return true;\n\n};\n\n\nvar roughlyEqual = function (e1, e2, uniqueDescriptors, sameSiblings, preventRecursion) {\n  var childUniqueDescriptors, nodeList1, nodeList2;\n\n  if (!e1 || !e2) {\n    return false;\n  }\n\n  if (e1.nodeName !== e2.nodeName) {\n    return false;\n  }\n\n  if (e1.nodeName === '#text') {\n    // Note that we initially don't care what the text content of a node is,\n    // the mere fact that it's the same tag and \"has text\" means it's roughly\n    // equal, and then we can find out the true text difference later.\n    return preventRecursion ? true : e1.data === e2.data;\n  }\n\n\n  if (e1.nodeName in uniqueDescriptors) {\n    return true;\n  }\n\n  if (e1.attributes && e2.attributes) {\n\n    if (e1.attributes.id && e1.attributes.id === e2.attributes.id) {\n      var idDescriptor = e1.nodeName + '#' + e1.attributes.id;\n      if (idDescriptor in uniqueDescriptors) {\n        return true;\n      }\n    }\n    if (e1.attributes.class && e1.attributes.class === e2.attributes.class) {\n      var classDescriptor = e1.nodeName + '.' + e1.attributes.class.replace(/ /g, '.');\n      if (classDescriptor in uniqueDescriptors) {\n        return true;\n      }\n    }\n  }\n\n  if (sameSiblings) {\n    return true;\n  }\n\n  nodeList1 = e1.childNodes ? e1.childNodes.slice().reverse() : [];\n  nodeList2 = e2.childNodes ? e2.childNodes.slice().reverse() : [];\n\n  if (nodeList1.length !== nodeList2.length) {\n    return false;\n  }\n\n  if (preventRecursion) {\n    return nodeList1.every(function (element, index) {\n      return element.nodeName === nodeList2[index].nodeName;\n    });\n  } else {\n    // note: we only allow one level of recursion at any depth. If 'preventRecursion'\n    // was not set, we must explicitly force it to true for child iterations.\n    childUniqueDescriptors = uniqueInBoth(nodeList1, nodeList2);\n    return nodeList1.every(function (element, index) {\n      return roughlyEqual(element, nodeList2[index], childUniqueDescriptors, true, true);\n    });\n  }\n};\n\n\nvar cloneObj = function (obj) {\n  //  TODO: Do we really need to clone here? Is it not enough to just return the original object?\n  return JSON.parse(JSON.stringify(obj));\n  //return obj;\n};\n\n/**\n * based on https://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Longest_common_substring#JavaScript\n */\nvar findCommonSubsets = function (c1, c2, marked1, marked2) {\n  var lcsSize = 0,\n    index = [],\n    matches = Array.apply(null, new Array(c1.length + 1)).map(function () {\n      return [];\n    }), // set up the matching table\n    uniqueDescriptors = uniqueInBoth(c1, c2),\n  // If all of the elements are the same tag, id and class, then we can\n  // consider them roughly the same even if they have a different number of\n  // children. This will reduce removing and re-adding similar elements.\n    subsetsSame = c1.length === c2.length,\n    origin, ret;\n\n  if (subsetsSame) {\n\n    c1.some(function (element, i) {\n      var c1Desc = elementDescriptors(element),\n        c2Desc = elementDescriptors(c2[i]);\n      if (c1Desc.length !== c2Desc.length) {\n        subsetsSame = false;\n        return true;\n      }\n      c1Desc.some(function (description, i) {\n        if (description !== c2Desc[i]) {\n          subsetsSame = false;\n          return true;\n        }\n      });\n      if (!subsetsSame) {\n        return true;\n      }\n\n    });\n  }\n\n  // fill the matches with distance values\n  c1.forEach(function (c1Element, c1Index) {\n    c2.forEach(function (c2Element, c2Index) {\n      if (!marked1[c1Index] && !marked2[c2Index] && roughlyEqual(c1Element, c2Element, uniqueDescriptors, subsetsSame)) {\n        matches[c1Index + 1][c2Index + 1] = (matches[c1Index][c2Index] ? matches[c1Index][c2Index] + 1 : 1);\n        if (matches[c1Index + 1][c2Index + 1] >= lcsSize) {\n          lcsSize = matches[c1Index + 1][c2Index + 1];\n          index = [c1Index + 1, c2Index + 1];\n        }\n      } else {\n        matches[c1Index + 1][c2Index + 1] = 0;\n      }\n    });\n  });\n  if (lcsSize === 0) {\n    return false;\n  }\n  origin = [index[0] - lcsSize, index[1] - lcsSize];\n  ret = new SubsetMapping(origin[0], origin[1]);\n  ret.length = lcsSize;\n\n  return ret;\n};\n\n/**\n * This should really be a predefined function in Array...\n */\nvar makeArray = function (n, v) {\n  return Array.apply(null, new Array(n)).map(function () {\n    return v;\n  });\n};\n\n/**\n * Generate arrays that indicate which node belongs to which subset,\n * or whether it's actually an orphan node, existing in only one\n * of the two trees, rather than somewhere in both.\n *\n * So if t1 = <img><canvas><br>, t2 = <canvas><br><img>.\n * The longest subset is \"<canvas><br>\" (length 2), so it will group 0.\n * The second longest is \"<img>\" (length 1), so it will be group 1.\n * gaps1 will therefore be [1,0,0] and gaps2 [0,0,1].\n *\n * If an element is not part of any group, it will stay being 'true', which\n * is the initial value. For example:\n * t1 = <img><p></p><br><canvas>, t2 = <b></b><br><canvas><img>\n *\n * The \"<p></p>\" and \"<b></b>\" do only show up in one of the two and will\n * therefore be marked by \"true\". The remaining parts are parts of the\n * groups 0 and 1:\n * gaps1 = [1, true, 0, 0], gaps2 = [true, 0, 0, 1]\n *\n */\nvar getGapInformation = function (t1, t2, stable) {\n\n  var gaps1 = t1.childNodes ? makeArray(t1.childNodes.length, true) : [],\n    gaps2 = t2.childNodes ? makeArray(t2.childNodes.length, true) : [],\n    group = 0;\n\n  // give elements from the same subset the same group number\n  stable.forEach(function (subset) {\n    var i, endOld = subset.old + subset.length,\n      endNew = subset.new + subset.length;\n    for (i = subset.old; i < endOld; i += 1) {\n      gaps1[i] = group;\n    }\n    for (i = subset.new; i < endNew; i += 1) {\n      gaps2[i] = group;\n    }\n    group += 1;\n  });\n\n  return {\n    gaps1: gaps1,\n    gaps2: gaps2\n  };\n};\n\n/**\n * Find all matching subsets, based on immediate child differences only.\n */\nvar markSubTrees = function (oldTree, newTree) {\n  // note: the child lists are views, and so update as we update old/newTree\n  var oldChildren = oldTree.childNodes ? oldTree.childNodes : [],\n    newChildren = newTree.childNodes ? newTree.childNodes : [],\n    marked1 = makeArray(oldChildren.length, false),\n    marked2 = makeArray(newChildren.length, false),\n    subsets = [],\n    subset = true,\n    returnIndex = function () {\n      return arguments[1];\n    },\n    markBoth = function (i) {\n      marked1[subset.old + i] = true;\n      marked2[subset.new + i] = true;\n    };\n\n  while (subset) {\n    subset = findCommonSubsets(oldChildren, newChildren, marked1, marked2);\n    if (subset) {\n      subsets.push(subset);\n\n      Array.apply(null, new Array(subset.length)).map(returnIndex).forEach(markBoth);\n\n    }\n  }\n  return subsets;\n};\n\n\nfunction swap(obj, p1, p2) {\n  (function (_) {\n    obj[p1] = obj[p2];\n    obj[p2] = _;\n  }(obj[p1]));\n}\n\n\nvar DiffTracker = function () {\n  this.list = [];\n};\n\nDiffTracker.prototype = {\n  list: false,\n  add: function (diffs) {\n    var list = this.list;\n    diffs.forEach(function (diff) {\n      list.push(diff);\n    });\n  },\n  forEach: function (fn) {\n    this.list.forEach(fn);\n  }\n};\n\nvar diffDOM = function (options) {\n\n  var defaults = {\n      debug: false,\n      diffcap: 10, // Limit for how many diffs are accepting when debugging. Inactive when debug is false.\n      maxDepth: false, // False or a numeral. If set to a numeral, limits the level of depth that the the diff mechanism looks for differences. If false, goes through the entire tree.\n      valueDiffing: true, // Whether to take into consideration the values of forms that differ from auto assigned values (when a user fills out a form).\n      // syntax: textDiff: function (node, currentValue, expectedValue, newValue)\n      textDiff: function () {\n        arguments[0].data = arguments[3];\n        return;\n      }\n    },\n    i;\n\n  if (typeof options == \"undefined\") {\n    options = {};\n  }\n\n  for (i in defaults) {\n    if (typeof options[i] == \"undefined\") {\n      this[i] = defaults[i];\n    } else {\n      this[i] = options[i];\n    }\n  }\n\n};\ndiffDOM.prototype = {\n\n  // ===== Create a diff =====\n\n  diff: function (t1Node, t2Node) {\n\n    var t1 = this.nodeToObj(t1Node),\n      t2 = this.nodeToObj(t2Node);\n\n    diffcount = 0;\n\n    if (this.debug) {\n      this.t1Orig = this.nodeToObj(t1Node);\n      this.t2Orig = this.nodeToObj(t2Node);\n    }\n\n    this.tracker = new DiffTracker();\n    return this.findDiffs(t1, t2);\n  },\n  findDiffs: function (t1, t2) {\n    var diffs;\n    do {\n      if (this.debug) {\n        diffcount += 1;\n        if (diffcount > this.diffcap) {\n          window.diffError = [this.t1Orig, this.t2Orig];\n          throw new Error(\"surpassed diffcap:\" + JSON.stringify(this.t1Orig) + \" -> \" + JSON.stringify(this.t2Orig));\n        }\n      }\n      diffs = this.findNextDiff(t1, t2, []);\n      if (diffs.length === 0) {\n        // Last check if the elements really are the same now.\n        // If not, remove all info about being done and start over.\n        // Somtimes a node can be marked as done, but the creation of subsequent diffs means that it has to be changed anyway.\n        if (!isEqual(t1, t2)) {\n          removeDone(t1);\n          diffs = this.findNextDiff(t1, t2, []);\n        }\n      }\n\n      if (diffs.length > 0) {\n        this.tracker.add(diffs);\n        this.applyVirtual(t1, diffs);\n      }\n    } while (diffs.length > 0);\n    return this.tracker.list;\n  },\n  findNextDiff: function (t1, t2, route) {\n    var diffs;\n\n    if (this.maxDepth && route.length > this.maxDepth) {\n      return [];\n    }\n    // outer differences?\n    if (!t1.outerDone) {\n      diffs = this.findOuterDiff(t1, t2, route);\n      if (diffs.length > 0) {\n        t1.outerDone = true;\n        return diffs;\n      } else {\n        t1.outerDone = true;\n      }\n    }\n    // inner differences?\n    if (!t1.innerDone) {\n      diffs = this.findInnerDiff(t1, t2, route);\n      if (diffs.length > 0) {\n        return diffs;\n      } else {\n        t1.innerDone = true;\n      }\n    }\n\n    if (this.valueDiffing && !t1.valueDone) {\n      // value differences?\n      diffs = this.findValueDiff(t1, t2, route);\n\n      if (diffs.length > 0) {\n        t1.valueDone = true;\n        return diffs;\n      } else {\n        t1.valueDone = true;\n      }\n    }\n\n    // no differences\n    return [];\n  },\n  findOuterDiff: function (t1, t2, route) {\n\n    var diffs = [],\n      attr1, attr2;\n\n    if (t1.nodeName !== t2.nodeName) {\n      return [new Diff({\n        action: 'replaceElement',\n        oldValue: cloneObj(t1),\n        newValue: cloneObj(t2),\n        route: route\n      })];\n    }\n\n    if (t1.data !== t2.data) {\n      // Comment or text node.\n      if (t1.nodeName === '#text') {\n        return [new Diff({\n          action: 'modifyComment',\n          route: route,\n          oldValue: t1.data,\n          newValue: t2.data\n        })];\n      } else {\n        return [new Diff({\n          action: 'modifyTextElement',\n          route: route,\n          oldValue: t1.data,\n          newValue: t2.data\n        })];\n      }\n\n    }\n\n\n    attr1 = t1.attributes ? Object.keys(t1.attributes).sort() : [];\n    attr2 = t2.attributes ? Object.keys(t2.attributes).sort() : [];\n\n    attr1.forEach(function (attr) {\n      var pos = attr2.indexOf(attr);\n      if (pos === -1) {\n        diffs.push(new Diff({\n          action: 'removeAttribute',\n          route: route,\n          name: attr,\n          value: t1.attributes[attr]\n        }));\n      } else {\n        attr2.splice(pos, 1);\n        if (t1.attributes[attr] !== t2.attributes[attr]) {\n          diffs.push(new Diff({\n            action: 'modifyAttribute',\n            route: route,\n            name: attr,\n            oldValue: t1.attributes[attr],\n            newValue: t2.attributes[attr]\n          }));\n        }\n      }\n\n    });\n\n\n    attr2.forEach(function (attr) {\n      diffs.push(new Diff({\n        action: 'addAttribute',\n        route: route,\n        name: attr,\n        value: t2.attributes[attr]\n      }));\n\n    });\n\n    return diffs;\n  },\n  nodeToObj: function (node) {\n    var objNode = {}, dobj = this;\n    objNode.nodeName = node.nodeName;\n    if (objNode.nodeName === '#text' || objNode.nodeName === '#comment') {\n      objNode.data = node.data;\n    } else {\n      if (node.attributes && node.attributes.length > 0) {\n        objNode.attributes = {};\n        Array.prototype.slice.call(node.attributes).forEach(\n          function (attribute) {\n            objNode.attributes[attribute.name] = attribute.value;\n          }\n        );\n      }\n      if (node.childNodes && node.childNodes.length > 0) {\n        objNode.childNodes = [];\n        Array.prototype.slice.call(node.childNodes).forEach(\n          function (childNode) {\n            objNode.childNodes.push(dobj.nodeToObj(childNode));\n          }\n        );\n      }\n      if (this.valueDiffing) {\n        if (node.value) {\n          objNode.value = node.value;\n        }\n        if (node.checked) {\n          objNode.checked = node.checked;\n        }\n        if (node.selected) {\n          objNode.selected = node.selected;\n        }\n      }\n    }\n\n    return objNode;\n  },\n  objToNode: function (objNode, insideSvg) {\n    var node, dobj = this;\n    if (objNode.nodeName === '#text') {\n      node = document.createTextNode(objNode.data);\n\n    } else if (objNode.nodeName === '#comment') {\n      node = document.createComment(objNode.data);\n    } else {\n      if (objNode.nodeName === 'svg' || insideSvg) {\n        node = document.createElementNS('http://www.w3.org/2000/svg', objNode.nodeName);\n        insideSvg = true;\n      } else {\n        node = document.createElement(objNode.nodeName);\n      }\n      if (objNode.attributes) {\n        Object.keys(objNode.attributes).forEach(function (attribute) {\n          node.setAttribute(attribute, objNode.attributes[attribute]);\n        });\n      }\n      if (objNode.childNodes) {\n        objNode.childNodes.forEach(function (childNode) {\n          node.appendChild(dobj.objToNode(childNode, insideSvg));\n        });\n      }\n      if (this.valueDiffing) {\n        if (objNode.value) {\n          node.value = objNode.value;\n        }\n        if (objNode.checked) {\n          node.checked = objNode.checked;\n        }\n        if (objNode.selected) {\n          node.selected = objNode.selected;\n        }\n      }\n    }\n    return node;\n  },\n  findInnerDiff: function (t1, t2, route) {\n\n    var subtrees = (t1.childNodes && t2.childNodes) ? markSubTrees(t1, t2) : [],\n      t1ChildNodes = t1.childNodes ? t1.childNodes : [],\n      t2ChildNodes = t2.childNodes ? t2.childNodes : [],\n      childNodesLengthDifference, diffs = [],\n      index = 0,\n      last, e1, e2, i;\n\n    if (subtrees.length > 1) {\n      /* Two or more groups have been identified among the childnodes of t1\n       * and t2.\n       */\n      return this.attemptGroupRelocation(t1, t2, subtrees, route);\n    }\n\n    /* 0 or 1 groups of similar child nodes have been found\n     * for t1 and t2. 1 If there is 1, it could be a sign that the\n     * contents are the same. When the number of groups is below 2,\n     * t1 and t2 are made to have the same length and each of the\n     * pairs of child nodes are diffed.\n     */\n\n\n    last = Math.max(t1ChildNodes.length, t2ChildNodes.length);\n    if (t1ChildNodes.length !== t2ChildNodes.length) {\n      childNodesLengthDifference = true;\n    }\n\n    for (i = 0; i < last; i += 1) {\n      e1 = t1ChildNodes[i];\n      e2 = t2ChildNodes[i];\n\n      if (childNodesLengthDifference) {\n        /* t1 and t2 have different amounts of childNodes. Add\n         * and remove as necessary to obtain the same length */\n        if (e1 && !e2) {\n          if (e1.nodeName === '#text') {\n            diffs.push(new Diff({\n              action: 'removeTextElement',\n              route: route.concat(index),\n              value: e1.data\n            }));\n            index -= 1;\n          } else {\n            diffs.push(new Diff({\n              action: 'removeElement',\n              route: route.concat(index),\n              element: cloneObj(e1)\n            }));\n            index -= 1;\n          }\n\n        } else if (e2 && !e1) {\n          if (e2.nodeName === '#text') {\n            diffs.push(new Diff({\n              action: 'addTextElement',\n              route: route.concat(index),\n              value: e2.data\n            }));\n          } else {\n            diffs.push(new Diff({\n              action: 'addElement',\n              route: route.concat(index),\n              element: cloneObj(e2)\n            }));\n          }\n        }\n      }\n      /* We are now guaranteed that childNodes e1 and e2 exist,\n       * and that they can be diffed.\n       */\n      /* Diffs in child nodes should not affect the parent node,\n       * so we let these diffs be submitted together with other\n       * diffs.\n       */\n\n      if (e1 && e2) {\n        diffs = diffs.concat(this.findNextDiff(e1, e2, route.concat(index)));\n      }\n\n      index += 1;\n\n    }\n    t1.innerDone = true;\n    return diffs;\n\n  },\n\n  attemptGroupRelocation: function (t1, t2, subtrees, route) {\n    /* Either t1.childNodes and t2.childNodes have the same length, or\n     * there are at least two groups of similar elements can be found.\n     * attempts are made at equalizing t1 with t2. First all initial\n     * elements with no group affiliation (gaps=true) are removed (if\n     * only in t1) or added (if only in t2). Then the creation of a group\n     * relocation diff is attempted.\n     */\n\n    var gapInformation = getGapInformation(t1, t2, subtrees),\n      gaps1 = gapInformation.gaps1,\n      gaps2 = gapInformation.gaps2,\n      shortest = Math.min(gaps1.length, gaps2.length),\n      destinationDifferent, toGroup,\n      group, node, similarNode, testI, diffs = [],\n      index = 0,\n      i, j;\n\n\n    for (i = 0; i < shortest; i += 1) {\n      if (gaps1[i] === true) {\n        node = t1.childNodes[i];\n        if (node.nodeName === '#text') {\n          if (t2.childNodes[i].nodeName === '#text' && node.data !== t2.childNodes[i].data) {\n            testI = i;\n            while (t1.childNodes.length > testI + 1 && t1.childNodes[testI + 1].nodeName === '#text') {\n              testI += 1;\n              if (t2.childNodes[i].data === t1.childNodes[testI].data) {\n                similarNode = true;\n                break;\n              }\n            }\n            if (!similarNode) {\n              diffs.push(new Diff({\n                action: 'modifyTextElement',\n                route: route.concat(index),\n                oldValue: node.data,\n                newValue: t2.childNodes[i].data\n              }));\n            }\n          }\n          diffs.push(new Diff({\n            action: 'removeTextElement',\n            route: route.concat(index),\n            value: node.data\n          }));\n          index -= 1;\n        } else {\n          diffs.push(new Diff({\n            action: 'removeElement',\n            route: route.concat(index),\n            element: cloneObj(node)\n          }));\n          index -= 1;\n        }\n\n      } else if (gaps2[i] === true) {\n        node = t2.childNodes[i];\n        if (node.nodeName === '#text') {\n          diffs.push(new Diff({\n            action: 'addTextElement',\n            route: route.concat(index),\n            value: node.data\n          }));\n          index += 1;\n        } else {\n          diffs.push(new Diff({\n            action: 'addElement',\n            route: route.concat(index),\n            element: cloneObj(node)\n          }));\n          index += 1;\n        }\n\n      } else if (gaps1[i] !== gaps2[i]) {\n        if (diffs.length > 0) {\n          return diffs;\n        }\n        // group relocation\n        group = subtrees[gaps1[i]];\n        toGroup = Math.min(group.new, (t1.childNodes.length - group.length));\n        if (toGroup !== group.old) {\n          // Check whether destination nodes are different than originating ones.\n          destinationDifferent = false;\n          for (j = 0; j < group.length; j += 1) {\n            if (!roughlyEqual(t1.childNodes[toGroup + j], t1.childNodes[group.old + j], [], false, true)) {\n              destinationDifferent = true;\n            }\n          }\n          if (destinationDifferent) {\n            return [new Diff({\n              action: 'relocateGroup',\n              groupLength: group.length,\n              from: group.old,\n              to: toGroup,\n              route: route\n            })];\n          }\n        }\n      }\n      index += 1;\n    }\n    return diffs;\n  },\n\n  findValueDiff: function (t1, t2, route) {\n    // Differences of value. Only useful if the value/selection/checked value\n    // differs from what is represented in the DOM. For example in the case\n    // of filled out forms, etc.\n    var diffs = [];\n\n    if (t1.selected !== t2.selected) {\n      diffs.push(new Diff({\n        action: 'modifySelected',\n        oldValue: t1.selected,\n        newValue: t2.selected,\n        route: route\n      }));\n    }\n\n    if ((t1.value || t2.value) && t1.value !== t2.value && t1.nodeName !== 'OPTION') {\n      diffs.push(new Diff({\n        action: 'modifyValue',\n        oldValue: t1.value,\n        newValue: t2.value,\n        route: route\n      }));\n    }\n    if (t1.checked !== t2.checked) {\n      diffs.push(new Diff({\n        action: 'modifyChecked',\n        oldValue: t1.checked,\n        newValue: t2.checked,\n        route: route\n      }));\n    }\n\n    return diffs;\n  },\n\n  // ===== Apply a virtual diff =====\n\n  applyVirtual: function (tree, diffs) {\n    var dobj = this;\n    if (diffs.length === 0) {\n      return true;\n    }\n    diffs.forEach(function (diff) {\n      //                              console.log(JSON.stringify(diff));\n      //                              console.log(JSON.stringify(tree));\n      //                              console.log(this.objToNode(tree).outerHTML);\n      dobj.applyVirtualDiff(tree, diff);\n      //                                console.log(JSON.stringify(tree));\n      //                                console.log(this.objToNode(tree).outerHTML);\n    });\n    return true;\n  },\n  getFromVirtualRoute: function (tree, route) {\n    var node = tree,\n      parentNode, nodeIndex;\n\n    route = route.slice();\n    while (route.length > 0) {\n      if (!node.childNodes) {\n        return false;\n      }\n      nodeIndex = route.splice(0, 1)[0];\n      parentNode = node;\n      node = node.childNodes[nodeIndex];\n    }\n    return {\n      node: node,\n      parentNode: parentNode,\n      nodeIndex: nodeIndex\n    };\n  },\n  applyVirtualDiff: function (tree, diff) {\n    var routeInfo = this.getFromVirtualRoute(tree, diff.route),\n      node = routeInfo.node,\n      parentNode = routeInfo.parentNode,\n      nodeIndex = routeInfo.nodeIndex,\n      newNode, route, c;\n\n    switch (diff.action) {\n      case 'addAttribute':\n        if (!node.attributes) {\n          node.attributes = {};\n        }\n\n        node.attributes[diff.name] = diff.value;\n\n        if (diff.name === 'checked') {\n          node.checked = true;\n        } else if (diff.name === 'selected') {\n          node.selected = true;\n        } else if (node.nodeName === 'INPUT' && diff.name === 'value') {\n          node.value = diff.value;\n        }\n\n        break;\n      case 'modifyAttribute':\n        node.attributes[diff.name] = diff.newValue;\n        if (node.nodeName === 'INPUT' && diff.name === 'value') {\n          node.value = diff.value;\n        }\n        break;\n      case 'removeAttribute':\n\n        delete node.attributes[diff.name];\n\n        if (Object.keys(node.attributes).length === 0) {\n          delete node.attributes;\n        }\n\n        if (diff.name === 'checked') {\n          delete node.checked;\n        } else if (diff.name === 'selected') {\n          delete node.selected;\n        } else if (node.nodeName === 'INPUT' && diff.name === 'value') {\n          delete node.value;\n        }\n\n        break;\n      case 'modifyTextElement':\n        node.data = diff.newValue;\n\n        if (parentNode.nodeName === 'TEXTAREA') {\n          parentNode.value = diff.newValue;\n        }\n        break;\n      case 'modifyValue':\n        node.value = diff.newValue;\n        break;\n      case 'modifyComment':\n        node.data = diff.newValue;\n        break;\n      case 'modifyChecked':\n        node.checked = diff.newValue;\n        break;\n      case 'modifySelected':\n        node.selected = diff.newValue;\n        break;\n      case 'replaceElement':\n        newNode = cloneObj(diff.newValue);\n        newNode.outerDone = true;\n        newNode.innerDone = true;\n        newNode.valueDone = true;\n        parentNode.childNodes[nodeIndex] = newNode;\n        break;\n      case 'relocateGroup':\n        node.childNodes.splice(diff.from, diff.groupLength).reverse()\n          .forEach(function (movedNode) {\n            node.childNodes.splice(diff.to, 0, movedNode);\n          });\n        break;\n      case 'removeElement':\n        parentNode.childNodes.splice(nodeIndex, 1);\n        break;\n      case 'addElement':\n        route = diff.route.slice();\n        c = route.splice(route.length - 1, 1)[0];\n        node = this.getFromVirtualRoute(tree, route).node;\n        newNode = cloneObj(diff.element);\n        newNode.outerDone = true;\n        newNode.innerDone = true;\n        newNode.valueDone = true;\n\n        if (!node.childNodes) {\n          node.childNodes = [];\n        }\n\n        if (c >= node.childNodes.length) {\n          node.childNodes.push(newNode);\n        } else {\n          node.childNodes.splice(c, 0, newNode);\n        }\n        break;\n      case 'removeTextElement':\n        parentNode.childNodes.splice(nodeIndex, 1);\n        if (parentNode.nodeName === 'TEXTAREA') {\n          delete parentNode.value;\n        }\n        break;\n      case 'addTextElement':\n        route = diff.route.slice();\n        c = route.splice(route.length - 1, 1)[0];\n        newNode = {};\n        newNode.nodeName = '#text';\n        newNode.data = diff.value;\n        node = this.getFromVirtualRoute(tree, route).node;\n        if (!node.childNodes) {\n          node.childNodes = [];\n        }\n\n        if (c >= node.childNodes.length) {\n          node.childNodes.push(newNode);\n        } else {\n          node.childNodes.splice(c, 0, newNode);\n        }\n        if (node.nodeName === 'TEXTAREA') {\n          node.value = diff.newValue;\n        }\n        break;\n      default:\n        console.log('unknown action');\n    }\n\n    return;\n  },\n\n\n  // ===== Apply a diff =====\n\n  apply: function (tree, diffs) {\n    var dobj = this;\n\n    if (diffs.length === 0) {\n      return true;\n    }\n    diffs.forEach(function (diff) {\n      if (!dobj.applyDiff(tree, diff)) {\n        return false;\n      }\n    });\n    return true;\n  },\n  getFromRoute: function (tree, route) {\n    route = route.slice();\n    var c, node = tree;\n    while (route.length > 0) {\n      if (!node.childNodes) {\n        return false;\n      }\n      c = route.splice(0, 1)[0];\n      node = node.childNodes[c];\n    }\n    return node;\n  },\n  applyDiff: function (tree, diff) {\n    var node = this.getFromRoute(tree, diff.route),\n      newNode, reference, route, c;\n\n    switch (diff.action) {\n      case 'addAttribute':\n        if (!node || !node.setAttribute) {\n          return false;\n        }\n        node.setAttribute(diff.name, diff.value);\n        break;\n      case 'modifyAttribute':\n        if (!node || !node.setAttribute) {\n          return false;\n        }\n        node.setAttribute(diff.name, diff.newValue);\n        break;\n      case 'removeAttribute':\n        if (!node || !node.removeAttribute) {\n          return false;\n        }\n        node.removeAttribute(diff.name);\n        break;\n      case 'modifyTextElement':\n        if (!node || node.nodeType !== 3) {\n          return false;\n        }\n        this.textDiff(node, node.data, diff.oldValue, diff.newValue);\n        break;\n      case 'modifyValue':\n        if (!node || typeof node.value === 'undefined') {\n          return false;\n        }\n        node.value = diff.newValue;\n        break;\n      case 'modifyComment':\n        if (!node || typeof node.data === 'undefined') {\n          return false;\n        }\n        node.data = diff.newValue;\n        break;\n      case 'modifyChecked':\n        if (!node || typeof node.checked === 'undefined') {\n          return false;\n        }\n        node.checked = diff.newValue;\n        break;\n      case 'modifySelected':\n        if (!node || typeof node.selected === 'undefined') {\n          return false;\n        }\n        node.selected = diff.newValue;\n        break;\n      case 'replaceElement':\n        node.parentNode.replaceChild(this.objToNode(diff.newValue), node);\n        break;\n      case 'relocateGroup':\n        Array.apply(null, new Array(diff.groupLength)).map(function () {\n          return node.removeChild(node.childNodes[diff.from]);\n        }).forEach(function (childNode, index) {\n          if (index === 0) {\n            reference = node.childNodes[diff.to];\n          }\n          node.insertBefore(childNode, reference);\n        });\n        break;\n      case 'removeElement':\n        node.parentNode.removeChild(node);\n        break;\n      case 'addElement':\n        route = diff.route.slice();\n        c = route.splice(route.length - 1, 1)[0];\n        node = this.getFromRoute(tree, route);\n        node.insertBefore(this.objToNode(diff.element), node.childNodes[c]);\n        break;\n      case 'removeTextElement':\n        if (!node || node.nodeType !== 3) {\n          return false;\n        }\n        node.parentNode.removeChild(node);\n        break;\n      case 'addTextElement':\n        route = diff.route.slice();\n        c = route.splice(route.length - 1, 1)[0];\n        newNode = document.createTextNode(diff.value);\n        node = this.getFromRoute(tree, route);\n        if (!node || !node.childNodes) {\n          return false;\n        }\n        node.insertBefore(newNode, node.childNodes[c]);\n        break;\n      default:\n        console.log('unknown action');\n    }\n\n    return true;\n  },\n\n  // ===== Undo a diff =====\n\n  undo: function (tree, diffs) {\n    diffs = diffs.slice();\n    var dobj = this;\n    if (!diffs.length) {\n      diffs = [diffs];\n    }\n    diffs.reverse();\n    diffs.forEach(function (diff) {\n      dobj.undoDiff(tree, diff);\n    });\n  },\n  undoDiff: function (tree, diff) {\n\n    switch (diff.action) {\n      case 'addAttribute':\n        diff.action = 'removeAttribute';\n        this.applyDiff(tree, diff);\n        break;\n      case 'modifyAttribute':\n        swap(diff, 'oldValue', 'newValue');\n        this.applyDiff(tree, diff);\n        break;\n      case 'removeAttribute':\n        diff.action = 'addAttribute';\n        this.applyDiff(tree, diff);\n        break;\n      case 'modifyTextElement':\n        swap(diff, 'oldValue', 'newValue');\n        this.applyDiff(tree, diff);\n        break;\n      case 'modifyValue':\n        swap(diff, 'oldValue', 'newValue');\n        this.applyDiff(tree, diff);\n        break;\n      case 'modifyComment':\n        swap(diff, 'oldValue', 'newValue');\n        this.applyDiff(tree, diff);\n        break;\n      case 'modifyChecked':\n        swap(diff, 'oldValue', 'newValue');\n        this.applyDiff(tree, diff);\n        break;\n      case 'modifySelected':\n        swap(diff, 'oldValue', 'newValue');\n        this.applyDiff(tree, diff);\n        break;\n      case 'replaceElement':\n        swap(diff, 'oldValue', 'newValue');\n        this.applyDiff(tree, diff);\n        break;\n      case 'relocateGroup':\n        swap(diff, 'from', 'to');\n        this.applyDiff(tree, diff);\n        break;\n      case 'removeElement':\n        diff.action = 'addElement';\n        this.applyDiff(tree, diff);\n        break;\n      case 'addElement':\n        diff.action = 'removeElement';\n        this.applyDiff(tree, diff);\n        break;\n      case 'removeTextElement':\n        diff.action = 'addTextElement';\n        this.applyDiff(tree, diff);\n        break;\n      case 'addTextElement':\n        diff.action = 'removeTextElement';\n        this.applyDiff(tree, diff);\n        break;\n      default:\n        console.log('unknown action');\n    }\n\n  }\n};\n\nwindow.diffDOM = diffDOM;\n"
  },
  {
    "path": "app/templates/app/src/lib/hammer.js",
    "content": "/*! Hammer.JS - v2.0.4 - 2014-09-28\n * http://hammerjs.github.io/\n *\n * Copyright (c) 2014 Jorik Tangelder;\n * Licensed under the MIT license */\n;\n(function (window, document, exportName, undefined) {\n  'use strict';\n\n  var VENDOR_PREFIXES = ['', 'webkit', 'moz', 'MS', 'ms', 'o'];\n  var TEST_ELEMENT = document.createElement('div');\n\n  var TYPE_FUNCTION = 'function';\n\n  var round = Math.round;\n  var abs = Math.abs;\n  var now = Date.now;\n\n  /**\n   * set a timeout with a given scope\n   * @param {Function} fn\n   * @param {Number} timeout\n   * @param {Object} context\n   * @returns {number}\n   */\n  function setTimeoutContext(fn, timeout, context) {\n    return setTimeout(bindFn(fn, context), timeout);\n  }\n\n  /**\n   * if the argument is an array, we want to execute the fn on each entry\n   * if it aint an array we don't want to do a thing.\n   * this is used by all the methods that accept a single and array argument.\n   * @param {*|Array} arg\n   * @param {String} fn\n   * @param {Object} [context]\n   * @returns {Boolean}\n   */\n  function invokeArrayArg(arg, fn, context) {\n    if (Array.isArray(arg)) {\n      each(arg, context[fn], context);\n      return true;\n    }\n    return false;\n  }\n\n  /**\n   * walk objects and arrays\n   * @param {Object} obj\n   * @param {Function} iterator\n   * @param {Object} context\n   */\n  function each(obj, iterator, context) {\n    var i;\n\n    if (!obj) {\n      return;\n    }\n\n    if (obj.forEach) {\n      obj.forEach(iterator, context);\n    } else if (obj.length !== undefined) {\n      i = 0;\n      while (i < obj.length) {\n        iterator.call(context, obj[i], i, obj);\n        i++;\n      }\n    } else {\n      for (i in obj) {\n        obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n      }\n    }\n  }\n\n  /**\n   * extend object.\n   * means that properties in dest will be overwritten by the ones in src.\n   * @param {Object} dest\n   * @param {Object} src\n   * @param {Boolean} [merge]\n   * @returns {Object} dest\n   */\n  function extend(dest, src, merge) {\n    var keys = Object.keys(src);\n    var i = 0;\n    while (i < keys.length) {\n      if (!merge || (merge && dest[keys[i]] === undefined)) {\n        dest[keys[i]] = src[keys[i]];\n      }\n      i++;\n    }\n    return dest;\n  }\n\n  /**\n   * merge the values from src in the dest.\n   * means that properties that exist in dest will not be overwritten by src\n   * @param {Object} dest\n   * @param {Object} src\n   * @returns {Object} dest\n   */\n  function merge(dest, src) {\n    return extend(dest, src, true);\n  }\n\n  /**\n   * simple class inheritance\n   * @param {Function} child\n   * @param {Function} base\n   * @param {Object} [properties]\n   */\n  function inherit(child, base, properties) {\n    var baseP = base.prototype,\n      childP;\n\n    childP = child.prototype = Object.create(baseP);\n    childP.constructor = child;\n    childP._super = baseP;\n\n    if (properties) {\n      extend(childP, properties);\n    }\n  }\n\n  /**\n   * simple function bind\n   * @param {Function} fn\n   * @param {Object} context\n   * @returns {Function}\n   */\n  function bindFn(fn, context) {\n    return function boundFn() {\n      return fn.apply(context, arguments);\n    };\n  }\n\n  /**\n   * let a boolean value also be a function that must return a boolean\n   * this first item in args will be used as the context\n   * @param {Boolean|Function} val\n   * @param {Array} [args]\n   * @returns {Boolean}\n   */\n  function boolOrFn(val, args) {\n    if (typeof val == TYPE_FUNCTION) {\n      return val.apply(args ? args[0] || undefined : undefined, args);\n    }\n    return val;\n  }\n\n  /**\n   * use the val2 when val1 is undefined\n   * @param {*} val1\n   * @param {*} val2\n   * @returns {*}\n   */\n  function ifUndefined(val1, val2) {\n    return (val1 === undefined) ? val2 : val1;\n  }\n\n  /**\n   * addEventListener with multiple events at once\n   * @param {EventTarget} target\n   * @param {String} types\n   * @param {Function} handler\n   */\n  function addEventListeners(target, types, handler) {\n    each(splitStr(types), function (type) {\n      target.addEventListener(type, handler, false);\n    });\n  }\n\n  /**\n   * removeEventListener with multiple events at once\n   * @param {EventTarget} target\n   * @param {String} types\n   * @param {Function} handler\n   */\n  function removeEventListeners(target, types, handler) {\n    each(splitStr(types), function (type) {\n      target.removeEventListener(type, handler, false);\n    });\n  }\n\n  /**\n   * find if a node is in the given parent\n   * @method hasParent\n   * @param {HTMLElement} node\n   * @param {HTMLElement} parent\n   * @return {Boolean} found\n   */\n  function hasParent(node, parent) {\n    while (node) {\n      if (node == parent) {\n        return true;\n      }\n      node = node.parentNode;\n    }\n    return false;\n  }\n\n  /**\n   * small indexOf wrapper\n   * @param {String} str\n   * @param {String} find\n   * @returns {Boolean} found\n   */\n  function inStr(str, find) {\n    return str.indexOf(find) > -1;\n  }\n\n  /**\n   * split string on whitespace\n   * @param {String} str\n   * @returns {Array} words\n   */\n  function splitStr(str) {\n    return str.trim().split(/\\s+/g);\n  }\n\n  /**\n   * find if a array contains the object using indexOf or a simple polyFill\n   * @param {Array} src\n   * @param {String} find\n   * @param {String} [findByKey]\n   * @return {Boolean|Number} false when not found, or the index\n   */\n  function inArray(src, find, findByKey) {\n    if (src.indexOf && !findByKey) {\n      return src.indexOf(find);\n    } else {\n      var i = 0;\n      while (i < src.length) {\n        if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {\n          return i;\n        }\n        i++;\n      }\n      return -1;\n    }\n  }\n\n  /**\n   * convert array-like objects to real arrays\n   * @param {Object} obj\n   * @returns {Array}\n   */\n  function toArray(obj) {\n    return Array.prototype.slice.call(obj, 0);\n  }\n\n  /**\n   * unique array with objects based on a key (like 'id') or just by the array's value\n   * @param {Array} src [{id:1},{id:2},{id:1}]\n   * @param {String} [key]\n   * @param {Boolean} [sort=False]\n   * @returns {Array} [{id:1},{id:2}]\n   */\n  function uniqueArray(src, key, sort) {\n    var results = [];\n    var values = [];\n    var i = 0;\n\n    while (i < src.length) {\n      var val = key ? src[i][key] : src[i];\n      if (inArray(values, val) < 0) {\n        results.push(src[i]);\n      }\n      values[i] = val;\n      i++;\n    }\n\n    if (sort) {\n      if (!key) {\n        results = results.sort();\n      } else {\n        results = results.sort(function sortUniqueArray(a, b) {\n          return a[key] > b[key];\n        });\n      }\n    }\n\n    return results;\n  }\n\n  /**\n   * get the prefixed property\n   * @param {Object} obj\n   * @param {String} property\n   * @returns {String|Undefined} prefixed\n   */\n  function prefixed(obj, property) {\n    var prefix, prop;\n    var camelProp = property[0].toUpperCase() + property.slice(1);\n\n    var i = 0;\n    while (i < VENDOR_PREFIXES.length) {\n      prefix = VENDOR_PREFIXES[i];\n      prop = (prefix) ? prefix + camelProp : property;\n\n      if (prop in obj) {\n        return prop;\n      }\n      i++;\n    }\n    return undefined;\n  }\n\n  /**\n   * get a unique id\n   * @returns {number} uniqueId\n   */\n  var _uniqueId = 1;\n\n  function uniqueId() {\n    return _uniqueId++;\n  }\n\n  /**\n   * get the window object of an element\n   * @param {HTMLElement} element\n   * @returns {DocumentView|Window}\n   */\n  function getWindowForElement(element) {\n    var doc = element.ownerDocument;\n    return (doc.defaultView || doc.parentWindow);\n  }\n\n  var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n\n  var SUPPORT_TOUCH = ('ontouchstart' in window);\n  var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\n  var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n\n  var INPUT_TYPE_TOUCH = 'touch';\n  var INPUT_TYPE_PEN = 'pen';\n  var INPUT_TYPE_MOUSE = 'mouse';\n  var INPUT_TYPE_KINECT = 'kinect';\n\n  var COMPUTE_INTERVAL = 25;\n\n  var INPUT_START = 1;\n  var INPUT_MOVE = 2;\n  var INPUT_END = 4;\n  var INPUT_CANCEL = 8;\n\n  var DIRECTION_NONE = 1;\n  var DIRECTION_LEFT = 2;\n  var DIRECTION_RIGHT = 4;\n  var DIRECTION_UP = 8;\n  var DIRECTION_DOWN = 16;\n\n  var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\n  var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\n  var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n\n  var PROPS_XY = ['x', 'y'];\n  var PROPS_CLIENT_XY = ['clientX', 'clientY'];\n\n  /**\n   * create new input type manager\n   * @param {Manager} manager\n   * @param {Function} callback\n   * @returns {Input}\n   * @constructor\n   */\n  function Input(manager, callback) {\n    var self = this;\n    this.manager = manager;\n    this.callback = callback;\n    this.element = manager.element;\n    this.target = manager.options.inputTarget;\n\n    // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n    // so when disabled the input events are completely bypassed.\n    this.domHandler = function (ev) {\n      if (boolOrFn(manager.options.enable, [manager])) {\n        self.handler(ev);\n      }\n    };\n\n    this.init();\n\n  }\n\n  Input.prototype = {\n    /**\n     * should handle the inputEvent data and trigger the callback\n     * @virtual\n     */\n    handler: function () {\n    },\n\n    /**\n     * bind the events\n     */\n    init: function () {\n      this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n      this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n      this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n    },\n\n    /**\n     * unbind the events\n     */\n    destroy: function () {\n      this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n      this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n      this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n    }\n  };\n\n  /**\n   * create new input type manager\n   * called by the Manager constructor\n   * @param {Hammer} manager\n   * @returns {Input}\n   */\n  function createInputInstance(manager) {\n    var Type;\n    var inputClass = manager.options.inputClass;\n\n    if (inputClass) {\n      Type = inputClass;\n    } else if (SUPPORT_POINTER_EVENTS) {\n      Type = PointerEventInput;\n    } else if (SUPPORT_ONLY_TOUCH) {\n      Type = TouchInput;\n    } else if (!SUPPORT_TOUCH) {\n      Type = MouseInput;\n    } else {\n      Type = TouchMouseInput;\n    }\n    return new (Type)(manager, inputHandler);\n  }\n\n  /**\n   * handle input events\n   * @param {Manager} manager\n   * @param {String} eventType\n   * @param {Object} input\n   */\n  function inputHandler(manager, eventType, input) {\n    var pointersLen = input.pointers.length;\n    var changedPointersLen = input.changedPointers.length;\n    var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));\n    var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));\n\n    input.isFirst = !!isFirst;\n    input.isFinal = !!isFinal;\n\n    if (isFirst) {\n      manager.session = {};\n    }\n\n    // source event is the normalized value of the domEvents\n    // like 'touchstart, mouseup, pointerdown'\n    input.eventType = eventType;\n\n    // compute scale, rotation etc\n    computeInputData(manager, input);\n\n    // emit secret event\n    manager.emit('hammer.input', input);\n\n    manager.recognize(input);\n    manager.session.prevInput = input;\n  }\n\n  /**\n   * extend the data with some usable properties like scale, rotate, velocity etc\n   * @param {Object} manager\n   * @param {Object} input\n   */\n  function computeInputData(manager, input) {\n    var session = manager.session;\n    var pointers = input.pointers;\n    var pointersLength = pointers.length;\n\n    // store the first input to calculate the distance and direction\n    if (!session.firstInput) {\n      session.firstInput = simpleCloneInputData(input);\n    }\n\n    // to compute scale and rotation we need to store the multiple touches\n    if (pointersLength > 1 && !session.firstMultiple) {\n      session.firstMultiple = simpleCloneInputData(input);\n    } else if (pointersLength === 1) {\n      session.firstMultiple = false;\n    }\n\n    var firstInput = session.firstInput;\n    var firstMultiple = session.firstMultiple;\n    var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n\n    var center = input.center = getCenter(pointers);\n    input.timeStamp = now();\n    input.deltaTime = input.timeStamp - firstInput.timeStamp;\n\n    input.angle = getAngle(offsetCenter, center);\n    input.distance = getDistance(offsetCenter, center);\n\n    computeDeltaXY(session, input);\n    input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n\n    input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n    input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n\n    computeIntervalInputData(session, input);\n\n    // find the correct target\n    var target = manager.element;\n    if (hasParent(input.srcEvent.target, target)) {\n      target = input.srcEvent.target;\n    }\n    input.target = target;\n  }\n\n  function computeDeltaXY(session, input) {\n    var center = input.center;\n    var offset = session.offsetDelta || {};\n    var prevDelta = session.prevDelta || {};\n    var prevInput = session.prevInput || {};\n\n    if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n      prevDelta = session.prevDelta = {\n        x: prevInput.deltaX || 0,\n        y: prevInput.deltaY || 0\n      };\n\n      offset = session.offsetDelta = {\n        x: center.x,\n        y: center.y\n      };\n    }\n\n    input.deltaX = prevDelta.x + (center.x - offset.x);\n    input.deltaY = prevDelta.y + (center.y - offset.y);\n  }\n\n  /**\n   * velocity is calculated every x ms\n   * @param {Object} session\n   * @param {Object} input\n   */\n  function computeIntervalInputData(session, input) {\n    var last = session.lastInterval || input,\n      deltaTime = input.timeStamp - last.timeStamp,\n      velocity, velocityX, velocityY, direction;\n\n    if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n      var deltaX = last.deltaX - input.deltaX;\n      var deltaY = last.deltaY - input.deltaY;\n\n      var v = getVelocity(deltaTime, deltaX, deltaY);\n      velocityX = v.x;\n      velocityY = v.y;\n      velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;\n      direction = getDirection(deltaX, deltaY);\n\n      session.lastInterval = input;\n    } else {\n      // use latest velocity info if it doesn't overtake a minimum period\n      velocity = last.velocity;\n      velocityX = last.velocityX;\n      velocityY = last.velocityY;\n      direction = last.direction;\n    }\n\n    input.velocity = velocity;\n    input.velocityX = velocityX;\n    input.velocityY = velocityY;\n    input.direction = direction;\n  }\n\n  /**\n   * create a simple clone from the input used for storage of firstInput and firstMultiple\n   * @param {Object} input\n   * @returns {Object} clonedInputData\n   */\n  function simpleCloneInputData(input) {\n    // make a simple copy of the pointers because we will get a reference if we don't\n    // we only need clientXY for the calculations\n    var pointers = [];\n    var i = 0;\n    while (i < input.pointers.length) {\n      pointers[i] = {\n        clientX: round(input.pointers[i].clientX),\n        clientY: round(input.pointers[i].clientY)\n      };\n      i++;\n    }\n\n    return {\n      timeStamp: now(),\n      pointers: pointers,\n      center: getCenter(pointers),\n      deltaX: input.deltaX,\n      deltaY: input.deltaY\n    };\n  }\n\n  /**\n   * get the center of all the pointers\n   * @param {Array} pointers\n   * @return {Object} center contains `x` and `y` properties\n   */\n  function getCenter(pointers) {\n    var pointersLength = pointers.length;\n\n    // no need to loop when only one touch\n    if (pointersLength === 1) {\n      return {\n        x: round(pointers[0].clientX),\n        y: round(pointers[0].clientY)\n      };\n    }\n\n    var x = 0, y = 0, i = 0;\n    while (i < pointersLength) {\n      x += pointers[i].clientX;\n      y += pointers[i].clientY;\n      i++;\n    }\n\n    return {\n      x: round(x / pointersLength),\n      y: round(y / pointersLength)\n    };\n  }\n\n  /**\n   * calculate the velocity between two points. unit is in px per ms.\n   * @param {Number} deltaTime\n   * @param {Number} x\n   * @param {Number} y\n   * @return {Object} velocity `x` and `y`\n   */\n  function getVelocity(deltaTime, x, y) {\n    return {\n      x: x / deltaTime || 0,\n      y: y / deltaTime || 0\n    };\n  }\n\n  /**\n   * get the direction between two points\n   * @param {Number} x\n   * @param {Number} y\n   * @return {Number} direction\n   */\n  function getDirection(x, y) {\n    if (x === y) {\n      return DIRECTION_NONE;\n    }\n\n    if (abs(x) >= abs(y)) {\n      return x > 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n    }\n    return y > 0 ? DIRECTION_UP : DIRECTION_DOWN;\n  }\n\n  /**\n   * calculate the absolute distance between two points\n   * @param {Object} p1 {x, y}\n   * @param {Object} p2 {x, y}\n   * @param {Array} [props] containing x and y keys\n   * @return {Number} distance\n   */\n  function getDistance(p1, p2, props) {\n    if (!props) {\n      props = PROPS_XY;\n    }\n    var x = p2[props[0]] - p1[props[0]],\n      y = p2[props[1]] - p1[props[1]];\n\n    return Math.sqrt((x * x) + (y * y));\n  }\n\n  /**\n   * calculate the angle between two coordinates\n   * @param {Object} p1\n   * @param {Object} p2\n   * @param {Array} [props] containing x and y keys\n   * @return {Number} angle\n   */\n  function getAngle(p1, p2, props) {\n    if (!props) {\n      props = PROPS_XY;\n    }\n    var x = p2[props[0]] - p1[props[0]],\n      y = p2[props[1]] - p1[props[1]];\n    return Math.atan2(y, x) * 180 / Math.PI;\n  }\n\n  /**\n   * calculate the rotation degrees between two pointersets\n   * @param {Array} start array of pointers\n   * @param {Array} end array of pointers\n   * @return {Number} rotation\n   */\n  function getRotation(start, end) {\n    return getAngle(end[1], end[0], PROPS_CLIENT_XY) - getAngle(start[1], start[0], PROPS_CLIENT_XY);\n  }\n\n  /**\n   * calculate the scale factor between two pointersets\n   * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n   * @param {Array} start array of pointers\n   * @param {Array} end array of pointers\n   * @return {Number} scale\n   */\n  function getScale(start, end) {\n    return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n  }\n\n  var MOUSE_INPUT_MAP = {\n    mousedown: INPUT_START,\n    mousemove: INPUT_MOVE,\n    mouseup: INPUT_END\n  };\n\n  var MOUSE_ELEMENT_EVENTS = 'mousedown';\n  var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n\n  /**\n   * Mouse events input\n   * @constructor\n   * @extends Input\n   */\n  function MouseInput() {\n    this.evEl = MOUSE_ELEMENT_EVENTS;\n    this.evWin = MOUSE_WINDOW_EVENTS;\n\n    this.allow = true; // used by Input.TouchMouse to disable mouse events\n    this.pressed = false; // mousedown state\n\n    Input.apply(this, arguments);\n  }\n\n  inherit(MouseInput, Input, {\n    /**\n     * handle mouse events\n     * @param {Object} ev\n     */\n    handler: function MEhandler(ev) {\n      var eventType = MOUSE_INPUT_MAP[ev.type];\n\n      // on start we want to have the left mouse button down\n      if (eventType & INPUT_START && ev.button === 0) {\n        this.pressed = true;\n      }\n\n      if (eventType & INPUT_MOVE && ev.which !== 1) {\n        eventType = INPUT_END;\n      }\n\n      // mouse must be down, and mouse events are allowed (see the TouchMouse input)\n      if (!this.pressed || !this.allow) {\n        return;\n      }\n\n      if (eventType & INPUT_END) {\n        this.pressed = false;\n      }\n\n      this.callback(this.manager, eventType, {\n        pointers: [ev],\n        changedPointers: [ev],\n        pointerType: INPUT_TYPE_MOUSE,\n        srcEvent: ev\n      });\n    }\n  });\n\n  var POINTER_INPUT_MAP = {\n    pointerdown: INPUT_START,\n    pointermove: INPUT_MOVE,\n    pointerup: INPUT_END,\n    pointercancel: INPUT_CANCEL,\n    pointerout: INPUT_CANCEL\n  };\n\n// in IE10 the pointer types is defined as an enum\n  var IE10_POINTER_TYPE_ENUM = {\n    2: INPUT_TYPE_TOUCH,\n    3: INPUT_TYPE_PEN,\n    4: INPUT_TYPE_MOUSE,\n    5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n  };\n\n  var POINTER_ELEMENT_EVENTS = 'pointerdown';\n  var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n\n// IE10 has prefixed support, and case-sensitive\n  if (window.MSPointerEvent) {\n    POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n    POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n  }\n\n  /**\n   * Pointer events input\n   * @constructor\n   * @extends Input\n   */\n  function PointerEventInput() {\n    this.evEl = POINTER_ELEMENT_EVENTS;\n    this.evWin = POINTER_WINDOW_EVENTS;\n\n    Input.apply(this, arguments);\n\n    this.store = (this.manager.session.pointerEvents = []);\n  }\n\n  inherit(PointerEventInput, Input, {\n    /**\n     * handle mouse events\n     * @param {Object} ev\n     */\n    handler: function PEhandler(ev) {\n      var store = this.store;\n      var removePointer = false;\n\n      var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n      var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n      var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n\n      var isTouch = (pointerType == INPUT_TYPE_TOUCH);\n\n      // get index of the event in the store\n      var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n\n      // start and mouse must be down\n      if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n        if (storeIndex < 0) {\n          store.push(ev);\n          storeIndex = store.length - 1;\n        }\n      } else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n        removePointer = true;\n      }\n\n      // it not found, so the pointer hasn't been down (so it's probably a hover)\n      if (storeIndex < 0) {\n        return;\n      }\n\n      // update the event in the store\n      store[storeIndex] = ev;\n\n      this.callback(this.manager, eventType, {\n        pointers: store,\n        changedPointers: [ev],\n        pointerType: pointerType,\n        srcEvent: ev\n      });\n\n      if (removePointer) {\n        // remove from the store\n        store.splice(storeIndex, 1);\n      }\n    }\n  });\n\n  var SINGLE_TOUCH_INPUT_MAP = {\n    touchstart: INPUT_START,\n    touchmove: INPUT_MOVE,\n    touchend: INPUT_END,\n    touchcancel: INPUT_CANCEL\n  };\n\n  var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\n  var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n  /**\n   * Touch events input\n   * @constructor\n   * @extends Input\n   */\n  function SingleTouchInput() {\n    this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n    this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n    this.started = false;\n\n    Input.apply(this, arguments);\n  }\n\n  inherit(SingleTouchInput, Input, {\n    handler: function TEhandler(ev) {\n      var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n\n      // should we handle the touch events?\n      if (type === INPUT_START) {\n        this.started = true;\n      }\n\n      if (!this.started) {\n        return;\n      }\n\n      var touches = normalizeSingleTouches.call(this, ev, type);\n\n      // when done, reset the started state\n      if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n        this.started = false;\n      }\n\n      this.callback(this.manager, type, {\n        pointers: touches[0],\n        changedPointers: touches[1],\n        pointerType: INPUT_TYPE_TOUCH,\n        srcEvent: ev\n      });\n    }\n  });\n\n  /**\n   * @this {TouchInput}\n   * @param {Object} ev\n   * @param {Number} type flag\n   * @returns {undefined|Array} [all, changed]\n   */\n  function normalizeSingleTouches(ev, type) {\n    var all = toArray(ev.touches);\n    var changed = toArray(ev.changedTouches);\n\n    if (type & (INPUT_END | INPUT_CANCEL)) {\n      all = uniqueArray(all.concat(changed), 'identifier', true);\n    }\n\n    return [all, changed];\n  }\n\n  var TOUCH_INPUT_MAP = {\n    touchstart: INPUT_START,\n    touchmove: INPUT_MOVE,\n    touchend: INPUT_END,\n    touchcancel: INPUT_CANCEL\n  };\n\n  var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n\n  /**\n   * Multi-user touch events input\n   * @constructor\n   * @extends Input\n   */\n  function TouchInput() {\n    this.evTarget = TOUCH_TARGET_EVENTS;\n    this.targetIds = {};\n\n    Input.apply(this, arguments);\n  }\n\n  inherit(TouchInput, Input, {\n    handler: function MTEhandler(ev) {\n      var type = TOUCH_INPUT_MAP[ev.type];\n      var touches = getTouches.call(this, ev, type);\n      if (!touches) {\n        return;\n      }\n\n      this.callback(this.manager, type, {\n        pointers: touches[0],\n        changedPointers: touches[1],\n        pointerType: INPUT_TYPE_TOUCH,\n        srcEvent: ev\n      });\n    }\n  });\n\n  /**\n   * @this {TouchInput}\n   * @param {Object} ev\n   * @param {Number} type flag\n   * @returns {undefined|Array} [all, changed]\n   */\n  function getTouches(ev, type) {\n    var allTouches = toArray(ev.touches);\n    var targetIds = this.targetIds;\n\n    // when there is only one touch, the process can be simplified\n    if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n      targetIds[allTouches[0].identifier] = true;\n      return [allTouches, allTouches];\n    }\n\n    var i,\n      targetTouches,\n      changedTouches = toArray(ev.changedTouches),\n      changedTargetTouches = [],\n      target = this.target;\n\n    // get target touches from touches\n    targetTouches = allTouches.filter(function (touch) {\n      return hasParent(touch.target, target);\n    });\n\n    // collect touches\n    if (type === INPUT_START) {\n      i = 0;\n      while (i < targetTouches.length) {\n        targetIds[targetTouches[i].identifier] = true;\n        i++;\n      }\n    }\n\n    // filter changed touches to only contain touches that exist in the collected target ids\n    i = 0;\n    while (i < changedTouches.length) {\n      if (targetIds[changedTouches[i].identifier]) {\n        changedTargetTouches.push(changedTouches[i]);\n      }\n\n      // cleanup removed touches\n      if (type & (INPUT_END | INPUT_CANCEL)) {\n        delete targetIds[changedTouches[i].identifier];\n      }\n      i++;\n    }\n\n    if (!changedTargetTouches.length) {\n      return;\n    }\n\n    return [\n      // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n      uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),\n      changedTargetTouches\n    ];\n  }\n\n  /**\n   * Combined touch and mouse input\n   *\n   * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n   * This because touch devices also emit mouse events while doing a touch.\n   *\n   * @constructor\n   * @extends Input\n   */\n  function TouchMouseInput() {\n    Input.apply(this, arguments);\n\n    var handler = bindFn(this.handler, this);\n    this.touch = new TouchInput(this.manager, handler);\n    this.mouse = new MouseInput(this.manager, handler);\n  }\n\n  inherit(TouchMouseInput, Input, {\n    /**\n     * handle mouse and touch events\n     * @param {Hammer} manager\n     * @param {String} inputEvent\n     * @param {Object} inputData\n     */\n    handler: function TMEhandler(manager, inputEvent, inputData) {\n      var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),\n        isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);\n\n      // when we're in a touch event, so  block all upcoming mouse events\n      // most mobile browser also emit mouseevents, right after touchstart\n      if (isTouch) {\n        this.mouse.allow = false;\n      } else if (isMouse && !this.mouse.allow) {\n        return;\n      }\n\n      // reset the allowMouse when we're done\n      if (inputEvent & (INPUT_END | INPUT_CANCEL)) {\n        this.mouse.allow = true;\n      }\n\n      this.callback(manager, inputEvent, inputData);\n    },\n\n    /**\n     * remove the event listeners\n     */\n    destroy: function destroy() {\n      this.touch.destroy();\n      this.mouse.destroy();\n    }\n  });\n\n  var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\n  var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n\n// magical touchAction value\n  var TOUCH_ACTION_COMPUTE = 'compute';\n  var TOUCH_ACTION_AUTO = 'auto';\n  var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n  var TOUCH_ACTION_NONE = 'none';\n  var TOUCH_ACTION_PAN_X = 'pan-x';\n  var TOUCH_ACTION_PAN_Y = 'pan-y';\n\n  /**\n   * Touch Action\n   * sets the touchAction property or uses the js alternative\n   * @param {Manager} manager\n   * @param {String} value\n   * @constructor\n   */\n  function TouchAction(manager, value) {\n    this.manager = manager;\n    this.set(value);\n  }\n\n  TouchAction.prototype = {\n    /**\n     * set the touchAction value on the element or enable the polyfill\n     * @param {String} value\n     */\n    set: function (value) {\n      // find out the touch-action by the event handlers\n      if (value == TOUCH_ACTION_COMPUTE) {\n        value = this.compute();\n      }\n\n      if (NATIVE_TOUCH_ACTION) {\n        this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n      }\n      this.actions = value.toLowerCase().trim();\n    },\n\n    /**\n     * just re-set the touchAction value\n     */\n    update: function () {\n      this.set(this.manager.options.touchAction);\n    },\n\n    /**\n     * compute the value for the touchAction property based on the recognizer's settings\n     * @returns {String} value\n     */\n    compute: function () {\n      var actions = [];\n      each(this.manager.recognizers, function (recognizer) {\n        if (boolOrFn(recognizer.options.enable, [recognizer])) {\n          actions = actions.concat(recognizer.getTouchAction());\n        }\n      });\n      return cleanTouchActions(actions.join(' '));\n    },\n\n    /**\n     * this method is called on each input cycle and provides the preventing of the browser behavior\n     * @param {Object} input\n     */\n    preventDefaults: function (input) {\n      // not needed with native support for the touchAction property\n      if (NATIVE_TOUCH_ACTION) {\n        return;\n      }\n\n      var srcEvent = input.srcEvent;\n      var direction = input.offsetDirection;\n\n      // if the touch action did prevented once this session\n      if (this.manager.session.prevented) {\n        srcEvent.preventDefault();\n        return;\n      }\n\n      var actions = this.actions;\n      var hasNone = inStr(actions, TOUCH_ACTION_NONE);\n      var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n      var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n\n      if (hasNone ||\n        (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n        (hasPanX && direction & DIRECTION_VERTICAL)) {\n        return this.preventSrc(srcEvent);\n      }\n    },\n\n    /**\n     * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n     * @param {Object} srcEvent\n     */\n    preventSrc: function (srcEvent) {\n      this.manager.session.prevented = true;\n      srcEvent.preventDefault();\n    }\n  };\n\n  /**\n   * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n   * @param {String} actions\n   * @returns {*}\n   */\n  function cleanTouchActions(actions) {\n    // none\n    if (inStr(actions, TOUCH_ACTION_NONE)) {\n      return TOUCH_ACTION_NONE;\n    }\n\n    var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n    var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n\n    // pan-x and pan-y can be combined\n    if (hasPanX && hasPanY) {\n      return TOUCH_ACTION_PAN_X + ' ' + TOUCH_ACTION_PAN_Y;\n    }\n\n    // pan-x OR pan-y\n    if (hasPanX || hasPanY) {\n      return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n    }\n\n    // manipulation\n    if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n      return TOUCH_ACTION_MANIPULATION;\n    }\n\n    return TOUCH_ACTION_AUTO;\n  }\n\n  /**\n   * Recognizer flow explained; *\n   * All recognizers have the initial state of POSSIBLE when a input session starts.\n   * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n   * Example session for mouse-input: mousedown -> mousemove -> mouseup\n   *\n   * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n   * which determines with state it should be.\n   *\n   * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n   * POSSIBLE to give it another change on the next cycle.\n   *\n   *               Possible\n   *                  |\n   *            +-----+---------------+\n   *            |                     |\n   *      +-----+-----+               |\n   *      |           |               |\n   *   Failed      Cancelled          |\n   *                          +-------+------+\n   *                          |              |\n   *                      Recognized       Began\n   *                                         |\n   *                                      Changed\n   *                                         |\n   *                                  Ended/Recognized\n   */\n  var STATE_POSSIBLE = 1;\n  var STATE_BEGAN = 2;\n  var STATE_CHANGED = 4;\n  var STATE_ENDED = 8;\n  var STATE_RECOGNIZED = STATE_ENDED;\n  var STATE_CANCELLED = 16;\n  var STATE_FAILED = 32;\n\n  /**\n   * Recognizer\n   * Every recognizer needs to extend from this class.\n   * @constructor\n   * @param {Object} options\n   */\n  function Recognizer(options) {\n    this.id = uniqueId();\n\n    this.manager = null;\n    this.options = merge(options || {}, this.defaults);\n\n    // default is enable true\n    this.options.enable = ifUndefined(this.options.enable, true);\n\n    this.state = STATE_POSSIBLE;\n\n    this.simultaneous = {};\n    this.requireFail = [];\n  }\n\n  Recognizer.prototype = {\n    /**\n     * @virtual\n     * @type {Object}\n     */\n    defaults: {},\n\n    /**\n     * set options\n     * @param {Object} options\n     * @return {Recognizer}\n     */\n    set: function (options) {\n      extend(this.options, options);\n\n      // also update the touchAction, in case something changed about the directions/enabled state\n      this.manager && this.manager.touchAction.update();\n      return this;\n    },\n\n    /**\n     * recognize simultaneous with an other recognizer.\n     * @param {Recognizer} otherRecognizer\n     * @returns {Recognizer} this\n     */\n    recognizeWith: function (otherRecognizer) {\n      if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n        return this;\n      }\n\n      var simultaneous = this.simultaneous;\n      otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n      if (!simultaneous[otherRecognizer.id]) {\n        simultaneous[otherRecognizer.id] = otherRecognizer;\n        otherRecognizer.recognizeWith(this);\n      }\n      return this;\n    },\n\n    /**\n     * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n     * @param {Recognizer} otherRecognizer\n     * @returns {Recognizer} this\n     */\n    dropRecognizeWith: function (otherRecognizer) {\n      if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n        return this;\n      }\n\n      otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n      delete this.simultaneous[otherRecognizer.id];\n      return this;\n    },\n\n    /**\n     * recognizer can only run when an other is failing\n     * @param {Recognizer} otherRecognizer\n     * @returns {Recognizer} this\n     */\n    requireFailure: function (otherRecognizer) {\n      if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n        return this;\n      }\n\n      var requireFail = this.requireFail;\n      otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n      if (inArray(requireFail, otherRecognizer) === -1) {\n        requireFail.push(otherRecognizer);\n        otherRecognizer.requireFailure(this);\n      }\n      return this;\n    },\n\n    /**\n     * drop the requireFailure link. it does not remove the link on the other recognizer.\n     * @param {Recognizer} otherRecognizer\n     * @returns {Recognizer} this\n     */\n    dropRequireFailure: function (otherRecognizer) {\n      if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n        return this;\n      }\n\n      otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n      var index = inArray(this.requireFail, otherRecognizer);\n      if (index > -1) {\n        this.requireFail.splice(index, 1);\n      }\n      return this;\n    },\n\n    /**\n     * has require failures boolean\n     * @returns {boolean}\n     */\n    hasRequireFailures: function () {\n      return this.requireFail.length > 0;\n    },\n\n    /**\n     * if the recognizer can recognize simultaneous with an other recognizer\n     * @param {Recognizer} otherRecognizer\n     * @returns {Boolean}\n     */\n    canRecognizeWith: function (otherRecognizer) {\n      return !!this.simultaneous[otherRecognizer.id];\n    },\n\n    /**\n     * You should use `tryEmit` instead of `emit` directly to check\n     * that all the needed recognizers has failed before emitting.\n     * @param {Object} input\n     */\n    emit: function (input) {\n      var self = this;\n      var state = this.state;\n\n      function emit(withState) {\n        self.manager.emit(self.options.event + (withState ? stateStr(state) : ''), input);\n      }\n\n      // 'panstart' and 'panmove'\n      if (state < STATE_ENDED) {\n        emit(true);\n      }\n\n      emit(); // simple 'eventName' events\n\n      // panend and pancancel\n      if (state >= STATE_ENDED) {\n        emit(true);\n      }\n    },\n\n    /**\n     * Check that all the require failure recognizers has failed,\n     * if true, it emits a gesture event,\n     * otherwise, setup the state to FAILED.\n     * @param {Object} input\n     */\n    tryEmit: function (input) {\n      if (this.canEmit()) {\n        return this.emit(input);\n      }\n      // it's failing anyway\n      this.state = STATE_FAILED;\n    },\n\n    /**\n     * can we emit?\n     * @returns {boolean}\n     */\n    canEmit: function () {\n      var i = 0;\n      while (i < this.requireFail.length) {\n        if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n          return false;\n        }\n        i++;\n      }\n      return true;\n    },\n\n    /**\n     * update the recognizer\n     * @param {Object} inputData\n     */\n    recognize: function (inputData) {\n      // make a new copy of the inputData\n      // so we can change the inputData without messing up the other recognizers\n      var inputDataClone = extend({}, inputData);\n\n      // is is enabled and allow recognizing?\n      if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n        this.reset();\n        this.state = STATE_FAILED;\n        return;\n      }\n\n      // reset when we've reached the end\n      if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n        this.state = STATE_POSSIBLE;\n      }\n\n      this.state = this.process(inputDataClone);\n\n      // the recognizer has recognized a gesture\n      // so trigger an event\n      if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n        this.tryEmit(inputDataClone);\n      }\n    },\n\n    /**\n     * return the state of the recognizer\n     * the actual recognizing happens in this method\n     * @virtual\n     * @param {Object} inputData\n     * @returns {Const} STATE\n     */\n    process: function (inputData) {\n    }, // jshint ignore:line\n\n    /**\n     * return the preferred touch-action\n     * @virtual\n     * @returns {Array}\n     */\n    getTouchAction: function () {\n    },\n\n    /**\n     * called when the gesture isn't allowed to recognize\n     * like when another is being recognized or it is disabled\n     * @virtual\n     */\n    reset: function () {\n    }\n  };\n\n  /**\n   * get a usable string, used as event postfix\n   * @param {Const} state\n   * @returns {String} state\n   */\n  function stateStr(state) {\n    if (state & STATE_CANCELLED) {\n      return 'cancel';\n    } else if (state & STATE_ENDED) {\n      return 'end';\n    } else if (state & STATE_CHANGED) {\n      return 'move';\n    } else if (state & STATE_BEGAN) {\n      return 'start';\n    }\n    return '';\n  }\n\n  /**\n   * direction cons to string\n   * @param {Const} direction\n   * @returns {String}\n   */\n  function directionStr(direction) {\n    if (direction == DIRECTION_DOWN) {\n      return 'down';\n    } else if (direction == DIRECTION_UP) {\n      return 'up';\n    } else if (direction == DIRECTION_LEFT) {\n      return 'left';\n    } else if (direction == DIRECTION_RIGHT) {\n      return 'right';\n    }\n    return '';\n  }\n\n  /**\n   * get a recognizer by name if it is bound to a manager\n   * @param {Recognizer|String} otherRecognizer\n   * @param {Recognizer} recognizer\n   * @returns {Recognizer}\n   */\n  function getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n    var manager = recognizer.manager;\n    if (manager) {\n      return manager.get(otherRecognizer);\n    }\n    return otherRecognizer;\n  }\n\n  /**\n   * This recognizer is just used as a base for the simple attribute recognizers.\n   * @constructor\n   * @extends Recognizer\n   */\n  function AttrRecognizer() {\n    Recognizer.apply(this, arguments);\n  }\n\n  inherit(AttrRecognizer, Recognizer, {\n    /**\n     * @namespace\n     * @memberof AttrRecognizer\n     */\n    defaults: {\n      /**\n       * @type {Number}\n       * @default 1\n       */\n      pointers: 1\n    },\n\n    /**\n     * Used to check if it the recognizer receives valid input, like input.distance > 10.\n     * @memberof AttrRecognizer\n     * @param {Object} input\n     * @returns {Boolean} recognized\n     */\n    attrTest: function (input) {\n      var optionPointers = this.options.pointers;\n      return optionPointers === 0 || input.pointers.length === optionPointers;\n    },\n\n    /**\n     * Process the input and return the state for the recognizer\n     * @memberof AttrRecognizer\n     * @param {Object} input\n     * @returns {*} State\n     */\n    process: function (input) {\n      var state = this.state;\n      var eventType = input.eventType;\n\n      var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n      var isValid = this.attrTest(input);\n\n      // on cancel input and we've recognized before, return STATE_CANCELLED\n      if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n        return state | STATE_CANCELLED;\n      } else if (isRecognized || isValid) {\n        if (eventType & INPUT_END) {\n          return state | STATE_ENDED;\n        } else if (!(state & STATE_BEGAN)) {\n          return STATE_BEGAN;\n        }\n        return state | STATE_CHANGED;\n      }\n      return STATE_FAILED;\n    }\n  });\n\n  /**\n   * Pan\n   * Recognized when the pointer is down and moved in the allowed direction.\n   * @constructor\n   * @extends AttrRecognizer\n   */\n  function PanRecognizer() {\n    AttrRecognizer.apply(this, arguments);\n\n    this.pX = null;\n    this.pY = null;\n  }\n\n  inherit(PanRecognizer, AttrRecognizer, {\n    /**\n     * @namespace\n     * @memberof PanRecognizer\n     */\n    defaults: {\n      event: 'pan',\n      threshold: 10,\n      pointers: 1,\n      direction: DIRECTION_ALL\n    },\n\n    getTouchAction: function () {\n      var direction = this.options.direction;\n      var actions = [];\n      if (direction & DIRECTION_HORIZONTAL) {\n        actions.push(TOUCH_ACTION_PAN_Y);\n      }\n      if (direction & DIRECTION_VERTICAL) {\n        actions.push(TOUCH_ACTION_PAN_X);\n      }\n      return actions;\n    },\n\n    directionTest: function (input) {\n      var options = this.options;\n      var hasMoved = true;\n      var distance = input.distance;\n      var direction = input.direction;\n      var x = input.deltaX;\n      var y = input.deltaY;\n\n      // lock to axis?\n      if (!(direction & options.direction)) {\n        if (options.direction & DIRECTION_HORIZONTAL) {\n          direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;\n          hasMoved = x != this.pX;\n          distance = Math.abs(input.deltaX);\n        } else {\n          direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;\n          hasMoved = y != this.pY;\n          distance = Math.abs(input.deltaY);\n        }\n      }\n      input.direction = direction;\n      return hasMoved && distance > options.threshold && direction & options.direction;\n    },\n\n    attrTest: function (input) {\n      return AttrRecognizer.prototype.attrTest.call(this, input) &&\n        (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));\n    },\n\n    emit: function (input) {\n      this.pX = input.deltaX;\n      this.pY = input.deltaY;\n\n      var direction = directionStr(input.direction);\n      if (direction) {\n        this.manager.emit(this.options.event + direction, input);\n      }\n\n      this._super.emit.call(this, input);\n    }\n  });\n\n  /**\n   * Pinch\n   * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n   * @constructor\n   * @extends AttrRecognizer\n   */\n  function PinchRecognizer() {\n    AttrRecognizer.apply(this, arguments);\n  }\n\n  inherit(PinchRecognizer, AttrRecognizer, {\n    /**\n     * @namespace\n     * @memberof PinchRecognizer\n     */\n    defaults: {\n      event: 'pinch',\n      threshold: 0,\n      pointers: 2\n    },\n\n    getTouchAction: function () {\n      return [TOUCH_ACTION_NONE];\n    },\n\n    attrTest: function (input) {\n      return this._super.attrTest.call(this, input) &&\n        (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n    },\n\n    emit: function (input) {\n      this._super.emit.call(this, input);\n      if (input.scale !== 1) {\n        var inOut = input.scale < 1 ? 'in' : 'out';\n        this.manager.emit(this.options.event + inOut, input);\n      }\n    }\n  });\n\n  /**\n   * Press\n   * Recognized when the pointer is down for x ms without any movement.\n   * @constructor\n   * @extends Recognizer\n   */\n  function PressRecognizer() {\n    Recognizer.apply(this, arguments);\n\n    this._timer = null;\n    this._input = null;\n  }\n\n  inherit(PressRecognizer, Recognizer, {\n    /**\n     * @namespace\n     * @memberof PressRecognizer\n     */\n    defaults: {\n      event: 'press',\n      pointers: 1,\n      time: 500, // minimal time of the pointer to be pressed\n      threshold: 5 // a minimal movement is ok, but keep it low\n    },\n\n    getTouchAction: function () {\n      return [TOUCH_ACTION_AUTO];\n    },\n\n    process: function (input) {\n      var options = this.options;\n      var validPointers = input.pointers.length === options.pointers;\n      var validMovement = input.distance < options.threshold;\n      var validTime = input.deltaTime > options.time;\n\n      this._input = input;\n\n      // we only allow little movement\n      // and we've reached an end event, so a tap is possible\n      if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {\n        this.reset();\n      } else if (input.eventType & INPUT_START) {\n        this.reset();\n        this._timer = setTimeoutContext(function () {\n          this.state = STATE_RECOGNIZED;\n          this.tryEmit();\n        }, options.time, this);\n      } else if (input.eventType & INPUT_END) {\n        return STATE_RECOGNIZED;\n      }\n      return STATE_FAILED;\n    },\n\n    reset: function () {\n      clearTimeout(this._timer);\n    },\n\n    emit: function (input) {\n      if (this.state !== STATE_RECOGNIZED) {\n        return;\n      }\n\n      if (input && (input.eventType & INPUT_END)) {\n        this.manager.emit(this.options.event + 'up', input);\n      } else {\n        this._input.timeStamp = now();\n        this.manager.emit(this.options.event, this._input);\n      }\n    }\n  });\n\n  /**\n   * Rotate\n   * Recognized when two or more pointer are moving in a circular motion.\n   * @constructor\n   * @extends AttrRecognizer\n   */\n  function RotateRecognizer() {\n    AttrRecognizer.apply(this, arguments);\n  }\n\n  inherit(RotateRecognizer, AttrRecognizer, {\n    /**\n     * @namespace\n     * @memberof RotateRecognizer\n     */\n    defaults: {\n      event: 'rotate',\n      threshold: 0,\n      pointers: 2\n    },\n\n    getTouchAction: function () {\n      return [TOUCH_ACTION_NONE];\n    },\n\n    attrTest: function (input) {\n      return this._super.attrTest.call(this, input) &&\n        (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n    }\n  });\n\n  /**\n   * Swipe\n   * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n   * @constructor\n   * @extends AttrRecognizer\n   */\n  function SwipeRecognizer() {\n    AttrRecognizer.apply(this, arguments);\n  }\n\n  inherit(SwipeRecognizer, AttrRecognizer, {\n    /**\n     * @namespace\n     * @memberof SwipeRecognizer\n     */\n    defaults: {\n      event: 'swipe',\n      threshold: 10,\n      velocity: 0.65,\n      direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n      pointers: 1\n    },\n\n    getTouchAction: function () {\n      return PanRecognizer.prototype.getTouchAction.call(this);\n    },\n\n    attrTest: function (input) {\n      var direction = this.options.direction;\n      var velocity;\n\n      if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n        velocity = input.velocity;\n      } else if (direction & DIRECTION_HORIZONTAL) {\n        velocity = input.velocityX;\n      } else if (direction & DIRECTION_VERTICAL) {\n        velocity = input.velocityY;\n      }\n\n      return this._super.attrTest.call(this, input) &&\n        direction & input.direction &&\n        input.distance > this.options.threshold &&\n        abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n    },\n\n    emit: function (input) {\n      var direction = directionStr(input.direction);\n      if (direction) {\n        this.manager.emit(this.options.event + direction, input);\n      }\n\n      this.manager.emit(this.options.event, input);\n    }\n  });\n\n  /**\n   * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n   * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n   * a single tap.\n   *\n   * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n   * multi-taps being recognized.\n   * @constructor\n   * @extends Recognizer\n   */\n  function TapRecognizer() {\n    Recognizer.apply(this, arguments);\n\n    // previous time and center,\n    // used for tap counting\n    this.pTime = false;\n    this.pCenter = false;\n\n    this._timer = null;\n    this._input = null;\n    this.count = 0;\n  }\n\n  inherit(TapRecognizer, Recognizer, {\n    /**\n     * @namespace\n     * @memberof PinchRecognizer\n     */\n    defaults: {\n      event: 'tap',\n      pointers: 1,\n      taps: 1,\n      interval: 300, // max time between the multi-tap taps\n      time: 250, // max time of the pointer to be down (like finger on the screen)\n      threshold: 2, // a minimal movement is ok, but keep it low\n      posThreshold: 10 // a multi-tap can be a bit off the initial position\n    },\n\n    getTouchAction: function () {\n      return [TOUCH_ACTION_MANIPULATION];\n    },\n\n    process: function (input) {\n      var options = this.options;\n\n      var validPointers = input.pointers.length === options.pointers;\n      var validMovement = input.distance < options.threshold;\n      var validTouchTime = input.deltaTime < options.time;\n\n      this.reset();\n\n      if ((input.eventType & INPUT_START) && (this.count === 0)) {\n        return this.failTimeout();\n      }\n\n      // we only allow little movement\n      // and we've reached an end event, so a tap is possible\n      if (validMovement && validTouchTime && validPointers) {\n        if (input.eventType != INPUT_END) {\n          return this.failTimeout();\n        }\n\n        var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;\n        var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n\n        this.pTime = input.timeStamp;\n        this.pCenter = input.center;\n\n        if (!validMultiTap || !validInterval) {\n          this.count = 1;\n        } else {\n          this.count += 1;\n        }\n\n        this._input = input;\n\n        // if tap count matches we have recognized it,\n        // else it has began recognizing...\n        var tapCount = this.count % options.taps;\n        if (tapCount === 0) {\n          // no failing requirements, immediately trigger the tap event\n          // or wait as long as the multitap interval to trigger\n          if (!this.hasRequireFailures()) {\n            return STATE_RECOGNIZED;\n          } else {\n            this._timer = setTimeoutContext(function () {\n              this.state = STATE_RECOGNIZED;\n              this.tryEmit();\n            }, options.interval, this);\n            return STATE_BEGAN;\n          }\n        }\n      }\n      return STATE_FAILED;\n    },\n\n    failTimeout: function () {\n      this._timer = setTimeoutContext(function () {\n        this.state = STATE_FAILED;\n      }, this.options.interval, this);\n      return STATE_FAILED;\n    },\n\n    reset: function () {\n      clearTimeout(this._timer);\n    },\n\n    emit: function () {\n      if (this.state == STATE_RECOGNIZED) {\n        this._input.tapCount = this.count;\n        this.manager.emit(this.options.event, this._input);\n      }\n    }\n  });\n\n  /**\n   * Simple way to create an manager with a default set of recognizers.\n   * @param {HTMLElement} element\n   * @param {Object} [options]\n   * @constructor\n   */\n  function Hammer(element, options) {\n    options = options || {};\n    options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n    return new Manager(element, options);\n  }\n\n  /**\n   * @const {string}\n   */\n  Hammer.VERSION = '2.0.4';\n\n  /**\n   * default settings\n   * @namespace\n   */\n  Hammer.defaults = {\n    /**\n     * set if DOM events are being triggered.\n     * But this is slower and unused by simple implementations, so disabled by default.\n     * @type {Boolean}\n     * @default false\n     */\n    domEvents: false,\n\n    /**\n     * The value for the touchAction property/fallback.\n     * When set to `compute` it will magically set the correct value based on the added recognizers.\n     * @type {String}\n     * @default compute\n     */\n    touchAction: TOUCH_ACTION_COMPUTE,\n\n    /**\n     * @type {Boolean}\n     * @default true\n     */\n    enable: true,\n\n    /**\n     * EXPERIMENTAL FEATURE -- can be removed/changed\n     * Change the parent input target element.\n     * If Null, then it is being set the to main element.\n     * @type {Null|EventTarget}\n     * @default null\n     */\n    inputTarget: null,\n\n    /**\n     * force an input class\n     * @type {Null|Function}\n     * @default null\n     */\n    inputClass: null,\n\n    /**\n     * Default recognizer setup when calling `Hammer()`\n     * When creating a new Manager these will be skipped.\n     * @type {Array}\n     */\n    preset: [\n      // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n      [RotateRecognizer, {enable: false}],\n      [PinchRecognizer, {enable: false}, ['rotate']],\n      [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],\n      [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],\n      [TapRecognizer],\n      [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],\n      [PressRecognizer]\n    ],\n\n    /**\n     * Some CSS properties can be used to improve the working of Hammer.\n     * Add them to this method and they will be set when creating a new Manager.\n     * @namespace\n     */\n    cssProps: {\n      /**\n       * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n       * @type {String}\n       * @default 'none'\n       */\n      userSelect: 'none',\n\n      /**\n       * Disable the Windows Phone grippers when pressing an element.\n       * @type {String}\n       * @default 'none'\n       */\n      touchSelect: 'none',\n\n      /**\n       * Disables the default callout shown when you touch and hold a touch target.\n       * On iOS, when you touch and hold a touch target such as a link, Safari displays\n       * a callout containing information about the link. This property allows you to disable that callout.\n       * @type {String}\n       * @default 'none'\n       */\n      touchCallout: 'none',\n\n      /**\n       * Specifies whether zooming is enabled. Used by IE10>\n       * @type {String}\n       * @default 'none'\n       */\n      contentZooming: 'none',\n\n      /**\n       * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n       * @type {String}\n       * @default 'none'\n       */\n      userDrag: 'none',\n\n      /**\n       * Overrides the highlight color shown when the user taps a link or a JavaScript\n       * clickable element in iOS. This property obeys the alpha value, if specified.\n       * @type {String}\n       * @default 'rgba(0,0,0,0)'\n       */\n      tapHighlightColor: 'rgba(0,0,0,0)'\n    }\n  };\n\n  var STOP = 1;\n  var FORCED_STOP = 2;\n\n  /**\n   * Manager\n   * @param {HTMLElement} element\n   * @param {Object} [options]\n   * @constructor\n   */\n  function Manager(element, options) {\n    options = options || {};\n\n    this.options = merge(options, Hammer.defaults);\n    this.options.inputTarget = this.options.inputTarget || element;\n\n    this.handlers = {};\n    this.session = {};\n    this.recognizers = [];\n\n    this.element = element;\n    this.input = createInputInstance(this);\n    this.touchAction = new TouchAction(this, this.options.touchAction);\n\n    toggleCssProps(this, true);\n\n    each(options.recognizers, function (item) {\n      var recognizer = this.add(new (item[0])(item[1]));\n      item[2] && recognizer.recognizeWith(item[2]);\n      item[3] && recognizer.requireFailure(item[3]);\n    }, this);\n  }\n\n  Manager.prototype = {\n    /**\n     * set options\n     * @param {Object} options\n     * @returns {Manager}\n     */\n    set: function (options) {\n      extend(this.options, options);\n\n      // Options that need a little more setup\n      if (options.touchAction) {\n        this.touchAction.update();\n      }\n      if (options.inputTarget) {\n        // Clean up existing event listeners and reinitialize\n        this.input.destroy();\n        this.input.target = options.inputTarget;\n        this.input.init();\n      }\n      return this;\n    },\n\n    /**\n     * stop recognizing for this session.\n     * This session will be discarded, when a new [input]start event is fired.\n     * When forced, the recognizer cycle is stopped immediately.\n     * @param {Boolean} [force]\n     */\n    stop: function (force) {\n      this.session.stopped = force ? FORCED_STOP : STOP;\n    },\n\n    /**\n     * run the recognizers!\n     * called by the inputHandler function on every movement of the pointers (touches)\n     * it walks through all the recognizers and tries to detect the gesture that is being made\n     * @param {Object} inputData\n     */\n    recognize: function (inputData) {\n      var session = this.session;\n      if (session.stopped) {\n        return;\n      }\n\n      // run the touch-action polyfill\n      this.touchAction.preventDefaults(inputData);\n\n      var recognizer;\n      var recognizers = this.recognizers;\n\n      // this holds the recognizer that is being recognized.\n      // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n      // if no recognizer is detecting a thing, it is set to `null`\n      var curRecognizer = session.curRecognizer;\n\n      // reset when the last recognizer is recognized\n      // or when we're in a new session\n      if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {\n        curRecognizer = session.curRecognizer = null;\n      }\n\n      var i = 0;\n      while (i < recognizers.length) {\n        recognizer = recognizers[i];\n\n        // find out if we are allowed try to recognize the input for this one.\n        // 1.   allow if the session is NOT forced stopped (see the .stop() method)\n        // 2.   allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n        //      that is being recognized.\n        // 3.   allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n        //      this can be setup with the `recognizeWith()` method on the recognizer.\n        if (session.stopped !== FORCED_STOP && ( // 1\n          !curRecognizer || recognizer == curRecognizer || // 2\n          recognizer.canRecognizeWith(curRecognizer))) { // 3\n          recognizer.recognize(inputData);\n        } else {\n          recognizer.reset();\n        }\n\n        // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n        // current active recognizer. but only if we don't already have an active recognizer\n        if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n          curRecognizer = session.curRecognizer = recognizer;\n        }\n        i++;\n      }\n    },\n\n    /**\n     * get a recognizer by its event name.\n     * @param {Recognizer|String} recognizer\n     * @returns {Recognizer|Null}\n     */\n    get: function (recognizer) {\n      if (recognizer instanceof Recognizer) {\n        return recognizer;\n      }\n\n      var recognizers = this.recognizers;\n      for (var i = 0; i < recognizers.length; i++) {\n        if (recognizers[i].options.event == recognizer) {\n          return recognizers[i];\n        }\n      }\n      return null;\n    },\n\n    /**\n     * add a recognizer to the manager\n     * existing recognizers with the same event name will be removed\n     * @param {Recognizer} recognizer\n     * @returns {Recognizer|Manager}\n     */\n    add: function (recognizer) {\n      if (invokeArrayArg(recognizer, 'add', this)) {\n        return this;\n      }\n\n      // remove existing\n      var existing = this.get(recognizer.options.event);\n      if (existing) {\n        this.remove(existing);\n      }\n\n      this.recognizers.push(recognizer);\n      recognizer.manager = this;\n\n      this.touchAction.update();\n      return recognizer;\n    },\n\n    /**\n     * remove a recognizer by name or instance\n     * @param {Recognizer|String} recognizer\n     * @returns {Manager}\n     */\n    remove: function (recognizer) {\n      if (invokeArrayArg(recognizer, 'remove', this)) {\n        return this;\n      }\n\n      var recognizers = this.recognizers;\n      recognizer = this.get(recognizer);\n      recognizers.splice(inArray(recognizers, recognizer), 1);\n\n      this.touchAction.update();\n      return this;\n    },\n\n    /**\n     * bind event\n     * @param {String} events\n     * @param {Function} handler\n     * @returns {EventEmitter} this\n     */\n    on: function (events, handler) {\n      var handlers = this.handlers;\n      each(splitStr(events), function (event) {\n        handlers[event] = handlers[event] || [];\n        handlers[event].push(handler);\n      });\n      return this;\n    },\n\n    /**\n     * unbind event, leave emit blank to remove all handlers\n     * @param {String} events\n     * @param {Function} [handler]\n     * @returns {EventEmitter} this\n     */\n    off: function (events, handler) {\n      var handlers = this.handlers;\n      each(splitStr(events), function (event) {\n        if (!handler) {\n          delete handlers[event];\n        } else {\n          handlers[event].splice(inArray(handlers[event], handler), 1);\n        }\n      });\n      return this;\n    },\n\n    /**\n     * emit event to the listeners\n     * @param {String} event\n     * @param {Object} data\n     */\n    emit: function (event, data) {\n      // we also want to trigger dom events\n      if (this.options.domEvents) {\n        triggerDomEvent(event, data);\n      }\n\n      // no handlers, so skip it all\n      var handlers = this.handlers[event] && this.handlers[event].slice();\n      if (!handlers || !handlers.length) {\n        return;\n      }\n\n      data.type = event;\n      data.preventDefault = function () {\n        data.srcEvent.preventDefault();\n      };\n\n      var i = 0;\n      while (i < handlers.length) {\n        handlers[i](data);\n        i++;\n      }\n    },\n\n    /**\n     * destroy the manager and unbinds all events\n     * it doesn't unbind dom events, that is the user own responsibility\n     */\n    destroy: function () {\n      this.element && toggleCssProps(this, false);\n\n      this.handlers = {};\n      this.session = {};\n      this.input.destroy();\n      this.element = null;\n    }\n  };\n\n  /**\n   * add/remove the css properties as defined in manager.options.cssProps\n   * @param {Manager} manager\n   * @param {Boolean} add\n   */\n  function toggleCssProps(manager, add) {\n    var element = manager.element;\n    each(manager.options.cssProps, function (value, name) {\n      element.style[prefixed(element.style, name)] = add ? value : '';\n    });\n  }\n\n  /**\n   * trigger dom event\n   * @param {String} event\n   * @param {Object} data\n   */\n  function triggerDomEvent(event, data) {\n    var gestureEvent = document.createEvent('Event');\n    gestureEvent.initEvent(event, true, true);\n    gestureEvent.gesture = data;\n    data.target.dispatchEvent(gestureEvent);\n  }\n\n  extend(Hammer, {\n    INPUT_START: INPUT_START,\n    INPUT_MOVE: INPUT_MOVE,\n    INPUT_END: INPUT_END,\n    INPUT_CANCEL: INPUT_CANCEL,\n\n    STATE_POSSIBLE: STATE_POSSIBLE,\n    STATE_BEGAN: STATE_BEGAN,\n    STATE_CHANGED: STATE_CHANGED,\n    STATE_ENDED: STATE_ENDED,\n    STATE_RECOGNIZED: STATE_RECOGNIZED,\n    STATE_CANCELLED: STATE_CANCELLED,\n    STATE_FAILED: STATE_FAILED,\n\n    DIRECTION_NONE: DIRECTION_NONE,\n    DIRECTION_LEFT: DIRECTION_LEFT,\n    DIRECTION_RIGHT: DIRECTION_RIGHT,\n    DIRECTION_UP: DIRECTION_UP,\n    DIRECTION_DOWN: DIRECTION_DOWN,\n    DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n    DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n    DIRECTION_ALL: DIRECTION_ALL,\n\n    Manager: Manager,\n    Input: Input,\n    TouchAction: TouchAction,\n\n    TouchInput: TouchInput,\n    MouseInput: MouseInput,\n    PointerEventInput: PointerEventInput,\n    TouchMouseInput: TouchMouseInput,\n    SingleTouchInput: SingleTouchInput,\n\n    Recognizer: Recognizer,\n    AttrRecognizer: AttrRecognizer,\n    Tap: TapRecognizer,\n    Pan: PanRecognizer,\n    Swipe: SwipeRecognizer,\n    Pinch: PinchRecognizer,\n    Rotate: RotateRecognizer,\n    Press: PressRecognizer,\n\n    on: addEventListeners,\n    off: removeEventListeners,\n    each: each,\n    merge: merge,\n    extend: extend,\n    inherit: inherit,\n    bindFn: bindFn,\n    prefixed: prefixed\n  });\n\n  if (typeof define == TYPE_FUNCTION && define.amd) {\n    define(function () {\n      return Hammer;\n    });\n  } else if (typeof module != 'undefined' && module.exports) {\n    module.exports = Hammer;\n  } else {\n    window[exportName] = Hammer;\n  }\n\n})(window, document, 'Hammer');\n"
  },
  {
    "path": "app/templates/app/src/lib/impress.js",
    "content": "/**\n * impress.js\n *\n * impress.js is a presentation tool based on the power of CSS3 transforms and transitions\n * in modern browsers and inspired by the idea behind prezi.com.\n *\n *\n * Copyright 2011-2012 Bartek Szopka (@bartaz)\n *\n * Released under the MIT and GPL Licenses.\n *\n * ------------------------------------------------\n *  author:  Bartek Szopka\n *  version: 0.5.3\n *  url:     http://bartaz.github.com/impress.js/\n *  source:  http://github.com/bartaz/impress.js/\n */\n\n/*jshint bitwise:true, curly:true, eqeqeq:true, forin:true, latedef:true, newcap:true,\n noarg:true, noempty:true, undef:true, strict:true, browser:true */\n\n// You are one of those who like to know how thing work inside?\n// Let me show you the cogs that make impress.js run...\nvar OPTIONS = {\n  resizeDrive: true,// keep current step after resize viewport\n  hashMark: true, //change the location hash\n  clickDrve: true, //enable clik to drive steps\n  keyboardDrve: true,//enable keyboard to drive steps\n  touchDrive: true,//enable touch to drive steps\n  anchorDrive: true//enable anchor to drive steps\n};\n\n(function (document, window) {\n  'use strict';\n\n  // HELPER FUNCTIONS\n\n  // `pfx` is a function that takes a standard CSS property name as a parameter\n  // and returns it's prefixed version valid for current browser it runs in.\n  // The code is heavily inspired by Modernizr http://www.modernizr.com/\n  var pfx = (function () {\n\n    var style = document.createElement('dummy').style,\n      prefixes = 'Webkit Moz O ms Khtml'.split(' '),\n      memory = {};\n\n    return function (prop) {\n      if (typeof memory[prop] === \"undefined\") {\n\n        var ucProp = prop.charAt(0).toUpperCase() + prop.substr(1),\n          props = (prop + ' ' + prefixes.join(ucProp + ' ') + ucProp).split(' ');\n\n        memory[prop] = null;\n        for (var i in props) {\n          if (style[props[i]] !== undefined) {\n            memory[prop] = props[i];\n            break;\n          }\n        }\n\n      }\n\n      return memory[prop];\n    };\n\n  })();\n\n  // `arraify` takes an array-like object and turns it into real Array\n  // to make all the Array.prototype goodness available.\n  var arrayify = function (a) {\n    return [].slice.call(a);\n  };\n\n  // `css` function applies the styles given in `props` object to the element\n  // given as `el`. It runs all property names through `pfx` function to make\n  // sure proper prefixed version of the property is used.\n  var css = function (el, props) {\n    var key, pkey;\n    for (key in props) {\n      if (props.hasOwnProperty(key)) {\n        pkey = pfx(key);\n        if (pkey !== null) {\n          el.style[pkey] = props[key];\n        }\n      }\n    }\n    return el;\n  };\n\n  // `toNumber` takes a value given as `numeric` parameter and tries to turn\n  // it into a number. If it is not possible it returns 0 (or other value\n  // given as `fallback`).\n  var toNumber = function (numeric, fallback) {\n    return isNaN(numeric) ? (fallback || 0) : Number(numeric);\n  };\n\n  // `byId` returns element with given `id` - you probably have guessed that ;)\n  var byId = function (id) {\n    return document.getElementById(id);\n  };\n\n  // `$` returns first element for given CSS `selector` in the `context` of\n  // the given element or whole document.\n  var $ = function (selector, context) {\n    context = context || document;\n    return context.querySelector(selector);\n  };\n\n  // `$$` return an array of elements for given CSS `selector` in the `context` of\n  // the given element or whole document.\n  var $$ = function (selector, context) {\n    context = context || document;\n    return arrayify(context.querySelectorAll(selector));\n  };\n\n  // `triggerEvent` builds a custom DOM event with given `eventName` and `detail` data\n  // and triggers it on element given as `el`.\n  var triggerEvent = function (el, eventName, detail) {\n    var event = document.createEvent(\"CustomEvent\");\n    event.initCustomEvent(eventName, true, true, detail);\n    el.dispatchEvent(event);\n  };\n\n  // `translate` builds a translate transform string for given data.\n  var translate = function (t) {\n    return \" translate3d(\" + t.x + \"px,\" + t.y + \"px,\" + t.z + \"px) \";\n  };\n\n  // `rotate` builds a rotate transform string for given data.\n  // By default the rotations are in X Y Z order that can be reverted by passing `true`\n  // as second parameter.\n  var rotate = function (r, revert) {\n    var rX = \" rotateX(\" + r.x + \"deg) \",\n      rY = \" rotateY(\" + r.y + \"deg) \",\n      rZ = \" rotateZ(\" + r.z + \"deg) \";\n\n    return revert ? rZ + rY + rX : rX + rY + rZ;\n  };\n\n  // `scale` builds a scale transform string for given data.\n  var scale = function (s) {\n    return \" scale(\" + s + \") \";\n  };\n\n  // `perspective` builds a perspective transform string for given data.\n  var perspective = function (p) {\n    return \" perspective(\" + p + \"px) \";\n  };\n\n  // `getElementFromHash` returns an element located by id from hash part of\n  // window location.\n  var getElementFromHash = function () {\n    // get id from url # by removing `#` or `#/` from the beginning,\n    // so both \"fallback\" `#slide-id` and \"enhanced\" `#/slide-id` will work\n    return byId(window.location.hash.replace(/^#\\/?/, \"\"));\n  };\n\n  // `computeWindowScale` counts the scale factor between window size and size\n  // defined for the presentation in the config.\n  var computeWindowScale = function (config) {\n    var hScale = window.innerHeight / config.height,\n      wScale = window.innerWidth / config.width,\n      scale = hScale > wScale ? wScale : hScale;\n\n    if (config.maxScale && scale > config.maxScale) {\n      scale = config.maxScale;\n    }\n\n    if (config.minScale && scale < config.minScale) {\n      scale = config.minScale;\n    }\n\n    return scale;\n  };\n\n  // CHECK SUPPORT\n  var body = document.body;\n\n  //var ua = navigator.userAgent.toLowerCase();\n  var impressSupported = true;\n  /* ||\n   // browser should support CSS 3D transtorms\n   ( pfx(\"perspective\") !== null ) &&\n\n   // and `classList` and `dataset` APIs\n   ( body.classList ) &&\n   ( body.dataset ) &&\n\n   // but some mobile devices need to be blacklisted,\n   // because their CSS 3D support or hardware is not\n   // good enough to run impress.js properly, sorry...\n   ( ua.search(/(iphone)|(ipod)|(android)/) === -1 );\n\n   if (!impressSupported) {\n   // we can't be sure that `classList` is supported\n   body.className += \" impress-not-supported \";\n   } else {\n   body.classList.remove(\"impress-not-supported\");\n   body.classList.add(\"impress-supported\");\n   }\n   */\n\n  // GLOBALS AND DEFAULTS\n\n  // This is were the root elements of all impress.js instances will be kept.\n  // Yes, this means you can have more than one instance on a page, but I'm not\n  // sure if it makes any sense in practice ;)\n  var roots = {};\n\n  // some default config values.\n  var defaults = {\n    width: 1024,\n    height: 768,\n    maxScale: 1,\n    minScale: 0,\n\n    perspective: 1000,\n\n    transitionDuration: 1000\n  };\n\n  // it's just an empty function ... and a useless comment.\n  var empty = function () {\n    return false;\n  };\n\n  // IMPRESS.JS API\n\n  // And that's where interesting things will start to happen.\n  // It's the core `impress` function that returns the impress.js API\n  // for a presentation based on the element with given id ('impress'\n  // by default).\n  var impress = window.impress = function (rootId, option) {\n\n    for (var key in option) {\n      OPTIONS[key] = option[key];\n    }\n    body = OPTIONS.body || body;\n    // If impress.js is not supported by the browser return a dummy API\n    // it may not be a perfect solution but we return early and avoid\n    // running code that may use features not implemented in the browser.\n    if (!impressSupported) {\n      return {\n        init: empty,\n        goto: empty,\n        prev: empty,\n        next: empty\n      };\n    }\n\n    rootId = rootId || \"impress\";\n\n    // if given root is already initialized just return the API\n    if (roots[\"impress-root-\" + rootId]) {\n      return roots[\"impress-root-\" + rootId];\n    }\n\n    // data of all presentation steps\n    var stepsData = {};\n\n    // element of currently active step\n    var activeStep = null;\n\n    // current state (position, rotation and scale) of the presentation\n    var currentState = null;\n\n    // array of step elements\n    var steps = null;\n\n    // configuration OPTIONS\n    var config = null;\n\n    // scale factor of the browser window\n    var windowScale = null;\n\n    // root presentation elements\n    var root = byId(rootId);\n    var canvas = document.createElement(\"div\");\n\n    var initialized = false;\n\n    // STEP EVENTS\n    //\n    // There are currently two step events triggered by impress.js\n    // `impress:stepenter` is triggered when the step is shown on the\n    // screen (the transition from the previous one is finished) and\n    // `impress:stepleave` is triggered when the step is left (the\n    // transition to next step just starts).\n\n    // reference to last entered step\n    var lastEntered = null;\n\n    // `onStepEnter` is called whenever the step element is entered\n    // but the event is triggered only if the step is different than\n    // last entered step.\n    var onStepEnter = function (step) {\n      if (lastEntered !== step) {\n        triggerEvent(step, \"impress:stepenter\");\n        lastEntered = step;\n      }\n    };\n\n    // `onStepLeave` is called whenever the step element is left\n    // but the event is triggered only if the step is the same as\n    // last entered step.\n    var onStepLeave = function (step) {\n      if (lastEntered === step) {\n        triggerEvent(step, \"impress:stepleave\");\n        lastEntered = null;\n      }\n    };\n\n    // `initStep` initializes given step element by reading data from its\n    // data attributes and setting correct styles.\n    var initStep = function (el, idx) {\n      var data = el.dataset,\n        step = {\n          translate: {\n            x: toNumber(data.x),\n            y: toNumber(data.y),\n            z: toNumber(data.z)\n          },\n          rotate: {\n            x: toNumber(data.rotateX),\n            y: toNumber(data.rotateY),\n            z: toNumber(data.rotateZ || data.rotate)\n          },\n          scale: toNumber(data.scale, 1),\n          el: el\n        };\n\n      if (!el.id) {\n        el.id = \"step-\" + (idx + 1);\n      }\n\n      stepsData[\"impress-\" + el.id] = step;\n\n      css(el, {\n        position: \"absolute\",\n        transform: \"translate(-50%,-50%)\" +\n        translate(step.translate) +\n        rotate(step.rotate) +\n        scale(step.scale),\n        transformStyle: \"preserve-3d\"\n      });\n    };\n\n    // `init` API function that initializes (and runs) the presentation.\n    var init = function () {\n      if (initialized) {\n        return;\n      }\n\n      /*\n       // First we set up the viewport for mobile devices.\n       // For some reason iPad goes nuts when it is not done properly.\n       var meta = $(\"meta[name='viewport']\") || document.createElement(\"meta\");\n       meta.content = \"width=device-width, minimum-scale=1, maximum-scale=1, user-scalable=no\";\n       if (meta.parentNode !== document.head) {\n       meta.name = 'viewport';\n       document.head.appendChild(meta);\n       }*/\n\n      // initialize configuration object\n      var rootData = root.dataset;\n      config = {\n        width: toNumber(rootData.width, defaults.width),\n        height: toNumber(rootData.height, defaults.height),\n        maxScale: toNumber(rootData.maxScale, defaults.maxScale),\n        minScale: toNumber(rootData.minScale, defaults.minScale),\n        perspective: toNumber(rootData.perspective, defaults.perspective),\n        transitionDuration: toNumber(rootData.transitionDuration, defaults.transitionDuration)\n      };\n\n      windowScale = computeWindowScale(config);\n\n      // wrap steps with \"canvas\" element\n      arrayify(root.childNodes).forEach(function (el) {\n        canvas.appendChild(el);\n      });\n      root.appendChild(canvas);\n\n      // set initial styles\n      document.documentElement.style.height = \"100%\";\n\n      css(body, {\n        height: \"100%\",\n        overflow: \"hidden\"\n      });\n\n      var rootStyles = {\n        position: \"absolute\",\n        transformOrigin: \"top left\",\n        transition: \"all 0s ease-in-out\",\n        transformStyle: \"preserve-3d\"\n      };\n\n      css(root, rootStyles);\n      css(root, {\n        top: \"50%\",\n        left: \"50%\",\n        transform: perspective(config.perspective / windowScale) + scale(windowScale)\n      });\n      css(canvas, rootStyles);\n\n      body.classList.remove(\"impress-disabled\");\n      body.classList.add(\"impress-enabled\");\n\n      // get and init steps\n      steps = $$(\".step\", root);\n      steps.forEach(initStep);\n\n      // set a default initial state of the canvas\n      currentState = {\n        translate: {x: 0, y: 0, z: 0},\n        rotate: {x: 0, y: 0, z: 0},\n        scale: 1\n      };\n\n      initialized = true;\n\n      triggerEvent(root, \"impress:init\", {api: roots[\"impress-root-\" + rootId]});\n    };\n\n    // `getStep` is a helper function that returns a step element defined by parameter.\n    // If a number is given, step with index given by the number is returned, if a string\n    // is given step element with such id is returned, if DOM element is given it is returned\n    // if it is a correct step element.\n    var getStep = function (step) {\n      if (typeof step === \"number\") {\n        step = step < 0 ? steps[steps.length + step] : steps[step];\n      } else if (typeof step === \"string\") {\n        step = byId(step);\n      }\n      return (step && step.id && stepsData[\"impress-\" + step.id]) ? step : null;\n    };\n\n    // used to reset timeout for `impress:stepenter` event\n    var stepEnterTimeout = null;\n\n    // `goto` API function that moves to step given with `el` parameter (by index, id or element),\n    // with a transition `duration` optionally given as second parameter.\n    var goto = function (el, duration) {\n\n      if (!initialized || !(el = getStep(el))) {\n        // presentation not initialized or given element is not a step\n        return false;\n      }\n\n      // Sometimes it's possible to trigger focus on first link with some keyboard action.\n      // Browser in such a case tries to scroll the page to make this element visible\n      // (even that body overflow is set to hidden) and it breaks our careful positioning.\n      //\n      // So, as a lousy (and lazy) workaround we will make the page scroll back to the top\n      // whenever slide is selected\n      //\n      // If you are reading this and know any better way to handle it, I'll be glad to hear about it!\n      window.scrollTo(0, 0);\n\n      var step = stepsData[\"impress-\" + el.id];\n\n      if (activeStep) {\n        activeStep.classList.remove(\"active\");\n        body.classList.remove(\"impress-on-\" + activeStep.id);\n      }\n      el.classList.add(\"active\");\n\n      body.classList.add(\"impress-on-\" + el.id);\n\n      // compute target state of the canvas based on given step\n      var target = {\n        rotate: {\n          x: -step.rotate.x,\n          y: -step.rotate.y,\n          z: -step.rotate.z\n        },\n        translate: {\n          x: -step.translate.x,\n          y: -step.translate.y,\n          z: -step.translate.z\n        },\n        scale: 1 / step.scale\n      };\n\n      // Check if the transition is zooming in or not.\n      //\n      // This information is used to alter the transition style:\n      // when we are zooming in - we start with move and rotate transition\n      // and the scaling is delayed, but when we are zooming out we start\n      // with scaling down and move and rotation are delayed.\n      var zoomin = target.scale >= currentState.scale;\n\n      duration = toNumber(duration, config.transitionDuration);\n      var delay = (duration / 2);\n\n      // if the same step is re-selected, force computing window scaling,\n      // because it is likely to be caused by window resize\n      if (el === activeStep) {\n        windowScale = computeWindowScale(config);\n      }\n\n      var targetScale = target.scale * windowScale;\n\n      // trigger leave of currently active element (if it's not the same step again)\n      if (activeStep && activeStep !== el) {\n        onStepLeave(activeStep);\n      }\n\n      // Now we alter transforms of `root` and `canvas` to trigger transitions.\n      //\n      // And here is why there are two elements: `root` and `canvas` - they are\n      // being animated separately:\n      // `root` is used for scaling and `canvas` for translate and rotations.\n      // Transitions on them are triggered with different delays (to make\n      // visually nice and 'natural' looking transitions), so we need to know\n      // that both of them are finished.\n      css(root, {\n        // to keep the perspective look similar for different scales\n        // we need to 'scale' the perspective, too\n        transform: perspective(config.perspective / targetScale) + scale(targetScale),\n        transitionDuration: duration + \"ms\",\n        transitionDelay: (zoomin ? delay : 0) + \"ms\"\n      });\n\n      css(canvas, {\n        transform: rotate(target.rotate, true) + translate(target.translate),\n        transitionDuration: duration + \"ms\",\n        transitionDelay: (zoomin ? 0 : delay) + \"ms\"\n      });\n\n      // Here is a tricky part...\n      //\n      // If there is no change in scale or no change in rotation and translation, it means there was actually\n      // no delay - because there was no transition on `root` or `canvas` elements.\n      // We want to trigger `impress:stepenter` event in the correct moment, so here we compare the current\n      // and target values to check if delay should be taken into account.\n      //\n      // I know that this `if` statement looks scary, but it's pretty simple when you know what is going on\n      // - it's simply comparing all the values.\n      if (currentState.scale === target.scale ||\n        (currentState.rotate.x === target.rotate.x && currentState.rotate.y === target.rotate.y &&\n        currentState.rotate.z === target.rotate.z && currentState.translate.x === target.translate.x &&\n        currentState.translate.y === target.translate.y && currentState.translate.z === target.translate.z)) {\n        delay = 0;\n      }\n\n      // store current state\n      currentState = target;\n      activeStep = el;\n\n      // And here is where we trigger `impress:stepenter` event.\n      // We simply set up a timeout to fire it taking transition duration (and possible delay) into account.\n      //\n      // I really wanted to make it in more elegant way. The `transitionend` event seemed to be the best way\n      // to do it, but the fact that I'm using transitions on two separate elements and that the `transitionend`\n      // event is only triggered when there was a transition (change in the values) caused some bugs and\n      // made the code really complicated, cause I had to handle all the conditions separately. And it still\n      // needed a `setTimeout` fallback for the situations when there is no transition at all.\n      // So I decided that I'd rather make the code simpler than use shiny new `transitionend`.\n      //\n      // If you want learn something interesting and see how it was done with `transitionend` go back to\n      // version 0.5.2 of impress.js: http://github.com/bartaz/impress.js/blob/0.5.2/js/impress.js\n      window.clearTimeout(stepEnterTimeout);\n      stepEnterTimeout = window.setTimeout(function () {\n        onStepEnter(activeStep);\n      }, duration + delay);\n\n      return el;\n    };\n\n    // `prev` API function goes to previous step (in document order)\n    var prev = function () {\n      var prev = steps.indexOf(activeStep) - 1;\n      prev = prev >= 0 ? steps[prev] : steps[steps.length - 1];\n\n      return goto(prev);\n    };\n\n    // `next` API function goes to next step (in document order)\n    var next = function () {\n      var next = steps.indexOf(activeStep) + 1;\n      next = next < steps.length ? steps[next] : steps[0];\n\n      return goto(next);\n    };\n\n    // Adding some useful classes to step elements.\n    //\n    // All the steps that have not been shown yet are given `future` class.\n    // When the step is entered the `future` class is removed and the `present`\n    // class is given. When the step is left `present` class is replaced with\n    // `past` class.\n    //\n    // So every step element is always in one of three possible states:\n    // `future`, `present` and `past`.\n    //\n    // There classes can be used in CSS to style different types of steps.\n    // For example the `present` class can be used to trigger some custom\n    // animations when step is shown.\n    root.addEventListener(\"impress:init\", function () {\n      // STEP CLASSES\n      steps.forEach(function (step) {\n        step.classList.add(\"future\");\n      });\n\n      root.addEventListener(\"impress:stepenter\", function (event) {\n        event.target.classList.remove(\"past\");\n        event.target.classList.remove(\"future\");\n        event.target.classList.add(\"present\");\n      }, false);\n\n      root.addEventListener(\"impress:stepleave\", function (event) {\n        event.target.classList.remove(\"present\");\n        event.target.classList.add(\"past\");\n      }, false);\n\n    }, false);\n\n    // Adding hash change support.\n    root.addEventListener(\"impress:init\", function () {\n\n      // last hash detected\n      var lastHash = \"\";\n\n      // `#/step-id` is used instead of `#step-id` to prevent default browser\n      // scrolling to element in hash.\n      //\n      // And it has to be set after animation finishes, because in Chrome it\n      // makes transtion laggy.\n      // BUG: http://code.google.com/p/chromium/issues/detail?id=62820\n      root.addEventListener(\"impress:stepenter\", function (event) {\n        if (OPTIONS.hashMark) {\n          window.location.hash = lastHash = \"#/\" + event.target.id;\n        }\n      }, false);\n\n      window.addEventListener(\"hashchange\", function () {\n        // When the step is entered hash in the location is updated\n        // (just few lines above from here), so the hash change is\n        // triggered and we would call `goto` again on the same element.\n        //\n        // To avoid this we store last entered hash and compare.\n        if (window.location.hash !== lastHash) {\n          goto(getElementFromHash());\n        }\n      }, false);\n\n      // START\n      // by selecting step defined in url or first step of the presentation\n      goto(getElementFromHash() || steps[0], 0);\n    }, false);\n\n    body.classList.add(\"impress-disabled\");\n\n    // store and return API for given impress.js root element\n    return (roots[\"impress-root-\" + rootId] = {\n      init: init,\n      goto: goto,\n      next: next,\n      prev: prev\n    });\n\n  };\n\n  // flag that can be used in JS to check if browser have passed the support test\n  impress.supported = impressSupported;\n\n})(document, window);\n\n// NAVIGATION EVENTS\n\n// As you can see this part is separate from the impress.js core code.\n// It's because these navigation actions only need what impress.js provides with\n// its simple API.\n//\n// In future I think about moving it to make them optional, move to separate files\n// and treat more like a 'plugins'.\n(function (document, window) {\n  'use strict';\n\n  // throttling function calls, by Remy Sharp\n  // http://remysharp.com/2010/07/21/throttling-function-calls/\n  var throttle = function (fn, delay) {\n    var timer = null;\n    return function () {\n      var context = this, args = arguments;\n      clearTimeout(timer);\n      timer = setTimeout(function () {\n        fn.apply(context, args);\n      }, delay);\n    };\n  };\n\n  // wait for impress.js to be initialized\n  document.addEventListener(\"impress:init\", function (event) {\n    // Getting API from event data.\n    // So you don't event need to know what is the id of the root element\n    // or anything. `impress:init` event data gives you everything you\n    // need to control the presentation that was just initialized.\n    var api = event.detail.api;\n\n    // KEYBOARD NAVIGATION HANDLERS\n\n    // Prevent default keydown action when one of supported key is pressed.\n    document.addEventListener(\"keydown\", function (event) {\n      if (OPTIONS.keyboardDrive && event.keyCode === 9 || ( event.keyCode >= 32 && event.keyCode <= 34 ) || (event.keyCode >= 37 && event.keyCode <= 40)) {\n        event.preventDefault();\n      }\n    }, false);\n\n    // Trigger impress action (next or prev) on keyup.\n\n    // Supported keys are:\n    // [space] - quite common in presentation software to move forward\n    // [up] [right] / [down] [left] - again common and natural addition,\n    // [pgdown] / [pgup] - often triggered by remote controllers,\n    // [tab] - this one is quite controversial, but the reason it ended up on\n    //   this list is quite an interesting story... Remember that strange part\n    //   in the impress.js code where window is scrolled to 0,0 on every presentation\n    //   step, because sometimes browser scrolls viewport because of the focused element?\n    //   Well, the [tab] key by default navigates around focusable elements, so clicking\n    //   it very often caused scrolling to focused element and breaking impress.js\n    //   positioning. I didn't want to just prevent this default action, so I used [tab]\n    //   as another way to moving to next step... And yes, I know that for the sake of\n    //   consistency I should add [shift+tab] as opposite action...\n    document.addEventListener(\"keyup\", function (event) {\n      if (OPTIONS.keyboardDrive && event.keyCode === 9 || ( event.keyCode >= 32 && event.keyCode <= 34 ) || (event.keyCode >= 37 && event.keyCode <= 40)) {\n        switch (event.keyCode) {\n          case 33: // pg up\n          case 37: // left\n          case 38: // up\n            api.prev();\n            break;\n          case 9:  // tab\n          case 32: // space\n          case 34: // pg down\n          case 39: // right\n          case 40: // down\n            api.next();\n            break;\n        }\n\n        event.preventDefault();\n      }\n    }, false);\n\n    // delegated handler for clicking on the links to presentation steps\n    document.addEventListener(\"click\", function (event) {\n      if (!OPTIONS.anchorDrive) {\n        return;\n      }\n      // event delegation with \"bubbling\"\n      // check if event target (or any of its parents is a link)\n      var target = event.target;\n      while ((target.tagName !== \"A\") &&\n      (target !== document.documentElement)) {\n        target = target.parentNode;\n      }\n\n      if (target.tagName === \"A\") {\n        var href = target.getAttribute(\"href\");\n\n        // if it's a link to presentation step, target this step\n        if (href && href[0] === '#') {\n          target = document.getElementById(href.slice(1));\n        }\n      }\n\n      if (api.goto(target)) {\n        event.stopImmediatePropagation();\n        event.preventDefault();\n      }\n    }, false);\n\n    // delegated handler for clicking on step elements\n    document.addEventListener(\"click\", function (event) {\n      if (!OPTIONS.clickDrive) {\n        return;\n      }\n      var target = event.target;\n      // find closest step element that is not active\n      while (!(target.classList.contains(\"step\") && !target.classList.contains(\"active\")) &&\n      (target !== document.documentElement)) {\n        target = target.parentNode;\n      }\n\n      if (api.goto(target)) {\n        event.preventDefault();\n      }\n    }, false);\n\n    // touch handler to detect taps on the left and right side of the screen\n    // based on awesome work of @hakimel: https://github.com/hakimel/reveal.js\n    document.addEventListener(\"touchstart\", function (event) {\n      if (OPTIONS.touchDrive && event.touches.length === 1) {\n        var x = event.touches[0].clientX,\n          width = window.innerWidth * 0.3,\n          result = null;\n\n        if (x < width) {\n          result = api.prev();\n        } else if (x > window.innerWidth - width) {\n          result = api.next();\n        }\n\n        if (result) {\n          event.preventDefault();\n        }\n      }\n    }, false);\n\n    // rescale presentation when window is resized\n    window.addEventListener(\"resize\", OPTIONS.resizeDrive && throttle(function () {\n        // force going to active step again, to trigger rescaling\n        api.goto(document.querySelector(\".step.active\"), 500);\n      }, 250), false);\n\n  }, false);\n\n})(document, window);\n\n// THAT'S ALL FOLKS!\n//\n// Thanks for reading it all.\n// Or thanks for scrolling down and reading the last part.\n//\n// I've learnt a lot when building impress.js and I hope this code and comments\n// will help somebody learn at least some part of it.\n"
  },
  {
    "path": "app/templates/app/src/lib/rebound.js",
    "content": "// Rebound\n// =======\n// **Rebound** is a simple library that models Spring dynamics for the\n// purpose of driving physical animations.\n//\n// Origin\n// ------\n// [Rebound](http://facebook.github.io/rebound) was originally written\n// in Java to provide a lightweight physics system for\n// [Facebook Home](https://play.google.com/store/apps/details?id=com.facebook.home)\n// and [Chat Heads](https://play.google.com/store/apps/details?id=com.facebook.orca)\n// on Android. It's now been adopted by several other Android\n// applications. This JavaScript port was written to provide a quick\n// way to demonstrate Rebound animations on the web for a\n// [conference talk](https://www.youtube.com/watch?v=s5kNm-DgyjY). Since then the\n// JavaScript version has been used to build some really nice interfaces.\n// Check out [brandonwalkin.com](http://brandonwalkin.com) for an\n// example.\n//\n// Overview\n// --------\n// The Library provides a SpringSystem for maintaining a set of Spring\n// objects and iterating those Springs through a physics solver loop\n// until equilibrium is achieved. The Spring class is the basic\n// animation driver provided by Rebound. By attaching a listener to\n// a Spring, you can observe its motion. The observer function is\n// notified of position changes on the spring as it solves for\n// equilibrium. These position updates can be mapped to an animation\n// range to drive animated property updates on your user interface\n// elements (translation, rotation, scale, etc).\n//\n// Example\n// -------\n// Here's a simple example. Pressing and releasing on the logo below\n// will cause it to scale up and down with a springy animation.\n//\n// <div style=\"text-align:center; margin-bottom:50px; margin-top:50px\">\n//   <img src=\"http://facebook.github.io/rebound/images/rebound.png\" id=\"logo\" />\n// </div>\n// <script src=\"../rebound.min.js\"></script>\n// <script>\n//\n// function scale(el, val) {\n//   el.style.mozTransform =\n//   el.style.msTransform =\n//   el.style.webkitTransform =\n//   el.style.transform = 'scale3d(' + val + ', ' + val + ', 1)';\n// }\n// var el = document.getElementById('logo');\n//\n// var springSystem = new rebound.SpringSystem();\n// var spring = springSystem.createSpring(50, 3);\n// spring.addListener({\n//   onSpringUpdate: function(spring) {\n//     var val = spring.getCurrentValue();\n//     val = rebound.MathUtil.mapValueInRange(val, 0, 1, 1, 0.5);\n//     scale(el, val);\n//   }\n// });\n//\n// el.addEventListener('mousedown', function() {\n//   spring.setEndValue(1);\n// });\n//\n// el.addEventListener('mouseout', function() {\n//   spring.setEndValue(0);\n// });\n//\n// el.addEventListener('mouseup', function() {\n//   spring.setEndValue(0);\n// });\n//\n// </script>\n//\n// Here's how it works.\n//\n// ```\n// // Get a reference to the logo element.\n// var el = document.getElementById('logo');\n//\n// // create a SpringSystem and a Spring with a bouncy config.\n// var springSystem = new rebound.SpringSystem();\n// var spring = springSystem.createSpring(50, 3);\n//\n// // Add a listener to the spring. Every time the physics\n// // solver updates the Spring's value onSpringUpdate will\n// // be called.\n// spring.addListener({\n//   onSpringUpdate: function(spring) {\n//     var val = spring.getCurrentValue();\n//     val = rebound.MathUtil\n//                  .mapValueInRange(val, 0, 1, 1, 0.5);\n//     scale(el, val);\n//   }\n// });\n//\n// // Listen for mouse down/up/out and toggle the\n// //springs endValue from 0 to 1.\n// el.addEventListener('mousedown', function() {\n//   spring.setEndValue(1);\n// });\n//\n// el.addEventListener('mouseout', function() {\n//   spring.setEndValue(0);\n// });\n//\n// el.addEventListener('mouseup', function() {\n//   spring.setEndValue(0);\n// });\n//\n// // Helper for scaling an element with css transforms.\n// function scale(el, val) {\n//   el.style.mozTransform =\n//   el.style.msTransform =\n//   el.style.webkitTransform =\n//   el.style.transform = 'scale3d(' +\n//     val + ', ' + val + ', 1)';\n// }\n// ```\n\n(function () {\n  var rebound = {};\n  var util = rebound.util = {};\n  var concat = Array.prototype.concat;\n  var slice = Array.prototype.slice;\n\n  // Bind a function to a context object.\n  util.bind = function bind(func, context) {\n    args = slice.call(arguments, 2);\n    return function () {\n      func.apply(context, concat.call(args, slice.call(arguments)));\n    };\n  };\n\n  // Add all the properties in the source to the target.\n  util.extend = function extend(target, source) {\n    for (var key in source) {\n      if (source.hasOwnProperty(key)) {\n        target[key] = source[key];\n      }\n    }\n  };\n\n  // SpringSystem\n  // ------------\n  // **SpringSystem** is a set of Springs that all run on the same physics\n  // timing loop. To get started with a Rebound animation you first\n  // create a new SpringSystem and then add springs to it.\n  var SpringSystem = rebound.SpringSystem = function SpringSystem(looper) {\n    this._springRegistry = {};\n    this._activeSprings = [];\n    this.listeners = [];\n    this._idleSpringIndices = [];\n    this.looper = looper || new AnimationLooper();\n    this.looper.springSystem = this;\n  };\n\n  util.extend(SpringSystem.prototype, {\n\n    _springRegistry: null,\n\n    _isIdle: true,\n\n    _lastTimeMillis: -1,\n\n    _activeSprings: null,\n\n    listeners: null,\n\n    _idleSpringIndices: null,\n\n    // A SpringSystem is iterated by a looper. The looper is responsible\n    // for executing each frame as the SpringSystem is resolved to idle.\n    // There are three types of Loopers described below AnimationLooper,\n    // SimulationLooper, and SteppingSimulationLooper. AnimationLooper is\n    // the default as it is the most useful for common UI animations.\n    setLooper: function (looper) {\n      this.looper = looper\n      looper.springSystem = this;\n    },\n\n    // Create and register a new spring with the SpringSystem. This\n    // Spring will now be solved for during the physics iteration loop. By default\n    // the spring will use the default Origami spring config with 40 tension and 7\n    // friction, but you can also provide your own values here.\n    createSpring: function (tension, friction) {\n      var spring = new Spring(this);\n      this.registerSpring(spring);\n      if (typeof tension === 'undefined' || typeof friction === 'undefined') {\n        spring.setSpringConfig(SpringConfig.DEFAULT_ORIGAMI_SPRING_CONFIG);\n      } else {\n        var springConfig = SpringConfig.fromOrigamiTensionAndFriction(tension, friction);\n        spring.setSpringConfig(springConfig);\n      }\n      return spring;\n    },\n\n    // You can check if a SpringSystem is idle or active by calling\n    // getIsIdle. If all of the Springs in the SpringSystem are at rest,\n    // i.e. the physics forces have reached equilibrium, then this\n    // method will return true.\n    getIsIdle: function () {\n      return this._isIdle;\n    },\n\n    // Retrieve a specific Spring from the SpringSystem by id. This\n    // can be useful for inspecting the state of a spring before\n    // or after an integration loop in the SpringSystem executes.\n    getSpringById: function (id) {\n      return this._springRegistry[id];\n    },\n\n    // Get a listing of all the springs registered with this\n    // SpringSystem.\n    getAllSprings: function () {\n      var vals = [];\n      for (var id in this._springRegistry) {\n        if (this._springRegistry.hasOwnProperty(id)) {\n          vals.push(this._springRegistry[id]);\n        }\n      }\n      return vals;\n    },\n\n    // registerSpring is called automatically as soon as you create\n    // a Spring with SpringSystem#createSpring. This method sets the\n    // spring up in the registry so that it can be solved in the\n    // solver loop.\n    registerSpring: function (spring) {\n      this._springRegistry[spring.getId()] = spring;\n    },\n\n    // Deregister a spring with this SpringSystem. The SpringSystem will\n    // no longer consider this Spring during its integration loop once\n    // this is called. This is normally done automatically for you when\n    // you call Spring#destroy.\n    deregisterSpring: function (spring) {\n      removeFirst(this._activeSprings, spring);\n      delete this._springRegistry[spring.getId()];\n    },\n\n    advance: function (time, deltaTime) {\n      while (this._idleSpringIndices.length > 0) this._idleSpringIndices.pop();\n      for (var i = 0, len = this._activeSprings.length; i < len; i++) {\n        var spring = this._activeSprings[i];\n        if (spring.systemShouldAdvance()) {\n          spring.advance(time / 1000.0, deltaTime / 1000.0);\n        } else {\n          this._idleSpringIndices.push(this._activeSprings.indexOf(spring));\n        }\n      }\n      while (this._idleSpringIndices.length > 0) {\n        var idx = this._idleSpringIndices.pop();\n        idx >= 0 && this._activeSprings.splice(idx, 1);\n      }\n    },\n\n    // This is our main solver loop called to move the simulation\n    // forward through time. Before each pass in the solver loop\n    // onBeforeIntegrate is called on an any listeners that have\n    // registered themeselves with the SpringSystem. This gives you\n    // an opportunity to apply any constraints or adjustments to\n    // the springs that should be enforced before each iteration\n    // loop. Next the advance method is called to move each Spring in\n    // the systemShouldAdvance forward to the current time. After the\n    // integration step runs in advance, onAfterIntegrate is called\n    // on any listeners that have registered themselves with the\n    // SpringSystem. This gives you an opportunity to run any post\n    // integration constraints or adjustments on the Springs in the\n    // SpringSystem.\n    loop: function (currentTimeMillis) {\n      var listener;\n      if (this._lastTimeMillis === -1) {\n        this._lastTimeMillis = currentTimeMillis - 1;\n      }\n      var ellapsedMillis = currentTimeMillis - this._lastTimeMillis;\n      this._lastTimeMillis = currentTimeMillis;\n\n      var i = 0, len = this.listeners.length;\n      for (i = 0; i < len; i++) {\n        var listener = this.listeners[i];\n        listener.onBeforeIntegrate && listener.onBeforeIntegrate(this);\n      }\n\n      this.advance(currentTimeMillis, ellapsedMillis);\n      if (this._activeSprings.length === 0) {\n        this._isIdle = true;\n        this._lastTimeMillis = -1;\n      }\n\n      for (i = 0; i < len; i++) {\n        var listener = this.listeners[i];\n        listener.onAfterIntegrate && listener.onAfterIntegrate(this);\n      }\n\n      if (!this._isIdle) {\n        this.looper.run();\n      }\n    },\n\n    // activateSpring is used to notify the SpringSystem that a Spring\n    // has become displaced. The system responds by starting its solver\n    // loop up if it is currently idle.\n    activateSpring: function (springId) {\n      var spring = this._springRegistry[springId];\n      if (this._activeSprings.indexOf(spring) == -1) {\n        this._activeSprings.push(spring);\n      }\n      if (this.getIsIdle()) {\n        this._isIdle = false;\n        this.looper.run();\n      }\n    },\n\n    // Add a listener to the SpringSystem so that you can receive\n    // before/after integration notifications allowing Springs to be\n    // constrained or adjusted.\n    addListener: function (listener) {\n      this.listeners.push(listener);\n    },\n\n    // Remove a previously added listener on the SpringSystem.\n    removeListener: function (listener) {\n      removeFirst(this.listeners, listener);\n    },\n\n    // Remove all previously added listeners on the SpringSystem.\n    removeAllListeners: function () {\n      this.listeners = [];\n    }\n\n  });\n\n  // Spring\n  // ------\n  // **Spring** provides a model of a classical spring acting to\n  // resolve a body to equilibrium. Springs have configurable\n  // tension which is a force multipler on the displacement of the\n  // spring from its rest point or `endValue` as defined by [Hooke’s\n  // law](http://en.wikipedia.org/wiki/Hooke's_law). Springs also have\n  // configurable friction, which ensures that they do not oscillate\n  // infinitely. When a Spring is displaced by updating it’s resting\n  // or `currentValue`, the SpringSystems that contain that Spring\n  // will automatically start looping to solve for equilibrium. As each\n  // timestep passes, `SpringListener` objects attached to the Spring\n  // will be notified of the updates providing a way to drive an\n  // animation off of the spring's resolution curve.\n  var Spring = rebound.Spring = function Spring(springSystem) {\n    this._id = 's' + Spring._ID++;\n    this._springSystem = springSystem;\n    this.listeners = [];\n    this._currentState = new PhysicsState();\n    this._previousState = new PhysicsState();\n    this._tempState = new PhysicsState();\n  };\n\n  util.extend(Spring, {\n    _ID: 0,\n\n    MAX_DELTA_TIME_SEC: 0.064,\n\n    SOLVER_TIMESTEP_SEC: 0.001\n\n  });\n\n  util.extend(Spring.prototype, {\n\n    _id: 0,\n\n    _springConfig: null,\n\n    _overshootClampingEnabled: false,\n\n    _currentState: null,\n\n    _previousState: null,\n\n    _tempState: null,\n\n    _startValue: 0,\n\n    _endValue: 0,\n\n    _wasAtRest: true,\n\n    _restSpeedThreshold: 0.001,\n\n    _displacementFromRestThreshold: 0.001,\n\n    listeners: null,\n\n    _timeAccumulator: 0,\n\n    _springSystem: null,\n\n    // Remove a Spring from simulation and clear its listeners.\n    destroy: function () {\n      this.listeners = [];\n      this.frames = [];\n      this._springSystem.deregisterSpring(this);\n    },\n\n    // Get the id of the spring, which can be used to retrieve it from\n    // the SpringSystems it participates in later.\n    getId: function () {\n      return this._id;\n    },\n\n    // Set the configuration values for this Spring. A SpringConfig\n    // contains the tension and friction values used to solve for the\n    // equilibrium of the Spring in the physics loop.\n    setSpringConfig: function (springConfig) {\n      this._springConfig = springConfig;\n      return this;\n    },\n\n    // Retrieve the SpringConfig used by this Spring.\n    getSpringConfig: function () {\n      return this._springConfig;\n    },\n\n    // Set the current position of this Spring. Listeners will be updated\n    // with this value immediately. If the rest or `endValue` is not\n    // updated to match this value, then the spring will be dispalced and\n    // the SpringSystem will start to loop to restore the spring to the\n    // `endValue`.\n    //\n    // A common pattern is to move a Spring around without animation by\n    // calling.\n    //\n    // ```\n    // spring.setCurrentValue(n).setAtRest();\n    // ```\n    //\n    // This moves the Spring to a new position `n`, sets the endValue\n    // to `n`, and removes any velocity from the `Spring`. By doing\n    // this you can allow the `SpringListener` to manage the position\n    // of UI elements attached to the spring even when moving without\n    // animation. For example, when dragging an element you can\n    // update the position of an attached view through a spring\n    // by calling `spring.setCurrentValue(x)`. When\n    // the gesture ends you can update the Springs\n    // velocity and endValue\n    // `spring.setVelocity(gestureEndVelocity).setEndValue(flingTarget)`\n    // to cause it to naturally animate the UI element to the resting\n    // position taking into account existing velocity. The codepaths for\n    // synchronous movement and spring driven animation can\n    // be unified using this technique.\n    setCurrentValue: function (currentValue, skipSetAtRest) {\n      this._startValue = currentValue;\n      this._currentState.position = currentValue;\n      if (!skipSetAtRest) {\n        this.setAtRest();\n      }\n      this.notifyPositionUpdated(false, false);\n      return this;\n    },\n\n    // Get the position that the most recent animation started at. This\n    // can be useful for determining the number off oscillations that\n    // have occurred.\n    getStartValue: function () {\n      return this._startValue;\n    },\n\n    // Retrieve the current value of the Spring.\n    getCurrentValue: function () {\n      return this._currentState.position;\n    },\n\n    // Get the absolute distance of the Spring from it’s resting endValue position.\n    getCurrentDisplacementDistance: function () {\n      return this.getDisplacementDistanceForState(this._currentState);\n    },\n\n    getDisplacementDistanceForState: function (state) {\n      return Math.abs(this._endValue - state.position);\n    },\n\n    // Set the endValue or resting position of the spring. If this\n    // value is different than the current value, the SpringSystem will\n    // be notified and will begin running its solver loop to resolve\n    // the Spring to equilibrium. Any listeners that are registered\n    // for onSpringEndStateChange will also be notified of this update\n    // immediately.\n    setEndValue: function (endValue) {\n      if (this._endValue == endValue && this.isAtRest()) {\n        return this;\n      }\n      this._startValue = this.getCurrentValue();\n      this._endValue = endValue;\n      this._springSystem.activateSpring(this.getId());\n      for (var i = 0, len = this.listeners.length; i < len; i++) {\n        var listener = this.listeners[i];\n        listener.onSpringEndStateChange && listener.onSpringEndStateChange(this);\n      }\n      return this;\n    },\n\n    // Retrieve the endValue or resting position of this spring.\n    getEndValue: function () {\n      return this._endValue;\n    },\n\n    // Set the current velocity of the Spring. As previously mentioned,\n    // this can be useful when you are performing a direct manipulation\n    // gesture. When a UI element is released you may call setVelocity\n    // on its animation Spring so that the Spring continues with the\n    // same velocity as the gesture ended with. The friction, tension,\n    // and displacement of the Spring will then govern its motion to\n    // return to rest on a natural feeling curve.\n    setVelocity: function (velocity) {\n      if (velocity === this._currentState.velocity) {\n        return this;\n      }\n      this._currentState.velocity = velocity;\n      this._springSystem.activateSpring(this.getId());\n      return this;\n    },\n\n    // Get the current velocity of the Spring.\n    getVelocity: function () {\n      return this._currentState.velocity;\n    },\n\n    // Set a threshold value for the movement speed of the Spring below\n    // which it will be considered to be not moving or resting.\n    setRestSpeedThreshold: function (restSpeedThreshold) {\n      this._restSpeedThreshold = restSpeedThreshold;\n      return this;\n    },\n\n    // Retrieve the rest speed threshold for this Spring.\n    getRestSpeedThreshold: function () {\n      return this._restSpeedThreshold;\n    },\n\n    // Set a threshold value for displacement below which the Spring\n    // will be considered to be not displaced i.e. at its resting\n    // `endValue`.\n    setRestDisplacementThreshold: function (displacementFromRestThreshold) {\n      this._displacementFromRestThreshold = displacementFromRestThreshold;\n    },\n\n    // Retrieve the rest displacement threshold for this spring.\n    getRestDisplacementThreshold: function () {\n      return this._displacementFromRestThreshold;\n    },\n\n    // Enable overshoot clamping. This means that the Spring will stop\n    // immediately when it reaches its resting position regardless of\n    // any existing momentum it may have. This can be useful for certain\n    // types of animations that should not oscillate such as a scale\n    // down to 0 or alpha fade.\n    setOvershootClampingEnabled: function (enabled) {\n      this._overshootClampingEnabled = enabled;\n      return this;\n    },\n\n    // Check if overshoot clamping is enabled for this spring.\n    isOvershootClampingEnabled: function () {\n      return this._overshootClampingEnabled;\n    },\n\n    // Check if the Spring has gone past its end point by comparing\n    // the direction it was moving in when it started to the current\n    // position and end value.\n    isOvershooting: function () {\n      return this._springConfig.tension > 0 &&\n        ((this._startValue < this._endValue && this.getCurrentValue() > this._endValue) ||\n        (this._startValue > this._endValue && this.getCurrentValue() < this._endValue));\n    },\n\n    // Spring.advance is the main solver method for the Spring. It takes\n    // the current time and delta since the last time step and performs\n    // an RK4 integration to get the new position and velocity state\n    // for the Spring based on the tension, friction, velocity, and\n    // displacement of the Spring.\n    advance: function (time, realDeltaTime) {\n      var isAtRest = this.isAtRest();\n\n      if (isAtRest && this._wasAtRest) {\n        return;\n      }\n\n      var adjustedDeltaTime = realDeltaTime;\n      if (realDeltaTime > Spring.MAX_DELTA_TIME_SEC) {\n        adjustedDeltaTime = Spring.MAX_DELTA_TIME_SEC;\n      }\n\n      this._timeAccumulator += adjustedDeltaTime;\n\n      var tension = this._springConfig.tension,\n        friction = this._springConfig.friction,\n\n        position = this._currentState.position,\n        velocity = this._currentState.velocity,\n        tempPosition = this._tempState.position,\n        tempVelocity = this._tempState.velocity,\n\n        aVelocity, aAcceleration,\n        bVelocity, bAcceleration,\n        cVelocity, cAcceleration,\n        dVelocity, dAcceleration,\n\n        dxdt, dvdt;\n\n      while (this._timeAccumulator >= Spring.SOLVER_TIMESTEP_SEC) {\n\n        this._timeAccumulator -= Spring.SOLVER_TIMESTEP_SEC;\n\n        if (this._timeAccumulator < Spring.SOLVER_TIMESTEP_SEC) {\n          this._previousState.position = position;\n          this._previousState.velocity = velocity;\n        }\n\n        aVelocity = velocity;\n        aAcceleration = (tension * (this._endValue - tempPosition)) - friction * velocity;\n\n        tempPosition = position + aVelocity * Spring.SOLVER_TIMESTEP_SEC * 0.5;\n        tempVelocity = velocity + aAcceleration * Spring.SOLVER_TIMESTEP_SEC * 0.5;\n        bVelocity = tempVelocity;\n        bAcceleration = (tension * (this._endValue - tempPosition)) - friction * tempVelocity;\n\n        tempPosition = position + bVelocity * Spring.SOLVER_TIMESTEP_SEC * 0.5;\n        tempVelocity = velocity + bAcceleration * Spring.SOLVER_TIMESTEP_SEC * 0.5;\n        cVelocity = tempVelocity;\n        cAcceleration = (tension * (this._endValue - tempPosition)) - friction * tempVelocity;\n\n        tempPosition = position + cVelocity * Spring.SOLVER_TIMESTEP_SEC * 0.5;\n        tempVelocity = velocity + cAcceleration * Spring.SOLVER_TIMESTEP_SEC * 0.5;\n        dVelocity = tempVelocity;\n        dAcceleration = (tension * (this._endValue - tempPosition)) - friction * tempVelocity;\n\n        dxdt = 1.0 / 6.0 * (aVelocity + 2.0 * (bVelocity + cVelocity) + dVelocity);\n        dvdt = 1.0 / 6.0 *\n          (aAcceleration + 2.0 * (bAcceleration + cAcceleration) + dAcceleration);\n\n        position += dxdt * Spring.SOLVER_TIMESTEP_SEC;\n        velocity += dvdt * Spring.SOLVER_TIMESTEP_SEC;\n      }\n\n      this._tempState.position = tempPosition;\n      this._tempState.velocity = tempVelocity;\n\n      this._currentState.position = position;\n      this._currentState.velocity = velocity;\n\n      if (this._timeAccumulator > 0) {\n        this.interpolate(this._timeAccumulator / Spring.SOLVER_TIMESTEP_SEC);\n      }\n\n      if (this.isAtRest() ||\n        this._overshootClampingEnabled && this.isOvershooting()) {\n\n        if (this._springConfig.tension > 0) {\n          this._startValue = this._endValue;\n          this._currentState.position = this._endValue;\n        } else {\n          this._endValue = this._currentState.position;\n          this._startValue = this._endValue;\n        }\n        this.setVelocity(0);\n        isAtRest = true;\n      }\n\n      var notifyActivate = false;\n      if (this._wasAtRest) {\n        this._wasAtRest = false;\n        notifyActivate = true;\n      }\n\n      var notifyAtRest = false;\n      if (isAtRest) {\n        this._wasAtRest = true;\n        notifyAtRest = true;\n      }\n\n      this.notifyPositionUpdated(notifyActivate, notifyAtRest);\n    },\n\n    notifyPositionUpdated: function (notifyActivate, notifyAtRest) {\n      for (var i = 0, len = this.listeners.length; i < len; i++) {\n        var listener = this.listeners[i];\n        if (notifyActivate && listener.onSpringActivate) {\n          listener.onSpringActivate(this);\n        }\n\n        if (listener.onSpringUpdate) {\n          listener.onSpringUpdate(this);\n        }\n\n        if (notifyAtRest && listener.onSpringAtRest) {\n          listener.onSpringAtRest(this);\n        }\n      }\n    },\n\n\n    // Check if the SpringSystem should advance. Springs are advanced\n    // a final frame after they reach equilibrium to ensure that the\n    // currentValue is exactly the requested endValue regardless of the\n    // displacement threshold.\n    systemShouldAdvance: function () {\n      return !this.isAtRest() || !this.wasAtRest();\n    },\n\n    wasAtRest: function () {\n      return this._wasAtRest;\n    },\n\n    // Check if the Spring is atRest meaning that it’s currentValue and\n    // endValue are the same and that it has no velocity. The previously\n    // described thresholds for speed and displacement define the bounds\n    // of this equivalence check. If the Spring has 0 tension, then it will\n    // be considered at rest whenever its absolute velocity drops below the\n    // restSpeedThreshold.\n    isAtRest: function () {\n      return Math.abs(this._currentState.velocity) < this._restSpeedThreshold &&\n        (this.getDisplacementDistanceForState(this._currentState) <= this._displacementFromRestThreshold ||\n        this._springConfig.tension === 0);\n    },\n\n    // Force the spring to be at rest at its current position. As\n    // described in the documentation for setCurrentValue, this method\n    // makes it easy to do synchronous non-animated updates to ui\n    // elements that are attached to springs via SpringListeners.\n    setAtRest: function () {\n      this._endValue = this._currentState.position;\n      this._tempState.position = this._currentState.position;\n      this._currentState.velocity = 0;\n      return this;\n    },\n\n    interpolate: function (alpha) {\n      this._currentState.position = this._currentState.position *\n        alpha + this._previousState.position * (1 - alpha);\n      this._currentState.velocity = this._currentState.velocity *\n        alpha + this._previousState.velocity * (1 - alpha);\n    },\n\n    getListeners: function () {\n      return this.listeners;\n    },\n\n    addListener: function (newListener) {\n      this.listeners.push(newListener);\n      return this;\n    },\n\n    removeListener: function (listenerToRemove) {\n      removeFirst(this.listeners, listenerToRemove);\n      return this;\n    },\n\n    removeAllListeners: function () {\n      this.listeners = [];\n      return this;\n    },\n\n    currentValueIsApproximately: function (value) {\n      return Math.abs(this.getCurrentValue() - value) <=\n        this.getRestDisplacementThreshold();\n    }\n\n  });\n\n  // PhysicsState\n  // ------------\n  // **PhysicsState** consists of a position and velocity. A Spring uses\n  // this internally to keep track of its current and prior position and\n  // velocity values.\n  var PhysicsState = function PhysicsState() {\n  };\n\n  util.extend(PhysicsState.prototype, {\n    position: 0,\n    velocity: 0\n  });\n\n  // SpringConfig\n  // ------------\n  // **SpringConfig** maintains a set of tension and friction constants\n  // for a Spring. You can use fromOrigamiTensionAndFriction to convert\n  // values from the [Origami](http://facebook.github.io/origami/)\n  // design tool directly to Rebound spring constants.\n  var SpringConfig = rebound.SpringConfig =\n    function SpringConfig(tension, friction) {\n      this.tension = tension;\n      this.friction = friction;\n    };\n\n  // Loopers\n  // -------\n  // **AnimationLooper** plays each frame of the SpringSystem on animation timing loop.\n  // This is the default type of looper for a new spring system as it is the most common\n  // when developing UI.\n  var AnimationLooper = rebound.AnimationLooper = function AnimationLooper() {\n    this.springSystem = null;\n    var _this = this;\n    var _run = function () {\n      _this.springSystem.loop(Date.now());\n    };\n\n    this.run = function () {\n      util.onFrame(_run);\n    }\n  };\n\n  // **SimulationLooper** resolves the SpringSystem to a resting state in a\n  // tight and blocking loop. This is useful for synchronously generating pre-recorded\n  // animations that can then be played on a timing loop later. Sometimes this lead to\n  // better performance to pre-record a single spring curve and use it to drive many\n  // animations; however, it can make dynamic response to user input a bit trickier to\n  // implement.\n  var SimulationLooper = rebound.SimulationLooper = function SimulationLooper(timestep) {\n    this.springSystem = null;\n    var time = 0;\n    var running = false;\n    timestep = timestep || 16.667;\n\n    this.run = function () {\n      if (running) {\n        return;\n      }\n      running = true;\n      while (!this.springSystem.getIsIdle()) {\n        this.springSystem.loop(time += timestep);\n      }\n      running = false;\n    }\n  };\n\n  // **SteppingSimulationLooper** resolves the SpringSystem one step at a time controlled\n  // by an outside loop. This is useful for testing and verifying the behavior of a SpringSystem\n  // or if you want to control your own timing loop for some reason e.g. slowing down or speeding\n  // up the simulation.\n  var SteppingSimulationLooper = rebound.SteppingSimulationLooper = function (timestep) {\n    this.springSystem = null;\n    var time = 0;\n    var running = false;\n\n    // this.run is NOOP'd here to allow control from the outside using this.step.\n    this.run = function () {\n    };\n\n    // Perform one step toward resolving the SpringSystem.\n    this.step = function (timestep) {\n      this.springSystem.loop(time += timestep);\n    }\n  };\n\n  // Math for converting from\n  // [Origami](http://facebook.github.io/origami/) to\n  // [Rebound](http://facebook.github.io/rebound).\n  // You mostly don't need to worry about this, just use\n  // SpringConfig.fromOrigamiTensionAndFriction(v, v);\n  var OrigamiValueConverter = rebound.OrigamiValueConverter = {\n    tensionFromOrigamiValue: function (oValue) {\n      return (oValue - 30.0) * 3.62 + 194.0;\n    },\n\n    origamiValueFromTension: function (tension) {\n      return (tension - 194.0) / 3.62 + 30.0;\n    },\n\n    frictionFromOrigamiValue: function (oValue) {\n      return (oValue - 8.0) * 3.0 + 25.0;\n    },\n\n    origamiFromFriction: function (friction) {\n      return (friction - 25.0) / 3.0 + 8.0;\n    }\n  };\n\n  util.extend(SpringConfig, {\n    // Convert an origami Spring tension and friction to Rebound spring\n    // constants. If you are prototyping a design with Origami, this\n    // makes it easy to make your springs behave exactly the same in\n    // Rebound.\n    fromOrigamiTensionAndFriction: function (tension, friction) {\n      return new SpringConfig(\n        OrigamiValueConverter.tensionFromOrigamiValue(tension),\n        OrigamiValueConverter.frictionFromOrigamiValue(friction));\n    },\n\n    // Create a SpringConfig with no tension or a coasting spring with some amount\n    // of Friction so that it does not coast infininitely.\n    coastingConfigWithOrigamiFriction: function (friction) {\n      return new SpringConfig(0, OrigamiValueConverter.frictionFromOrigamiValue(friction));\n    }\n  });\n\n  SpringConfig.DEFAULT_ORIGAMI_SPRING_CONFIG = SpringConfig.fromOrigamiTensionAndFriction(40, 7);\n\n  util.extend(SpringConfig.prototype, {friction: 0, tension: 0});\n\n  // Here are a couple of function to convert colors between hex codes and RGB\n  // component values. These are handy when performing color tweening animations.\n  var colorCache = {};\n  util.hexToRGB = function (color) {\n    if (colorCache[color]) {\n      return colorCache[color];\n    }\n    color = color.replace('#', '');\n    if (color.length === 3) {\n      color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2];\n    }\n    var parts = color.match(/.{2}/g);\n\n    var color = {\n      r: parseInt(parts[0], 16),\n      g: parseInt(parts[1], 16),\n      b: parseInt(parts[2], 16)\n    };\n\n    colorCache[color] = color;\n    return color;\n  };\n\n  util.rgbToHex = function (r, g, b) {\n    r = r.toString(16);\n    g = g.toString(16);\n    b = b.toString(16);\n    r = r.length < 2 ? '0' + r : r;\n    g = g.length < 2 ? '0' + g : g;\n    b = b.length < 2 ? '0' + b : b;\n    return '#' + r + g + b;\n  };\n\n  var MathUtil = rebound.MathUtil = {\n    // This helper function does a linear interpolation of a value from\n    // one range to another. This can be very useful for converting the\n    // motion of a Spring to a range of UI property values. For example a\n    // spring moving from position 0 to 1 could be interpolated to move a\n    // view from pixel 300 to 350 and scale it from 0.5 to 1. The current\n    // position of the `Spring` just needs to be run through this method\n    // taking its input range in the _from_ parameters with the property\n    // animation range in the _to_ parameters.\n    mapValueInRange: function (value, fromLow, fromHigh, toLow, toHigh) {\n      var fromRangeSize = fromHigh - fromLow;\n      var toRangeSize = toHigh - toLow;\n      var valueScale = (value - fromLow) / fromRangeSize;\n      return toLow + (valueScale * toRangeSize);\n    },\n\n    // Interpolate two hex colors in a 0 - 1 range or optionally provide a custom range\n    // with fromLow,fromHight. The output will be in hex by default unless asRGB is true\n    // in which case it will be returned as an rgb string.\n    interpolateColor: function (val, startColor, endColor, fromLow, fromHigh, asRGB) {\n      fromLow = typeof fromLow === 'undefined' ? 0 : fromLow;\n      fromHigh = typeof fromHigh === 'undefined' ? 1 : fromHigh;\n      var startColor = util.hexToRGB(startColor);\n      var endColor = util.hexToRGB(endColor);\n      var r = Math.floor(util.mapValueInRange(val, fromLow, fromHigh, startColor.r, endColor.r));\n      var g = Math.floor(util.mapValueInRange(val, fromLow, fromHigh, startColor.g, endColor.g));\n      var b = Math.floor(util.mapValueInRange(val, fromLow, fromHigh, startColor.b, endColor.b));\n      if (asRGB) {\n        return 'rgb(' + r + ',' + g + ',' + b + ')';\n      } else {\n        return util.rgbToHex(r, g, b);\n      }\n    },\n\n    degreesToRadians: function (deg) {\n      return (deg * Math.PI) / 180;\n    },\n\n    radiansToDegrees: function (rad) {\n      return (rad * 180) / Math.PI;\n    }\n\n  }\n\n  util.extend(util, MathUtil);\n\n\n  // Utilities\n  // ---------\n  // Here are a few useful JavaScript utilities.\n\n  // Lop off the first occurence of the reference in the Array.\n  function removeFirst(array, item) {\n    var idx = array.indexOf(item);\n    idx != -1 && array.splice(idx, 1);\n  }\n\n  var _onFrame;\n  if (typeof window !== 'undefined') {\n    _onFrame = window.requestAnimationFrame ||\n      window.webkitRequestAnimationFrame ||\n      window.mozRequestAnimationFrame ||\n      window.msRequestAnimationFrame ||\n      window.oRequestAnimationFrame;\n  }\n  if (!_onFrame && typeof process !== 'undefined' && process.title === 'node') {\n    _onFrame = setImmediate;\n  }\n\n  // Cross browser/node timer functions.\n  util.onFrame = function onFrame(func) {\n    return _onFrame(func);\n  }\n\n  // Export the public api using exports for common js or the window for\n  // normal browser inclusion.\n  if (typeof exports != 'undefined') {\n    util.extend(exports, rebound);\n  } else if (typeof window != 'undefined') {\n    window.rebound = rebound;\n  }\n})();\n\n// Legal Stuff\n// -----------\n/**\n *  Copyright (c) 2013, Facebook, Inc.\n *  All rights reserved.\n *\n *  This source code is licensed under the BSD-style license found in the\n *  LICENSE file in the root directory of this source tree. An additional grant\n *  of patent rights can be found in the PATENTS file in the same directory.\n */\n"
  },
  {
    "path": "app/templates/app/src/lib/swing/card.js",
    "content": "/* global window, navigator */\nvar global = window;\n\nvar Card,\n  Sister = require('lib/swing/sister'),\n  Hammer = require('lib/hammer') || window['Hammer'],\n  rebound = require('lib/rebound'),\n  vendorPrefix = require('lib/swing/vendor-prefix'),\n  dom = require('lib/swing/dom'),\n  util = {},\n  _isTouchDevice,\n  requestAnimFrame,\n  requestAnimFrame;\n\n/**\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random\n */\nutil.randomInt = function (min, max) {\n  return Math.floor(Math.random() * (max - min + 1)) + min;\n};\n\n//http://notes.jetienne.com/2011/05/18/cancelRequestAnimFrame-for-paul-irish-requestAnimFrame.html\ncancelRequestAnimFrame = (function () {\n  return window.cancelAnimationFrame ||\n    window.webkitCancelRequestAnimationFrame ||\n    clearTimeout\n})();\nrequestAnimFrame = (function () {\n  return window.requestAnimationFrame ||\n    window.webkitRequestAnimationFrame ||\n    function (/* function */ callback, /* DOMElement */ element) {\n      return window.setTimeout(callback, 1000 / 60);\n    };\n})();\n\n/**\n * @param {Stack} stack\n * @param {HTMLElement} targetElement\n */\nCard = function Card(stack, targetElement) {\n  var card,\n    config,\n    eventEmitter,\n    springSystem,\n    springThrowIn,\n    springThrowOut,\n    lastThrow,\n    lastTranslate,\n    throwOutDistance,\n    onSpringUpdate,\n    throwWhere,\n    mc,\n    defaultThreshold = 0.05,\n    dragTimer = 0,\n    isDraging = false,\n    curX = 0,\n    curY = 0;\n\n\n  if (!(this instanceof Card)) {\n    return new Card(stack, targetElement);\n  }\n\n  card = this;\n  config = Card.config(stack.config());\n  eventEmitter = Sister();\n  springSystem = stack.springSystem();\n  springThrowIn = springSystem.createSpring(250, 10);\n  springThrowOut = springSystem.createSpring(500, 20);\n  lastThrow = {};\n  lastTranslate = {x: 0, y: 0};\n\n  springThrowIn.setRestSpeedThreshold(defaultThreshold);\n  springThrowIn.setRestDisplacementThreshold(defaultThreshold);\n\n  springThrowOut.setRestSpeedThreshold(defaultThreshold);\n  springThrowOut.setRestDisplacementThreshold(defaultThreshold);\n\n  throwOutDistance = config.throwOutDistance(config.minThrowOutDistance, config.maxThrowOutDistance);\n\n  mc = new Hammer.Manager(targetElement, {\n    recognizers: [\n      [Hammer.Pan, {threshold: 2}]\n    ]\n  });\n\n  Card.appendToParent(targetElement);\n\n\n  function doMove() {\n    var x = lastTranslate.x + curX,\n      y = lastTranslate.y + curY,\n      r = config.rotation(x, y, targetElement, config.maxRotation);\n\n    config.transform(targetElement, x, y, r);\n\n    eventEmitter.trigger('dragmove', {\n      target: targetElement,\n      throwOutConfidence: config.throwOutConfidence(x, targetElement),\n      throwDirection: x < 0 ? Card.DIRECTION_LEFT : Card.DIRECTION_RIGHT\n    });\n\n  }\n\n  function cancelMove() {\n    dragTimer && cancelRequestAnimFrame(dragTimer);\n  }\n\n  eventEmitter.on('_panstart', function () {\n    Card.appendToParent(targetElement);\n\n    curX = curY = 0;\n\n    cancelMove();\n    isDraging = true;\n    //raf\n    (function animloop() {\n      if (!isDraging) {\n        return;\n      }\n      doMove();\n      dragTimer = requestAnimFrame(animloop);\n    })();\n    //end raf\n\n    eventEmitter.trigger('dragstart', {\n      target: targetElement\n    });\n  });\n\n  eventEmitter.on('_panmove', function (e) {\n    curX = e.deltaX;\n    curY = e.deltaY;\n  });\n\n  eventEmitter.on('_panend', function (e) {\n    isDraging = false;\n    cancelMove();\n    var x = lastTranslate.x + e.deltaX,\n      y = lastTranslate.y + e.deltaY;\n\n    if (config.isThrowOut(x, targetElement, config.throwOutConfidence(x, targetElement))) {\n      card.throwOut(x, y);\n    } else {\n      card.throwIn(x, y);\n    }\n\n    eventEmitter.trigger('dragend', {\n      target: targetElement\n    });\n  });\n\n  // \"mousedown\" event fires late on touch enabled devices, thus listening\n  // to the touchstart event for touch enabled devices and mousedown otherwise.\n  if (_isTouchDevice()) {\n    targetElement.addEventListener('touchstart', function () {\n      eventEmitter.trigger('_panstart');\n    });\n\n    // Disable scrolling while dragging the element on the touch enabled devices.\n    // @see http://stackoverflow.com/a/12090055/368691\n    (function () {\n      var dragging;\n\n      targetElement.addEventListener('touchstart', function () {\n        dragging = true;\n      });\n\n      targetElement.addEventListener('touchend', function () {\n        dragging = false;\n      });\n\n      global.addEventListener('touchmove', function (e) {\n        if (dragging) {\n          e.preventDefault();\n        }\n      });\n    }());\n  } else {\n    targetElement.addEventListener('mousedown', function () {\n      eventEmitter.trigger('_panstart');\n    });\n  }\n\n  mc.on('panmove', function (e) {\n    eventEmitter.trigger('_panmove', e);\n  });\n\n  mc.on('panend', function (e) {\n    eventEmitter.trigger('_panend', e);\n  });\n\n  springThrowIn.addListener({\n    onSpringUpdate: function (spring) {\n      var value = spring.getCurrentValue(),\n        x = rebound.MathUtil.mapValueInRange(value, 0, 1, lastThrow.fromX, 0),\n        y = rebound.MathUtil.mapValueInRange(value, 0, 1, lastThrow.fromY, 0);\n\n      onSpringUpdate(x, y);\n    },\n    onSpringAtRest: function () {\n      eventEmitter.trigger('throwinend', {\n        target: targetElement\n      });\n    }\n  });\n\n  springThrowOut.addListener({\n    onSpringUpdate: function (spring) {\n      var value = spring.getCurrentValue(),\n        x = rebound.MathUtil.mapValueInRange(value, 0, 1, lastThrow.fromX, throwOutDistance * lastThrow.direction),\n        y = lastThrow.fromY;\n\n      onSpringUpdate(x, y);\n    },\n    onSpringAtRest: function () {\n      eventEmitter.trigger('throwoutend', {\n        target: targetElement\n      });\n    }\n  });\n\n  /**\n   * Invoked every time the physics solver updates the Spring's value.\n   *\n   * @param {Number} x\n   * @param {Number} y\n   */\n  onSpringUpdate = function (x, y) {\n    var r = config.rotation(x, y, targetElement, config.maxRotation);\n\n    lastTranslate.x = x || 0;\n    lastTranslate.y = y || 0;\n\n    Card.transform(targetElement, x, y, r);\n  };\n\n  /**\n   * Alias\n   */\n  card.on = eventEmitter.on;\n  card._trigger = eventEmitter.trigger;\n\n  /**\n   * Throws a card into the stack from an arbitrary position.\n   *\n   * @param {Number} fromX\n   * @param {Number} fromY\n   */\n  card.throwIn = function (fromX, fromY) {\n    throwWhere(Card.THROW_IN, fromX, fromY);\n  };\n\n  /**\n   * Throws a card out of the stack in the direction away from the original offset.\n   *\n   * @param {Number} fromX\n   * @param {Number} fromY\n   */\n  card.throwOut = function (fromX, fromY) {\n    throwWhere(Card.THROW_OUT, fromX, fromY);\n  };\n\n  /**\n   * Unbinds all Hammer.Manager events.\n   * Removes the listeners from the physics simulation.\n   */\n  card.destroy = function () {\n    cancelMove();\n\n    mc.destroy();\n    springThrowIn.destroy();\n    springThrowOut.destroy();\n\n    stack._destroyCard(card);\n  };\n\n  /**\n   * @param {Card.THROW_IN|Card.THROW_OUT} where\n   * @param {Number} fromX\n   * @param {Number} fromY\n   */\n  throwWhere = function (where, fromX, fromY) {\n    lastThrow.fromX = fromX;\n    lastThrow.fromY = fromY;\n    lastThrow.direction = lastThrow.fromX < 0 ? Card.DIRECTION_LEFT : Card.DIRECTION_RIGHT;\n\n    if (where === Card.THROW_IN) {\n      springThrowIn.setCurrentValue(0).setAtRest().setEndValue(1);\n\n      eventEmitter.trigger('throwin', {\n        target: targetElement,\n        throwDirection: lastThrow.direction\n      });\n    } else if (where === Card.THROW_OUT) {\n      springThrowOut.setCurrentValue(0).setAtRest().setVelocity(100).setEndValue(1);\n\n      eventEmitter.trigger('throwout', {\n        target: targetElement,\n        throwDirection: lastThrow.direction\n      });\n\n      if (lastThrow.direction === Card.DIRECTION_LEFT) {\n        eventEmitter.trigger('throwoutleft', {\n          target: targetElement,\n          throwDirection: lastThrow.direction\n        });\n      } else {\n        eventEmitter.trigger('throwoutright', {\n          target: targetElement,\n          throwDirection: lastThrow.direction\n        });\n      }\n    } else {\n      throw new Error('Invalid throw event.');\n    }\n  };\n\n  return card;\n};\n\n/**\n * Interprets stack.config() object. Sets default configuration.\n *\n * @param {Object} config\n * @return {Object}\n */\nCard.config = function (config) {\n  config = config || {};\n\n  config.isThrowOut = config.isThrowOut ? config.isThrowOut : Card.isThrowOut;\n\n  config.throwOutConfidence = config.throwOutConfidence ? config.throwOutConfidence : Card.throwOutConfidence;\n\n  config.throwOutDistance = config.throwOutDistance ? config.throwOutDistance : Card.throwOutDistance;\n  config.minThrowOutDistance = config.minThrowOutDistance ? config.minThrowOutDistance : 400;\n  config.maxThrowOutDistance = config.maxThrowOutDistance ? config.maxThrowOutDistance : 500;\n\n  config.rotation = config.rotation ? config.rotation : Card.rotation;\n  config.maxRotation = config.maxRotation ? config.maxRotation : 20;\n\n  config.transform = config.transform ? config.transform : Card.transform;\n\n  return config;\n};\n\n/**\n * Invoked in the event of `dragmove` and every time the physics solver is triggered.\n * Uses CSS transform to translate element position and rotation.\n *\n * @param {Number} x Horizontal offset from the startDrag.\n * @param {Number} y Vertical offset from the startDrag.\n * @return {null}\n */\nCard.transform = function (element, x, y, r) {\n  element.style[vendorPrefix('transform')] = 'translate3d(0, 0, 0) translate(' + x + 'px, ' + y + 'px) rotate(' + r + 'deg)';\n};\n\n/**\n * If element is not the last among the siblings, append the\n * element to the parentNode. The reason for using this as opposed to zIndex\n * is to allow CSS selector :nth-child, etc.\n *\n * Invoked in the event of mousedown.\n * Invoked when card is added to the stack.\n *\n * @param {HTMLElement} element The target element.\n */\nCard.appendToParent = function (element) {\n  var parent = element.parentNode,\n    siblings = dom.elementChildren(parent),\n    targetIndex = siblings.indexOf(element);\n\n  if (targetIndex + 1 !== siblings.length) {\n    parent.removeChild(element);\n    parent.appendChild(element);\n  }\n};\n\n/**\n * Invoked in the event of dragmove.\n * Returns a value between 0 and 1 indicating the completeness of the throw out condition.\n * Ration of the absolute distance from the original card position and element width.\n *\n * @param {Number} offset Distance from the dragStart.\n * @param {HTMLElement} element Element.\n * @return {Number}\n */\nCard.throwOutConfidence = function (offset, element) {\n  return Math.min(Math.abs(offset) / element.offsetWidth, 1);\n};\n\n/**\n * Invoked in the event of dragend.\n * Determines if element is being thrown out of the stack.\n * Element is considered to be thrown out when throwOutConfidence is equal to 1.\n *\n * @param {Number} offset Distance from the dragStart.\n * @param {HTMLElement} element Element.\n * @param {Number} throwOutConfidence config.throwOutConfidence\n * @return {Boolean}\n */\nCard.isThrowOut = function (offset, element, throwOutConfidence) {\n  return throwOutConfidence === 1;\n};\n\n/**\n * Invoked when card is added to the stack.\n * The card is thrown to this offset from the stack.\n * The value is a random number between minThrowOutDistance and maxThrowOutDistance.\n *\n * @return {Number}\n */\nCard.throwOutDistance = function (minThrowOutDistance, maxThrowOutDistance) {\n  return util.randomInt(minThrowOutDistance, maxThrowOutDistance);\n};\n\n/**\n * Rotation is equal to the proportion of horizontal and vertical offset\n * times the maximumRotation constant.\n *\n * @param {Number} x Horizontal offset from the startDrag.\n * @param {Number} y Vertical offset from the startDrag.\n * @param {HTMLElement} element Element.\n * @param {Number} maxRotation\n * @return {Number} Rotation angle expressed in degrees.\n */\nCard.rotation = function (x, y, element, maxRotation) {\n  var horizontalOffset = Math.min(Math.max(x / element.offsetWidth, -1), 1),\n    verticalOffset = (y > 0 ? 1 : -1) * Math.min(Math.abs(y) / 100, 1),\n    rotation = horizontalOffset * verticalOffset * maxRotation;\n\n  return rotation;\n};\n\n/**\n * @see http://stackoverflow.com/questions/4817029/whats-the-best-way-to-detect-a-touch-screen-device-using-javascript/4819886#4819886\n */\n_isTouchDevice = function () {\n  return 'ontouchstart' in window || navigator.msMaxTouchPoints;\n};\n\nCard.DIRECTION_LEFT = -1;\nCard.DIRECTION_RIGHT = 1;\n\nCard.THROW_IN = 'in';\nCard.THROW_OUT = 'out';\n\nmodule.exports = Card;\n"
  },
  {
    "path": "app/templates/app/src/lib/swing/dom.js",
    "content": "var dom = {};\n\n/**\n * Return direct children elements.\n *\n * @see http://stackoverflow.com/a/27102446/368691\n * @param {HTMLElement}\n * @return {Array}\n */\ndom.elementChildren = function (element) {\n  var childNodes = element.childNodes,\n    children = [],\n    i = childNodes.length;\n\n  while (i--) {\n    if (childNodes[i].nodeType === 1) {\n      children.unshift(childNodes[i]);\n    }\n  }\n\n  return children;\n};\n\nmodule.exports = dom;\n"
  },
  {
    "path": "app/templates/app/src/lib/swing/sister.js",
    "content": "var global = window;\n\n/**\n * @link https://github.com/gajus/sister for the canonical source repository\n * @license https://github.com/gajus/sister/blob/master/LICENSE BSD 3-Clause\n */\nfunction Sister() {\n  var sister = {},\n    events = {};\n\n  /**\n   * @name handler\n   * @function\n   * @param {Object} data Event data.\n   */\n\n  /**\n   * @param {String} name Event name.\n   * @param {handler} handler\n   * @return {listener}\n   */\n  sister.on = function (name, handler) {\n    var listener = {name: name, handler: handler};\n    events[name] = events[name] || [];\n    events[name].unshift(listener);\n    return listener;\n  };\n\n  /**\n   * @param {listener}\n   */\n  sister.off = function (listener) {\n    var index = events[listener.name].indexOf(listener);\n\n    if (index != -1) {\n      events[listener.name].splice(index, 1);\n    }\n  };\n\n  /**\n   * @param {String} name Event name.\n   * @param {Object} data Event data.\n   */\n  sister.trigger = function (name, data) {\n    var listeners = events[name],\n      i;\n\n    if (listeners) {\n      i = listeners.length;\n      while (i--) {\n        listeners[i].handler(data);\n      }\n    }\n  };\n\n  return sister;\n}\n\nglobal.gajus = global.gajus || {};\nglobal.gajus.Sister = Sister;\n\nmodule.exports = Sister;\n"
  },
  {
    "path": "app/templates/app/src/lib/swing/stack.js",
    "content": "var Stack,\n  Sister = require('lib/swing/sister'),\n  rebound = require('lib/rebound'),\n  Card = require('lib/swing/card');\n\n/**\n * @param {Object} config\n */\nStack = function Stack(config) {\n  var stack,\n    springSystem,\n    eventEmitter,\n    index;\n\n  if (!(this instanceof Stack)) {\n    return new Stack(config);\n  }\n\n  stack = this;\n  springSystem = new rebound.SpringSystem();\n  eventEmitter = Sister();\n  index = [];\n\n  /**\n   * Get the configuration object.\n   *\n   * @return {Object}\n   */\n  stack.config = function () {\n    return config;\n  };\n\n  /**\n   * Get a singleton instance of the SpringSystem physics engine.\n   *\n   * @return {Sister}\n   */\n  stack.springSystem = function () {\n    return springSystem;\n  };\n\n  /**\n   * Proxy to the instance of the event emitter.\n   *\n   * @param {String} eventName\n   * @param {String} listener\n   */\n  stack.on = function (eventName, listener) {\n    eventEmitter.on(eventName, listener);\n  };\n\n  /**\n   * Creates an instance of Card and associates it with the element.\n   *\n   * @return {Card}\n   */\n  stack.createCard = function (element) {\n    var card = Card(this, element),\n      events = [\n        'throwout',\n        'throwoutend',\n        'throwoutleft',\n        'throwoutright',\n        'throwin',\n        'throwinend',\n        'dragstart',\n        'dragmove',\n        'dragend'\n      ];\n\n    // Proxy Card events to the Stack.\n    events.forEach(function (name) {\n      card.on(name, function (data) {\n        eventEmitter.trigger(name, data);\n      });\n    });\n\n    index.push({\n      element: element,\n      card: card\n    });\n\n    return card;\n  };\n\n  /**\n   * Returns card associated with an element.\n   *\n   * @param {HTMLElement} element\n   * @return {Card|null}\n   */\n  stack.getCard = function (element) {\n    var j = index.length;\n    while (j--) {\n      if (index[j].element === element) {\n        return index[j].card;\n      }\n    }\n    return null;\n  };\n\n  /**\n   * @param {Card} card\n   */\n  stack._destroyCard = function (card) {\n    var j = index.length;\n    while (j--) {\n      if (index[j].card === card) {\n        index.splice(j, 1);\n\n        break;\n      }\n    }\n  };\n\n  return stack;\n};\n\nmodule.exports = Stack;\n"
  },
  {
    "path": "app/templates/app/src/lib/swing/swing.js",
    "content": "var global = window;\n\nvar Stack = require('lib/swing/stack'),\n  Card = require('lib/swing/card');\n\nglobal.gajus = global.gajus || {};\n\nglobal.gajus.Swing = {\n  Stack: Stack,\n  Card: Card\n};\n\nmodule.exports = {\n  Stack: Stack,\n  Card: Card\n};\n"
  },
  {
    "path": "app/templates/app/src/lib/swing/vendor-prefix.js",
    "content": "var style = document.createElement('p').style,\n  prefixes = 'O ms Moz webkit'.split(' '),\n  hasPrefix = /^(o|ms|moz|webkit)/,\n  upper = /([A-Z])/g,\n  memo = {};\n\nfunction get(key) {\n  return (key in memo) ? memo[key] : memo[key] = prefix(key);\n}\n\nfunction prefix(key) {\n  var capitalizedKey = key.replace(/-([a-z])/g, function (s, match) {\n      return match.toUpperCase();\n    }),\n    i = prefixes.length,\n    name;\n\n  if (style[capitalizedKey] !== undefined) return capitalizedKey;\n\n  capitalizedKey = capitalize(key);\n\n  while (i--) {\n    name = prefixes[i] + capitalizedKey;\n    if (style[name] !== undefined) return name;\n  }\n\n  throw new Error('unable to prefix ' + key);\n}\n\nfunction capitalize(str) {\n  return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nfunction dashedPrefix(key) {\n  var prefixedKey = get(key),\n    upper = /([A-Z])/g;\n\n  if (upper.test(prefixedKey)) {\n    prefixedKey = (hasPrefix.test(prefixedKey) ? '-' : '') + prefixedKey.replace(upper, '-$1');\n  }\n\n  return prefixedKey.toLowerCase();\n}\n\nif (typeof module != 'undefined' && module.exports) {\n  module.exports = get;\n  module.exports.dash = dashedPrefix;\n} else {\n  return get;\n}\n"
  },
  {
    "path": "app/templates/app/src/lib/velocity.js",
    "content": "/*! VelocityJS.org (1.2.2). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */\n\n/*************************\n Velocity jQuery Shim\n *************************/\n\n/*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */\n\n/* This file contains the jQuery functions that Velocity relies on, thereby removing Velocity's dependency on a full copy of jQuery, and allowing it to work in any environment. */\n/* These shimmed functions are only used if jQuery isn't present. If both this shim and jQuery are loaded, Velocity defaults to jQuery proper. */\n/* Browser support: Using this shim instead of jQuery proper removes support for IE8. */\n\n;\n(function (window) {\n  /***************\n   Setup\n   ***************/\n\n  /* If jQuery is already loaded, there's no point in loading this shim. */\n  if (window.jQuery) {\n    return;\n  }\n\n  /* jQuery base. */\n  var $ = function (selector, context) {\n    return new $.fn.init(selector, context);\n  };\n\n  /********************\n   Private Methods\n   ********************/\n\n  /* jQuery */\n  $.isWindow = function (obj) {\n    /* jshint eqeqeq: false */\n    return obj != null && obj == obj.window;\n  };\n\n  /* jQuery */\n  $.type = function (obj) {\n    if (obj == null) {\n      return obj + \"\";\n    }\n\n    return typeof obj === \"object\" || typeof obj === \"function\" ?\n    class2type[toString.call(obj)] || \"object\" :\n      typeof obj;\n  };\n\n  /* jQuery */\n  $.isArray = Array.isArray || function (obj) {\n      return $.type(obj) === \"array\";\n    };\n\n  /* jQuery */\n  function isArraylike(obj) {\n    var length = obj.length,\n      type = $.type(obj);\n\n    if (type === \"function\" || $.isWindow(obj)) {\n      return false;\n    }\n\n    if (obj.nodeType === 1 && length) {\n      return true;\n    }\n\n    return type === \"array\" || length === 0 || typeof length === \"number\" && length > 0 && (length - 1) in obj;\n  }\n\n  /***************\n   $ Methods\n   ***************/\n\n  /* jQuery: Support removed for IE<9. */\n  $.isPlainObject = function (obj) {\n    var key;\n\n    if (!obj || $.type(obj) !== \"object\" || obj.nodeType || $.isWindow(obj)) {\n      return false;\n    }\n\n    try {\n      if (obj.constructor && !hasOwn.call(obj, \"constructor\") && !hasOwn.call(obj.constructor.prototype, \"isPrototypeOf\")) {\n        return false;\n      }\n    } catch (e) {\n      return false;\n    }\n\n    for (key in obj) {\n    }\n\n    return key === undefined || hasOwn.call(obj, key);\n  };\n\n  /* jQuery */\n  $.each = function (obj, callback, args) {\n    var value,\n      i = 0,\n      length = obj.length,\n      isArray = isArraylike(obj);\n\n    if (args) {\n      if (isArray) {\n        for (; i < length; i++) {\n          value = callback.apply(obj[i], args);\n\n          if (value === false) {\n            break;\n          }\n        }\n      } else {\n        for (i in obj) {\n          value = callback.apply(obj[i], args);\n\n          if (value === false) {\n            break;\n          }\n        }\n      }\n\n    } else {\n      if (isArray) {\n        for (; i < length; i++) {\n          value = callback.call(obj[i], i, obj[i]);\n\n          if (value === false) {\n            break;\n          }\n        }\n      } else {\n        for (i in obj) {\n          value = callback.call(obj[i], i, obj[i]);\n\n          if (value === false) {\n            break;\n          }\n        }\n      }\n    }\n\n    return obj;\n  };\n\n  /* Custom */\n  $.data = function (node, key, value) {\n    /* $.getData() */\n    if (value === undefined) {\n      var id = node[$.expando],\n        store = id && cache[id];\n\n      if (key === undefined) {\n        return store;\n      } else if (store) {\n        if (key in store) {\n          return store[key];\n        }\n      }\n      /* $.setData() */\n    } else if (key !== undefined) {\n      var id = node[$.expando] || (node[$.expando] = ++$.uuid);\n\n      cache[id] = cache[id] || {};\n      cache[id][key] = value;\n\n      return value;\n    }\n  };\n\n  /* Custom */\n  $.removeData = function (node, keys) {\n    var id = node[$.expando],\n      store = id && cache[id];\n\n    if (store) {\n      $.each(keys, function (_, key) {\n        delete store[key];\n      });\n    }\n  };\n\n  /* jQuery */\n  $.extend = function () {\n    var src, copyIsArray, copy, name, options, clone,\n      target = arguments[0] || {},\n      i = 1,\n      length = arguments.length,\n      deep = false;\n\n    if (typeof target === \"boolean\") {\n      deep = target;\n\n      target = arguments[i] || {};\n      i++;\n    }\n\n    if (typeof target !== \"object\" && $.type(target) !== \"function\") {\n      target = {};\n    }\n\n    if (i === length) {\n      target = this;\n      i--;\n    }\n\n    for (; i < length; i++) {\n      if ((options = arguments[i]) != null) {\n        for (name in options) {\n          src = target[name];\n          copy = options[name];\n\n          if (target === copy) {\n            continue;\n          }\n\n          if (deep && copy && ($.isPlainObject(copy) || (copyIsArray = $.isArray(copy)))) {\n            if (copyIsArray) {\n              copyIsArray = false;\n              clone = src && $.isArray(src) ? src : [];\n\n            } else {\n              clone = src && $.isPlainObject(src) ? src : {};\n            }\n\n            target[name] = $.extend(deep, clone, copy);\n\n          } else if (copy !== undefined) {\n            target[name] = copy;\n          }\n        }\n      }\n    }\n\n    return target;\n  };\n\n  /* jQuery 1.4.3 */\n  $.queue = function (elem, type, data) {\n    function $makeArray(arr, results) {\n      var ret = results || [];\n\n      if (arr != null) {\n        if (isArraylike(Object(arr))) {\n          /* $.merge */\n          (function (first, second) {\n            var len = +second.length,\n              j = 0,\n              i = first.length;\n\n            while (j < len) {\n              first[i++] = second[j++];\n            }\n\n            if (len !== len) {\n              while (second[j] !== undefined) {\n                first[i++] = second[j++];\n              }\n            }\n\n            first.length = i;\n\n            return first;\n          })(ret, typeof arr === \"string\" ? [arr] : arr);\n        } else {\n          [].push.call(ret, arr);\n        }\n      }\n\n      return ret;\n    }\n\n    if (!elem) {\n      return;\n    }\n\n    type = (type || \"fx\") + \"queue\";\n\n    var q = $.data(elem, type);\n\n    if (!data) {\n      return q || [];\n    }\n\n    if (!q || $.isArray(data)) {\n      q = $.data(elem, type, $makeArray(data));\n    } else {\n      q.push(data);\n    }\n\n    return q;\n  };\n\n  /* jQuery 1.4.3 */\n  $.dequeue = function (elems, type) {\n    /* Custom: Embed element iteration. */\n    $.each(elems.nodeType ? [elems] : elems, function (i, elem) {\n      type = type || \"fx\";\n\n      var queue = $.queue(elem, type),\n        fn = queue.shift();\n\n      if (fn === \"inprogress\") {\n        fn = queue.shift();\n      }\n\n      if (fn) {\n        if (type === \"fx\") {\n          queue.unshift(\"inprogress\");\n        }\n\n        fn.call(elem, function () {\n          $.dequeue(elem, type);\n        });\n      }\n    });\n  };\n\n  /******************\n   $.fn Methods\n   ******************/\n\n  /* jQuery */\n  $.fn = $.prototype = {\n    init: function (selector) {\n      /* Just return the element wrapped inside an array; don't proceed with the actual jQuery node wrapping process. */\n      if (selector.nodeType) {\n        this[0] = selector;\n\n        return this;\n      } else {\n        throw new Error(\"Not a DOM node.\");\n      }\n    },\n\n    offset: function () {\n      /* jQuery altered code: Dropped disconnected DOM node checking. */\n      var box = this[0].getBoundingClientRect ? this[0].getBoundingClientRect() : {top: 0, left: 0};\n\n      return {\n        top: box.top + (window.pageYOffset || document.scrollTop || 0) - (document.clientTop || 0),\n        left: box.left + (window.pageXOffset || document.scrollLeft || 0) - (document.clientLeft || 0)\n      };\n    },\n\n    position: function () {\n      /* jQuery */\n      function offsetParent() {\n        var offsetParent = this.offsetParent || document;\n\n        while (offsetParent && (!offsetParent.nodeType.toLowerCase === \"html\" && offsetParent.style.position === \"static\")) {\n          offsetParent = offsetParent.offsetParent;\n        }\n\n        return offsetParent || document;\n      }\n\n      /* Zepto */\n      var elem = this[0],\n        offsetParent = offsetParent.apply(elem),\n        offset = this.offset(),\n        parentOffset = /^(?:body|html)$/i.test(offsetParent.nodeName) ? {top: 0, left: 0} : $(offsetParent).offset()\n\n      offset.top -= parseFloat(elem.style.marginTop) || 0;\n      offset.left -= parseFloat(elem.style.marginLeft) || 0;\n\n      if (offsetParent.style) {\n        parentOffset.top += parseFloat(offsetParent.style.borderTopWidth) || 0\n        parentOffset.left += parseFloat(offsetParent.style.borderLeftWidth) || 0\n      }\n\n      return {\n        top: offset.top - parentOffset.top,\n        left: offset.left - parentOffset.left\n      };\n    }\n  };\n\n  /**********************\n   Private Variables\n   **********************/\n\n  /* For $.data() */\n  var cache = {};\n  $.expando = \"velocity\" + (new Date().getTime());\n  $.uuid = 0;\n\n  /* For $.queue() */\n  var class2type = {},\n    hasOwn = class2type.hasOwnProperty,\n    toString = class2type.toString;\n\n  var types = \"Boolean Number String Function Array Date RegExp Object Error\".split(\" \");\n  for (var i = 0; i < types.length; i++) {\n    class2type[\"[object \" + types[i] + \"]\"] = types[i].toLowerCase();\n  }\n\n  /* Makes $(node) possible, without having to call init. */\n  $.fn.init.prototype = $.fn;\n\n  /* Globalize Velocity onto the window, and assign its Utilities property. */\n  window.Velocity = {Utilities: $};\n})(window);\n\n/******************\n Velocity.js\n ******************/\n\n;\n(function (factory) {\n  /* CommonJS module. */\n  //if (typeof module === \"object\" && typeof module.exports === \"object\") {\n  //  module.exports = factory();\n  //  /* AMD module. */\n  //} else if (typeof define === \"function\" && define.amd) {\n  //  define(factory);\n  //  /* Browser globals. */\n  //} else {\n  factory();\n  //}\n}(function () {\n  return function (global, window, document, undefined) {\n\n    /***************\n     Summary\n     ***************/\n\n    /*\n     - CSS: CSS stack that works independently from the rest of Velocity.\n     - animate(): Core animation method that iterates over the targeted elements and queues the incoming call onto each element individually.\n     - Pre-Queueing: Prepare the element for animation by instantiating its data cache and processing the call's options.\n     - Queueing: The logic that runs once the call has reached its point of execution in the element's $.queue() stack.\n     Most logic is placed here to avoid risking it becoming stale (if the element's properties have changed).\n     - Pushing: Consolidation of the tween data followed by its push onto the global in-progress calls container.\n     - tick(): The single requestAnimationFrame loop responsible for tweening all in-progress calls.\n     - completeCall(): Handles the cleanup process for each Velocity call.\n     */\n\n    /*********************\n     Helper Functions\n     *********************/\n\n    /* IE detection. Gist: https://gist.github.com/julianshapiro/9098609 */\n    var IE = (function () {\n      if (document.documentMode) {\n        return document.documentMode;\n      } else {\n        for (var i = 7; i > 4; i--) {\n          var div = document.createElement(\"div\");\n\n          div.innerHTML = \"<!--[if IE \" + i + \"]><span></span><![endif]-->\";\n\n          if (div.getElementsByTagName(\"span\").length) {\n            div = null;\n\n            return i;\n          }\n        }\n      }\n\n      return undefined;\n    })();\n\n    /* rAF shim. Gist: https://gist.github.com/julianshapiro/9497513 */\n    var rAFShim = (function () {\n      var timeLast = 0;\n\n      return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function (callback) {\n          var timeCurrent = (new Date()).getTime(),\n            timeDelta;\n\n          /* Dynamically set delay on a per-tick basis to match 60fps. */\n          /* Technique by Erik Moller. MIT license: https://gist.github.com/paulirish/1579671 */\n          timeDelta = Math.max(0, 16 - (timeCurrent - timeLast));\n          timeLast = timeCurrent + timeDelta;\n\n          return setTimeout(function () {\n            callback(timeCurrent + timeDelta);\n          }, timeDelta);\n        };\n    })();\n\n    /* Array compacting. Copyright Lo-Dash. MIT License: https://github.com/lodash/lodash/blob/master/LICENSE.txt */\n    function compactSparseArray(array) {\n      var index = -1,\n        length = array ? array.length : 0,\n        result = [];\n\n      while (++index < length) {\n        var value = array[index];\n\n        if (value) {\n          result.push(value);\n        }\n      }\n\n      return result;\n    }\n\n    function sanitizeElements(elements) {\n      /* Unwrap jQuery/Zepto objects. */\n      if (Type.isWrapped(elements)) {\n        elements = [].slice.call(elements);\n        /* Wrap a single element in an array so that $.each() can iterate with the element instead of its node's children. */\n      } else if (Type.isNode(elements)) {\n        elements = [elements];\n      }\n\n      return elements;\n    }\n\n    var Type = {\n      isString: function (variable) {\n        return (typeof variable === \"string\");\n      },\n      isArray: Array.isArray || function (variable) {\n        return Object.prototype.toString.call(variable) === \"[object Array]\";\n      },\n      isFunction: function (variable) {\n        return Object.prototype.toString.call(variable) === \"[object Function]\";\n      },\n      isNode: function (variable) {\n        return variable && variable.nodeType;\n      },\n      /* Copyright Martin Bohm. MIT License: https://gist.github.com/Tomalak/818a78a226a0738eaade */\n      isNodeList: function (variable) {\n        return typeof variable === \"object\" &&\n          /^\\[object (HTMLCollection|NodeList|Object)\\]$/.test(Object.prototype.toString.call(variable)) &&\n          variable.length !== undefined &&\n          (variable.length === 0 || (typeof variable[0] === \"object\" && variable[0].nodeType > 0));\n      },\n      /* Determine if variable is a wrapped jQuery or Zepto element. */\n      isWrapped: function (variable) {\n        return variable && (variable.jquery || (window.Zepto && window.Zepto.zepto.isZ(variable)));\n      },\n      isSVG: function (variable) {\n        return window.SVGElement && (variable instanceof window.SVGElement);\n      },\n      isEmptyObject: function (variable) {\n        for (var name in variable) {\n          return false;\n        }\n\n        return true;\n      }\n    };\n\n    /*****************\n     Dependencies\n     *****************/\n\n    var $,\n      isJQuery = false;\n\n    if (global.fn && global.fn.jquery) {\n      $ = global;\n      isJQuery = true;\n    } else {\n      $ = window.Velocity.Utilities;\n    }\n\n    if (IE <= 8 && !isJQuery) {\n      throw new Error(\"Velocity: IE8 and below require jQuery to be loaded before Velocity.\");\n    } else if (IE <= 7) {\n      /* Revert to jQuery's $.animate(), and lose Velocity's extra features. */\n      jQuery.fn.velocity = jQuery.fn.animate;\n\n      /* Now that $.fn.velocity is aliased, abort this Velocity declaration. */\n      return;\n    }\n\n    /*****************\n     Constants\n     *****************/\n\n    var DURATION_DEFAULT = 400,\n      EASING_DEFAULT = \"swing\";\n\n    /*************\n     State\n     *************/\n\n    var Velocity = {\n      /* Container for page-wide Velocity state data. */\n      State: {\n        /* Detect mobile devices to determine if mobileHA should be turned on. */\n        isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),\n        /* The mobileHA option's behavior changes on older Android devices (Gingerbread, versions 2.3.3-2.3.7). */\n        isAndroid: /Android/i.test(navigator.userAgent),\n        isGingerbread: /Android 2\\.3\\.[3-7]/i.test(navigator.userAgent),\n        isChrome: window.chrome,\n        isFirefox: /Firefox/i.test(navigator.userAgent),\n        /* Create a cached element for re-use when checking for CSS property prefixes. */\n        prefixElement: document.createElement(\"div\"),\n        /* Cache every prefix match to avoid repeating lookups. */\n        prefixMatches: {},\n        /* Cache the anchor used for animating window scrolling. */\n        scrollAnchor: null,\n        /* Cache the browser-specific property names associated with the scroll anchor. */\n        scrollPropertyLeft: null,\n        scrollPropertyTop: null,\n        /* Keep track of whether our RAF tick is running. */\n        isTicking: false,\n        /* Container for every in-progress call to Velocity. */\n        calls: []\n      },\n      /* Velocity's custom CSS stack. Made global for unit testing. */\n      CSS: {/* Defined below. */},\n      /* A shim of the jQuery utility functions used by Velocity -- provided by Velocity's optional jQuery shim. */\n      Utilities: $,\n      /* Container for the user's custom animation redirects that are referenced by name in place of the properties map argument. */\n      Redirects: {/* Manually registered by the user. */},\n      Easings: {/* Defined below. */},\n      /* Attempt to use ES6 Promises by default. Users can override this with a third-party promises library. */\n      Promise: window.Promise,\n      /* Velocity option defaults, which can be overriden by the user. */\n      defaults: {\n        queue: \"\",\n        duration: DURATION_DEFAULT,\n        easing: EASING_DEFAULT,\n        begin: undefined,\n        complete: undefined,\n        progress: undefined,\n        display: undefined,\n        visibility: undefined,\n        loop: false,\n        delay: false,\n        mobileHA: true,\n        /* Advanced: Set to false to prevent property values from being cached between consecutive Velocity-initiated chain calls. */\n        _cacheValues: true\n      },\n      /* A design goal of Velocity is to cache data wherever possible in order to avoid DOM requerying. Accordingly, each element has a data cache. */\n      init: function (element) {\n        $.data(element, \"velocity\", {\n          /* Store whether this is an SVG element, since its properties are retrieved and updated differently than standard HTML elements. */\n          isSVG: Type.isSVG(element),\n          /* Keep track of whether the element is currently being animated by Velocity.\n           This is used to ensure that property values are not transferred between non-consecutive (stale) calls. */\n          isAnimating: false,\n          /* A reference to the element's live computedStyle object. Learn more here: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle */\n          computedStyle: null,\n          /* Tween data is cached for each animation on the element so that data can be passed across calls --\n           in particular, end values are used as subsequent start values in consecutive Velocity calls. */\n          tweensContainer: null,\n          /* The full root property values of each CSS hook being animated on this element are cached so that:\n           1) Concurrently-animating hooks sharing the same root can have their root values' merged into one while tweening.\n           2) Post-hook-injection root values can be transferred over to consecutively chained Velocity calls as starting root values. */\n          rootPropertyValueCache: {},\n          /* A cache for transform updates, which must be manually flushed via CSS.flushTransformCache(). */\n          transformCache: {}\n        });\n      },\n      /* A parallel to jQuery's $.css(), used for getting/setting Velocity's hooked CSS properties. */\n      hook: null, /* Defined below. */\n      /* Velocity-wide animation time remapping for testing purposes. */\n      mock: false,\n      version: {major: 1, minor: 2, patch: 2},\n      /* Set to 1 or 2 (most verbose) to output debug info to console. */\n      debug: false\n    };\n\n    /* Retrieve the appropriate scroll anchor and property name for the browser: https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY */\n    if (window.pageYOffset !== undefined) {\n      Velocity.State.scrollAnchor = window;\n      Velocity.State.scrollPropertyLeft = \"pageXOffset\";\n      Velocity.State.scrollPropertyTop = \"pageYOffset\";\n    } else {\n      Velocity.State.scrollAnchor = document.documentElement || document.body.parentNode || document.body;\n      Velocity.State.scrollPropertyLeft = \"scrollLeft\";\n      Velocity.State.scrollPropertyTop = \"scrollTop\";\n    }\n\n    /* Shorthand alias for jQuery's $.data() utility. */\n    function Data(element) {\n      /* Hardcode a reference to the plugin name. */\n      var response = $.data(element, \"velocity\");\n\n      /* jQuery <=1.4.2 returns null instead of undefined when no match is found. We normalize this behavior. */\n      return response === null ? undefined : response;\n    };\n\n    /**************\n     Easing\n     **************/\n\n    /* Step easing generator. */\n    function generateStep(steps) {\n      return function (p) {\n        return Math.round(p * steps) * (1 / steps);\n      };\n    }\n\n    /* Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */\n    function generateBezier(mX1, mY1, mX2, mY2) {\n      var NEWTON_ITERATIONS = 4,\n        NEWTON_MIN_SLOPE = 0.001,\n        SUBDIVISION_PRECISION = 0.0000001,\n        SUBDIVISION_MAX_ITERATIONS = 10,\n        kSplineTableSize = 11,\n        kSampleStepSize = 1.0 / (kSplineTableSize - 1.0),\n        float32ArraySupported = \"Float32Array\" in window;\n\n      /* Must contain four arguments. */\n      if (arguments.length !== 4) {\n        return false;\n      }\n\n      /* Arguments must be numbers. */\n      for (var i = 0; i < 4; ++i) {\n        if (typeof arguments[i] !== \"number\" || isNaN(arguments[i]) || !isFinite(arguments[i])) {\n          return false;\n        }\n      }\n\n      /* X values must be in the [0, 1] range. */\n      mX1 = Math.min(mX1, 1);\n      mX2 = Math.min(mX2, 1);\n      mX1 = Math.max(mX1, 0);\n      mX2 = Math.max(mX2, 0);\n\n      var mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);\n\n      function A(aA1, aA2) {\n        return 1.0 - 3.0 * aA2 + 3.0 * aA1;\n      }\n\n      function B(aA1, aA2) {\n        return 3.0 * aA2 - 6.0 * aA1;\n      }\n\n      function C(aA1) {\n        return 3.0 * aA1;\n      }\n\n      function calcBezier(aT, aA1, aA2) {\n        return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT;\n      }\n\n      function getSlope(aT, aA1, aA2) {\n        return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1);\n      }\n\n      function newtonRaphsonIterate(aX, aGuessT) {\n        for (var i = 0; i < NEWTON_ITERATIONS; ++i) {\n          var currentSlope = getSlope(aGuessT, mX1, mX2);\n\n          if (currentSlope === 0.0) return aGuessT;\n\n          var currentX = calcBezier(aGuessT, mX1, mX2) - aX;\n          aGuessT -= currentX / currentSlope;\n        }\n\n        return aGuessT;\n      }\n\n      function calcSampleValues() {\n        for (var i = 0; i < kSplineTableSize; ++i) {\n          mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);\n        }\n      }\n\n      function binarySubdivide(aX, aA, aB) {\n        var currentX, currentT, i = 0;\n\n        do {\n          currentT = aA + (aB - aA) / 2.0;\n          currentX = calcBezier(currentT, mX1, mX2) - aX;\n          if (currentX > 0.0) {\n            aB = currentT;\n          } else {\n            aA = currentT;\n          }\n        } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);\n\n        return currentT;\n      }\n\n      function getTForX(aX) {\n        var intervalStart = 0.0,\n          currentSample = 1,\n          lastSample = kSplineTableSize - 1;\n\n        for (; currentSample != lastSample && mSampleValues[currentSample] <= aX; ++currentSample) {\n          intervalStart += kSampleStepSize;\n        }\n\n        --currentSample;\n\n        var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample + 1] - mSampleValues[currentSample]),\n          guessForT = intervalStart + dist * kSampleStepSize,\n          initialSlope = getSlope(guessForT, mX1, mX2);\n\n        if (initialSlope >= NEWTON_MIN_SLOPE) {\n          return newtonRaphsonIterate(aX, guessForT);\n        } else if (initialSlope == 0.0) {\n          return guessForT;\n        } else {\n          return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize);\n        }\n      }\n\n      var _precomputed = false;\n\n      function precompute() {\n        _precomputed = true;\n        if (mX1 != mY1 || mX2 != mY2) calcSampleValues();\n      }\n\n      var f = function (aX) {\n        if (!_precomputed) precompute();\n        if (mX1 === mY1 && mX2 === mY2) return aX;\n        if (aX === 0) return 0;\n        if (aX === 1) return 1;\n\n        return calcBezier(getTForX(aX), mY1, mY2);\n      };\n\n      f.getControlPoints = function () {\n        return [{x: mX1, y: mY1}, {x: mX2, y: mY2}];\n      };\n\n      var str = \"generateBezier(\" + [mX1, mY1, mX2, mY2] + \")\";\n      f.toString = function () {\n        return str;\n      };\n\n      return f;\n    }\n\n    /* Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */\n    /* Given a tension, friction, and duration, a simulation at 60FPS will first run without a defined duration in order to calculate the full path. A second pass\n     then adjusts the time delta -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */\n    var generateSpringRK4 = (function () {\n      function springAccelerationForState(state) {\n        return (-state.tension * state.x) - (state.friction * state.v);\n      }\n\n      function springEvaluateStateWithDerivative(initialState, dt, derivative) {\n        var state = {\n          x: initialState.x + derivative.dx * dt,\n          v: initialState.v + derivative.dv * dt,\n          tension: initialState.tension,\n          friction: initialState.friction\n        };\n\n        return {dx: state.v, dv: springAccelerationForState(state)};\n      }\n\n      function springIntegrateState(state, dt) {\n        var a = {\n            dx: state.v,\n            dv: springAccelerationForState(state)\n          },\n          b = springEvaluateStateWithDerivative(state, dt * 0.5, a),\n          c = springEvaluateStateWithDerivative(state, dt * 0.5, b),\n          d = springEvaluateStateWithDerivative(state, dt, c),\n          dxdt = 1.0 / 6.0 * (a.dx + 2.0 * (b.dx + c.dx) + d.dx),\n          dvdt = 1.0 / 6.0 * (a.dv + 2.0 * (b.dv + c.dv) + d.dv);\n\n        state.x = state.x + dxdt * dt;\n        state.v = state.v + dvdt * dt;\n\n        return state;\n      }\n\n      return function springRK4Factory(tension, friction, duration) {\n\n        var initState = {\n            x: -1,\n            v: 0,\n            tension: null,\n            friction: null\n          },\n          path = [0],\n          time_lapsed = 0,\n          tolerance = 1 / 10000,\n          DT = 16 / 1000,\n          have_duration, dt, last_state;\n\n        tension = parseFloat(tension) || 500;\n        friction = parseFloat(friction) || 20;\n        duration = duration || null;\n\n        initState.tension = tension;\n        initState.friction = friction;\n\n        have_duration = duration !== null;\n\n        /* Calculate the actual time it takes for this animation to complete with the provided conditions. */\n        if (have_duration) {\n          /* Run the simulation without a duration. */\n          time_lapsed = springRK4Factory(tension, friction);\n          /* Compute the adjusted time delta. */\n          dt = time_lapsed / duration * DT;\n        } else {\n          dt = DT;\n        }\n\n        while (true) {\n          /* Next/step function .*/\n          last_state = springIntegrateState(last_state || initState, dt);\n          /* Store the position. */\n          path.push(1 + last_state.x);\n          time_lapsed += 16;\n          /* If the change threshold is reached, break. */\n          if (!(Math.abs(last_state.x) > tolerance && Math.abs(last_state.v) > tolerance)) {\n            break;\n          }\n        }\n\n        /* If duration is not defined, return the actual time required for completing this animation. Otherwise, return a closure that holds the\n         computed path and returns a snapshot of the position according to a given percentComplete. */\n        return !have_duration ? time_lapsed : function (percentComplete) {\n          return path[(percentComplete * (path.length - 1)) | 0];\n        };\n      };\n    }());\n\n    /* jQuery easings. */\n    Velocity.Easings = {\n      linear: function (p) {\n        return p;\n      },\n      swing: function (p) {\n        return 0.5 - Math.cos(p * Math.PI) / 2\n      },\n      /* Bonus \"spring\" easing, which is a less exaggerated version of easeInOutElastic. */\n      spring: function (p) {\n        return 1 - (Math.cos(p * 4.5 * Math.PI) * Math.exp(-p * 6));\n      }\n    };\n\n    /* CSS3 and Robert Penner easings. */\n    $.each(\n      [\n        [\"ease\", [0.25, 0.1, 0.25, 1.0]],\n        [\"ease-in\", [0.42, 0.0, 1.00, 1.0]],\n        [\"ease-out\", [0.00, 0.0, 0.58, 1.0]],\n        [\"ease-in-out\", [0.42, 0.0, 0.58, 1.0]],\n        [\"easeInSine\", [0.47, 0, 0.745, 0.715]],\n        [\"easeOutSine\", [0.39, 0.575, 0.565, 1]],\n        [\"easeInOutSine\", [0.445, 0.05, 0.55, 0.95]],\n        [\"easeInQuad\", [0.55, 0.085, 0.68, 0.53]],\n        [\"easeOutQuad\", [0.25, 0.46, 0.45, 0.94]],\n        [\"easeInOutQuad\", [0.455, 0.03, 0.515, 0.955]],\n        [\"easeInCubic\", [0.55, 0.055, 0.675, 0.19]],\n        [\"easeOutCubic\", [0.215, 0.61, 0.355, 1]],\n        [\"easeInOutCubic\", [0.645, 0.045, 0.355, 1]],\n        [\"easeInQuart\", [0.895, 0.03, 0.685, 0.22]],\n        [\"easeOutQuart\", [0.165, 0.84, 0.44, 1]],\n        [\"easeInOutQuart\", [0.77, 0, 0.175, 1]],\n        [\"easeInQuint\", [0.755, 0.05, 0.855, 0.06]],\n        [\"easeOutQuint\", [0.23, 1, 0.32, 1]],\n        [\"easeInOutQuint\", [0.86, 0, 0.07, 1]],\n        [\"easeInExpo\", [0.95, 0.05, 0.795, 0.035]],\n        [\"easeOutExpo\", [0.19, 1, 0.22, 1]],\n        [\"easeInOutExpo\", [1, 0, 0, 1]],\n        [\"easeInCirc\", [0.6, 0.04, 0.98, 0.335]],\n        [\"easeOutCirc\", [0.075, 0.82, 0.165, 1]],\n        [\"easeInOutCirc\", [0.785, 0.135, 0.15, 0.86]]\n      ], function (i, easingArray) {\n        Velocity.Easings[easingArray[0]] = generateBezier.apply(null, easingArray[1]);\n      });\n\n    /* Determine the appropriate easing type given an easing input. */\n    function getEasing(value, duration) {\n      var easing = value;\n\n      /* The easing option can either be a string that references a pre-registered easing,\n       or it can be a two-/four-item array of integers to be converted into a bezier/spring function. */\n      if (Type.isString(value)) {\n        /* Ensure that the easing has been assigned to jQuery's Velocity.Easings object. */\n        if (!Velocity.Easings[value]) {\n          easing = false;\n        }\n      } else if (Type.isArray(value) && value.length === 1) {\n        easing = generateStep.apply(null, value);\n      } else if (Type.isArray(value) && value.length === 2) {\n        /* springRK4 must be passed the animation's duration. */\n        /* Note: If the springRK4 array contains non-numbers, generateSpringRK4() returns an easing\n         function generated with default tension and friction values. */\n        easing = generateSpringRK4.apply(null, value.concat([duration]));\n      } else if (Type.isArray(value) && value.length === 4) {\n        /* Note: If the bezier array contains non-numbers, generateBezier() returns false. */\n        easing = generateBezier.apply(null, value);\n      } else {\n        easing = false;\n      }\n\n      /* Revert to the Velocity-wide default easing type, or fall back to \"swing\" (which is also jQuery's default)\n       if the Velocity-wide default has been incorrectly modified. */\n      if (easing === false) {\n        if (Velocity.Easings[Velocity.defaults.easing]) {\n          easing = Velocity.defaults.easing;\n        } else {\n          easing = EASING_DEFAULT;\n        }\n      }\n\n      return easing;\n    }\n\n    /*****************\n     CSS Stack\n     *****************/\n\n    /* The CSS object is a highly condensed and performant CSS stack that fully replaces jQuery's.\n     It handles the validation, getting, and setting of both standard CSS properties and CSS property hooks. */\n    /* Note: A \"CSS\" shorthand is aliased so that our code is easier to read. */\n    var CSS = Velocity.CSS = {\n\n      /*************\n       RegEx\n       *************/\n\n      RegEx: {\n        isHex: /^#([A-f\\d]{3}){1,2}$/i,\n        /* Unwrap a property value's surrounding text, e.g. \"rgba(4, 3, 2, 1)\" ==> \"4, 3, 2, 1\" and \"rect(4px 3px 2px 1px)\" ==> \"4px 3px 2px 1px\". */\n        valueUnwrap: /^[A-z]+\\((.*)\\)$/i,\n        wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,\n        /* Split a multi-value property into an array of subvalues, e.g. \"rgba(4, 3, 2, 1) 4px 3px 2px 1px\" ==> [ \"rgba(4, 3, 2, 1)\", \"4px\", \"3px\", \"2px\", \"1px\" ]. */\n        valueSplit: /([A-z]+\\(.+\\))|(([A-z0-9#-.]+?)(?=\\s|$))/ig\n      },\n\n      /************\n       Lists\n       ************/\n\n      Lists: {\n        colors: [\"fill\", \"stroke\", \"stopColor\", \"color\", \"backgroundColor\", \"borderColor\", \"borderTopColor\", \"borderRightColor\", \"borderBottomColor\", \"borderLeftColor\", \"outlineColor\"],\n        transformsBase: [\"translateX\", \"translateY\", \"scale\", \"scaleX\", \"scaleY\", \"skewX\", \"skewY\", \"rotateZ\"],\n        transforms3D: [\"transformPerspective\", \"translateZ\", \"scaleZ\", \"rotateX\", \"rotateY\"]\n      },\n\n      /************\n       Hooks\n       ************/\n\n      /* Hooks allow a subproperty (e.g. \"boxShadowBlur\") of a compound-value CSS property\n       (e.g. \"boxShadow: X Y Blur Spread Color\") to be animated as if it were a discrete property. */\n      /* Note: Beyond enabling fine-grained property animation, hooking is necessary since Velocity only\n       tweens properties with single numeric values; unlike CSS transitions, Velocity does not interpolate compound-values. */\n      Hooks: {\n        /********************\n         Registration\n         ********************/\n\n        /* Templates are a concise way of indicating which subproperties must be individually registered for each compound-value CSS property. */\n        /* Each template consists of the compound-value's base name, its constituent subproperty names, and those subproperties' default values. */\n        templates: {\n          \"textShadow\": [\"Color X Y Blur\", \"black 0px 0px 0px\"],\n          \"boxShadow\": [\"Color X Y Blur Spread\", \"black 0px 0px 0px 0px\"],\n          \"clip\": [\"Top Right Bottom Left\", \"0px 0px 0px 0px\"],\n          \"backgroundPosition\": [\"X Y\", \"0% 0%\"],\n          \"transformOrigin\": [\"X Y Z\", \"50% 50% 0px\"],\n          \"perspectiveOrigin\": [\"X Y\", \"50% 50%\"]\n        },\n\n        /* A \"registered\" hook is one that has been converted from its template form into a live,\n         tweenable property. It contains data to associate it with its root property. */\n        registered: {\n          /* Note: A registered hook looks like this ==> textShadowBlur: [ \"textShadow\", 3 ],\n           which consists of the subproperty's name, the associated root property's name,\n           and the subproperty's position in the root's value. */\n        },\n        /* Convert the templates into individual hooks then append them to the registered object above. */\n        register: function () {\n          /* Color hooks registration: Colors are defaulted to white -- as opposed to black -- since colors that are\n           currently set to \"transparent\" default to their respective template below when color-animated,\n           and white is typically a closer match to transparent than black is. An exception is made for text (\"color\"),\n           which is almost always set closer to black than white. */\n          for (var i = 0; i < CSS.Lists.colors.length; i++) {\n            var rgbComponents = (CSS.Lists.colors[i] === \"color\") ? \"0 0 0 1\" : \"255 255 255 1\";\n            CSS.Hooks.templates[CSS.Lists.colors[i]] = [\"Red Green Blue Alpha\", rgbComponents];\n          }\n\n          var rootProperty,\n            hookTemplate,\n            hookNames;\n\n          /* In IE, color values inside compound-value properties are positioned at the end the value instead of at the beginning.\n           Thus, we re-arrange the templates accordingly. */\n          if (IE) {\n            for (rootProperty in CSS.Hooks.templates) {\n              hookTemplate = CSS.Hooks.templates[rootProperty];\n              hookNames = hookTemplate[0].split(\" \");\n\n              var defaultValues = hookTemplate[1].match(CSS.RegEx.valueSplit);\n\n              if (hookNames[0] === \"Color\") {\n                /* Reposition both the hook's name and its default value to the end of their respective strings. */\n                hookNames.push(hookNames.shift());\n                defaultValues.push(defaultValues.shift());\n\n                /* Replace the existing template for the hook's root property. */\n                CSS.Hooks.templates[rootProperty] = [hookNames.join(\" \"), defaultValues.join(\" \")];\n              }\n            }\n          }\n\n          /* Hook registration. */\n          for (rootProperty in CSS.Hooks.templates) {\n            hookTemplate = CSS.Hooks.templates[rootProperty];\n            hookNames = hookTemplate[0].split(\" \");\n\n            for (var i in hookNames) {\n              var fullHookName = rootProperty + hookNames[i],\n                hookPosition = i;\n\n              /* For each hook, register its full name (e.g. textShadowBlur) with its root property (e.g. textShadow)\n               and the hook's position in its template's default value string. */\n              CSS.Hooks.registered[fullHookName] = [rootProperty, hookPosition];\n            }\n          }\n        },\n\n        /*****************************\n         Injection and Extraction\n         *****************************/\n\n        /* Look up the root property associated with the hook (e.g. return \"textShadow\" for \"textShadowBlur\"). */\n        /* Since a hook cannot be set directly (the browser won't recognize it), style updating for hooks is routed through the hook's root property. */\n        getRoot: function (property) {\n          var hookData = CSS.Hooks.registered[property];\n\n          if (hookData) {\n            return hookData[0];\n          } else {\n            /* If there was no hook match, return the property name untouched. */\n            return property;\n          }\n        },\n        /* Convert any rootPropertyValue, null or otherwise, into a space-delimited list of hook values so that\n         the targeted hook can be injected or extracted at its standard position. */\n        cleanRootPropertyValue: function (rootProperty, rootPropertyValue) {\n          /* If the rootPropertyValue is wrapped with \"rgb()\", \"clip()\", etc., remove the wrapping to normalize the value before manipulation. */\n          if (CSS.RegEx.valueUnwrap.test(rootPropertyValue)) {\n            rootPropertyValue = rootPropertyValue.match(CSS.RegEx.valueUnwrap)[1];\n          }\n\n          /* If rootPropertyValue is a CSS null-value (from which there's inherently no hook value to extract),\n           default to the root's default value as defined in CSS.Hooks.templates. */\n          /* Note: CSS null-values include \"none\", \"auto\", and \"transparent\". They must be converted into their\n           zero-values (e.g. textShadow: \"none\" ==> textShadow: \"0px 0px 0px black\") for hook manipulation to proceed. */\n          if (CSS.Values.isCSSNullValue(rootPropertyValue)) {\n            rootPropertyValue = CSS.Hooks.templates[rootProperty][1];\n          }\n\n          return rootPropertyValue;\n        },\n        /* Extracted the hook's value from its root property's value. This is used to get the starting value of an animating hook. */\n        extractValue: function (fullHookName, rootPropertyValue) {\n          var hookData = CSS.Hooks.registered[fullHookName];\n\n          if (hookData) {\n            var hookRoot = hookData[0],\n              hookPosition = hookData[1];\n\n            rootPropertyValue = CSS.Hooks.cleanRootPropertyValue(hookRoot, rootPropertyValue);\n\n            /* Split rootPropertyValue into its constituent hook values then grab the desired hook at its standard position. */\n            return rootPropertyValue.toString().match(CSS.RegEx.valueSplit)[hookPosition];\n          } else {\n            /* If the provided fullHookName isn't a registered hook, return the rootPropertyValue that was passed in. */\n            return rootPropertyValue;\n          }\n        },\n        /* Inject the hook's value into its root property's value. This is used to piece back together the root property\n         once Velocity has updated one of its individually hooked values through tweening. */\n        injectValue: function (fullHookName, hookValue, rootPropertyValue) {\n          var hookData = CSS.Hooks.registered[fullHookName];\n\n          if (hookData) {\n            var hookRoot = hookData[0],\n              hookPosition = hookData[1],\n              rootPropertyValueParts,\n              rootPropertyValueUpdated;\n\n            rootPropertyValue = CSS.Hooks.cleanRootPropertyValue(hookRoot, rootPropertyValue);\n\n            /* Split rootPropertyValue into its individual hook values, replace the targeted value with hookValue,\n             then reconstruct the rootPropertyValue string. */\n            rootPropertyValueParts = rootPropertyValue.toString().match(CSS.RegEx.valueSplit);\n            rootPropertyValueParts[hookPosition] = hookValue;\n            rootPropertyValueUpdated = rootPropertyValueParts.join(\" \");\n\n            return rootPropertyValueUpdated;\n          } else {\n            /* If the provided fullHookName isn't a registered hook, return the rootPropertyValue that was passed in. */\n            return rootPropertyValue;\n          }\n        }\n      },\n\n      /*******************\n       Normalizations\n       *******************/\n\n      /* Normalizations standardize CSS property manipulation by pollyfilling browser-specific implementations (e.g. opacity)\n       and reformatting special properties (e.g. clip, rgba) to look like standard ones. */\n      Normalizations: {\n        /* Normalizations are passed a normalization target (either the property's name, its extracted value, or its injected value),\n         the targeted element (which may need to be queried), and the targeted property value. */\n        registered: {\n          clip: function (type, element, propertyValue) {\n            switch (type) {\n              case \"name\":\n                return \"clip\";\n              /* Clip needs to be unwrapped and stripped of its commas during extraction. */\n              case \"extract\":\n                var extracted;\n\n                /* If Velocity also extracted this value, skip extraction. */\n                if (CSS.RegEx.wrappedValueAlreadyExtracted.test(propertyValue)) {\n                  extracted = propertyValue;\n                } else {\n                  /* Remove the \"rect()\" wrapper. */\n                  extracted = propertyValue.toString().match(CSS.RegEx.valueUnwrap);\n\n                  /* Strip off commas. */\n                  extracted = extracted ? extracted[1].replace(/,(\\s+)?/g, \" \") : propertyValue;\n                }\n\n                return extracted;\n              /* Clip needs to be re-wrapped during injection. */\n              case \"inject\":\n                return \"rect(\" + propertyValue + \")\";\n            }\n          },\n\n          blur: function (type, element, propertyValue) {\n            switch (type) {\n              case \"name\":\n                return Velocity.State.isFirefox ? \"filter\" : \"-webkit-filter\";\n              case \"extract\":\n                var extracted = parseFloat(propertyValue);\n\n                /* If extracted is NaN, meaning the value isn't already extracted. */\n                if (!(extracted || extracted === 0)) {\n                  var blurComponent = propertyValue.toString().match(/blur\\(([0-9]+[A-z]+)\\)/i);\n\n                  /* If the filter string had a blur component, return just the blur value and unit type. */\n                  if (blurComponent) {\n                    extracted = blurComponent[1];\n                    /* If the component doesn't exist, default blur to 0. */\n                  } else {\n                    extracted = 0;\n                  }\n                }\n\n                return extracted;\n              /* Blur needs to be re-wrapped during injection. */\n              case \"inject\":\n                /* For the blur effect to be fully de-applied, it needs to be set to \"none\" instead of 0. */\n                if (!parseFloat(propertyValue)) {\n                  return \"none\";\n                } else {\n                  return \"blur(\" + propertyValue + \")\";\n                }\n            }\n          },\n\n          /* <=IE8 do not support the standard opacity property. They use filter:alpha(opacity=INT) instead. */\n          opacity: function (type, element, propertyValue) {\n            if (IE <= 8) {\n              switch (type) {\n                case \"name\":\n                  return \"filter\";\n                case \"extract\":\n                  /* <=IE8 return a \"filter\" value of \"alpha(opacity=\\d{1,3})\".\n                   Extract the value and convert it to a decimal value to match the standard CSS opacity property's formatting. */\n                  var extracted = propertyValue.toString().match(/alpha\\(opacity=(.*)\\)/i);\n\n                  if (extracted) {\n                    /* Convert to decimal value. */\n                    propertyValue = extracted[1] / 100;\n                  } else {\n                    /* When extracting opacity, default to 1 since a null value means opacity hasn't been set. */\n                    propertyValue = 1;\n                  }\n\n                  return propertyValue;\n                case \"inject\":\n                  /* Opacified elements are required to have their zoom property set to a non-zero value. */\n                  element.style.zoom = 1;\n\n                  /* Setting the filter property on elements with certain font property combinations can result in a\n                   highly unappealing ultra-bolding effect. There's no way to remedy this throughout a tween, but dropping the\n                   value altogether (when opacity hits 1) at leasts ensures that the glitch is gone post-tweening. */\n                  if (parseFloat(propertyValue) >= 1) {\n                    return \"\";\n                  } else {\n                    /* As per the filter property's spec, convert the decimal value to a whole number and wrap the value. */\n                    return \"alpha(opacity=\" + parseInt(parseFloat(propertyValue) * 100, 10) + \")\";\n                  }\n              }\n              /* With all other browsers, normalization is not required; return the same values that were passed in. */\n            } else {\n              switch (type) {\n                case \"name\":\n                  return \"opacity\";\n                case \"extract\":\n                  return propertyValue;\n                case \"inject\":\n                  return propertyValue;\n              }\n            }\n          }\n        },\n\n        /*****************************\n         Batched Registrations\n         *****************************/\n\n        /* Note: Batched normalizations extend the CSS.Normalizations.registered object. */\n        register: function () {\n\n          /*****************\n           Transforms\n           *****************/\n\n          /* Transforms are the subproperties contained by the CSS \"transform\" property. Transforms must undergo normalization\n           so that they can be referenced in a properties map by their individual names. */\n          /* Note: When transforms are \"set\", they are actually assigned to a per-element transformCache. When all transform\n           setting is complete complete, CSS.flushTransformCache() must be manually called to flush the values to the DOM.\n           Transform setting is batched in this way to improve performance: the transform style only needs to be updated\n           once when multiple transform subproperties are being animated simultaneously. */\n          /* Note: IE9 and Android Gingerbread have support for 2D -- but not 3D -- transforms. Since animating unsupported\n           transform properties results in the browser ignoring the *entire* transform string, we prevent these 3D values\n           from being normalized for these browsers so that tweening skips these properties altogether\n           (since it will ignore them as being unsupported by the browser.) */\n          if (!(IE <= 9) && !Velocity.State.isGingerbread) {\n            /* Note: Since the standalone CSS \"perspective\" property and the CSS transform \"perspective\" subproperty\n             share the same name, the latter is given a unique token within Velocity: \"transformPerspective\". */\n            CSS.Lists.transformsBase = CSS.Lists.transformsBase.concat(CSS.Lists.transforms3D);\n          }\n\n          for (var i = 0; i < CSS.Lists.transformsBase.length; i++) {\n            /* Wrap the dynamically generated normalization function in a new scope so that transformName's value is\n             paired with its respective function. (Otherwise, all functions would take the final for loop's transformName.) */\n            (function () {\n              var transformName = CSS.Lists.transformsBase[i];\n\n              CSS.Normalizations.registered[transformName] = function (type, element, propertyValue) {\n                switch (type) {\n                  /* The normalized property name is the parent \"transform\" property -- the property that is actually set in CSS. */\n                  case \"name\":\n                    return \"transform\";\n                  /* Transform values are cached onto a per-element transformCache object. */\n                  case \"extract\":\n                    /* If this transform has yet to be assigned a value, return its null value. */\n                    if (Data(element) === undefined || Data(element).transformCache[transformName] === undefined) {\n                      /* Scale CSS.Lists.transformsBase default to 1 whereas all other transform properties default to 0. */\n                      return /^scale/i.test(transformName) ? 1 : 0;\n                      /* When transform values are set, they are wrapped in parentheses as per the CSS spec.\n                       Thus, when extracting their values (for tween calculations), we strip off the parentheses. */\n                    } else {\n                      return Data(element).transformCache[transformName].replace(/[()]/g, \"\");\n                    }\n                  case \"inject\":\n                    var invalid = false;\n\n                    /* If an individual transform property contains an unsupported unit type, the browser ignores the *entire* transform property.\n                     Thus, protect users from themselves by skipping setting for transform values supplied with invalid unit types. */\n                    /* Switch on the base transform type; ignore the axis by removing the last letter from the transform's name. */\n                    switch (transformName.substr(0, transformName.length - 1)) {\n                      /* Whitelist unit types for each transform. */\n                      case \"translate\":\n                        invalid = !/(%|px|em|rem|vw|vh|\\d)$/i.test(propertyValue);\n                        break;\n                      /* Since an axis-free \"scale\" property is supported as well, a little hack is used here to detect it by chopping off its last letter. */\n                      case \"scal\":\n                      case \"scale\":\n                        /* Chrome on Android has a bug in which scaled elements blur if their initial scale\n                         value is below 1 (which can happen with forcefeeding). Thus, we detect a yet-unset scale property\n                         and ensure that its first value is always 1. More info: http://stackoverflow.com/questions/10417890/css3-animations-with-transform-causes-blurred-elements-on-webkit/10417962#10417962 */\n                        if (Velocity.State.isAndroid && Data(element).transformCache[transformName] === undefined && propertyValue < 1) {\n                          propertyValue = 1;\n                        }\n\n                        invalid = !/(\\d)$/i.test(propertyValue);\n                        break;\n                      case \"skew\":\n                        invalid = !/(deg|\\d)$/i.test(propertyValue);\n                        break;\n                      case \"rotate\":\n                        invalid = !/(deg|\\d)$/i.test(propertyValue);\n                        break;\n                    }\n\n                    if (!invalid) {\n                      /* As per the CSS spec, wrap the value in parentheses. */\n                      Data(element).transformCache[transformName] = \"(\" + propertyValue + \")\";\n                    }\n\n                    /* Although the value is set on the transformCache object, return the newly-updated value for the calling code to process as normal. */\n                    return Data(element).transformCache[transformName];\n                }\n              };\n            })();\n          }\n\n          /*************\n           Colors\n           *************/\n\n          /* Since Velocity only animates a single numeric value per property, color animation is achieved by hooking the individual RGBA components of CSS color properties.\n           Accordingly, color values must be normalized (e.g. \"#ff0000\", \"red\", and \"rgb(255, 0, 0)\" ==> \"255 0 0 1\") so that their components can be injected/extracted by CSS.Hooks logic. */\n          for (var i = 0; i < CSS.Lists.colors.length; i++) {\n            /* Wrap the dynamically generated normalization function in a new scope so that colorName's value is paired with its respective function.\n             (Otherwise, all functions would take the final for loop's colorName.) */\n            (function () {\n              var colorName = CSS.Lists.colors[i];\n\n              /* Note: In IE<=8, which support rgb but not rgba, color properties are reverted to rgb by stripping off the alpha component. */\n              CSS.Normalizations.registered[colorName] = function (type, element, propertyValue) {\n                switch (type) {\n                  case \"name\":\n                    return colorName;\n                  /* Convert all color values into the rgb format. (Old IE can return hex values and color names instead of rgb/rgba.) */\n                  case \"extract\":\n                    var extracted;\n\n                    /* If the color is already in its hookable form (e.g. \"255 255 255 1\") due to having been previously extracted, skip extraction. */\n                    if (CSS.RegEx.wrappedValueAlreadyExtracted.test(propertyValue)) {\n                      extracted = propertyValue;\n                    } else {\n                      var converted,\n                        colorNames = {\n                          black: \"rgb(0, 0, 0)\",\n                          blue: \"rgb(0, 0, 255)\",\n                          gray: \"rgb(128, 128, 128)\",\n                          green: \"rgb(0, 128, 0)\",\n                          red: \"rgb(255, 0, 0)\",\n                          white: \"rgb(255, 255, 255)\"\n                        };\n\n                      /* Convert color names to rgb. */\n                      if (/^[A-z]+$/i.test(propertyValue)) {\n                        if (colorNames[propertyValue] !== undefined) {\n                          converted = colorNames[propertyValue]\n                        } else {\n                          /* If an unmatched color name is provided, default to black. */\n                          converted = colorNames.black;\n                        }\n                        /* Convert hex values to rgb. */\n                      } else if (CSS.RegEx.isHex.test(propertyValue)) {\n                        converted = \"rgb(\" + CSS.Values.hexToRgb(propertyValue).join(\" \") + \")\";\n                        /* If the provided color doesn't match any of the accepted color formats, default to black. */\n                      } else if (!(/^rgba?\\(/i.test(propertyValue))) {\n                        converted = colorNames.black;\n                      }\n\n                      /* Remove the surrounding \"rgb/rgba()\" string then replace commas with spaces and strip\n                       repeated spaces (in case the value included spaces to begin with). */\n                      extracted = (converted || propertyValue).toString().match(CSS.RegEx.valueUnwrap)[1].replace(/,(\\s+)?/g, \" \");\n                    }\n\n                    /* So long as this isn't <=IE8, add a fourth (alpha) component if it's missing and default it to 1 (visible). */\n                    if (!(IE <= 8) && extracted.split(\" \").length === 3) {\n                      extracted += \" 1\";\n                    }\n\n                    return extracted;\n                  case \"inject\":\n                    /* If this is IE<=8 and an alpha component exists, strip it off. */\n                    if (IE <= 8) {\n                      if (propertyValue.split(\" \").length === 4) {\n                        propertyValue = propertyValue.split(/\\s+/).slice(0, 3).join(\" \");\n                      }\n                      /* Otherwise, add a fourth (alpha) component if it's missing and default it to 1 (visible). */\n                    } else if (propertyValue.split(\" \").length === 3) {\n                      propertyValue += \" 1\";\n                    }\n\n                    /* Re-insert the browser-appropriate wrapper(\"rgb/rgba()\"), insert commas, and strip off decimal units\n                     on all values but the fourth (R, G, and B only accept whole numbers). */\n                    return (IE <= 8 ? \"rgb\" : \"rgba\") + \"(\" + propertyValue.replace(/\\s+/g, \",\").replace(/\\.(\\d)+(?=,)/g, \"\") + \")\";\n                }\n              };\n            })();\n          }\n        }\n      },\n\n      /************************\n       CSS Property Names\n       ************************/\n\n      Names: {\n        /* Camelcase a property name into its JavaScript notation (e.g. \"background-color\" ==> \"backgroundColor\").\n         Camelcasing is used to normalize property names between and across calls. */\n        camelCase: function (property) {\n          return property.replace(/-(\\w)/g, function (match, subMatch) {\n            return subMatch.toUpperCase();\n          });\n        },\n\n        /* For SVG elements, some properties (namely, dimensional ones) are GET/SET via the element's HTML attributes (instead of via CSS styles). */\n        SVGAttribute: function (property) {\n          var SVGAttributes = \"width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2\";\n\n          /* Certain browsers require an SVG transform to be applied as an attribute. (Otherwise, application via CSS is preferable due to 3D support.) */\n          if (IE || (Velocity.State.isAndroid && !Velocity.State.isChrome)) {\n            SVGAttributes += \"|transform\";\n          }\n\n          return new RegExp(\"^(\" + SVGAttributes + \")$\", \"i\").test(property);\n        },\n\n        /* Determine whether a property should be set with a vendor prefix. */\n        /* If a prefixed version of the property exists, return it. Otherwise, return the original property name.\n         If the property is not at all supported by the browser, return a false flag. */\n        prefixCheck: function (property) {\n          /* If this property has already been checked, return the cached value. */\n          if (Velocity.State.prefixMatches[property]) {\n            return [Velocity.State.prefixMatches[property], true];\n          } else {\n            var vendors = [\"\", \"Webkit\", \"Moz\", \"ms\", \"O\"];\n\n            for (var i = 0, vendorsLength = vendors.length; i < vendorsLength; i++) {\n              var propertyPrefixed;\n\n              if (i === 0) {\n                propertyPrefixed = property;\n              } else {\n                /* Capitalize the first letter of the property to conform to JavaScript vendor prefix notation (e.g. webkitFilter). */\n                propertyPrefixed = vendors[i] + property.replace(/^\\w/, function (match) {\n                    return match.toUpperCase();\n                  });\n              }\n\n              /* Check if the browser supports this property as prefixed. */\n              if (Type.isString(Velocity.State.prefixElement.style[propertyPrefixed])) {\n                /* Cache the match. */\n                Velocity.State.prefixMatches[property] = propertyPrefixed;\n\n                return [propertyPrefixed, true];\n              }\n            }\n\n            /* If the browser doesn't support this property in any form, include a false flag so that the caller can decide how to proceed. */\n            return [property, false];\n          }\n        }\n      },\n\n      /************************\n       CSS Property Values\n       ************************/\n\n      Values: {\n        /* Hex to RGB conversion. Copyright Tim Down: http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb */\n        hexToRgb: function (hex) {\n          var shortformRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i,\n            longformRegex = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i,\n            rgbParts;\n\n          hex = hex.replace(shortformRegex, function (m, r, g, b) {\n            return r + r + g + g + b + b;\n          });\n\n          rgbParts = longformRegex.exec(hex);\n\n          return rgbParts ? [parseInt(rgbParts[1], 16), parseInt(rgbParts[2], 16), parseInt(rgbParts[3], 16)] : [0, 0, 0];\n        },\n\n        isCSSNullValue: function (value) {\n          /* The browser defaults CSS values that have not been set to either 0 or one of several possible null-value strings.\n           Thus, we check for both falsiness and these special strings. */\n          /* Null-value checking is performed to default the special strings to 0 (for the sake of tweening) or their hook\n           templates as defined as CSS.Hooks (for the sake of hook injection/extraction). */\n          /* Note: Chrome returns \"rgba(0, 0, 0, 0)\" for an undefined color whereas IE returns \"transparent\". */\n          return (value == 0 || /^(none|auto|transparent|(rgba\\(0, ?0, ?0, ?0\\)))$/i.test(value));\n        },\n\n        /* Retrieve a property's default unit type. Used for assigning a unit type when one is not supplied by the user. */\n        getUnitType: function (property) {\n          if (/^(rotate|skew)/i.test(property)) {\n            return \"deg\";\n          } else if (/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(property)) {\n            /* The above properties are unitless. */\n            return \"\";\n          } else {\n            /* Default to px for all other properties. */\n            return \"px\";\n          }\n        },\n\n        /* HTML elements default to an associated display type when they're not set to display:none. */\n        /* Note: This function is used for correctly setting the non-\"none\" display value in certain Velocity redirects, such as fadeIn/Out. */\n        getDisplayType: function (element) {\n          var tagName = element && element.tagName.toString().toLowerCase();\n\n          if (/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(tagName)) {\n            return \"inline\";\n          } else if (/^(li)$/i.test(tagName)) {\n            return \"list-item\";\n          } else if (/^(tr)$/i.test(tagName)) {\n            return \"table-row\";\n          } else if (/^(table)$/i.test(tagName)) {\n            return \"table\";\n          } else if (/^(tbody)$/i.test(tagName)) {\n            return \"table-row-group\";\n            /* Default to \"block\" when no match is found. */\n          } else {\n            return \"block\";\n          }\n        },\n\n        /* The class add/remove functions are used to temporarily apply a \"velocity-animating\" class to elements while they're animating. */\n        addClass: function (element, className) {\n          if (element.classList) {\n            element.classList.add(className);\n          } else {\n            element.className += (element.className.length ? \" \" : \"\") + className;\n          }\n        },\n\n        removeClass: function (element, className) {\n          if (element.classList) {\n            element.classList.remove(className);\n          } else {\n            element.className = element.className.toString().replace(new RegExp(\"(^|\\\\s)\" + className.split(\" \").join(\"|\") + \"(\\\\s|$)\", \"gi\"), \" \");\n          }\n        }\n      },\n\n      /****************************\n       Style Getting & Setting\n       ****************************/\n\n      /* The singular getPropertyValue, which routes the logic for all normalizations, hooks, and standard CSS properties. */\n      getPropertyValue: function (element, property, rootPropertyValue, forceStyleLookup) {\n        /* Get an element's computed property value. */\n        /* Note: Retrieving the value of a CSS property cannot simply be performed by checking an element's\n         style attribute (which only reflects user-defined values). Instead, the browser must be queried for a property's\n         *computed* value. You can read more about getComputedStyle here: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle */\n        function computePropertyValue(element, property) {\n          /* When box-sizing isn't set to border-box, height and width style values are incorrectly computed when an\n           element's scrollbars are visible (which expands the element's dimensions). Thus, we defer to the more accurate\n           offsetHeight/Width property, which includes the total dimensions for interior, border, padding, and scrollbar.\n           We subtract border and padding to get the sum of interior + scrollbar. */\n          var computedValue = 0;\n\n          /* IE<=8 doesn't support window.getComputedStyle, thus we defer to jQuery, which has an extensive array\n           of hacks to accurately retrieve IE8 property values. Re-implementing that logic here is not worth bloating the\n           codebase for a dying browser. The performance repercussions of using jQuery here are minimal since\n           Velocity is optimized to rarely (and sometimes never) query the DOM. Further, the $.css() codepath isn't that slow. */\n          if (IE <= 8) {\n            computedValue = $.css(element, property);\n            /* GET */\n            /* All other browsers support getComputedStyle. The returned live object reference is cached onto its\n             associated element so that it does not need to be refetched upon every GET. */\n          } else {\n            /* Browsers do not return height and width values for elements that are set to display:\"none\". Thus, we temporarily\n             toggle display to the element type's default value. */\n            var toggleDisplay = false;\n\n            if (/^(width|height)$/.test(property) && CSS.getPropertyValue(element, \"display\") === 0) {\n              toggleDisplay = true;\n              CSS.setPropertyValue(element, \"display\", CSS.Values.getDisplayType(element));\n            }\n\n            function revertDisplay() {\n              if (toggleDisplay) {\n                CSS.setPropertyValue(element, \"display\", \"none\");\n              }\n            }\n\n            if (!forceStyleLookup) {\n              if (property === \"height\" && CSS.getPropertyValue(element, \"boxSizing\").toString().toLowerCase() !== \"border-box\") {\n                var contentBoxHeight = element.offsetHeight - (parseFloat(CSS.getPropertyValue(element, \"borderTopWidth\")) || 0) - (parseFloat(CSS.getPropertyValue(element, \"borderBottomWidth\")) || 0) - (parseFloat(CSS.getPropertyValue(element, \"paddingTop\")) || 0) - (parseFloat(CSS.getPropertyValue(element, \"paddingBottom\")) || 0);\n                revertDisplay();\n\n                return contentBoxHeight;\n              } else if (property === \"width\" && CSS.getPropertyValue(element, \"boxSizing\").toString().toLowerCase() !== \"border-box\") {\n                var contentBoxWidth = element.offsetWidth - (parseFloat(CSS.getPropertyValue(element, \"borderLeftWidth\")) || 0) - (parseFloat(CSS.getPropertyValue(element, \"borderRightWidth\")) || 0) - (parseFloat(CSS.getPropertyValue(element, \"paddingLeft\")) || 0) - (parseFloat(CSS.getPropertyValue(element, \"paddingRight\")) || 0);\n                revertDisplay();\n\n                return contentBoxWidth;\n              }\n            }\n\n            var computedStyle;\n\n            /* For elements that Velocity hasn't been called on directly (e.g. when Velocity queries the DOM on behalf\n             of a parent of an element its animating), perform a direct getComputedStyle lookup since the object isn't cached. */\n            if (Data(element) === undefined) {\n              computedStyle = window.getComputedStyle(element, null);\n              /* GET */\n              /* If the computedStyle object has yet to be cached, do so now. */\n            } else if (!Data(element).computedStyle) {\n              computedStyle = Data(element).computedStyle = window.getComputedStyle(element, null);\n              /* GET */\n              /* If computedStyle is cached, use it. */\n            } else {\n              computedStyle = Data(element).computedStyle;\n            }\n\n            /* IE and Firefox do not return a value for the generic borderColor -- they only return individual values for each border side's color.\n             Also, in all browsers, when border colors aren't all the same, a compound value is returned that Velocity isn't setup to parse.\n             So, as a polyfill for querying individual border side colors, we just return the top border's color and animate all borders from that value. */\n            if (property === \"borderColor\") {\n              property = \"borderTopColor\";\n            }\n\n            /* IE9 has a bug in which the \"filter\" property must be accessed from computedStyle using the getPropertyValue method\n             instead of a direct property lookup. The getPropertyValue method is slower than a direct lookup, which is why we avoid it by default. */\n            if (IE === 9 && property === \"filter\") {\n              computedValue = computedStyle.getPropertyValue(property);\n              /* GET */\n            } else {\n              computedValue = computedStyle[property];\n            }\n\n            /* Fall back to the property's style value (if defined) when computedValue returns nothing,\n             which can happen when the element hasn't been painted. */\n            if (computedValue === \"\" || computedValue === null) {\n              computedValue = element.style[property];\n            }\n\n            revertDisplay();\n          }\n\n          /* For top, right, bottom, and left (TRBL) values that are set to \"auto\" on elements of \"fixed\" or \"absolute\" position,\n           defer to jQuery for converting \"auto\" to a numeric value. (For elements with a \"static\" or \"relative\" position, \"auto\" has the same\n           effect as being set to 0, so no conversion is necessary.) */\n          /* An example of why numeric conversion is necessary: When an element with \"position:absolute\" has an untouched \"left\"\n           property, which reverts to \"auto\", left's value is 0 relative to its parent element, but is often non-zero relative\n           to its *containing* (not parent) element, which is the nearest \"position:relative\" ancestor or the viewport (and always the viewport in the case of \"position:fixed\"). */\n          if (computedValue === \"auto\" && /^(top|right|bottom|left)$/i.test(property)) {\n            var position = computePropertyValue(element, \"position\");\n            /* GET */\n\n            /* For absolute positioning, jQuery's $.position() only returns values for top and left;\n             right and bottom will have their \"auto\" value reverted to 0. */\n            /* Note: A jQuery object must be created here since jQuery doesn't have a low-level alias for $.position().\n             Not a big deal since we're currently in a GET batch anyway. */\n            if (position === \"fixed\" || (position === \"absolute\" && /top|left/i.test(property))) {\n              /* Note: jQuery strips the pixel unit from its returned values; we re-add it here to conform with computePropertyValue's behavior. */\n              computedValue = $(element).position()[property] + \"px\";\n              /* GET */\n            }\n          }\n\n          return computedValue;\n        }\n\n        var propertyValue;\n\n        /* If this is a hooked property (e.g. \"clipLeft\" instead of the root property of \"clip\"),\n         extract the hook's value from a normalized rootPropertyValue using CSS.Hooks.extractValue(). */\n        if (CSS.Hooks.registered[property]) {\n          var hook = property,\n            hookRoot = CSS.Hooks.getRoot(hook);\n\n          /* If a cached rootPropertyValue wasn't passed in (which Velocity always attempts to do in order to avoid requerying the DOM),\n           query the DOM for the root property's value. */\n          if (rootPropertyValue === undefined) {\n            /* Since the browser is now being directly queried, use the official post-prefixing property name for this lookup. */\n            rootPropertyValue = CSS.getPropertyValue(element, CSS.Names.prefixCheck(hookRoot)[0]);\n            /* GET */\n          }\n\n          /* If this root has a normalization registered, peform the associated normalization extraction. */\n          if (CSS.Normalizations.registered[hookRoot]) {\n            rootPropertyValue = CSS.Normalizations.registered[hookRoot](\"extract\", element, rootPropertyValue);\n          }\n\n          /* Extract the hook's value. */\n          propertyValue = CSS.Hooks.extractValue(hook, rootPropertyValue);\n\n          /* If this is a normalized property (e.g. \"opacity\" becomes \"filter\" in <=IE8) or \"translateX\" becomes \"transform\"),\n           normalize the property's name and value, and handle the special case of transforms. */\n          /* Note: Normalizing a property is mutually exclusive from hooking a property since hook-extracted values are strictly\n           numerical and therefore do not require normalization extraction. */\n        } else if (CSS.Normalizations.registered[property]) {\n          var normalizedPropertyName,\n            normalizedPropertyValue;\n\n          normalizedPropertyName = CSS.Normalizations.registered[property](\"name\", element);\n\n          /* Transform values are calculated via normalization extraction (see below), which checks against the element's transformCache.\n           At no point do transform GETs ever actually query the DOM; initial stylesheet values are never processed.\n           This is because parsing 3D transform matrices is not always accurate and would bloat our codebase;\n           thus, normalization extraction defaults initial transform values to their zero-values (e.g. 1 for scaleX and 0 for translateX). */\n          if (normalizedPropertyName !== \"transform\") {\n            normalizedPropertyValue = computePropertyValue(element, CSS.Names.prefixCheck(normalizedPropertyName)[0]);\n            /* GET */\n\n            /* If the value is a CSS null-value and this property has a hook template, use that zero-value template so that hooks can be extracted from it. */\n            if (CSS.Values.isCSSNullValue(normalizedPropertyValue) && CSS.Hooks.templates[property]) {\n              normalizedPropertyValue = CSS.Hooks.templates[property][1];\n            }\n          }\n\n          propertyValue = CSS.Normalizations.registered[property](\"extract\", element, normalizedPropertyValue);\n        }\n\n        /* If a (numeric) value wasn't produced via hook extraction or normalization, query the DOM. */\n        if (!/^[\\d-]/.test(propertyValue)) {\n          /* For SVG elements, dimensional properties (which SVGAttribute() detects) are tweened via\n           their HTML attribute values instead of their CSS style values. */\n          if (Data(element) && Data(element).isSVG && CSS.Names.SVGAttribute(property)) {\n            /* Since the height/width attribute values must be set manually, they don't reflect computed values.\n             Thus, we use use getBBox() to ensure we always get values for elements with undefined height/width attributes. */\n            if (/^(height|width)$/i.test(property)) {\n              /* Firefox throws an error if .getBBox() is called on an SVG that isn't attached to the DOM. */\n              try {\n                propertyValue = element.getBBox()[property];\n              } catch (error) {\n                propertyValue = 0;\n              }\n              /* Otherwise, access the attribute value directly. */\n            } else {\n              propertyValue = element.getAttribute(property);\n            }\n          } else {\n            propertyValue = computePropertyValue(element, CSS.Names.prefixCheck(property)[0]);\n            /* GET */\n          }\n        }\n\n        /* Since property lookups are for animation purposes (which entails computing the numeric delta between start and end values),\n         convert CSS null-values to an integer of value 0. */\n        if (CSS.Values.isCSSNullValue(propertyValue)) {\n          propertyValue = 0;\n        }\n\n        if (Velocity.debug >= 2) console.log(\"Get \" + property + \": \" + propertyValue);\n\n        return propertyValue;\n      },\n\n      /* The singular setPropertyValue, which routes the logic for all normalizations, hooks, and standard CSS properties. */\n      setPropertyValue: function (element, property, propertyValue, rootPropertyValue, scrollData) {\n        var propertyName = property;\n\n        /* In order to be subjected to call options and element queueing, scroll animation is routed through Velocity as if it were a standard CSS property. */\n        if (property === \"scroll\") {\n          /* If a container option is present, scroll the container instead of the browser window. */\n          if (scrollData.container) {\n            scrollData.container[\"scroll\" + scrollData.direction] = propertyValue;\n            /* Otherwise, Velocity defaults to scrolling the browser window. */\n          } else {\n            if (scrollData.direction === \"Left\") {\n              window.scrollTo(propertyValue, scrollData.alternateValue);\n            } else {\n              window.scrollTo(scrollData.alternateValue, propertyValue);\n            }\n          }\n        } else {\n          /* Transforms (translateX, rotateZ, etc.) are applied to a per-element transformCache object, which is manually flushed via flushTransformCache().\n           Thus, for now, we merely cache transforms being SET. */\n          if (CSS.Normalizations.registered[property] && CSS.Normalizations.registered[property](\"name\", element) === \"transform\") {\n            /* Perform a normalization injection. */\n            /* Note: The normalization logic handles the transformCache updating. */\n            CSS.Normalizations.registered[property](\"inject\", element, propertyValue);\n\n            propertyName = \"transform\";\n            propertyValue = Data(element).transformCache[property];\n          } else {\n            /* Inject hooks. */\n            if (CSS.Hooks.registered[property]) {\n              var hookName = property,\n                hookRoot = CSS.Hooks.getRoot(property);\n\n              /* If a cached rootPropertyValue was not provided, query the DOM for the hookRoot's current value. */\n              rootPropertyValue = rootPropertyValue || CSS.getPropertyValue(element, hookRoot);\n              /* GET */\n\n              propertyValue = CSS.Hooks.injectValue(hookName, propertyValue, rootPropertyValue);\n              property = hookRoot;\n            }\n\n            /* Normalize names and values. */\n            if (CSS.Normalizations.registered[property]) {\n              propertyValue = CSS.Normalizations.registered[property](\"inject\", element, propertyValue);\n              property = CSS.Normalizations.registered[property](\"name\", element);\n            }\n\n            /* Assign the appropriate vendor prefix before performing an official style update. */\n            propertyName = CSS.Names.prefixCheck(property)[0];\n\n            /* A try/catch is used for IE<=8, which throws an error when \"invalid\" CSS values are set, e.g. a negative width.\n             Try/catch is avoided for other browsers since it incurs a performance overhead. */\n            if (IE <= 8) {\n              try {\n                element.style[propertyName] = propertyValue;\n              } catch (error) {\n                if (Velocity.debug) console.log(\"Browser does not support [\" + propertyValue + \"] for [\" + propertyName + \"]\");\n              }\n              /* SVG elements have their dimensional properties (width, height, x, y, cx, etc.) applied directly as attributes instead of as styles. */\n              /* Note: IE8 does not support SVG elements, so it's okay that we skip it for SVG animation. */\n            } else if (Data(element) && Data(element).isSVG && CSS.Names.SVGAttribute(property)) {\n              /* Note: For SVG attributes, vendor-prefixed property names are never used. */\n              /* Note: Not all CSS properties can be animated via attributes, but the browser won't throw an error for unsupported properties. */\n              element.setAttribute(property, propertyValue);\n            } else {\n              element.style[propertyName] = propertyValue;\n            }\n\n            if (Velocity.debug >= 2) console.log(\"Set \" + property + \" (\" + propertyName + \"): \" + propertyValue);\n          }\n        }\n\n        /* Return the normalized property name and value in case the caller wants to know how these values were modified before being applied to the DOM. */\n        return [propertyName, propertyValue];\n      },\n\n      /* To increase performance by batching transform updates into a single SET, transforms are not directly applied to an element until flushTransformCache() is called. */\n      /* Note: Velocity applies transform properties in the same order that they are chronogically introduced to the element's CSS styles. */\n      flushTransformCache: function (element) {\n        var transformString = \"\";\n\n        /* Certain browsers require that SVG transforms be applied as an attribute. However, the SVG transform attribute takes a modified version of CSS's transform string\n         (units are dropped and, except for skewX/Y, subproperties are merged into their master property -- e.g. scaleX and scaleY are merged into scale(X Y). */\n        if ((IE || (Velocity.State.isAndroid && !Velocity.State.isChrome)) && Data(element).isSVG) {\n          /* Since transform values are stored in their parentheses-wrapped form, we use a helper function to strip out their numeric values.\n           Further, SVG transform properties only take unitless (representing pixels) values, so it's okay that parseFloat() strips the unit suffixed to the float value. */\n          function getTransformFloat(transformProperty) {\n            return parseFloat(CSS.getPropertyValue(element, transformProperty));\n          }\n\n          /* Create an object to organize all the transforms that we'll apply to the SVG element. To keep the logic simple,\n           we process *all* transform properties -- even those that may not be explicitly applied (since they default to their zero-values anyway). */\n          var SVGTransforms = {\n            translate: [getTransformFloat(\"translateX\"), getTransformFloat(\"translateY\")],\n            skewX: [getTransformFloat(\"skewX\")], skewY: [getTransformFloat(\"skewY\")],\n            /* If the scale property is set (non-1), use that value for the scaleX and scaleY values\n             (this behavior mimics the result of animating all these properties at once on HTML elements). */\n            scale: getTransformFloat(\"scale\") !== 1 ? [getTransformFloat(\"scale\"), getTransformFloat(\"scale\")] : [getTransformFloat(\"scaleX\"), getTransformFloat(\"scaleY\")],\n            /* Note: SVG's rotate transform takes three values: rotation degrees followed by the X and Y values\n             defining the rotation's origin point. We ignore the origin values (default them to 0). */\n            rotate: [getTransformFloat(\"rotateZ\"), 0, 0]\n          };\n\n          /* Iterate through the transform properties in the user-defined property map order.\n           (This mimics the behavior of non-SVG transform animation.) */\n          $.each(Data(element).transformCache, function (transformName) {\n            /* Except for with skewX/Y, revert the axis-specific transform subproperties to their axis-free master\n             properties so that they match up with SVG's accepted transform properties. */\n            if (/^translate/i.test(transformName)) {\n              transformName = \"translate\";\n            } else if (/^scale/i.test(transformName)) {\n              transformName = \"scale\";\n            } else if (/^rotate/i.test(transformName)) {\n              transformName = \"rotate\";\n            }\n\n            /* Check that we haven't yet deleted the property from the SVGTransforms container. */\n            if (SVGTransforms[transformName]) {\n              /* Append the transform property in the SVG-supported transform format. As per the spec, surround the space-delimited values in parentheses. */\n              transformString += transformName + \"(\" + SVGTransforms[transformName].join(\" \") + \")\" + \" \";\n\n              /* After processing an SVG transform property, delete it from the SVGTransforms container so we don't\n               re-insert the same master property if we encounter another one of its axis-specific properties. */\n              delete SVGTransforms[transformName];\n            }\n          });\n        } else {\n          var transformValue,\n            perspective;\n\n          /* Transform properties are stored as members of the transformCache object. Concatenate all the members into a string. */\n          $.each(Data(element).transformCache, function (transformName) {\n            transformValue = Data(element).transformCache[transformName];\n\n            /* Transform's perspective subproperty must be set first in order to take effect. Store it temporarily. */\n            if (transformName === \"transformPerspective\") {\n              perspective = transformValue;\n              return true;\n            }\n\n            /* IE9 only supports one rotation type, rotateZ, which it refers to as \"rotate\". */\n            if (IE === 9 && transformName === \"rotateZ\") {\n              transformName = \"rotate\";\n            }\n\n            transformString += transformName + transformValue + \" \";\n          });\n\n          /* If present, set the perspective subproperty first. */\n          if (perspective) {\n            transformString = \"perspective\" + perspective + \" \" + transformString;\n          }\n        }\n\n        CSS.setPropertyValue(element, \"transform\", transformString);\n      }\n    };\n\n    /* Register hooks and normalizations. */\n    CSS.Hooks.register();\n    CSS.Normalizations.register();\n\n    /* Allow hook setting in the same fashion as jQuery's $.css(). */\n    Velocity.hook = function (elements, arg2, arg3) {\n      var value = undefined;\n\n      elements = sanitizeElements(elements);\n\n      $.each(elements, function (i, element) {\n        /* Initialize Velocity's per-element data cache if this element hasn't previously been animated. */\n        if (Data(element) === undefined) {\n          Velocity.init(element);\n        }\n\n        /* Get property value. If an element set was passed in, only return the value for the first element. */\n        if (arg3 === undefined) {\n          if (value === undefined) {\n            value = Velocity.CSS.getPropertyValue(element, arg2);\n          }\n          /* Set property value. */\n        } else {\n          /* sPV returns an array of the normalized propertyName/propertyValue pair used to update the DOM. */\n          var adjustedSet = Velocity.CSS.setPropertyValue(element, arg2, arg3);\n\n          /* Transform properties don't automatically set. They have to be flushed to the DOM. */\n          if (adjustedSet[0] === \"transform\") {\n            Velocity.CSS.flushTransformCache(element);\n          }\n\n          value = adjustedSet;\n        }\n      });\n\n      return value;\n    };\n\n    /*****************\n     Animation\n     *****************/\n\n    var animate = function () {\n\n      /******************\n       Call Chain\n       ******************/\n\n      /* Logic for determining what to return to the call stack when exiting out of Velocity. */\n      function getChain() {\n        /* If we are using the utility function, attempt to return this call's promise. If no promise library was detected,\n         default to null instead of returning the targeted elements so that utility function's return value is standardized. */\n        if (isUtility) {\n          return promiseData.promise || null;\n          /* Otherwise, if we're using $.fn, return the jQuery-/Zepto-wrapped element set. */\n        } else {\n          return elementsWrapped;\n        }\n      }\n\n      /*************************\n       Arguments Assignment\n       *************************/\n\n      /* To allow for expressive CoffeeScript code, Velocity supports an alternative syntax in which \"elements\" (or \"e\"), \"properties\" (or \"p\"), and \"options\" (or \"o\")\n       objects are defined on a container object that's passed in as Velocity's sole argument. */\n      /* Note: Some browsers automatically populate arguments with a \"properties\" object. We detect it by checking for its default \"names\" property. */\n      var syntacticSugar = (arguments[0] && (arguments[0].p || (($.isPlainObject(arguments[0].properties) && !arguments[0].properties.names) || Type.isString(arguments[0].properties)))),\n      /* Whether Velocity was called via the utility function (as opposed to on a jQuery/Zepto object). */\n        isUtility,\n      /* When Velocity is called via the utility function ($.Velocity()/Velocity()), elements are explicitly\n       passed in as the first parameter. Thus, argument positioning varies. We normalize them here. */\n        elementsWrapped,\n        argumentIndex;\n\n      var elements,\n        propertiesMap,\n        options;\n\n      /* Detect jQuery/Zepto elements being animated via the $.fn method. */\n      if (Type.isWrapped(this)) {\n        isUtility = false;\n\n        argumentIndex = 0;\n        elements = this;\n        elementsWrapped = this;\n        /* Otherwise, raw elements are being animated via the utility function. */\n      } else {\n        isUtility = true;\n\n        argumentIndex = 1;\n        elements = syntacticSugar ? (arguments[0].elements || arguments[0].e) : arguments[0];\n      }\n\n      elements = sanitizeElements(elements);\n\n      if (!elements) {\n        return;\n      }\n\n      if (syntacticSugar) {\n        propertiesMap = arguments[0].properties || arguments[0].p;\n        options = arguments[0].options || arguments[0].o;\n      } else {\n        propertiesMap = arguments[argumentIndex];\n        options = arguments[argumentIndex + 1];\n      }\n\n      /* The length of the element set (in the form of a nodeList or an array of elements) is defaulted to 1 in case a\n       single raw DOM element is passed in (which doesn't contain a length property). */\n      var elementsLength = elements.length,\n        elementsIndex = 0;\n\n      /***************************\n       Argument Overloading\n       ***************************/\n\n      /* Support is included for jQuery's argument overloading: $.animate(propertyMap [, duration] [, easing] [, complete]).\n       Overloading is detected by checking for the absence of an object being passed into options. */\n      /* Note: The stop and finish actions do not accept animation options, and are therefore excluded from this check. */\n      if (!/^(stop|finish)$/i.test(propertiesMap) && !$.isPlainObject(options)) {\n        /* The utility function shifts all arguments one position to the right, so we adjust for that offset. */\n        var startingArgumentPosition = argumentIndex + 1;\n\n        options = {};\n\n        /* Iterate through all options arguments */\n        for (var i = startingArgumentPosition; i < arguments.length; i++) {\n          /* Treat a number as a duration. Parse it out. */\n          /* Note: The following RegEx will return true if passed an array with a number as its first item.\n           Thus, arrays are skipped from this check. */\n          if (!Type.isArray(arguments[i]) && (/^(fast|normal|slow)$/i.test(arguments[i]) || /^\\d/.test(arguments[i]))) {\n            options.duration = arguments[i];\n            /* Treat strings and arrays as easings. */\n          } else if (Type.isString(arguments[i]) || Type.isArray(arguments[i])) {\n            options.easing = arguments[i];\n            /* Treat a function as a complete callback. */\n          } else if (Type.isFunction(arguments[i])) {\n            options.complete = arguments[i];\n          }\n        }\n      }\n\n      /***************\n       Promises\n       ***************/\n\n      var promiseData = {\n        promise: null,\n        resolver: null,\n        rejecter: null\n      };\n\n      /* If this call was made via the utility function (which is the default method of invocation when jQuery/Zepto are not being used), and if\n       promise support was detected, create a promise object for this call and store references to its resolver and rejecter methods. The resolve\n       method is used when a call completes naturally or is prematurely stopped by the user. In both cases, completeCall() handles the associated\n       call cleanup and promise resolving logic. The reject method is used when an invalid set of arguments is passed into a Velocity call. */\n      /* Note: Velocity employs a call-based queueing architecture, which means that stopping an animating element actually stops the full call that\n       triggered it -- not that one element exclusively. Similarly, there is one promise per call, and all elements targeted by a Velocity call are\n       grouped together for the purposes of resolving and rejecting a promise. */\n      if (isUtility && Velocity.Promise) {\n        promiseData.promise = new Velocity.Promise(function (resolve, reject) {\n          promiseData.resolver = resolve;\n          promiseData.rejecter = reject;\n        });\n      }\n\n      /*********************\n       Action Detection\n       *********************/\n\n      /* Velocity's behavior is categorized into \"actions\": Elements can either be specially scrolled into view,\n       or they can be started, stopped, or reversed. If a literal or referenced properties map is passed in as Velocity's\n       first argument, the associated action is \"start\". Alternatively, \"scroll\", \"reverse\", or \"stop\" can be passed in instead of a properties map. */\n      var action;\n\n      switch (propertiesMap) {\n        case \"scroll\":\n          action = \"scroll\";\n          break;\n\n        case \"reverse\":\n          action = \"reverse\";\n          break;\n\n        case \"finish\":\n        case \"stop\":\n          /*******************\n           Action: Stop\n           *******************/\n\n          /* Clear the currently-active delay on each targeted element. */\n          $.each(elements, function (i, element) {\n            if (Data(element) && Data(element).delayTimer) {\n              /* Stop the timer from triggering its cached next() function. */\n              clearTimeout(Data(element).delayTimer.setTimeout);\n\n              /* Manually call the next() function so that the subsequent queue items can progress. */\n              if (Data(element).delayTimer.next) {\n                Data(element).delayTimer.next();\n              }\n\n              delete Data(element).delayTimer;\n            }\n          });\n\n          var callsToStop = [];\n\n          /* When the stop action is triggered, the elements' currently active call is immediately stopped. The active call might have\n           been applied to multiple elements, in which case all of the call's elements will be stopped. When an element\n           is stopped, the next item in its animation queue is immediately triggered. */\n          /* An additional argument may be passed in to clear an element's remaining queued calls. Either true (which defaults to the \"fx\" queue)\n           or a custom queue string can be passed in. */\n          /* Note: The stop command runs prior to Velocity's Queueing phase since its behavior is intended to take effect *immediately*,\n           regardless of the element's current queue state. */\n\n          /* Iterate through every active call. */\n          $.each(Velocity.State.calls, function (i, activeCall) {\n            /* Inactive calls are set to false by the logic inside completeCall(). Skip them. */\n            if (activeCall) {\n              /* Iterate through the active call's targeted elements. */\n              $.each(activeCall[1], function (k, activeElement) {\n                /* If true was passed in as a secondary argument, clear absolutely all calls on this element. Otherwise, only\n                 clear calls associated with the relevant queue. */\n                /* Call stopping logic works as follows:\n                 - options === true --> stop current default queue calls (and queue:false calls), including remaining queued ones.\n                 - options === undefined --> stop current queue:\"\" call and all queue:false calls.\n                 - options === false --> stop only queue:false calls.\n                 - options === \"custom\" --> stop current queue:\"custom\" call, including remaining queued ones (there is no functionality to only clear the currently-running queue:\"custom\" call). */\n                var queueName = (options === undefined) ? \"\" : options;\n\n                if (queueName !== true && (activeCall[2].queue !== queueName) && !(options === undefined && activeCall[2].queue === false)) {\n                  return true;\n                }\n\n                /* Iterate through the calls targeted by the stop command. */\n                $.each(elements, function (l, element) {\n                  /* Check that this call was applied to the target element. */\n                  if (element === activeElement) {\n                    /* Optionally clear the remaining queued calls. */\n                    if (options === true || Type.isString(options)) {\n                      /* Iterate through the items in the element's queue. */\n                      $.each($.queue(element, Type.isString(options) ? options : \"\"), function (_, item) {\n                        /* The queue array can contain an \"inprogress\" string, which we skip. */\n                        if (Type.isFunction(item)) {\n                          /* Pass the item's callback a flag indicating that we want to abort from the queue call.\n                           (Specifically, the queue will resolve the call's associated promise then abort.)  */\n                          item(null, true);\n                        }\n                      });\n\n                      /* Clearing the $.queue() array is achieved by resetting it to []. */\n                      $.queue(element, Type.isString(options) ? options : \"\", []);\n                    }\n\n                    if (propertiesMap === \"stop\") {\n                      /* Since \"reverse\" uses cached start values (the previous call's endValues), these values must be\n                       changed to reflect the final value that the elements were actually tweened to. */\n                      /* Note: If only queue:false animations are currently running on an element, it won't have a tweensContainer\n                       object. Also, queue:false animations can't be reversed. */\n                      if (Data(element) && Data(element).tweensContainer && queueName !== false) {\n                        $.each(Data(element).tweensContainer, function (m, activeTween) {\n                          activeTween.endValue = activeTween.currentValue;\n                        });\n                      }\n\n                      callsToStop.push(i);\n                    } else if (propertiesMap === \"finish\") {\n                      /* To get active tweens to finish immediately, we forcefully shorten their durations to 1ms so that\n                       they finish upon the next rAf tick then proceed with normal call completion logic. */\n                      activeCall[2].duration = 1;\n                    }\n                  }\n                });\n              });\n            }\n          });\n\n          /* Prematurely call completeCall() on each matched active call. Pass an additional flag for \"stop\" to indicate\n           that the complete callback and display:none setting should be skipped since we're completing prematurely. */\n          if (propertiesMap === \"stop\") {\n            $.each(callsToStop, function (i, j) {\n              completeCall(j, true);\n            });\n\n            if (promiseData.promise) {\n              /* Immediately resolve the promise associated with this stop call since stop runs synchronously. */\n              promiseData.resolver(elements);\n            }\n          }\n\n          /* Since we're stopping, and not proceeding with queueing, exit out of Velocity. */\n          return getChain();\n\n        default:\n          /* Treat a non-empty plain object as a literal properties map. */\n          if ($.isPlainObject(propertiesMap) && !Type.isEmptyObject(propertiesMap)) {\n            action = \"start\";\n\n            /****************\n             Redirects\n             ****************/\n\n            /* Check if a string matches a registered redirect (see Redirects above). */\n          } else if (Type.isString(propertiesMap) && Velocity.Redirects[propertiesMap]) {\n            var opts = $.extend({}, options),\n              durationOriginal = opts.duration,\n              delayOriginal = opts.delay || 0;\n\n            /* If the backwards option was passed in, reverse the element set so that elements animate from the last to the first. */\n            if (opts.backwards === true) {\n              elements = $.extend(true, [], elements).reverse();\n            }\n\n            /* Individually trigger the redirect for each element in the set to prevent users from having to handle iteration logic in their redirect. */\n            $.each(elements, function (elementIndex, element) {\n              /* If the stagger option was passed in, successively delay each element by the stagger value (in ms). Retain the original delay value. */\n              if (parseFloat(opts.stagger)) {\n                opts.delay = delayOriginal + (parseFloat(opts.stagger) * elementIndex);\n              } else if (Type.isFunction(opts.stagger)) {\n                opts.delay = delayOriginal + opts.stagger.call(element, elementIndex, elementsLength);\n              }\n\n              /* If the drag option was passed in, successively increase/decrease (depending on the presense of opts.backwards)\n               the duration of each element's animation, using floors to prevent producing very short durations. */\n              if (opts.drag) {\n                /* Default the duration of UI pack effects (callouts and transitions) to 1000ms instead of the usual default duration of 400ms. */\n                opts.duration = parseFloat(durationOriginal) || (/^(callout|transition)/.test(propertiesMap) ? 1000 : DURATION_DEFAULT);\n\n                /* For each element, take the greater duration of: A) animation completion percentage relative to the original duration,\n                 B) 75% of the original duration, or C) a 200ms fallback (in case duration is already set to a low value).\n                 The end result is a baseline of 75% of the redirect's duration that increases/decreases as the end of the element set is approached. */\n                opts.duration = Math.max(opts.duration * (opts.backwards ? 1 - elementIndex / elementsLength : (elementIndex + 1) / elementsLength), opts.duration * 0.75, 200);\n              }\n\n              /* Pass in the call's opts object so that the redirect can optionally extend it. It defaults to an empty object instead of null to\n               reduce the opts checking logic required inside the redirect. */\n              Velocity.Redirects[propertiesMap].call(element, element, opts || {}, elementIndex, elementsLength, elements, promiseData.promise ? promiseData : undefined);\n            });\n\n            /* Since the animation logic resides within the redirect's own code, abort the remainder of this call.\n             (The performance overhead up to this point is virtually non-existant.) */\n            /* Note: The jQuery call chain is kept intact by returning the complete element set. */\n            return getChain();\n          } else {\n            var abortError = \"Velocity: First argument (\" + propertiesMap + \") was not a property map, a known action, or a registered redirect. Aborting.\";\n\n            if (promiseData.promise) {\n              promiseData.rejecter(new Error(abortError));\n            } else {\n              console.log(abortError);\n            }\n\n            return getChain();\n          }\n      }\n\n      /**************************\n       Call-Wide Variables\n       **************************/\n\n      /* A container for CSS unit conversion ratios (e.g. %, rem, and em ==> px) that is used to cache ratios across all elements\n       being animated in a single Velocity call. Calculating unit ratios necessitates DOM querying and updating, and is therefore\n       avoided (via caching) wherever possible. This container is call-wide instead of page-wide to avoid the risk of using stale\n       conversion metrics across Velocity animations that are not immediately consecutively chained. */\n      var callUnitConversionData = {\n        lastParent: null,\n        lastPosition: null,\n        lastFontSize: null,\n        lastPercentToPxWidth: null,\n        lastPercentToPxHeight: null,\n        lastEmToPx: null,\n        remToPx: null,\n        vwToPx: null,\n        vhToPx: null\n      };\n\n      /* A container for all the ensuing tween data and metadata associated with this call. This container gets pushed to the page-wide\n       Velocity.State.calls array that is processed during animation ticking. */\n      var call = [];\n\n      /************************\n       Element Processing\n       ************************/\n\n      /* Element processing consists of three parts -- data processing that cannot go stale and data processing that *can* go stale (i.e. third-party style modifications):\n       1) Pre-Queueing: Element-wide variables, including the element's data storage, are instantiated. Call options are prepared. If triggered, the Stop action is executed.\n       2) Queueing: The logic that runs once this call has reached its point of execution in the element's $.queue() stack. Most logic is placed here to avoid risking it becoming stale.\n       3) Pushing: Consolidation of the tween data followed by its push onto the global in-progress calls container.\n       */\n\n      function processElement() {\n\n        /*************************\n         Part I: Pre-Queueing\n         *************************/\n\n        /***************************\n         Element-Wide Variables\n         ***************************/\n\n        var element = this,\n        /* The runtime opts object is the extension of the current call's options and Velocity's page-wide option defaults. */\n          opts = $.extend({}, Velocity.defaults, options),\n        /* A container for the processed data associated with each property in the propertyMap.\n         (Each property in the map produces its own \"tween\".) */\n          tweensContainer = {},\n          elementUnitConversionData;\n\n        /******************\n         Element Init\n         ******************/\n\n        if (Data(element) === undefined) {\n          Velocity.init(element);\n        }\n\n        /******************\n         Option: Delay\n         ******************/\n\n        /* Since queue:false doesn't respect the item's existing queue, we avoid injecting its delay here (it's set later on). */\n        /* Note: Velocity rolls its own delay function since jQuery doesn't have a utility alias for $.fn.delay()\n         (and thus requires jQuery element creation, which we avoid since its overhead includes DOM querying). */\n        if (parseFloat(opts.delay) && opts.queue !== false) {\n          $.queue(element, opts.queue, function (next) {\n            /* This is a flag used to indicate to the upcoming completeCall() function that this queue entry was initiated by Velocity. See completeCall() for further details. */\n            Velocity.velocityQueueEntryFlag = true;\n\n            /* The ensuing queue item (which is assigned to the \"next\" argument that $.queue() automatically passes in) will be triggered after a setTimeout delay.\n             The setTimeout is stored so that it can be subjected to clearTimeout() if this animation is prematurely stopped via Velocity's \"stop\" command. */\n            Data(element).delayTimer = {\n              setTimeout: setTimeout(next, parseFloat(opts.delay)),\n              next: next\n            };\n          });\n        }\n\n        /*********************\n         Option: Duration\n         *********************/\n\n        /* Support for jQuery's named durations. */\n        switch (opts.duration.toString().toLowerCase()) {\n          case \"fast\":\n            opts.duration = 200;\n            break;\n\n          case \"normal\":\n            opts.duration = DURATION_DEFAULT;\n            break;\n\n          case \"slow\":\n            opts.duration = 600;\n            break;\n\n          default:\n            /* Remove the potential \"ms\" suffix and default to 1 if the user is attempting to set a duration of 0 (in order to produce an immediate style change). */\n            opts.duration = parseFloat(opts.duration) || 1;\n        }\n\n        /************************\n         Global Option: Mock\n         ************************/\n\n        if (Velocity.mock !== false) {\n          /* In mock mode, all animations are forced to 1ms so that they occur immediately upon the next rAF tick.\n           Alternatively, a multiplier can be passed in to time remap all delays and durations. */\n          if (Velocity.mock === true) {\n            opts.duration = opts.delay = 1;\n          } else {\n            opts.duration *= parseFloat(Velocity.mock) || 1;\n            opts.delay *= parseFloat(Velocity.mock) || 1;\n          }\n        }\n\n        /*******************\n         Option: Easing\n         *******************/\n\n        opts.easing = getEasing(opts.easing, opts.duration);\n\n        /**********************\n         Option: Callbacks\n         **********************/\n\n        /* Callbacks must functions. Otherwise, default to null. */\n        if (opts.begin && !Type.isFunction(opts.begin)) {\n          opts.begin = null;\n        }\n\n        if (opts.progress && !Type.isFunction(opts.progress)) {\n          opts.progress = null;\n        }\n\n        if (opts.complete && !Type.isFunction(opts.complete)) {\n          opts.complete = null;\n        }\n\n        /*********************************\n         Option: Display & Visibility\n         *********************************/\n\n        /* Refer to Velocity's documentation (VelocityJS.org/#displayAndVisibility) for a description of the display and visibility options' behavior. */\n        /* Note: We strictly check for undefined instead of falsiness because display accepts an empty string value. */\n        if (opts.display !== undefined && opts.display !== null) {\n          opts.display = opts.display.toString().toLowerCase();\n\n          /* Users can pass in a special \"auto\" value to instruct Velocity to set the element to its default display value. */\n          if (opts.display === \"auto\") {\n            opts.display = Velocity.CSS.Values.getDisplayType(element);\n          }\n        }\n\n        if (opts.visibility !== undefined && opts.visibility !== null) {\n          opts.visibility = opts.visibility.toString().toLowerCase();\n        }\n\n        /**********************\n         Option: mobileHA\n         **********************/\n\n        /* When set to true, and if this is a mobile device, mobileHA automatically enables hardware acceleration (via a null transform hack)\n         on animating elements. HA is removed from the element at the completion of its animation. */\n        /* Note: Android Gingerbread doesn't support HA. If a null transform hack (mobileHA) is in fact set, it will prevent other tranform subproperties from taking effect. */\n        /* Note: You can read more about the use of mobileHA in Velocity's documentation: VelocityJS.org/#mobileHA. */\n        opts.mobileHA = (opts.mobileHA && Velocity.State.isMobile && !Velocity.State.isGingerbread);\n\n        /***********************\n         Part II: Queueing\n         ***********************/\n\n        /* When a set of elements is targeted by a Velocity call, the set is broken up and each element has the current Velocity call individually queued onto it.\n         In this way, each element's existing queue is respected; some elements may already be animating and accordingly should not have this current Velocity call triggered immediately. */\n        /* In each queue, tween data is processed for each animating property then pushed onto the call-wide calls array. When the last element in the set has had its tweens processed,\n         the call array is pushed to Velocity.State.calls for live processing by the requestAnimationFrame tick. */\n        function buildQueue(next) {\n\n          /*******************\n           Option: Begin\n           *******************/\n\n          /* The begin callback is fired once per call -- not once per elemenet -- and is passed the full raw DOM element set as both its context and its first argument. */\n          if (opts.begin && elementsIndex === 0) {\n            /* We throw callbacks in a setTimeout so that thrown errors don't halt the execution of Velocity itself. */\n            try {\n              opts.begin.call(elements, elements);\n            } catch (error) {\n              setTimeout(function () {\n                throw error;\n              }, 1);\n            }\n          }\n\n          /*****************************************\n           Tween Data Construction (for Scroll)\n           *****************************************/\n\n          /* Note: In order to be subjected to chaining and animation options, scroll's tweening is routed through Velocity as if it were a standard CSS property animation. */\n          if (action === \"scroll\") {\n            /* The scroll action uniquely takes an optional \"offset\" option -- specified in pixels -- that offsets the targeted scroll position. */\n            var scrollDirection = (/^x$/i.test(opts.axis) ? \"Left\" : \"Top\"),\n              scrollOffset = parseFloat(opts.offset) || 0,\n              scrollPositionCurrent,\n              scrollPositionCurrentAlternate,\n              scrollPositionEnd;\n\n            /* Scroll also uniquely takes an optional \"container\" option, which indicates the parent element that should be scrolled --\n             as opposed to the browser window itself. This is useful for scrolling toward an element that's inside an overflowing parent element. */\n            if (opts.container) {\n              /* Ensure that either a jQuery object or a raw DOM element was passed in. */\n              if (Type.isWrapped(opts.container) || Type.isNode(opts.container)) {\n                /* Extract the raw DOM element from the jQuery wrapper. */\n                opts.container = opts.container[0] || opts.container;\n                /* Note: Unlike other properties in Velocity, the browser's scroll position is never cached since it so frequently changes\n                 (due to the user's natural interaction with the page). */\n                scrollPositionCurrent = opts.container[\"scroll\" + scrollDirection];\n                /* GET */\n\n                /* $.position() values are relative to the container's currently viewable area (without taking into account the container's true dimensions\n                 -- say, for example, if the container was not overflowing). Thus, the scroll end value is the sum of the child element's position *and*\n                 the scroll container's current scroll position. */\n                scrollPositionEnd = (scrollPositionCurrent + $(element).position()[scrollDirection.toLowerCase()]) + scrollOffset;\n                /* GET */\n                /* If a value other than a jQuery object or a raw DOM element was passed in, default to null so that this option is ignored. */\n              } else {\n                opts.container = null;\n              }\n            } else {\n              /* If the window itself is being scrolled -- not a containing element -- perform a live scroll position lookup using\n               the appropriate cached property names (which differ based on browser type). */\n              scrollPositionCurrent = Velocity.State.scrollAnchor[Velocity.State[\"scrollProperty\" + scrollDirection]];\n              /* GET */\n              /* When scrolling the browser window, cache the alternate axis's current value since window.scrollTo() doesn't let us change only one value at a time. */\n              scrollPositionCurrentAlternate = Velocity.State.scrollAnchor[Velocity.State[\"scrollProperty\" + (scrollDirection === \"Left\" ? \"Top\" : \"Left\")]];\n              /* GET */\n\n              /* Unlike $.position(), $.offset() values are relative to the browser window's true dimensions -- not merely its currently viewable area --\n               and therefore end values do not need to be compounded onto current values. */\n              scrollPositionEnd = $(element).offset()[scrollDirection.toLowerCase()] + scrollOffset;\n              /* GET */\n            }\n\n            /* Since there's only one format that scroll's associated tweensContainer can take, we create it manually. */\n            tweensContainer = {\n              scroll: {\n                rootPropertyValue: false,\n                startValue: scrollPositionCurrent,\n                currentValue: scrollPositionCurrent,\n                endValue: scrollPositionEnd,\n                unitType: \"\",\n                easing: opts.easing,\n                scrollData: {\n                  container: opts.container,\n                  direction: scrollDirection,\n                  alternateValue: scrollPositionCurrentAlternate\n                }\n              },\n              element: element\n            };\n\n            if (Velocity.debug) console.log(\"tweensContainer (scroll): \", tweensContainer.scroll, element);\n\n            /******************************************\n             Tween Data Construction (for Reverse)\n             ******************************************/\n\n            /* Reverse acts like a \"start\" action in that a property map is animated toward. The only difference is\n             that the property map used for reverse is the inverse of the map used in the previous call. Thus, we manipulate\n             the previous call to construct our new map: use the previous map's end values as our new map's start values. Copy over all other data. */\n            /* Note: Reverse can be directly called via the \"reverse\" parameter, or it can be indirectly triggered via the loop option. (Loops are composed of multiple reverses.) */\n            /* Note: Reverse calls do not need to be consecutively chained onto a currently-animating element in order to operate on cached values;\n             there is no harm to reverse being called on a potentially stale data cache since reverse's behavior is simply defined\n             as reverting to the element's values as they were prior to the previous *Velocity* call. */\n          } else if (action === \"reverse\") {\n            /* Abort if there is no prior animation data to reverse to. */\n            if (!Data(element).tweensContainer) {\n              /* Dequeue the element so that this queue entry releases itself immediately, allowing subsequent queue entries to run. */\n              $.dequeue(element, opts.queue);\n\n              return;\n            } else {\n              /*********************\n               Options Parsing\n               *********************/\n\n              /* If the element was hidden via the display option in the previous call,\n               revert display to \"auto\" prior to reversal so that the element is visible again. */\n              if (Data(element).opts.display === \"none\") {\n                Data(element).opts.display = \"auto\";\n              }\n\n              if (Data(element).opts.visibility === \"hidden\") {\n                Data(element).opts.visibility = \"visible\";\n              }\n\n              /* If the loop option was set in the previous call, disable it so that \"reverse\" calls aren't recursively generated.\n               Further, remove the previous call's callback options; typically, users do not want these to be refired. */\n              Data(element).opts.loop = false;\n              Data(element).opts.begin = null;\n              Data(element).opts.complete = null;\n\n              /* Since we're extending an opts object that has already been extended with the defaults options object,\n               we remove non-explicitly-defined properties that are auto-assigned values. */\n              if (!options.easing) {\n                delete opts.easing;\n              }\n\n              if (!options.duration) {\n                delete opts.duration;\n              }\n\n              /* The opts object used for reversal is an extension of the options object optionally passed into this\n               reverse call plus the options used in the previous Velocity call. */\n              opts = $.extend({}, Data(element).opts, opts);\n\n              /*************************************\n               Tweens Container Reconstruction\n               *************************************/\n\n              /* Create a deepy copy (indicated via the true flag) of the previous call's tweensContainer. */\n              var lastTweensContainer = $.extend(true, {}, Data(element).tweensContainer);\n\n              /* Manipulate the previous tweensContainer by replacing its end values and currentValues with its start values. */\n              for (var lastTween in lastTweensContainer) {\n                /* In addition to tween data, tweensContainers contain an element property that we ignore here. */\n                if (lastTween !== \"element\") {\n                  var lastStartValue = lastTweensContainer[lastTween].startValue;\n\n                  lastTweensContainer[lastTween].startValue = lastTweensContainer[lastTween].currentValue = lastTweensContainer[lastTween].endValue;\n                  lastTweensContainer[lastTween].endValue = lastStartValue;\n\n                  /* Easing is the only option that embeds into the individual tween data (since it can be defined on a per-property basis).\n                   Accordingly, every property's easing value must be updated when an options object is passed in with a reverse call.\n                   The side effect of this extensibility is that all per-property easing values are forcefully reset to the new value. */\n                  if (!Type.isEmptyObject(options)) {\n                    lastTweensContainer[lastTween].easing = opts.easing;\n                  }\n\n                  if (Velocity.debug) console.log(\"reverse tweensContainer (\" + lastTween + \"): \" + JSON.stringify(lastTweensContainer[lastTween]), element);\n                }\n              }\n\n              tweensContainer = lastTweensContainer;\n            }\n\n            /*****************************************\n             Tween Data Construction (for Start)\n             *****************************************/\n\n          } else if (action === \"start\") {\n\n            /*************************\n             Value Transferring\n             *************************/\n\n            /* If this queue entry follows a previous Velocity-initiated queue entry *and* if this entry was created\n             while the element was in the process of being animated by Velocity, then this current call is safe to use\n             the end values from the prior call as its start values. Velocity attempts to perform this value transfer\n             process whenever possible in order to avoid requerying the DOM. */\n            /* If values aren't transferred from a prior call and start values were not forcefed by the user (more on this below),\n             then the DOM is queried for the element's current values as a last resort. */\n            /* Note: Conversely, animation reversal (and looping) *always* perform inter-call value transfers; they never requery the DOM. */\n            var lastTweensContainer;\n\n            /* The per-element isAnimating flag is used to indicate whether it's safe (i.e. the data isn't stale)\n             to transfer over end values to use as start values. If it's set to true and there is a previous\n             Velocity call to pull values from, do so. */\n            if (Data(element).tweensContainer && Data(element).isAnimating === true) {\n              lastTweensContainer = Data(element).tweensContainer;\n            }\n\n            /***************************\n             Tween Data Calculation\n             ***************************/\n\n            /* This function parses property data and defaults endValue, easing, and startValue as appropriate. */\n            /* Property map values can either take the form of 1) a single value representing the end value,\n             or 2) an array in the form of [ endValue, [, easing] [, startValue] ].\n             The optional third parameter is a forcefed startValue to be used instead of querying the DOM for\n             the element's current value. Read Velocity's docmentation to learn more about forcefeeding: VelocityJS.org/#forcefeeding */\n            function parsePropertyValue(valueData, skipResolvingEasing) {\n              var endValue = undefined,\n                easing = undefined,\n                startValue = undefined;\n\n              /* Handle the array format, which can be structured as one of three potential overloads:\n               A) [ endValue, easing, startValue ], B) [ endValue, easing ], or C) [ endValue, startValue ] */\n              if (Type.isArray(valueData)) {\n                /* endValue is always the first item in the array. Don't bother validating endValue's value now\n                 since the ensuing property cycling logic does that. */\n                endValue = valueData[0];\n\n                /* Two-item array format: If the second item is a number, function, or hex string, treat it as a\n                 start value since easings can only be non-hex strings or arrays. */\n                if ((!Type.isArray(valueData[1]) && /^[\\d-]/.test(valueData[1])) || Type.isFunction(valueData[1]) || CSS.RegEx.isHex.test(valueData[1])) {\n                  startValue = valueData[1];\n                  /* Two or three-item array: If the second item is a non-hex string or an array, treat it as an easing. */\n                } else if ((Type.isString(valueData[1]) && !CSS.RegEx.isHex.test(valueData[1])) || Type.isArray(valueData[1])) {\n                  easing = skipResolvingEasing ? valueData[1] : getEasing(valueData[1], opts.duration);\n\n                  /* Don't bother validating startValue's value now since the ensuing property cycling logic inherently does that. */\n                  if (valueData[2] !== undefined) {\n                    startValue = valueData[2];\n                  }\n                }\n                /* Handle the single-value format. */\n              } else {\n                endValue = valueData;\n              }\n\n              /* Default to the call's easing if a per-property easing type was not defined. */\n              if (!skipResolvingEasing) {\n                easing = easing || opts.easing;\n              }\n\n              /* If functions were passed in as values, pass the function the current element as its context,\n               plus the element's index and the element set's size as arguments. Then, assign the returned value. */\n              if (Type.isFunction(endValue)) {\n                endValue = endValue.call(element, elementsIndex, elementsLength);\n              }\n\n              if (Type.isFunction(startValue)) {\n                startValue = startValue.call(element, elementsIndex, elementsLength);\n              }\n\n              /* Allow startValue to be left as undefined to indicate to the ensuing code that its value was not forcefed. */\n              return [endValue || 0, easing, startValue];\n            }\n\n            /* Cycle through each property in the map, looking for shorthand color properties (e.g. \"color\" as opposed to \"colorRed\"). Inject the corresponding\n             colorRed, colorGreen, and colorBlue RGB component tweens into the propertiesMap (which Velocity understands) and remove the shorthand property. */\n            $.each(propertiesMap, function (property, value) {\n              /* Find shorthand color properties that have been passed a hex string. */\n              if (RegExp(\"^\" + CSS.Lists.colors.join(\"$|^\") + \"$\").test(property)) {\n                /* Parse the value data for each shorthand. */\n                var valueData = parsePropertyValue(value, true),\n                  endValue = valueData[0],\n                  easing = valueData[1],\n                  startValue = valueData[2];\n\n                if (CSS.RegEx.isHex.test(endValue)) {\n                  /* Convert the hex strings into their RGB component arrays. */\n                  var colorComponents = [\"Red\", \"Green\", \"Blue\"],\n                    endValueRGB = CSS.Values.hexToRgb(endValue),\n                    startValueRGB = startValue ? CSS.Values.hexToRgb(startValue) : undefined;\n\n                  /* Inject the RGB component tweens into propertiesMap. */\n                  for (var i = 0; i < colorComponents.length; i++) {\n                    var dataArray = [endValueRGB[i]];\n\n                    if (easing) {\n                      dataArray.push(easing);\n                    }\n\n                    if (startValueRGB !== undefined) {\n                      dataArray.push(startValueRGB[i]);\n                    }\n\n                    propertiesMap[property + colorComponents[i]] = dataArray;\n                  }\n\n                  /* Remove the intermediary shorthand property entry now that we've processed it. */\n                  delete propertiesMap[property];\n                }\n              }\n            });\n\n            /* Create a tween out of each property, and append its associated data to tweensContainer. */\n            for (var property in propertiesMap) {\n\n              /**************************\n               Start Value Sourcing\n               **************************/\n\n              /* Parse out endValue, easing, and startValue from the property's data. */\n              var valueData = parsePropertyValue(propertiesMap[property]),\n                endValue = valueData[0],\n                easing = valueData[1],\n                startValue = valueData[2];\n\n              /* Now that the original property name's format has been used for the parsePropertyValue() lookup above,\n               we force the property to its camelCase styling to normalize it for manipulation. */\n              property = CSS.Names.camelCase(property);\n\n              /* In case this property is a hook, there are circumstances where we will intend to work on the hook's root property and not the hooked subproperty. */\n              var rootProperty = CSS.Hooks.getRoot(property),\n                rootPropertyValue = false;\n\n              /* Other than for the dummy tween property, properties that are not supported by the browser (and do not have an associated normalization) will\n               inherently produce no style changes when set, so they are skipped in order to decrease animation tick overhead.\n               Property support is determined via prefixCheck(), which returns a false flag when no supported is detected. */\n              /* Note: Since SVG elements have some of their properties directly applied as HTML attributes,\n               there is no way to check for their explicit browser support, and so we skip skip this check for them. */\n              if (!Data(element).isSVG && rootProperty !== \"tween\" && CSS.Names.prefixCheck(rootProperty)[1] === false && CSS.Normalizations.registered[rootProperty] === undefined) {\n                if (Velocity.debug) console.log(\"Skipping [\" + rootProperty + \"] due to a lack of browser support.\");\n\n                continue;\n              }\n\n              /* If the display option is being set to a non-\"none\" (e.g. \"block\") and opacity (filter on IE<=8) is being\n               animated to an endValue of non-zero, the user's intention is to fade in from invisible, thus we forcefeed opacity\n               a startValue of 0 if its startValue hasn't already been sourced by value transferring or prior forcefeeding. */\n              if (((opts.display !== undefined && opts.display !== null && opts.display !== \"none\") || (opts.visibility !== undefined && opts.visibility !== \"hidden\")) && /opacity|filter/.test(property) && !startValue && endValue !== 0) {\n                startValue = 0;\n              }\n\n              /* If values have been transferred from the previous Velocity call, extract the endValue and rootPropertyValue\n               for all of the current call's properties that were *also* animated in the previous call. */\n              /* Note: Value transferring can optionally be disabled by the user via the _cacheValues option. */\n              if (opts._cacheValues && lastTweensContainer && lastTweensContainer[property]) {\n                if (startValue === undefined) {\n                  startValue = lastTweensContainer[property].endValue + lastTweensContainer[property].unitType;\n                }\n\n                /* The previous call's rootPropertyValue is extracted from the element's data cache since that's the\n                 instance of rootPropertyValue that gets freshly updated by the tweening process, whereas the rootPropertyValue\n                 attached to the incoming lastTweensContainer is equal to the root property's value prior to any tweening. */\n                rootPropertyValue = Data(element).rootPropertyValueCache[rootProperty];\n                /* If values were not transferred from a previous Velocity call, query the DOM as needed. */\n              } else {\n                /* Handle hooked properties. */\n                if (CSS.Hooks.registered[property]) {\n                  if (startValue === undefined) {\n                    rootPropertyValue = CSS.getPropertyValue(element, rootProperty);\n                    /* GET */\n                    /* Note: The following getPropertyValue() call does not actually trigger a DOM query;\n                     getPropertyValue() will extract the hook from rootPropertyValue. */\n                    startValue = CSS.getPropertyValue(element, property, rootPropertyValue);\n                    /* If startValue is already defined via forcefeeding, do not query the DOM for the root property's value;\n                     just grab rootProperty's zero-value template from CSS.Hooks. This overwrites the element's actual\n                     root property value (if one is set), but this is acceptable since the primary reason users forcefeed is\n                     to avoid DOM queries, and thus we likewise avoid querying the DOM for the root property's value. */\n                  } else {\n                    /* Grab this hook's zero-value template, e.g. \"0px 0px 0px black\". */\n                    rootPropertyValue = CSS.Hooks.templates[rootProperty][1];\n                  }\n                  /* Handle non-hooked properties that haven't already been defined via forcefeeding. */\n                } else if (startValue === undefined) {\n                  startValue = CSS.getPropertyValue(element, property);\n                  /* GET */\n                }\n              }\n\n              /**************************\n               Value Data Extraction\n               **************************/\n\n              var separatedValue,\n                endValueUnitType,\n                startValueUnitType,\n                operator = false;\n\n              /* Separates a property value into its numeric value and its unit type. */\n              function separateValue(property, value) {\n                var unitType,\n                  numericValue;\n\n                numericValue = (value || \"0\")\n                  .toString()\n                  .toLowerCase()\n                  /* Match the unit type at the end of the value. */\n                  .replace(/[%A-z]+$/, function (match) {\n                    /* Grab the unit type. */\n                    unitType = match;\n\n                    /* Strip the unit type off of value. */\n                    return \"\";\n                  });\n\n                /* If no unit type was supplied, assign one that is appropriate for this property (e.g. \"deg\" for rotateZ or \"px\" for width). */\n                if (!unitType) {\n                  unitType = CSS.Values.getUnitType(property);\n                }\n\n                return [numericValue, unitType];\n              }\n\n              /* Separate startValue. */\n              separatedValue = separateValue(property, startValue);\n              startValue = separatedValue[0];\n              startValueUnitType = separatedValue[1];\n\n              /* Separate endValue, and extract a value operator (e.g. \"+=\", \"-=\") if one exists. */\n              separatedValue = separateValue(property, endValue);\n              endValue = separatedValue[0].replace(/^([+-\\/*])=/, function (match, subMatch) {\n                operator = subMatch;\n\n                /* Strip the operator off of the value. */\n                return \"\";\n              });\n              endValueUnitType = separatedValue[1];\n\n              /* Parse float values from endValue and startValue. Default to 0 if NaN is returned. */\n              startValue = parseFloat(startValue) || 0;\n              endValue = parseFloat(endValue) || 0;\n\n              /***************************************\n               Property-Specific Value Conversion\n               ***************************************/\n\n              /* Custom support for properties that don't actually accept the % unit type, but where pollyfilling is trivial and relatively foolproof. */\n              if (endValueUnitType === \"%\") {\n                /* A %-value fontSize/lineHeight is relative to the parent's fontSize (as opposed to the parent's dimensions),\n                 which is identical to the em unit's behavior, so we piggyback off of that. */\n                if (/^(fontSize|lineHeight)$/.test(property)) {\n                  /* Convert % into an em decimal value. */\n                  endValue = endValue / 100;\n                  endValueUnitType = \"em\";\n                  /* For scaleX and scaleY, convert the value into its decimal format and strip off the unit type. */\n                } else if (/^scale/.test(property)) {\n                  endValue = endValue / 100;\n                  endValueUnitType = \"\";\n                  /* For RGB components, take the defined percentage of 255 and strip off the unit type. */\n                } else if (/(Red|Green|Blue)$/i.test(property)) {\n                  endValue = (endValue / 100) * 255;\n                  endValueUnitType = \"\";\n                }\n              }\n\n              /***************************\n               Unit Ratio Calculation\n               ***************************/\n\n              /* When queried, the browser returns (most) CSS property values in pixels. Therefore, if an endValue with a unit type of\n               %, em, or rem is animated toward, startValue must be converted from pixels into the same unit type as endValue in order\n               for value manipulation logic (increment/decrement) to proceed. Further, if the startValue was forcefed or transferred\n               from a previous call, startValue may also not be in pixels. Unit conversion logic therefore consists of two steps:\n               1) Calculating the ratio of %/em/rem/vh/vw relative to pixels\n               2) Converting startValue into the same unit of measurement as endValue based on these ratios. */\n              /* Unit conversion ratios are calculated by inserting a sibling node next to the target node, copying over its position property,\n               setting values with the target unit type then comparing the returned pixel value. */\n              /* Note: Even if only one of these unit types is being animated, all unit ratios are calculated at once since the overhead\n               of batching the SETs and GETs together upfront outweights the potential overhead\n               of layout thrashing caused by re-querying for uncalculated ratios for subsequently-processed properties. */\n              /* Todo: Shift this logic into the calls' first tick instance so that it's synced with RAF. */\n              function calculateUnitRatios() {\n\n                /************************\n                 Same Ratio Checks\n                 ************************/\n\n                /* The properties below are used to determine whether the element differs sufficiently from this call's\n                 previously iterated element to also differ in its unit conversion ratios. If the properties match up with those\n                 of the prior element, the prior element's conversion ratios are used. Like most optimizations in Velocity,\n                 this is done to minimize DOM querying. */\n                var sameRatioIndicators = {\n                    myParent: element.parentNode || document.body, /* GET */\n                    position: CSS.getPropertyValue(element, \"position\"), /* GET */\n                    fontSize: CSS.getPropertyValue(element, \"fontSize\") /* GET */\n                  },\n                /* Determine if the same % ratio can be used. % is based on the element's position value and its parent's width and height dimensions. */\n                  samePercentRatio = ((sameRatioIndicators.position === callUnitConversionData.lastPosition) && (sameRatioIndicators.myParent === callUnitConversionData.lastParent)),\n                /* Determine if the same em ratio can be used. em is relative to the element's fontSize. */\n                  sameEmRatio = (sameRatioIndicators.fontSize === callUnitConversionData.lastFontSize);\n\n                /* Store these ratio indicators call-wide for the next element to compare against. */\n                callUnitConversionData.lastParent = sameRatioIndicators.myParent;\n                callUnitConversionData.lastPosition = sameRatioIndicators.position;\n                callUnitConversionData.lastFontSize = sameRatioIndicators.fontSize;\n\n                /***************************\n                 Element-Specific Units\n                 ***************************/\n\n                /* Note: IE8 rounds to the nearest pixel when returning CSS values, thus we perform conversions using a measurement\n                 of 100 (instead of 1) to give our ratios a precision of at least 2 decimal values. */\n                var measurement = 100,\n                  unitRatios = {};\n\n                if (!sameEmRatio || !samePercentRatio) {\n                  var dummy = Data(element).isSVG ? document.createElementNS(\"http://www.w3.org/2000/svg\", \"rect\") : document.createElement(\"div\");\n\n                  Velocity.init(dummy);\n                  sameRatioIndicators.myParent.appendChild(dummy);\n\n                  /* To accurately and consistently calculate conversion ratios, the element's cascaded overflow and box-sizing are stripped.\n                   Similarly, since width/height can be artificially constrained by their min-/max- equivalents, these are controlled for as well. */\n                  /* Note: Overflow must be also be controlled for per-axis since the overflow property overwrites its per-axis values. */\n                  $.each([\"overflow\", \"overflowX\", \"overflowY\"], function (i, property) {\n                    Velocity.CSS.setPropertyValue(dummy, property, \"hidden\");\n                  });\n                  Velocity.CSS.setPropertyValue(dummy, \"position\", sameRatioIndicators.position);\n                  Velocity.CSS.setPropertyValue(dummy, \"fontSize\", sameRatioIndicators.fontSize);\n                  Velocity.CSS.setPropertyValue(dummy, \"boxSizing\", \"content-box\");\n\n                  /* width and height act as our proxy properties for measuring the horizontal and vertical % ratios. */\n                  $.each([\"minWidth\", \"maxWidth\", \"width\", \"minHeight\", \"maxHeight\", \"height\"], function (i, property) {\n                    Velocity.CSS.setPropertyValue(dummy, property, measurement + \"%\");\n                  });\n                  /* paddingLeft arbitrarily acts as our proxy property for the em ratio. */\n                  Velocity.CSS.setPropertyValue(dummy, \"paddingLeft\", measurement + \"em\");\n\n                  /* Divide the returned value by the measurement to get the ratio between 1% and 1px. Default to 1 since working with 0 can produce Infinite. */\n                  unitRatios.percentToPxWidth = callUnitConversionData.lastPercentToPxWidth = (parseFloat(CSS.getPropertyValue(dummy, \"width\", null, true)) || 1) / measurement;\n                  /* GET */\n                  unitRatios.percentToPxHeight = callUnitConversionData.lastPercentToPxHeight = (parseFloat(CSS.getPropertyValue(dummy, \"height\", null, true)) || 1) / measurement;\n                  /* GET */\n                  unitRatios.emToPx = callUnitConversionData.lastEmToPx = (parseFloat(CSS.getPropertyValue(dummy, \"paddingLeft\")) || 1) / measurement;\n                  /* GET */\n\n                  sameRatioIndicators.myParent.removeChild(dummy);\n                } else {\n                  unitRatios.emToPx = callUnitConversionData.lastEmToPx;\n                  unitRatios.percentToPxWidth = callUnitConversionData.lastPercentToPxWidth;\n                  unitRatios.percentToPxHeight = callUnitConversionData.lastPercentToPxHeight;\n                }\n\n                /***************************\n                 Element-Agnostic Units\n                 ***************************/\n\n                /* Whereas % and em ratios are determined on a per-element basis, the rem unit only needs to be checked\n                 once per call since it's exclusively dependant upon document.body's fontSize. If this is the first time\n                 that calculateUnitRatios() is being run during this call, remToPx will still be set to its default value of null,\n                 so we calculate it now. */\n                if (callUnitConversionData.remToPx === null) {\n                  /* Default to browsers' default fontSize of 16px in the case of 0. */\n                  callUnitConversionData.remToPx = parseFloat(CSS.getPropertyValue(document.body, \"fontSize\")) || 16;\n                  /* GET */\n                }\n\n                /* Similarly, viewport units are %-relative to the window's inner dimensions. */\n                if (callUnitConversionData.vwToPx === null) {\n                  callUnitConversionData.vwToPx = parseFloat(window.innerWidth) / 100;\n                  /* GET */\n                  callUnitConversionData.vhToPx = parseFloat(window.innerHeight) / 100;\n                  /* GET */\n                }\n\n                unitRatios.remToPx = callUnitConversionData.remToPx;\n                unitRatios.vwToPx = callUnitConversionData.vwToPx;\n                unitRatios.vhToPx = callUnitConversionData.vhToPx;\n\n                if (Velocity.debug >= 1) console.log(\"Unit ratios: \" + JSON.stringify(unitRatios), element);\n\n                return unitRatios;\n              }\n\n              /********************\n               Unit Conversion\n               ********************/\n\n              /* The * and / operators, which are not passed in with an associated unit, inherently use startValue's unit. Skip value and unit conversion. */\n              if (/[\\/*]/.test(operator)) {\n                endValueUnitType = startValueUnitType;\n                /* If startValue and endValue differ in unit type, convert startValue into the same unit type as endValue so that if endValueUnitType\n                 is a relative unit (%, em, rem), the values set during tweening will continue to be accurately relative even if the metrics they depend\n                 on are dynamically changing during the course of the animation. Conversely, if we always normalized into px and used px for setting values, the px ratio\n                 would become stale if the original unit being animated toward was relative and the underlying metrics change during the animation. */\n                /* Since 0 is 0 in any unit type, no conversion is necessary when startValue is 0 -- we just start at 0 with endValueUnitType. */\n              } else if ((startValueUnitType !== endValueUnitType) && startValue !== 0) {\n                /* Unit conversion is also skipped when endValue is 0, but *startValueUnitType* must be used for tween values to remain accurate. */\n                /* Note: Skipping unit conversion here means that if endValueUnitType was originally a relative unit, the animation won't relatively\n                 match the underlying metrics if they change, but this is acceptable since we're animating toward invisibility instead of toward visibility,\n                 which remains past the point of the animation's completion. */\n                if (endValue === 0) {\n                  endValueUnitType = startValueUnitType;\n                } else {\n                  /* By this point, we cannot avoid unit conversion (it's undesirable since it causes layout thrashing).\n                   If we haven't already, we trigger calculateUnitRatios(), which runs once per element per call. */\n                  elementUnitConversionData = elementUnitConversionData || calculateUnitRatios();\n\n                  /* The following RegEx matches CSS properties that have their % values measured relative to the x-axis. */\n                  /* Note: W3C spec mandates that all of margin and padding's properties (even top and bottom) are %-relative to the *width* of the parent element. */\n                  var axis = (/margin|padding|left|right|width|text|word|letter/i.test(property) || /X$/.test(property) || property === \"x\") ? \"x\" : \"y\";\n\n                  /* In order to avoid generating n^2 bespoke conversion functions, unit conversion is a two-step process:\n                   1) Convert startValue into pixels. 2) Convert this new pixel value into endValue's unit type. */\n                  switch (startValueUnitType) {\n                    case \"%\":\n                      /* Note: translateX and translateY are the only properties that are %-relative to an element's own dimensions -- not its parent's dimensions.\n                       Velocity does not include a special conversion process to account for this behavior. Therefore, animating translateX/Y from a % value\n                       to a non-% value will produce an incorrect start value. Fortunately, this sort of cross-unit conversion is rarely done by users in practice. */\n                      startValue *= (axis === \"x\" ? elementUnitConversionData.percentToPxWidth : elementUnitConversionData.percentToPxHeight);\n                      break;\n\n                    case \"px\":\n                      /* px acts as our midpoint in the unit conversion process; do nothing. */\n                      break;\n\n                    default:\n                      startValue *= elementUnitConversionData[startValueUnitType + \"ToPx\"];\n                  }\n\n                  /* Invert the px ratios to convert into to the target unit. */\n                  switch (endValueUnitType) {\n                    case \"%\":\n                      startValue *= 1 / (axis === \"x\" ? elementUnitConversionData.percentToPxWidth : elementUnitConversionData.percentToPxHeight);\n                      break;\n\n                    case \"px\":\n                      /* startValue is already in px, do nothing; we're done. */\n                      break;\n\n                    default:\n                      startValue *= 1 / elementUnitConversionData[endValueUnitType + \"ToPx\"];\n                  }\n                }\n              }\n\n              /*********************\n               Relative Values\n               *********************/\n\n              /* Operator logic must be performed last since it requires unit-normalized start and end values. */\n              /* Note: Relative *percent values* do not behave how most people think; while one would expect \"+=50%\"\n               to increase the property 1.5x its current value, it in fact increases the percent units in absolute terms:\n               50 points is added on top of the current % value. */\n              switch (operator) {\n                case \"+\":\n                  endValue = startValue + endValue;\n                  break;\n\n                case \"-\":\n                  endValue = startValue - endValue;\n                  break;\n\n                case \"*\":\n                  endValue = startValue * endValue;\n                  break;\n\n                case \"/\":\n                  endValue = startValue / endValue;\n                  break;\n              }\n\n              /**************************\n               tweensContainer Push\n               **************************/\n\n              /* Construct the per-property tween object, and push it to the element's tweensContainer. */\n              tweensContainer[property] = {\n                rootPropertyValue: rootPropertyValue,\n                startValue: startValue,\n                currentValue: startValue,\n                endValue: endValue,\n                unitType: endValueUnitType,\n                easing: easing\n              };\n\n              if (Velocity.debug) console.log(\"tweensContainer (\" + property + \"): \" + JSON.stringify(tweensContainer[property]), element);\n            }\n\n            /* Along with its property data, store a reference to the element itself onto tweensContainer. */\n            tweensContainer.element = element;\n          }\n\n          /*****************\n           Call Push\n           *****************/\n\n          /* Note: tweensContainer can be empty if all of the properties in this call's property map were skipped due to not\n           being supported by the browser. The element property is used for checking that the tweensContainer has been appended to. */\n          if (tweensContainer.element) {\n            /* Apply the \"velocity-animating\" indicator class. */\n            CSS.Values.addClass(element, \"velocity-animating\");\n\n            /* The call array houses the tweensContainers for each element being animated in the current call. */\n            call.push(tweensContainer);\n\n            /* Store the tweensContainer and options if we're working on the default effects queue, so that they can be used by the reverse command. */\n            if (opts.queue === \"\") {\n              Data(element).tweensContainer = tweensContainer;\n              Data(element).opts = opts;\n            }\n\n            /* Switch on the element's animating flag. */\n            Data(element).isAnimating = true;\n\n            /* Once the final element in this call's element set has been processed, push the call array onto\n             Velocity.State.calls for the animation tick to immediately begin processing. */\n            if (elementsIndex === elementsLength - 1) {\n              /* Add the current call plus its associated metadata (the element set and the call's options) onto the global call container.\n               Anything on this call container is subjected to tick() processing. */\n              Velocity.State.calls.push([call, elements, opts, null, promiseData.resolver]);\n\n              /* If the animation tick isn't running, start it. (Velocity shuts it off when there are no active calls to process.) */\n              if (Velocity.State.isTicking === false) {\n                Velocity.State.isTicking = true;\n\n                /* Start the tick loop. */\n                tick();\n              }\n            } else {\n              elementsIndex++;\n            }\n          }\n        }\n\n        /* When the queue option is set to false, the call skips the element's queue and fires immediately. */\n        if (opts.queue === false) {\n          /* Since this buildQueue call doesn't respect the element's existing queue (which is where a delay option would have been appended),\n           we manually inject the delay property here with an explicit setTimeout. */\n          if (opts.delay) {\n            setTimeout(buildQueue, opts.delay);\n          } else {\n            buildQueue();\n          }\n          /* Otherwise, the call undergoes element queueing as normal. */\n          /* Note: To interoperate with jQuery, Velocity uses jQuery's own $.queue() stack for queuing logic. */\n        } else {\n          $.queue(element, opts.queue, function (next, clearQueue) {\n            /* If the clearQueue flag was passed in by the stop command, resolve this call's promise. (Promises can only be resolved once,\n             so it's fine if this is repeatedly triggered for each element in the associated call.) */\n            if (clearQueue === true) {\n              if (promiseData.promise) {\n                promiseData.resolver(elements);\n              }\n\n              /* Do not continue with animation queueing. */\n              return true;\n            }\n\n            /* This flag indicates to the upcoming completeCall() function that this queue entry was initiated by Velocity.\n             See completeCall() for further details. */\n            Velocity.velocityQueueEntryFlag = true;\n\n            buildQueue(next);\n          });\n        }\n\n        /*********************\n         Auto-Dequeuing\n         *********************/\n\n        /* As per jQuery's $.queue() behavior, to fire the first non-custom-queue entry on an element, the element\n         must be dequeued if its queue stack consists *solely* of the current call. (This can be determined by checking\n         for the \"inprogress\" item that jQuery prepends to active queue stack arrays.) Regardless, whenever the element's\n         queue is further appended with additional items -- including $.delay()'s or even $.animate() calls, the queue's\n         first entry is automatically fired. This behavior contrasts that of custom queues, which never auto-fire. */\n        /* Note: When an element set is being subjected to a non-parallel Velocity call, the animation will not begin until\n         each one of the elements in the set has reached the end of its individually pre-existing queue chain. */\n        /* Note: Unfortunately, most people don't fully grasp jQuery's powerful, yet quirky, $.queue() function.\n         Lean more here: http://stackoverflow.com/questions/1058158/can-somebody-explain-jquery-queue-to-me */\n        if ((opts.queue === \"\" || opts.queue === \"fx\") && $.queue(element)[0] !== \"inprogress\") {\n          $.dequeue(element);\n        }\n      }\n\n      /**************************\n       Element Set Iteration\n       **************************/\n\n      /* If the \"nodeType\" property exists on the elements variable, we're animating a single element.\n       Place it in an array so that $.each() can iterate over it. */\n      $.each(elements, function (i, element) {\n        /* Ensure each element in a set has a nodeType (is a real element) to avoid throwing errors. */\n        if (Type.isNode(element)) {\n          processElement.call(element);\n        }\n      });\n\n      /******************\n       Option: Loop\n       ******************/\n\n      /* The loop option accepts an integer indicating how many times the element should loop between the values in the\n       current call's properties map and the element's property values prior to this call. */\n      /* Note: The loop option's logic is performed here -- after element processing -- because the current call needs\n       to undergo its queue insertion prior to the loop option generating its series of constituent \"reverse\" calls,\n       which chain after the current call. Two reverse calls (two \"alternations\") constitute one loop. */\n      var opts = $.extend({}, Velocity.defaults, options),\n        reverseCallsCount;\n\n      opts.loop = parseInt(opts.loop);\n      reverseCallsCount = (opts.loop * 2) - 1;\n\n      if (opts.loop) {\n        /* Double the loop count to convert it into its appropriate number of \"reverse\" calls.\n         Subtract 1 from the resulting value since the current call is included in the total alternation count. */\n        for (var x = 0; x < reverseCallsCount; x++) {\n          /* Since the logic for the reverse action occurs inside Queueing and therefore this call's options object\n           isn't parsed until then as well, the current call's delay option must be explicitly passed into the reverse\n           call so that the delay logic that occurs inside *Pre-Queueing* can process it. */\n          var reverseOptions = {\n            delay: opts.delay,\n            progress: opts.progress\n          };\n\n          /* If a complete callback was passed into this call, transfer it to the loop redirect's final \"reverse\" call\n           so that it's triggered when the entire redirect is complete (and not when the very first animation is complete). */\n          if (x === reverseCallsCount - 1) {\n            reverseOptions.display = opts.display;\n            reverseOptions.visibility = opts.visibility;\n            reverseOptions.complete = opts.complete;\n          }\n\n          animate(elements, \"reverse\", reverseOptions);\n        }\n      }\n\n      /***************\n       Chaining\n       ***************/\n\n      /* Return the elements back to the call chain, with wrapped elements taking precedence in case Velocity was called via the $.fn. extension. */\n      return getChain();\n    };\n\n    /* Turn Velocity into the animation function, extended with the pre-existing Velocity object. */\n    Velocity = $.extend(animate, Velocity);\n    /* For legacy support, also expose the literal animate method. */\n    Velocity.animate = animate;\n\n    /**************\n     Timing\n     **************/\n\n    /* Ticker function. */\n    var ticker = window.requestAnimationFrame || rAFShim;\n\n    /* Inactive browser tabs pause rAF, which results in all active animations immediately sprinting to their completion states when the tab refocuses.\n     To get around this, we dynamically switch rAF to setTimeout (which the browser *doesn't* pause) when the tab loses focus. We skip this for mobile\n     devices to avoid wasting battery power on inactive tabs. */\n    /* Note: Tab focus detection doesn't work on older versions of IE, but that's okay since they don't support rAF to begin with. */\n    if (!Velocity.State.isMobile && document.hidden !== undefined) {\n      document.addEventListener(\"visibilitychange\", function () {\n        /* Reassign the rAF function (which the global tick() function uses) based on the tab's focus state. */\n        if (document.hidden) {\n          ticker = function (callback) {\n            /* The tick function needs a truthy first argument in order to pass its internal timestamp check. */\n            return setTimeout(function () {\n              callback(true)\n            }, 16);\n          };\n\n          /* The rAF loop has been paused by the browser, so we manually restart the tick. */\n          tick();\n        } else {\n          ticker = window.requestAnimationFrame || rAFShim;\n        }\n      });\n    }\n\n    /************\n     Tick\n     ************/\n\n    /* Note: All calls to Velocity are pushed to the Velocity.State.calls array, which is fully iterated through upon each tick. */\n    function tick(timestamp) {\n      /* An empty timestamp argument indicates that this is the first tick occurence since ticking was turned on.\n       We leverage this metadata to fully ignore the first tick pass since RAF's initial pass is fired whenever\n       the browser's next tick sync time occurs, which results in the first elements subjected to Velocity\n       calls being animated out of sync with any elements animated immediately thereafter. In short, we ignore\n       the first RAF tick pass so that elements being immediately consecutively animated -- instead of simultaneously animated\n       by the same Velocity call -- are properly batched into the same initial RAF tick and consequently remain in sync thereafter. */\n      if (timestamp) {\n        /* We ignore RAF's high resolution timestamp since it can be significantly offset when the browser is\n         under high stress; we opt for choppiness over allowing the browser to drop huge chunks of frames. */\n        var timeCurrent = (new Date).getTime();\n\n        /********************\n         Call Iteration\n         ********************/\n\n        var callsLength = Velocity.State.calls.length;\n\n        /* To speed up iterating over this array, it is compacted (falsey items -- calls that have completed -- are removed)\n         when its length has ballooned to a point that can impact tick performance. This only becomes necessary when animation\n         has been continuous with many elements over a long period of time; whenever all active calls are completed, completeCall() clears Velocity.State.calls. */\n        if (callsLength > 10000) {\n          Velocity.State.calls = compactSparseArray(Velocity.State.calls);\n        }\n\n        /* Iterate through each active call. */\n        for (var i = 0; i < callsLength; i++) {\n          /* When a Velocity call is completed, its Velocity.State.calls entry is set to false. Continue on to the next call. */\n          if (!Velocity.State.calls[i]) {\n            continue;\n          }\n\n          /************************\n           Call-Wide Variables\n           ************************/\n\n          var callContainer = Velocity.State.calls[i],\n            call = callContainer[0],\n            opts = callContainer[2],\n            timeStart = callContainer[3],\n            firstTick = !!timeStart,\n            tweenDummyValue = null;\n\n          /* If timeStart is undefined, then this is the first time that this call has been processed by tick().\n           We assign timeStart now so that its value is as close to the real animation start time as possible.\n           (Conversely, had timeStart been defined when this call was added to Velocity.State.calls, the delay\n           between that time and now would cause the first few frames of the tween to be skipped since\n           percentComplete is calculated relative to timeStart.) */\n          /* Further, subtract 16ms (the approximate resolution of RAF) from the current time value so that the\n           first tick iteration isn't wasted by animating at 0% tween completion, which would produce the\n           same style value as the element's current value. */\n          if (!timeStart) {\n            timeStart = Velocity.State.calls[i][3] = timeCurrent - 16;\n          }\n\n          /* The tween's completion percentage is relative to the tween's start time, not the tween's start value\n           (which would result in unpredictable tween durations since JavaScript's timers are not particularly accurate).\n           Accordingly, we ensure that percentComplete does not exceed 1. */\n          var percentComplete = Math.min((timeCurrent - timeStart) / opts.duration, 1);\n\n          /**********************\n           Element Iteration\n           **********************/\n\n          /* For every call, iterate through each of the elements in its set. */\n          for (var j = 0, callLength = call.length; j < callLength; j++) {\n            var tweensContainer = call[j],\n              element = tweensContainer.element;\n\n            /* Check to see if this element has been deleted midway through the animation by checking for the\n             continued existence of its data cache. If it's gone, skip animating this element. */\n            if (!Data(element)) {\n              continue;\n            }\n\n            var transformPropertyExists = false;\n\n            /**********************************\n             Display & Visibility Toggling\n             **********************************/\n\n            /* If the display option is set to non-\"none\", set it upfront so that the element can become visible before tweening begins.\n             (Otherwise, display's \"none\" value is set in completeCall() once the animation has completed.) */\n            if (opts.display !== undefined && opts.display !== null && opts.display !== \"none\") {\n              if (opts.display === \"flex\") {\n                var flexValues = [\"-webkit-box\", \"-moz-box\", \"-ms-flexbox\", \"-webkit-flex\"];\n\n                $.each(flexValues, function (i, flexValue) {\n                  CSS.setPropertyValue(element, \"display\", flexValue);\n                });\n              }\n\n              CSS.setPropertyValue(element, \"display\", opts.display);\n            }\n\n            /* Same goes with the visibility option, but its \"none\" equivalent is \"hidden\". */\n            if (opts.visibility !== undefined && opts.visibility !== \"hidden\") {\n              CSS.setPropertyValue(element, \"visibility\", opts.visibility);\n            }\n\n            /************************\n             Property Iteration\n             ************************/\n\n            /* For every element, iterate through each property. */\n            for (var property in tweensContainer) {\n              /* Note: In addition to property tween data, tweensContainer contains a reference to its associated element. */\n              if (property !== \"element\") {\n                var tween = tweensContainer[property],\n                  currentValue,\n                /* Easing can either be a pre-genereated function or a string that references a pre-registered easing\n                 on the Velocity.Easings object. In either case, return the appropriate easing *function*. */\n                  easing = Type.isString(tween.easing) ? Velocity.Easings[tween.easing] : tween.easing;\n\n                /******************************\n                 Current Value Calculation\n                 ******************************/\n\n                /* If this is the last tick pass (if we've reached 100% completion for this tween),\n                 ensure that currentValue is explicitly set to its target endValue so that it's not subjected to any rounding. */\n                if (percentComplete === 1) {\n                  currentValue = tween.endValue;\n                  /* Otherwise, calculate currentValue based on the current delta from startValue. */\n                } else {\n                  var tweenDelta = tween.endValue - tween.startValue;\n                  currentValue = tween.startValue + (tweenDelta * easing(percentComplete, opts, tweenDelta));\n\n                  /* If no value change is occurring, don't proceed with DOM updating. */\n                  if (!firstTick && (currentValue === tween.currentValue)) {\n                    continue;\n                  }\n                }\n\n                tween.currentValue = currentValue;\n\n                /* If we're tweening a fake 'tween' property in order to log transition values, update the one-per-call variable so that\n                 it can be passed into the progress callback. */\n                if (property === \"tween\") {\n                  tweenDummyValue = currentValue;\n                } else {\n                  /******************\n                   Hooks: Part I\n                   ******************/\n\n                  /* For hooked properties, the newly-updated rootPropertyValueCache is cached onto the element so that it can be used\n                   for subsequent hooks in this call that are associated with the same root property. If we didn't cache the updated\n                   rootPropertyValue, each subsequent update to the root property in this tick pass would reset the previous hook's\n                   updates to rootPropertyValue prior to injection. A nice performance byproduct of rootPropertyValue caching is that\n                   subsequently chained animations using the same hookRoot but a different hook can use this cached rootPropertyValue. */\n                  if (CSS.Hooks.registered[property]) {\n                    var hookRoot = CSS.Hooks.getRoot(property),\n                      rootPropertyValueCache = Data(element).rootPropertyValueCache[hookRoot];\n\n                    if (rootPropertyValueCache) {\n                      tween.rootPropertyValue = rootPropertyValueCache;\n                    }\n                  }\n\n                  /*****************\n                   DOM Update\n                   *****************/\n\n                  /* setPropertyValue() returns an array of the property name and property value post any normalization that may have been performed. */\n                  /* Note: To solve an IE<=8 positioning bug, the unit type is dropped when setting a property value of 0. */\n                  var adjustedSetData = CSS.setPropertyValue(element, /* SET */\n                    property,\n                    tween.currentValue + (parseFloat(currentValue) === 0 ? \"\" : tween.unitType),\n                    tween.rootPropertyValue,\n                    tween.scrollData);\n\n                  /*******************\n                   Hooks: Part II\n                   *******************/\n\n                  /* Now that we have the hook's updated rootPropertyValue (the post-processed value provided by adjustedSetData), cache it onto the element. */\n                  if (CSS.Hooks.registered[property]) {\n                    /* Since adjustedSetData contains normalized data ready for DOM updating, the rootPropertyValue needs to be re-extracted from its normalized form. ?? */\n                    if (CSS.Normalizations.registered[hookRoot]) {\n                      Data(element).rootPropertyValueCache[hookRoot] = CSS.Normalizations.registered[hookRoot](\"extract\", null, adjustedSetData[1]);\n                    } else {\n                      Data(element).rootPropertyValueCache[hookRoot] = adjustedSetData[1];\n                    }\n                  }\n\n                  /***************\n                   Transforms\n                   ***************/\n\n                  /* Flag whether a transform property is being animated so that flushTransformCache() can be triggered once this tick pass is complete. */\n                  if (adjustedSetData[0] === \"transform\") {\n                    transformPropertyExists = true;\n                  }\n\n                }\n              }\n            }\n\n            /****************\n             mobileHA\n             ****************/\n\n            /* If mobileHA is enabled, set the translate3d transform to null to force hardware acceleration.\n             It's safe to override this property since Velocity doesn't actually support its animation (hooks are used in its place). */\n            if (opts.mobileHA) {\n              /* Don't set the null transform hack if we've already done so. */\n              if (Data(element).transformCache.translate3d === undefined) {\n                /* All entries on the transformCache object are later concatenated into a single transform string via flushTransformCache(). */\n                Data(element).transformCache.translate3d = \"(0px, 0px, 0px)\";\n\n                transformPropertyExists = true;\n              }\n            }\n\n            if (transformPropertyExists) {\n              CSS.flushTransformCache(element);\n            }\n          }\n\n          /* The non-\"none\" display value is only applied to an element once -- when its associated call is first ticked through.\n           Accordingly, it's set to false so that it isn't re-processed by this call in the next tick. */\n          if (opts.display !== undefined && opts.display !== \"none\") {\n            Velocity.State.calls[i][2].display = false;\n          }\n          if (opts.visibility !== undefined && opts.visibility !== \"hidden\") {\n            Velocity.State.calls[i][2].visibility = false;\n          }\n\n          /* Pass the elements and the timing data (percentComplete, msRemaining, timeStart, tweenDummyValue) into the progress callback. */\n          if (opts.progress) {\n            opts.progress.call(callContainer[1],\n              callContainer[1],\n              percentComplete,\n              Math.max(0, (timeStart + opts.duration) - timeCurrent),\n              timeStart,\n              tweenDummyValue);\n          }\n\n          /* If this call has finished tweening, pass its index to completeCall() to handle call cleanup. */\n          if (percentComplete === 1) {\n            completeCall(i);\n          }\n        }\n      }\n\n      /* Note: completeCall() sets the isTicking flag to false when the last call on Velocity.State.calls has completed. */\n      if (Velocity.State.isTicking) {\n        ticker(tick);\n      }\n    }\n\n    /**********************\n     Call Completion\n     **********************/\n\n    /* Note: Unlike tick(), which processes all active calls at once, call completion is handled on a per-call basis. */\n    function completeCall(callIndex, isStopped) {\n      /* Ensure the call exists. */\n      if (!Velocity.State.calls[callIndex]) {\n        return false;\n      }\n\n      /* Pull the metadata from the call. */\n      var call = Velocity.State.calls[callIndex][0],\n        elements = Velocity.State.calls[callIndex][1],\n        opts = Velocity.State.calls[callIndex][2],\n        resolver = Velocity.State.calls[callIndex][4];\n\n      var remainingCallsExist = false;\n\n      /*************************\n       Element Finalization\n       *************************/\n\n      for (var i = 0, callLength = call.length; i < callLength; i++) {\n        var element = call[i].element;\n\n        /* If the user set display to \"none\" (intending to hide the element), set it now that the animation has completed. */\n        /* Note: display:none isn't set when calls are manually stopped (via Velocity(\"stop\"). */\n        /* Note: Display gets ignored with \"reverse\" calls and infinite loops, since this behavior would be undesirable. */\n        if (!isStopped && !opts.loop) {\n          if (opts.display === \"none\") {\n            CSS.setPropertyValue(element, \"display\", opts.display);\n          }\n\n          if (opts.visibility === \"hidden\") {\n            CSS.setPropertyValue(element, \"visibility\", opts.visibility);\n          }\n        }\n\n        /* If the element's queue is empty (if only the \"inprogress\" item is left at position 0) or if its queue is about to run\n         a non-Velocity-initiated entry, turn off the isAnimating flag. A non-Velocity-initiatied queue entry's logic might alter\n         an element's CSS values and thereby cause Velocity's cached value data to go stale. To detect if a queue entry was initiated by Velocity,\n         we check for the existence of our special Velocity.queueEntryFlag declaration, which minifiers won't rename since the flag\n         is assigned to jQuery's global $ object and thus exists out of Velocity's own scope. */\n        if (opts.loop !== true && ($.queue(element)[1] === undefined || !/\\.velocityQueueEntryFlag/i.test($.queue(element)[1]))) {\n          /* The element may have been deleted. Ensure that its data cache still exists before acting on it. */\n          if (Data(element)) {\n            Data(element).isAnimating = false;\n            /* Clear the element's rootPropertyValueCache, which will become stale. */\n            Data(element).rootPropertyValueCache = {};\n\n            var transformHAPropertyExists = false;\n            /* If any 3D transform subproperty is at its default value (regardless of unit type), remove it. */\n            $.each(CSS.Lists.transforms3D, function (i, transformName) {\n              var defaultValue = /^scale/.test(transformName) ? 1 : 0,\n                currentValue = Data(element).transformCache[transformName];\n\n              if (Data(element).transformCache[transformName] !== undefined && new RegExp(\"^\\\\(\" + defaultValue + \"[^.]\").test(currentValue)) {\n                transformHAPropertyExists = true;\n\n                delete Data(element).transformCache[transformName];\n              }\n            });\n\n            /* Mobile devices have hardware acceleration removed at the end of the animation in order to avoid hogging the GPU's memory. */\n            if (opts.mobileHA) {\n              transformHAPropertyExists = true;\n              delete Data(element).transformCache.translate3d;\n            }\n\n            /* Flush the subproperty removals to the DOM. */\n            if (transformHAPropertyExists) {\n              CSS.flushTransformCache(element);\n            }\n\n            /* Remove the \"velocity-animating\" indicator class. */\n            CSS.Values.removeClass(element, \"velocity-animating\");\n          }\n        }\n\n        /*********************\n         Option: Complete\n         *********************/\n\n        /* Complete is fired once per call (not once per element) and is passed the full raw DOM element set as both its context and its first argument. */\n        /* Note: Callbacks aren't fired when calls are manually stopped (via Velocity(\"stop\"). */\n        if (!isStopped && opts.complete && !opts.loop && (i === callLength - 1)) {\n          /* We throw callbacks in a setTimeout so that thrown errors don't halt the execution of Velocity itself. */\n          try {\n            opts.complete.call(elements, elements);\n          } catch (error) {\n            setTimeout(function () {\n              throw error;\n            }, 1);\n          }\n        }\n\n        /**********************\n         Promise Resolving\n         **********************/\n\n        /* Note: Infinite loops don't return promises. */\n        if (resolver && opts.loop !== true) {\n          resolver(elements);\n        }\n\n        /****************************\n         Option: Loop (Infinite)\n         ****************************/\n\n        if (Data(element) && opts.loop === true && !isStopped) {\n          /* If a rotateX/Y/Z property is being animated to 360 deg with loop:true, swap tween start/end values to enable\n           continuous iterative rotation looping. (Otherise, the element would just rotate back and forth.) */\n          $.each(Data(element).tweensContainer, function (propertyName, tweenContainer) {\n            if (/^rotate/.test(propertyName) && parseFloat(tweenContainer.endValue) === 360) {\n              tweenContainer.endValue = 0;\n              tweenContainer.startValue = 360;\n            }\n\n            if (/^backgroundPosition/.test(propertyName) && parseFloat(tweenContainer.endValue) === 100 && tweenContainer.unitType === \"%\") {\n              tweenContainer.endValue = 0;\n              tweenContainer.startValue = 100;\n            }\n          });\n\n          Velocity(element, \"reverse\", {loop: true, delay: opts.delay});\n        }\n\n        /***************\n         Dequeueing\n         ***************/\n\n        /* Fire the next call in the queue so long as this call's queue wasn't set to false (to trigger a parallel animation),\n         which would have already caused the next call to fire. Note: Even if the end of the animation queue has been reached,\n         $.dequeue() must still be called in order to completely clear jQuery's animation queue. */\n        if (opts.queue !== false) {\n          $.dequeue(element, opts.queue);\n        }\n      }\n\n      /************************\n       Calls Array Cleanup\n       ************************/\n\n      /* Since this call is complete, set it to false so that the rAF tick skips it. This array is later compacted via compactSparseArray().\n       (For performance reasons, the call is set to false instead of being deleted from the array: http://www.html5rocks.com/en/tutorials/speed/v8/) */\n      Velocity.State.calls[callIndex] = false;\n\n      /* Iterate through the calls array to determine if this was the final in-progress animation.\n       If so, set a flag to end ticking and clear the calls array. */\n      for (var j = 0, callsLength = Velocity.State.calls.length; j < callsLength; j++) {\n        if (Velocity.State.calls[j] !== false) {\n          remainingCallsExist = true;\n\n          break;\n        }\n      }\n\n      if (remainingCallsExist === false) {\n        /* tick() will detect this flag upon its next iteration and subsequently turn itself off. */\n        Velocity.State.isTicking = false;\n\n        /* Clear the calls array so that its length is reset. */\n        delete Velocity.State.calls;\n        Velocity.State.calls = [];\n      }\n    }\n\n    /******************\n     Frameworks\n     ******************/\n\n    /* Both jQuery and Zepto allow their $.fn object to be extended to allow wrapped elements to be subjected to plugin calls.\n     If either framework is loaded, register a \"velocity\" extension pointing to Velocity's core animate() method.  Velocity\n     also registers itself onto a global container (window.jQuery || window.Zepto || window) so that certain features are\n     accessible beyond just a per-element scope. This master object contains an .animate() method, which is later assigned to $.fn\n     (if jQuery or Zepto are present). Accordingly, Velocity can both act on wrapped DOM elements and stand alone for targeting raw DOM elements. */\n    global.Velocity = Velocity;\n\n    if (global !== window) {\n      /* Assign the element function to Velocity's core animate() method. */\n      global.fn.velocity = animate;\n      /* Assign the object function's defaults to Velocity's global defaults object. */\n      global.fn.velocity.defaults = Velocity.defaults;\n    }\n\n    /***********************\n     Packaged Redirects\n     ***********************/\n\n    /* slideUp, slideDown */\n    $.each([\"Down\", \"Up\"], function (i, direction) {\n      Velocity.Redirects[\"slide\" + direction] = function (element, options, elementsIndex, elementsSize, elements, promiseData) {\n        var opts = $.extend({}, options),\n          begin = opts.begin,\n          complete = opts.complete,\n          computedValues = {height: \"\", marginTop: \"\", marginBottom: \"\", paddingTop: \"\", paddingBottom: \"\"},\n          inlineValues = {};\n\n        if (opts.display === undefined) {\n          /* Show the element before slideDown begins and hide the element after slideUp completes. */\n          /* Note: Inline elements cannot have dimensions animated, so they're reverted to inline-block. */\n          opts.display = (direction === \"Down\" ? (Velocity.CSS.Values.getDisplayType(element) === \"inline\" ? \"inline-block\" : \"block\") : \"none\");\n        }\n\n        opts.begin = function () {\n          /* If the user passed in a begin callback, fire it now. */\n          begin && begin.call(elements, elements);\n\n          /* Cache the elements' original vertical dimensional property values so that we can animate back to them. */\n          for (var property in computedValues) {\n            inlineValues[property] = element.style[property];\n\n            /* For slideDown, use forcefeeding to animate all vertical properties from 0. For slideUp,\n             use forcefeeding to start from computed values and animate down to 0. */\n            var propertyValue = Velocity.CSS.getPropertyValue(element, property);\n            computedValues[property] = (direction === \"Down\") ? [propertyValue, 0] : [0, propertyValue];\n          }\n\n          /* Force vertical overflow content to clip so that sliding works as expected. */\n          inlineValues.overflow = element.style.overflow;\n          element.style.overflow = \"hidden\";\n        }\n\n        opts.complete = function () {\n          /* Reset element to its pre-slide inline values once its slide animation is complete. */\n          for (var property in inlineValues) {\n            element.style[property] = inlineValues[property];\n          }\n\n          /* If the user passed in a complete callback, fire it now. */\n          complete && complete.call(elements, elements);\n          promiseData && promiseData.resolver(elements);\n        };\n\n        Velocity(element, computedValues, opts);\n      };\n    });\n\n    /* fadeIn, fadeOut */\n    $.each([\"In\", \"Out\"], function (i, direction) {\n      Velocity.Redirects[\"fade\" + direction] = function (element, options, elementsIndex, elementsSize, elements, promiseData) {\n        var opts = $.extend({}, options),\n          propertiesMap = {opacity: (direction === \"In\") ? 1 : 0},\n          originalComplete = opts.complete;\n\n        /* Since redirects are triggered individually for each element in the animated set, avoid repeatedly triggering\n         callbacks by firing them only when the final element has been reached. */\n        if (elementsIndex !== elementsSize - 1) {\n          opts.complete = opts.begin = null;\n        } else {\n          opts.complete = function () {\n            if (originalComplete) {\n              originalComplete.call(elements, elements);\n            }\n\n            promiseData && promiseData.resolver(elements);\n          }\n        }\n\n        /* If a display was passed in, use it. Otherwise, default to \"none\" for fadeOut or the element-specific default for fadeIn. */\n        /* Note: We allow users to pass in \"null\" to skip display setting altogether. */\n        if (opts.display === undefined) {\n          opts.display = (direction === \"In\" ? \"auto\" : \"none\");\n        }\n\n        Velocity(this, propertiesMap, opts);\n      };\n    });\n\n    return Velocity;\n  }((window.jQuery || window.Zepto || window), window, document);\n}));\n\n/******************\n Known Issues\n ******************/\n\n/* The CSS spec mandates that the translateX/Y/Z transforms are %-relative to the element itself -- not its parent.\n Velocity, however, doesn't make this distinction. Thus, converting to or from the % unit with these subproperties\n will produce an inaccurate conversion value. The same issue exists with the cx/cy attributes of SVG circles and ellipses. */\n"
  },
  {
    "path": "app/templates/app/src/lib/velocityui.js",
    "content": "/**********************\n Velocity UI Pack\n **********************/\n\n/* VelocityJS.org UI Pack (5.0.4). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License. Portions copyright Daniel Eden, Christian Pucci. */\n\n;\n(function (factory) {\n  /* CommonJS module. */\n  //if (typeof require === \"function\" && typeof exports === \"object\") {\n  //  module.exports = factory();\n  //  /* AMD module. */\n  //} else if (typeof define === \"function\" && define.amd) {\n  //  define([\"velocity\"], factory);\n  //  /* Browser globals. */\n  //} else {\n  factory();\n  //}\n}(function () {\n  return function (global, window, document, undefined) {\n\n    /*************\n     Checks\n     *************/\n\n    if (!global.Velocity || !global.Velocity.Utilities) {\n      window.console && console.log(\"Velocity UI Pack: Velocity must be loaded first. Aborting.\");\n      return;\n    } else {\n      var Velocity = global.Velocity,\n        $ = Velocity.Utilities;\n    }\n\n    var velocityVersion = Velocity.version,\n      requiredVersion = {major: 1, minor: 1, patch: 0};\n\n    function greaterSemver(primary, secondary) {\n      var versionInts = [];\n\n      if (!primary || !secondary) {\n        return false;\n      }\n\n      $.each([primary, secondary], function (i, versionObject) {\n        var versionIntsComponents = [];\n\n        $.each(versionObject, function (component, value) {\n          while (value.toString().length < 5) {\n            value = \"0\" + value;\n          }\n          versionIntsComponents.push(value);\n        });\n\n        versionInts.push(versionIntsComponents.join(\"\"))\n      });\n\n      return (parseFloat(versionInts[0]) > parseFloat(versionInts[1]));\n    }\n\n    if (greaterSemver(requiredVersion, velocityVersion)) {\n      var abortError = \"Velocity UI Pack: You need to update Velocity (jquery.velocity.js) to a newer version. Visit http://github.com/julianshapiro/velocity.\";\n      alert(abortError);\n      throw new Error(abortError);\n    }\n\n    /************************\n     Effect Registration\n     ************************/\n\n    /* Note: RegisterUI is a legacy name. */\n    Velocity.RegisterEffect = Velocity.RegisterUI = function (effectName, properties) {\n      /* Animate the expansion/contraction of the elements' parent's height for In/Out effects. */\n      function animateParentHeight(elements, direction, totalDuration, stagger) {\n        var totalHeightDelta = 0,\n          parentNode;\n\n        /* Sum the total height (including padding and margin) of all targeted elements. */\n        $.each(elements.nodeType ? [elements] : elements, function (i, element) {\n          if (stagger) {\n            /* Increase the totalDuration by the successive delay amounts produced by the stagger option. */\n            totalDuration += i * stagger;\n          }\n\n          parentNode = element.parentNode;\n\n          $.each([\"height\", \"paddingTop\", \"paddingBottom\", \"marginTop\", \"marginBottom\"], function (i, property) {\n            totalHeightDelta += parseFloat(Velocity.CSS.getPropertyValue(element, property));\n          });\n        });\n\n        /* Animate the parent element's height adjustment (with a varying duration multiplier for aesthetic benefits). */\n        Velocity.animate(\n          parentNode,\n          {height: (direction === \"In\" ? \"+\" : \"-\") + \"=\" + totalHeightDelta},\n          {queue: false, easing: \"ease-in-out\", duration: totalDuration * (direction === \"In\" ? 0.6 : 1)}\n        );\n      }\n\n      /* Register a custom redirect for each effect. */\n      Velocity.Redirects[effectName] = function (element, redirectOptions, elementsIndex, elementsSize, elements, promiseData) {\n        var finalElement = (elementsIndex === elementsSize - 1);\n\n        if (typeof properties.defaultDuration === \"function\") {\n          properties.defaultDuration = properties.defaultDuration.call(elements, elements);\n        } else {\n          properties.defaultDuration = parseFloat(properties.defaultDuration);\n        }\n\n        /* Iterate through each effect's call array. */\n        for (var callIndex = 0; callIndex < properties.calls.length; callIndex++) {\n          var call = properties.calls[callIndex],\n            propertyMap = call[0],\n            redirectDuration = (redirectOptions.duration || properties.defaultDuration || 1000),\n            durationPercentage = call[1],\n            callOptions = call[2] || {},\n            opts = {};\n\n          /* Assign the whitelisted per-call options. */\n          opts.duration = redirectDuration * (durationPercentage || 1);\n          opts.queue = redirectOptions.queue || \"\";\n          opts.easing = callOptions.easing || \"ease\";\n          opts.delay = parseFloat(callOptions.delay) || 0;\n          opts._cacheValues = callOptions._cacheValues || true;\n\n          /* Special processing for the first effect call. */\n          if (callIndex === 0) {\n            /* If a delay was passed into the redirect, combine it with the first call's delay. */\n            opts.delay += (parseFloat(redirectOptions.delay) || 0);\n\n            if (elementsIndex === 0) {\n              opts.begin = function () {\n                /* Only trigger a begin callback on the first effect call with the first element in the set. */\n                redirectOptions.begin && redirectOptions.begin.call(elements, elements);\n\n                var direction = effectName.match(/(In|Out)$/);\n\n                /* Make \"in\" transitioning elements invisible immediately so that there's no FOUC between now\n                 and the first RAF tick. */\n                if ((direction && direction[0] === \"In\") && propertyMap.opacity !== undefined) {\n                  $.each(elements.nodeType ? [elements] : elements, function (i, element) {\n                    Velocity.CSS.setPropertyValue(element, \"opacity\", 0);\n                  });\n                }\n\n                /* Only trigger animateParentHeight() if we're using an In/Out transition. */\n                if (redirectOptions.animateParentHeight && direction) {\n                  animateParentHeight(elements, direction[0], redirectDuration + opts.delay, redirectOptions.stagger);\n                }\n              }\n            }\n\n            /* If the user isn't overriding the display option, default to \"auto\" for \"In\"-suffixed transitions. */\n            if (redirectOptions.display !== null) {\n              if (redirectOptions.display !== undefined && redirectOptions.display !== \"none\") {\n                opts.display = redirectOptions.display;\n              } else if (/In$/.test(effectName)) {\n                /* Inline elements cannot be subjected to transforms, so we switch them to inline-block. */\n                var defaultDisplay = Velocity.CSS.Values.getDisplayType(element);\n                opts.display = (defaultDisplay === \"inline\") ? \"inline-block\" : defaultDisplay;\n              }\n            }\n\n            if (redirectOptions.visibility && redirectOptions.visibility !== \"hidden\") {\n              opts.visibility = redirectOptions.visibility;\n            }\n          }\n\n          /* Special processing for the last effect call. */\n          if (callIndex === properties.calls.length - 1) {\n            /* Append promise resolving onto the user's redirect callback. */\n            function injectFinalCallbacks() {\n              if ((redirectOptions.display === undefined || redirectOptions.display === \"none\") && /Out$/.test(effectName)) {\n                $.each(elements.nodeType ? [elements] : elements, function (i, element) {\n                  Velocity.CSS.setPropertyValue(element, \"display\", \"none\");\n                });\n              }\n\n              redirectOptions.complete && redirectOptions.complete.call(elements, elements);\n\n              if (promiseData) {\n                promiseData.resolver(elements || element);\n              }\n            }\n\n            opts.complete = function () {\n              if (properties.reset) {\n                for (var resetProperty in properties.reset) {\n                  var resetValue = properties.reset[resetProperty];\n\n                  /* Format each non-array value in the reset property map to [ value, value ] so that changes apply\n                   immediately and DOM querying is avoided (via forcefeeding). */\n                  /* Note: Don't forcefeed hooks, otherwise their hook roots will be defaulted to their null values. */\n                  if (Velocity.CSS.Hooks.registered[resetProperty] === undefined && (typeof resetValue === \"string\" || typeof resetValue === \"number\")) {\n                    properties.reset[resetProperty] = [properties.reset[resetProperty], properties.reset[resetProperty]];\n                  }\n                }\n\n                /* So that the reset values are applied instantly upon the next rAF tick, use a zero duration and parallel queueing. */\n                var resetOptions = {duration: 0, queue: false};\n\n                /* Since the reset option uses up the complete callback, we trigger the user's complete callback at the end of ours. */\n                if (finalElement) {\n                  resetOptions.complete = injectFinalCallbacks;\n                }\n\n                Velocity.animate(element, properties.reset, resetOptions);\n                /* Only trigger the user's complete callback on the last effect call with the last element in the set. */\n              } else if (finalElement) {\n                injectFinalCallbacks();\n              }\n            };\n\n            if (redirectOptions.visibility === \"hidden\") {\n              opts.visibility = redirectOptions.visibility;\n            }\n          }\n\n          Velocity.animate(element, propertyMap, opts);\n        }\n      };\n\n      /* Return the Velocity object so that RegisterUI calls can be chained. */\n      return Velocity;\n    };\n\n    /*********************\n     Packaged Effects\n     *********************/\n\n    /* Externalize the packagedEffects data so that they can optionally be modified and re-registered. */\n    /* Support: <=IE8: Callouts will have no effect, and transitions will simply fade in/out. IE9/Android 2.3: Most effects are fully supported, the rest fade in/out. All other browsers: full support. */\n    Velocity.RegisterEffect.packagedEffects =\n    {\n      /* Animate.css */\n      \"callout.bounce\": {\n        defaultDuration: 550,\n        calls: [\n          [{translateY: -30}, 0.25],\n          [{translateY: 0}, 0.125],\n          [{translateY: -15}, 0.125],\n          [{translateY: 0}, 0.25]\n        ]\n      },\n      /* Animate.css */\n      \"callout.shake\": {\n        defaultDuration: 800,\n        calls: [\n          [{translateX: -11}, 0.125],\n          [{translateX: 11}, 0.125],\n          [{translateX: -11}, 0.125],\n          [{translateX: 11}, 0.125],\n          [{translateX: -11}, 0.125],\n          [{translateX: 11}, 0.125],\n          [{translateX: -11}, 0.125],\n          [{translateX: 0}, 0.125]\n        ]\n      },\n      /* Animate.css */\n      \"callout.flash\": {\n        defaultDuration: 1100,\n        calls: [\n          [{opacity: [0, \"easeInOutQuad\", 1]}, 0.25],\n          [{opacity: [1, \"easeInOutQuad\"]}, 0.25],\n          [{opacity: [0, \"easeInOutQuad\"]}, 0.25],\n          [{opacity: [1, \"easeInOutQuad\"]}, 0.25]\n        ]\n      },\n      /* Animate.css */\n      \"callout.pulse\": {\n        defaultDuration: 825,\n        calls: [\n          [{scaleX: 1.1, scaleY: 1.1}, 0.50, {easing: \"easeInExpo\"}],\n          [{scaleX: 1, scaleY: 1}, 0.50]\n        ]\n      },\n      /* Animate.css */\n      \"callout.swing\": {\n        defaultDuration: 950,\n        calls: [\n          [{rotateZ: 15}, 0.20],\n          [{rotateZ: -10}, 0.20],\n          [{rotateZ: 5}, 0.20],\n          [{rotateZ: -5}, 0.20],\n          [{rotateZ: 0}, 0.20]\n        ]\n      },\n      /* Animate.css */\n      \"callout.tada\": {\n        defaultDuration: 1000,\n        calls: [\n          [{scaleX: 0.9, scaleY: 0.9, rotateZ: -3}, 0.10],\n          [{scaleX: 1.1, scaleY: 1.1, rotateZ: 3}, 0.10],\n          [{scaleX: 1.1, scaleY: 1.1, rotateZ: -3}, 0.10],\n          [\"reverse\", 0.125],\n          [\"reverse\", 0.125],\n          [\"reverse\", 0.125],\n          [\"reverse\", 0.125],\n          [\"reverse\", 0.125],\n          [{scaleX: 1, scaleY: 1, rotateZ: 0}, 0.20]\n        ]\n      },\n      \"transition.fadeIn\": {\n        defaultDuration: 500,\n        calls: [\n          [{opacity: [1, 0]}]\n        ]\n      },\n      \"transition.fadeOut\": {\n        defaultDuration: 500,\n        calls: [\n          [{opacity: [0, 1]}]\n        ]\n      },\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.flipXIn\": {\n        defaultDuration: 700,\n        calls: [\n          [{opacity: [1, 0], transformPerspective: [800, 800], rotateY: [0, -55]}]\n        ],\n        reset: {transformPerspective: 0}\n      },\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.flipXOut\": {\n        defaultDuration: 700,\n        calls: [\n          [{opacity: [0, 1], transformPerspective: [800, 800], rotateY: 55}]\n        ],\n        reset: {transformPerspective: 0, rotateY: 0}\n      },\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.flipYIn\": {\n        defaultDuration: 800,\n        calls: [\n          [{opacity: [1, 0], transformPerspective: [800, 800], rotateX: [0, -45]}]\n        ],\n        reset: {transformPerspective: 0}\n      },\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.flipYOut\": {\n        defaultDuration: 800,\n        calls: [\n          [{opacity: [0, 1], transformPerspective: [800, 800], rotateX: 25}]\n        ],\n        reset: {transformPerspective: 0, rotateX: 0}\n      },\n      /* Animate.css */\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.flipBounceXIn\": {\n        defaultDuration: 900,\n        calls: [\n          [{opacity: [0.725, 0], transformPerspective: [400, 400], rotateY: [-10, 90]}, 0.50],\n          [{opacity: 0.80, rotateY: 10}, 0.25],\n          [{opacity: 1, rotateY: 0}, 0.25]\n        ],\n        reset: {transformPerspective: 0}\n      },\n      /* Animate.css */\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.flipBounceXOut\": {\n        defaultDuration: 800,\n        calls: [\n          [{opacity: [0.9, 1], transformPerspective: [400, 400], rotateY: -10}, 0.50],\n          [{opacity: 0, rotateY: 90}, 0.50]\n        ],\n        reset: {transformPerspective: 0, rotateY: 0}\n      },\n      /* Animate.css */\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.flipBounceYIn\": {\n        defaultDuration: 850,\n        calls: [\n          [{opacity: [0.725, 0], transformPerspective: [400, 400], rotateX: [-10, 90]}, 0.50],\n          [{opacity: 0.80, rotateX: 10}, 0.25],\n          [{opacity: 1, rotateX: 0}, 0.25]\n        ],\n        reset: {transformPerspective: 0}\n      },\n      /* Animate.css */\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.flipBounceYOut\": {\n        defaultDuration: 800,\n        calls: [\n          [{opacity: [0.9, 1], transformPerspective: [400, 400], rotateX: -15}, 0.50],\n          [{opacity: 0, rotateX: 90}, 0.50]\n        ],\n        reset: {transformPerspective: 0, rotateX: 0}\n      },\n      /* Magic.css */\n      \"transition.swoopIn\": {\n        defaultDuration: 850,\n        calls: [\n          [{\n            opacity: [1, 0],\n            transformOriginX: [\"100%\", \"50%\"],\n            transformOriginY: [\"100%\", \"100%\"],\n            scaleX: [1, 0],\n            scaleY: [1, 0],\n            translateX: [0, -700],\n            translateZ: 0\n          }]\n        ],\n        reset: {transformOriginX: \"50%\", transformOriginY: \"50%\"}\n      },\n      /* Magic.css */\n      \"transition.swoopOut\": {\n        defaultDuration: 850,\n        calls: [\n          [{\n            opacity: [0, 1],\n            transformOriginX: [\"50%\", \"100%\"],\n            transformOriginY: [\"100%\", \"100%\"],\n            scaleX: 0,\n            scaleY: 0,\n            translateX: -700,\n            translateZ: 0\n          }]\n        ],\n        reset: {transformOriginX: \"50%\", transformOriginY: \"50%\", scaleX: 1, scaleY: 1, translateX: 0}\n      },\n      /* Magic.css */\n      /* Support: Loses rotation in IE9/Android 2.3. (Fades and scales only.) */\n      \"transition.whirlIn\": {\n        defaultDuration: 850,\n        calls: [\n          [{\n            opacity: [1, 0],\n            transformOriginX: [\"50%\", \"50%\"],\n            transformOriginY: [\"50%\", \"50%\"],\n            scaleX: [1, 0],\n            scaleY: [1, 0],\n            rotateY: [0, 160]\n          }, 1, {easing: \"easeInOutSine\"}]\n        ]\n      },\n      /* Magic.css */\n      /* Support: Loses rotation in IE9/Android 2.3. (Fades and scales only.) */\n      \"transition.whirlOut\": {\n        defaultDuration: 750,\n        calls: [\n          [{\n            opacity: [0, \"easeInOutQuint\", 1],\n            transformOriginX: [\"50%\", \"50%\"],\n            transformOriginY: [\"50%\", \"50%\"],\n            scaleX: 0,\n            scaleY: 0,\n            rotateY: 160\n          }, 1, {easing: \"swing\"}]\n        ],\n        reset: {scaleX: 1, scaleY: 1, rotateY: 0}\n      },\n      \"transition.shrinkIn\": {\n        defaultDuration: 750,\n        calls: [\n          [{\n            opacity: [1, 0],\n            transformOriginX: [\"50%\", \"50%\"],\n            transformOriginY: [\"50%\", \"50%\"],\n            scaleX: [1, 1.5],\n            scaleY: [1, 1.5],\n            translateZ: 0\n          }]\n        ]\n      },\n      \"transition.shrinkOut\": {\n        defaultDuration: 600,\n        calls: [\n          [{\n            opacity: [0, 1],\n            transformOriginX: [\"50%\", \"50%\"],\n            transformOriginY: [\"50%\", \"50%\"],\n            scaleX: 1.3,\n            scaleY: 1.3,\n            translateZ: 0\n          }]\n        ],\n        reset: {scaleX: 1, scaleY: 1}\n      },\n      \"transition.expandIn\": {\n        defaultDuration: 700,\n        calls: [\n          [{\n            opacity: [1, 0],\n            transformOriginX: [\"50%\", \"50%\"],\n            transformOriginY: [\"50%\", \"50%\"],\n            scaleX: [1, 0.625],\n            scaleY: [1, 0.625],\n            translateZ: 0\n          }]\n        ]\n      },\n      \"transition.expandOut\": {\n        defaultDuration: 700,\n        calls: [\n          [{\n            opacity: [0, 1],\n            transformOriginX: [\"50%\", \"50%\"],\n            transformOriginY: [\"50%\", \"50%\"],\n            scaleX: 0.5,\n            scaleY: 0.5,\n            translateZ: 0\n          }]\n        ],\n        reset: {scaleX: 1, scaleY: 1}\n      },\n      /* Animate.css */\n      \"transition.bounceIn\": {\n        defaultDuration: 800,\n        calls: [\n          [{opacity: [1, 0], scaleX: [1.05, 0.3], scaleY: [1.05, 0.3]}, 0.40],\n          [{scaleX: 0.9, scaleY: 0.9, translateZ: 0}, 0.20],\n          [{scaleX: 1, scaleY: 1}, 0.50]\n        ]\n      },\n      /* Animate.css */\n      \"transition.bounceOut\": {\n        defaultDuration: 800,\n        calls: [\n          [{scaleX: 0.95, scaleY: 0.95}, 0.35],\n          [{scaleX: 1.1, scaleY: 1.1, translateZ: 0}, 0.35],\n          [{opacity: [0, 1], scaleX: 0.3, scaleY: 0.3}, 0.30]\n        ],\n        reset: {scaleX: 1, scaleY: 1}\n      },\n      /* Animate.css */\n      \"transition.bounceUpIn\": {\n        defaultDuration: 800,\n        calls: [\n          [{opacity: [1, 0], translateY: [-30, 1000]}, 0.60, {easing: \"easeOutCirc\"}],\n          [{translateY: 10}, 0.20],\n          [{translateY: 0}, 0.20]\n        ]\n      },\n      /* Animate.css */\n      \"transition.bounceUpOut\": {\n        defaultDuration: 1000,\n        calls: [\n          [{translateY: 20}, 0.20],\n          [{opacity: [0, \"easeInCirc\", 1], translateY: -1000}, 0.80]\n        ],\n        reset: {translateY: 0}\n      },\n      /* Animate.css */\n      \"transition.bounceDownIn\": {\n        defaultDuration: 800,\n        calls: [\n          [{opacity: [1, 0], translateY: [30, -1000]}, 0.60, {easing: \"easeOutCirc\"}],\n          [{translateY: -10}, 0.20],\n          [{translateY: 0}, 0.20]\n        ]\n      },\n      /* Animate.css */\n      \"transition.bounceDownOut\": {\n        defaultDuration: 1000,\n        calls: [\n          [{translateY: -20}, 0.20],\n          [{opacity: [0, \"easeInCirc\", 1], translateY: 1000}, 0.80]\n        ],\n        reset: {translateY: 0}\n      },\n      /* Animate.css */\n      \"transition.bounceLeftIn\": {\n        defaultDuration: 750,\n        calls: [\n          [{opacity: [1, 0], translateX: [30, -1250]}, 0.60, {easing: \"easeOutCirc\"}],\n          [{translateX: -10}, 0.20],\n          [{translateX: 0}, 0.20]\n        ]\n      },\n      /* Animate.css */\n      \"transition.bounceLeftOut\": {\n        defaultDuration: 750,\n        calls: [\n          [{translateX: 30}, 0.20],\n          [{opacity: [0, \"easeInCirc\", 1], translateX: -1250}, 0.80]\n        ],\n        reset: {translateX: 0}\n      },\n      /* Animate.css */\n      \"transition.bounceRightIn\": {\n        defaultDuration: 750,\n        calls: [\n          [{opacity: [1, 0], translateX: [-30, 1250]}, 0.60, {easing: \"easeOutCirc\"}],\n          [{translateX: 10}, 0.20],\n          [{translateX: 0}, 0.20]\n        ]\n      },\n      /* Animate.css */\n      \"transition.bounceRightOut\": {\n        defaultDuration: 750,\n        calls: [\n          [{translateX: -30}, 0.20],\n          [{opacity: [0, \"easeInCirc\", 1], translateX: 1250}, 0.80]\n        ],\n        reset: {translateX: 0}\n      },\n      \"transition.slideUpIn\": {\n        defaultDuration: 900,\n        calls: [\n          [{opacity: [1, 0], translateY: [0, 20], translateZ: 0}]\n        ]\n      },\n      \"transition.slideUpOut\": {\n        defaultDuration: 900,\n        calls: [\n          [{opacity: [0, 1], translateY: -20, translateZ: 0}]\n        ],\n        reset: {translateY: 0}\n      },\n      \"transition.slideDownIn\": {\n        defaultDuration: 900,\n        calls: [\n          [{opacity: [1, 0], translateY: [0, -20], translateZ: 0}]\n        ]\n      },\n      \"transition.slideDownOut\": {\n        defaultDuration: 900,\n        calls: [\n          [{opacity: [0, 1], translateY: 20, translateZ: 0}]\n        ],\n        reset: {translateY: 0}\n      },\n      \"transition.slideLeftIn\": {\n        defaultDuration: 1000,\n        calls: [\n          [{opacity: [1, 0], translateX: [0, -20], translateZ: 0}]\n        ]\n      },\n      \"transition.slideLeftOut\": {\n        defaultDuration: 1050,\n        calls: [\n          [{opacity: [0, 1], translateX: -20, translateZ: 0}]\n        ],\n        reset: {translateX: 0}\n      },\n      \"transition.slideRightIn\": {\n        defaultDuration: 1000,\n        calls: [\n          [{opacity: [1, 0], translateX: [0, 20], translateZ: 0}]\n        ]\n      },\n      \"transition.slideRightOut\": {\n        defaultDuration: 1050,\n        calls: [\n          [{opacity: [0, 1], translateX: 20, translateZ: 0}]\n        ],\n        reset: {translateX: 0}\n      },\n      \"transition.slideUpBigIn\": {\n        defaultDuration: 850,\n        calls: [\n          [{opacity: [1, 0], translateY: [0, 75], translateZ: 0}]\n        ]\n      },\n      \"transition.slideUpBigOut\": {\n        defaultDuration: 800,\n        calls: [\n          [{opacity: [0, 1], translateY: -75, translateZ: 0}]\n        ],\n        reset: {translateY: 0}\n      },\n      \"transition.slideDownBigIn\": {\n        defaultDuration: 850,\n        calls: [\n          [{opacity: [1, 0], translateY: [0, -75], translateZ: 0}]\n        ]\n      },\n      \"transition.slideDownBigOut\": {\n        defaultDuration: 800,\n        calls: [\n          [{opacity: [0, 1], translateY: 75, translateZ: 0}]\n        ],\n        reset: {translateY: 0}\n      },\n      \"transition.slideLeftBigIn\": {\n        defaultDuration: 800,\n        calls: [\n          [{opacity: [1, 0], translateX: [0, -75], translateZ: 0}]\n        ]\n      },\n      \"transition.slideLeftBigOut\": {\n        defaultDuration: 750,\n        calls: [\n          [{opacity: [0, 1], translateX: -75, translateZ: 0}]\n        ],\n        reset: {translateX: 0}\n      },\n      \"transition.slideRightBigIn\": {\n        defaultDuration: 800,\n        calls: [\n          [{opacity: [1, 0], translateX: [0, 75], translateZ: 0}]\n        ]\n      },\n      \"transition.slideRightBigOut\": {\n        defaultDuration: 750,\n        calls: [\n          [{opacity: [0, 1], translateX: 75, translateZ: 0}]\n        ],\n        reset: {translateX: 0}\n      },\n      /* Magic.css */\n      \"transition.perspectiveUpIn\": {\n        defaultDuration: 800,\n        calls: [\n          [{\n            opacity: [1, 0],\n            transformPerspective: [800, 800],\n            transformOriginX: [0, 0],\n            transformOriginY: [\"100%\", \"100%\"],\n            rotateX: [0, -180]\n          }]\n        ],\n        reset: {transformPerspective: 0, transformOriginX: \"50%\", transformOriginY: \"50%\"}\n      },\n      /* Magic.css */\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.perspectiveUpOut\": {\n        defaultDuration: 850,\n        calls: [\n          [{\n            opacity: [0, 1],\n            transformPerspective: [800, 800],\n            transformOriginX: [0, 0],\n            transformOriginY: [\"100%\", \"100%\"],\n            rotateX: -180\n          }]\n        ],\n        reset: {transformPerspective: 0, transformOriginX: \"50%\", transformOriginY: \"50%\", rotateX: 0}\n      },\n      /* Magic.css */\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.perspectiveDownIn\": {\n        defaultDuration: 800,\n        calls: [\n          [{\n            opacity: [1, 0],\n            transformPerspective: [800, 800],\n            transformOriginX: [0, 0],\n            transformOriginY: [0, 0],\n            rotateX: [0, 180]\n          }]\n        ],\n        reset: {transformPerspective: 0, transformOriginX: \"50%\", transformOriginY: \"50%\"}\n      },\n      /* Magic.css */\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.perspectiveDownOut\": {\n        defaultDuration: 850,\n        calls: [\n          [{\n            opacity: [0, 1],\n            transformPerspective: [800, 800],\n            transformOriginX: [0, 0],\n            transformOriginY: [0, 0],\n            rotateX: 180\n          }]\n        ],\n        reset: {transformPerspective: 0, transformOriginX: \"50%\", transformOriginY: \"50%\", rotateX: 0}\n      },\n      /* Magic.css */\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.perspectiveLeftIn\": {\n        defaultDuration: 950,\n        calls: [\n          [{\n            opacity: [1, 0],\n            transformPerspective: [2000, 2000],\n            transformOriginX: [0, 0],\n            transformOriginY: [0, 0],\n            rotateY: [0, -180]\n          }]\n        ],\n        reset: {transformPerspective: 0, transformOriginX: \"50%\", transformOriginY: \"50%\"}\n      },\n      /* Magic.css */\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.perspectiveLeftOut\": {\n        defaultDuration: 950,\n        calls: [\n          [{\n            opacity: [0, 1],\n            transformPerspective: [2000, 2000],\n            transformOriginX: [0, 0],\n            transformOriginY: [0, 0],\n            rotateY: -180\n          }]\n        ],\n        reset: {transformPerspective: 0, transformOriginX: \"50%\", transformOriginY: \"50%\", rotateY: 0}\n      },\n      /* Magic.css */\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.perspectiveRightIn\": {\n        defaultDuration: 950,\n        calls: [\n          [{\n            opacity: [1, 0],\n            transformPerspective: [2000, 2000],\n            transformOriginX: [\"100%\", \"100%\"],\n            transformOriginY: [0, 0],\n            rotateY: [0, 180]\n          }]\n        ],\n        reset: {transformPerspective: 0, transformOriginX: \"50%\", transformOriginY: \"50%\"}\n      },\n      /* Magic.css */\n      /* Support: Loses rotation in IE9/Android 2.3 (fades only). */\n      \"transition.perspectiveRightOut\": {\n        defaultDuration: 950,\n        calls: [\n          [{\n            opacity: [0, 1],\n            transformPerspective: [2000, 2000],\n            transformOriginX: [\"100%\", \"100%\"],\n            transformOriginY: [0, 0],\n            rotateY: 180\n          }]\n        ],\n        reset: {transformPerspective: 0, transformOriginX: \"50%\", transformOriginY: \"50%\", rotateY: 0}\n      }\n    };\n\n    /* Register the packaged effects. */\n    for (var effectName in Velocity.RegisterEffect.packagedEffects) {\n      Velocity.RegisterEffect(effectName, Velocity.RegisterEffect.packagedEffects[effectName]);\n    }\n\n    /*********************\n     Sequence Running\n     **********************/\n\n    /* Note: Sequence calls must use Velocity's single-object arguments syntax. */\n    Velocity.RunSequence = function (originalSequence) {\n      var sequence = $.extend(true, [], originalSequence);\n\n      if (sequence.length > 1) {\n        $.each(sequence.reverse(), function (i, currentCall) {\n          var nextCall = sequence[i + 1];\n\n          if (nextCall) {\n            /* Parallel sequence calls (indicated via sequenceQueue:false) are triggered\n             in the previous call's begin callback. Otherwise, chained calls are normally triggered\n             in the previous call's complete callback. */\n            var currentCallOptions = currentCall.o || currentCall.options,\n              nextCallOptions = nextCall.o || nextCall.options;\n\n            var timing = (currentCallOptions && currentCallOptions.sequenceQueue === false) ? \"begin\" : \"complete\",\n              callbackOriginal = nextCallOptions && nextCallOptions[timing],\n              options = {};\n\n            options[timing] = function () {\n              var nextCallElements = nextCall.e || nextCall.elements;\n              var elements = nextCallElements.nodeType ? [nextCallElements] : nextCallElements;\n\n              callbackOriginal && callbackOriginal.call(elements, elements);\n              Velocity(currentCall);\n            }\n\n            if (nextCall.o) {\n              nextCall.o = $.extend({}, nextCallOptions, options);\n            } else {\n              nextCall.options = $.extend({}, nextCallOptions, options);\n            }\n          }\n        });\n\n        sequence.reverse();\n      }\n\n      Velocity(sequence[0]);\n    };\n  }((window.jQuery || window.Zepto || window), window, document);\n}));\n"
  },
  {
    "path": "app/templates/app/src/lib/zepto.js",
    "content": "// MODULES=\"zepto event ajax form ie detect fx touch gesture selector\" npm run-script dist\n/* Zepto 1.1.6 - zepto event ajax form ie detect fx touch gesture selector - zeptojs.com/license */\n\nvar Zepto = (function () {\n  var undefined, key, $, classList, emptyArray = [], slice = emptyArray.slice, filter = emptyArray.filter,\n    document = window.document,\n    elementDisplay = {}, classCache = {},\n    cssNumber = {\n      'column-count': 1,\n      'columns': 1,\n      'font-weight': 1,\n      'line-height': 1,\n      'opacity': 1,\n      'z-index': 1,\n      'zoom': 1\n    },\n    fragmentRE = /^\\s*<(\\w+|!)[^>]*>/,\n    singleTagRE = /^<(\\w+)\\s*\\/?>(?:<\\/\\1>|)$/,\n    tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:]+)[^>]*)\\/>/ig,\n    rootNodeRE = /^(?:body|html)$/i,\n    capitalRE = /([A-Z])/g,\n\n  // special attributes that should be get/set via method calls\n    methodAttributes = ['val', 'css', 'html', 'text', 'data', 'width', 'height', 'offset'],\n\n    adjacencyOperators = ['after', 'prepend', 'before', 'append'],\n    table = document.createElement('table'),\n    tableRow = document.createElement('tr'),\n    containers = {\n      'tr': document.createElement('tbody'),\n      'tbody': table, 'thead': table, 'tfoot': table,\n      'td': tableRow, 'th': tableRow,\n      '*': document.createElement('div')\n    },\n    readyRE = /complete|loaded|interactive/,\n    simpleSelectorRE = /^[\\w-]*$/,\n    class2type = {},\n    toString = class2type.toString,\n    zepto = {},\n    camelize, uniq,\n    tempParent = document.createElement('div'),\n    propMap = {\n      'tabindex': 'tabIndex',\n      'readonly': 'readOnly',\n      'for': 'htmlFor',\n      'class': 'className',\n      'maxlength': 'maxLength',\n      'cellspacing': 'cellSpacing',\n      'cellpadding': 'cellPadding',\n      'rowspan': 'rowSpan',\n      'colspan': 'colSpan',\n      'usemap': 'useMap',\n      'frameborder': 'frameBorder',\n      'contenteditable': 'contentEditable'\n    },\n    isArray = Array.isArray ||\n      function (object) {\n        return object instanceof Array\n      }\n\n  zepto.matches = function (element, selector) {\n    if (!selector || !element || element.nodeType !== 1) return false\n    var matchesSelector = element.webkitMatchesSelector || element.mozMatchesSelector ||\n      element.oMatchesSelector || element.matchesSelector\n    if (matchesSelector) return matchesSelector.call(element, selector)\n    // fall back to performing a selector:\n    var match, parent = element.parentNode, temp = !parent\n    if (temp) (parent = tempParent).appendChild(element)\n    match = ~zepto.qsa(parent, selector).indexOf(element)\n    temp && tempParent.removeChild(element)\n    return match\n  }\n\n  function type(obj) {\n    return obj == null ? String(obj) :\n    class2type[toString.call(obj)] || \"object\"\n  }\n\n  function isFunction(value) {\n    return type(value) == \"function\"\n  }\n\n  function isWindow(obj) {\n    return obj != null && obj == obj.window\n  }\n\n  function isDocument(obj) {\n    return obj != null && obj.nodeType == obj.DOCUMENT_NODE\n  }\n\n  function isObject(obj) {\n    return type(obj) == \"object\"\n  }\n\n  function isPlainObject(obj) {\n    return isObject(obj) && !isWindow(obj) && Object.getPrototypeOf(obj) == Object.prototype\n  }\n\n  function likeArray(obj) {\n    return typeof obj.length == 'number'\n  }\n\n  function compact(array) {\n    return filter.call(array, function (item) {\n      return item != null\n    })\n  }\n\n  function flatten(array) {\n    return array.length > 0 ? $.fn.concat.apply([], array) : array\n  }\n\n  camelize = function (str) {\n    return str.replace(/-+(.)?/g, function (match, chr) {\n      return chr ? chr.toUpperCase() : ''\n    })\n  }\n  function dasherize(str) {\n    return str.replace(/::/g, '/')\n      .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')\n      .replace(/([a-z\\d])([A-Z])/g, '$1_$2')\n      .replace(/_/g, '-')\n      .toLowerCase()\n  }\n\n  uniq = function (array) {\n    return filter.call(array, function (item, idx) {\n      return array.indexOf(item) == idx\n    })\n  }\n\n  function classRE(name) {\n    return name in classCache ?\n      classCache[name] : (classCache[name] = new RegExp('(^|\\\\s)' + name + '(\\\\s|$)'))\n  }\n\n  function maybeAddPx(name, value) {\n    return (typeof value == \"number\" && !cssNumber[dasherize(name)]) ? value + \"px\" : value\n  }\n\n  function defaultDisplay(nodeName) {\n    var element, display\n    if (!elementDisplay[nodeName]) {\n      element = document.createElement(nodeName)\n      document.body.appendChild(element)\n      display = getComputedStyle(element, '').getPropertyValue(\"display\")\n      element.parentNode.removeChild(element)\n      display == \"none\" && (display = \"block\")\n      elementDisplay[nodeName] = display\n    }\n    return elementDisplay[nodeName]\n  }\n\n  function children(element) {\n    return 'children' in element ?\n      slice.call(element.children) :\n      $.map(element.childNodes, function (node) {\n        if (node.nodeType == 1) return node\n      })\n  }\n\n  // `$.zepto.fragment` takes a html string and an optional tag name\n  // to generate DOM nodes nodes from the given html string.\n  // The generated DOM nodes are returned as an array.\n  // This function can be overriden in plugins for example to make\n  // it compatible with browsers that don't support the DOM fully.\n  zepto.fragment = function (html, name, properties) {\n    var dom, nodes, container\n\n    // A special case optimization for a single tag\n    if (singleTagRE.test(html)) dom = $(document.createElement(RegExp.$1))\n\n    if (!dom) {\n      if (html.replace) html = html.replace(tagExpanderRE, \"<$1></$2>\")\n      if (name === undefined) name = fragmentRE.test(html) && RegExp.$1\n      if (!(name in containers)) name = '*'\n\n      container = containers[name]\n      container.innerHTML = '' + html\n      dom = $.each(slice.call(container.childNodes), function () {\n        container.removeChild(this)\n      })\n    }\n\n    if (isPlainObject(properties)) {\n      nodes = $(dom)\n      $.each(properties, function (key, value) {\n        if (methodAttributes.indexOf(key) > -1) nodes[key](value)\n        else nodes.attr(key, value)\n      })\n    }\n\n    return dom\n  }\n\n  // `$.zepto.Z` swaps out the prototype of the given `dom` array\n  // of nodes with `$.fn` and thus supplying all the Zepto functions\n  // to the array. Note that `__proto__` is not supported on Internet\n  // Explorer. This method can be overriden in plugins.\n  zepto.Z = function (dom, selector) {\n    dom = dom || []\n    dom.__proto__ = $.fn\n    dom.selector = selector || ''\n    return dom\n  }\n\n  // `$.zepto.isZ` should return `true` if the given object is a Zepto\n  // collection. This method can be overriden in plugins.\n  zepto.isZ = function (object) {\n    return object instanceof zepto.Z\n  }\n\n  // `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and\n  // takes a CSS selector and an optional context (and handles various\n  // special cases).\n  // This method can be overriden in plugins.\n  zepto.init = function (selector, context) {\n    var dom\n    // If nothing given, return an empty Zepto collection\n    if (!selector) return zepto.Z()\n    // Optimize for string selectors\n    else if (typeof selector == 'string') {\n      selector = selector.trim()\n      // If it's a html fragment, create nodes from it\n      // Note: In both Chrome 21 and Firefox 15, DOM error 12\n      // is thrown if the fragment doesn't begin with <\n      if (selector[0] == '<' && fragmentRE.test(selector))\n        dom = zepto.fragment(selector, RegExp.$1, context), selector = null\n      // If there's a context, create a collection on that context first, and select\n      // nodes from there\n      else if (context !== undefined) return $(context).find(selector)\n      // If it's a CSS selector, use it to select nodes.\n      else dom = zepto.qsa(document, selector)\n    }\n    // If a function is given, call it when the DOM is ready\n    else if (isFunction(selector)) return $(document).ready(selector)\n    // If a Zepto collection is given, just return it\n    else if (zepto.isZ(selector)) return selector\n    else {\n      // normalize array if an array of nodes is given\n      if (isArray(selector)) dom = compact(selector)\n      // Wrap DOM nodes.\n      else if (isObject(selector))\n        dom = [selector], selector = null\n      // If it's a html fragment, create nodes from it\n      else if (fragmentRE.test(selector))\n        dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null\n      // If there's a context, create a collection on that context first, and select\n      // nodes from there\n      else if (context !== undefined) return $(context).find(selector)\n      // And last but no least, if it's a CSS selector, use it to select nodes.\n      else dom = zepto.qsa(document, selector)\n    }\n    // create a new Zepto collection from the nodes found\n    return zepto.Z(dom, selector)\n  }\n\n  // `$` will be the base `Zepto` object. When calling this\n  // function just call `$.zepto.init, which makes the implementation\n  // details of selecting nodes and creating Zepto collections\n  // patchable in plugins.\n  $ = function (selector, context) {\n    return zepto.init(selector, context)\n  }\n\n  function extend(target, source, deep) {\n    for (key in source)\n      if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {\n        if (isPlainObject(source[key]) && !isPlainObject(target[key]))\n          target[key] = {}\n        if (isArray(source[key]) && !isArray(target[key]))\n          target[key] = []\n        extend(target[key], source[key], deep)\n      }\n      else if (source[key] !== undefined) target[key] = source[key]\n  }\n\n  // Copy all but undefined properties from one or more\n  // objects to the `target` object.\n  $.extend = function (target) {\n    var deep, args = slice.call(arguments, 1)\n    if (typeof target == 'boolean') {\n      deep = target\n      target = args.shift()\n    }\n    args.forEach(function (arg) {\n      extend(target, arg, deep)\n    })\n    return target\n  }\n\n  // `$.zepto.qsa` is Zepto's CSS selector implementation which\n  // uses `document.querySelectorAll` and optimizes for some special cases, like `#id`.\n  // This method can be overriden in plugins.\n  zepto.qsa = function (element, selector) {\n    var found,\n      maybeID = selector[0] == '#',\n      maybeClass = !maybeID && selector[0] == '.',\n      nameOnly = maybeID || maybeClass ? selector.slice(1) : selector, // Ensure that a 1 char tag name still gets checked\n      isSimple = simpleSelectorRE.test(nameOnly)\n    return (isDocument(element) && isSimple && maybeID) ?\n      ( (found = element.getElementById(nameOnly)) ? [found] : [] ) :\n      (element.nodeType !== 1 && element.nodeType !== 9) ? [] :\n        slice.call(\n          isSimple && !maybeID ?\n            maybeClass ? element.getElementsByClassName(nameOnly) : // If it's simple, it could be a class\n              element.getElementsByTagName(selector) : // Or a tag\n            element.querySelectorAll(selector) // Or it's not simple, and we need to query all\n        )\n  }\n\n  function filtered(nodes, selector) {\n    return selector == null ? $(nodes) : $(nodes).filter(selector)\n  }\n\n  $.contains = document.documentElement.contains ?\n    function (parent, node) {\n      return parent !== node && parent.contains(node)\n    } :\n    function (parent, node) {\n      while (node && (node = node.parentNode))\n        if (node === parent) return true\n      return false\n    }\n\n  function funcArg(context, arg, idx, payload) {\n    return isFunction(arg) ? arg.call(context, idx, payload) : arg\n  }\n\n  function setAttribute(node, name, value) {\n    value == null ? node.removeAttribute(name) : node.setAttribute(name, value)\n  }\n\n  // access className property while respecting SVGAnimatedString\n  function className(node, value) {\n    var klass = node.className || '',\n      svg = klass && klass.baseVal !== undefined\n\n    if (value === undefined) return svg ? klass.baseVal : klass\n    svg ? (klass.baseVal = value) : (node.className = value)\n  }\n\n  // \"true\"  => true\n  // \"false\" => false\n  // \"null\"  => null\n  // \"42\"    => 42\n  // \"42.5\"  => 42.5\n  // \"08\"    => \"08\"\n  // JSON    => parse if valid\n  // String  => self\n  function deserializeValue(value) {\n    try {\n      return value ?\n      value == \"true\" ||\n      ( value == \"false\" ? false :\n        value == \"null\" ? null :\n          +value + \"\" == value ? +value :\n            /^[\\[\\{]/.test(value) ? $.parseJSON(value) :\n              value )\n        : value\n    } catch (e) {\n      return value\n    }\n  }\n\n  $.type = type\n  $.isFunction = isFunction\n  $.isWindow = isWindow\n  $.isArray = isArray\n  $.isPlainObject = isPlainObject\n\n  $.isEmptyObject = function (obj) {\n    var name\n    for (name in obj) return false\n    return true\n  }\n\n  $.inArray = function (elem, array, i) {\n    return emptyArray.indexOf.call(array, elem, i)\n  }\n\n  $.camelCase = camelize\n  $.trim = function (str) {\n    return str == null ? \"\" : String.prototype.trim.call(str)\n  }\n\n  // plugin compatibility\n  $.uuid = 0\n  $.support = {}\n  $.expr = {}\n\n  $.map = function (elements, callback) {\n    var value, values = [], i, key\n    if (likeArray(elements))\n      for (i = 0; i < elements.length; i++) {\n        value = callback(elements[i], i)\n        if (value != null) values.push(value)\n      }\n    else\n      for (key in elements) {\n        value = callback(elements[key], key)\n        if (value != null) values.push(value)\n      }\n    return flatten(values)\n  }\n\n  $.each = function (elements, callback) {\n    var i, key\n    if (likeArray(elements)) {\n      for (i = 0; i < elements.length; i++)\n        if (callback.call(elements[i], i, elements[i]) === false) return elements\n    } else {\n      for (key in elements)\n        if (callback.call(elements[key], key, elements[key]) === false) return elements\n    }\n\n    return elements\n  }\n\n  $.grep = function (elements, callback) {\n    return filter.call(elements, callback)\n  }\n\n  if (window.JSON) $.parseJSON = JSON.parse\n\n  // Populate the class2type map\n  $.each(\"Boolean Number String Function Array Date RegExp Object Error\".split(\" \"), function (i, name) {\n    class2type[\"[object \" + name + \"]\"] = name.toLowerCase()\n  })\n\n  // Define methods that will be available on all\n  // Zepto collections\n  $.fn = {\n    // Because a collection acts like an array\n    // copy over these useful array functions.\n    forEach: emptyArray.forEach,\n    reduce: emptyArray.reduce,\n    push: emptyArray.push,\n    sort: emptyArray.sort,\n    indexOf: emptyArray.indexOf,\n    concat: emptyArray.concat,\n\n    // `map` and `slice` in the jQuery API work differently\n    // from their array counterparts\n    map: function (fn) {\n      return $($.map(this, function (el, i) {\n        return fn.call(el, i, el)\n      }))\n    },\n    slice: function () {\n      return $(slice.apply(this, arguments))\n    },\n\n    ready: function (callback) {\n      // need to check if document.body exists for IE as that browser reports\n      // document ready when it hasn't yet created the body element\n      if (readyRE.test(document.readyState) && document.body) callback($)\n      else document.addEventListener('DOMContentLoaded', function () {\n        callback($)\n      }, false)\n      return this\n    },\n    get: function (idx) {\n      return idx === undefined ? slice.call(this) : this[idx >= 0 ? idx : idx + this.length]\n    },\n    toArray: function () {\n      return this.get()\n    },\n    size: function () {\n      return this.length\n    },\n    remove: function () {\n      return this.each(function () {\n        if (this.parentNode != null)\n          this.parentNode.removeChild(this)\n      })\n    },\n    each: function (callback) {\n      emptyArray.every.call(this, function (el, idx) {\n        return callback.call(el, idx, el) !== false\n      })\n      return this\n    },\n    filter: function (selector) {\n      if (isFunction(selector)) return this.not(this.not(selector))\n      return $(filter.call(this, function (element) {\n        return zepto.matches(element, selector)\n      }))\n    },\n    add: function (selector, context) {\n      return $(uniq(this.concat($(selector, context))))\n    },\n    is: function (selector) {\n      return this.length > 0 && zepto.matches(this[0], selector)\n    },\n    not: function (selector) {\n      var nodes = []\n      if (isFunction(selector) && selector.call !== undefined)\n        this.each(function (idx) {\n          if (!selector.call(this, idx)) nodes.push(this)\n        })\n      else {\n        var excludes = typeof selector == 'string' ? this.filter(selector) :\n          (likeArray(selector) && isFunction(selector.item)) ? slice.call(selector) : $(selector)\n        this.forEach(function (el) {\n          if (excludes.indexOf(el) < 0) nodes.push(el)\n        })\n      }\n      return $(nodes)\n    },\n    has: function (selector) {\n      return this.filter(function () {\n        return isObject(selector) ?\n          $.contains(this, selector) :\n          $(this).find(selector).size()\n      })\n    },\n    eq: function (idx) {\n      return idx === -1 ? this.slice(idx) : this.slice(idx, +idx + 1)\n    },\n    first: function () {\n      var el = this[0]\n      return el && !isObject(el) ? el : $(el)\n    },\n    last: function () {\n      var el = this[this.length - 1]\n      return el && !isObject(el) ? el : $(el)\n    },\n    find: function (selector) {\n      var result, $this = this\n      if (!selector) result = $()\n      else if (typeof selector == 'object')\n        result = $(selector).filter(function () {\n          var node = this\n          return emptyArray.some.call($this, function (parent) {\n            return $.contains(parent, node)\n          })\n        })\n      else if (this.length == 1) result = $(zepto.qsa(this[0], selector))\n      else result = this.map(function () {\n          return zepto.qsa(this, selector)\n        })\n      return result\n    },\n    closest: function (selector, context) {\n      var node = this[0], collection = false\n      if (typeof selector == 'object') collection = $(selector)\n      while (node && !(collection ? collection.indexOf(node) >= 0 : zepto.matches(node, selector)))\n        node = node !== context && !isDocument(node) && node.parentNode\n      return $(node)\n    },\n    parents: function (selector) {\n      var ancestors = [], nodes = this\n      while (nodes.length > 0)\n        nodes = $.map(nodes, function (node) {\n          if ((node = node.parentNode) && !isDocument(node) && ancestors.indexOf(node) < 0) {\n            ancestors.push(node)\n            return node\n          }\n        })\n      return filtered(ancestors, selector)\n    },\n    parent: function (selector) {\n      return filtered(uniq(this.pluck('parentNode')), selector)\n    },\n    children: function (selector) {\n      return filtered(this.map(function () {\n        return children(this)\n      }), selector)\n    },\n    contents: function () {\n      return this.map(function () {\n        return slice.call(this.childNodes)\n      })\n    },\n    siblings: function (selector) {\n      return filtered(this.map(function (i, el) {\n        return filter.call(children(el.parentNode), function (child) {\n          return child !== el\n        })\n      }), selector)\n    },\n    empty: function () {\n      return this.each(function () {\n        this.innerHTML = ''\n      })\n    },\n    // `pluck` is borrowed from Prototype.js\n    pluck: function (property) {\n      return $.map(this, function (el) {\n        return el[property]\n      })\n    },\n    show: function () {\n      return this.each(function () {\n        this.style.display == \"none\" && (this.style.display = '')\n        if (getComputedStyle(this, '').getPropertyValue(\"display\") == \"none\")\n          this.style.display = defaultDisplay(this.nodeName)\n      })\n    },\n    replaceWith: function (newContent) {\n      return this.before(newContent).remove()\n    },\n    wrap: function (structure) {\n      var func = isFunction(structure)\n      if (this[0] && !func)\n        var dom = $(structure).get(0),\n          clone = dom.parentNode || this.length > 1\n\n      return this.each(function (index) {\n        $(this).wrapAll(\n          func ? structure.call(this, index) :\n            clone ? dom.cloneNode(true) : dom\n        )\n      })\n    },\n    wrapAll: function (structure) {\n      if (this[0]) {\n        $(this[0]).before(structure = $(structure))\n        var children\n        // drill down to the inmost element\n        while ((children = structure.children()).length) structure = children.first()\n        $(structure).append(this)\n      }\n      return this\n    },\n    wrapInner: function (structure) {\n      var func = isFunction(structure)\n      return this.each(function (index) {\n        var self = $(this), contents = self.contents(),\n          dom = func ? structure.call(this, index) : structure\n        contents.length ? contents.wrapAll(dom) : self.append(dom)\n      })\n    },\n    unwrap: function () {\n      this.parent().each(function () {\n        $(this).replaceWith($(this).children())\n      })\n      return this\n    },\n    clone: function () {\n      return this.map(function () {\n        return this.cloneNode(true)\n      })\n    },\n    hide: function () {\n      return this.css(\"display\", \"none\")\n    },\n    toggle: function (setting) {\n      return this.each(function () {\n        var el = $(this)\n          ;\n        (setting === undefined ? el.css(\"display\") == \"none\" : setting) ? el.show() : el.hide()\n      })\n    },\n    prev: function (selector) {\n      return $(this.pluck('previousElementSibling')).filter(selector || '*')\n    },\n    next: function (selector) {\n      return $(this.pluck('nextElementSibling')).filter(selector || '*')\n    },\n    html: function (html) {\n      return 0 in arguments ?\n        this.each(function (idx) {\n          var originHtml = this.innerHTML\n          $(this).empty().append(funcArg(this, html, idx, originHtml))\n        }) :\n        (0 in this ? this[0].innerHTML : null)\n    },\n    text: function (text) {\n      return 0 in arguments ?\n        this.each(function (idx) {\n          var newText = funcArg(this, text, idx, this.textContent)\n          this.textContent = newText == null ? '' : '' + newText\n        }) :\n        (0 in this ? this[0].textContent : null)\n    },\n    attr: function (name, value) {\n      var result\n      return (typeof name == 'string' && !(1 in arguments)) ?\n        (!this.length || this[0].nodeType !== 1 ? undefined :\n            (!(result = this[0].getAttribute(name)) && name in this[0]) ? this[0][name] : result\n        ) :\n        this.each(function (idx) {\n          if (this.nodeType !== 1) return\n          if (isObject(name)) for (key in name) setAttribute(this, key, name[key])\n          else setAttribute(this, name, funcArg(this, value, idx, this.getAttribute(name)))\n        })\n    },\n    removeAttr: function (name) {\n      return this.each(function () {\n        this.nodeType === 1 && name.split(' ').forEach(function (attribute) {\n          setAttribute(this, attribute)\n        }, this)\n      })\n    },\n    prop: function (name, value) {\n      name = propMap[name] || name\n      return (1 in arguments) ?\n        this.each(function (idx) {\n          this[name] = funcArg(this, value, idx, this[name])\n        }) :\n        (this[0] && this[0][name])\n    },\n    data: function (name, value) {\n      var attrName = 'data-' + name.replace(capitalRE, '-$1').toLowerCase()\n\n      var data = (1 in arguments) ?\n        this.attr(attrName, value) :\n        this.attr(attrName)\n\n      return data !== null ? deserializeValue(data) : undefined\n    },\n    val: function (value) {\n      return 0 in arguments ?\n        this.each(function (idx) {\n          this.value = funcArg(this, value, idx, this.value)\n        }) :\n        (this[0] && (this[0].multiple ?\n            $(this[0]).find('option').filter(function () {\n              return this.selected\n            }).pluck('value') :\n            this[0].value)\n        )\n    },\n    offset: function (coordinates) {\n      if (coordinates) return this.each(function (index) {\n        var $this = $(this),\n          coords = funcArg(this, coordinates, index, $this.offset()),\n          parentOffset = $this.offsetParent().offset(),\n          props = {\n            top: coords.top - parentOffset.top,\n            left: coords.left - parentOffset.left\n          }\n\n        if ($this.css('position') == 'static') props['position'] = 'relative'\n        $this.css(props)\n      })\n      if (!this.length) return null\n      var obj = this[0].getBoundingClientRect()\n      return {\n        left: obj.left + window.pageXOffset,\n        top: obj.top + window.pageYOffset,\n        width: Math.round(obj.width),\n        height: Math.round(obj.height)\n      }\n    },\n    css: function (property, value) {\n      if (arguments.length < 2) {\n        var computedStyle, element = this[0]\n        if (!element) return\n        computedStyle = getComputedStyle(element, '')\n        if (typeof property == 'string')\n          return element.style[camelize(property)] || computedStyle.getPropertyValue(property)\n        else if (isArray(property)) {\n          var props = {}\n          $.each(property, function (_, prop) {\n            props[prop] = (element.style[camelize(prop)] || computedStyle.getPropertyValue(prop))\n          })\n          return props\n        }\n      }\n\n      var css = ''\n      if (type(property) == 'string') {\n        if (!value && value !== 0)\n          this.each(function () {\n            this.style.removeProperty(dasherize(property))\n          })\n        else\n          css = dasherize(property) + \":\" + maybeAddPx(property, value)\n      } else {\n        for (key in property)\n          if (!property[key] && property[key] !== 0)\n            this.each(function () {\n              this.style.removeProperty(dasherize(key))\n            })\n          else\n            css += dasherize(key) + ':' + maybeAddPx(key, property[key]) + ';'\n      }\n\n      return this.each(function () {\n        this.style.cssText += ';' + css\n      })\n    },\n    index: function (element) {\n      return element ? this.indexOf($(element)[0]) : this.parent().children().indexOf(this[0])\n    },\n    hasClass: function (name) {\n      if (!name) return false\n      return emptyArray.some.call(this, function (el) {\n        return this.test(className(el))\n      }, classRE(name))\n    },\n    addClass: function (name) {\n      if (!name) return this\n      return this.each(function (idx) {\n        if (!('className' in this)) return\n        classList = []\n        var cls = className(this), newName = funcArg(this, name, idx, cls)\n        newName.split(/\\s+/g).forEach(function (klass) {\n          if (!$(this).hasClass(klass)) classList.push(klass)\n        }, this)\n        classList.length && className(this, cls + (cls ? \" \" : \"\") + classList.join(\" \"))\n      })\n    },\n    removeClass: function (name) {\n      return this.each(function (idx) {\n        if (!('className' in this)) return\n        if (name === undefined) return className(this, '')\n        classList = className(this)\n        funcArg(this, name, idx, classList).split(/\\s+/g).forEach(function (klass) {\n          classList = classList.replace(classRE(klass), \" \")\n        })\n        className(this, classList.trim())\n      })\n    },\n    toggleClass: function (name, when) {\n      if (!name) return this\n      return this.each(function (idx) {\n        var $this = $(this), names = funcArg(this, name, idx, className(this))\n        names.split(/\\s+/g).forEach(function (klass) {\n          (when === undefined ? !$this.hasClass(klass) : when) ?\n            $this.addClass(klass) : $this.removeClass(klass)\n        })\n      })\n    },\n    scrollTop: function (value) {\n      if (!this.length) return\n      var hasScrollTop = 'scrollTop' in this[0]\n      if (value === undefined) return hasScrollTop ? this[0].scrollTop : this[0].pageYOffset\n      return this.each(hasScrollTop ?\n        function () {\n          this.scrollTop = value\n        } :\n        function () {\n          this.scrollTo(this.scrollX, value)\n        })\n    },\n    scrollLeft: function (value) {\n      if (!this.length) return\n      var hasScrollLeft = 'scrollLeft' in this[0]\n      if (value === undefined) return hasScrollLeft ? this[0].scrollLeft : this[0].pageXOffset\n      return this.each(hasScrollLeft ?\n        function () {\n          this.scrollLeft = value\n        } :\n        function () {\n          this.scrollTo(value, this.scrollY)\n        })\n    },\n    position: function () {\n      if (!this.length) return\n\n      var elem = this[0],\n      // Get *real* offsetParent\n        offsetParent = this.offsetParent(),\n      // Get correct offsets\n        offset = this.offset(),\n        parentOffset = rootNodeRE.test(offsetParent[0].nodeName) ? {top: 0, left: 0} : offsetParent.offset()\n\n      // Subtract element margins\n      // note: when an element has margin: auto the offsetLeft and marginLeft\n      // are the same in Safari causing offset.left to incorrectly be 0\n      offset.top -= parseFloat($(elem).css('margin-top')) || 0\n      offset.left -= parseFloat($(elem).css('margin-left')) || 0\n\n      // Add offsetParent borders\n      parentOffset.top += parseFloat($(offsetParent[0]).css('border-top-width')) || 0\n      parentOffset.left += parseFloat($(offsetParent[0]).css('border-left-width')) || 0\n\n      // Subtract the two offsets\n      return {\n        top: offset.top - parentOffset.top,\n        left: offset.left - parentOffset.left\n      }\n    },\n    offsetParent: function () {\n      return this.map(function () {\n        var parent = this.offsetParent || document.body\n        while (parent && !rootNodeRE.test(parent.nodeName) && $(parent).css(\"position\") == \"static\")\n          parent = parent.offsetParent\n        return parent\n      })\n    }\n  }\n\n  // for now\n  $.fn.detach = $.fn.remove\n\n    // Generate the `width` and `height` functions\n  ;\n  ['width', 'height'].forEach(function (dimension) {\n    var dimensionProperty =\n      dimension.replace(/./, function (m) {\n        return m[0].toUpperCase()\n      })\n\n    $.fn[dimension] = function (value) {\n      var offset, el = this[0]\n      if (value === undefined) return isWindow(el) ? el['inner' + dimensionProperty] :\n        isDocument(el) ? el.documentElement['scroll' + dimensionProperty] :\n        (offset = this.offset()) && offset[dimension]\n      else return this.each(function (idx) {\n        el = $(this)\n        el.css(dimension, funcArg(this, value, idx, el[dimension]()))\n      })\n    }\n  })\n\n  function traverseNode(node, fun) {\n    fun(node)\n    for (var i = 0, len = node.childNodes.length; i < len; i++)\n      traverseNode(node.childNodes[i], fun)\n  }\n\n  // Generate the `after`, `prepend`, `before`, `append`,\n  // `insertAfter`, `insertBefore`, `appendTo`, and `prependTo` methods.\n  adjacencyOperators.forEach(function (operator, operatorIndex) {\n    var inside = operatorIndex % 2 //=> prepend, append\n\n    $.fn[operator] = function () {\n      // arguments can be nodes, arrays of nodes, Zepto objects and HTML strings\n      var argType, nodes = $.map(arguments, function (arg) {\n          argType = type(arg)\n          return argType == \"object\" || argType == \"array\" || arg == null ?\n            arg : zepto.fragment(arg)\n        }),\n        parent, copyByClone = this.length > 1\n      if (nodes.length < 1) return this\n\n      return this.each(function (_, target) {\n        parent = inside ? target : target.parentNode\n\n        // convert all methods to a \"before\" operation\n        target = operatorIndex == 0 ? target.nextSibling :\n          operatorIndex == 1 ? target.firstChild :\n            operatorIndex == 2 ? target :\n              null\n\n        var parentInDocument = $.contains(document.documentElement, parent)\n\n        nodes.forEach(function (node) {\n          if (copyByClone) node = node.cloneNode(true)\n          else if (!parent) return $(node).remove()\n\n          parent.insertBefore(node, target)\n          if (parentInDocument) traverseNode(node, function (el) {\n            if (el.nodeName != null && el.nodeName.toUpperCase() === 'SCRIPT' &&\n              (!el.type || el.type === 'text/javascript') && !el.src)\n              window['eval'].call(window, el.innerHTML)\n          })\n        })\n      })\n    }\n\n    // after    => insertAfter\n    // prepend  => prependTo\n    // before   => insertBefore\n    // append   => appendTo\n    $.fn[inside ? operator + 'To' : 'insert' + (operatorIndex ? 'Before' : 'After')] = function (html) {\n      $(html)[operator](this)\n      return this\n    }\n  })\n\n  zepto.Z.prototype = $.fn\n\n  // Export internal API functions in the `$.zepto` namespace\n  zepto.uniq = uniq\n  zepto.deserializeValue = deserializeValue\n  $.zepto = zepto\n\n  return $\n})()\n\nwindow.Zepto = Zepto\nwindow.$ === undefined && (window.$ = Zepto)\n\n;\n(function ($) {\n  var _zid = 1, undefined,\n    slice = Array.prototype.slice,\n    isFunction = $.isFunction,\n    isString = function (obj) {\n      return typeof obj == 'string'\n    },\n    handlers = {},\n    specialEvents = {},\n    focusinSupported = 'onfocusin' in window,\n    focus = {focus: 'focusin', blur: 'focusout'},\n    hover = {mouseenter: 'mouseover', mouseleave: 'mouseout'}\n\n  specialEvents.click = specialEvents.mousedown = specialEvents.mouseup = specialEvents.mousemove = 'MouseEvents'\n\n  function zid(element) {\n    return element._zid || (element._zid = _zid++)\n  }\n\n  function findHandlers(element, event, fn, selector) {\n    event = parse(event)\n    if (event.ns) var matcher = matcherFor(event.ns)\n    return (handlers[zid(element)] || []).filter(function (handler) {\n      return handler\n        && (!event.e || handler.e == event.e)\n        && (!event.ns || matcher.test(handler.ns))\n        && (!fn || zid(handler.fn) === zid(fn))\n        && (!selector || handler.sel == selector)\n    })\n  }\n\n  function parse(event) {\n    var parts = ('' + event).split('.')\n    return {e: parts[0], ns: parts.slice(1).sort().join(' ')}\n  }\n\n  function matcherFor(ns) {\n    return new RegExp('(?:^| )' + ns.replace(' ', ' .* ?') + '(?: |$)')\n  }\n\n  function eventCapture(handler, captureSetting) {\n    return handler.del &&\n      (!focusinSupported && (handler.e in focus)) || !!captureSetting\n  }\n\n  function realEvent(type) {\n    return hover[type] || (focusinSupported && focus[type]) || type\n  }\n\n  function add(element, events, fn, data, selector, delegator, capture) {\n    var id = zid(element), set = (handlers[id] || (handlers[id] = []))\n    events.split(/\\s/).forEach(function (event) {\n      if (event == 'ready') return $(document).ready(fn)\n      var handler = parse(event)\n      handler.fn = fn\n      handler.sel = selector\n      // emulate mouseenter, mouseleave\n      if (handler.e in hover) fn = function (e) {\n        var related = e.relatedTarget\n        if (!related || (related !== this && !$.contains(this, related)))\n          return handler.fn.apply(this, arguments)\n      }\n      handler.del = delegator\n      var callback = delegator || fn\n      handler.proxy = function (e) {\n        e = compatible(e)\n        if (e.isImmediatePropagationStopped()) return\n        e.data = data\n        var result = callback.apply(element, e._args == undefined ? [e] : [e].concat(e._args))\n        if (result === false) e.preventDefault(), e.stopPropagation()\n        return result\n      }\n      handler.i = set.length\n      set.push(handler)\n      if ('addEventListener' in element)\n        element.addEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture))\n    })\n  }\n\n  function remove(element, events, fn, selector, capture) {\n    var id = zid(element)\n      ;\n    (events || '').split(/\\s/).forEach(function (event) {\n      findHandlers(element, event, fn, selector).forEach(function (handler) {\n        delete handlers[id][handler.i]\n        if ('removeEventListener' in element)\n          element.removeEventListener(realEvent(handler.e), handler.proxy, eventCapture(handler, capture))\n      })\n    })\n  }\n\n  $.event = {add: add, remove: remove}\n\n  $.proxy = function (fn, context) {\n    var args = (2 in arguments) && slice.call(arguments, 2)\n    if (isFunction(fn)) {\n      var proxyFn = function () {\n        return fn.apply(context, args ? args.concat(slice.call(arguments)) : arguments)\n      }\n      proxyFn._zid = zid(fn)\n      return proxyFn\n    } else if (isString(context)) {\n      if (args) {\n        args.unshift(fn[context], fn)\n        return $.proxy.apply(null, args)\n      } else {\n        return $.proxy(fn[context], fn)\n      }\n    } else {\n      throw new TypeError(\"expected function\")\n    }\n  }\n\n  $.fn.bind = function (event, data, callback) {\n    return this.on(event, data, callback)\n  }\n  $.fn.unbind = function (event, callback) {\n    return this.off(event, callback)\n  }\n  $.fn.one = function (event, selector, data, callback) {\n    return this.on(event, selector, data, callback, 1)\n  }\n\n  var returnTrue = function () {\n      return true\n    },\n    returnFalse = function () {\n      return false\n    },\n    ignoreProperties = /^([A-Z]|returnValue$|layer[XY]$)/,\n    eventMethods = {\n      preventDefault: 'isDefaultPrevented',\n      stopImmediatePropagation: 'isImmediatePropagationStopped',\n      stopPropagation: 'isPropagationStopped'\n    }\n\n  function compatible(event, source) {\n    if (source || !event.isDefaultPrevented) {\n      source || (source = event)\n\n      $.each(eventMethods, function (name, predicate) {\n        var sourceMethod = source[name]\n        event[name] = function () {\n          this[predicate] = returnTrue\n          return sourceMethod && sourceMethod.apply(source, arguments)\n        }\n        event[predicate] = returnFalse\n      })\n\n      if (source.defaultPrevented !== undefined ? source.defaultPrevented :\n          'returnValue' in source ? source.returnValue === false :\n          source.getPreventDefault && source.getPreventDefault())\n        event.isDefaultPrevented = returnTrue\n    }\n    return event\n  }\n\n  function createProxy(event) {\n    var key, proxy = {originalEvent: event}\n    for (key in event)\n      if (!ignoreProperties.test(key) && event[key] !== undefined) proxy[key] = event[key]\n\n    return compatible(proxy, event)\n  }\n\n  $.fn.delegate = function (selector, event, callback) {\n    return this.on(event, selector, callback)\n  }\n  $.fn.undelegate = function (selector, event, callback) {\n    return this.off(event, selector, callback)\n  }\n\n  $.fn.live = function (event, callback) {\n    $(document.body).delegate(this.selector, event, callback)\n    return this\n  }\n  $.fn.die = function (event, callback) {\n    $(document.body).undelegate(this.selector, event, callback)\n    return this\n  }\n\n  $.fn.on = function (event, selector, data, callback, one) {\n    var autoRemove, delegator, $this = this\n    if (event && !isString(event)) {\n      $.each(event, function (type, fn) {\n        $this.on(type, selector, data, fn, one)\n      })\n      return $this\n    }\n\n    if (!isString(selector) && !isFunction(callback) && callback !== false)\n      callback = data, data = selector, selector = undefined\n    if (isFunction(data) || data === false)\n      callback = data, data = undefined\n\n    if (callback === false) callback = returnFalse\n\n    return $this.each(function (_, element) {\n      if (one) autoRemove = function (e) {\n        remove(element, e.type, callback)\n        return callback.apply(this, arguments)\n      }\n\n      if (selector) delegator = function (e) {\n        var evt, match = $(e.target).closest(selector, element).get(0)\n        if (match && match !== element) {\n          evt = $.extend(createProxy(e), {currentTarget: match, liveFired: element})\n          return (autoRemove || callback).apply(match, [evt].concat(slice.call(arguments, 1)))\n        }\n      }\n\n      add(element, event, callback, data, selector, delegator || autoRemove)\n    })\n  }\n  $.fn.off = function (event, selector, callback) {\n    var $this = this\n    if (event && !isString(event)) {\n      $.each(event, function (type, fn) {\n        $this.off(type, selector, fn)\n      })\n      return $this\n    }\n\n    if (!isString(selector) && !isFunction(callback) && callback !== false)\n      callback = selector, selector = undefined\n\n    if (callback === false) callback = returnFalse\n\n    return $this.each(function () {\n      remove(this, event, callback, selector)\n    })\n  }\n\n  $.fn.trigger = function (event, args) {\n    event = (isString(event) || $.isPlainObject(event)) ? $.Event(event) : compatible(event)\n    event._args = args\n    return this.each(function () {\n      // handle focus(), blur() by calling them directly\n      if (event.type in focus && typeof this[event.type] == \"function\") this[event.type]()\n      // items in the collection might not be DOM elements\n      else if ('dispatchEvent' in this) this.dispatchEvent(event)\n      else $(this).triggerHandler(event, args)\n    })\n  }\n\n  // triggers event handlers on current element just as if an event occurred,\n  // doesn't trigger an actual event, doesn't bubble\n  $.fn.triggerHandler = function (event, args) {\n    var e, result\n    this.each(function (i, element) {\n      e = createProxy(isString(event) ? $.Event(event) : event)\n      e._args = args\n      e.target = element\n      $.each(findHandlers(element, event.type || event), function (i, handler) {\n        result = handler.proxy(e)\n        if (e.isImmediatePropagationStopped()) return false\n      })\n    })\n    return result\n  }\n\n    // shortcut methods for `.bind(event, fn)` for each event type\n  ;\n  ('focusin focusout focus blur load resize scroll unload click dblclick ' +\n  'mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave ' +\n  'change select keydown keypress keyup error').split(' ').forEach(function (event) {\n    $.fn[event] = function (callback) {\n      return (0 in arguments) ?\n        this.bind(event, callback) :\n        this.trigger(event)\n    }\n  })\n\n  $.Event = function (type, props) {\n    if (!isString(type)) props = type, type = props.type\n    var event = document.createEvent(specialEvents[type] || 'Events'), bubbles = true\n    if (props) for (var name in props) (name == 'bubbles') ? (bubbles = !!props[name]) : (event[name] = props[name])\n    event.initEvent(type, bubbles, true)\n    return compatible(event)\n  }\n\n})(Zepto)\n\n;\n(function ($) {\n  var jsonpID = 0,\n    document = window.document,\n    key,\n    name,\n    rscript = /<script\\b[^<]*(?:(?!<\\/script>)<[^<]*)*<\\/script>/gi,\n    scriptTypeRE = /^(?:text|application)\\/javascript/i,\n    xmlTypeRE = /^(?:text|application)\\/xml/i,\n    jsonType = 'application/json',\n    htmlType = 'text/html',\n    blankRE = /^\\s*$/,\n    originAnchor = document.createElement('a')\n\n  originAnchor.href = window.location.href\n\n  // trigger a custom event and return false if it was cancelled\n  function triggerAndReturn(context, eventName, data) {\n    var event = $.Event(eventName)\n    $(context).trigger(event, data)\n    return !event.isDefaultPrevented()\n  }\n\n  // trigger an Ajax \"global\" event\n  function triggerGlobal(settings, context, eventName, data) {\n    if (settings.global) return triggerAndReturn(context || document, eventName, data)\n  }\n\n  // Number of active Ajax requests\n  $.active = 0\n\n  function ajaxStart(settings) {\n    if (settings.global && $.active++ === 0) triggerGlobal(settings, null, 'ajaxStart')\n  }\n\n  function ajaxStop(settings) {\n    if (settings.global && !(--$.active)) triggerGlobal(settings, null, 'ajaxStop')\n  }\n\n  // triggers an extra global event \"ajaxBeforeSend\" that's like \"ajaxSend\" but cancelable\n  function ajaxBeforeSend(xhr, settings) {\n    var context = settings.context\n    if (settings.beforeSend.call(context, xhr, settings) === false ||\n      triggerGlobal(settings, context, 'ajaxBeforeSend', [xhr, settings]) === false)\n      return false\n\n    triggerGlobal(settings, context, 'ajaxSend', [xhr, settings])\n  }\n\n  function ajaxSuccess(data, xhr, settings, deferred) {\n    var context = settings.context, status = 'success'\n    settings.success.call(context, data, status, xhr)\n    if (deferred) deferred.resolveWith(context, [data, status, xhr])\n    triggerGlobal(settings, context, 'ajaxSuccess', [xhr, settings, data])\n    ajaxComplete(status, xhr, settings)\n  }\n\n  // type: \"timeout\", \"error\", \"abort\", \"parsererror\"\n  function ajaxError(error, type, xhr, settings, deferred) {\n    var context = settings.context\n    settings.error.call(context, xhr, type, error)\n    if (deferred) deferred.rejectWith(context, [xhr, type, error])\n    triggerGlobal(settings, context, 'ajaxError', [xhr, settings, error || type])\n    ajaxComplete(type, xhr, settings)\n  }\n\n  // status: \"success\", \"notmodified\", \"error\", \"timeout\", \"abort\", \"parsererror\"\n  function ajaxComplete(status, xhr, settings) {\n    var context = settings.context\n    settings.complete.call(context, xhr, status)\n    triggerGlobal(settings, context, 'ajaxComplete', [xhr, settings])\n    ajaxStop(settings)\n  }\n\n  // Empty function, used as default callback\n  function empty() {\n  }\n\n  $.ajaxJSONP = function (options, deferred) {\n    if (!('type' in options)) return $.ajax(options)\n\n    var _callbackName = options.jsonpCallback,\n      callbackName = ($.isFunction(_callbackName) ?\n          _callbackName() : _callbackName) || ('jsonp' + (++jsonpID)),\n      script = document.createElement('script'),\n      originalCallback = window[callbackName],\n      responseData,\n      abort = function (errorType) {\n        $(script).triggerHandler('error', errorType || 'abort')\n      },\n      xhr = {abort: abort}, abortTimeout\n\n    if (deferred) deferred.promise(xhr)\n\n    $(script).on('load error', function (e, errorType) {\n      clearTimeout(abortTimeout)\n      $(script).off().remove()\n\n      if (e.type == 'error' || !responseData) {\n        ajaxError(null, errorType || 'error', xhr, options, deferred)\n      } else {\n        ajaxSuccess(responseData[0], xhr, options, deferred)\n      }\n\n      window[callbackName] = originalCallback\n      if (responseData && $.isFunction(originalCallback))\n        originalCallback(responseData[0])\n\n      originalCallback = responseData = undefined\n    })\n\n    if (ajaxBeforeSend(xhr, options) === false) {\n      abort('abort')\n      return xhr\n    }\n\n    window[callbackName] = function () {\n      responseData = arguments\n    }\n\n    script.src = options.url.replace(/\\?(.+)=\\?/, '?$1=' + callbackName)\n    document.head.appendChild(script)\n\n    if (options.timeout > 0) abortTimeout = setTimeout(function () {\n      abort('timeout')\n    }, options.timeout)\n\n    return xhr\n  }\n\n  $.ajaxSettings = {\n    // Default type of request\n    type: 'GET',\n    // Callback that is executed before request\n    beforeSend: empty,\n    // Callback that is executed if the request succeeds\n    success: empty,\n    // Callback that is executed the the server drops error\n    error: empty,\n    // Callback that is executed on request complete (both: error and success)\n    complete: empty,\n    // The context for the callbacks\n    context: null,\n    // Whether to trigger \"global\" Ajax events\n    global: true,\n    // Transport\n    xhr: function () {\n      return new window.XMLHttpRequest()\n    },\n    // MIME types mapping\n    // IIS returns Javascript as \"application/x-javascript\"\n    accepts: {\n      script: 'text/javascript, application/javascript, application/x-javascript',\n      json: jsonType,\n      xml: 'application/xml, text/xml',\n      html: htmlType,\n      text: 'text/plain'\n    },\n    // Whether the request is to another domain\n    crossDomain: false,\n    // Default timeout\n    timeout: 0,\n    // Whether data should be serialized to string\n    processData: true,\n    // Whether the browser should be allowed to cache GET responses\n    cache: true\n  }\n\n  function mimeToDataType(mime) {\n    if (mime) mime = mime.split(';', 2)[0]\n    return mime && ( mime == htmlType ? 'html' :\n        mime == jsonType ? 'json' :\n          scriptTypeRE.test(mime) ? 'script' :\n          xmlTypeRE.test(mime) && 'xml' ) || 'text'\n  }\n\n  function appendQuery(url, query) {\n    if (query == '') return url\n    return (url + '&' + query).replace(/[&?]{1,2}/, '?')\n  }\n\n  // serialize payload and append it to the URL for GET requests\n  function serializeData(options) {\n    if (options.processData && options.data && $.type(options.data) != \"string\")\n      options.data = $.param(options.data, options.traditional)\n    if (options.data && (!options.type || options.type.toUpperCase() == 'GET'))\n      options.url = appendQuery(options.url, options.data), options.data = undefined\n  }\n\n  $.ajax = function (options) {\n    var settings = $.extend({}, options || {}),\n      deferred = $.Deferred && $.Deferred(),\n      urlAnchor\n    for (key in $.ajaxSettings) if (settings[key] === undefined) settings[key] = $.ajaxSettings[key]\n\n    ajaxStart(settings)\n\n    if (!settings.crossDomain) {\n      urlAnchor = document.createElement('a')\n      urlAnchor.href = settings.url\n      urlAnchor.href = urlAnchor.href\n      settings.crossDomain = (originAnchor.protocol + '//' + originAnchor.host) !== (urlAnchor.protocol + '//' + urlAnchor.host)\n    }\n\n    if (!settings.url) settings.url = window.location.toString()\n    serializeData(settings)\n\n    var dataType = settings.dataType, hasPlaceholder = /\\?.+=\\?/.test(settings.url)\n    if (hasPlaceholder) dataType = 'jsonp'\n\n    if (settings.cache === false || (\n        (!options || options.cache !== true) &&\n        ('script' == dataType || 'jsonp' == dataType)\n      ))\n      settings.url = appendQuery(settings.url, '_=' + Date.now())\n\n    if ('jsonp' == dataType) {\n      if (!hasPlaceholder)\n        settings.url = appendQuery(settings.url,\n          settings.jsonp ? (settings.jsonp + '=?') : settings.jsonp === false ? '' : 'callback=?')\n      return $.ajaxJSONP(settings, deferred)\n    }\n\n    var mime = settings.accepts[dataType],\n      headers = {},\n      setHeader = function (name, value) {\n        headers[name.toLowerCase()] = [name, value]\n      },\n      protocol = /^([\\w-]+:)\\/\\//.test(settings.url) ? RegExp.$1 : window.location.protocol,\n      xhr = settings.xhr(),\n      nativeSetHeader = xhr.setRequestHeader,\n      abortTimeout\n\n    if (deferred) deferred.promise(xhr)\n\n    if (!settings.crossDomain) setHeader('X-Requested-With', 'XMLHttpRequest')\n    setHeader('Accept', mime || '*/*')\n    if (mime = settings.mimeType || mime) {\n      if (mime.indexOf(',') > -1) mime = mime.split(',', 2)[0]\n      xhr.overrideMimeType && xhr.overrideMimeType(mime)\n    }\n    if (settings.contentType || (settings.contentType !== false && settings.data && settings.type.toUpperCase() != 'GET'))\n      setHeader('Content-Type', settings.contentType || 'application/x-www-form-urlencoded')\n\n    if (settings.headers) for (name in settings.headers) setHeader(name, settings.headers[name])\n    xhr.setRequestHeader = setHeader\n\n    xhr.onreadystatechange = function () {\n      if (xhr.readyState == 4) {\n        xhr.onreadystatechange = empty\n        clearTimeout(abortTimeout)\n        var result, error = false\n        if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304 || (xhr.status == 0 && protocol == 'file:')) {\n          dataType = dataType || mimeToDataType(settings.mimeType || xhr.getResponseHeader('content-type'))\n          result = xhr.responseText\n\n          try {\n            // http://perfectionkills.com/global-eval-what-are-the-options/\n            if (dataType == 'script')    (1, eval)(result)\n            else if (dataType == 'xml')  result = xhr.responseXML\n            else if (dataType == 'json') result = blankRE.test(result) ? null : $.parseJSON(result)\n          } catch (e) {\n            error = e\n          }\n\n          if (error) ajaxError(error, 'parsererror', xhr, settings, deferred)\n          else ajaxSuccess(result, xhr, settings, deferred)\n        } else {\n          ajaxError(xhr.statusText || null, xhr.status ? 'error' : 'abort', xhr, settings, deferred)\n        }\n      }\n    }\n\n    if (ajaxBeforeSend(xhr, settings) === false) {\n      xhr.abort()\n      ajaxError(null, 'abort', xhr, settings, deferred)\n      return xhr\n    }\n\n    if (settings.xhrFields) for (name in settings.xhrFields) xhr[name] = settings.xhrFields[name]\n\n    var async = 'async' in settings ? settings.async : true\n    xhr.open(settings.type, settings.url, async, settings.username, settings.password)\n\n    for (name in headers) nativeSetHeader.apply(xhr, headers[name])\n\n    if (settings.timeout > 0) abortTimeout = setTimeout(function () {\n      xhr.onreadystatechange = empty\n      xhr.abort()\n      ajaxError(null, 'timeout', xhr, settings, deferred)\n    }, settings.timeout)\n\n    // avoid sending empty string (#319)\n    xhr.send(settings.data ? settings.data : null)\n    return xhr\n  }\n\n  // handle optional data/success arguments\n  function parseArguments(url, data, success, dataType) {\n    if ($.isFunction(data)) dataType = success, success = data, data = undefined\n    if (!$.isFunction(success)) dataType = success, success = undefined\n    return {\n      url: url\n      , data: data\n      , success: success\n      , dataType: dataType\n    }\n  }\n\n  $.get = function (/* url, data, success, dataType */) {\n    return $.ajax(parseArguments.apply(null, arguments))\n  }\n\n  $.post = function (/* url, data, success, dataType */) {\n    var options = parseArguments.apply(null, arguments)\n    options.type = 'POST'\n    return $.ajax(options)\n  }\n\n  $.getJSON = function (/* url, data, success */) {\n    var options = parseArguments.apply(null, arguments)\n    options.dataType = 'json'\n    return $.ajax(options)\n  }\n\n  $.fn.load = function (url, data, success) {\n    if (!this.length) return this\n    var self = this, parts = url.split(/\\s/), selector,\n      options = parseArguments(url, data, success),\n      callback = options.success\n    if (parts.length > 1) options.url = parts[0], selector = parts[1]\n    options.success = function (response) {\n      self.html(selector ?\n        $('<div>').html(response.replace(rscript, \"\")).find(selector)\n        : response)\n      callback && callback.apply(self, arguments)\n    }\n    $.ajax(options)\n    return this\n  }\n\n  var escape = encodeURIComponent\n\n  function serialize(params, obj, traditional, scope) {\n    var type, array = $.isArray(obj), hash = $.isPlainObject(obj)\n    $.each(obj, function (key, value) {\n      type = $.type(value)\n      if (scope) key = traditional ? scope :\n      scope + '[' + (hash || type == 'object' || type == 'array' ? key : '') + ']'\n      // handle data in serializeArray() format\n      if (!scope && array) params.add(value.name, value.value)\n      // recurse into nested objects\n      else if (type == \"array\" || (!traditional && type == \"object\"))\n        serialize(params, value, traditional, key)\n      else params.add(key, value)\n    })\n  }\n\n  $.param = function (obj, traditional) {\n    var params = []\n    params.add = function (key, value) {\n      if ($.isFunction(value)) value = value()\n      if (value == null) value = \"\"\n      this.push(escape(key) + '=' + escape(value))\n    }\n    serialize(params, obj, traditional)\n    return params.join('&').replace(/%20/g, '+')\n  }\n})(Zepto)\n\n;\n(function ($) {\n  $.fn.serializeArray = function () {\n    var name, type, result = [],\n      add = function (value) {\n        if (value.forEach) return value.forEach(add)\n        result.push({name: name, value: value})\n      }\n    if (this[0]) $.each(this[0].elements, function (_, field) {\n      type = field.type, name = field.name\n      if (name && field.nodeName.toLowerCase() != 'fieldset' && !field.disabled && type != 'submit' && type != 'reset' && type != 'button' && type != 'file' &&\n        ((type != 'radio' && type != 'checkbox') || field.checked))\n        add($(field).val())\n    })\n    return result\n  }\n\n  $.fn.serialize = function () {\n    var result = []\n    this.serializeArray().forEach(function (elm) {\n      result.push(encodeURIComponent(elm.name) + '=' + encodeURIComponent(elm.value))\n    })\n    return result.join('&')\n  }\n\n  $.fn.submit = function (callback) {\n    if (0 in arguments) this.bind('submit', callback)\n    else if (this.length) {\n      var event = $.Event('submit')\n      this.eq(0).trigger(event)\n      if (!event.isDefaultPrevented()) this.get(0).submit()\n    }\n    return this\n  }\n\n})(Zepto)\n\n;\n(function ($) {\n  // __proto__ doesn't exist on IE<11, so redefine\n  // the Z function to use object extension instead\n  if (!('__proto__' in {})) {\n    $.extend($.zepto, {\n      Z: function (dom, selector) {\n        dom = dom || []\n        $.extend(dom, $.fn)\n        dom.selector = selector || ''\n        dom.__Z = true\n        return dom\n      },\n      // this is a kludge but works\n      isZ: function (object) {\n        return $.type(object) === 'array' && '__Z' in object\n      }\n    })\n  }\n\n  // getComputedStyle shouldn't freak out when called\n  // without a valid element as argument\n  try {\n    getComputedStyle(undefined)\n  } catch (e) {\n    var nativeGetComputedStyle = getComputedStyle;\n    window.getComputedStyle = function (element) {\n      try {\n        return nativeGetComputedStyle(element)\n      } catch (e) {\n        return null\n      }\n    }\n  }\n})(Zepto)\n\n;\n(function ($) {\n  function detect(ua, platform) {\n    var os = this.os = {}, browser = this.browser = {},\n      webkit = ua.match(/Web[kK]it[\\/]{0,1}([\\d.]+)/),\n      android = ua.match(/(Android);?[\\s\\/]+([\\d.]+)?/),\n      osx = !!ua.match(/\\(Macintosh\\; Intel /),\n      ipad = ua.match(/(iPad).*OS\\s([\\d_]+)/),\n      ipod = ua.match(/(iPod)(.*OS\\s([\\d_]+))?/),\n      iphone = !ipad && ua.match(/(iPhone\\sOS)\\s([\\d_]+)/),\n      webos = ua.match(/(webOS|hpwOS)[\\s\\/]([\\d.]+)/),\n      win = /Win\\d{2}|Windows/.test(platform),\n      wp = ua.match(/Windows Phone ([\\d.]+)/),\n      touchpad = webos && ua.match(/TouchPad/),\n      kindle = ua.match(/Kindle\\/([\\d.]+)/),\n      silk = ua.match(/Silk\\/([\\d._]+)/),\n      blackberry = ua.match(/(BlackBerry).*Version\\/([\\d.]+)/),\n      bb10 = ua.match(/(BB10).*Version\\/([\\d.]+)/),\n      rimtabletos = ua.match(/(RIM\\sTablet\\sOS)\\s([\\d.]+)/),\n      playbook = ua.match(/PlayBook/),\n      chrome = ua.match(/Chrome\\/([\\d.]+)/) || ua.match(/CriOS\\/([\\d.]+)/),\n      firefox = ua.match(/Firefox\\/([\\d.]+)/),\n      ie = ua.match(/MSIE\\s([\\d.]+)/) || ua.match(/Trident\\/[\\d](?=[^\\?]+).*rv:([0-9.].)/),\n      webview = !chrome && ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/),\n      safari = webview || ua.match(/Version\\/([\\d.]+)([^S](Safari)|[^M]*(Mobile)[^S]*(Safari))/)\n\n    // Todo: clean this up with a better OS/browser seperation:\n    // - discern (more) between multiple browsers on android\n    // - decide if kindle fire in silk mode is android or not\n    // - Firefox on Android doesn't specify the Android version\n    // - possibly devide in os, device and browser hashes\n\n    if (browser.webkit = !!webkit) browser.version = webkit[1]\n\n    if (android) os.android = true, os.version = android[2]\n    if (iphone && !ipod) os.ios = os.iphone = true, os.version = iphone[2].replace(/_/g, '.')\n    if (ipad) os.ios = os.ipad = true, os.version = ipad[2].replace(/_/g, '.')\n    if (ipod) os.ios = os.ipod = true, os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null\n    if (wp) os.wp = true, os.version = wp[1]\n    if (webos) os.webos = true, os.version = webos[2]\n    if (touchpad) os.touchpad = true\n    if (blackberry) os.blackberry = true, os.version = blackberry[2]\n    if (bb10) os.bb10 = true, os.version = bb10[2]\n    if (rimtabletos) os.rimtabletos = true, os.version = rimtabletos[2]\n    if (playbook) browser.playbook = true\n    if (kindle) os.kindle = true, os.version = kindle[1]\n    if (silk) browser.silk = true, browser.version = silk[1]\n    if (!silk && os.android && ua.match(/Kindle Fire/)) browser.silk = true\n    if (chrome) browser.chrome = true, browser.version = chrome[1]\n    if (firefox) browser.firefox = true, browser.version = firefox[1]\n    if (ie) browser.ie = true, browser.version = ie[1]\n    if (safari && (osx || os.ios || win)) {\n      browser.safari = true\n      if (!os.ios) browser.version = safari[1]\n    }\n    if (webview) browser.webview = true\n\n    os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) ||\n    (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/)))\n    os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || blackberry || bb10 ||\n    (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\\/([\\d.]+)/)) ||\n    (firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/))))\n  }\n\n  detect.call($, navigator.userAgent, navigator.platform)\n  // make available to unit tests\n  $.__detect = detect\n\n})(Zepto)\n\n;\n(function ($, undefined) {\n  var prefix = '', eventPrefix, endEventName, endAnimationName,\n    vendors = {Webkit: 'webkit', Moz: '', O: 'o'},\n    document = window.document, testEl = document.createElement('div'),\n    supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,\n    transform,\n    transitionProperty, transitionDuration, transitionTiming, transitionDelay,\n    animationName, animationDuration, animationTiming, animationDelay,\n    cssReset = {}\n\n  function dasherize(str) {\n    return str.replace(/([a-z])([A-Z])/, '$1-$2').toLowerCase()\n  }\n\n  function normalizeEvent(name) {\n    return eventPrefix ? eventPrefix + name : name.toLowerCase()\n  }\n\n  $.each(vendors, function (vendor, event) {\n    if (testEl.style[vendor + 'TransitionProperty'] !== undefined) {\n      prefix = '-' + vendor.toLowerCase() + '-'\n      eventPrefix = event\n      return false\n    }\n  })\n\n  transform = prefix + 'transform'\n  cssReset[transitionProperty = prefix + 'transition-property'] =\n    cssReset[transitionDuration = prefix + 'transition-duration'] =\n      cssReset[transitionDelay = prefix + 'transition-delay'] =\n        cssReset[transitionTiming = prefix + 'transition-timing-function'] =\n          cssReset[animationName = prefix + 'animation-name'] =\n            cssReset[animationDuration = prefix + 'animation-duration'] =\n              cssReset[animationDelay = prefix + 'animation-delay'] =\n                cssReset[animationTiming = prefix + 'animation-timing-function'] = ''\n\n  $.fx = {\n    off: (eventPrefix === undefined && testEl.style.transitionProperty === undefined),\n    speeds: {_default: 400, fast: 200, slow: 600},\n    cssPrefix: prefix,\n    transitionEnd: normalizeEvent('TransitionEnd'),\n    animationEnd: normalizeEvent('AnimationEnd')\n  }\n\n  $.fn.animate = function (properties, duration, ease, callback, delay) {\n    if ($.isFunction(duration))\n      callback = duration, ease = undefined, duration = undefined\n    if ($.isFunction(ease))\n      callback = ease, ease = undefined\n    if ($.isPlainObject(duration))\n      ease = duration.easing, callback = duration.complete, delay = duration.delay, duration = duration.duration\n    if (duration) duration = (typeof duration == 'number' ? duration :\n        ($.fx.speeds[duration] || $.fx.speeds._default)) / 1000\n    if (delay) delay = parseFloat(delay) / 1000\n    return this.anim(properties, duration, ease, callback, delay)\n  }\n\n  $.fn.anim = function (properties, duration, ease, callback, delay) {\n    var key, cssValues = {}, cssProperties, transforms = '',\n      that = this, wrappedCallback, endEvent = $.fx.transitionEnd,\n      fired = false\n\n    if (duration === undefined) duration = $.fx.speeds._default / 1000\n    if (delay === undefined) delay = 0\n    if ($.fx.off) duration = 0\n\n    if (typeof properties == 'string') {\n      // keyframe animation\n      cssValues[animationName] = properties\n      cssValues[animationDuration] = duration + 's'\n      cssValues[animationDelay] = delay + 's'\n      cssValues[animationTiming] = (ease || 'linear')\n      endEvent = $.fx.animationEnd\n    } else {\n      cssProperties = []\n      // CSS transitions\n      for (key in properties)\n        if (supportedTransforms.test(key)) transforms += key + '(' + properties[key] + ') '\n        else cssValues[key] = properties[key], cssProperties.push(dasherize(key))\n\n      if (transforms) cssValues[transform] = transforms, cssProperties.push(transform)\n      if (duration > 0 && typeof properties === 'object') {\n        cssValues[transitionProperty] = cssProperties.join(', ')\n        cssValues[transitionDuration] = duration + 's'\n        cssValues[transitionDelay] = delay + 's'\n        cssValues[transitionTiming] = (ease || 'linear')\n      }\n    }\n\n    wrappedCallback = function (event) {\n      if (typeof event !== 'undefined') {\n        if (event.target !== event.currentTarget) return // makes sure the event didn't bubble from \"below\"\n        $(event.target).unbind(endEvent, wrappedCallback)\n      } else\n        $(this).unbind(endEvent, wrappedCallback) // triggered by setTimeout\n\n      fired = true\n      $(this).css(cssReset)\n      callback && callback.call(this)\n    }\n    if (duration > 0) {\n      this.bind(endEvent, wrappedCallback)\n      // transitionEnd is not always firing on older Android phones\n      // so make sure it gets fired\n      setTimeout(function () {\n        if (fired) return\n        wrappedCallback.call(that)\n      }, ((duration + delay) * 1000) + 25)\n    }\n\n    // trigger page reflow so new elements can animate\n    this.size() && this.get(0).clientLeft\n\n    this.css(cssValues)\n\n    if (duration <= 0) setTimeout(function () {\n      that.each(function () {\n        wrappedCallback.call(this)\n      })\n    }, 0)\n\n    return this\n  }\n\n  testEl = null\n})(Zepto)\n\n;\n(function ($) {\n  var touch = {},\n    touchTimeout, tapTimeout, swipeTimeout, longTapTimeout,\n    longTapDelay = 750,\n    gesture\n\n  function swipeDirection(x1, x2, y1, y2) {\n    return Math.abs(x1 - x2) >=\n    Math.abs(y1 - y2) ? (x1 - x2 > 0 ? 'Left' : 'Right') : (y1 - y2 > 0 ? 'Up' : 'Down')\n  }\n\n  function longTap() {\n    longTapTimeout = null\n    if (touch.last) {\n      touch.el.trigger('longTap')\n      touch = {}\n    }\n  }\n\n  function cancelLongTap() {\n    if (longTapTimeout) clearTimeout(longTapTimeout)\n    longTapTimeout = null\n  }\n\n  function cancelAll() {\n    if (touchTimeout) clearTimeout(touchTimeout)\n    if (tapTimeout) clearTimeout(tapTimeout)\n    if (swipeTimeout) clearTimeout(swipeTimeout)\n    if (longTapTimeout) clearTimeout(longTapTimeout)\n    touchTimeout = tapTimeout = swipeTimeout = longTapTimeout = null\n    touch = {}\n  }\n\n  function isPrimaryTouch(event) {\n    return (event.pointerType == 'touch' ||\n      event.pointerType == event.MSPOINTER_TYPE_TOUCH)\n      && event.isPrimary\n  }\n\n  function isPointerEventType(e, type) {\n    return (e.type == 'pointer' + type ||\n    e.type.toLowerCase() == 'mspointer' + type)\n  }\n\n  $(document).ready(function () {\n    var now, delta, deltaX = 0, deltaY = 0, firstTouch, _isPointerType\n\n    if ('MSGesture' in window) {\n      gesture = new MSGesture()\n      gesture.target = document.body\n    }\n\n    $(document)\n      .bind('MSGestureEnd', function (e) {\n        var swipeDirectionFromVelocity =\n          e.velocityX > 1 ? 'Right' : e.velocityX < -1 ? 'Left' : e.velocityY > 1 ? 'Down' : e.velocityY < -1 ? 'Up' : null;\n        if (swipeDirectionFromVelocity) {\n          touch.el.trigger('swipe')\n          touch.el.trigger('swipe' + swipeDirectionFromVelocity)\n        }\n      })\n      .on('touchstart MSPointerDown pointerdown', function (e) {\n        if ((_isPointerType = isPointerEventType(e, 'down')) && !isPrimaryTouch(e)) return\n        firstTouch = _isPointerType ? e : e.touches[0]\n        if (e.touches && e.touches.length === 1 && touch.x2) {\n          // Clear out touch movement data if we have it sticking around\n          // This can occur if touchcancel doesn't fire due to preventDefault, etc.\n          touch.x2 = undefined\n          touch.y2 = undefined\n        }\n        now = Date.now()\n        delta = now - (touch.last || now)\n        touch.el = $('tagName' in firstTouch.target ?\n          firstTouch.target : firstTouch.target.parentNode)\n        touchTimeout && clearTimeout(touchTimeout)\n        touch.x1 = firstTouch.pageX\n        touch.y1 = firstTouch.pageY\n        if (delta > 0 && delta <= 250) touch.isDoubleTap = true\n        touch.last = now\n        longTapTimeout = setTimeout(longTap, longTapDelay)\n        // adds the current touch contact for IE gesture recognition\n        if (gesture && _isPointerType) gesture.addPointer(e.pointerId);\n      })\n      .on('touchmove MSPointerMove pointermove', function (e) {\n        if ((_isPointerType = isPointerEventType(e, 'move')) && !isPrimaryTouch(e)) return\n        firstTouch = _isPointerType ? e : e.touches[0]\n        cancelLongTap()\n        touch.x2 = firstTouch.pageX\n        touch.y2 = firstTouch.pageY\n\n        deltaX += Math.abs(touch.x1 - touch.x2)\n        deltaY += Math.abs(touch.y1 - touch.y2)\n      })\n      .on('touchend MSPointerUp pointerup', function (e) {\n        if ((_isPointerType = isPointerEventType(e, 'up')) && !isPrimaryTouch(e)) return\n        cancelLongTap()\n\n        // swipe\n        if ((touch.x2 && Math.abs(touch.x1 - touch.x2) > 30) ||\n          (touch.y2 && Math.abs(touch.y1 - touch.y2) > 30))\n\n          swipeTimeout = setTimeout(function () {\n            touch.el.trigger('swipe')\n            touch.el.trigger('swipe' + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2)))\n            touch = {}\n          }, 0)\n\n        // normal tap\n        else if ('last' in touch)\n        // don't fire tap when delta position changed by more than 30 pixels,\n        // for instance when moving to a point and back to origin\n          if (deltaX < 30 && deltaY < 30) {\n            // delay by one tick so we can cancel the 'tap' event if 'scroll' fires\n            // ('tap' fires before 'scroll')\n            tapTimeout = setTimeout(function () {\n\n              // trigger universal 'tap' with the option to cancelTouch()\n              // (cancelTouch cancels processing of single vs double taps for faster 'tap' response)\n              var event = $.Event('tap')\n              event.cancelTouch = cancelAll\n              touch.el.trigger(event)\n\n              // trigger double tap immediately\n              if (touch.isDoubleTap) {\n                if (touch.el) touch.el.trigger('doubleTap')\n                touch = {}\n              }\n\n              // trigger single tap after 250ms of inactivity\n              else {\n                touchTimeout = setTimeout(function () {\n                  touchTimeout = null\n                  if (touch.el) touch.el.trigger('singleTap')\n                  touch = {}\n                }, 250)\n              }\n            }, 0)\n          } else {\n            touch = {}\n          }\n        deltaX = deltaY = 0\n\n      })\n      // when the browser window loses focus,\n      // for example when a modal dialog is shown,\n      // cancel all ongoing events\n      .on('touchcancel MSPointerCancel pointercancel', cancelAll)\n\n    // scrolling the window indicates intention of the user\n    // to scroll, not tap or swipe, so cancel all ongoing events\n    $(window).on('scroll', cancelAll)\n  })\n\n  ;\n  ['swipe', 'swipeLeft', 'swipeRight', 'swipeUp', 'swipeDown',\n    'doubleTap', 'tap', 'singleTap', 'longTap'].forEach(function (eventName) {\n    $.fn[eventName] = function (callback) {\n      return this.on(eventName, callback)\n    }\n  })\n})(Zepto)\n\n;\n(function ($) {\n  if ($.os.ios) {\n    var gesture = {}, gestureTimeout\n\n    function parentIfText(node) {\n      return 'tagName' in node ? node : node.parentNode\n    }\n\n    $(document).bind('gesturestart', function (e) {\n      var now = Date.now(), delta = now - (gesture.last || now)\n      gesture.target = parentIfText(e.target)\n      gestureTimeout && clearTimeout(gestureTimeout)\n      gesture.e1 = e.scale\n      gesture.last = now\n    }).bind('gesturechange', function (e) {\n      gesture.e2 = e.scale\n    }).bind('gestureend', function (e) {\n      if (gesture.e2 > 0) {\n        Math.abs(gesture.e1 - gesture.e2) != 0 && $(gesture.target).trigger('pinch') &&\n        $(gesture.target).trigger('pinch' + (gesture.e1 - gesture.e2 > 0 ? 'In' : 'Out'))\n        gesture.e1 = gesture.e2 = gesture.last = 0\n      } else if ('last' in gesture) {\n        gesture = {}\n      }\n    })\n\n    ;\n    ['pinch', 'pinchIn', 'pinchOut'].forEach(function (m) {\n      $.fn[m] = function (callback) {\n        return this.bind(m, callback)\n      }\n    })\n  }\n})(Zepto)\n\n;\n(function ($) {\n  var zepto = $.zepto, oldQsa = zepto.qsa, oldMatches = zepto.matches\n\n  function visible(elem) {\n    elem = $(elem)\n    return !!(elem.width() || elem.height()) && elem.css(\"display\") !== \"none\"\n  }\n\n  // Implements a subset from:\n  // http://api.jquery.com/category/selectors/jquery-selector-extensions/\n  //\n  // Each filter function receives the current index, all nodes in the\n  // considered set, and a value if there were parentheses. The value\n  // of `this` is the node currently being considered. The function returns the\n  // resulting node(s), null, or undefined.\n  //\n  // Complex selectors are not supported:\n  //   li:has(label:contains(\"foo\")) + li:has(label:contains(\"bar\"))\n  //   ul.inner:first > li\n  var filters = $.expr[':'] = {\n    visible: function () {\n      if (visible(this)) return this\n    },\n    hidden: function () {\n      if (!visible(this)) return this\n    },\n    selected: function () {\n      if (this.selected) return this\n    },\n    checked: function () {\n      if (this.checked) return this\n    },\n    parent: function () {\n      return this.parentNode\n    },\n    first: function (idx) {\n      if (idx === 0) return this\n    },\n    last: function (idx, nodes) {\n      if (idx === nodes.length - 1) return this\n    },\n    eq: function (idx, _, value) {\n      if (idx === value) return this\n    },\n    contains: function (idx, _, text) {\n      if ($(this).text().indexOf(text) > -1) return this\n    },\n    has: function (idx, _, sel) {\n      if (zepto.qsa(this, sel).length) return this\n    }\n  }\n\n  var filterRe = new RegExp('(.*):(\\\\w+)(?:\\\\(([^)]+)\\\\))?$\\\\s*'),\n    childRe = /^\\s*>/,\n    classTag = 'Zepto' + (+new Date())\n\n  function process(sel, fn) {\n    // quote the hash in `a[href^=#]` expression\n    sel = sel.replace(/=#\\]/g, '=\"#\"]')\n    var filter, arg, match = filterRe.exec(sel)\n    if (match && match[2] in filters) {\n      filter = filters[match[2]], arg = match[3]\n      sel = match[1]\n      if (arg) {\n        var num = Number(arg)\n        if (isNaN(num)) arg = arg.replace(/^[\"']|[\"']$/g, '')\n        else arg = num\n      }\n    }\n    return fn(sel, filter, arg)\n  }\n\n  zepto.qsa = function (node, selector) {\n    return process(selector, function (sel, filter, arg) {\n      try {\n        var taggedParent\n        if (!sel && filter) sel = '*'\n        else if (childRe.test(sel))\n        // support \"> *\" child queries by tagging the parent node with a\n        // unique class and prepending that classname onto the selector\n          taggedParent = $(node).addClass(classTag), sel = '.' + classTag + ' ' + sel\n\n        var nodes = oldQsa(node, sel)\n      } catch (e) {\n        console.error('error performing selector: %o', selector)\n        throw e\n      } finally {\n        if (taggedParent) taggedParent.removeClass(classTag)\n      }\n      return !filter ? nodes :\n        zepto.uniq($.map(nodes, function (n, i) {\n          return filter.call(n, i, nodes, arg)\n        }))\n    })\n  }\n\n  zepto.matches = function (node, selector) {\n    return process(selector, function (sel, filter, arg) {\n      return (!sel || oldMatches(node, sel)) &&\n        (!filter || filter.call(node, null, arg) === node)\n    })\n  }\n})(Zepto);\n"
  },
  {
    "path": "app/templates/app/src/lib/zepto.waypoints.js",
    "content": "/*!\n Waypoints - 4.0.0\n Copyright © 2011-2015 Caleb Troughton\n Licensed under the MIT license.\n https://github.com/imakewebthings/waypoints/blog/master/licenses.txt\n */\n;(function () {\n  'use strict'\n\n  var keyCounter = 0\n  var allWaypoints = {}\n\n  /* http://imakewebthings.com/waypoints/api/waypoint */\n  function Waypoint(options) {\n    if (!options) {\n      throw new Error('No options passed to Waypoint constructor')\n    }\n    if (!options.element) {\n      throw new Error('No element option passed to Waypoint constructor')\n    }\n    if (!options.handler) {\n      throw new Error('No handler option passed to Waypoint constructor')\n    }\n\n    this.key = 'waypoint-' + keyCounter\n    this.options = Waypoint.Adapter.extend({}, Waypoint.defaults, options)\n    this.element = this.options.element\n    this.adapter = new Waypoint.Adapter(this.element)\n    this.callback = options.handler\n    this.axis = this.options.horizontal ? 'horizontal' : 'vertical'\n    this.enabled = this.options.enabled\n    this.triggerPoint = null\n    this.group = Waypoint.Group.findOrCreate({\n      name: this.options.group,\n      axis: this.axis\n    })\n    this.context = Waypoint.Context.findOrCreateByElement(this.options.context)\n\n    if (Waypoint.offsetAliases[this.options.offset]) {\n      this.options.offset = Waypoint.offsetAliases[this.options.offset]\n    }\n    this.group.add(this)\n    this.context.add(this)\n    allWaypoints[this.key] = this\n    keyCounter += 1\n  }\n\n  /* Private */\n  Waypoint.prototype.queueTrigger = function (direction) {\n    this.group.queueTrigger(this, direction)\n  }\n\n  /* Private */\n  Waypoint.prototype.trigger = function (args) {\n    if (!this.enabled) {\n      return\n    }\n    if (this.callback) {\n      this.callback.apply(this, args)\n    }\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/destroy */\n  Waypoint.prototype.destroy = function () {\n    this.context.remove(this)\n    this.group.remove(this)\n    delete allWaypoints[this.key]\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/disable */\n  Waypoint.prototype.disable = function () {\n    this.enabled = false\n    return this\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/enable */\n  Waypoint.prototype.enable = function () {\n    this.context.refresh()\n    this.enabled = true\n    return this\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/next */\n  Waypoint.prototype.next = function () {\n    return this.group.next(this)\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/previous */\n  Waypoint.prototype.previous = function () {\n    return this.group.previous(this)\n  }\n\n  /* Private */\n  Waypoint.invokeAll = function (method) {\n    var allWaypointsArray = []\n    for (var waypointKey in allWaypoints) {\n      allWaypointsArray.push(allWaypoints[waypointKey])\n    }\n    for (var i = 0, end = allWaypointsArray.length; i < end; i++) {\n      allWaypointsArray[i][method]()\n    }\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/destroy-all */\n  Waypoint.destroyAll = function () {\n    Waypoint.invokeAll('destroy')\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/disable-all */\n  Waypoint.disableAll = function () {\n    Waypoint.invokeAll('disable')\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/enable-all */\n  Waypoint.enableAll = function () {\n    Waypoint.invokeAll('enable')\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/refresh-all */\n  Waypoint.refreshAll = function () {\n    Waypoint.Context.refreshAll()\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/viewport-height */\n  Waypoint.viewportHeight = function () {\n    return window.innerHeight || document.documentElement.clientHeight\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/viewport-width */\n  Waypoint.viewportWidth = function () {\n    return document.documentElement.clientWidth\n  }\n\n  Waypoint.adapters = []\n\n  Waypoint.defaults = {\n    context: window,\n    continuous: true,\n    enabled: true,\n    group: 'default',\n    horizontal: false,\n    offset: 0\n  }\n\n  Waypoint.offsetAliases = {\n    'bottom-in-view': function () {\n      return this.context.innerHeight() - this.adapter.outerHeight()\n    },\n    'right-in-view': function () {\n      return this.context.innerWidth() - this.adapter.outerWidth()\n    }\n  }\n\n  window.Waypoint = Waypoint\n}())\n;\n(function () {\n  'use strict'\n\n  function requestAnimationFrameShim(callback) {\n    window.setTimeout(callback, 1000 / 60)\n  }\n\n  var keyCounter = 0\n  var contexts = {}\n  var Waypoint = window.Waypoint\n  var oldWindowLoad = window.onload\n\n  /* http://imakewebthings.com/waypoints/api/context */\n  function Context(element) {\n    this.element = element\n    this.Adapter = Waypoint.Adapter\n    this.adapter = new this.Adapter(element)\n    this.key = 'waypoint-context-' + keyCounter\n    this.didScroll = false\n    this.didResize = false\n    this.oldScroll = {\n      x: this.adapter.scrollLeft(),\n      y: this.adapter.scrollTop()\n    }\n    this.waypoints = {\n      vertical: {},\n      horizontal: {}\n    }\n\n    element.waypointContextKey = this.key\n    contexts[element.waypointContextKey] = this\n    keyCounter += 1\n\n    this.createThrottledScrollHandler()\n    this.createThrottledResizeHandler()\n  }\n\n  /* Private */\n  Context.prototype.add = function (waypoint) {\n    var axis = waypoint.options.horizontal ? 'horizontal' : 'vertical'\n    this.waypoints[axis][waypoint.key] = waypoint\n    this.refresh()\n  }\n\n  /* Private */\n  Context.prototype.checkEmpty = function () {\n    var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal)\n    var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical)\n    if (horizontalEmpty && verticalEmpty) {\n      this.adapter.off('.waypoints')\n      delete contexts[this.key]\n    }\n  }\n\n  /* Private */\n  Context.prototype.createThrottledResizeHandler = function () {\n    var self = this\n\n    function resizeHandler() {\n      self.handleResize()\n      self.didResize = false\n    }\n\n    this.adapter.on('resize.waypoints', function () {\n      if (!self.didResize) {\n        self.didResize = true\n        Waypoint.requestAnimationFrame(resizeHandler)\n      }\n    })\n  }\n\n  /* Private */\n  Context.prototype.createThrottledScrollHandler = function () {\n    var self = this\n\n    function scrollHandler() {\n      self.handleScroll()\n      self.didScroll = false\n    }\n\n    this.adapter.on('scroll.waypoints', function () {\n      if (!self.didScroll || Waypoint.isTouch) {\n        self.didScroll = true\n        Waypoint.requestAnimationFrame(scrollHandler)\n      }\n    })\n  }\n\n  /* Private */\n  Context.prototype.handleResize = function () {\n    Waypoint.Context.refreshAll()\n  }\n\n  /* Private */\n  Context.prototype.handleScroll = function () {\n    var triggeredGroups = {}\n    var axes = {\n      horizontal: {\n        newScroll: this.adapter.scrollLeft(),\n        oldScroll: this.oldScroll.x,\n        forward: 'right',\n        backward: 'left'\n      },\n      vertical: {\n        newScroll: this.adapter.scrollTop(),\n        oldScroll: this.oldScroll.y,\n        forward: 'down',\n        backward: 'up'\n      }\n    }\n\n    for (var axisKey in axes) {\n      var axis = axes[axisKey]\n      var isForward = axis.newScroll > axis.oldScroll\n      var direction = isForward ? axis.forward : axis.backward\n\n      for (var waypointKey in this.waypoints[axisKey]) {\n        var waypoint = this.waypoints[axisKey][waypointKey]\n        var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint\n        var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint\n        var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint\n        var crossedBackward = !wasBeforeTriggerPoint && !nowAfterTriggerPoint\n        if (crossedForward || crossedBackward) {\n          waypoint.queueTrigger(direction)\n          triggeredGroups[waypoint.group.id] = waypoint.group\n        }\n      }\n    }\n\n    for (var groupKey in triggeredGroups) {\n      triggeredGroups[groupKey].flushTriggers()\n    }\n\n    this.oldScroll = {\n      x: axes.horizontal.newScroll,\n      y: axes.vertical.newScroll\n    }\n  }\n\n  /* Private */\n  Context.prototype.innerHeight = function () {\n    /*eslint-disable eqeqeq */\n    if (this.element == this.element.window) {\n      return Waypoint.viewportHeight()\n    }\n    /*eslint-enable eqeqeq */\n    return this.adapter.innerHeight()\n  }\n\n  /* Private */\n  Context.prototype.remove = function (waypoint) {\n    delete this.waypoints[waypoint.axis][waypoint.key]\n    this.checkEmpty()\n  }\n\n  /* Private */\n  Context.prototype.innerWidth = function () {\n    /*eslint-disable eqeqeq */\n    if (this.element == this.element.window) {\n      return Waypoint.viewportWidth()\n    }\n    /*eslint-enable eqeqeq */\n    return this.adapter.innerWidth()\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/context-destroy */\n  Context.prototype.destroy = function () {\n    var allWaypoints = []\n    for (var axis in this.waypoints) {\n      for (var waypointKey in this.waypoints[axis]) {\n        allWaypoints.push(this.waypoints[axis][waypointKey])\n      }\n    }\n    for (var i = 0, end = allWaypoints.length; i < end; i++) {\n      allWaypoints[i].destroy()\n    }\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/context-refresh */\n  Context.prototype.refresh = function () {\n    /*eslint-disable eqeqeq */\n    var isWindow = this.element == this.element.window\n    /*eslint-enable eqeqeq */\n    var contextOffset = isWindow ? undefined : this.adapter.offset()\n    var triggeredGroups = {}\n    var axes\n\n    this.handleScroll()\n    axes = {\n      horizontal: {\n        contextOffset: isWindow ? 0 : contextOffset.left,\n        contextScroll: isWindow ? 0 : this.oldScroll.x,\n        contextDimension: this.innerWidth(),\n        oldScroll: this.oldScroll.x,\n        forward: 'right',\n        backward: 'left',\n        offsetProp: 'left'\n      },\n      vertical: {\n        contextOffset: isWindow ? 0 : contextOffset.top,\n        contextScroll: isWindow ? 0 : this.oldScroll.y,\n        contextDimension: this.innerHeight(),\n        oldScroll: this.oldScroll.y,\n        forward: 'down',\n        backward: 'up',\n        offsetProp: 'top'\n      }\n    }\n\n    for (var axisKey in axes) {\n      var axis = axes[axisKey]\n      for (var waypointKey in this.waypoints[axisKey]) {\n        var waypoint = this.waypoints[axisKey][waypointKey]\n        var adjustment = waypoint.options.offset\n        var oldTriggerPoint = waypoint.triggerPoint\n        var elementOffset = 0\n        var freshWaypoint = oldTriggerPoint == null\n        var contextModifier, wasBeforeScroll, nowAfterScroll\n        var triggeredBackward, triggeredForward\n\n        if (waypoint.element !== waypoint.element.window) {\n          elementOffset = waypoint.adapter.offset()[axis.offsetProp]\n        }\n\n        if (typeof adjustment === 'function') {\n          adjustment = adjustment.apply(waypoint)\n        }\n        else if (typeof adjustment === 'string') {\n          adjustment = parseFloat(adjustment)\n          if (waypoint.options.offset.indexOf('%') > -1) {\n            adjustment = Math.ceil(axis.contextDimension * adjustment / 100)\n          }\n        }\n\n        contextModifier = axis.contextScroll - axis.contextOffset\n        waypoint.triggerPoint = elementOffset + contextModifier - adjustment\n        wasBeforeScroll = oldTriggerPoint < axis.oldScroll\n        nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll\n        triggeredBackward = wasBeforeScroll && nowAfterScroll\n        triggeredForward = !wasBeforeScroll && !nowAfterScroll\n\n        if (!freshWaypoint && triggeredBackward) {\n          waypoint.queueTrigger(axis.backward)\n          triggeredGroups[waypoint.group.id] = waypoint.group\n        }\n        else if (!freshWaypoint && triggeredForward) {\n          waypoint.queueTrigger(axis.forward)\n          triggeredGroups[waypoint.group.id] = waypoint.group\n        }\n        else if (freshWaypoint && axis.oldScroll >= waypoint.triggerPoint) {\n          waypoint.queueTrigger(axis.forward)\n          triggeredGroups[waypoint.group.id] = waypoint.group\n        }\n      }\n    }\n\n    Waypoint.requestAnimationFrame(function () {\n      for (var groupKey in triggeredGroups) {\n        triggeredGroups[groupKey].flushTriggers()\n      }\n    })\n\n    return this\n  }\n\n  /* Private */\n  Context.findOrCreateByElement = function (element) {\n    return Context.findByElement(element) || new Context(element)\n  }\n\n  /* Private */\n  Context.refreshAll = function () {\n    for (var contextId in contexts) {\n      contexts[contextId].refresh()\n    }\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/context-find-by-element */\n  Context.findByElement = function (element) {\n    return contexts[element.waypointContextKey]\n  }\n\n  window.onload = function () {\n    if (oldWindowLoad) {\n      oldWindowLoad()\n    }\n    Context.refreshAll()\n  }\n\n  Waypoint.requestAnimationFrame = function (callback) {\n    var requestFn = window.requestAnimationFrame ||\n      window.mozRequestAnimationFrame ||\n      window.webkitRequestAnimationFrame ||\n      requestAnimationFrameShim\n    requestFn.call(window, callback)\n  }\n  Waypoint.Context = Context\n}())\n;\n(function () {\n  'use strict'\n\n  function byTriggerPoint(a, b) {\n    return a.triggerPoint - b.triggerPoint\n  }\n\n  function byReverseTriggerPoint(a, b) {\n    return b.triggerPoint - a.triggerPoint\n  }\n\n  var groups = {\n    vertical: {},\n    horizontal: {}\n  }\n  var Waypoint = window.Waypoint\n\n  /* http://imakewebthings.com/waypoints/api/group */\n  function Group(options) {\n    this.name = options.name\n    this.axis = options.axis\n    this.id = this.name + '-' + this.axis\n    this.waypoints = []\n    this.clearTriggerQueues()\n    groups[this.axis][this.name] = this\n  }\n\n  /* Private */\n  Group.prototype.add = function (waypoint) {\n    this.waypoints.push(waypoint)\n  }\n\n  /* Private */\n  Group.prototype.clearTriggerQueues = function () {\n    this.triggerQueues = {\n      up: [],\n      down: [],\n      left: [],\n      right: []\n    }\n  }\n\n  /* Private */\n  Group.prototype.flushTriggers = function () {\n    for (var direction in this.triggerQueues) {\n      var waypoints = this.triggerQueues[direction]\n      var reverse = direction === 'up' || direction === 'left'\n      waypoints.sort(reverse ? byReverseTriggerPoint : byTriggerPoint)\n      for (var i = 0, end = waypoints.length; i < end; i += 1) {\n        var waypoint = waypoints[i]\n        if (waypoint.options.continuous || i === waypoints.length - 1) {\n          waypoint.trigger([direction])\n        }\n      }\n    }\n    this.clearTriggerQueues()\n  }\n\n  /* Private */\n  Group.prototype.next = function (waypoint) {\n    this.waypoints.sort(byTriggerPoint)\n    var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)\n    var isLast = index === this.waypoints.length - 1\n    return isLast ? null : this.waypoints[index + 1]\n  }\n\n  /* Private */\n  Group.prototype.previous = function (waypoint) {\n    this.waypoints.sort(byTriggerPoint)\n    var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)\n    return index ? this.waypoints[index - 1] : null\n  }\n\n  /* Private */\n  Group.prototype.queueTrigger = function (waypoint, direction) {\n    this.triggerQueues[direction].push(waypoint)\n  }\n\n  /* Private */\n  Group.prototype.remove = function (waypoint) {\n    var index = Waypoint.Adapter.inArray(waypoint, this.waypoints)\n    if (index > -1) {\n      this.waypoints.splice(index, 1)\n    }\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/first */\n  Group.prototype.first = function () {\n    return this.waypoints[0]\n  }\n\n  /* Public */\n  /* http://imakewebthings.com/waypoints/api/last */\n  Group.prototype.last = function () {\n    return this.waypoints[this.waypoints.length - 1]\n  }\n\n  /* Private */\n  Group.findOrCreate = function (options) {\n    return groups[options.axis][options.name] || new Group(options)\n  }\n\n  Waypoint.Group = Group\n}())\n;\n(function () {\n  'use strict'\n\n  var $ = window.Zepto\n  var Waypoint = window.Waypoint\n\n  function ZeptoAdapter(element) {\n    this.element = element\n    this.$element = $(element)\n  }\n\n  $.each([\n    'off',\n    'on',\n    'scrollLeft',\n    'scrollTop'\n  ], function (i, method) {\n    ZeptoAdapter.prototype[method] = function () {\n      var args = Array.prototype.slice.call(arguments)\n      return this.$element[method].apply(this.$element, args)\n    }\n  })\n\n  ZeptoAdapter.prototype.offset = function () {\n    if (this.element !== this.element.window) {\n      return this.$element.offset()\n    }\n  }\n\n  // Adapted from https://gist.github.com/wheresrhys/5823198\n  $.each([\n    'width',\n    'height'\n  ], function (i, dimension) {\n    function createDimensionMethod($element, includeBorder) {\n      return function (includeMargin) {\n        var $element = this.$element\n        var size = $element[dimension]()\n        var sides = {\n          width: ['left', 'right'],\n          height: ['top', 'bottom']\n        }\n\n        $.each(sides[dimension], function (i, side) {\n          size += parseInt($element.css('padding-' + side), 10)\n          if (includeBorder) {\n            size += parseInt($element.css('border-' + side + '-width'), 10)\n          }\n          if (includeMargin) {\n            size += parseInt($element.css('margin-' + side), 10)\n          }\n        })\n        return size\n      }\n    }\n\n    var innerMethod = $.camelCase('inner-' + dimension)\n    var outerMethod = $.camelCase('outer-' + dimension)\n\n    ZeptoAdapter.prototype[innerMethod] = createDimensionMethod(false)\n    ZeptoAdapter.prototype[outerMethod] = createDimensionMethod(true)\n  })\n\n  $.each([\n    'extend',\n    'inArray'\n  ], function (i, method) {\n    ZeptoAdapter[method] = $[method]\n  })\n\n  ZeptoAdapter.isEmptyObject = function (obj) {\n    /* eslint no-unused-vars: 0 */\n    for (var name in obj) {\n      return false\n    }\n    return true\n  }\n\n  Waypoint.adapters.push({\n    name: 'zepto',\n    Adapter: ZeptoAdapter\n  })\n  Waypoint.Adapter = ZeptoAdapter\n}())\n;\n(function () {\n  'use strict'\n\n  var Waypoint = window.Waypoint\n\n  function createExtension(framework) {\n    return function () {\n      var waypoints = []\n      var overrides = arguments[0]\n\n      if (framework.isFunction(arguments[0])) {\n        overrides = framework.extend({}, arguments[1])\n        overrides.handler = arguments[0]\n      }\n\n      this.each(function () {\n        var options = framework.extend({}, overrides, {\n          element: this\n        })\n        if (typeof options.context === 'string') {\n          options.context = framework(this).closest(options.context)[0]\n        }\n        waypoints.push(new Waypoint(options))\n      })\n\n      return waypoints\n    }\n  }\n\n  if (window.jQuery) {\n    window.jQuery.fn.waypoint = createExtension(window.jQuery)\n  }\n  if (window.Zepto) {\n    window.Zepto.fn.waypoint = createExtension(window.Zepto)\n  }\n}());\n"
  },
  {
    "path": "app/templates/app/src/util/AppCache.js",
    "content": "/**\n * if you enable manifest in package.json,you don't need to require this module any more,gulp will auto includes it for you\n */\nvar appCache = window.applicationCache;\nappCache.addEventListener('updateready', function (e) {\n  if (appCache.status == appCache.UPDATEREADY) {\n    try {\n      appCache.update();\n      if (appCache.status == appCache.UPDATEREADY) {\n        try {\n          appCache.swapCache();\n          window.location.reload(false);\n        } catch (err) {\n        }\n      }\n    } catch (err) {\n    }\n  }\n}, false);\n"
  },
  {
    "path": "app/templates/app/src/util/Base64.js",
    "content": "var Base64 = {\n  // private property\n  _keyStr: \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\",\n\n  // public method for encoding\n  encode: function (input) {\n    var output = \"\";\n    var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n    var i = 0;\n\n    input = Base64._utf8_encode(input);\n\n    while (i < input.length) {\n\n      chr1 = input.charCodeAt(i++);\n      chr2 = input.charCodeAt(i++);\n      chr3 = input.charCodeAt(i++);\n\n      enc1 = chr1 >> 2;\n      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n      enc4 = chr3 & 63;\n\n      if (isNaN(chr2)) {\n        enc3 = enc4 = 64;\n      } else if (isNaN(chr3)) {\n        enc4 = 64;\n      }\n\n      output = output +\n        this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +\n        this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);\n\n    }\n\n    return output;\n  },\n\n  // public method for decoding\n  decode: function (input) {\n    var output = \"\";\n    var chr1, chr2, chr3;\n    var enc1, enc2, enc3, enc4;\n    var i = 0;\n\n    input = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, \"\");\n\n    while (i < input.length) {\n\n      enc1 = this._keyStr.indexOf(input.charAt(i++));\n      enc2 = this._keyStr.indexOf(input.charAt(i++));\n      enc3 = this._keyStr.indexOf(input.charAt(i++));\n      enc4 = this._keyStr.indexOf(input.charAt(i++));\n\n      chr1 = (enc1 << 2) | (enc2 >> 4);\n      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n      chr3 = ((enc3 & 3) << 6) | enc4;\n\n      output = output + String.fromCharCode(chr1);\n\n      if (enc3 != 64) {\n        output = output + String.fromCharCode(chr2);\n      }\n      if (enc4 != 64) {\n        output = output + String.fromCharCode(chr3);\n      }\n\n    }\n\n    output = Base64._utf8_decode(output);\n\n    return output;\n\n  },\n\n  // private method for UTF-8 encoding\n  _utf8_encode: function (string) {\n    string = string.replace(/\\r\\n/g, \"\\n\");\n    var utftext = \"\";\n\n    for (var n = 0; n < string.length; n++) {\n\n      var c = string.charCodeAt(n);\n\n      if (c < 128) {\n        utftext += String.fromCharCode(c);\n      }\n      else if ((c > 127) && (c < 2048)) {\n        utftext += String.fromCharCode((c >> 6) | 192);\n        utftext += String.fromCharCode((c & 63) | 128);\n      }\n      else {\n        utftext += String.fromCharCode((c >> 12) | 224);\n        utftext += String.fromCharCode(((c >> 6) & 63) | 128);\n        utftext += String.fromCharCode((c & 63) | 128);\n      }\n\n    }\n\n    return utftext;\n  },\n\n  // private method for UTF-8 decoding\n  _utf8_decode: function (utftext) {\n    var string = \"\";\n    var i = 0;\n    var c = c1 = c2 = 0;\n\n    while (i < utftext.length) {\n\n      c = utftext.charCodeAt(i);\n\n      if (c < 128) {\n        string += String.fromCharCode(c);\n        i++;\n      }\n      else if ((c > 191) && (c < 224)) {\n        c2 = utftext.charCodeAt(i + 1);\n        string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));\n        i += 2;\n      }\n      else {\n        c2 = utftext.charCodeAt(i + 1);\n        c3 = utftext.charCodeAt(i + 2);\n        string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));\n        i += 3;\n      }\n\n    }\n\n    return string;\n  }\n\n}\nmodule.exports = Base64;\n"
  },
  {
    "path": "app/templates/app/src/util/DateHandler.js",
    "content": "var DateHandler = (function () {\n  function getStrDate(str) {\n    var date;\n    if (typeof str === 'string') {\n      var arr = str.split(/[- :]/);\n      date = new Date(arr[0], arr[1] - 1, arr[2], arr[3] || 0, arr[4] || 0, arr[5] || 0);\n    }\n    return date;\n  }\n\n  function dbl00(num) {\n    return num < 10 ? '0' + num : num;\n  }\n\n  function getMeta(date) {\n    if (!date) {\n      return null;\n    }\n    var YYYY = date.getFullYear(),\n      MM = date.getMonth(),\n      DD = date.getDate(),\n      hh = date.getHours(),\n      mm = date.getMinutes(),\n      ss = date.getSeconds();\n    return {\n      year: YYYY,\n      month: dbl00(MM + 1),\n      day: dbl00(DD),\n      hour: dbl00(hh),\n      minute: dbl00(mm),\n      second: dbl00(ss)\n    }\n  }\n\n  function formatStr(str) {\n    var date = getStrDate(str);\n    return getMeta(date);\n  }\n\n  function fromNowTo(date) {\n    if (!date) {\n      return null;\n    }\n    var _date;\n    if (typeof date === 'string') {\n      _date = getStrDate(date);\n    } else if (typeof date === 'number') {\n      _date = new Date(date);\n    } else if (date.getTime) {\n      _date = date;\n    }\n    if (!_date) {\n      return null;\n    }\n    var old = _date.getTime(),\n      cur = new Date().getTime(),\n      diff = Math.abs(cur - old),\n      day = Math.floor(diff / (24 * 60 * 60 * 1000)),\n      hour = Math.floor((diff - (day * 24 * 60 * 60 * 1000)) / (60 * 60 * 1000)),\n      minute = Math.floor((diff - (hour * 60 * 60 * 1000) - (day * 24 * 60 * 60 * 1000)) / (60 * 1000)),\n      second = Math.floor((diff - (hour * 60 * 60 * 1000) - (day * 24 * 60 * 60 * 1000) - (minute * 60 * 1000)) / 1000);\n    return {\n      day: dbl00(day),\n      hour: dbl00(hour),\n      minute: dbl00(minute),\n      second: dbl00(second)\n    }\n  }\n\n  function timeLogFromNowTo(date) {\n    var _date = fromNowTo(date);\n    if (!_date) {\n      return null\n    }\n    var day = parseInt(_date.day),\n      hou = parseInt(_date.hour),\n      min = parseInt(_date.minute);\n    if (day > 0) {\n      return day + ' days ago';\n    } else if (hou > 0) {\n      return hou + ' hours ago';\n    } else if (min >= 3) {\n      return min + ' mins ago';\n    } else {\n      return 'just now';\n    }\n  }\n\n  function getDaysInMonth(y, m) {\n    return /8|3|5|10/.test(--m) ? 30 : m == 1 ? (!(y % 4) && y % 100) || !(y % 400) ? 29 : 28 : 31;\n  }\n\n  return {\n    getStrDate: getStrDate,\n    getMeta: getMeta,\n    formatStr: formatStr,\n    fromNowTo: fromNowTo,\n    timeLogFromNowTo: timeLogFromNowTo,\n    getDaysInMonth: getDaysInMonth\n  }\n}());\n\nmodule.exports = DateHandler;\n"
  },
  {
    "path": "app/templates/app/src/util/Easing.js",
    "content": "/**\n * http://www.robertpenner.com/easing/\n * http://www.gizma.com/easing/\n *\n * t: current time\n * b: begInnIng value\n * c: change In value\n * d: duration\n **/\n\n  // simple linear tweening - no easing, no acceleration\nMath.linearTween = function (t, b, c, d) {\n  return c * t / d + b;\n};\n\n// quadratic easing in - accelerating from zero velocity\nMath.easeInQuad = function (t, b, c, d) {\n  t /= d;\n  return c * t * t + b;\n};\n\n// quadratic easing out - decelerating to zero velocity\nMath.easeOutQuad = function (t, b, c, d) {\n  t /= d;\n  return -c * t * (t - 2) + b;\n};\n\n// quadratic easing in/out - acceleration until halfway, then deceleration\nMath.easeInOutQuad = function (t, b, c, d) {\n  t /= d / 2;\n  if (t < 1) return c / 2 * t * t + b;\n  t--;\n  return -c / 2 * (t * (t - 2) - 1) + b;\n};\n\n// cubic easing in - accelerating from zero velocity\nMath.easeInCubic = function (t, b, c, d) {\n  t /= d;\n  return c * t * t * t + b;\n};\n\n// cubic easing out - decelerating to zero velocity\nMath.easeOutCubic = function (t, b, c, d) {\n  t /= d;\n  t--;\n  return c * (t * t * t + 1) + b;\n};\n\n// cubic easing in/out - acceleration until halfway, then deceleration\nMath.easeInOutCubic = function (t, b, c, d) {\n  t /= d / 2;\n  if (t < 1) return c / 2 * t * t * t + b;\n  t -= 2;\n  return c / 2 * (t * t * t + 2) + b;\n};\n// quartic easing in - accelerating from zero velocity\nMath.easeInQuart = function (t, b, c, d) {\n  t /= d;\n  return c * t * t * t * t + b;\n};\n\n// quartic easing out - decelerating to zero velocity\nMath.easeOutQuart = function (t, b, c, d) {\n  t /= d;\n  t--;\n  return -c * (t * t * t * t - 1) + b;\n};\n\n// quartic easing in/out - acceleration until halfway, then deceleration\nMath.easeInOutQuart = function (t, b, c, d) {\n  t /= d / 2;\n  if (t < 1) return c / 2 * t * t * t * t + b;\n  t -= 2;\n  return -c / 2 * (t * t * t * t - 2) + b;\n};\n// quintic easing in - accelerating from zero velocity\nMath.easeInQuint = function (t, b, c, d) {\n  t /= d;\n  return c * t * t * t * t * t + b;\n};\n\n// quintic easing out - decelerating to zero velocity\nMath.easeOutQuint = function (t, b, c, d) {\n  t /= d;\n  t--;\n  return c * (t * t * t * t * t + 1) + b;\n};\n\n// quintic easing in/out - acceleration until halfway, then deceleration\nMath.easeInOutQuint = function (t, b, c, d) {\n  t /= d / 2;\n  if (t < 1) return c / 2 * t * t * t * t * t + b;\n  t -= 2;\n  return c / 2 * (t * t * t * t * t + 2) + b;\n};\n// sinusoidal easing in - accelerating from zero velocity\nMath.easeInSine = function (t, b, c, d) {\n  return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;\n};\n\n// sinusoidal easing out - decelerating to zero velocity\nMath.easeOutSine = function (t, b, c, d) {\n  return c * Math.sin(t / d * (Math.PI / 2)) + b;\n};\n\n// sinusoidal easing in/out - accelerating until halfway, then decelerating\nMath.easeInOutSine = function (t, b, c, d) {\n  return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;\n};\n\n// exponential easing in - accelerating from zero velocity\nMath.easeInExpo = function (t, b, c, d) {\n  return c * Math.pow(2, 10 * (t / d - 1)) + b;\n};\n\n// exponential easing out - decelerating to zero velocity\nMath.easeOutExpo = function (t, b, c, d) {\n  return c * ( -Math.pow(2, -10 * t / d) + 1 ) + b;\n};\n\n// exponential easing in/out - accelerating until halfway, then decelerating\nMath.easeInOutExpo = function (t, b, c, d) {\n  t /= d / 2;\n  if (t < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;\n  t--;\n  return c / 2 * ( -Math.pow(2, -10 * t) + 2 ) + b;\n};\n// circular easing in - accelerating from zero velocity\nMath.easeInCirc = function (t, b, c, d) {\n  t /= d;\n  return -c * (Math.sqrt(1 - t * t) - 1) + b;\n};\n\n// circular easing out - decelerating to zero velocity\nMath.easeOutCirc = function (t, b, c, d) {\n  t /= d;\n  t--;\n  return c * Math.sqrt(1 - t * t) + b;\n};\n\n// circular easing in/out - acceleration until halfway, then deceleration\nMath.easeInOutCirc = function (t, b, c, d) {\n  t /= d / 2;\n  if (t < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;\n  t -= 2;\n  return c / 2 * (Math.sqrt(1 - t * t) + 1) + b;\n};\n"
  },
  {
    "path": "app/templates/app/src/util/FacebookShare.js",
    "content": "var MetaHandler = require('util/MetaHandler');\n\n/**\n * facebook\n * https://developers.facebook.com/docs/sharing/best-practices\n *\n * @param data = {\n     *  url,\n     *  type,\n     *  title,\n     *  description,\n     *  image\n     * }\n *\n */\nfunction share(data) {\n  data = data || {};\n  MetaHandler.createMeta('og:url').setContent('og:url', data.url || window.location.href);\n  MetaHandler.createMeta('og:type').setContent('og:type', data.type || 'article');\n  MetaHandler.createMeta('og:title').setContent('og:title', data.title || document.title);\n  MetaHandler.createMeta('og:description').setContent('og:description', data.description);\n  MetaHandler.createMeta('og:image').setContent('og:image', data.image);\n}\n\nmodule.exports = share;\n"
  },
  {
    "path": "app/templates/app/src/util/FormHandler.js",
    "content": "var Navigator = require('core/Navigator');\n\nvar FormHandler = function () {\n  //MONOSTATE\n  if (FormHandler.prototype.instance) {\n    return FormHandler.prototype.instance;\n  }\n  var _this = this;\n\n  function getForm(method) {\n    var _form = document.createElement('form');\n    _form.setAttribute(\"style\", \"display:none;width:0;height:0;position: absolute;top:0;left:0;border:0;\");\n    _form.setAttribute(\"method\", method || 'POST');\n    return _form;\n  }\n\n  this.asyncSubmit = function (action, data) {\n    this.submit(action, data, true);\n  }\n\n  this.submit = function (action, data, async) {\n    var target,\n      frame,\n      form = getForm(),\n      inputs = [],\n      itpl = '<input type=\"text\" name=\"{N}\" value=\"{V}\" />';\n\n    if (async) {\n      target = '__formhandler_' + new Date().getTime();\n      frame = Navigator.getFrame(null, target);\n      form.setAttribute('target', target);\n      setTimeout(function () {\n        Navigator.removeFrame(frame);\n      }, 120000);\n    }\n\n    form.setAttribute('action', action);\n    data = data || {};\n    for (var key in data) {\n      inputs.push(itpl.replace('{N}', key).replace('{V}', data[key]));\n    }\n    form.innerHTML = inputs.join('');\n    action && setTimeout(function () {\n      form.submit();\n    }, 100);\n  }\n\n  //MONOSTATE\n  FormHandler.prototype.instance = this;\n};\n\nmodule.exports = new FormHandler;\n"
  },
  {
    "path": "app/templates/app/src/util/GUID.js",
    "content": "function GUID(len) {\n  var res = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.replace(/[x]/g, function(c) {\n    var num = Math.random() *16 | 0, v = c === 'x' ? num : (num&0x3|0x8);\n    return v.toString(16);\n  });\n  return len?res.substr(0, len):res;\n}\n\nmodule.exports = GUID;\n"
  },
  {
    "path": "app/templates/app/src/util/ImpressGenerator.js",
    "content": "var randomList = require('util/RandomList');\nvar impress = window.impress;\n\nvar ww = window.innerWidth,\n  wh = window.innerHeight;\nvar Generator = {};\n\nfunction initImpress(option) {\n  option = option || {};\n  if (!option.body || !option.root || !impress) {\n    return null;\n  }\n  var imp,\n    id = 'impress_generator_' + new Date().getTime();\n  option.root.id = id;\n  imp = new impress(id, {\n    body: option.body,\n    resizeDrive: false,// keep current step after resize viewport\n    hashMark: false, //change the location hash\n    clickDrve: false, //enable clik to drive steps\n    keyboardDrve: false,//enable keyboard to drive steps\n    touchDrive: false,//enable touch to drive steps\n    anchorDrive: false//enable anchor to drive steps\n  });\n\n  !option.lazy && imp.init();\n\n  return imp;\n}\n\nfunction getInstance(attrs, ioption) {\n  var instance = {};\n  instance.attrs = attrs || [];\n  instance.impress = ioption ? initImpress(ioption) : null;\n\n  return instance;\n}\n\nfunction setAttr(el, attr) {\n  if (el && attr) {\n    el.setAttribute('data-x', attr.x || 0);\n    el.setAttribute('data-y', attr.y || 0);\n    el.setAttribute('data-z', attr.z || 0);\n    el.setAttribute('data-rotate-x', attr.rx || 0);\n    el.setAttribute('data-rotate-y', attr.ry || 0);\n    el.setAttribute('data-rotate-z', attr.rz || 0);\n    el.setAttribute('data-scale', attr.scale || 1);\n  }\n}\n\nGenerator.circle = function (option) {\n  option = option || {};\n  if (!option.el && !option.total) {\n    return;\n  }\n  var el = option.el,\n    dir = option.direction || 'normal',\n    _dirs = [{x: 1, y: 1, de: -1}, {x: 1, y: 1, de: 1}, {x: -1, y: -1, de: 1}, {x: -1, y: -1, de: -1}],\n    dirs = {\n      'left-top': _dirs[0],\n      'left-bottom': _dirs[1],\n      'right-top': _dirs[2],\n      'right-bottom': _dirs[3],\n      'normal': _dirs[2],\n      'random': randomList(_dirs, 1, null, 10)[0]\n    },\n    zoom = option.zoom || 'normal',\n    zooms = {\n      'zoom-in': 1,\n      'zoom-out': -1,\n      'normal': 0,\n      'random': randomList([0, 1, -1], 1, null, 10)[0]\n    },\n    total = option.total,\n    width = option.maxWidth || ww,\n    height = option.maxHeight || wh,\n    children, attrs = [], i = 0;\n\n  if (el) {\n    children = el.children;\n    total = children.length;\n  }\n\n  var c = ( height + ((zoom == 'zoom-in' || zooms[zoom] == 1) ? height : 0) ) * total,\n    offsetX = parseInt(width / 2, 10),\n    offsetY = parseInt(height / 2, 10),\n    r = parseInt(c / 2 / Math.PI + height / 2, 10),\n    de = 0,\n    deStep = 360 / total,\n    ra, x, y;\n\n  for (i; i < total; i++) {\n    var cel = children && children[i];\n    de = deStep * i * (dirs[dir] || dirs['normal'])['de'];\n    ra = (360 - de) * Math.PI / 180;\n    x = parseInt(offsetX + Math.cos(ra) * r, 10);\n    y = parseInt(offsetY - Math.sin(ra) * r, 10);\n    var attr = {\n      x: x * (dirs[dir] || dirs['normal'])['x'],\n      y: y * (dirs[dir] || dirs['normal'])['y'],\n      z: 0,\n      rx: 0,\n      ry: 0,\n      rz: de,\n      scale: 1 + ( (zooms[zoom] || zooms['normal']) * i / total )\n    };\n    attrs.push(attr);\n    setAttr(cel, attr);\n  }\n\n  return getInstance(attrs, option.impress);\n}\nGenerator.horizontal = function (option) {\n  option = option || {};\n  if (!option.el && !option.total) {\n    return;\n  }\n  var el = option.el,\n    dir = option.direction || 'normal',\n    dirs = {\n      'from-right': 1,\n      'from-left': -1,\n      'normal': 1,\n      'random': Math.round(Math.random()) ? -1 : 1\n    },\n    zoom = option.zoom || 'normal',\n    zooms = {\n      'zoom-in': 1,\n      'zoom-out': -1,\n      'normal': 0,\n      'random': randomList([0, 1, -1], 1, null, 10)[0]\n    },\n    total = option.total,\n    width = option.maxWidth || ww,\n    height = option.maxHeight || wh,\n    children, attrs = [], i = 0;\n\n  if (el) {\n    children = el.children;\n    total = children.length;\n  }\n\n  for (i; i < total; i++) {\n    var cel = children && children[i];\n    var attr = {\n      x: i * width * (dirs[dir] || dirs['normal']) * (zoom == 'normal' || zooms[zoom] == 0 ? 1.4 : 2),\n      y: 0,\n      z: 0,\n      rx: 0,\n      ry: 0,\n      rz: 0,\n      scale: 1 + ( (zooms[zoom] || zooms['normal']) * i / total )\n    };\n    attrs.push(attr);\n    setAttr(cel, attr);\n  }\n\n  return getInstance(attrs, option.impress);\n}\n\nGenerator.vertical = function (option) {\n  option = option || {};\n  if (!option.el && !option.total) {\n    return;\n  }\n  var el = option.el,\n    dir = option.direction || 'normal',\n    dirs = {\n      'from-bottom': 1,\n      'from-up': -1,\n      'normal': 1,\n      'random': Math.round(Math.random()) ? -1 : 1\n    },\n    zoom = option.zoom || 'normal',\n    zooms = {\n      'zoom-in': 1,\n      'zoom-out': -1,\n      'normal': 0,\n      'random': randomList([0, 1, -1], 1, null, 10)[0]\n    },\n    total = option.total,\n    width = option.maxWidth || ww,\n    height = option.maxHeight || wh,\n    children, attrs = [], i = 0;\n\n  if (el) {\n    children = el.children;\n    total = children.length;\n  }\n\n  for (i; i < total; i++) {\n    var cel = children && children[i];\n    var attr = {\n      x: 0,\n      y: i * height * (dirs[dir] || dirs['normal']) * (zoom == 'normal' || zooms[zoom] == 0 ? 1.2 : 1.3),\n      z: 0,\n      rx: 0,\n      ry: 0,\n      rz: 0,\n      scale: 1 + ( (zooms[zoom] || zooms['normal']) * i / total )\n    };\n    attrs.push(attr);\n    setAttr(cel, attr);\n  }\n\n  return getInstance(attrs, option.impress);\n}\n\nGenerator.diagonal = function (option) {\n  option = option || {};\n  if (!option.el && !option.total) {\n    return;\n  }\n  var el = option.el,\n    dir = option.direction || 'normal',\n    _dirs = [{x: -1, y: -1}, {x: -1, y: 1}, {x: -1, y: 1}, {x: 1, y: 1}],\n    dirs = {\n      'top-left': _dirs[0],\n      'top-right': _dirs[1],\n      'bottom-left': _dirs[2],\n      'bottom-right': _dirs[3],\n      'normal': _dirs[3],\n      'random': randomList(_dirs, 1, null, 10)[0]\n    },\n    zoom = option.zoom || 'normal',\n    zooms = {\n      'zoom-in': 1,\n      'zoom-out': -1,\n      'normal': 0,\n      'random': randomList([0, 1, -1], 1, null, 10)[0]\n    },\n    total = option.total,\n    width = option.maxWidth || ww,\n    height = option.maxHeight || wh,\n    children, attrs = [], i = 0;\n\n  if (el) {\n    children = el.children;\n    total = children.length;\n  }\n\n  for (i; i < total; i++) {\n    var cel = children && children[i];\n    var attr = {\n      x: i * width * (dirs[dir] || dirs['normal'])['x'] * (zoom == 'normal' || zooms[zoom] == 0 ? 1.2 : 1.6),\n      y: i * height * (dirs[dir] || dirs['normal'])['y'] * (zoom == 'normal' || zooms[zoom] == 0 ? 1.2 : 1.6),\n      z: 0,\n      rx: 0,\n      ry: 0,\n      rz: 0,\n      scale: 1 + ( (zooms[zoom] || zooms['normal']) * i / total )\n    };\n    attrs.push(attr);\n    setAttr(cel, attr);\n  }\n\n  return getInstance(attrs, option.impress);\n}\nGenerator.snake = function (option) {\n  option = option || {};\n  if (!option.el && !option.total) {\n    return;\n  }\n  var el = option.el,\n    zoom = option.zoom || 'normal',\n    zooms = {\n      'zoom-in': 1,\n      'zoom-out': -1,\n      'normal': 0,\n      'random': randomList([0, 1, -1], 1, null, 10)[0]\n    },\n    total = option.total,\n    width = option.maxWidth || ww,\n    height = option.maxHeight || wh,\n    children, attrs = [], i = 0;\n\n  if (el) {\n    children = el.children;\n    total = children.length;\n  }\n\n  for (i; i < total; i++) {\n    var cel = children && children[i];\n    var attr = {\n      x: i * width * 1.3,\n      y: i * height * 1.3,\n      z: 0,\n      rx: 135 * (i % 2 ? 0 : 1),\n      ry: 135 * (i % 2 ? 1 : 0),\n      rz: i * 360 / total,\n      scale: 1 + ( (zooms[zoom] || zooms['normal']) * i / total )\n    };\n    attrs.push(attr);\n    setAttr(cel, attr);\n  }\n\n  return getInstance(attrs, option.impress);\n}\n\nGenerator.random = function (option) {\n  var anim = ['circle', 'horizontal', 'vertical', 'diagonal', 'snake'];\n  return Generator[randomList(anim, 1, null, 10)](option);\n}\n\nmodule.exports = Generator;\n"
  },
  {
    "path": "app/templates/app/src/util/LocalHost.js",
    "content": "if (!window.location.origin) {\n  window.location.origin = window.location.protocol\n    + \"//\" + window.location.hostname\n    + (window.location.port ? ':' + window.location.port : '');\n}\nmodule.exports = window.location.origin;\n"
  },
  {
    "path": "app/templates/app/src/util/LocalParam.js",
    "content": "/**\n * window.location.search\n * window.location.hash\n */\nfunction localParam(search, hash) {\n  search = search || window.location.search;\n  hash = hash || window.location.hash;\n  var fn = function (str, reg) {\n    if (str) {\n      var data = {};\n      str.replace(reg, function ($0, $1, $2, $3) {\n        data[$1] = $3;\n      });\n      return data;\n    }\n  }\n  return {\n    search: fn(search, new RegExp(\"([^?=&]+)(=([^&]*))?\", \"g\")) || {},\n    hash: fn(hash, new RegExp(\"([^#=&]+)(=([^&]*))?\", \"g\")) || {}\n  };\n}\n\nmodule.exports = localParam;\n"
  },
  {
    "path": "app/templates/app/src/util/LocalStorage.js",
    "content": "function localStorage() {\n  var lcst = window.localStorage;\n\n  /**\n   * 读取\n   *\n   * @method getLocalValue\n   * @param {String} id item id\n   * @return {String} value\n   */\n  function getLocalValue(id) {\n    if (lcst) {\n      return lcst[id];\n    } else {\n      return null;\n    }\n  }\n\n  /**\n   * 保存/更新\n   *\n   * @method setLocalValue\n   * @param {String}|{Object} id item id\n   * @param {String} val value\n   */\n  function setLocalValue(id, val) {\n    if (lcst) {\n      if (typeof id === 'object') {\n        for (var key in id) {\n          try {\n            id[key] && lcst.setItem(key, id[key]);\n          } catch (err) {\n          }\n        }\n      } else {\n        try {\n          lcst.setItem(id, val);\n        } catch (err) {\n        }\n      }\n    }\n    return this;\n  }\n\n  /**\n   * 删除\n   * @param {Array}||{String} id\n   */\n  function removeLocalValue(id) {\n    if (lcst) {\n      if (typeof id === 'object') {\n        for (var key in id) {\n          try {\n            lcst.removeItem(id[key]);\n          } catch (err) {\n          }\n        }\n      } else {\n        try {\n          lcst.removeItem(id);\n        } catch (err) {\n        }\n      }\n    }\n    return this;\n  }\n\n  this.set = setLocalValue;\n  this.get = getLocalValue;\n  this.del = removeLocalValue;\n}\n\nmodule.exports = new localStorage;\n"
  },
  {
    "path": "app/templates/app/src/util/MetaHandler.js",
    "content": "var ua = navigator.userAgent,\n  android = ua.match(/(Android);?[\\s\\/]+([\\d.]+)?/),\n  ipad = ua.match(/(iPad).*OS\\s([\\d_]+)/),\n  ipod = ua.match(/(iPod)(.*OS\\s([\\d_]+))?/),\n  iphone = !ipad && ua.match(/(iPhone\\sOS)\\s([\\d_]+)/),\n  os = {};\n\nif (android) os.android = true, os.version = android[2];\nif (iphone && !ipod) os.ios = os.iphone = true, os.version = iphone[2].replace(/_/g, '.')\nif (ipad) os.ios = os.ipad = true, os.version = ipad[2].replace(/_/g, '.')\nif (ipod) os.ios = os.ipod = true, os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null;\n\nvar MetaHandler = function () {\n  //MONOSTATE\n  if (MetaHandler.prototype.instance) {\n    return MetaHandler.prototype.instance;\n  }\n  var me = this;\n  var meta = {}, _els;\n\n  /**\n   * _els\n   * meta = {name:{content:String,seriation:Array,store:{property:String},...},...}\n   * @method init\n   */\n  function init() {\n    _els = document.getElementsByTagName('meta');\n    for (var i = 0; i < _els.length; i++) {\n      var name = _els[i].name;\n      if (name) {\n        meta[name] = {};\n        meta[name].el = _els[i];\n        meta[name].content = _els[i].content;\n        meta[name].seriation = meta[name].content.split(',');\n        meta[name].store = getContentStore(name);\n      }\n    }\n    return me;\n  }\n\n  function getContentStore(name) {\n    var content = meta[name].seriation, store = {};\n    for (var i = 0; i < content.length; i++) {\n      if (content[i].length < 1) {\n        content[i] = null;\n        delete content[i];\n        content.length--;\n      } else {\n        var ct = content[i].split('='),\n          pp = ct[0];\n        if (pp) {\n          store[pp] = ct[1];\n        }\n      }\n    }\n    return store;\n  }\n\n  this.hasMeta = function (name) {\n    return meta[name] ? 1 : 0;\n  }\n  this.createMeta = function (name) {\n    if (!this.hasMeta(name)) {\n      var el = document.createElement('meta');\n      el.name = name;\n      document.head.appendChild(el);\n      meta[name] = {};\n      meta[name].el = el;\n      meta[name].content = '';\n      meta[name].seriation = [];\n      meta[name].store = {};\n    }\n    return me;\n  }\n  this.setContent = function (name, value) {\n    meta[name].content = value;\n    meta[name].el.content = value;\n    return me;\n  }\n  this.getContent = function (name) {\n    return meta[name] && meta[name].content;\n  }\n  function updateContent(name) {\n    meta[name].content = meta[name].seriation.join(',');\n    me.setContent(name, meta[name].content);\n    return me;\n  }\n\n  this.removeContentProperty = function (name, property) {\n    var _property = property;\n    if (meta[name]) {\n      if (meta[name].store[_property] != null) {\n        for (var i = 0; i < meta[name].seriation.length; i++) {\n          if (meta[name].seriation[i].indexOf(property + '=') != -1) {\n            meta[name].seriation[i] = null;\n            delete meta[name].seriation[i];\n            break;\n          }\n        }\n      }\n      updateContent(name);\n    }\n    return me;\n  }\n  this.getContentProperty = function (name, property) {\n    return meta[name] && meta[name].store[property];\n  }\n  this.setContentProperty = function (name, property, value) {\n    var _property = property,\n      pv = property + '=' + value;\n    if (meta[name]) {\n      if (meta[name].store[_property] != null) {\n        meta[name].store[_property] = value;\n        for (var i = 0; i < meta[name].seriation.length; i++) {\n          if (meta[name].seriation[i].indexOf(property + '=') != -1) {\n            meta[name].seriation[i] = pv;\n            break;\n          }\n        }\n      } else {\n        meta[name].store[_property] = value;\n        meta[name].seriation.push(pv);\n      }\n      updateContent(name);\n    }\n    return me;\n  }\n\n  /**\n   * Automatically adjusts according to a device’s screen size.\n   * Base on [theory](https://www.icloud.com/keynote/AwBWCAESEJd5uucfBPGt6KPotb3tNfsaKm-Q7fqs2-4ojmPoPJuWZCvjYgKl5jEf1URdRgdgNHe38BTzeF3DK7q1ewMCUCAQEEIJ85mw21ii_AwybOqxoF-V02v51Vdg855ED4qVA_8bXr)\n   *\n   * Note:\n   *  For iOS it just works perfectly,if it's not,try to use \"webView.scalesPageToFit = YES\" in the webview.\n   *  For android it works in all of build-in broswers,it might be break in some third-part ROM's build-in broswers(webview).\n   *  That's because they don't do a good job for the webview,such as they should not use \"webview.setBuiltInZoomControls(false)\".\n   *\n   *  This is a painless solution.For more extra work,checkout the [REM solution](http://gregrickaby.com/using-the-golden-ratio-and-rems/).\n   *\n   * e.g.\n   *     <head>\n   *      ....\n   *      <!-- defind the viewport meta -->\n   *      <meta content=\"target-densitydpi=device-dpi,width=640\" name=\"viewport\">\n   *      <!-- set the body's width to be the same as the viewport's width -->\n   *      <style type=\"text/css\">\n   *           body{width: 640px;}\n   *      </style>\n   *      <!-- magic happens here -->\n   *      <script> (new MetaHandler()).fixViewportWidth(); </script>\n   *     </head>\n   *\n   * Demo:\n   * [NetEase newsapp member club](http://c.3g.163.com/CreditMarket/default.html)\n   * [Deja Fashion topic](http://m.deja.me/topics/#/special/9)\n   *\n   * @param width {number} the size of the viewport\n   * @param fixBody {boolean} force to set body's width as same as the size of the viewport\n   */\n  this.fixViewportWidth = function (width, fixBody) {\n    width = width || me.getContentProperty('viewport', 'width');\n    if (width != 'device-width') {\n      var iw = window.innerWidth || width,\n        ow = window.outerWidth || iw,\n        sw = window.screen.width || iw,\n        saw = window.screen.availWidth || iw,\n        ih = window.innerHeight || width,\n        oh = window.outerHeight || ih,\n        sh = window.screen.height || ih,\n        sah = window.screen.availHeight || ih,\n        w = Math.min(iw, ow, sw, saw, ih, oh, sh, sah),\n        ratio = w / width,\n        dpr = window.devicePixelRatio;\n      ratio = Math.min(ratio, dpr);\n\n      //fixBody may trigger a reflow,you should not use it if you could do it in your css\n      if (fixBody) {\n        document.body.style.width = width + 'px';\n      }\n\n      if (os.android) {\n        me.removeContentProperty('viewport', 'user-scalable')\n          .setContentProperty('viewport', 'target-densitydpi', 'device-dpi')\n          .setContentProperty('viewport', 'initial-scale', ratio)\n          .setContentProperty('viewport', 'maximum-scale', ratio);\n      } else if (os.ios && !os.android) {\n        me.setContentProperty('viewport', 'user-scalable', 'no');\n        //scale for UIWebview\n        if ( os.ios && parseInt(os.version) < 7 || !(window.indexedDB || window.webkitIndexedDB) ){\n          me.setContentProperty('viewport', 'initial-scale', ratio);\n        }\n      }\n    }\n  }\n  init();\n  //MONOSTATE\n  MetaHandler.prototype.instance = this;\n};\n\nmodule.exports = new MetaHandler;\n"
  },
  {
    "path": "app/templates/app/src/util/Number.js",
    "content": "function formatMoney(num) {\n  return (num).toFixed(2).replace(/./g, function (c, i, a) {\n    return i && c !== \".\" && !((a.length - i) % 3) ? ',' + c : c;\n  });\n}\n\n/**\n * count down and increase number\n * @param option = {\n   *  el,dest,rate,duration\n   * }\n */\nfunction countNum(option) {\n  option = option || {};\n  if (!option.el) {\n    return;\n  }\n\n  var total = option.dest || 0,\n    rate = option.rate || 50,\n    duration = option.duration || 1500,\n    totalEl = option.el,\n    curNum = parseInt(totalEl.innerHTML) || 0,\n    increase = Math.round(Math.abs(curNum - total) / (duration / rate)) || 1,\n    countDown = curNum > total;\n\n  function fn() {\n    if ((!countDown && curNum >= total) || (countDown && curNum <= total)) {\n      totalEl.innerHTML = total;\n    } else {\n      totalEl.innerHTML = curNum;\n      curNum += countDown ? (-increase) : increase;\n      setTimeout(fn, rate);\n    }\n  }\n\n  fn();\n}\n\n/**\n * Returns a random number between min (inclusive) and max (exclusive)\n * @param min\n * @param max\n * @returns {*}\n */\nfunction randomArbitrary(min, max) {\n  return Math.random() * (max - min) + min;\n}\n\nmodule.exports = {\n  formatMoney: formatMoney,\n  countNum: countNum,\n  randomArbitrary: randomArbitrary\n}\n"
  },
  {
    "path": "app/templates/app/src/util/OpenAppInBrowser.js",
    "content": "var Navigator = require('core/Navigator');\n\nvar nav = navigator,\n  isiOS = (/iphone|ipod/gi).test(nav.platform)||(/ipad/gi).test(nav.platform),\n  isAndroid = (/Android/gi).test(nav.userAgent),\n  isWeixin = (/MicroMessenger/ig).test(nav.userAgent),\n  config = {\n    default: '',\n    wx: '',\n    iOS: '',\n    schema: ''\n  };\n\nfunction redirectToPage(link) {\n  if (link) {\n    window.location = decodeURIComponent(link);\n  }\n}\n\nfunction download() {\n  redirectToPage(config.default);\n}\n\nfunction wxOpen() {\n  redirectToPage(config.wx);\n}\n\nfunction iOSOpen() {\n  //先跳转后下载\n  //参看 http://www.iunbug.com/archives/2012/09/18/401.html\n  config.schema && redirectToPage(config.schema);\n  setTimeout(function () {\n    redirectToPage(config.iOS);\n  }, 50);\n}\n\nfunction androidOpen() {\n  //打开同时下载\n  config.schema && Navigator.protocol(decodeURIComponent(config.schema), true);\n  download();\n}\n\n/*\n * iOS点击打开:\n 1.如果是微信就去引导图页面\n 2.如果不是微信就走安装就打开不安装就去app store\n 3.如果微信用户按引导图从浏览器打开就能走通第2条\n\n android点击打开:\n 1.如果是微信就在打开的时候同时跳转到有图的引导页\n 2.如果不是微信就同时跳转到公公共下载页\n 3.如果微信用户按引导图从浏览器打开就能走通第2条\n */\n/**\n * conf = {\n *   default, //link for default redirect to\n *   wx, //link to open in WeChat\n *   iOS,// open AppStore\n *   schema,// URL schema for open your app\n * }\n */\nfunction openAppInBrowser(conf) {\n  config = conf || config;\n\n  if (isWeixin) {\n    wxOpen();\n  } else if (isiOS && !isAndroid) {\n    iOSOpen();\n  } else {\n    androidOpen();\n  }\n}\n\n\nmodule.exports = openAppInBrowser;\n"
  },
  {
    "path": "app/templates/app/src/util/RandomColor.js",
    "content": "// randomColor by David Merfield under the MIT license\n// https://github.com/davidmerfield/randomColor/\nvar randomColor = (function () {\n\n  // Seed to get repeatable colors\n  var seed = null;\n\n  // Shared color dictionary\n  var colorDictionary = {};\n\n  // Populate the color dictionary\n  loadColorBounds();\n\n  var randomColor = function (options) {\n\n    options = options || {};\n\n    if (options.seed && !seed) {\n      seed = options.seed;\n    }\n\n    var H, S, B;\n\n    // Check if we need to generate multiple colors\n    if (options.count !== null && options.count !== undefined) {\n\n      var totalColors = options.count,\n        colors = [];\n\n      options.count = null;\n\n      while (totalColors > colors.length) {\n        colors.push(randomColor(options));\n      }\n\n      options.count = totalColors;\n\n      //Keep the seed constant between runs.\n      if (options.seed && totalColors !== colors.length) {\n        seed = options.seed;\n      } else {\n        seed = null;\n      }\n\n      return colors;\n    }\n\n    // First we pick a hue (H)\n    H = pickHue(options);\n\n    // Then use H to determine saturation (S)\n    S = pickSaturation(H, options);\n\n    // Then use S and H to determine brightness (B).\n    B = pickBrightness(H, S, options);\n\n    // Then we return the HSB color in the desired format\n    return setFormat([H, S, B], options);\n  };\n\n  function pickHue(options) {\n\n    var hueRange = getHueRange(options.hue),\n      hue = randomWithin(hueRange);\n\n    // Instead of storing red as two seperate ranges,\n    // we group them, using negative numbers\n    if (hue < 0) {\n      hue = 360 + hue;\n    }\n\n    return hue;\n\n  }\n\n  function pickSaturation(hue, options) {\n\n    if (options.luminosity === 'random') {\n      return randomWithin([0, 100]);\n    }\n\n    if (options.hue === 'monochrome') {\n      return 0;\n    }\n\n    var saturationRange = getSaturationRange(hue);\n\n    var sMin = saturationRange[0],\n      sMax = saturationRange[1];\n\n    switch (options.luminosity) {\n\n      case 'bright':\n        sMin = 55;\n        break;\n\n      case 'dark':\n        sMin = sMax - 10;\n        break;\n\n      case 'light':\n        sMax = 55;\n        break;\n    }\n\n    return randomWithin([sMin, sMax]);\n\n  }\n\n  function pickBrightness(H, S, options) {\n\n    var bMin = getMinimumBrightness(H, S),\n      bMax = 100;\n\n    switch (options.luminosity) {\n\n      case 'dark':\n        bMax = bMin + 20;\n        break;\n\n      case 'light':\n        bMin = (bMax + bMin) / 2;\n        break;\n\n      case 'random':\n        bMin = 0;\n        bMax = 100;\n        break;\n    }\n\n    return randomWithin([bMin, bMax]);\n  }\n\n  function setFormat(hsv, options) {\n\n    switch (options.format) {\n\n      case 'hsvArray':\n        return hsv;\n\n      case 'hslArray':\n        return HSVtoHSL(hsv);\n\n      case 'hsl':\n        var hsl = HSVtoHSL(hsv);\n        return 'hsl(' + hsl[0] + ', ' + hsl[1] + '%, ' + hsl[2] + '%)';\n\n      case 'hsla':\n        var hslColor = HSVtoHSL(hsv);\n        return 'hsla(' + hslColor[0] + ', ' + hslColor[1] + '%, ' + hslColor[2] + '%, ' + Math.random() + ')';\n\n      case 'rgbArray':\n        return HSVtoRGB(hsv);\n\n      case 'rgb':\n        var rgb = HSVtoRGB(hsv);\n        return 'rgb(' + rgb.join(', ') + ')';\n\n      case 'rgba':\n        var rgbColor = HSVtoRGB(hsv);\n        return 'rgba(' + rgbColor.join(', ') + ', ' + Math.random() + ')';\n\n      default:\n        return HSVtoHex(hsv);\n    }\n\n  }\n\n  function getMinimumBrightness(H, S) {\n\n    var lowerBounds = getColorInfo(H).lowerBounds;\n\n    for (var i = 0; i < lowerBounds.length - 1; i++) {\n\n      var s1 = lowerBounds[i][0],\n        v1 = lowerBounds[i][1];\n\n      var s2 = lowerBounds[i + 1][0],\n        v2 = lowerBounds[i + 1][1];\n\n      if (S >= s1 && S <= s2) {\n\n        var m = (v2 - v1) / (s2 - s1),\n          b = v1 - m * s1;\n\n        return m * S + b;\n      }\n\n    }\n\n    return 0;\n  }\n\n  function getHueRange(colorInput) {\n\n    if (typeof parseInt(colorInput) === 'number') {\n\n      var number = parseInt(colorInput);\n\n      if (number < 360 && number > 0) {\n        return [number, number];\n      }\n\n    }\n\n    if (typeof colorInput === 'string') {\n\n      if (colorDictionary[colorInput]) {\n        var color = colorDictionary[colorInput];\n        if (color.hueRange) {\n          return color.hueRange;\n        }\n      }\n    }\n\n    return [0, 360];\n\n  }\n\n  function getSaturationRange(hue) {\n    return getColorInfo(hue).saturationRange;\n  }\n\n  function getColorInfo(hue) {\n\n    // Maps red colors to make picking hue easier\n    if (hue >= 334 && hue <= 360) {\n      hue -= 360;\n    }\n\n    for (var colorName in colorDictionary) {\n      var color = colorDictionary[colorName];\n      if (color.hueRange &&\n        hue >= color.hueRange[0] &&\n        hue <= color.hueRange[1]) {\n        return colorDictionary[colorName];\n      }\n    }\n    return 'Color not found';\n  }\n\n  function randomWithin(range) {\n    if (seed === null) {\n      return Math.floor(range[0] + Math.random() * (range[1] + 1 - range[0]));\n    } else {\n      //Seeded random algorithm from http://indiegamr.com/generate-repeatable-random-numbers-in-js/\n      var max = range[1] || 1;\n      var min = range[0] || 0;\n      seed = (seed * 9301 + 49297) % 233280;\n      var rnd = seed / 233280.0;\n      return Math.floor(min + rnd * (max - min));\n    }\n  }\n\n  function HSVtoHex(hsv) {\n\n    var rgb = HSVtoRGB(hsv);\n\n    function componentToHex(c) {\n      var hex = c.toString(16);\n      return hex.length == 1 ? '0' + hex : hex;\n    }\n\n    var hex = '#' + componentToHex(rgb[0]) + componentToHex(rgb[1]) + componentToHex(rgb[2]);\n\n    return hex;\n\n  }\n\n  function defineColor(name, hueRange, lowerBounds) {\n\n    var sMin = lowerBounds[0][0],\n      sMax = lowerBounds[lowerBounds.length - 1][0],\n\n      bMin = lowerBounds[lowerBounds.length - 1][1],\n      bMax = lowerBounds[0][1];\n\n    colorDictionary[name] = {\n      hueRange: hueRange,\n      lowerBounds: lowerBounds,\n      saturationRange: [sMin, sMax],\n      brightnessRange: [bMin, bMax]\n    };\n\n  }\n\n  function loadColorBounds() {\n\n    defineColor(\n      'monochrome',\n      null,\n      [[0, 0], [100, 0]]\n    );\n\n    defineColor(\n      'red',\n      [-26, 18],\n      [[20, 100], [30, 92], [40, 89], [50, 85], [60, 78], [70, 70], [80, 60], [90, 55], [100, 50]]\n    );\n\n    defineColor(\n      'orange',\n      [19, 46],\n      [[20, 100], [30, 93], [40, 88], [50, 86], [60, 85], [70, 70], [100, 70]]\n    );\n\n    defineColor(\n      'yellow',\n      [47, 62],\n      [[25, 100], [40, 94], [50, 89], [60, 86], [70, 84], [80, 82], [90, 80], [100, 75]]\n    );\n\n    defineColor(\n      'green',\n      [63, 178],\n      [[30, 100], [40, 90], [50, 85], [60, 81], [70, 74], [80, 64], [90, 50], [100, 40]]\n    );\n\n    defineColor(\n      'blue',\n      [179, 257],\n      [[20, 100], [30, 86], [40, 80], [50, 74], [60, 60], [70, 52], [80, 44], [90, 39], [100, 35]]\n    );\n\n    defineColor(\n      'purple',\n      [258, 282],\n      [[20, 100], [30, 87], [40, 79], [50, 70], [60, 65], [70, 59], [80, 52], [90, 45], [100, 42]]\n    );\n\n    defineColor(\n      'pink',\n      [283, 334],\n      [[20, 100], [30, 90], [40, 86], [60, 84], [80, 80], [90, 75], [100, 73]]\n    );\n\n  }\n\n  function HSVtoRGB(hsv) {\n\n    // this doesn't work for the values of 0 and 360\n    // here's the hacky fix\n    var h = hsv[0];\n    if (h === 0) {\n      h = 1;\n    }\n    if (h === 360) {\n      h = 359;\n    }\n\n    // Rebase the h,s,v values\n    h = h / 360;\n    var s = hsv[1] / 100,\n      v = hsv[2] / 100;\n\n    var h_i = Math.floor(h * 6),\n      f = h * 6 - h_i,\n      p = v * (1 - s),\n      q = v * (1 - f * s),\n      t = v * (1 - (1 - f) * s),\n      r = 256,\n      g = 256,\n      b = 256;\n\n    switch (h_i) {\n      case 0:\n        r = v;\n        g = t;\n        b = p;\n        break;\n      case 1:\n        r = q;\n        g = v;\n        b = p;\n        break;\n      case 2:\n        r = p;\n        g = v;\n        b = t;\n        break;\n      case 3:\n        r = p;\n        g = q;\n        b = v;\n        break;\n      case 4:\n        r = t;\n        g = p;\n        b = v;\n        break;\n      case 5:\n        r = v;\n        g = p;\n        b = q;\n        break;\n    }\n\n    var result = [Math.floor(r * 255), Math.floor(g * 255), Math.floor(b * 255)];\n    return result;\n  }\n\n  function HSVtoHSL(hsv) {\n    var h = hsv[0],\n      s = hsv[1] / 100,\n      v = hsv[2] / 100,\n      k = (2 - s) * v;\n\n    return [\n      h,\n      Math.round(s * v / (k < 1 ? k : 2 - k) * 10000) / 100,\n      k / 2 * 100\n    ];\n  }\n\n  return randomColor;\n})();\n\nmodule.exports = randomColor;\n"
  },
  {
    "path": "app/templates/app/src/util/RandomList.js",
    "content": "/**\n * 随机数组\n */\nfunction randomList(list, len, verify, ratio) {\n  var rs = [], _list = list.slice(0);\n  len = len || _list.length;\n  ratio = ratio ? ratio : 0;\n  function rd(_array) {\n    _array = _array.sort(function () {\n      return (0.5 - Math.random());\n    });\n  }\n\n  while (ratio) {\n    rd(_list);\n    ratio--;\n  }\n  if (_list.length <= len) {\n    rs = _list;\n  } else {\n    while (rs.length < len) {\n      var index = Math.floor(Math.random() * _list.length),\n        item = _list[index];\n      if (( verify && verify.call(this, item, _list) ) || !verify) {\n        rs.push(item);\n        _list.splice(index, 1);\n      }\n    }\n  }\n  return rs;\n}\n\nmodule.exports = randomList;\n"
  },
  {
    "path": "app/templates/app/src/util/RequestAnimationFrame.js",
    "content": "//http://notes.jetienne.com/2011/05/18/cancelRequestAnimFrame-for-paul-irish-requestAnimFrame.html\nwindow.cancelRequestAnimFrame = (function () {\n  return window.cancelAnimationFrame ||\n    window.webkitCancelRequestAnimationFrame ||\n    clearTimeout\n})();\nwindow.requestAnimFrame = (function () {\n  return window.requestAnimationFrame ||\n    window.webkitRequestAnimationFrame ||\n    function (/* function */ callback, /* DOMElement */ element) {\n      return window.setTimeout(callback, 1000 / 60);\n    };\n})();\n"
  },
  {
    "path": "app/templates/app/src/util/RequestHandler.js",
    "content": "var RequestHandler = (function () {\n  /**\n   * AJAX管理器\n   *\n   * @param Object option\n   * option:{\n         *  type : String 请求类型POST/GET\n         *  dataType : String 数据解析类型\n         *  action :String 请求action\n         *  data : Object 请求参数\n         *  complete :Function 完毕回调方法\n         * }\n   * @method AJAXHandler\n   */\n  function AJAXHandler(option) {\n    if (!option) {\n      return;\n    }\n    var conf = {};\n    for (var name in option) conf[name] = option[name];\n    conf.url = conf.action || conf.url;\n    conf.data = conf.data || null;\n    delete conf.complete;\n    delete conf.action;\n    conf.success = function (data, status, xhr) {\n      if (option.complete && typeof option.complete === 'function') {\n        option.complete({\n          data: data,\n          success: true\n        });\n      }\n    };\n    conf.error = function (xhr, errorType, error) {\n      if (option.complete && typeof option.complete === 'function') {\n        option.complete({\n          success: false\n        });\n      }\n    };\n    $.ajax(conf);\n  }//end AJAXHandler\n  function JSONP(option) {\n    if (!option) {\n      return;\n    }\n    $.ajax({\n      type: 'GET',\n      url: option.action || option.url,\n      dataType: 'jsonp',\n      jsonp: false,\n      jsonpCallback: false,\n      contentType: \"application/json\",\n      data: option.data || null//空值设置null避免向后端发送undefined无用参数\n    });\n  }\n\n  function getJSON(option) {\n    if (!option) {\n      return;\n    }\n    option.type = 'GET';\n    option.dataType = 'json';\n    AJAXHandler(option);\n  }//end getJSON\n\n  function postJSON(option) {\n    if (!option) {\n      return;\n    }\n    option.type = 'POST';\n    option.dataType = 'json';\n    AJAXHandler(option);\n  }//end postJSON\n  return {\n    getJSON: getJSON,\n    postJSON: postJSON,\n    JSONP: JSONP\n  }\n})();\nmodule.exports = RequestHandler;\n"
  },
  {
    "path": "app/templates/app/src/util/Scratch.js",
    "content": "function Scratch(option) {\n  option = option || {};\n  var me = this,\n    emptyFn = function () {\n    },\n    el = option.el,\n    GlobalTouch = option.GlobalTouch,\n    coverSrc = option.coverSrc,\n    width = option.width || el.width(),\n    height = option.height || el.height(),\n    finger = option.finger || 60,\n    minScratch = option.minScratch || 99,\n    card, isReady, scratch,\n    hasOnCardMinScratch = false;\n\n  var onSetCover = option.onSetCover || emptyFn,\n    onCoverReady = option.onCoverReady || emptyFn,\n    onCardFirstScratch = option.onCardFirstScratch || emptyFn,\n    onCardMinScratch = option.onCardMinScratch || emptyFn;\n\n  function init() {\n    card = createCard();\n    me.reset();\n    bindEvent();\n  }\n\n  this.reset = function () {\n    scratch = {\n      started: false,\n      scratching: false,\n      timer: 0\n    }\n    card.ctx.globalCompositeOperation = 'source-over';\n    me.setCover(coverSrc);\n    cancelRequestAnimFrame(scratch.timer);\n  }\n  function bindEvent() {\n    var cEl = $(card.canvas);\n    cEl.on('touchstart', function (e) {\n      GlobalTouch.preventMove = true;\n      if (!isReady) {\n        return;\n      }\n      if (!scratch.started) {\n        onCardFirstScratch();\n      }\n      scratch.started = true;\n      scratch.scratching = true;\n      card.offset = $(card.canvas).offset();\n\n      var touch = e.touches[0];\n      scratch.dirX = Math.floor(touch.pageX - card.offset.left);\n      scratch.dirY = Math.floor(touch.pageY - card.offset.top);\n\n      startScratch();\n      drawScratch();\n    });\n    cEl.on('touchmove', function (e) {\n      GlobalTouch.preventMove = true;\n      var touch = e.touches[0];\n      scratch.distX = Math.floor(touch.pageX - card.offset.left);\n      scratch.distY = Math.floor(touch.pageY - card.offset.top);\n    });\n    cEl.on('touchend', function () {\n      scratch.scratching = false;\n      GlobalTouch.preventMove = false;\n      card.ctx.closePath();\n      cancelRequestAnimFrame(scratch.timer);\n      if (!hasOnCardMinScratch && scratchPercentage() > minScratch) {\n        onCardMinScratch();\n        hasOnCardMinScratch = true;\n      }\n    });\n  }\n\n  function createCard() {\n    var canvas = document.createElement('canvas');\n    ctx = canvas.getContext('2d');\n    ctx.globalCompositeOperation = 'none';\n    canvas.setAttribute('width', width);\n    canvas.setAttribute('height', height);\n    el.html(canvas);\n    return {\n      canvas: canvas,\n      ctx: ctx\n    }\n  }\n\n  this.setCover = function (src) {\n    onSetCover();\n    hasOnCardMinScratch = false;\n    isReady = false;\n    var _img = new Image();\n    _img.onload = function () {\n      drawCover(_img);\n      _img = null;\n    }\n    _img.src = src;\n  }\n  function drawCover(image) {\n    isReady = true;\n    card.ctx.drawImage(image, 0, 0, width, height);\n    onCoverReady(this);\n  }\n\n  function drawScratch() {\n    if (scratch.scratching) {\n      if (scratch.distX != scratch.lastDistX || scratch.distY != scratch.lastDistY) {\n        scratch.lastDistX = scratch.distX;\n        scratch.lastDistY = scratch.distY;\n        card.ctx.lineTo(scratch.distX, scratch.distY);\n        card.ctx.stroke();\n\n        card.canvas.style['margin-right'] = card.canvas.style['margin-right'] == '1px' ? '0px' : '1px';\n      }\n      scratch.timer = requestAnimFrame(drawScratch);\n    } else {\n      card.ctx.closePath();\n    }\n  }\n\n  function startScratch() {\n    scratch.distX = scratch.dirX;\n    scratch.distY = scratch.dirY;\n    scratch.lastDistX = scratch.distX;\n    scratch.lastDistY = scratch.distY;\n\n    card.ctx.globalCompositeOperation = 'destination-out';\n    card.ctx.lineJoin = 'round';\n    card.ctx.lineCap = 'round';\n    card.ctx.strokeStyle = '#000';\n    card.ctx.lineWidth = finger;\n\n    card.ctx.beginPath();\n    card.ctx.arc(scratch.dirX, scratch.dirY, finger / 2, 0, Math.PI * 2, true);\n    card.ctx.closePath();\n    card.ctx.fill();\n    card.ctx.beginPath();\n    card.ctx.moveTo(scratch.dirX, scratch.dirY);\n  }\n\n  function scratchPercentage() {\n    var hits = 0;\n    var imageData = card.ctx.getImageData(0, 0, width, height);\n\n    for (var i = 0, ii = imageData.data.length; i < ii; i = i + 4) {\n      if (imageData.data[i] == 0 && imageData.data[i + 1] == 0 && imageData.data[i + 2] == 0 && imageData.data[i + 3] == 0) hits++;\n    }\n\n    return (hits / (width * height)) * 100;\n  }\n\n  this.destroy = function () {\n    el.html('');\n    card = null;\n  }\n\n  init();\n}\n\nmodule.exports = Scratch;\n"
  },
  {
    "path": "app/templates/app/src/util/SeededRandom.js",
    "content": "/**\n * 默认基于时间，返回指定范围内的随机数\n * 当seed不固定时速度比较慢，仅用于减少重复率\n * http://indiegamr.com/generate-repeatable-random-numbers-in-js/\n */\nfunction seededRandom(max, min, seed) {\n  var seed = seed || new Date().getTime(),\n    rnd;\n  max = max || 1;\n  min = min || 0;\n\n  seed = (seed * 9301 + 49297) % 233280;\n  rnd = seed / 233280;\n\n  return min + rnd * (max - min);\n}\n\nmodule.exports = seededRandom;\n"
  },
  {
    "path": "app/templates/app/src/util/Shake.js",
    "content": "/**\n * 摇一摇工具，如果 android 客户端则使用客户端的摇一摇接口\n *\n */\n\nvar _fn = function () {\n  },\n  x1 = 0, y1 = 0, z1 = 0, x2 = 0, y2 = 0, z2 = 0,\n  startstamp = 0,\n  threshold = 15,\n  duration = 1000,\n  timeout = 5000,\n  delayTimer = 0;\n\nvar _onStart = _fn;\nvar _onEnd = _fn;\n\nfunction onStart() {\n  _onStart();\n  _onStart = _fn;\n}\n\nfunction onEnd() {\n  delayTimer && clearTimeout(delayTimer);\n  _onEnd();\n  _onEnd = _fn;\n}\n\nvar checkDeviceMotion = function () {\n  var deltaX = Math.abs(x2 - x1),\n    deltaY = Math.abs(y2 - y1),\n    deltaZ = Math.abs(z2 - z1);\n\n  if ((deltaX > threshold && deltaY > threshold) || (deltaX > threshold && deltaZ > threshold) || (deltaY > threshold && deltaZ > threshold)) {\n    var curtime = (new Date()).getTime(),\n      d = curtime - startstamp;\n    if (d > duration) {\n      window.removeEventListener('devicemotion', _listener);\n      onEnd();\n      startstamp = curtime;\n    }\n  }\n\n  x2 = x1;\n  y2 = y1;\n  z2 = z1;\n}\n\nfunction _listener(e) {\n  x1 = e.accelerationIncludingGravity.x;\n  y1 = e.accelerationIncludingGravity.y;\n  z1 = e.accelerationIncludingGravity.z;\n  checkDeviceMotion();\n}\n\n/**\n * 监听摇一摇事件\n *\n * @method shakeListener\n * @param {Function} startCallback 当事件开始时触发的方法\n * @param {Function} endCallback 当事件结束时触发的方法\n * @param {Function} abortCallback 等待超时触发的方法\n * @param {Function} errorCallback 不支持摇一摇时触发的方法\n */\nfunction Shake(startCallback, endCallback, abortCallback, errorCallback) {\n  _onStart = startCallback || _onStart;\n  _onEnd = endCallback || _onEnd;\n  delayTimer && clearTimeout(delayTimer);\n\n  function originShakeListener() {\n    window.removeEventListener('devicemotion', _listener);\n\n    x1 = 0;\n    y1 = 0;\n    z1 = 0;\n    x2 = 0;\n    y2 = 0;\n    z2 = 0;\n    startstamp = (new Date()).getTime();\n    onStart();\n    window.addEventListener('devicemotion', _listener, false);\n\n    delayTimer = setTimeout(function () {\n      window.removeEventListener('devicemotion', _listener);\n      _onEnd = _fn;\n      abortCallback && abortCallback();\n    }, timeout);\n  }\n\n  function nativeShakeListener() {\n    if (window.extra && window.extra.__newsapp_shake_start) {\n      window.__newsapp_shake = onEnd;\n      onStart();\n      window.extra.__newsapp_shake_start();\n\n      delayTimer = setTimeout(function () {\n        window.extra.__newsapp_shake_stop && window.extra.__newsapp_shake_stop();\n        _onEnd = _fn;\n        abortCallback && abortCallback();\n      }, timeout);\n    }\n  }\n\n  var _shakeFn;\n  //使用新闻客户端的方法\n  if (window.extra && window.extra.__newsapp_shake_start) {\n    _shakeFn = nativeShakeListener;\n  }\n  //使用浏览器事件\n  else if (window.DeviceMotionEvent || ('ondevicemotion' in window)) {\n    _shakeFn = originShakeListener;\n  }\n  else {\n    _shakeFn = errorCallback;\n  }\n  _shakeFn && _shakeFn();\n}\n\nmodule.exports = Shake;\n"
  },
  {
    "path": "app/templates/app/src/util/SimpleSlider.js",
    "content": "function Slider(config) {\n  if (!config || !config.el) {\n    return null;\n  }\n  var _this = this;\n  var efn = function () {\n    },\n    el = config.el,\n    pages = el.children,\n    index = 0,\n    lastIndex = 0,\n    animTime = config.animTime || 600,\n    transitions = el.getAttribute('transitions');\n\n  var onFirst = config.onFirst || efn;\n  var onLast = config.onLast || efn;\n  var onPage = config.onPage || efn;\n\n  function init() {\n    if (!pages[0]) {\n      return;\n    }\n    el.classList.remove(transitions);\n    pages[0].classList.add('selected');\n    fixHeight(pages[0]);\n  }\n\n  this.reset = function () {\n    index = 0;\n    doPage(pages[index]);\n  }\n  this.prePage = function () {\n    index--;\n    index = index < 0 ? 0 : index;\n    if (index >= 0 && pages[index + 1]) {\n      doPage(pages[index + 1]);\n      index == 0 && onFirst();\n    }\n  }\n  this.nextPage = function () {\n    index++;\n    index = index > pages.length - 1 ? pages.length - 1 : index;\n    if (index <= pages.length - 1 && pages[index - 1]) {\n      doPage(pages[index - 1]);\n      index == (pages.length - 1) && onLast();\n    }\n  }\n  function doPage(src, dest) {\n    if (lastIndex == index) {\n      return;\n    }\n    lastIndex = index;\n    dest = dest || pages[index];\n\n    el.classList.add(transitions);\n    src.setAttribute('animate', '');\n    dest.setAttribute('animate', '');\n    src.offsetTop;\n    src.classList.remove('selected');\n    dest.classList.add('selected');\n\n    fixHeight(dest);\n\n    setTimeout(function () {\n      el.classList.remove(transitions);\n      for (var i = 0; i < pages.length; i++) {\n        pages[i].removeAttribute('animate');\n        (index != i) && pages[i].classList.remove('selected');\n      }\n    }, animTime + 100);\n    onPage(index);\n  }\n\n  function fixHeight(dest) {\n    if (config.fixHeight) {\n      var h = dest.offsetHeight + 0;\n      !!h && setTimeout(function () {\n        el.style['min-height'] = h + 'px';\n      }, 100);\n    }\n  }\n\n  init();\n}\n\nmodule.exports = Slider;\n"
  },
  {
    "path": "app/templates/app/src/util/Slider.js",
    "content": "/**\n *\n * @param option\n * {\n   * el, //list wrap element,optional if listEl is specified\n   * listEl,// list element,optional if el is specified\n   * processEl,//process element,optional if el is specified\n   * listCls, //[optional]css class to find the slide list,default \".list\"\n   * processCls, //[optional]css class to find the slide process,default \".process\"\n   *\n   * vertical, //[optional]slide direction,default horizontal(false)\n   * itemLen, //[optional]width(or height) for each item\n   * itemCount,//[optional]total item length for the list\n   * totalLen,//[optional]total width(or height) for the list\n   *\n   * enableDrag, //[optional]enable drag to move,default false\n   * enableLoop, //[optional]enable infinite loop,default false\n   * enableAutorun, //[optional]enable auto play,default false\n   * enableProcess, //[optional]enable default navigation process UI,default false\n   *\n   * moveTimeout, //[optional]time out for next move,default 100ms\n   * moveDuration, //[optional]time out for one move duration,default 640\n   * moveRate, //[optional]speed for animate one move,default 1.3\n   * dragAnim, //[optional]drag move animation timing function,default 'cubic-bezier(0.075, 0.82, 0.165, 1)'\n   * moveAnim, //[optional]auto move animation timing function,default 'ease'\n   *\n   * onMove, //[optional]on moving event listener\n   * onFirst, //[optional]on first slide event listener\n   * onLast, //[optional]on last slide event listener\n   * onTouchstart, //[optional]on touchstart event listener\n   * onTouchend, //[optional]on touchend  event listener\n   * onTouchmove //[optional]on touchmove  event listener\n   * }\n *\n * @method next() //move to next slide\n * @method pre() //move to pre slide\n * @method moveTo(index) //move to specified index slide,start from 0\n * @method reset() //reset to default state\n * @method refresh() //refresh for content changed\n * @method startAutoRun() //start to auto play\n * @method stopAutoRun() //stop auto play\n * @method getIndex() //get current index\n * @method getItemCount() //get current slides total count\n * @method removeCurrent(delay,callback) //remove current slide\n * @constructor Slider\n */\nfunction Slider(option) {\n  option = option || {};\n  var me = this,\n    emptyFn = function () {\n    },\n    el = option.listEl || option.el.find(option.listCls || '.list'),\n    pEl = option.processEl || el.siblings(option.processCls || '.process'),\n    isMoving = false,\n    isRemoving = false,\n    moveTimeout = option.moveTimeout || 100,\n    moveDuration = option.moveDuration || 640,\n    moveRate = option.moveRate || 1.3,\n    vertical = option.vertical,\n    index = 0,\n    totalLen,\n    itemCount,\n    itemLen,\n    orientation = true,\n    lastMove = 0,\n    autoTimer = 0,\n    loopTimer = 0,\n    loopCls = 'slider-duplicate',\n    currentCls = 'slider-current',\n    removeCls = 'slider-remove',\n    moveToFn = vertical ? moveToY : moveToX;\n  resetSize();\n  calculateSize();\n  var enableProcess = option.enableProcess,\n    enableAutorun = option.enableAutorun,\n    enableDrag = option.enableDrag,\n    enableLoop = option.enableLoop;\n  var onMove = option.onMove || emptyFn,\n    onFirst = option.onFirst || emptyFn,\n    onLast = option.onLast || emptyFn,\n    onTouchstart = option.onTouchstart || emptyFn,\n    onTouchend = option.onTouchend || emptyFn,\n    onTouchmove = option.onTouchmove || emptyFn;\n  var dragAnim = option.dragAnim || 'cubic-bezier(0.075, 0.82, 0.165, 1)',//'cubic-bezier(0.1, 0.57, 0.1, 1)';\n    moveAnim = option.moveAnim || 'ease';\n  var drag = {\n    moved: false,\n    timer: 0,\n    dirX: 0,\n    distX: 0,\n    dirY: 0,\n    distY: 0,\n    moveDistX: 0,\n    maxMove: itemLen / 2,\n    startTime: 0,\n    endTime: 0,\n    resetMaxMove: function () {\n      drag.maxMove = itemLen / 2;\n    },\n    distPos: function () {\n      return drag[vertical ? 'distY' : 'distX'];\n    },\n    reset: function () {\n      drag.moved = false;\n      drag.isSwipe = false;\n      drag.dirX = 0;\n      drag.distX = 0;\n      drag.dirY = 0;\n      drag.distY = 0;\n      drag.timer = 0;\n      drag.timer && cancelRequestAnimFrame(drag.timer);\n    },\n    move: function () {\n      if (!drag.moved) {\n        return;\n      }\n      var mX = -(index + (enableLoop ? 1 : 0)) * itemLen,\n        dx = Math.round(Math.abs(drag.distPos()) / moveRate);\n      drag.moveDistX = dx;\n      if (dx > itemLen * 9 / 10) {\n        drag.endDrag();\n        return;\n      } else if (drag.distPos() > 0) {\n        mX += dx;\n      } else {\n        mX -= dx;\n      }\n\n      moveToFn(mX, 0, dragAnim);\n      lastMove = -mX;\n    },\n    endDrag: function () {\n      drag.moved = false;\n      var mX = -index * itemLen,\n        dx = drag.moveDistX;\n      if (drag.isSwipe) {\n        drag.distPos() > 0 ? me.pre() : me.next();\n      } else {\n        if (drag.distPos() > 0) {\n          mX += dx;\n        } else {\n          mX -= dx;\n        }\n        if (mX >= 0 || mX <= -(totalLen - itemLen) || dx < drag.maxMove) {\n          move();\n        } else {\n          drag.distPos() > 0 ? me.pre() : me.next();\n        }\n      }\n\n      drag.reset();\n      me.startAutoRun();\n    }\n  };\n\n  function touchStart(e) {\n    if (itemCount < 2 || isMoving) {\n      return;\n    }\n    drag.startTime = new Date().getTime();\n    onTouchstart();\n    me.stopAutoRun();\n    totalLen = totalLen || el.width();\n    itemLen = itemLen || (totalLen / itemCount);\n    drag.resetMaxMove();\n    var touch = e.touches[0];\n    drag.moved = true;\n    drag.dirX = touch.pageX;\n    drag.distX = 0;\n    drag.dirY = touch.pageY;\n    drag.distY = 0;\n    (function animloop() {\n      if (!drag.moved) {\n        drag.reset();\n        return;\n      }\n      drag.move();\n      drag.timer = requestAnimFrame(animloop);\n    })();\n  }\n\n  function touchMove(e) {\n    var touch = e.touches[0];\n    drag.distX = touch.pageX - drag.dirX;\n    drag.distY = touch.pageY - drag.dirY;\n    onTouchmove(Math.abs(drag.distX), Math.abs(drag.distY));\n  }\n\n  function touchEnd(e) {\n    drag.endTime = new Date().getTime();\n    if (drag.moved) {\n      drag.isSwipe = drag.endTime - drag.startTime <= 200 && Math.abs(drag.distPos()) > 30;\n      drag.endDrag();\n    }\n    onTouchend(Math.abs(drag.distX), Math.abs(drag.distY));\n  }\n\n  if (enableDrag) {\n    el.touchstart = el.touchstart || touchStart;\n    el.touchmove = el.touchmove || touchMove;\n    el.touchend = el.touchend || touchEnd;\n    el.off('touchstart', el.touchstart);\n    el.off('touchmove', el.touchmove);\n    el.off('touchend', el.touchend);\n    el.on('touchstart', el.touchstart);\n    el.on('touchmove', el.touchmove);\n    el.on('touchend', el.touchend);\n  }\n\n  function move() {\n    if (isMoving) {\n      return;\n    }\n    isMoving = true;\n    setTimeout(function () {\n      isMoving = false;\n    }, moveTimeout);\n    if (!enableLoop) {\n      if (index > itemCount - 1) {\n        index = itemCount - 1;\n        onLast(index);\n      } else if (index < 0) {\n        index = 0;\n        onFirst(index);\n      }\n    }\n    var mx = (index + (enableLoop ? 1 : 0)) * itemLen,\n      absm = Math.abs(lastMove - mx),\n      mtime = Math.min(moveDuration, (moveDuration / itemLen) * absm),\n      animate = moveAnim;\n\n    if (drag.isSwipe) {\n      var velocity = drag.moveDistX * moveRate / (drag.endTime - drag.startTime);\n      mtime = velocity * absm;\n      animate = dragAnim;\n    }\n\n    lastMove = mx;\n    //修正android差1px的问题\n    //mx = (mx>0&&$.os.android)?(mx+1):mx;\n    moveToFn(-mx, mtime, animate);\n\n    stopLoopHelper();\n    if (enableLoop) {\n      var loopm;\n      if (index > itemCount - 1) {\n        loopm = itemLen;\n        index = 0;\n        lastMove = itemLen;\n        onLast(index);\n      } else if (index < 0) {\n        loopm = itemLen * itemCount;\n        index = itemCount - 1;\n        onFirst(index);\n      }\n      loopTimer = loopm !== undefined && setTimeout(function () {\n          moveToFn(-loopm);\n        }, mtime);\n    }\n    runProcess();\n    addClasses(index);\n    onMove(index);\n  }\n\n  function moveToX(x, time, anim) {\n    moveTo(x, 0, time, anim);\n  }\n\n  function moveToY(x, time, anim) {\n    moveTo(0, x, time, anim);\n  }\n\n  function moveTo(x, y, time, anim) {\n    el.css({\n      '-webkit-transform': 'translate3d(' + (x || 0) + 'px' + ',' + (y || 0) + 'px,0)',\n      '-webkit-transition': '-webkit-transform ' + (time || 0) + 'ms ' + (anim || moveAnim)\n    });\n  }\n\n  function remove(idx,delay,callback){\n    if(isRemoving){return;}\n    isRemoving = true;\n    var reEl = el.children().eq(idx),\n      isNext = idx<itemCount-1;\n    reEl.addClass(removeCls);\n    setTimeout(function(){\n      if(isNext){\n        me.next();\n      }else{\n        me.pre();\n      }\n      setTimeout(function(){\n        isRemoving = false;\n        reEl.remove();\n        if(isNext){\n          index--;\n          lastMove = index*itemLen;\n        }\n        me.refresh();\n        callback && callback(index,itemCount);\n      },itemCount>1?moveDuration:100);\n    },delay||0);\n  }\n\n  function stopLoopHelper() {\n    loopTimer && clearInterval(loopTimer);\n  }\n\n  function moveOrientation() {\n    calculateSize();\n    if (!enableLoop && index == itemCount - 1) {\n      orientation = false;\n    } else if (index == 0) {\n      orientation = true;\n    }\n    if (!orientation) {\n      me.pre();\n    } else {\n      me.next();\n    }\n  }\n\n  function renderProcess() {\n    if (enableProcess && itemCount > 1) {\n      var tmp = [];\n      for (var i = 0; i < itemCount; i++) {\n        tmp.push('<div></div>');\n      }\n      pEl.html(tmp.join(''));\n      pEl.show();\n      runProcess();\n    }\n  }\n\n  function renderLoop() {\n    if (enableLoop) {\n      el.find('.' + loopCls).remove();\n      var cels = [].slice.call(el.children()),\n        first = cels.pop().cloneNode(true),\n        last = cels.shift().cloneNode(true);\n      first.classList.add(loopCls);\n      last.classList.add(loopCls);\n      el.prepend(first);\n      el.append(last);\n    }\n  }\n\n  function runProcess() {\n    if (!enableProcess) {\n      return;\n    }\n    var processChild = pEl.find('div');\n    processChild.removeClass('on');\n    $(processChild[index]).addClass('on');\n  }\n\n  function resetSize() {\n    el.find('.' + loopCls).remove();\n    itemLen = option.itemLen || 0;\n    itemCount = option.itemCount || 0;\n    totalLen = option.totalLen || (itemCount * itemLen) || 0;\n  }\n\n  function calculateSize() {\n    var child = el.children();\n    itemLen = itemLen || child.eq(0)[vertical ? 'height' : 'width']();\n    itemCount = itemCount || child.length;\n    totalLen = totalLen || (itemLen * itemCount);\n  }\n\n  this.pre = function () {\n    if (isMoving) {\n      return;\n    }\n    index--;\n    move();\n  }\n\n  this.next = function () {\n    if (isMoving) {\n      return;\n    }\n    index++;\n    move();\n  }\n\n  this.first = function () {\n    if (isMoving) {\n      return;\n    }\n    index = 0;\n    move();\n  }\n\n  this.last = function () {\n    if (isMoving) {\n      return;\n    }\n    index = itemCount;\n    move();\n  }\n\n  this.moveTo = function (idx) {\n    index = idx;\n    move();\n  }\n\n  this.reset = function () {\n    index = 0;\n    orientation = true;\n    me.stopAutoRun();\n    pEl.hide();\n    resetSize();\n    calculateSize();\n    renderLoop();\n    lastMove = enableLoop ? itemLen : 0;\n    moveToFn(-lastMove);\n    drag.reset();\n    renderProcess();\n    me.startAutoRun();\n    addClasses(index);\n    onFirst(index);\n    onMove(index);\n  }\n  this.refresh = function () {\n    me.stopAutoRun();\n    pEl.hide();\n    resetSize();\n    calculateSize();\n    renderLoop();\n    moveToFn(-lastMove);\n    renderProcess();\n    me.startAutoRun();\n    addClasses(index);\n    onMove(index);\n  }\n\n  this.getIndex = function(){\n    return index;\n  }\n\n  this.getItemCount = function(){\n    return itemCount;\n  }\n\n  this.removeCurrent = function(delay,callback){\n    remove(index,delay,callback);\n  }\n\n  this.startAutoRun = function () {\n    if (enableAutorun && itemCount > 1) {\n      autoTimer = setInterval(function () {\n        if (drag.moved) {\n          return;\n        }//如果拖动就停止\n        moveOrientation();\n      }, 5000);\n    }\n  }\n\n  this.stopAutoRun = function () {\n    autoTimer && clearInterval(autoTimer);\n    stopLoopHelper();\n  }\n\n  function addClasses(idx) {\n    idx = enableLoop ? (idx + 1) : idx;\n    el.find('.' + currentCls).removeClass(currentCls);\n    el.children().eq(idx).addClass(currentCls);\n  }\n\n  this.reset();\n}\n\nmodule.exports = Slider;\n"
  },
  {
    "path": "app/templates/app/src/util/SlotMachine.js",
    "content": "function SlotMachine(option) {\n  option = option || {};\n  var me = this,\n    emptyFn = function () {\n    },\n    lightEl = option.lightEl,\n    sliderA = option.sliderA,\n    sliderB = option.sliderB,\n    sliderC = option.sliderC,\n    sliderList = option.sliderList,\n    slotUI = option.slotUI,\n    GlobalTouch = option.GlobalTouch,\n    sliderTpl = option.sliderTpl,\n    lightTimer = 0,\n    lightUpeateTime = 0,\n    lightStoped = true,\n    lightDuration = 350,\n    dataLen = 0,\n    listHeight = 0,\n    twoSameCount = 0,//失败时两个同时出现计数\n    moveLen = {},\n    winIndex = 0,\n    itemIndex = 0,\n    data;\n\n\n  var listLen = option.listLen || 15,//默认组数，全部奖品为一组,一共20组\n    wrapHeight = option.wrapHeight || 200,//可视区高度\n    itemHeight = option.itemHeight || 83,//项高度\n    extraMove = option.extraMove || 30,//额外移动距离，用于调整居中奖品\n    moveDuration = option.moveDuration || 2.0,//移动 毫秒每像素\n    minMove = option.minMove || 10;//最小滚动15组\n\n  var onPlay = option.onPlay || emptyFn,\n    onEndPlay = option.onEndPlay || emptyFn,\n    onReset = option.onReset || emptyFn,\n    onLighting = option.onLighting || emptyFn;\n\n  this.locked = false;\n\n  this.play = function (index) {\n    if (me.locked) {\n      return;\n    }\n    onPlay();\n    itemIndex = index;\n    var sfn = slideLose;\n    if (itemIndex != null) {\n      sfn = slideWin;\n    } else {\n      itemIndex = randomIndex(0, dataLen - 1);\n    }\n    setTimeout(function () {\n      sfn();\n    }, 1200);\n    slotUI.currentScrollData = data[itemIndex];\n\n    me.locked = true;\n  }\n  function computeMoveA() {\n    winIndex = randomIndex(3, listLen - 1);\n    while (winIndex >= (listLen - minMove)) {\n      winIndex = randomIndex(3, listLen - 1);\n    }\n    moveLen.A = ( winIndex * dataLen + (itemIndex) ) * itemHeight - extraMove * 2;\n  }\n\n  function slideWin() {\n    computeMoveA();\n    moveLen.B = moveLen.A + ( randomBool() ? (dataLen * itemHeight) : ( randomBool() ? (-dataLen * itemHeight) : 0 ) );\n    moveLen.C = moveLen.A + ( randomBool() ? (dataLen * itemHeight) : ( randomBool() ? (-dataLen * itemHeight) : 0 ) );\n    twoSameCount++;\n\n    startMove();\n  }\n\n  function slideLose() {\n    computeMoveA();\n    var _list = ['B', 'C'],\n      rs = [];\n    rs = _list.sort(function () {\n      return randomBool();\n    });\n\n    var tmpSame = randomBool(),\n      tmpIndex = randomIndex(0, dataLen - 1),\n      loseIndex = itemIndex;\n    while (loseIndex == itemIndex) {//最后一个不会跟第一个相同\n      loseIndex = randomIndex(0, dataLen - 1);\n    }\n    if (tmpIndex != loseIndex && twoSameCount < (dataLen / 2) && !tmpSame && tmpIndex != itemIndex) {//至少出现2个相同dataLen/2次才考虑出现三个不同\n      loseIndex = tmpIndex;\n    }\n    moveLen[rs[0]] = tmpSame\n      ? moveLen.A + ( randomBool() ? (dataLen * itemHeight) : (-dataLen * itemHeight) )\n      : ( ( winIndex * dataLen + ( tmpIndex + ( randomBool() ? dataLen : 0) ) ) * itemHeight - extraMove * 2 );\n    moveLen[rs[1]] = ( winIndex * dataLen + ( loseIndex + ( randomBool() ? dataLen : 0) ) ) * itemHeight - extraMove * 2;\n    if (tmpSame || itemIndex == tmpIndex) {\n      twoSameCount++;\n      slotUI.currentScrollData = data[itemIndex];\n    } else if (tmpIndex == loseIndex) {\n      twoSameCount++;\n      slotUI.currentScrollData = data[loseIndex];\n    } else {\n      twoSameCount = 0;\n      slotUI.currentScrollData = null;\n    }\n\n    startMove();\n  }\n\n  function startMove() {\n    var _list = [\n        {el: sliderB, move: moveLen.B, time: moveDuration * moveLen.B},\n        {el: sliderC, move: moveLen.C, time: moveDuration * moveLen.C},\n      ],\n      rs = [];\n    rs = _list.sort(function () {\n      return randomBool();\n    });\n\n    moveTo({el: sliderA, move: moveLen.A, time: moveDuration * moveLen.A});\n    setTimeout(function () {\n      moveTo(rs[0]);\n    }, 500);\n    setTimeout(function () {\n      moveTo(rs[1]);\n    }, 900);\n\n    startLight();\n  }\n\n  this.renderList = function () {\n    me.hide();\n    data = slotUI.slotChildData;\n    dataLen = data.length;\n    if (dataLen > 4 && 10 > dataLen - 4) {\n      listLen = 15 - (dataLen - 4);\n      minMove = 10 - (dataLen - 4);\n    }\n\n    var sList = [],\n      finalList = [],\n      finalHTML,\n      total = parseInt(listLen);\n\n    for (var i = 0; i < dataLen; i++) {\n      sList.push(sliderTpl({IMG: data[i].image}));\n    }\n    while (total) {\n      finalList.push('<div class=\"slider-group\">');\n      finalList.push(sList.join(''));\n      finalList.push('</div>');\n      total--;\n    }\n    finalHTML = finalList.join('');\n    sliderA.html(finalHTML);\n    sliderB.html(finalHTML);\n    sliderC.html(finalHTML);\n    me.reset();\n    me.show();\n  }\n  function moveTo(option) {\n    //http://stackoverflow.com/questions/7466070/how-can-i-achieve-a-slot-machine-spinning-effect-with-css3-jquery?rq=1\n    option.el.css({\n      '-webkit-transform': 'translate3D(0px,' + -option.move + 'px,0px)',\n      '-webkit-transition': '-webkit-transform ' + option.time + 'ms ease-in-out'\n    });\n  }\n\n  this.reset = function () {\n    GlobalTouch.preventMove = false;\n    stopLight();\n    me.locked = false;\n    listHeight = itemHeight * dataLen * listLen;\n    var move = listHeight - (wrapHeight + itemHeight - extraMove * 2);\n    moveTo({el: sliderA, move: move, time: 0});\n    moveTo({el: sliderB, move: move, time: 0});\n    moveTo({el: sliderC, move: move, time: 0});\n    sliderList.removeClass('fadein');\n    setTimeout(function () {\n      sliderList.addClass('fadein');\n    }, 0);\n    onReset();\n  }\n  this.show = function () {\n    sliderList.show();\n  }\n  this.hide = function () {\n    sliderList.hide();\n  }\n  function startLight() {\n    lightDuration = 200;\n    me.doLight();\n    var lastTime = ( Math.max(Math.max(moveLen.A, moveLen.B + 900), moveLen.C + 500) ) * moveDuration;\n    secTime = ( Math.min(Math.min(moveLen.A, moveLen.B + 900), moveLen.C + 500) ) * moveDuration;\n    setTimeout(function () {\n      lightDuration = 600;\n    }, secTime);\n    setTimeout(function () {\n      stopLight();\n      onEndPlay();\n    }, lastTime - 800);\n  }\n\n  function stopLight() {\n    lightStoped = true;\n    GlobalTouch.preventMove = false;\n    lightUpeateTime = 0;\n    setTimeout(function () {\n      lightDuration = 350;\n      lightEl.removeClass('off on');\n    }, 600);\n  }\n\n  function animateLight() {\n    var _nd = new Date().getTime();\n    if (_nd - lightUpeateTime >= lightDuration) {\n      lightUpeateTime = _nd;\n      if (lightEl.hasClass('on')) {\n        lightEl.removeClass('on').addClass('off');\n      } else if (lightEl.hasClass('off')) {\n        lightEl.removeClass('off').addClass('on');\n      } else {\n        lightEl.addClass('on');\n      }\n    }\n  }\n\n  this.doLight = function () {\n    window.scrollTo(0, 1);\n    lightStoped = false;\n    GlobalTouch.preventMove = true;\n    (function animloop() {\n      if (lightStoped) {\n        lightTimer && cancelRequestAnimFrame(lightTimer);\n        lightUpeateTime = 0;\n        return;\n      }\n      lightTimer = requestAnimFrame(animloop);\n      animateLight();\n    })();\n    onLighting();\n  }\n\n  function randomIndex(from, to) {\n    from = from || 0;\n    to = to || 0;\n    return Math.floor(Math.random() * (to - from + 1) + from);\n  }\n\n  function randomBool() {\n    return (0.5 > Math.random());\n  }\n}//end SlotMachine\nmodule.exports = SlotMachine;\n"
  },
  {
    "path": "app/templates/app/src/util/TabStatus.js",
    "content": "var store = {};\n\nfunction init(){\n  var data = {curIdx: 0};\n  this.getStatus  = function () {\n    return data;\n  }\n  this.setCurTabIdx = function (idx) {\n    data.curIdx = idx;\n  }\n  this.getCurTabIdx = function () {\n    return data.curIdx;\n  }\n  this.setTabPosition = function (idx) {\n    idx = idx || this.getCurTabIdx() || 0;\n    data[idx] = $(window).scrollTop();\n  }\n  this.getTabPosition = function(idx) {\n    return data[idx] || 1;\n  }\n  this.scrollToTabPosition = function(idx, budget){\n    window.scrollTo(0, Math.max(budget||1, this.getTabPosition(idx)))\n  }\n}\nfunction TabStatus(key){\n  store[key] = store[key] || new init();\n  return store[key];\n}\n\nmodule.exports = TabStatus;\n"
  },
  {
    "path": "app/templates/app/src/util/ThirdVendor.js",
    "content": "/**\n * 第三方平台\n */\nvar ua = window.navigator.userAgent;\nvar vendor = null;\n\nfunction isUA(name) {\n  var reg = new RegExp(name, 'gi');\n  return reg.test(ua);\n}\n\nif (isUA('Deja')) {\n  vendor = {\n    code: 'Deja',\n    name: 'DejaFashion'\n  }\n}\nelse if (isUA('FBAN')) {\n  vendor = {\n    code: 'Facebook',\n    name: 'Facebook'\n  }\n}\nelse if (isUA('Twitter')) {\n  vendor = {\n    code: 'Twitter',\n    name: 'Twitter'\n  }\n}\nelse if (isUA('Instagram')) {\n  vendor = {\n    code: 'Instagram',\n    name: 'Instagram'\n  }\n}\nelse if (isUA('weibo')) {\n  vendor = {\n    code: 'Weibo',\n    name: '微博'\n  }\n}\nelse if (isUA('MicroMessenger')) {\n  vendor = {\n    code: 'WX',\n    name: '微信'\n  }\n}\nelse if (isUA('QQ')) {\n  vendor = {\n    code: 'QQ',\n    name: 'QQ'\n  }\n}\nelse if (isUA('YiXin')) {\n  vendor = {\n    code: 'YX',\n    name: '易信'\n  }\n}\n\nmodule.exports = vendor;\n"
  },
  {
    "path": "app/templates/app/src/util/Unveil.js",
    "content": "/**\n * jQuery Unveil\n * A very lightweight jQuery plugin to lazy load images\n * http://luis-almeida.github.com/unveil\n *\n * Licensed under the MIT license.\n * Copyright 2013 Luís Almeida\n * https://github.com/luis-almeida\n */\n;(function ($) {\n\n  $.fn.unveil = function (threshold, callback) {\n\n    var $w = $(window),\n      th = threshold || 0,\n      retina = window.devicePixelRatio > 1,\n      attrib = retina ? \"data-src-retina\" : \"data-src\",\n      images = this,\n      loaded;\n\n    this.one(\"unveil\", function () {\n      var source = this.getAttribute(attrib);\n      source = source || this.getAttribute(\"data-src\");\n      if (source) {\n        if (typeof callback === \"function\") callback.call(this);\n        this.setAttribute(\"src\", source);\n      }\n    });\n\n    function unveil() {\n      var inview = images.filter(function () {\n        var $e = $(this);\n        //if ($e.is(\":hidden\")) return;\n\n        var wt = $w.scrollTop(),\n          wb = wt + $w.height(),\n          et = $e.offset().top,\n          eb = et + $e.height();\n\n        return eb >= wt - th && et <= wb + th;\n      });\n\n      loaded = inview.trigger(\"unveil\");\n      images = images.not(loaded);\n    }\n\n    $w.on(\"scroll.unveil resize.unveil lookup.unveil\", unveil);\n\n    unveil();\n\n    return this;\n\n  };\n\n})(window.Zepto);\n"
  },
  {
    "path": "app/templates/app/src/util/VersionCompare.js",
    "content": "/**\n * Simply compares two string version values.\n * https://gist.github.com/alexey-bass/1115557\n *\n * Example:\n * versionCompare('1.1', '1.2') => -1\n * versionCompare('1.1', '1.1') =>  0\n * versionCompare('1.2', '1.1') =>  1\n * versionCompare('2.23.3', '2.22.3') => 1\n *\n * Returns:\n * -1 = left is LOWER than right\n *  0 = they are equal\n *  1 = left is GREATER = right is LOWER\n *  And FALSE if one of input versions are not valid\n *\n * @function\n * @param {String} left  Version #1\n * @param {String} right Version #2\n * @return {Integer|Boolean}\n * @author Alexey Bass (albass)\n * @since 2011-07-14\n */\nvar versionCompare = function (left, right) {\n  if (typeof left + typeof right != 'stringstring')\n    return false;\n\n  var a = left.split('.')\n    , b = right.split('.')\n    , i = 0, len = Math.max(a.length, b.length);\n\n  for (; i < len; i++) {\n    if ((a[i] && !b[i] && parseInt(a[i]) > 0) || (parseInt(a[i]) > parseInt(b[i]))) {\n      return 1;\n    } else if ((b[i] && !a[i] && parseInt(b[i]) > 0) || (parseInt(a[i]) < parseInt(b[i]))) {\n      return -1;\n    }\n  }\n\n  return 0;\n}\n\nmodule.exports = versionCompare;\n"
  },
  {
    "path": "app/templates/app/src/util/VirtualDOMLite.js",
    "content": "require('lib/diffDOM');\n\n//https://github.com/fiduswriter/diffDOM\n;(function ($) {\n  $.fn.superHtml = $.fn.html;\n  $.fn.html = diffDOM\n    ? function (html, diff) {\n    if (diff && this._diffdom) {\n      var VDOM = this[0].cloneNode(),\n        VDD = new diffDOM(diff),\n        VDiff;\n      VDOM.innerHTML = html;\n      VDiff = VDD.diff(this[0], VDOM);\n      //fallback\n      if (!VDD.apply(this[0], VDiff)) {\n        this.superHtml.apply(this, arguments);\n      }\n      this.eq(0).trigger('virtualdomrendered');\n      return this;\n    } else {\n      this._diffdom = 1;\n      var res = this.superHtml.apply(this, arguments);\n      this.eq(0).trigger('virtualdomrendered');\n      return res;\n    }\n  }\n    : $.fn.superHtml;\n\n})(window.Zepto);\n"
  },
  {
    "path": "app/templates/app/src/util/WaypointsHandler.js",
    "content": "require('lib/zepto.waypoints');\n\nvar WaypointsHandler = function (el) {\n  var anim = [\"callout.bounce\", \"callout.shake\", \"callout.flash\", \"callout.pulse\", \"callout.swing\", \"callout.tada\",\n    \"transition.fadeIn\", \"transition.fadeOut\",\n    \"transition.flipXIn\", \"transition.flipXOut\", \"transition.flipYIn\", \"transition.flipYOut\",\n    \"transition.flipBounceXIn\", \"transition.flipBounceXOut\", \"transition.flipBounceYIn\", \"transition.flipBounceYOut\",\n    \"transition.swoopIn\", \"transition.swoopOut\",\n    \"transition.whirlIn\", \"transition.whirlOut\",\n    \"transition.shrinkIn\", \"transition.shrinkOut\",\n    \"transition.expandIn\", \"transition.expandOut\",\n    \"transition.bounceIn\", \"transition.bounceOut\", \"transition.bounceUpIn\", \"transition.bounceUpOut\", \"transition.bounceDownIn\", \"transition.bounceDownOut\", \"transition.bounceLeftIn\", \"transition.bounceLeftOut\", \"transition.bounceRightIn\", \"transition.bounceRightOut\",\n    \"transition.slideUpIn\", \"transition.slideUpOut\", \"transition.slideDownIn\", \"transition.slideDownOut\", \"transition.slideLeftIn\", \"transition.slideLeftOut\", \"transition.slideRightIn\", \"transition.slideRightOut\", \"transition.slideUpBigIn\", \"transition.slideUpBigOut\", \"transition.slideDownBigIn\", \"transition.slideDownBigOut\", \"transition.slideLeftBigIn\", \"transition.slideLeftBigOut\", \"transition.slideRightBigIn\", \"transition.slideRightBigOut\",\n    \"transition.perspectiveUpIn\", \"transition.perspectiveUpOut\", \"transition.perspectiveDownIn\", \"transition.perspectiveDownOut\", \"transition.perspectiveLeftIn\", \"transition.perspectiveLeftOut\", \"transition.perspectiveRightIn\", \"transition.perspectiveRightOut\"];\n  el.find('*[data-velocity-effect=\"none\"]').removeAttr('data-velocity-effect').removeAttr('data-velocity-offset');\n  ['default', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'].forEach(function (key) {\n    var vels = el.find('*[data-velocity-offset=\"' + key + '\"]');\n    vels[0] && vels.css({visibility: 'hidden'})\n      .waypoint({\n        offset: key == 'default' ? '70%' : key,\n        handler: function (direction) {\n          if (!this.element.VelocityEffectTriggered) {\n            this.element.VelocityEffectTriggered = true;\n            var cel = $(this.element);\n            cel.css({visibility: 'visible'}).velocity(cel.attr('data-velocity-effect'));\n          }\n        }\n      });\n  });\n}\n\nmodule.exports = WaypointsHandler;\n"
  },
  {
    "path": "app/templates/app/src/util/WechatShare.js",
    "content": "function WechatShare() {\n  var meta = {\n    \"appid\": \"\",\n    \"img_url\": null,\n    \"img_width\": \"200\",\n    \"img_height\": \"200\",\n    \"link\": window.location,\n    \"url\": window.location,\n    \"desc\": document.title,\n    \"content\": document.title,\n    \"title\": document.title\n  }, dirtyTimer = 0, dirtyCount = 0;\n\n  function setMeta(data) {\n    meta = data || meta;\n  }\n\n  function command(name) {\n    window.WeixinJSBridge.invoke(name, meta, function (res) {\n    });\n  }\n\n  function weixinJSBridgeListener() {\n    if (window.WeixinJSBridge && !window.WeixinJSBridge.__ListenerRegistered) {\n      window.WeixinJSBridge.__ListenerRegistered = true;\n      window.WeixinJSBridge.on('menu:share:appmessage', function (argv) {\n        command('sendAppMessage');\n      });\n      window.WeixinJSBridge.on('menu:share:timeline', function (argv) {\n        command('shareTimeline');\n      });\n      window.WeixinJSBridge.on('menu:share:weibo', function (argv) {\n        command('shareWeibo');\n      });\n      return;\n    }\n    dirtyTimer && clearTimeout(dirtyTimer);\n    if (dirtyCount < 60) {\n      dirtyCount++;\n      dirtyTimer = setTimeout(weixinJSBridgeListener, 1000);\n    }\n  }\n\n  if (/MicroMessenger/i.test(window.navigator.userAgent)) {\n    weixinJSBridgeListener();\n    document.addEventListener('WeixinJSBridgeReady', weixinJSBridgeListener, false);\n  }\n\n  return setMeta;\n}\n\nmodule.exports = WechatShare();\n"
  },
  {
    "path": "app/templates/app/src/util/YiXinShare.js",
    "content": "var MetaHandler = require('util/MetaHandler');\n\n/**\n * 易信分享\n * @param data = {\n     *  conetnt,img\n     * }\n */\nfunction share(data) {\n  data = data || {};\n  MetaHandler.createMeta('yixin-share-desc').setContent('yixin-share-desc', data.content);\n  MetaHandler.createMeta('yixin-share-image').setContent('yixin-share-image', data.img);\n}\n\nmodule.exports = share;\n"
  },
  {
    "path": "app/templates/app/src/widget/Msgbox.js",
    "content": "function Msgbox(option) {\n  //MONOSTATE\n  if (Msgbox.prototype.instance) {\n    return Msgbox.prototype.instance;\n  }\n  option = option || {};\n  var _this = this,\n    bEl,\n    readyToHide = true,\n    isLoading,\n    emptyFn = function () {\n    },\n    onBD = emptyFn,\n    themeCls = option.themeCls || ($.os.android ? 'android' : ''),\n    box = $('.msgbox');\n  bEl = {\n    box: box,\n    mask: box.find('.box-mask'),\n    bd: box.find('.msgbox-bd'),\n    dialog: box.find('.box-ct.dialog'),\n    menu: box.find('.box-ct.menu'),\n    loading: box.find('.box-ct.loading'),\n    signin: box.find('.box-ct.signin')\n  }\n  bEl.dialog.hide();\n  bEl.menu.hide();\n  bEl.loading.hide();\n  bEl.signin.hide();\n\n  bEl.box.on('click', function (e) {\n    if (onBD && /msgbox-bd/i.test(e.target.className)) {\n      onBD(e);\n      onBD = emptyFn;\n    }\n  });\n\n  //dialog\n  bEl.dialog.nbt = bEl.dialog.find('.no');\n  bEl.dialog.ybt = bEl.dialog.find('.yes');\n  bEl.dialog.title = bEl.dialog.find('.title');\n  bEl.dialog.msg = bEl.dialog.find('.msg');\n  bEl.dialog.nbt.on('click', function () {\n    _this.hideDialog(bEl.dialog.noCallback);\n  });\n  bEl.dialog.ybt.on('click', function () {\n    _this.hideDialog(bEl.dialog.yesCallback);\n  });\n  /**\n   * option = {\n     *     title,\n     *     msg,\n     *     yesText,\n     *     noText,\n     *     yesCallback,\n     *     noCallback,\n     *     bodyCallback\n     * }\n   */\n  this.showDialog = function (option) {\n    option = option || {};\n    readyToHide = false;\n    bEl.dialog.yesCallback = option.yesCallback;\n    bEl.dialog.noCallback = option.noCallback;\n    onBD = option.bodyCallback;\n\n    bEl.dialog.ybt[option.yesText ? 'show' : 'hide']().html(option.yesText);\n    bEl.dialog.nbt[option.noText ? 'show' : 'hide']().html(option.noText);\n    bEl.dialog.title[option.title ? 'show' : 'hide']().html(option.title || '');\n    bEl.dialog.msg[option.msg ? 'show' : 'hide']().html(option.msg || '');\n    setTimeout(function () {\n      bEl.dialog.show();\n      _this.show();\n    }, 400);\n  }\n  this.hideDialog = function (callback) {\n    readyToHide = true;\n    bEl.dialog.hide();\n    _this.hide();\n    callbackHandler(callback);\n  }\n  //menu\n  bEl.menu.nbt = bEl.menu.find('.no');\n  bEl.menu.options = bEl.menu.find('.options');\n  bEl.menu.nbt.on('click', function () {\n    _this.hideMenu(bEl.menu.noCallback);\n  });\n  /**\n   * option = {\n     *     msg,\n     *     noText,\n     *     noCallback,\n     *     noCls,\n     *     options: {\n     *      text,cls,callback\n     *     }\n     * }\n   */\n  this.showMenu = function (option) {\n    //bEl.menu.css({bottom: (document.body.scrollHeight-window.screen.height) + 'px'});\n    option = option || {};\n    readyToHide = false;\n    bEl.menu.noCallback = option.noCallback;\n    bEl.menu.nbt.html(option.noText || 'Cancel').addClass(option.noCls);\n    bEl.menu.options.html('');\n    if (option.msg) {\n      bEl.menu.options.append('<div class=\"opt msg\">' + option.msg + '</div>');\n    }\n    if (option.options) {\n      var tpl = '<div class=\"opt\"></div>';\n      option.options.forEach(function (k) {\n        var el = $(tpl);\n        el.html(k.text);\n        el.addClass(k.cls);//highlight\n        k.callback && el.on('click', function () {\n          _this.hideMenu(k.callback);\n        });\n        bEl.menu.options.append(el);\n      });\n    }\n    setTimeout(function () {\n      bEl.menu.show();\n      _this.show();\n      onBD = function () {\n        _this.hideMenu(bEl.menu.noCallback);\n      }\n    }, 400);\n  }\n  this.hideMenu = function (callback) {\n    readyToHide = true;\n    bEl.menu.addClass('close');\n    setTimeout(function () {\n      bEl.menu.hide().removeClass('close');\n      _this.hide();\n      callbackHandler(callback);\n    }, 350)\n  }\n  /**\n   * option = {\n     *     title,\n     *     msg,\n     *     yesText,\n     *     yesCallback\n     * }\n   */\n  this.showFailed = function (option) {\n    option = option || {};\n    var _option = {\n      title: option.title || 'Sorry~',\n      msg: option.msg || 'Unable to connect to the Internet',\n      yesText: option.yesText || 'OK',\n      yesCallback: option.yesCallback,\n      bodyCallback: option.bodyCallback\n    }\n    _this.showDialog(_option);\n  }\n  /**\n   * option = {\n     *     msg,\n     *     hideCallback\n     * }\n   */\n  this.showError = function (option) {\n    option = option || {};\n    var _option = {\n      msg: option.msg || '',\n      bodyCallback: option.bodyCallback\n    }\n    _this.showDialog(_option);\n    setTimeout(function () {\n      _this.hideDialog(option.hideCallback);\n    }, 2500);\n  }\n  /**\n   * option = {\n     *     yesCallback\n     * }\n   */\n  this.showDownload = function (option) {\n    option = option || {};\n    var _option = {\n      msg: 'Please download the latest app!',\n      noText: 'Cancel',\n      yesText: 'OK',\n      yesCallback: option.yesCallback,\n      bodyCallback: option.bodyCallback\n    }\n    _this.showDialog(_option);\n  }\n  //signin\n  bEl.signin.nbt = bEl.signin.find('.no');\n  bEl.signin.ybt = bEl.signin.find('.plf');\n  bEl.signin.msg = bEl.signin.find('.msg');\n  bEl.signin.nbt.on('click', function () {\n    _this.hideSignin(bEl.signin.noCallback);\n  });\n  bEl.signin.ybt.on('click', '.b', function () {\n    _this.hideSignin(bEl.signin.yesCallback, this.getAttribute('data-plf'));\n  });\n  /**\n   * option = {\n     *     msg,\n     *     yesCallback,\n     *     noCallback\n     * }\n   */\n  this.showSignin = function (option) {\n    option = option || {};\n    readyToHide = false;\n\n    bEl.signin.noCallback = option.noCallback;\n    bEl.signin.yesCallback = option.yesCallback;\n    onBD = option.bodyCallback;\n\n    bEl.signin.msg.html(option.msg || 'Please sign in');\n\n    bEl.signin.show();\n    this.show();\n  }\n  this.hideSignin = function (callback, data) {\n    readyToHide = true;\n    bEl.signin.hide();\n    _this.hide();\n    callbackHandler(callback, data);\n  }\n\n  this.show = function (el) {\n    el = el || bEl.box;\n    //setTimeout(function () {\n    //bEl.box.css({height: document.body.scrollHeight + 'px'});\n    //}, 500);\n    if (el == bEl.box) {\n      el.addClass('show');\n    } else {\n      el.css({'display': '-webkit-box'});\n    }\n  }\n  this.hide = function (el) {\n    el = el || bEl.box;\n    isLoading = false;\n    if (readyToHide) {\n      if (el == bEl.box) {\n        el.removeClass('show');\n      } else {\n        el.css({'display': 'none'});\n      }\n    }\n  }\n  this.showLoading = function (msg) {\n    bEl.loading.msg = bEl.loading.msg || bEl.loading.find('.msg');\n    bEl.loading.msg.html(msg || 'Loading...');\n    if (!isLoading) {\n      isLoading = true;\n      bEl.loading.show();\n      this.show();\n    }\n  }\n  this.hideLoading = function () {\n    if (isLoading) {\n      isLoading = false;\n      bEl.loading.hide();\n      _this.hide();\n    }\n  }\n  function callbackHandler(callback, data) {\n    if (callback) {\n      callback(data);\n      callback = null;\n    }\n  }\n\n  this.setTheme = function (cls) {\n    bEl.bd.removeClass([cls, 'android'].join(' ')).addClass(cls);\n  }\n  this.setTheme(themeCls);\n\n  //MONOSTATE\n  Msgbox.prototype.instance = this;\n}//end Msgbox\nmodule.exports = Msgbox;\n"
  },
  {
    "path": "app/templates/app/src/widget/Tooltip.js",
    "content": "var tpl = Core.microTmpl($('#tpl_tooltip').text());\nvar _body = $('body');\n\n/**\n *\n * @param options {\n   * single: if it's true,root container will remove from the renderTo element,default is true,\n   * rootId: root container id,\n   * rootCls: css class for the root container\n   * renderTo: element for root container to render,\n   * bodyCls: css class for the body container,\n   * bodyStyle: css style for body container,\n   * theme: UI theme,see in _tooltip.css\n   * zIndex: z-index for root container,\n   * top: top position,\n   * left: left position,\n   * bottom: bottom position,\n   * autoShow: auto show,\n   * showDelay: delay time for autoShow,default is 0,\n   * showAnimCls: show animation class,see in _tooltip.css,\n   * autoHide: auto hide,\n   * hideDelay: delay time for autoHide,default is 3500ms\n   * hideAnimCls: hide animation class,see in _tooltip.css,\n   * hideAnimDuration: duration time for hide animation,after that the element will be destroyed,default is 1000ms,\n   * onShow: event for show,\n   * onHide: event for hide,\n   * arrow: {\n   *  type: left|right|top|bottom,\n   *  position: top position for left|right,left position for top|bottom\n   * }\n   * }\n * @constructor\n */\nfunction Tooltip(options) {\n  options = options || {};\n  var _this = this,\n    emptyFn = function () {\n    },\n    onShow = options.onShow || emptyFn,\n    onHide = options.onHide || emptyFn,\n    prefix = 'tooltip',\n    dZIndex = 90,\n    single = options.single == undefined ? true : options.single,\n    autoShow = options.autoShow == undefined ? true : options.autoShow,\n    rootId = options.rootId || prefix + '_rootid_' + new Date().getTime(),\n    renderTo = options.renderTo || _body,\n    showAnimCls = options.showAnimCls || 'fadeIn',\n    hideAnimCls = options.hideAnimCls||'fadeOut',\n    target = options.target!=undefined && (/string/i.test(typeof options.target)?$(options.target):options.target),\n    els,\n    destoryed = false;\n\n  function init() {\n    render();\n    layout();\n    autoShow && _this.show();\n  }\n\n  function render() {\n    var arType = 'hide',\n      arStl = '';\n    if (options.arrow) {\n      arType = options.arrow.type;\n      if (/left|right/.test(arType)) {\n        arStl = 'top:' + options.arrow.position + 'px';\n      }\n      else if (/top|bottom/.test(arType)) {\n        arStl = 'left:' + options.arrow.position + 'px';\n      }\n    }\n    renderTo.append(tpl({\n      rootId: rootId,\n      theme: options.theme || '',\n      rootCls: options.rootCls || '',\n      bodyCls: options.bodyCls || '',\n      body: options.body || '',\n      arrow: {\n        type: arType,\n        style: arStl\n      }\n    }));\n    var main = $('#' + rootId);\n    els = {\n      main: main,\n      ct: main.find('.tooltip__ct'),\n      bd: main.find('.tooltip__bd'),\n      content: main.find('.tooltip__content'),\n      arrow: main.find('.tooltip__arrow')\n    }\n  }\n\n  function layout() {\n    els.main.css({\n      'z-index': options.zIndex || dZIndex,\n      'top': options.top != undefined ? (options.top + 'px') : 'auto',\n      'bottom': options.bottom != undefined ? (options.bottom + 'px') : 'auto'\n    });\n    els.ct.css({\n      'padding-left': options.left != undefined ? (options.left + 'px') : 'auto'\n    });\n    els.content.css(options.bodyStyle||{});\n  }\n\n  this.show = function () {\n    els.bd.addClass(showAnimCls);\n    setTimeout(function(){\n      els.main.addClass('show');\n    },options.showDelay||0);\n    onShow();\n\n    options.autoHide && setTimeout(function () {\n      _this.hide();\n    }, options.hideDelay || 3500);\n  }\n  this.hide = function () {\n    els.bd.removeClass(showAnimCls);\n    els.bd.addClass(hideAnimCls);\n    setTimeout(function () {\n      els.main.removeClass('show');\n      onHide();\n    }, options.hideAnimDuration || 1000);\n\n    single && setTimeout(function () {\n      destory();\n    }, options.hideAnimDuration ? (options.hideAnimDuration + 350) : 30000);\n  }\n  this.setArrowStyle = function (style) {\n    els.arrow.css(style);\n  }\n  function destory() {\n    if (destoryed) {\n      return;\n    }\n    destoryed = true;\n    els.main.remove();\n  }\n\n  init();\n}\n\nmodule.exports = Tooltip;\n"
  },
  {
    "path": "app/templates/app/webpack.config.js",
    "content": "// For instructions about this file refer to\n// webpack and webpack-hot-middleware documentation\nvar webpack = require('webpack');\nvar path = require('path');\nvar conf = require('./package.json');\nvar loaders = [];\nconf.project.babel && loaders.push({ test: /\\.jsx?$/, exclude: /node_modules/,loader: \"babel\", query: {cacheDirectory: true } });\n\nexports.dev = {\n  debug: true,\n  resolve: {\n    root: [\n      path.resolve('./src')\n    ]\n  },\n  entry: './src/app/App.js',\n  output: {\n    filename: \"app.js\",\n    sourceMapFilename: 'app.map'\n  },\n  module: {\n    loaders: loaders\n  },\n  plugins: [\n    new webpack.optimize.OccurenceOrderPlugin(),\n    new webpack.NoErrorsPlugin()\n  ],\n  cache: true,\n  devtool: 'source-map'\n};\n\nexports.build = {\n  resolve: {\n    root: [\n      path.resolve('./src')\n    ]\n  },\n  entry: './src/app/App.js',\n  output: {\n    filename: \"app.js\"\n  },\n  module: {\n    loaders: loaders\n  },\n  plugins: [\n    new webpack.optimize.OccurenceOrderPlugin(),\n    new webpack.NoErrorsPlugin(),\n    new webpack.DefinePlugin({\n      \"process.env\": {\n        NODE_ENV: JSON.stringify(\"production\")\n      }\n    })\n  ]\n};\n"
  },
  {
    "path": "app/templates/editorconfig",
    "content": "# http://editorconfig.org\nroot = true\n\n[*]\nindent_style = space\nindent_size = 2\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n[*.md]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": "app/templates/ftppass",
    "content": "{\n  \"testServer\": {\n      \"user\": \"test\",\n      \"pass\": \"test\"\n    }\n}\n"
  },
  {
    "path": "app/templates/gitignore",
    "content": ".DS_Store\nThumbs.db\n.sass-cache\n.idea\nlib-cov\n*.seed\n*.log\n*.csv\n*.dat\n*.out\n*.pid\n*.gz\n\npids\nlogs\nresults\n\nnpm-debug.log\nnode_modules\ndist\n.idea\n"
  },
  {
    "path": "app/templates/jshintrc",
    "content": "{\n  \"node\": true,\n  \"esnext\": true,\n  \"bitwise\": true,\n  \"camelcase\": true,\n  \"curly\": true,\n  \"eqeqeq\": true,\n  \"immed\": true,\n  \"indent\": 2,\n  \"latedef\": true,\n  \"newcap\": true,\n  \"noarg\": true,\n  \"quotmark\": \"single\",\n  \"undef\": true,\n  \"unused\": true,\n  \"strict\": true\n}\n"
  },
  {
    "path": "model/index.js",
    "content": "'use strict';\nvar yeoman = require('yeoman-generator');\nvar chalk = require('chalk');\nvar yosay = require('yosay');\nvar htmlWiring = require('html-wiring');\n\nmodule.exports = yeoman.generators.Base.extend({\n  constructor: function () {\n    yeoman.generators.Base.apply(this, arguments);\n\n    this.argument('model-name', {\n      desc: 'Name of the model to generate',\n      required: true\n    });\n  },\n\n  init: function () {\n    this.modelName = this['model-name'];\n    this.umodelName = this.modelName.toUpperCase();\n    this.args.splice(0, 1);\n    this.components = this.args;\n  },\n\n  writing: {\n    module: function () {\n      //make ModelView js\n      this.template('Model.js', 'src/app/model/' + this.modelName + 'Model.js');\n    }\n  }\n});\n"
  },
  {
    "path": "model/templates/Model.js",
    "content": "var RequestHelper = require('app/model/RequestHelper');\nvar StoreHelper = require('app/model/StoreHelper');\nvar Actions = require('app/resources/Actions');\nvar Basic = require('app/model/Model');\n\nvar <%=umodelName%>,\n    Mdl = Core.Class.Model,\n    lcStorage = Core.localStorage;\n\nfunction <%=modelName%>(){\n\n}\n\n//demo sub model for get request\n<%=modelName%>.prototype.testSubModelGetMethod = StoreHelper.requestStore(Actions.actionForTestSubModelGetMethod);\n\n//demo sub model for post request\n<%=modelName%>.prototype.testSubModelPostMethod = StoreHelper.postStore(Actions.actionForTestSubModelPostMethod);\n\n//demo sub model for paging\n<%=modelName%>.prototype.testSubModelPaging = StoreHelper.pagingStore(Actions.actionForTestSubModelPaging);\n\n//demo sub model for JSONP\n<%=modelName%>.prototype.testSubModelJSONP = StoreHelper.JSONPStore(Actions.actionForTestSubModelJSONP);\n\n\nmodule.exports = new <%=modelName%>();\n"
  },
  {
    "path": "module/index.js",
    "content": "'use strict';\nvar yeoman = require('yeoman-generator');\nvar chalk = require('chalk');\nvar yosay = require('yosay');\nvar htmlWiring = require('html-wiring');\n\nmodule.exports = yeoman.generators.Base.extend({\n  constructor: function () {\n    yeoman.generators.Base.apply(this, arguments);\n\n    this.argument('module-name', {\n      desc: 'Name of the module to generate',\n      required: true\n    });\n  },\n\n  init: function () {\n    this.moduleName = this['module-name'];\n    this.lmoduleName = this.moduleName.toLowerCase();\n    this.args.splice(0, 1);\n    this.components = this.args;\n  },\n\n  writing: {\n    module: function () {\n      //make module html,and add to view.html\n      this.template('module.html', 'html/include/view-' + this.lmoduleName + '.html');\n      var file = htmlWiring.readFileAsString('html/include/views.html'),\n        add = [];\n      add.push('\\n<!-- view-' + this.lmoduleName + ' -->');\n      add.push('\\n@@include(\"include/view-' + this.lmoduleName + '.html\")');\n      add.push('\\n<!-- end view-' + this.lmoduleName + ' -->');\n      file += add.join('');\n      htmlWiring.writeFileFromString(file, 'html/include/views.html');\n\n      //make module scss and add to _view.scss\n      this.template('module.scss', 'scss/_view-' + this.lmoduleName + '.scss');\n      file = htmlWiring.readFileAsString('scss/_view.scss');\n      add = [];\n      add.push('\\n\\n/*view-' + this.lmoduleName + '.scss*/');\n      add.push('\\n@import \"view-' + this.lmoduleName + '.scss\";');\n      add.push('\\n/*end view-' + this.lmoduleName + '.scss*/');\n      file += add.join('');\n      htmlWiring.writeFileFromString(file, 'scss/_view.scss');\n\n      //make module view js\n      this.template('ModuleView.js', 'src/app/view/' + this.moduleName + 'View.js');\n\n      //make module controller js App.js\n      this.template('ModuleController.js', 'src/app/controller/' + this.moduleName + 'Controller.js');\n      file = htmlWiring.readFileAsString('src/app/App.js');\n      file = file.replace('//__INSERT_POINT__',[\"var \"+this.moduleName+\"Controller = require('app/controller/\"+this.moduleName+\"Controller');\",'\\n  //__INSERT_POINT__'].join(''));\n      htmlWiring.writeFileFromString(file, 'src/app/App.js');\n    }\n  }\n});\n"
  },
  {
    "path": "module/templates/ModuleController.js",
    "content": "var Actions = require('../resources/Actions');\nvar BasicModel = require('app/model/Model');\nvar BasicView = require('app/view/View');\nvar <%=moduleName%>View = require('app/view/<%=moduleName%>View');\n\nfunction <%=moduleName%>Controller(){\n  this.models = {\n    Basic: BasicModel\n  }\n  this.views = {\n    Basic: BasicView,\n    <%=moduleName%>: <%=moduleName%>View\n  }\n\n  var CTRL = this,\n    viewNames,\n    curViewId = '',\n    view<%=moduleName%>Query = {};\n\n  viewNames = {\n    '<%=lmoduleName%>': '<%=moduleName%>'\n  }\n  Core.Router.subscribe('/<%=lmoduleName%>/', onView<%=moduleName%>, unView<%=moduleName%>);\n\n  //统计视图\n  Core.Event.on('analyticsCurView', analyticsCurView);\n  //forward<%=moduleName%>\n  Core.Event.on('forward<%=moduleName%>', forward<%=moduleName%>);\n\n\n  function unView<%=moduleName%>() {\n    CTRL.views.<%=moduleName%>.hide();\n  }\n\n  function onView<%=moduleName%>(req){\n    curViewId = '<%=lmoduleName%>';\n    view<%=moduleName%>Query = req.query;\n    CTRL.views.<%=moduleName%>.show();\n\n    //追加统计\n    analyticsCurView();\n  }\n  function forward<%=moduleName%>(arg){\n    Core.Router.forward('/<%=lmoduleName%>/' + (arg || ''));\n  }\n\n  function analyticsCurView(params, title) {\n    if (!Core.Router.currentMatch(['/<%=lmoduleName%>/'])) {\n      return;\n    }\n    params = params ? ('&' + params) : '';\n    title = title || viewNames[curViewId] || document.title;\n\n    Core.Event.trigger('analytics', 'viewid=' + curViewId + params, title);\n  }\n}\nmodule.exports = new <%=moduleName%>Controller;\n"
  },
  {
    "path": "module/templates/ModuleView.js",
    "content": "var BasicView = require('app/view/View');\nvar BasicModel = require('app/model/Model');\n\nfunction <%=moduleName%>View(){\n  this.models = {\n    Basic: BasicModel\n  }\n  this.viewCls = 'view-<%=lmoduleName%>';\n  this._BasicView = BasicView;\n\n  var VIEW = this,\n    isApp = Core.NativeBridge.isApp(),\n    Tpl, els,\n    tap = VIEW._BasicView.tapEvent;\n\n  //model listeners\n\n  function initEls() {\n    if(els){return;}\n    els = VIEW._BasicView.getElements(VIEW.viewCls,function(){\n      return {\n        //extraElement: this.main.find('.extra-element')\n      }\n    });\n    bindEvent();\n  }//end initEls\n  function initTpls(){\n    if(Tpl){return;}\n    Tpl = Tpl || VIEW._BasicView.getTemplates(VIEW.viewCls);\n  }\n  function initResources() {\n    initEls();\n    initTpls();\n  }\n  this.getEls = function () {\n    initEls();\n    return els;\n  }\n  this.getTpls = function(){\n    initTpls();\n    return Tpl;\n  }\n  function bindEvent() {\n\n  }//end bindEvent\n\n  this.show = function () {\n    initResources();\n\n    Core.Event.trigger('trigerAnimate',els.main);\n    VIEW._BasicView.show(VIEW.viewCls);\n  }\n  this.hide = function () {\n    if (!els) {\n      return;\n    }\n  }\n  function render(data) {\n    initResources();\n\n  }//end render\n\n}//end View\nmodule.exports = new <%=moduleName%>View();\n"
  },
  {
    "path": "module/templates/module.html",
    "content": "<section class=\"view view-<%=lmoduleName%>\">\n  <section class=\"<%=lmoduleName%>\">\n    Hello <%=moduleName%>\n  </section>\n</section>\n"
  },
  {
    "path": "module/templates/module.scss",
    "content": "@charset \"UTF-8\";\n.view-<%=lmoduleName%> {\n  width: 100%;\n  height: 100%;\n  min-height: 100%;\n  background-color: #fff;\n  font-size: 32px;\n  > .<%=lmoduleName%> {\n    @include box-h-c-c;\n    height: 100%;\n  }\n}\n\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"generator-webappstarter\",\n  \"version\": \"2.3.4\",\n  \"description\": \"Quick start a web app for mobile.Automatically adjusts according to a device’s screen size without any extra work.\",\n  \"license\": \"MIT\",\n  \"main\": \"app/index.js\",\n  \"repository\": \"unbug/generator-webappstarter\",\n  \"author\": {\n    \"name\": \"unbug\",\n    \"email\": \"tidelgl@gmail.com\",\n    \"url\": \"https://github.com/unbug\"\n  },\n  \"scripts\": {\n    \"test\": \"mocha\"\n  },\n  \"files\": [\n    \"app\",\n    \"module\",\n    \"update\",\n    \"model\"\n  ],\n  \"keywords\": [\n    \"yeoman-generator\",\n    \"mobile web app\",\n    \"MVC\",\n    \"gulp\",\n    \"webpack\",\n    \"react\",\n    \"es2015\",\n    \"es6\",\n    \"es7\",\n    \"responsive\"\n  ],\n  \"dependencies\": {\n    \"chalk\": \"^1.0.0\",\n    \"html-wiring\": \"^1.0.1\",\n    \"yeoman-generator\": \"^0.19.0\",\n    \"yosay\": \"^1.0.2\"\n  },\n  \"devDependencies\": {\n    \"mocha\": \"*\"\n  }\n}\n"
  },
  {
    "path": "test/test-app.js",
    "content": "'use strict';\n\nvar path = require('path');\nvar assert = require('yeoman-generator').assert;\nvar helpers = require('yeoman-generator').test;\nvar os = require('os');\n\ndescribe('webappstarter:app', function () {\n  before(function (done) {\n    helpers.run(path.join(__dirname, '../app'))\n      .withOptions({ skipInstall: true })\n      .withPrompts({ someOption: true })\n      .on('end', done);\n  });\n\n  it('creates files', function () {\n    assert.file([\n      'bower.json',\n      'package.json',\n      '.editorconfig',\n      '.jshintrc'\n    ]);\n  });\n});\n"
  },
  {
    "path": "update/index.js",
    "content": "'use strict';\nvar yeoman = require('yeoman-generator');\nvar chalk = require('chalk');\nvar yosay = require('yosay');\nvar htmlWiring = require('html-wiring');\n\nmodule.exports = yeoman.generators.Base.extend({\n  constructor: function () {\n    yeoman.generators.Base.apply(this, arguments);\n  },\n\n  init: function () {\n  },\n\n  writing: {\n    core: function () {\n      this.log('updating \"./src/core\" directory');\n      this.directory('../../app/templates/app/src/core', './src/core');\n    },\n    lib: function () {\n      this.log('updating \"./src/lib\" directory');\n      this.directory('../../app/templates/app/src/lib', './src/lib');\n    },\n    util: function () {\n      this.log('updating \"./src/util\" directory');\n      this.directory('../../app/templates/app/src/util', './src/util');\n    },\n    widget: function () {\n      this.log('updating \"./src/widget\" directory');\n      this.directory('../../app/templates/app/src/widget', './src/widget');\n    },\n    app: function(){\n      this.log('updating some files in \"./src/app/\" directory');\n      //copy Basic Controller.js\n      this.copy('../../app/templates/app/src/app/controller/Controller.js', './src/app/controller/Controller.js');\n      //copy Basic View.js\n      this.copy('../../app/templates/app/src/app/view/View.js', './src/app/view/View.js');\n      //copy Basic Model.js\n      this.copy('../../app/templates/app/src/app/model/Model.js', './src/app/model/Model.js');\n      this.copy('../../app/templates/app/src/app/model/RequestHelper.js', './src/app/model/RequestHelper.js');\n    },\n    scss: function(){\n      this.log('updating some files in \"./scss/\" directory');\n      this.copy('../../app/templates/app/scss/_common.scss','./scss/_common.scss');\n      this.copy('../../app/templates/app/scss/_mixin.scss','./scss/_mixin.scss');\n      this.copy('../../app/templates/app/scss/_value.scss','./scss/_value.scss');\n      this.copy('../../app/templates/app/scss/_box.scss','./scss/_box.scss');\n      this.copy('../../app/templates/app/scss/_util.scss','./scss/_util.scss');\n      this.copy('../../app/templates/app/scss/_components.scss','./scss/_components.scss');\n      this.copy('../../app/templates/app/scss/_slide.scss','./scss/_slide.scss');\n      this.copy('../../app/templates/app/scss/_msgbox.scss','./scss/_msgbox.scss');\n      this.copy('../../app/templates/app/scss/_msgbox-android.scss','./scss/_msgbox-android.scss');\n      this.copy('../../app/templates/app/scss/_msgbox-deja.scss','./scss/_msgbox-deja.scss');\n      this.copy('../../app/templates/app/scss/_tooltip.scss','./scss/_tooltip.scss');\n      this.copy('../../app/templates/app/scss/_loading-spinner.scss','./scss/_loading-spinner.scss');\n      this.copy('../../app/templates/app/scss/_section-download.scss','./scss/_section-download.scss');\n      this.copy('../../app/templates/app/scss/_animate.scss','./scss/_animate.scss');\n      this.copy('../../app/templates/app/scss/_button.scss','./scss/_button.scss');\n    },\n    html: function(){\n      this.log('updating some files in \"./html/\" directory');\n      this.copy('../../app/templates/app/html/debug/index.html','./html/debug/index.html');\n      this.copy('../../app/templates/app/html/official/index.html','./html/official/index.html');\n      this.copy('../../app/templates/app/html/include/cache.manifest','./html/include/cache.manifest');\n      this.copy('../../app/templates/app/html/include/msgbox.html','./html/include/msgbox.html');\n      this.copy('../../app/templates/app/html/include/tooltip.html','./html/include/tooltip.html');\n      this.copy('../../app/templates/app/html/include/components.html','./html/include/components.html');\n      this.copy('../../app/templates/app/html/include/download.html','./html/include/download.html');\n      this.copy('../../app/templates/app/html/include/scripts-version.html','./html/include/scripts-version.html');\n      this.copy('../../app/templates/app/html/include/styles-version.html','./html/include/styles-version.html');\n    },\n    images: function(){\n      this.log('updating \"./resources/images\" directory');\n      this.directory('../../app/templates/app/resources/images', './resources/images');\n    },\n    other: function(){\n      this.copy('../../app/templates/app/gulpfile.js', './gulpfile.js');\n      this.copy('../../app/templates/app/.babelrc', './.babelrc');\n      this.copy('../../app/templates/app/webpack.config.js', './webpack.config.js');\n      this.copy('../../app/templates/app/README.md', './README.md');\n    }\n  }\n});\n"
  }
]