diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..0bbf9fa8 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.git +.idea +.vagrant +coverage +design +e2e_coverage +Vagrantfile +Procfile diff --git a/Dockerfile b/Dockerfile index 25f20cb9..65e27847 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,19 @@ # Build: -# docker build -t tellform -f ./Dockerfile . +# docker build -t tellform-prod -f ./Dockerfile-production . # # Run: -# docker run -it tellform +# docker run -it tellform-prod + FROM phusion/baseimage:0.9.19 MAINTAINER David Baldwynn -# 3000 = TellForm server, 35729 = livereload, 8080 = node-inspector -EXPOSE 3000 35729 8080 - -# Set development environment as default -ENV NODE_ENV development -ENV BASE_URL tellform.dev -ENV PORT 3000 +#FROM node:6.11.4-alpine # Install Utilities -RUN apt-get update -q \ +RUN apt-get update -q \ && apt-get install -yqq \ curl \ ant \ - default-jdk \ git \ gcc \ make \ @@ -37,34 +31,33 @@ RUN sudo apt-get install -yq nodejs \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# Install MEAN.JS Prerequisites -RUN npm install --quiet -g grunt bower && npm cache clean +# Install NPM Global Libraries +RUN npm install --quiet -g grunt bower pm2 && npm cache clean -RUN mkdir -p /opt/tellform/public/lib WORKDIR /opt/tellform +RUN mkdir -p /opt/tellform/public/lib + +# Add bower.json +COPY bower.json /opt/tellform/bower.json +COPY .bowerrc /opt/tellform/.bowerrc + +COPY ./process.yml /opt/tellform/process.yml +COPY ./app /opt/tellform/app +COPY ./public /opt/tellform/public +COPY ./config /opt/tellform/config +COPY ./gruntfile.js /opt/tellform/gruntfile.js +COPY ./server.js /opt/tellform/server.js +COPY ./scripts/create_admin.js /opt/tellform/scripts/create_admin.js # Copies the local package.json file to the container # and utilities docker container cache to not needing to rebuild # and install node_modules/ everytime we build the docker, but only # when the local package.json file changes. # Add npm package.json -COPY package.json /opt/tellform/package.json -RUN npm install +COPY ./package.json /opt/tellform/package.json +RUN npm install --quiet -# Add bower.json -COPY bower.json /opt/tellform/bower.json -COPY .bowerrc /opt/tellform/.bowerrc +COPY ./start.sh /start.sh -COPY ./app /opt/tellform/app -COPY ./public /opt/tellform/public -COPY ./config /opt/tellform/config -COPY ./gruntfile.js /opt/tellform/gruntfile.js -COPY ./server.js /opt/tellform/server.js -COPY ./.env /opt/tellform/.env -COPY ./scripts/create_admin.js /opt/tellform/scripts/create_admin.js - -# Run Development TellForm server -COPY ./dev_entrypoint.sh /dev_entrypoint.sh -RUN chmod +x /dev_entrypoint.sh - -ENTRYPOINT ["/dev_entrypoint.sh"] \ No newline at end of file +# Run TellForm server +CMD ["/start.sh"] \ No newline at end of file diff --git a/Dockerfile-production b/Dockerfile-production deleted file mode 100644 index 9876021d..00000000 --- a/Dockerfile-production +++ /dev/null @@ -1,71 +0,0 @@ -# Build: -# docker build -t tellform-prod -f ./Dockerfile-production . -# -# Run: -# docker run -it tellform-prod - -FROM phusion/baseimage:0.9.19 -MAINTAINER David Baldwynn - -# 4545 = TellForm server -EXPOSE 4545 - -# Set development environment as default -ENV NODE_ENV production -ENV PORT 4545 -ENV BASE_URL tellform.com - -# Install Utilities -RUN apt-get update -q \ - && apt-get install -yqq \ - curl \ - ant \ - default-jdk \ - git \ - gcc \ - make \ - build-essential \ - libkrb5-dev \ - python \ - sudo \ - apt-utils \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# Install nodejs -RUN curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - -RUN sudo apt-get install -yq nodejs \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# Install MEAN.JS Prerequisites -RUN npm install --quiet -g grunt bower pm2 && npm cache clean - -RUN mkdir -p /opt/tellform/public/lib -WORKDIR /opt/tellform - -# Copies the local package.json file to the container -# and utilities docker container cache to not needing to rebuild -# and install node_modules/ everytime we build the docker, but only -# when the local package.json file changes. -# Add npm package.json -COPY package.json /opt/tellform/package.json -RUN npm install --production -RUN mv ./node_modules ./node_modules.tmp && mv ./node_modules.tmp ./node_modules && npm install - -# Add bower.json -COPY bower.json /opt/tellform/bower.json -COPY .bowerrc /opt/tellform/.bowerrc - -COPY ./app /opt/tellform/app -COPY ./public /opt/tellform/public -COPY ./config /opt/tellform/config -COPY ./gruntfile.js /opt/tellform/gruntfile.js -COPY ./server.js /opt/tellform/server.js -COPY ./.env /opt/tellform/.env -COPY ./scripts/create_admin.js /opt/tellform/scripts/create_admin.js - -RUN grunt build - -# Run TellForm server -CMD ["pm2-docker","process.yml"] diff --git a/app/controllers/forms.server.controller.js b/app/controllers/forms.server.controller.js index 960a682e..44b6df95 100644 --- a/app/controllers/forms.server.controller.js +++ b/app/controllers/forms.server.controller.js @@ -49,7 +49,6 @@ exports.createSubmission = function(req, res) { var timeElapsed = 0; - console.log(req.body); if(typeof req.body.timeElapsed === 'number'){ timeElapsed = req.body.timeElapsed; } @@ -64,7 +63,6 @@ exports.createSubmission = function(req, res) { device: req.body.device }); - submission.save(function(err, submission){ if (err) { console.error(err.message); @@ -100,7 +98,7 @@ exports.listSubmissions = function(req, res) { exports.create = function(req, res) { if(!req.body.form){ - return res.status(400).send({ + return res.status(401).send({ message: 'Invalid Input' }); } @@ -110,7 +108,7 @@ exports.create = function(req, res) { form.save(function(err) { if (err) { - return res.status(405).send({ + return res.status(500).send({ message: errorHandler.getErrorMessage(err) }); } @@ -222,7 +220,7 @@ exports.update = function(req, res) { form.save(function(err, savedForm) { if (err) { - res.status(405).send({ + res.status(500).send({ message: errorHandler.getErrorMessage(err) }); } else { diff --git a/app/libs/timestamp.server.plugin.js b/app/libs/timestamp.server.plugin.js new file mode 100644 index 00000000..084e2c1b --- /dev/null +++ b/app/libs/timestamp.server.plugin.js @@ -0,0 +1,39 @@ +'use strict'; + +// Plugin +module.exports = function timestamp (schema, options) { + options || (options = {}) + + // Options + var fields = {} + , createdPath = options.createdPath || 'created' + , modifiedPath = options.modifiedPath || 'modified' + , useVirtual = (options.useVirtual !== undefined) + ? options.useVirtual + : true + + // Add paths to schema if not present + if (!schema.paths[createdPath]) { + fields[modifiedPath] = { type: Date } + } + if (useVirtual) { + // Use the ObjectID for extracting the created time + schema.virtual(createdPath).get(function () { + return new Date(this._id.generationTime * 1000) + }) + } else { + if (!schema.paths[createdPath]) { + fields[createdPath] = { + type: Date + , default: Date.now + } + } + } + schema.add(fields) + + // Update the modified timestamp on save + schema.pre('save', function (next) { + this[modifiedPath] = new Date + next() + }) +} \ No newline at end of file diff --git a/app/models/form.server.model.js b/app/models/form.server.model.js index ab6a9b2f..b20d1a9e 100644 --- a/app/models/form.server.model.js +++ b/app/models/form.server.model.js @@ -6,7 +6,7 @@ var mongoose = require('mongoose'), Schema = mongoose.Schema, _ = require('lodash'), - mUtilities = require('mongoose-utilities'), + timeStampPlugin = require('../libs/timestamp.server.plugin'), async = require('async'), Random = require('random-js'), mt = Random.engines.mt19937(); @@ -283,7 +283,7 @@ FormSchema.virtual('analytics.fields').get(function () { return fieldDropoffs; }); -FormSchema.plugin(mUtilities.timestamp, { +FormSchema.plugin(timeStampPlugin, { createdPath: 'created', modifiedPath: 'lastModified', useVirtual: false @@ -304,7 +304,6 @@ FormSchema.pre('save', function (next) { this.language = 'de'; break; default: - this.language = 'en'; break; } next(); @@ -336,54 +335,55 @@ FormSchema.pre('save', function (next) { var that = this; var _original; - async.series([function(cb) { - that.constructor - .findOne({_id: that._id}).exec(function (err, original) { - if (err) { - return cb(err); - } else if (!original){ - return next(); - } else { - _original = original; - return cb(null); - } - }); - }, - function(cb) { - if(that.form_fields && that.isModified('form_fields') && formFieldsAllHaveIds(that.toObject().form_fields)){ + async.series([ + function(cb) { + that.constructor + .findOne({_id: that._id}).exec(function (err, original) { + if (err) { + return cb(err); + } else if (!original){ + return next(); + } else { + _original = original; + return cb(null); + } + }); + }, + function(cb) { + if(that.form_fields && that.isModified('form_fields') && formFieldsAllHaveIds(that.toObject().form_fields)){ - var current_form = that.toObject(), - old_form_fields = _original.toObject().form_fields, - new_ids = _.map(_.map(current_form.form_fields, 'globalId'), function(id){ return ''+id;}), - old_ids = _.map(_.map(old_form_fields, 'globalId'), function(id){ return ''+id;}), - deletedIds = getDeletedIndexes(old_ids, new_ids); + var current_form = that.toObject(), + old_form_fields = _original.toObject().form_fields, + new_ids = _.map(_.map(current_form.form_fields, 'globalId'), function(id){ return ''+id;}), + old_ids = _.map(_.map(old_form_fields, 'globalId'), function(id){ return ''+id;}), + deletedIds = getDeletedIndexes(old_ids, new_ids); - //Check if any form_fileds were deleted - if( deletedIds.length > 0 ){ + //Check if any form_fileds were deleted + if( deletedIds.length > 0 ){ - var modifiedSubmissions = []; + var modifiedSubmissions = []; - async.forEachOfSeries(deletedIds, - function (deletedIdIndex, key, cb_id) { + async.forEachOfSeries(deletedIds, + function (deletedIdIndex, key, cb_id) { - var deleted_id = old_ids[deletedIdIndex]; - //Find FormSubmissions that contain field with _id equal to 'deleted_id' - FormSubmission. - find({ form: that, form_fields: {$elemMatch: {globalId: deleted_id} } }). - exec(function(err, submissions){ - if(err) { - return cb_id(err); - } + var deleted_id = old_ids[deletedIdIndex]; + //Find FormSubmissions that contain field with _id equal to 'deleted_id' + FormSubmission. + find({ form: that, form_fields: {$elemMatch: {globalId: deleted_id} } }). + exec(function(err, submissions){ + if(err) { + return cb_id(err); + } - //Preserve fields that have at least one submission - if (submissions.length) { - //Add submissions - modifiedSubmissions.push.apply(modifiedSubmissions, submissions); - } + //Preserve fields that have at least one submission + if (submissions.length) { + //Add submissions + modifiedSubmissions.push.apply(modifiedSubmissions, submissions); + } - return cb_id(null); - }); - }, + return cb_id(null); + }); + }, function (err) { if(err){ console.error(err.message); @@ -425,17 +425,20 @@ FormSchema.pre('save', function (next) { }, function (err) { return cb(err); }); - } - ); + }); + } else { + return cb(null); + } } else { return cb(null); } - } else { - return cb(null); } - }], - function(err, results){ - next(err); + ], + function(err){ + if(err){ + return next(err); + } + next(); }); }); diff --git a/app/models/form_field.server.model.js b/app/models/form_field.server.model.js index 9a86b74b..9aae7749 100644 --- a/app/models/form_field.server.model.js +++ b/app/models/form_field.server.model.js @@ -5,13 +5,11 @@ */ var mongoose = require('mongoose'), util = require('util'), - mUtilities = require('mongoose-utilities'), + timeStampPlugin = require('../libs/timestamp.server.plugin'), _ = require('lodash'), Schema = mongoose.Schema, - LogicJumpSchema = require('./logic_jump.server.model'); - -const UIDGenerator = require('uid-generator'); -const uidgen3 = new UIDGenerator(256, UIDGenerator.BASE62); + LogicJumpSchema = require('./logic_jump.server.model'), + tokgen = require('../libs/tokenGenerator'); var FieldOptionSchema = new Schema({ option_id: { @@ -132,7 +130,7 @@ function BaseFieldSchema(){ fieldValue: Schema.Types.Mixed }); - this.plugin(mUtilities.timestamp, { + this.plugin(timeStampPlugin, { createdPath: 'created', modifiedPath: 'lastModified', useVirtual: false @@ -198,7 +196,7 @@ FormFieldSchema.pre('save', function(next) { if(this.logicJump.jumpTo === '') delete this.logicJump.jumpTo; } if(!this.globalId){ - this.globalId = uidgen3.generateSync(); + this.globalId = tokgen(); } next(); }); diff --git a/app/models/form_submission.server.model.js b/app/models/form_submission.server.model.js index e2029e4e..de4765b5 100644 --- a/app/models/form_submission.server.model.js +++ b/app/models/form_submission.server.model.js @@ -5,7 +5,7 @@ */ var mongoose = require('mongoose'), Schema = mongoose.Schema, - mUtilities = require('mongoose-utilities'), + timeStampPlugin = require('../libs/timestamp.server.plugin'), FieldSchema = require('./form_field.server.model.js'); /** @@ -75,7 +75,7 @@ FormSubmissionSchema.path('form_fields', { } }); -FormSubmissionSchema.plugin(mUtilities.timestamp, { +FormSubmissionSchema.plugin(timeStampPlugin, { createdPath: 'created', modifiedPath: 'lastModified', useVirtual: false diff --git a/app/models/user.server.model.js b/app/models/user.server.model.js index a22f53d4..98e2d613 100755 --- a/app/models/user.server.model.js +++ b/app/models/user.server.model.js @@ -7,8 +7,7 @@ var mongoose = require('mongoose'), Schema = mongoose.Schema, crypto = require('crypto'), config = require('../../config/config'), - fs = require('fs-extra'), - mUtilities = require('mongoose-utilities'), + timeStampPlugin = require('../libs/timestamp.server.plugin'), path = require('path'), querystring = require('querystring'), nodemailer = require('nodemailer'); @@ -143,7 +142,7 @@ UserSchema.virtual('displayName').get(function () { return this.firstName + ' ' + this.lastName; }); -UserSchema.plugin(mUtilities.timestamp, { +UserSchema.plugin(timeStampPlugin, { createdPath: 'created', modifiedPath: 'lastModified', useVirtual: false diff --git a/app/tests/form.server.model.test.js b/app/tests/form.server.model.test.js index 697fe87e..573e631b 100644 --- a/app/tests/form.server.model.test.js +++ b/app/tests/form.server.model.test.js @@ -1,5 +1,7 @@ 'use strict'; +require('../../server.js'); + /** * Module dependencies. */ diff --git a/app/tests/form.server.routes.test.js b/app/tests/form.server.routes.test.js index c2f7cb4e..e1aa2654 100644 --- a/app/tests/form.server.routes.test.js +++ b/app/tests/form.server.routes.test.js @@ -1,5 +1,4 @@ 'use strict'; -process.env.NODE_ENV = 'test'; var should = require('should'), lodash = require('lodash'), @@ -19,8 +18,8 @@ var user, myForm, userSession; // Create user credentials var credentials = { - username: 'test1234', - email: 'test1234@test.com', + username: 'aeokjqjqkqaeoaoe', + email: 'aeoaekjqjqqjkoeoa@test.com', password: 'password' }; @@ -30,18 +29,17 @@ var credentials = { describe('Form Routes Unit tests', function() { beforeEach(function(done) { - // Create a new user user = new User({ firstName: 'Full', lastName: 'Name', - displayName: 'Full Name', email: credentials.email, username: credentials.username, password: credentials.password, provider: 'local' }); + // Save a user to the test db and create new Form user.save(function(err) { should.not.exist(err); @@ -65,10 +63,12 @@ describe('Form Routes Unit tests', function() { }); it(' > should not be able to create a Form if not logged in', function(done) { + userSession.post('/forms') .send({form: myForm}) .expect(401) .end(function(FormSaveErr, FormSaveRes) { + // Call the assertion callback done(FormSaveErr); }); @@ -153,7 +153,7 @@ describe('Form Routes Unit tests', function() { // Save a new Form authenticatedSession.post('/forms') .send({form: myForm}) - .expect(405) + .expect(500) .end(function(FormSaveErr, FormSaveRes) { // Handle Form save error if (FormSaveErr) { diff --git a/app/tests/form_submission.model.test.js b/app/tests/form_submission.model.test.js index de87d09f..f60e599e 100644 --- a/app/tests/form_submission.model.test.js +++ b/app/tests/form_submission.model.test.js @@ -168,7 +168,7 @@ describe('FormSubmission Model Unit Tests:', function() { }); it('should be able to find FormSubmission by $elemMatch on form_fields id', function(done){ - FormSubmission.findOne({ form: myForm._id, admin: user, form_fields: {$elemMatch: {_id: myForm.form_fields[0]._id} } }) + FormSubmission.findOne({ form: myForm._id, form_fields: {$elemMatch: {globalId: myForm.form_fields[0].globalId} } }) .exec(function(err, submission){ should.not.exist(err); should.exist(submission); diff --git a/app/tests/form_submission.routes.test.js b/app/tests/form_submission.routes.test.js index 9cde8744..13d5e780 100644 --- a/app/tests/form_submission.routes.test.js +++ b/app/tests/form_submission.routes.test.js @@ -21,7 +21,8 @@ var credentials, user; * Form routes tests */ describe('Form Submission Routes Unit tests', function() { - var FormObj, _Submission, submissionSession; + var FormObj, _Submission, submissionSession, _SubmissionBody + beforeEach(function(done) { @@ -60,15 +61,43 @@ describe('Form Submission Routes Unit tests', function() { if (formSaveErr) done(formSaveErr); _Submission = { - form_fields: [ - {'fieldType':'textfield', 'title':'First Name', 'fieldValue': 'David'}, - {'fieldType':'checkbox', 'title':'nascar', 'fieldValue': true}, - {'fieldType':'checkbox', 'title':'hockey', 'fieldValue': false} - ], form: form._id, - admin: user._id, + form_fields: [ + {'fieldType':'textfield', 'title':'First Name', 'fieldValue': 'David', _id: '', isSubmission: false, deletePreserved: false}, + {'fieldType':'checkbox', 'title':'nascar', 'fieldValue': true, _id: '', isSubmission: false, deletePreserved: true}, + {'fieldType':'checkbox', 'title':'hockey', 'fieldValue': false, _id: '', isSubmission: false, deletePreserved: false} + ], percentageComplete: 100, - timeElapsed: 11.55 + timeElapsed: 11.55, + ipAddr: '123.233.232.232', + geoLocation: { + Country: 'Canada', + City: 'Vancouver' + }, + device:{ + type: 'Mobile', + name: 'iPhone' + } + }; + + _SubmissionBody ={ + _id: form._id, + form_fields: [ + {'fieldType':'textfield', 'title':'First Name', 'fieldValue': 'David', _id: '', isSubmission: false, deletePreserved: false}, + {'fieldType':'checkbox', 'title':'nascar', 'fieldValue': true, _id: '', isSubmission: false, deletePreserved: true}, + {'fieldType':'checkbox', 'title':'hockey', 'fieldValue': false, _id: '', isSubmission: false, deletePreserved: false} + ], + percentageComplete: 100, + timeElapsed: 11.55, + ipAddr: '123.233.232.232', + geoLocation: { + Country: 'Canada', + City: 'Vancouver' + }, + device:{ + type: 'Mobile', + name: 'iPhone' + } }; FormObj = form; @@ -86,12 +115,11 @@ describe('Form Submission Routes Unit tests', function() { //Create Submission submissionSession.post('/forms/' + FormObj._id) - .send(_Submission) + .send(_SubmissionBody) .expect(200) .end(function(err, res) { should.not.exist(err); - done(); }); }); @@ -99,7 +127,7 @@ describe('Form Submission Routes Unit tests', function() { it(' > should be able to get Form Submissions if signed in', function(done) { //Create Submission submissionSession.post('/forms/' + FormObj._id) - .send(_Submission) + .send(_SubmissionBody) .expect(200) .end(function(err, res) { diff --git a/app/tests/libs/timestamp.server.plugin.test.js b/app/tests/libs/timestamp.server.plugin.test.js new file mode 100644 index 00000000..2901fe72 --- /dev/null +++ b/app/tests/libs/timestamp.server.plugin.test.js @@ -0,0 +1,70 @@ +// Dependencies +var util = require('util') + , assert = require('assert') + , mongoose = require('mongoose') + , timestamp = require('../../libs/timestamp.server.plugin') + , Schema = mongoose.Schema + , ObjectId = Schema.ObjectId + +// Run tests +describe('Timestamp', function () { + describe('#default()', function () { + var FooSchema = new Schema() + FooSchema.plugin(timestamp) + var FooModel = mongoose.model('timeFoo', FooSchema) + , bar = new FooModel() + + before(function () { + FooModel.remove(function (err) { + assert.strictEqual(err, null) + }) + }) + + it('should have custom properties', function (done) { + assert.strictEqual(typeof FooSchema.virtuals.created, 'object') + assert.strictEqual(typeof FooSchema.paths.modified, 'object') + done() + }) + + it('should create the default attributes', function (done) { + bar.save(function (err, doc) { + assert.strictEqual(err, null) + assert.strictEqual(util.isDate(doc.created), true) + assert.strictEqual(util.isDate(doc.modified), true) + done() + }) + }) + }) + + describe('#custom()', function () { + var FooSchema = new Schema() + FooSchema.plugin(timestamp, { + createdPath: 'oh' + , modifiedPath: 'hai' + , useVirtual: false + }) + var BarModel = mongoose.model('timeBar', FooSchema) + , bar = new BarModel() + + before(function () { + BarModel.remove(function (err) { + assert.strictEqual(err, null) + }) + }) + + it('should have custom properties', function (done) { + assert.strictEqual(typeof FooSchema.paths.oh, 'object') + assert.strictEqual(typeof FooSchema.paths.hai, 'object') + done() + }) + + it('should create custom attributes', function (done) { + bar.save(function (err, doc) { + assert.strictEqual(err, null) + assert.strictEqual(util.isDate(doc.oh), true) + assert.strictEqual(util.isDate(doc.hai), true) + done() + }) + }) + }) +}) \ No newline at end of file diff --git a/config/env/all.js b/config/env/all.js index 2651bae1..54bc72ed 100755 --- a/config/env/all.js +++ b/config/env/all.js @@ -8,20 +8,18 @@ module.exports = { keywords: process.env.APP_KEYWORDS || 'typeform, pdfs, forms, opensource, formbuilder, google forms, nodejs' }, db: { - uri: 'mongodb://'+ (process.env.DB_PORT_27017_TCP_ADDR || process.env.DB_HOST || 'localhost')+'/mean', + uri: process.env.MONGODB_URI || 'mongodb://'+ (process.env.DB_PORT_27017_TCP_ADDR || '127.0.0.1') + '/mean', options: { user: '', pass: '' } }, - port: process.env.PORT || 3000, - socketPort: process.env.SOCKET_PORT || 20523, + port: 3000, + socketPort: 20523, templateEngine: 'swig', - reCAPTCHA_Key: process.env.reCAPTCHA_KEY || '', - signupDisabled: (process.env.SIGNUP_DISABLED === 'TRUE'), enableClusterMode: (process.env.ENABLE_CLUSTER_MODE === 'TRUE'), baseUrl: '', diff --git a/config/env/development.js b/config/env/development.js index 7771b6e0..a44816a7 100755 --- a/config/env/development.js +++ b/config/env/development.js @@ -4,7 +4,7 @@ module.exports = { baseUrl: process.env.BASE_URL || 'http://localhost:5000', port: process.env.PORT || 5000, db: { - uri: 'mongodb://'+( process.env.DB_PORT_27017_TCP_ADDR || process.env.DB_HOST || '0.0.0.0') +'/mean', + uri: process.env.MONGODB_URI || 'mongodb://'+( process.env.DB_PORT_27017_TCP_ADDR || '127.0.0.1') +'/mean', options: { user: '', pass: '' @@ -16,31 +16,6 @@ module.exports = { // Stream defaults to process.stdout // Uncomment to enable logging to a log on the file system }, - facebook: { - clientID: process.env.FACEBOOK_ID || 'APP_ID', - clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET', - callbackURL: '/auth/facebook/callback' - }, - twitter: { - clientID: process.env.TWITTER_KEY || 'CONSUMER_KEY', - clientSecret: process.env.TWITTER_SECRET || 'CONSUMER_SECRET', - callbackURL: '/auth/twitter/callback' - }, - google: { - clientID: process.env.GOOGLE_ID || 'APP_ID', - clientSecret: process.env.GOOGLE_SECRET || 'APP_SECRET', - callbackURL: '/auth/google/callback' - }, - linkedin: { - clientID: process.env.LINKEDIN_ID || 'APP_ID', - clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET', - callbackURL: '/auth/linkedin/callback' - }, - github: { - clientID: process.env.GITHUB_ID || 'APP_ID', - clientSecret: process.env.GITHUB_SECRET || 'APP_SECRET', - callbackURL: '/auth/github/callback' - }, mailer: { from: process.env.MAILER_FROM || 'no-reply@tellform.com', options: process.env.MAILER_SMTP_HOST ? { //Uses custom SMTP if MAILER_SMTP_HOST is set diff --git a/config/env/production.js b/config/env/production.js index 110fd1f4..b80b5d01 100755 --- a/config/env/production.js +++ b/config/env/production.js @@ -3,7 +3,7 @@ module.exports = { baseUrl: process.env.BASE_URL || process.env.HEROKU_APP_NAME + '.herokuapp.com' || 'tellform.com', db: { - uri: process.env.MONGODB_URI || process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || '0.0.0.0') + '/mean', + uri: process.env.MONGODB_URI || process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_PORT_27017_TCP_ADDR || '127.0.0.1') + '/mean', }, port: process.env.PORT || 5000, socketUrl: process.env.SOCKET_URL || 'ws.tellform.com', @@ -32,31 +32,6 @@ module.exports = { js: 'public/dist/application.min.js', form_js: 'public/dist/form-application.min.js' }, - facebook: { - clientID: process.env.FACEBOOK_ID || 'APP_ID', - clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET', - callbackURL: '/auth/facebook/callback' - }, - twitter: { - clientID: process.env.TWITTER_KEY || 'CONSUMER_KEY', - clientSecret: process.env.TWITTER_SECRET || 'CONSUMER_SECRET', - callbackURL: '/auth/twitter/callback' - }, - google: { - clientID: process.env.GOOGLE_ID || 'APP_ID', - clientSecret: process.env.GOOGLE_SECRET || 'APP_SECRET', - callbackURL: '/auth/google/callback' - }, - linkedin: { - clientID: process.env.LINKEDIN_ID || 'APP_ID', - clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET', - callbackURL: '/auth/linkedin/callback' - }, - github: { - clientID: process.env.GITHUB_ID || 'APP_ID', - clientSecret: process.env.GITHUB_SECRET || 'APP_SECRET', - callbackURL: '/auth/github/callback' - }, mailer: { from: process.env.MAILER_FROM || 'testing@'+process.env.SPARKPOST_SANDBOX_DOMAIN || 'no-reply@tellform.com', options: process.env.MAILER_SMTP_HOST ? { //Uses custom SMTP if MAILER_SMTP_HOST is set diff --git a/config/env/secure.js b/config/env/secure.js index 4c6a584f..77c508a5 100755 --- a/config/env/secure.js +++ b/config/env/secure.js @@ -4,7 +4,7 @@ module.exports = { baseUrl: 'https://forms.polydaic.com', port: 8443, db: { - uri: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://localhost/mean', + uri: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || process.env.MONGODB_URI || 'mongodb://127.0.0.1/mean', options: { user: '', pass: '' @@ -39,31 +39,6 @@ module.exports = { css: 'public/dist/application.min.css', js: 'public/dist/application.min.js' }, - facebook: { - clientID: process.env.FACEBOOK_ID || 'APP_ID', - clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET', - callbackURL: 'https://localhost:443/auth/facebook/callback' - }, - twitter: { - clientID: process.env.TWITTER_KEY || 'CONSUMER_KEY', - clientSecret: process.env.TWITTER_SECRET || 'CONSUMER_SECRET', - callbackURL: 'https://localhost:443/auth/twitter/callback' - }, - google: { - clientID: process.env.GOOGLE_ID || 'APP_ID', - clientSecret: process.env.GOOGLE_SECRET || 'APP_SECRET', - callbackURL: 'https://localhost:443/auth/google/callback' - }, - linkedin: { - clientID: process.env.LINKEDIN_ID || 'APP_ID', - clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET', - callbackURL: 'https://localhost:443/auth/linkedin/callback' - }, - github: { - clientID: process.env.GITHUB_ID || 'APP_ID', - clientSecret: process.env.GITHUB_SECRET || 'APP_SECRET', - callbackURL: 'https://localhost:443/auth/github/callback' - }, mailer: { from: process.env.MAILER_FROM || '', options: process.env.MAILER_SMTP_HOST ? { //Uses custom SMTP if MAILER_SMTP_HOST is set diff --git a/config/env/test.js b/config/env/test.js index 29e4e821..c6731236 100755 --- a/config/env/test.js +++ b/config/env/test.js @@ -25,31 +25,6 @@ module.exports = { sessionCookie: { maxAge: 24 * 60 * 60 * 1000 // 24 hours }, - facebook: { - clientID: process.env.FACEBOOK_ID || 'APP_ID', - clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET', - callbackURL: '/auth/facebook/callback' - }, - twitter: { - clientID: process.env.TWITTER_KEY || 'CONSUMER_KEY', - clientSecret: process.env.TWITTER_SECRET || 'CONSUMER_SECRET', - callbackURL: '/auth/twitter/callback' - }, - google: { - clientID: process.env.GOOGLE_ID || 'APP_ID', - clientSecret: process.env.GOOGLE_SECRET || 'APP_SECRET', - callbackURL: '/auth/google/callback' - }, - linkedin: { - clientID: process.env.LINKEDIN_ID || 'APP_ID', - clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET', - callbackURL: '/auth/linkedin/callback' - }, - github: { - clientID: process.env.GITHUB_ID || 'APP_ID', - clientSecret: process.env.GITHUB_SECRET || 'APP_SECRET', - callbackURL: '/auth/github/callback' - }, mailer: { from: process.env.MAILER_FROM || 'MAILER_FROM', options: process.env.MAILER_SMTP_HOST ? { //Uses custom SMTP if MAILER_SMTP_HOST is set diff --git a/config/express.js b/config/express.js index 1569a012..64f25ba2 100755 --- a/config/express.js +++ b/config/express.js @@ -3,7 +3,7 @@ /** * Module dependencies. */ -var fs = require('fs-extra'), +var fs = require('fs'), https = require('https'), express = require('express'), morgan = require('morgan'), @@ -17,22 +17,13 @@ var fs = require('fs-extra'), passport = require('passport'), raven = require('raven'), MongoStore = require('connect-mongo')(session), - flash = require('connect-flash'), config = require('./config'), consolidate = require('consolidate'), path = require('path'), - device = require('express-device'), client = new raven.Client(config.DSN); var mongoose = require('mongoose'); -var cacheOpts = { - max:100000, - maxAge:1000*60 -}; - -require('mongoose-cache').install(mongoose, cacheOpts); - /** * Configure Socket.io */ @@ -246,12 +237,6 @@ module.exports = function(db) { app.use(passport.initialize()); app.use(passport.session()); - // setup express-device - app.use(device.capture({ parseUserAgent: true })); - - // connect flash for flash messages - app.use(flash()); - // Globbing routing files config.getGlobbedFiles('./app/routes/**/*.js').forEach(function(routePath) { require(path.resolve(routePath))(app); diff --git a/config/strategies/facebook.js b/config/strategies/facebook.js deleted file mode 100755 index 34ddc68f..00000000 --- a/config/strategies/facebook.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -/** - * Module dependencies. - */ -var passport = require('passport'), - FacebookStrategy = require('passport-facebook').Strategy, - config = require('../config'), - users = require('../../app/controllers/users.server.controller'); - -module.exports = function() { - // Use facebook strategy - passport.use(new FacebookStrategy({ - clientID: config.facebook.clientID, - clientSecret: config.facebook.clientSecret, - callbackURL: config.facebook.callbackURL, - passReqToCallback: true - }, - function(req, accessToken, refreshToken, profile, done) { - // Set the provider data and include tokens - var providerData = profile._json; - providerData.accessToken = accessToken; - providerData.refreshToken = refreshToken; - - // Create the user OAuth profile - var providerUserProfile = { - firstName: profile.name.givenName, - lastName: profile.name.familyName, - displayName: profile.displayName, - email: profile.emails[0].value, - username: profile.username, - provider: 'facebook', - providerIdentifierField: 'id', - providerData: providerData - }; - - // Save the user OAuth profile - users.saveOAuthUserProfile(req, providerUserProfile, done); - } - )); -}; diff --git a/config/strategies/github.js b/config/strategies/github.js deleted file mode 100755 index f10a413e..00000000 --- a/config/strategies/github.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; - -/** - * Module dependencies. - */ -var passport = require('passport'), - GithubStrategy = require('passport-github').Strategy, - config = require('../config'), - users = require('../../app/controllers/users.server.controller'); - -module.exports = function() { - // Use github strategy - passport.use(new GithubStrategy({ - clientID: config.github.clientID, - clientSecret: config.github.clientSecret, - callbackURL: config.github.callbackURL, - passReqToCallback: true - }, - function(req, accessToken, refreshToken, profile, done) { - // Set the provider data and include tokens - var providerData = profile._json; - providerData.accessToken = accessToken; - providerData.refreshToken = refreshToken; - - // Create the user OAuth profile - var displayName = profile.displayName.trim(); - var iSpace = displayName.indexOf(' '); // index of the whitespace following the firstName - var firstName = iSpace !== -1 ? displayName.substring(0, iSpace) : displayName; - var lastName = iSpace !== -1 ? displayName.substring(iSpace + 1) : ''; - - var providerUserProfile = { - firstName: firstName, - lastName: lastName, - displayName: displayName, - email: profile.emails[0].value, - username: profile.username, - provider: 'github', - providerIdentifierField: 'id', - providerData: providerData - }; - - // Save the user OAuth profile - users.saveOAuthUserProfile(req, providerUserProfile, done); - } - )); -}; diff --git a/config/strategies/google.js b/config/strategies/google.js deleted file mode 100755 index 8044ed4e..00000000 --- a/config/strategies/google.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; - -/** - * Module dependencies. - */ -var passport = require('passport'), - GoogleStrategy = require('passport-google-oauth').OAuth2Strategy, - config = require('../config'), - users = require('../../app/controllers/users.server.controller'); - -module.exports = function() { - // Use google strategy - passport.use(new GoogleStrategy({ - clientID: config.google.clientID, - clientSecret: config.google.clientSecret, - callbackURL: config.google.callbackURL, - passReqToCallback: true - }, - function(req, accessToken, refreshToken, profile, done) { - // Set the provider data and include tokens - var providerData = profile._json; - providerData.accessToken = accessToken; - providerData.refreshToken = refreshToken; - - // Create the user OAuth profile - var providerUserProfile = { - firstName: profile.name.givenName, - lastName: profile.name.familyName, - displayName: profile.displayName, - email: profile.emails[0].value, - username: profile.username, - provider: 'google', - providerIdentifierField: 'id', - providerData: providerData - }; - - // Save the user OAuth profile - users.saveOAuthUserProfile(req, providerUserProfile, done); - } - )); -}; diff --git a/config/strategies/linkedin.js b/config/strategies/linkedin.js deleted file mode 100755 index 1ee5b3f5..00000000 --- a/config/strategies/linkedin.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -/** - * Module dependencies. - */ -var passport = require('passport'), - LinkedInStrategy = require('passport-linkedin').Strategy, - config = require('../config'), - users = require('../../app/controllers/users.server.controller'); - -module.exports = function() { - // Use linkedin strategy - passport.use(new LinkedInStrategy({ - consumerKey: config.linkedin.clientID, - consumerSecret: config.linkedin.clientSecret, - callbackURL: config.linkedin.callbackURL, - passReqToCallback: true, - profileFields: ['id', 'first-name', 'last-name', 'email-address'] - }, - function(req, accessToken, refreshToken, profile, done) { - // Set the provider data and include tokens - var providerData = profile._json; - providerData.accessToken = accessToken; - providerData.refreshToken = refreshToken; - - // Create the user OAuth profile - var providerUserProfile = { - firstName: profile.name.givenName, - lastName: profile.name.familyName, - displayName: profile.displayName, - email: profile.emails[0].value, - username: profile.username, - provider: 'linkedin', - providerIdentifierField: 'id', - providerData: providerData - }; - - // Save the user OAuth profile - users.saveOAuthUserProfile(req, providerUserProfile, done); - } - )); -}; diff --git a/config/strategies/twitter.js b/config/strategies/twitter.js deleted file mode 100755 index 5dcc93f4..00000000 --- a/config/strategies/twitter.js +++ /dev/null @@ -1,45 +0,0 @@ -'use strict'; - -/** - * Module dependencies. - */ -var passport = require('passport'), - TwitterStrategy = require('passport-twitter').Strategy, - config = require('../config'), - users = require('../../app/controllers/users.server.controller'); - -module.exports = function() { - // Use twitter strategy - passport.use(new TwitterStrategy({ - consumerKey: config.twitter.clientID, - consumerSecret: config.twitter.clientSecret, - callbackURL: config.twitter.callbackURL, - passReqToCallback: true - }, - function(req, token, tokenSecret, profile, done) { - // Set the provider data and include tokens - var providerData = profile._json; - providerData.token = token; - providerData.tokenSecret = tokenSecret; - - // Create the user OAuth profile - var displayName = profile.displayName.trim(); - var iSpace = displayName.indexOf(' '); // index of the whitespace following the firstName - var firstName = iSpace !== -1 ? displayName.substring(0, iSpace) : displayName; - var lastName = iSpace !== -1 ? displayName.substring(iSpace + 1) : ''; - - var providerUserProfile = { - firstName: firstName, - lastName: lastName, - displayName: displayName, - username: profile.username, - provider: 'twitter', - providerIdentifierField: 'id_str', - providerData: providerData - }; - - // Save the user OAuth profile - users.saveOAuthUserProfile(req, providerUserProfile, done); - } - )); -}; diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 7e016e4d..00000000 --- a/docker-compose.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: "3" -services: - tellform: - build: - context: ./ - dockerfile: dockerfile - image: tellform - ports: - - 3000:3000 - links: - - tellform-redis:redis-db - - tellform-mongo:db - env_file: - - .env - tellform-redis: - image: redis - ports: - - 6379 - tellform-mongo: - image: mongo - ports: - - 27017 diff --git a/docs/example_formfields.json b/docs/example_formfields.json deleted file mode 100644 index 2cb6b475..00000000 --- a/docs/example_formfields.json +++ /dev/null @@ -1,96 +0,0 @@ - [ - [{ - "fieldType": "textfield", - "fieldValue": "snthsnth", - "_id": "55aec5d284bae1a1996210bd", - "disabled": false, - "fieldOptions": [], - "description": "", - "title": "Short Text2", - "lastModified": "2015-07-21T22:21:06.653Z", - "created": "2015-07-21T22:21:06.653Z", - "$$hashKey": "02J" - }, { - "fieldType": "textfield", - "fieldValue": "duieedi", - "_id": "55aec5b084bae1a1996210b4", - "disabled": false, - "fieldOptions": [], - "description": "", - "title": "Last Name", - "lastModified": "2015-07-21T22:20:32.053Z", - "created": "2015-07-21T22:20:32.053Z", - "$$hashKey": "02K" - }], - - [{ - "fieldType": "textfield", - "fieldValue": "snthsnth", - "_id": "55aec5d284bae1a1996210bd", - "disabled": false, - "fieldOptions": [], - "description": "", - "title": "Short Text2", - "lastModified": "2015-07-21T22:21:06.653Z", - "created": "2015-07-21T22:21:06.653Z", - "$$hashKey": "02J" - }, { - "fieldType": "textfield", - "fieldValue": "duieedi", - "_id": "55aec5b084bae1a1996210b4", - "disabled": false, - "fieldOptions": [], - "description": "", - "title": "Last Name", - "lastModified": "2015-07-21T22:20:32.053Z", - "created": "2015-07-21T22:20:32.053Z", - "$$hashKey": "02K" - }], - [{ - "fieldType": "textfield", - "fieldValue": "snthsnth", - "_id": "55aec5d284bae1a1996210bd", - "disabled": false, - "fieldOptions": [], - "description": "", - "title": "Short Text2", - "lastModified": "2015-07-21T22:21:06.653Z", - "created": "2015-07-21T22:21:06.653Z", - "$$hashKey": "02J" - }, { - "fieldType": "textfield", - "fieldValue": "duieedi", - "_id": "55aec5b084bae1a1996210b4", - "disabled": false, - "fieldOptions": [], - "description": "", - "title": "Last Name", - "lastModified": "2015-07-21T22:20:32.053Z", - "created": "2015-07-21T22:20:32.053Z", - "$$hashKey": "02K" - }], - [{ - "fieldType": "textfield", - "fieldValue": "snthsnth", - "_id": "55aec5d284bae1a1996210bd", - "disabled": false, - "fieldOptions": [], - "description": "", - "title": "Short Text2", - "lastModified": "2015-07-21T22:21:06.653Z", - "created": "2015-07-21T22:21:06.653Z", - "$$hashKey": "02J" - }, { - "fieldType": "textfield", - "fieldValue": "duieedi", - "_id": "55aec5b084bae1a1996210b4", - "disabled": false, - "fieldOptions": [], - "description": "", - "title": "Last Name", - "lastModified": "2015-07-21T22:20:32.053Z", - "created": "2015-07-21T22:20:32.053Z", - "$$hashKey": "02K" - }] - - ] \ No newline at end of file diff --git a/docs/example_submission_data.json b/docs/example_submission_data.json deleted file mode 100644 index 9e2f9a0c..00000000 --- a/docs/example_submission_data.json +++ /dev/null @@ -1,758 +0,0 @@ -[ - { - "_id": "56450d120761e9d7d68d3543", - "lastModified": "2015-11-12T22:05:06.380Z", - "fdfData": null, - "admin": "55d270df2749c1ceb47c0f8b", - "form": "5644dde5507b2572635dcd50", - "title": "Sample Form", - "timeElapsed": 11.925, - "percentageComplete": 75, - "__v": 0, - "created": "2015-11-12T22:05:06.378Z", - "form_fields": [ - { - "_id": "5644e0d5507b2572635dcd56", - "fieldValue": "", - "fieldType": "statement", - "title": "Statement2", - "lastModified": "2015-11-12T18:56:21.730Z", - "created": "2015-11-12T18:56:21.660Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": true, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.769Z", - "title": "Short Text2", - "fieldType": "textfield", - "fieldValue": "first", - "_id": "5644dde7507b2572635dcd51", - "created": "2015-11-12T18:43:51.290Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.770Z", - "title": "Short Text3", - "fieldType": "textfield", - "fieldValue": "first", - "_id": "5644dde7507b2572635dcd52", - "created": "2015-11-12T18:43:51.977Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.771Z", - "title": "Paragraph Text2", - "fieldType": "textarea", - "fieldValue": "first", - "_id": "5644ddea507b2572635dcd54", - "created": "2015-11-12T18:43:54.594Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.771Z", - "title": "Rating2", - "fieldType": "rating", - "fieldValue": 1, - "_id": "5644e0d4507b2572635dcd55", - "created": "2015-11-12T18:56:20.324Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - } - ] - }, - { - "_id": "56450d1d0761e9d7d68d3544", - "lastModified": "2015-11-12T22:05:17.806Z", - "fdfData": null, - "admin": "55d270df2749c1ceb47c0f8b", - "form": "5644dde5507b2572635dcd50", - "title": "Sample Form", - "timeElapsed": 10.301, - "percentageComplete": 75, - "__v": 0, - "created": "2015-11-12T22:05:17.805Z", - "form_fields": [ - { - "_id": "5644e0d5507b2572635dcd56", - "fieldValue": "", - "fieldType": "statement", - "title": "Statement2", - "lastModified": "2015-11-12T18:56:21.730Z", - "created": "2015-11-12T18:56:21.660Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": true, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.769Z", - "title": "Short Text2", - "fieldType": "textfield", - "fieldValue": "second", - "_id": "5644dde7507b2572635dcd51", - "created": "2015-11-12T18:43:51.290Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.770Z", - "title": "Short Text3", - "fieldType": "textfield", - "fieldValue": "second", - "_id": "5644dde7507b2572635dcd52", - "created": "2015-11-12T18:43:51.977Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.771Z", - "title": "Paragraph Text2", - "fieldType": "textarea", - "fieldValue": "second", - "_id": "5644ddea507b2572635dcd54", - "created": "2015-11-12T18:43:54.594Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.771Z", - "title": "Rating2", - "fieldType": "rating", - "fieldValue": 3, - "_id": "5644e0d4507b2572635dcd55", - "created": "2015-11-12T18:56:20.324Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - } - ] - }, - { - "_id": "56450d260761e9d7d68d3545", - "lastModified": "2015-11-12T22:05:26.874Z", - "fdfData": null, - "admin": "55d270df2749c1ceb47c0f8b", - "form": "5644dde5507b2572635dcd50", - "title": "Sample Form", - "timeElapsed": 7.975, - "percentageComplete": 75, - "__v": 0, - "created": "2015-11-12T22:05:26.874Z", - "form_fields": [ - { - "_id": "5644e0d5507b2572635dcd56", - "fieldValue": "", - "fieldType": "statement", - "title": "Statement2", - "lastModified": "2015-11-12T18:56:21.730Z", - "created": "2015-11-12T18:56:21.660Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": true, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.769Z", - "title": "Short Text2", - "fieldType": "textfield", - "fieldValue": "third", - "_id": "5644dde7507b2572635dcd51", - "created": "2015-11-12T18:43:51.290Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.770Z", - "title": "Short Text3", - "fieldType": "textfield", - "fieldValue": "third", - "_id": "5644dde7507b2572635dcd52", - "created": "2015-11-12T18:43:51.977Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.771Z", - "title": "Paragraph Text2", - "fieldType": "textarea", - "fieldValue": "third", - "_id": "5644ddea507b2572635dcd54", - "created": "2015-11-12T18:43:54.594Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.771Z", - "title": "Rating2", - "fieldType": "rating", - "fieldValue": 2, - "_id": "5644e0d4507b2572635dcd55", - "created": "2015-11-12T18:56:20.324Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - } - ] - }, - { - "_id": "56450d320761e9d7d68d3546", - "lastModified": "2015-11-12T22:05:38.717Z", - "fdfData": null, - "admin": "55d270df2749c1ceb47c0f8b", - "form": "5644dde5507b2572635dcd50", - "title": "Sample Form", - "timeElapsed": 10.47, - "percentageComplete": 75, - "__v": 0, - "created": "2015-11-12T22:05:38.716Z", - "form_fields": [ - { - "_id": "5644e0d5507b2572635dcd56", - "fieldValue": "", - "fieldType": "statement", - "title": "Statement2", - "lastModified": "2015-11-12T18:56:21.730Z", - "created": "2015-11-12T18:56:21.660Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": true, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.769Z", - "title": "Short Text2", - "fieldType": "textfield", - "fieldValue": "fourth", - "_id": "5644dde7507b2572635dcd51", - "created": "2015-11-12T18:43:51.290Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.770Z", - "title": "Short Text3", - "fieldType": "textfield", - "fieldValue": "fourth", - "_id": "5644dde7507b2572635dcd52", - "created": "2015-11-12T18:43:51.977Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.771Z", - "title": "Paragraph Text2", - "fieldType": "textarea", - "fieldValue": "fourth", - "_id": "5644ddea507b2572635dcd54", - "created": "2015-11-12T18:43:54.594Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - }, - { - "lastModified": "2015-11-12T21:30:20.771Z", - "title": "Rating2", - "fieldType": "rating", - "fieldValue": 2, - "_id": "5644e0d4507b2572635dcd55", - "created": "2015-11-12T18:56:20.324Z", - "validFieldTypes": [ - "textfield", - "date", - "email", - "link", - "legal", - "url", - "textarea", - "statement", - "welcome", - "thankyou", - "file", - "dropdown", - "scale", - "rating", - "radio", - "checkbox", - "hidden", - "yes_no", - "natural", - "number" - ], - "deletePreserved": false, - "disabled": false, - "required": true, - "fieldOptions": [], - "description": "" - } - ] - } -] \ No newline at end of file diff --git a/docs/form_update_process.md b/docs/form_update_process.md deleted file mode 100644 index 37132b36..00000000 --- a/docs/form_update_process.md +++ /dev/null @@ -1,22 +0,0 @@ -##First Form Auto-Update - -1. Added field CLIENT -time: 2553 - -2. Finding form SERVER -time: 2841 - -3. Update form CLIENT -time: 2870 - -4.Updated form SERVER -time: 2863 - - -##Second Form Auto-Update - -1. Added field CLIENT -time: 2755 - -2. Finding form SERVER -time: 2898 \ No newline at end of file diff --git a/docs/readme_logos/do_logo.png b/docs/readme_logos/do_logo.png deleted file mode 100755 index ee98b493..00000000 Binary files a/docs/readme_logos/do_logo.png and /dev/null differ diff --git a/docs/readme_logos/roost_logo.png b/docs/readme_logos/roost_logo.png deleted file mode 100644 index ee4a5ac3..00000000 Binary files a/docs/readme_logos/roost_logo.png and /dev/null differ diff --git a/docs/readme_logos/sentry_logo.png b/docs/readme_logos/sentry_logo.png deleted file mode 100644 index 89ef4f1d..00000000 Binary files a/docs/readme_logos/sentry_logo.png and /dev/null differ diff --git a/docs/readme_logos/sparkpost_logo.png b/docs/readme_logos/sparkpost_logo.png deleted file mode 100644 index d1732c0e..00000000 Binary files a/docs/readme_logos/sparkpost_logo.png and /dev/null differ diff --git a/docs/readme_logos/statuspage_logo.png b/docs/readme_logos/statuspage_logo.png deleted file mode 100644 index 5da28109..00000000 Binary files a/docs/readme_logos/statuspage_logo.png and /dev/null differ diff --git a/docs/readme_logos/stickermule_logo.png b/docs/readme_logos/stickermule_logo.png deleted file mode 100644 index c5f61e8c..00000000 Binary files a/docs/readme_logos/stickermule_logo.png and /dev/null differ diff --git a/docs/setup_sentry_server.md b/docs/setup_sentry_server.md deleted file mode 100644 index 5b30903d..00000000 --- a/docs/setup_sentry_server.md +++ /dev/null @@ -1,249 +0,0 @@ -#Installing Sentry Server - -### Before You Begin -Make sure you understand what sentry server does. You can view documentation for sentry server [here](https://sentry.readthedocs.org/). This document was written for a server running *Ubuntu 14.04 LTS server* (we used Azure). - - -### Prerequisites -Make sure you have these installed: -* apt-get -* python2.7 -* vim - - - -### Installation Steps -1. Add non-root user. - ``` - sudo adduser sentry - sudo adduser sentry sudo - ``` - -2. Update all apt-get packages - ``` - sudo apt-get update - sudo apt-get dist-upgrade - sudo apt-get autoremove - sudo apt-get install libxml2-dev libxslt1-dev libffi-dev libpq-dev python-dev - sudo reboot - ``` - -3. Install easy_install and pip - ``` - wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python - sudo easy_install pip - ``` - -4. Install virtualenv and lmxl - ``` - sudo pip install virtualenv - sudo pip install lxml - ``` - -5. Install Sentry and Setup - ``` - # make server directory - mkdir ~/SentryServer; cd ~/SentryServer; - # make virtualenv - virtualenv ./ - #activate virtualenv - source ./bin/activate - - # install sentry and its postgresql dependencies - pip install -U sentry[postgres] - ``` - -6. Install postgresql - ``` - # install postgres - sudo apt-get install postgresql postgresql-contrib libpq-dev - - # install postgres adminpack - sudo -u postgres psql - CREATE EXTENSION "adminpack"; - \q - ``` - -7. Setup postgresql DB - ``` - # change postgres password & create database - sudo passwd postgres - sudo su - postgres - psql -d template1 -c "ALTER USER postgres WITH PASSWORD 'changeme';" - createdb sentry - createuser sentry_user --pwprompt - psql -d template1 -U postgres - GRANT ALL PRIVILEGES ON DATABASE sentry to sentry_user; - \q - exit - ``` - -8. Setup Sentry Configuration - ``` - # initialize conf file - sentry init - - #edit sentry configuration - vim ~/.sentry/sentry.conf.py - ``` - - The following are the contents of my sentry.conf.py file (replace name, user and password with your that of your DB) - - ``` - DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'sentry', - 'USER': 'sentry_user', - 'PASSWORD': 'your_password', - 'HOST': 'localhost', - } - } - # No trailing slash! - SENTRY_URL_PREFIX = 'http://sentry.example.com' - - SENTRY_WEB_HOST = '0.0.0.0' - SENTRY_WEB_PORT = 9000 - SENTRY_WEB_OPTIONS = { - 'workers': 3, # the number of gunicorn workers - 'secure_scheme_headers': {'X-FORWARDED-PROTO': 'https'}, # detect HTTPS mode from X-Forwarded-Proto header - } - - #CONFIGURE REDIS - SENTRY_REDIS_OPTIONS = { - 'hosts': { - 0: { - 'host': '127.0.0.1', - 'port': 6379, - 'timeout': 3, - #'password': 'redis auth password' - } - } - } - - #CONFIGURE OUTGOING MAIL - EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' - EMAIL_USE_TLS = True - EMAIL_HOST = 'smtp.gmail.com' - EMAIL_PORT = 587 - EMAIL_HOST_USER = 'your_gmail_username@gmail.com' - EMAIL_HOST_PASSWORD = 'your_gmail_password' - DEFAULT_FROM_EMAIL = 'testing@testing.com - ``` - -9. Setup Database and Start Sentry - ``` - #install and run redis-server - wget http://download.redis.io/releases/redis-stable.tar.gz - tar xzf redis-stable.tar.gz - cd redis-stable - make - make test - sudo make install - cd utils - sudo ./install_server.sh - - #Go back to app directory - cd ~/SentryServer - sudo service redis_6379 start - - # set up databse - sentry upgrade - - # let's try it out! - sentry start - ``` - -10. Install nginx - - ``` - # install nginx - sudo apt-get install nginx - - # remove the default symbolic link - sudo rm /etc/nginx/sites-enabled/default - - # create a new blank config, and make a symlink to it - sudo touch /etc/nginx/sites-available/sentry - cd /etc/nginx/sites-enabled - sudo ln -s ../sites-available/sentry - - # edit the nginx configuration file - sudo vim /etc/nginx/sites-available/sentry - ``` - *Here are the contents of my nginx file:* - ``` - server { - # listen on port 80 - listen 80; - - # for requests to these domains - server_name yourdomain.com www.yourdomain.com; - - # keep logs in these files - access_log /var/log/nginx/sentry.access.log; - error_log /var/log/nginx/sentry.error.log; - - # You need this to allow users to upload large files - # See http://wiki.nginx.org/HttpCoreModule#client_max_body_size - # I'm not sure where it goes, so I put it in twice. It works. - client_max_body_size 0; - - location / { - proxy_pass http://localhost:9000; - proxy_redirect off; - - proxy_read_timeout 5m; - - # make sure these HTTP headers are set properly - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } - } - ``` - -11. Start the worker processes - ``` - # restart nginx - sudo nginx -t - sudo service nginx reload - - #start sentry - sentry celery worker -B - ``` - -12. Install and Configure supervisord - ``` - pip install supervisord - sudo echo_supervisord_conf > ~/SentryServer/etc/supervisord.conf - - #Edit yuour supervisord Config - vim /etc/supervisord.conf - ``` - - Configuration file should look like this - ``` - [program:sentry-web] - directory=~/SentryServer/ - command=~/SentryServer/bin/sentry start - autostart=true - autorestart=true - redirect_stderr=true - stdout_logfile=syslog - stderr_logfile=syslog - - [program:sentry-worker] - directory=~/SentryServer/ - command=~/SentryServer/bin/sentry celery worker -B - autostart=true - autorestart=true - redirect_stderr=true - stdout_logfile=syslog - stderr_logfile=syslog - ``` - -13. Run Server (with supervisord) - ``` - supervisord - ``` diff --git a/docs/ux_flows.md b/docs/ux_flows.md deleted file mode 100644 index 847b2853..00000000 --- a/docs/ux_flows.md +++ /dev/null @@ -1,29 +0,0 @@ -UX of Updating Forms -==================== - -##Form Updating - - Action: Update Configuration - 1. User clicks on Form from FormList page (visits form admin page) - 2. User clicks on "Configure Form" Tab - 3. User changes inputs in form page - 4. Save Button is Pressed - 5. Loading/Busy Indicator fills the screen - 6. Loading/Busy Indicator exits the screen - 7. Configuration page is shown with updated settings - - - Action: Add Form Field - 1. User clicks on Form from FormList page - 2. User clicks on a Tab in "AddField" column - 3. Loading/Busy Indicator fills the screen - 4. Loading/Busy Indicator exits the screen - - - Action: Edit Form Field Title - 1. User clicks on Form from FormList page (visits form admin page) - 2. User clicks on a current Form Input accordion (must be either the name or the caret) - 3. The clicked accordion (the one interacted with in Step#2) expands - 4. User clicks on 'Question Title' text input (aka focuses on said text input) - 5. User starts typing in text input - 6. User defocuses/clicks off of text input - 7. Loading/Busy Indicator fills the screen - 8. Loading/Busy Indicator exits the screen - 9. Field Accordion heading is updated diff --git a/gruntfile.js b/gruntfile.js index 7fb0d3bc..1407195a 100755 --- a/gruntfile.js +++ b/gruntfile.js @@ -28,10 +28,10 @@ module.exports = function(grunt) { clientViews: ['public/modules/**/*.html', 'public/form_modules/forms/base/**/*.html', '!public/modules/forms/base/**/*.html',], clientJS: ['public/js/*.js', 'public/form_modules/**/*.js', 'public/modules/**/*.js'], - clientCSS: ['public/modules/**/*.css', 'public/form_modules/**/*.css', '!public/modules/**/demo/**/*.css', '!public/modules/**/dist/**/*.css'], + clientCSS: ['public/modules/**/*.css'], serverTests: ['app/tests/**/*.js'], - clientTests: ['public/modules/**/tests/*.js', '!public/modules/**/demo/**/*.js', '!public/modules/**/dist/**/*.js', '!public/modules/**/node_modules/**/*.js'] + clientTests: ['public/modules/**/tests/*.js'] }; watchFiles.allTests = watchFiles.serverTests.concat(watchFiles.clientTests); @@ -127,19 +127,6 @@ module.exports = function(grunt) { } } }, - 'closure-compiler': { - vendor_file: { - closurePath: './scripts', - js: 'public/dist/vendor_forms_uglified.js', - jsOutputFile: 'public/dist/vendor.min.js', - maxBuffer: 10000000000, - options: { - warning_level: 'QUIET', - compilation_level: 'SIMPLE_OPTIMIZATIONS', - language_in: 'ECMASCRIPT5' - } - } - }, cssmin: { combine: { files: { @@ -157,19 +144,6 @@ module.exports = function(grunt) { } } }, - 'node-inspector': { - custom: { - options: { - 'web-port': 1337, - 'web-host': 'localhost', - 'debug-port': 5858, - 'save-live-edit': true, - 'no-preload': true, - 'stack-trace-limit': 50, - 'hidden': [] - } - } - }, ngAnnotate: { production: { files: { @@ -180,7 +154,7 @@ module.exports = function(grunt) { }, concurrent: { default: ['nodemon', 'watch'], - debug: ['nodemon', 'watch', 'node-inspector'], + debug: ['nodemon', 'watch'], options: { logConcurrentOutput: true, limit: 10 @@ -189,19 +163,15 @@ module.exports = function(grunt) { env: { test: { NODE_ENV: 'test', - src: '.env' }, secure: { NODE_ENV: 'secure', - src: '/opt/deploy/.env' }, production: { NODE_ENV: 'production', - src: '/opt/deploy/.env' }, dev: { NODE_ENV: 'development', - src: '.env' } }, mochaTest: { @@ -211,7 +181,7 @@ module.exports = function(grunt) { quiet: false, require: 'server.js', ui: 'bdd', - debug: true + debug: false } }, karma: { diff --git a/package.json b/package.json index 15d77751..ff9c9acf 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,8 @@ "url": "https://github.com/whitef0x0/tellform.git" }, "engines": { - "node": "6.11.2", - "npm": "3.10.10" + "node": "6.x.x", + "npm": "3.x.x" }, "scripts": { "addcontrib": "all-contributors add", @@ -22,74 +22,47 @@ "start": "npm run version && grunt", "test": "npm run version && grunt test", "postinstall": "bower install --config.interactive=false; grunt build;", - "init": "node scripts/setup.js", - "version": "check-node-version --package" + "init": "node scripts/setup.js" }, "dependencies": { "async": "^1.4.2", - "async-boolean-expression-evaluator": "^1.1.1", "bcrypt": "^0.8.7", - "bcrypt-nodejs": "0.0.3", "body-parser": "~1.14.1", "bower": "~1.6.5", "chalk": "^1.1.3", - "check-node-version": "^2.1.0", "compression": "~1.6.0", "connect": "^3.4.1", - "connect-flash": "~0.1.1", "connect-mongo": "~0.8.2", "consolidate": "~0.13.1", "cookie-parser": "~1.4.0", "deep-diff": "^0.3.4", "dotenv": "^2.0.0", "email-verification": "~0.4.1", - "envfile": "^2.0.1", "express": "~4.13.3", - "express-device": "~0.4.2", "express-session": "~1.12.1", - "forever": "~0.15.1", - "fs-extra": "~0.26.2", "glob": "^7.0.3", - "google-cdn": "^1.1.0", "grunt": "~0.4.1", - "grunt-cli": "~0.1.13", "grunt-concurrent": "~2.3.0", "grunt-contrib-csslint": "~1.0.0", "grunt-contrib-cssmin": "~1.0.1", "grunt-contrib-jshint": "~1.0.0", "grunt-contrib-uglify": "~0.11.0", - "grunt-contrib-watch": "~0.6.1", "grunt-env": "~0.4.1", "grunt-html2js": "~0.3.5", - "grunt-karma": "~0.12.1", - "grunt-newer": "~1.1.1", "grunt-ng-annotate": "~1.0.1", - "grunt-node-inspector": "~0.4.1", - "grunt-nodemon": "~0.4.0", "helmet": "3.5.0", - "inquirer": "^1.0.2", "jit-grunt": "^0.9.1", "lodash": "^4.17.4", "main-bower-files": "~2.9.0", "method-override": "~2.3.0", "mkdirp": "^0.5.1", "mongoose": "~4.4.19", - "mongoose-cache": "^0.1.5", - "mongoose-utilities": "~0.1.1", "morgan": "~1.8.1", - "multer": "^1.3.0", "nodemailer": "~4.0.0", - "nodemailer-sendgrid-transport": "^0.2.0", - "nodemailer-sparkpost-transport": "^1.0.0", "passport": "~0.3.0", "passport-anonymous": "^1.0.1", - "passport-facebook": "~2.0.0", - "passport-github": "~1.0.0", - "passport-google-oauth": "~0.2.0", - "passport-linkedin": "~1.0.0", "passport-local": "~1.0.0", "passport-localapikey-update": "^0.5.0", - "passport-twitter": "~1.0.2", "path-exists": "^2.1.0", "prerender-node": "^2.2.1", "random-js": "^1.0.8", @@ -98,7 +71,6 @@ "socket.io": "^1.4.6", "socket.io-redis": "^1.0.0", "swig": "~1.4.1", - "uid-generator": "^0.1.1", "uuid-token-generator": "^0.5.0", "wildcard-subdomains": "github:tellform/wildcard-subdomains", "winston": "^2.3.1", @@ -110,7 +82,7 @@ "coveralls": "^2.11.4", "cross-spawn": "^5.0.0", "del": "^2.2.2", - "email-verification": "github:tellform/node-email-verification", + "grunt-cli": "~0.1.13", "grunt-closure-compiler": "0.0.21", "grunt-contrib-concat": "^1.0.1", "grunt-contrib-copy": "^1.0.0", @@ -118,7 +90,11 @@ "grunt-execute": "^0.2.2", "grunt-mocha-istanbul": "^3.0.1", "grunt-mocha-test": "~0.12.1", + "grunt-contrib-watch": "~0.6.1", + "grunt-newer": "~1.1.1", "grunt-usemin": "^3.1.1", + "grunt-karma": "~0.12.1", + "grunt-nodemon": "~0.4.0", "grunt-wiredep": "^3.0.1", "istanbul": "^0.4.0", "jasmine-core": "^2.4.1", @@ -131,11 +107,9 @@ "karma-mocha-reporter": "^1.1.1", "karma-ng-html2js-preprocessor": "^0.2.0", "karma-phantomjs-launcher": "^1.0.4", - "mailosaur": "^1.0.1", "mocha": "^3.1.2", "mocha-lcov-reporter": "^1.0.0", "nightwatch": "^0.9.8", - "node-mandrill": "^1.0.1", "phantomjs": "^1.9.18", "selenium-server": "^3.0.1", "should": "~7.1.1", diff --git a/public/dist/vendor.min.js b/public/dist/vendor.min.js index a7a47ac7..0e01a1b0 100644 --- a/public/dist/vendor.min.js +++ b/public/dist/vendor.min.js @@ -9,11 +9,11 @@ a.put("bootstrap/no-choice.tpl.html",'',require:"ngModel",scope:!0,link:e};return f}]),!function(a){var b="Compound",c="Identifier",d="MemberExpression",e="Literal",f="ThisExpression",g="CallExpression",h="UnaryExpression",i="BinaryExpression",j="LogicalExpression",k="ConditionalExpression",l="ArrayExpression",m=46,n=44,o=39,p=34,q=40,r=41,s=91,t=93,u=63,v=59,w=58,x=function(a,b){var c=new Error(a+" at character "+b);throw c.index=b,c.description=a,c},y=!0,z={"-":y,"!":y,"~":y,"+":y},A={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},B=function(a){var b,c=0;for(var d in a)(b=d.length)>c&&a.hasOwnProperty(d)&&(c=b);return c},C=B(z),D=B(A),E={"true":!0,"false":!1,"null":null},F="this",G=function(a){return A[a]||0},H=function(a,b,c){var d="||"===a||"&&"===a?j:i;return{type:d,operator:a,left:b,right:c}},I=function(a){return a>=48&&a<=57},J=function(a){return 36===a||95===a||a>=65&&a<=90||a>=97&&a<=122||a>=128&&!A[String.fromCharCode(a)]},K=function(a){return 36===a||95===a||a>=65&&a<=90||a>=97&&a<=122||a>=48&&a<=57||a>=128&&!A[String.fromCharCode(a)]},L=function(a){for(var i,j,y=0,B=a.charAt,L=a.charCodeAt,M=function(b){return B.call(a,b)},N=function(b){return L.call(a,b)},O=a.length,P=function(){for(var a=N(y);32===a||9===a;)a=N(++y)},Q=function(){var a,b,c=S();return P(),N(y)!==u?c:(y++,a=Q(),a||x("Expected expression",y),P(),N(y)===w?(y++,b=Q(),b||x("Expected expression",y),{type:k,test:c,consequent:a,alternate:b}):void x("Expected :",y))},R=function(){P();for(var b=a.substr(y,D),c=b.length;c>0;){if(A.hasOwnProperty(b))return y+=c,b;b=b.substr(0,--c)}return!1},S=function(){var a,b,c,d,e,f,g,h;if(f=T(),b=R(),!b)return f;for(e={value:b,prec:G(b)},g=T(),g||x("Expected expression after "+b,y),d=[f,e,g];(b=R())&&(c=G(b),0!==c);){for(e={value:b,prec:c};d.length>2&&c<=d[d.length-2].prec;)g=d.pop(),b=d.pop().value,f=d.pop(),a=H(b,f,g),d.push(a);a=T(),a||x("Expected expression after "+b,y),d.push(e,a)}for(h=d.length-1,a=d[h];h>1;)a=H(d[h-1].value,d[h-2],a),h-=2;return a},T=function(){var b,c,d;if(P(),b=N(y),I(b)||b===m)return U();if(b===o||b===p)return V();if(J(b)||b===q)return Y();if(b===s)return $();for(c=a.substr(y,C),d=c.length;d>0;){if(z.hasOwnProperty(c))return y+=d,{type:h,operator:c,argument:T(),prefix:!0};c=c.substr(0,--d)}return!1},U=function(){for(var a,b,c="";I(N(y));)c+=M(y++);if(N(y)===m)for(c+=M(y++);I(N(y));)c+=M(y++);if(a=M(y),"e"===a||"E"===a){for(c+=M(y++),a=M(y),"+"!==a&&"-"!==a||(c+=M(y++));I(N(y));)c+=M(y++);I(N(y-1))||x("Expected exponent ("+c+M(y)+")",y)}return b=N(y),J(b)?x("Variable names cannot start with a number ("+c+M(y)+")",y):b===m&&x("Unexpected period",y),{type:e,value:parseFloat(c),raw:c}},V=function(){for(var a,b="",c=M(y++),d=!1;yg;g++)e(d[g]);return e}({1:[function(a,b,c){function d(a){this.name="RavenConfigError",this.message=a}d.prototype=new Error,d.prototype.constructor=d,b.exports=d},{}],2:[function(a,b,c){function d(){return+new Date}function e(){this.a=!("object"!=typeof JSON||!JSON.stringify),this.b="undefined"!=typeof document,this.c=null,this.d=null,this.e=null,this.f=null,this.g=null,this.h={},this.i={logger:"javascript",ignoreErrors:[],ignoreUrls:[],whitelistUrls:[],includePaths:[],crossOrigin:"anonymous",collectWindowErrors:!0,maxMessageLength:0,stackTraceLimit:50},this.j=0,this.k=!1,this.l=Error.stackTraceLimit,this.m=window.console||{},this.n={},this.o=[],this.p=d(),this.q=[];for(var a in this.m)this.n[a]=this.m[a]}var f=a(5),g=a(1),h=a(4),i=h.isFunction,j=h.isUndefined,k=h.isError,l=h.isEmptyObject,m=h.hasKey,n=h.joinRegExp,o=h.each,p=h.objectMerge,q=h.truncate,r=h.urlencode,s=h.uuid4,t="source protocol user pass host port path".split(" "),u=/^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/;e.prototype={VERSION:"2.3.0",debug:!1,TraceKit:f,config:function(a,b){var c=this;if(this.e)return this.r("error","Error: Raven has already been configured"),this;if(!a)return this;b&&o(b,function(a,b){"tags"===a||"extra"===a?c.h[a]=b:c.i[a]=b});var d=this.s(a),e=d.path.lastIndexOf("/"),g=d.path.substr(1,e);return this.t=a,this.i.ignoreErrors.push(/^Script error\.?$/),this.i.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/),this.i.ignoreErrors=n(this.i.ignoreErrors),this.i.ignoreUrls=!!this.i.ignoreUrls.length&&n(this.i.ignoreUrls),this.i.whitelistUrls=!!this.i.whitelistUrls.length&&n(this.i.whitelistUrls),this.i.includePaths=n(this.i.includePaths),this.f=d.user,this.u=d.pass&&d.pass.substr(1),this.g=d.path.substr(e+1),this.e=this.v(d),this.w=this.e+"/"+g+"api/"+this.g+"/store/",this.i.fetchContext&&(f.remoteFetching=!0),this.i.linesOfContext&&(f.linesOfContext=this.i.linesOfContext),f.collectWindowErrors=!!this.i.collectWindowErrors,this},install:function(){var a=this;return this.isSetup()&&!this.k&&(f.report.subscribe(function(){a.x.apply(a,arguments)}),this.y(),this.z(),this.k=!0),Error.stackTraceLimit=this.i.stackTraceLimit,this},context:function(a,b,c){return i(a)&&(c=b||[],b=a,a=void 0),this.wrap(a,b).apply(this,c)},wrap:function(a,b){function c(){for(var c=[],e=arguments.length,f=!a||a&&a.deep!==!1;e--;)c[e]=f?d.wrap(a,arguments[e]):arguments[e];try{return b.apply(this,c)}catch(g){throw d.A(),d.captureException(g,a),g}}var d=this;if(j(b)&&!i(a))return a;if(i(a)&&(b=a,a=void 0),!i(b))return b;try{if(b.B)return b}catch(e){return b}if(b.C)return b.C;for(var f in b)m(b,f)&&(c[f]=b[f]);return b.C=c,c.prototype=b.prototype,c.B=!0,c.D=b,c},uninstall:function(){return f.report.uninstall(),this.E(),Error.stackTraceLimit=this.l,this.k=!1,this},captureException:function(a,b){if(!k(a))return this.captureMessage(a,b);this.c=a;try{var c=f.computeStackTrace(a); -this.F(c,b)}catch(d){if(a!==d)throw d}return this},captureMessage:function(a,b){return this.i.ignoreErrors.test&&this.i.ignoreErrors.test(a)?void 0:(this.G(p({message:a+""},b)),this)},addPlugin:function(a){var b=Array.prototype.slice.call(arguments,1);return this.o.push([a,b]),this.k&&this.z(),this},setUserContext:function(a){return this.h.user=a,this},setExtraContext:function(a){return this.H("extra",a),this},setTagsContext:function(a){return this.H("tags",a),this},clearContext:function(){return this.h={},this},getContext:function(){return JSON.parse(JSON.stringify(this.h))},setRelease:function(a){return this.i.release=a,this},setDataCallback:function(a){return this.i.dataCallback=a,this},setShouldSendCallback:function(a){return this.i.shouldSendCallback=a,this},setTransport:function(a){return this.i.transport=a,this},lastException:function(){return this.c},lastEventId:function(){return this.d},isSetup:function(){return!!this.a&&(!!this.e||(this.ravenNotConfiguredError||(this.ravenNotConfiguredError=!0,this.r("error","Error: Raven has not been configured.")),!1))},afterLoad:function(){var a=window.RavenConfig;a&&this.config(a.dsn,a.config).install()},showReportDialog:function(a){if(window.document){a=a||{};var b=a.eventId||this.lastEventId();if(!b)throw new g("Missing eventId");var c=a.dsn||this.t;if(!c)throw new g("Missing DSN");var d=encodeURIComponent,e="";e+="?eventId="+d(b),e+="&dsn="+d(c);var f=a.user||this.h.user;f&&(f.name&&(e+="&name="+d(f.name)),f.email&&(e+="&email="+d(f.email)));var h=this.v(this.s(c)),i=document.createElement("script");i.async=!0,i.src=h+"/api/embed/error-page/"+e,(document.head||document.body).appendChild(i)}},A:function(){var a=this;this.j+=1,setTimeout(function(){a.j-=1})},I:function(a,b){var c,d;if(this.b){b=b||{},a="raven"+a.substr(0,1).toUpperCase()+a.substr(1),document.createEvent?(c=document.createEvent("HTMLEvents"),c.initEvent(a,!0,!0)):(c=document.createEventObject(),c.eventType=a);for(d in b)m(b,d)&&(c[d]=b[d]);if(document.createEvent)document.dispatchEvent(c);else try{document.fireEvent("on"+c.eventType.toLowerCase(),c)}catch(e){}}},y:function(){function a(a,b,d,e){var f=a[b];a[b]=d(f),e||c.q.push([a,b,f])}function b(a){return function(b,d){var e=[].slice.call(arguments),f=e[0];return i(f)&&(e[0]=c.wrap(f)),a.apply?a.apply(this,e):a(e[0],e[1])}}var c=this;a(window,"setTimeout",b),a(window,"setInterval",b),window.requestAnimationFrame&&a(window,"requestAnimationFrame",function(a){return function(b){return a(c.wrap(b))}}),"EventTarget Window Node ApplicationCache AudioTrackList ChannelMergerNode CryptoOperation EventSource FileReader HTMLUnknownElement IDBDatabase IDBRequest IDBTransaction KeyOperation MediaController MessagePort ModalWindow Notification SVGElementInstance Screen TextTrack TextTrackCue TextTrackList WebSocket WebSocketWorker Worker XMLHttpRequest XMLHttpRequestEventTarget XMLHttpRequestUpload".replace(/\w+/g,function(b){var d=window[b]&&window[b].prototype;d&&d.hasOwnProperty&&d.hasOwnProperty("addEventListener")&&(a(d,"addEventListener",function(a){return function(b,d,e,f){try{d&&d.handleEvent&&(d.handleEvent=c.wrap(d.handleEvent))}catch(g){}return a.call(this,b,c.wrap(d),e,f)}}),a(d,"removeEventListener",function(a){return function(b,c,d,e){return c=c&&(c.C?c.C:c),a.call(this,b,c,d,e)}}))}),"XMLHttpRequest"in window&&a(XMLHttpRequest.prototype,"send",function(b){return function(d){var e=this;return"onreadystatechange onload onerror onprogress".replace(/\w+/g,function(b){b in e&&"[object Function]"===Object.prototype.toString.call(e[b])&&a(e,b,function(a){return c.wrap(a)},!0)}),b.apply(this,arguments)}});var d=window.jQuery||window.$;d&&d.fn&&d.fn.ready&&a(d.fn,"ready",function(a){return function(b){return a.call(this,c.wrap(b))}})},E:function(){for(var a;this.q.length;){a=this.q.shift();var b=a[0],c=a[1],d=a[2];b[c]=d}},z:function(){var a=this;o(this.o,function(b,c){var d=c[0],e=c[1];d.apply(a,[a].concat(e))})},s:function(a){var b=u.exec(a),c={},d=7;try{for(;d--;)c[t[d]]=b[d]||""}catch(e){throw new g("Invalid DSN: "+a)}if(c.pass&&!this.i.allowSecretKey)throw new g("Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key");return c},v:function(a){var b="//"+a.host+(a.port?":"+a.port:"");return a.protocol&&(b=a.protocol+":"+b),b},x:function(){this.j||this.F.apply(this,arguments)},F:function(a,b){var c=this,d=[];a.stack&&a.stack.length&&o(a.stack,function(a,b){var e=c.J(b);e&&d.push(e)}),this.I("handle",{stackInfo:a,options:b}),this.K(a.name,a.message,a.url,a.lineno,d.slice(0,this.i.stackTraceLimit),b)},J:function(a){if(a.url){var b,c={filename:a.url,lineno:a.line,colno:a.column,"function":a.func||"?"},d=this.L(a);if(d){var e=["pre_context","context_line","post_context"];for(b=3;b--;)c[e[b]]=d[b]}return c.in_app=!(this.i.includePaths.test&&!this.i.includePaths.test(c.filename)||/(Raven|TraceKit)\./.test(c["function"])||/raven\.(min\.)?js$/.test(c.filename)),c}},L:function(a){if(a.context&&this.i.fetchContext){for(var b=a.context,c=~~(b.length/2),d=b.length,e=!1;d--;)if(b[d].length>300){e=!0;break}if(e){if(j(a.column))return;return[[],b[c].substr(a.column,50),[]]}return[b.slice(0,c),b[c],b.slice(c+1)]}},K:function(a,b,c,d,e,f){var g,h;if((!this.i.ignoreErrors.test||!this.i.ignoreErrors.test(b))&&(b+="",b=q(b,this.i.maxMessageLength),h=(a?a+": ":"")+b,h=q(h,this.i.maxMessageLength),e&&e.length?(c=e[0].filename||c,e.reverse(),g={frames:e}):c&&(g={frames:[{filename:c,lineno:d,in_app:!0}]}),(!this.i.ignoreUrls.test||!this.i.ignoreUrls.test(c))&&(!this.i.whitelistUrls.test||this.i.whitelistUrls.test(c)))){var i=p({exception:{values:[{type:a,value:b,stacktrace:g}]},culprit:c,message:h},f);this.G(i)}},M:function(a){var b=this.i.maxMessageLength;if(a.message=q(a.message,b),a.exception){var c=a.exception.values[0];c.value=q(c.value,b)}return a},N:function(){if(this.b&&document.location&&document.location.href){var a={headers:{"User-Agent":navigator.userAgent}};return a.url=document.location.href,document.referrer&&(a.headers.Referer=document.referrer),a}},G:function(a){var b=this,c=this.i,e={project:this.g,logger:c.logger,platform:"javascript"},f=this.N();if(f&&(e.request=f),a=p(e,a),a.tags=p(p({},this.h.tags),a.tags),a.extra=p(p({},this.h.extra),a.extra),a.extra["session:duration"]=d()-this.p,l(a.tags)&&delete a.tags,this.h.user&&(a.user=this.h.user),c.release&&(a.release=c.release),c.serverName&&(a.server_name=c.serverName),i(c.dataCallback)&&(a=c.dataCallback(a)||a),a&&!l(a)&&(!i(c.shouldSendCallback)||c.shouldSendCallback(a))&&(this.d=a.event_id||(a.event_id=s()),a=this.M(a),this.r("debug","Raven about to send:",a),this.isSetup())){var g={sentry_version:"7",sentry_client:"raven-js/"+this.VERSION,sentry_key:this.f};this.u&&(g.sentry_secret=this.u);var h=this.w;(c.transport||this.O).call(this,{url:h,auth:g,data:a,options:c,onSuccess:function(){b.I("success",{data:a,src:h})},onError:function(){b.I("failure",{data:a,src:h})}})}},P:function(a){a.auth.sentry_data=JSON.stringify(a.data);var b=this.Q(),c=a.url+"?"+r(a.auth),d=a.options.crossOrigin;(d||""===d)&&(b.crossOrigin=d),b.onload=a.onSuccess,b.onerror=b.onabort=a.onError,b.src=c},R:function(a){function b(){200===c.status?a.onSuccess&&a.onSuccess():a.onError&&a.onError()}var c,d=a.url;c=new XMLHttpRequest,"withCredentials"in c?c.onreadystatechange=function(){4===c.readyState&&b()}:(c=new XDomainRequest,d=d.replace(/^https?:/,""),c.onload=b),c.open("POST",d+"?"+r(a.auth)),c.send(JSON.stringify(a.data))},O:function(a){var b="withCredentials"in new XMLHttpRequest||"undefined"!=typeof XDomainRequest;return(b?this.R:this.P)(a)},Q:function(){return document.createElement("img")},r:function(a){this.n[a]&&this.debug&&Function.prototype.apply.call(this.n[a],this.m,[].slice.call(arguments,1))},H:function(a,b){j(b)?delete this.h[a]:this.h[a]=p(this.h[a]||{},b)}},e.prototype.setUser=e.prototype.setUserContext,e.prototype.setReleaseContext=e.prototype.setRelease,b.exports=e},{1:1,4:4,5:5}],3:[function(a,b,c){var d=a(2),e=window.Raven,f=new d;f.noConflict=function(){return window.Raven=e,f},f.afterLoad(),b.exports=f},{2:2}],4:[function(a,b,c){function d(a){return void 0===a}function e(a){return"function"==typeof a}function f(a){return"[object String]"===q.toString.call(a)}function g(a){return"object"==typeof a&&null!==a}function h(a){for(var b in a)return!1;return!0}function i(a){var b=q.toString.call(a);return g(a)&&"[object Error]"===b||"[object Exception]"===b||a instanceof Error}function j(a,b){var c,e;if(d(a.length))for(c in a)m(a,c)&&b.call(null,c,a[c]);else if(e=a.length)for(c=0;e>c;c++)b.call(null,c,a[c])}function k(a,b){return b?(j(b,function(b,c){a[b]=c}),a):a}function l(a,b){return!b||b>=a.length?a:a.substr(0,b)+"…"}function m(a,b){return q.hasOwnProperty.call(a,b)}function n(a){for(var b,c=[],d=0,e=a.length;e>d;d++)b=a[d],f(b)?c.push(b.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):b&&b.source&&c.push(b.source);return new RegExp(c.join("|"),"i")}function o(a){var b=[];return j(a,function(a,c){b.push(encodeURIComponent(a)+"="+encodeURIComponent(c))}),b.join("&")}function p(){var a=window.crypto||window.msCrypto;if(!d(a)&&a.getRandomValues){var b=new Uint16Array(8);a.getRandomValues(b),b[3]=4095&b[3]|16384,b[4]=16383&b[4]|32768;var c=function(a){for(var b=a.toString(16);4>b.length;)b="0"+b;return b};return c(b[0])+c(b[1])+c(b[2])+c(b[3])+c(b[4])+c(b[5])+c(b[6])+c(b[7])}return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)})}var q=Object.prototype;b.exports={isUndefined:d,isFunction:e,isString:f,isObject:g,isEmptyObject:h,isError:i,each:j,objectMerge:k,truncate:l,hasKey:m,joinRegExp:n,urlencode:o,uuid4:p}},{}],5:[function(a,b,c){function d(){return"undefined"==typeof document?"":document.location.href}var e=a(4),f=e.hasKey,g=e.isString,h=e.isUndefined,i={remoteFetching:!1,collectWindowErrors:!0,linesOfContext:7,debug:!1},j=[].slice,k="?",l=/^(?:Uncaught )?((?:Eval|Internal|Range|Reference|Syntax|Type|URI)Error)\: ?(.*)$/;i.report=function(){function a(a){k(),r.push(a)}function b(a){for(var b=r.length-1;b>=0;--b)r[b]===a&&r.splice(b,1)}function c(){m(),r=[]}function e(a,b){var c=null;if(!b||i.collectWindowErrors){for(var d in r)if(f(r,d))try{r[d].apply(null,[a].concat(j.call(arguments,2)))}catch(e){c=e}if(c)throw c}}function h(a,b,c,f,h){var j=null;if(u)i.computeStackTrace.augmentStackTraceWithInitialElement(u,b,c,a),n();else if(h)j=i.computeStackTrace(h),e(j,!0);else{var k={url:b,line:c,column:f};k.func=i.computeStackTrace.guessFunctionName(k.url,k.line),k.context=i.computeStackTrace.gatherContext(k.url,k.line);var m,o=void 0,q=a;if(g(a)){var m=a.match(l);m&&(o=m[1],q=m[2])}j={name:o,message:q,url:d(),stack:[k]},e(j,!0)}return!!p&&p.apply(this,arguments)}function k(){q||(p=window.onerror,window.onerror=h,q=!0)}function m(){q&&(window.onerror=p,q=!1,p=void 0)}function n(){var a=u,b=s;s=null,u=null,t=null,e.apply(null,[a,!1].concat(b))}function o(a,b){var c=j.call(arguments,1);if(u){if(t===a)return;n()}var d=i.computeStackTrace(a);if(u=d,t=a,s=c,window.setTimeout(function(){t===a&&n()},d.incomplete?2e3:0),b!==!1)throw a}var p,q,r=[],s=null,t=null,u=null;return o.subscribe=a,o.unsubscribe=b,o.uninstall=c,o}(),i.computeStackTrace=function(){function a(a){if(!i.remoteFetching)return"";try{var b=function(){try{return new window.XMLHttpRequest}catch(a){return new window.ActiveXObject("Microsoft.XMLHTTP")}},c=b();return c.open("GET",a,!1),c.send(""),c.responseText}catch(d){return""}}function b(b){if(!g(b))return[];if(!f(v,b)){var c="",d="";try{d=document.domain}catch(e){}-1!==b.indexOf(d)&&(c=a(b)),v[b]=c?c.split("\n"):[]}return v[b]}function c(a,c){var d,e=/function ([^(]*)\(([^)]*)\)/,f=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,g="",i=10,j=b(a);if(!j.length)return k;for(var l=0;i>l;++l)if(g=j[c-l]+g,!h(g)){if(d=f.exec(g))return d[1];if(d=e.exec(g))return d[1]}return k}function e(a,c){var d=b(a);if(!d.length)return null;var e=[],f=Math.floor(i.linesOfContext/2),g=f+i.linesOfContext%2,j=Math.max(0,c-f-1),k=Math.min(d.length,c+g-1);c-=1;for(var l=j;k>l;++l)h(d[l])||e.push(d[l]);return e.length>0?e:null}function j(a){return a.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function l(a){return j(a).replace("<","(?:<|<)").replace(">","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function m(a,c){for(var d,e,f=0,g=c.length;g>f;++f)if((d=b(c[f])).length&&(d=d.join("\n"),e=a.exec(d)))return{url:c[f],line:d.substring(0,e.index).split("\n").length,column:e.index-d.lastIndexOf("\n",e.index)-1};return null}function n(a,c,d){var e,f=b(c),g=new RegExp("\\b"+j(a)+"\\b");return d-=1,f&&f.length>d&&(e=g.exec(f[d]))?e.index:null}function o(a){if("undefined"!=typeof document){for(var b,c,d,e,f=[window.location.href],g=document.getElementsByTagName("script"),h=""+a,i=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,k=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/,n=0;g.length>n;++n){var o=g[n];o.src&&f.push(o.src)}if(d=i.exec(h)){var p=d[1]?"\\s+"+d[1]:"",q=d[2].split(",").join("\\s*,\\s*");b=j(d[3]).replace(/;$/,";?"),c=new RegExp("function"+p+"\\s*\\(\\s*"+q+"\\s*\\)\\s*{\\s*"+b+"\\s*}")}else c=new RegExp(j(h).replace(/\s+/g,"\\s+"));if(e=m(c,f))return e;if(d=k.exec(h)){var r=d[1];if(b=l(d[2]),c=new RegExp("on"+r+"=[\\'\"]\\s*"+b+"\\s*[\\'\"]","i"),e=m(c,f[0]))return e;if(c=new RegExp(b),e=m(c,f))return e}return null}}function p(a){if(!h(a.stack)&&a.stack){for(var b,f,g=/^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,i=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|\[native).*?)(?::(\d+))?(?::(\d+))?\s*$/i,j=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:ms-appx|https?|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,l=a.stack.split("\n"),m=[],o=/^(.*) is undefined$/.exec(a.message),p=0,q=l.length;q>p;++p){if(b=g.exec(l[p])){var r=b[2]&&-1!==b[2].indexOf("native");f={url:r?null:b[2],func:b[1]||k,args:r?[b[2]]:[],line:b[3]?+b[3]:null,column:b[4]?+b[4]:null}}else if(b=j.exec(l[p]))f={url:b[2],func:b[1]||k,args:[],line:+b[3],column:b[4]?+b[4]:null};else{if(!(b=i.exec(l[p])))continue;f={url:b[3],func:b[1]||k,args:b[2]?b[2].split(","):[],line:b[4]?+b[4]:null,column:b[5]?+b[5]:null}}!f.func&&f.line&&(f.func=c(f.url,f.line)),f.line&&(f.context=e(f.url,f.line)),m.push(f)}return m.length?(m[0].line&&!m[0].column&&o?m[0].column=n(o[1],m[0].url,m[0].line):m[0].column||h(a.columnNumber)||(m[0].column=a.columnNumber+1),{name:a.name,message:a.message,url:d(),stack:m}):null}}function q(a){var b=a.stacktrace;if(!h(a.stacktrace)&&a.stacktrace){for(var f,g=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,i=/ line (\d+), column (\d+)\s*(?:in (?:]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,j=b.split("\n"),k=[],l=0;j.length>l;l+=2){var m=null;if((f=g.exec(j[l]))?m={url:f[2],line:+f[1],column:null,func:f[3],args:[]}:(f=i.exec(j[l]))&&(m={url:f[6],line:+f[1],column:+f[2],func:f[3]||f[4],args:f[5]?f[5].split(","):[]}),m){if(!m.func&&m.line&&(m.func=c(m.url,m.line)),m.line)try{m.context=e(m.url,m.line)}catch(n){}m.context||(m.context=[j[l+1]]),k.push(m)}}return k.length?{name:a.name,message:a.message,url:d(),stack:k}:null}}function r(a){var g=a.message.split("\n");if(4>g.length)return null;var h,i=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,j=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,k=/^\s*Line (\d+) of function script\s*$/i,n=[],o=document.getElementsByTagName("script"),p=[];for(var q in o)f(o,q)&&!o[q].src&&p.push(o[q]);for(var r=2;g.length>r;r+=2){var s=null;if(h=i.exec(g[r]))s={url:h[2],func:h[3],args:[],line:+h[1],column:null};else if(h=j.exec(g[r])){s={url:h[3],func:h[4],args:[],line:+h[1],column:null};var t=+h[1],u=p[h[2]-1];if(u){var v=b(s.url);if(v){v=v.join("\n");var w=v.indexOf(u.innerText);w>=0&&(s.line=t+v.substring(0,w).split("\n").length)}}}else if(h=k.exec(g[r])){var x=window.location.href.replace(/#.*$/,""),y=new RegExp(l(g[r+1])),z=m(y,[x]);s={url:x,func:"",args:[],line:z?z.line:h[1],column:null}}if(s){s.func||(s.func=c(s.url,s.line));var A=e(s.url,s.line),B=A?A[Math.floor(A.length/2)]:null;s.context=A&&B.replace(/^\s*/,"")===g[r+1].replace(/^\s*/,"")?A:[g[r+1]],n.push(s)}}return n.length?{name:a.name,message:g[0],url:d(),stack:n}:null}function s(a,b,d,f){var g={url:b,line:d};if(g.url&&g.line){a.incomplete=!1,g.func||(g.func=c(g.url,g.line)),g.context||(g.context=e(g.url,g.line));var h=/ '([^']+)' /.exec(f);if(h&&(g.column=n(h[1],g.url,g.line)),a.stack.length>0&&a.stack[0].url===g.url){if(a.stack[0].line===g.line)return!1;if(!a.stack[0].line&&a.stack[0].func===g.func)return a.stack[0].line=g.line,a.stack[0].context=g.context,!1}return a.stack.unshift(g),a.partial=!0,!0}return a.incomplete=!0,!1}function t(a,b){for(var e,f,g,h=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,j=[],l={},m=!1,p=t.caller;p&&!m;p=p.caller)if(p!==u&&p!==i.report){if(f={url:null,func:k,line:null,column:null},p.name?f.func=p.name:(e=h.exec(p.toString()))&&(f.func=e[1]),"undefined"==typeof f.func)try{f.func=e.input.substring(0,e.input.indexOf("{"))}catch(q){}if(g=o(p)){f.url=g.url,f.line=g.line,f.func===k&&(f.func=c(f.url,f.line));var r=/ '([^']+)' /.exec(a.message||a.description);r&&(f.column=n(r[1],g.url,g.line))}l[""+p]?m=!0:l[""+p]=!0,j.push(f)}b&&j.splice(0,b);var v={name:a.name,message:a.message,url:d(),stack:j};return s(v,a.sourceURL||a.fileName,a.line||a.lineNumber,a.message||a.description),v}function u(a,b){var c=null;b=null==b?0:+b;try{if(c=q(a))return c}catch(e){if(i.debug)throw e}try{if(c=p(a))return c}catch(e){if(i.debug)throw e}try{if(c=r(a))return c}catch(e){if(i.debug)throw e}try{if(c=t(a,b+1))return c}catch(e){if(i.debug)throw e}return{name:a.name,message:a.message,url:d()}}var v={};return u.augmentStackTraceWithInitialElement=s,u.computeStackTraceFromStackProp=p,u.guessFunctionName=c,u.gatherContext=e,u}(),b.exports=i},{4:4}]},{},[3])(3)}),function(){function a(a,b){if(a!==b){var c=null===a,d=a===u,e=a===a,f=null===b,g=b===u,h=b===b;if(a>b&&!f||!e||c&&!g&&h||d&&h)return 1;if(a=a&&9<=a&&13>=a||32==a||160==a||5760==a||6158==a||8192<=a&&(8202>=a||8232==a||8233==a||8239==a||8287==a||12288==a||65279==a)}function p(a,b){for(var c=-1,d=a.length,e=-1,f=[];++c=J&&pe&&je?new Oa(b):null,j=b.length;i&&(g=Pa,h=!1,b=i);a:for(;++fg(b,i,0)&&e.push(i);return e}function hb(a,b){var c=!0;return He(a,function(a,d,e){return c=!!b(a,d,e)}),c}function ib(a,b,c,d){var e=d,f=e;return He(a,function(a,g,h){g=+b(a,g,h),(c(g,e)||g===d&&g===f)&&(e=g,f=a)}),f}function jb(a,b){var c=[];return He(a,function(a,d,e){b(a,d,e)&&c.push(a)}),c}function kb(a,b,c,d){var e;return c(a,function(a,c,f){return b(a,c,f)?(e=d?c:a,!1):void 0}),e}function lb(a,b,c,d){d||(d=[]);for(var e=-1,f=a.length;++eb&&(b=-b>e?0:e+b),c=c===u||c>e?e:+c||0,0>c&&(c+=e),e=b>c?0:c-b>>>0,b>>>=0,c=Nd(e);++d=j)break a;f=d[f],e*="asc"===f||!0===f?1:-1;break a}e=b.b-c.b}return e})}function Gb(a,b){var c=0;return He(a,function(a,d,e){c+=+b(a,d,e)||0}),c}function Hb(a,b){var d=-1,e=vc(),f=a.length,g=e===c,h=g&&f>=J,i=h&&pe&&je?new Oa((void 0)):null,j=[];i?(e=Pa,g=!1):(h=!1,i=b?[]:j);a:for(;++de(i,l,0)&&((b||h)&&i.push(l),j.push(k))}return j}function Ib(a,b){for(var c=-1,d=b.length,e=Nd(d);++c>>1,g=a[f];(c?g<=b:ge?u:f,e=1);++d=J)return b.plant(d).value();for(var e=0,a=c?f[e].apply(this,a):d;++earguments.length;return"function"==typeof d&&f===u&&Bf(c)?a(c,d,e,g):Bb(c,tc(d,f,4),e,g,b)}}function kc(a,b,c,d,e,f,g,h,i,j){function k(){for(var t=arguments.length,v=t,y=Nd(t);v--;)y[v]=arguments[v];if(d&&(y=Pb(y,d,e)),f&&(y=Qb(y,f,g)),o||r){var v=k.placeholder,z=p(y,v),t=t-z.length;if(tb?0:b)):[]}function Rc(a,b,c){var d=a?a.length:0;return d?((c?Ec(a,b,c):null==b)&&(b=1),b=d-(+b||0),Cb(a,0,0>b?0:b)):[]}function Sc(a){return a?a[0]:u}function Tc(a,b,d){var e=a?a.length:0;if(!e)return-1;if("number"==typeof d)d=0>d?ue(e+d,0):d;else if(d)return d=Lb(a,b),dc?ue(e+c,0):c||0,"string"==typeof a||!Bf(a)&&ud(a)?c<=e&&-1b?0:+b||0,d);++c=a&&(b=u),c}}function hd(a,b,c){function d(b,c){c&&fe(c),i=m=n=u,b&&(o=nf(),j=a.apply(l,h),m||i||(h=l=u))}function e(){var a=b-(nf()-k);0>=a||a>b?d(n,i):m=ke(e,a)}function f(){d(q,m)}function g(){if(h=arguments,k=nf(),l=this,n=q&&(m||!r),!1===p)var c=r&&!m;else{i||r||(o=k);var d=p-(k-o),g=0>=d||d>p;g?(i&&(i=fe(i)),o=k,j=a.apply(l,h)):i||(i=ke(f,d))}return g&&m?m=fe(m):m||b===p||(m=ke(e,b)),c&&(g=!0,j=a.apply(l,h)),!g||m||i||(h=l=u),j}var h,i,j,k,l,m,n,o=0,p=!1,q=!0;if("function"!=typeof a)throw new Wd(M);if(b=0>b?0:+b||0,!0===c)var r=!0,q=!1;else pd(c)&&(r=!!c.leading,p="maxWait"in c&&ue(+c.maxWait||0,b),q="trailing"in c?!!c.trailing:q);return g.cancel=function(){m&&fe(m),i&&fe(i),o=0,i=m=n=u},g}function id(a,b){function c(){var d=arguments,e=b?b.apply(this,d):d[0],f=c.cache;return f.has(e)?f.get(e):(d=a.apply(this,d),c.cache=f.set(e,d),d)}if("function"!=typeof a||b&&"function"!=typeof b)throw new Wd(M);return c.cache=new id.Cache,c}function jd(a,b){if("function"!=typeof a)throw new Wd(M);return b=ue(b===u?a.length-1:+b||0,0),function(){for(var c=arguments,d=-1,e=ue(c.length-b,0),f=Nd(e);++db}function ld(a){return n(a)&&Cc(a)&&_d.call(a,"callee")&&!ie.call(a,"callee")}function md(a,b,c,d){return d=(c="function"==typeof c?Nb(c,d,3):u)?c(a,b):u,d===u?rb(a,b,c):!!d}function nd(a){return n(a)&&"string"==typeof a.message&&be.call(a)==S}function od(a){return pd(a)&&be.call(a)==T}function pd(a){var b=typeof a;return!!a&&("object"==b||"function"==b)}function qd(a){return null!=a&&(od(a)?de.test($d.call(a)):n(a)&&Aa.test(a))}function rd(a){return"number"==typeof a||n(a)&&be.call(a)==U}function sd(a){var b;if(!n(a)||be.call(a)!=V||ld(a)||!(_d.call(a,"constructor")||(b=a.constructor,"function"!=typeof b||b instanceof b)))return!1;var c;return mb(a,function(a,b){c=b}),c===u||_d.call(a,c)}function td(a){return pd(a)&&be.call(a)==W}function ud(a){return"string"==typeof a||n(a)&&be.call(a)==X}function vd(a){return n(a)&&Hc(a.length)&&!!Ha[be.call(a)]}function wd(a,b){return ab||!a||!se(b))return c;do b%2&&(c+=a),b=qe(b/2),a+=a;while(b);return c}function Fd(a,b,c){var d=a;return(a=e(a))?(c?Ec(d,b,c):null==b)?a.slice(q(a),r(a)+1):(b+="",a.slice(f(a,b),g(a,b)+1)):a}function Gd(a,b,c){return c&&Ec(a,b,c)&&(b=u),a=e(a),a.match(b||Fa)||[]}function Hd(a,b,c){return c&&Ec(a,b,c)&&(b=u),n(a)?Jd(a):db(a,b)}function Id(a){return a}function Jd(a){return ub(eb(a,!0))}function Kd(a,b,c){if(null==c){var d=pd(b),e=d?Mf(b):u;((e=e&&e.length?pb(b,e):u)?e.length:d)||(e=!1,c=b,b=a,a=this)}e||(e=pb(b,Mf(b)));var f=!0,d=-1,g=od(a),h=e.length;!1===c?f=!1:pd(c)&&"chain"in c&&(f=c.chain);for(;++d=H)return c}else a=0;return Le(c,d)}}(),Pe=jd(function(a,b){return n(a)&&Cc(a)?gb(a,lb(b,!1,!0)):[]}),Qe=ac(),Re=ac(!0),Se=jd(function(a){for(var b=a.length,d=b,e=Nd(k),f=vc(),g=f===c,h=[];d--;){var i=a[d]=Cc(i=a[d])?i:[];e[d]=g&&120<=i.length&&pe&&je?new Oa(d&&i):null}var g=a[0],j=-1,k=g?g.length:0,l=e[0];a:for(;++j(l?Pa(l,i):f(h,i,0))){for(d=b;--d;){var m=e[d];if(0>(m?Pa(m,i):f(a[d],i,0)))continue a}l&&l.push(i),h.push(i)}return h}),Te=jd(function(b,c){c=lb(c);var d=bb(b,c);return zb(b,c.sort(a)),d}),Ue=oc(),Ve=oc(!0),We=jd(function(a){return Hb(lb(a,!1,!0))}),Xe=jd(function(a,b){return Cc(a)?gb(a,b):[]}),Ye=jd(Xc),Ze=jd(function(a){var b=a.length,c=2--a?b.apply(this,arguments):void 0}},Ja.ary=function(a,b,c){return c&&Ec(a,b,c)&&(b=u),b=a&&null==b?a.length:ue(+b||0,0),pc(a,D,u,u,u,u,b)},Ja.assign=Df,Ja.at=_e,Ja.before=gd,Ja.bind=of,Ja.bindAll=pf,Ja.bindKey=qf,Ja.callback=Hd,Ja.chain=$c,Ja.chunk=function(a,b,c){b=(c?Ec(a,b,c):null==b)?1:ue(qe(b)||1,1),c=0;for(var d=a?a.length:0,e=-1,f=Nd(oe(d/b));cc&&(c=-c>e?0:e+c),d=d===u||d>e?e:+d||0,0>d&&(d+=e),e=c>d?0:d>>>0,c>>>=0;cb?0:b)):[]},Ja.takeRight=function(a,b,c){var d=a?a.length:0;return d?((c?Ec(a,b,c):null==b)&&(b=1),b=d-(+b||0),Cb(a,0>b?0:b)):[]},Ja.takeRightWhile=function(a,b,c){return a&&a.length?Jb(a,tc(b,c,3),!1,!0):[]},Ja.takeWhile=function(a,b,c){return a&&a.length?Jb(a,tc(b,c,3)):[]},Ja.tap=function(a,b,c){return b.call(c,a),a},Ja.throttle=function(a,b,c){var d=!0,e=!0;if("function"!=typeof a)throw new Wd(M);return!1===c?d=!1:pd(c)&&(d="leading"in c?!!c.leading:d,e="trailing"in c?!!c.trailing:e),hd(a,b,{leading:d,maxWait:+b,trailing:e})},Ja.thru=_c,Ja.times=function(a,b,c){if(a=qe(a),1>a||!se(a))return[];var d=-1,e=Nd(ve(a,4294967295));for(b=Nb(b,c,1);++dd?e[d]=b(d):b(d);return e},Ja.toArray=xd,Ja.toPlainObject=yd,Ja.transform=function(a,b,c,d){var e=Bf(a)||vd(a);return b=tc(b,d,4),null==c&&(e||pd(a)?(d=a.constructor,c=e?Bf(a)?new d:[]:Ge(od(d)?d.prototype:u)):c={}),(e?Ra:nb)(a,function(a,d,e){return b(c,a,d,e)}),c},Ja.union=We,Ja.uniq=Wc,Ja.unzip=Xc,Ja.unzipWith=Yc,Ja.values=Cd,Ja.valuesIn=function(a){return Ib(a,Ad(a))},Ja.where=function(a,b){return bd(a,ub(b))},Ja.without=Xe,Ja.wrap=function(a,b){return b=null==b?Id:b,pc(b,B,u,[a],[])},Ja.xor=function(){for(var a=-1,b=arguments.length;++ac?0:+c||0,d),c-=b.length,0<=c&&a.indexOf(b,c)==c},Ja.escape=function(a){return(a=e(a))&&ma.test(a)?a.replace(ka,j):a},Ja.escapeRegExp=function(a){return(a=e(a))&&ua.test(a)?a.replace(ta,k):a||"(?:)"},Ja.every=ad,Ja.find=bf,Ja.findIndex=Qe,Ja.findKey=Gf,Ja.findLast=cf,Ja.findLastIndex=Re,Ja.findLastKey=Hf,Ja.findWhere=function(a,b){return bf(a,ub(b))},Ja.first=Sc,Ja.floor=_f,Ja.get=function(a,b,c){return a=null==a?u:qb(a,Oc(b),b+""),a===u?c:a},Ja.gt=kd,Ja.gte=function(a,b){return a>=b},Ja.has=function(a,b){if(null==a)return!1;var c=_d.call(a,b);if(!c&&!Fc(b)){if(b=Oc(b),a=1==b.length?a:qb(a,Cb(b,0,-1)),null==a)return!1;b=Uc(b),c=_d.call(a,b)}return c||Hc(a.length)&&Dc(b,a.length)&&(Bf(a)||ld(a))},Ja.identity=Id,Ja.includes=cd,Ja.indexOf=Tc,Ja.inRange=function(a,b,c){return b=+b||0,c===u?(c=b,b=0):c=+c||0,a>=ve(b,c)&&ac?ue(d+c,0):ve(c||0,d-1))+1;else if(c)return e=Lb(a,b,!0)-1,a=a[e],(b===b?b===a:a!==a)?e:-1;if(b!==b)return m(a,e,!0);for(;e--;)if(a[e]===b)return e;return-1},Ja.lt=wd,Ja.lte=function(a,b){return a<=b},Ja.max=ag,Ja.min=bg,Ja.noConflict=function(){return Ua._=ce,this},Ja.noop=Ld,Ja.now=nf,Ja.pad=function(a,b,c){a=e(a),b=+b;var d=a.length;return dc?0:+c||0,a.length),a.lastIndexOf(b,c)==c},Ja.sum=function(a,b,c){if(c&&Ec(a,b,c)&&(b=u),b=tc(b,c,3),1==b.length){a=Bf(a)?a:Mc(a),c=a.length;for(var d=0;c--;)d+=+b(a[c])||0;a=d}else a=Gb(a,b);return a},Ja.template=function(a,b,c){var d=Ja.templateSettings;c&&Ec(a,b,c)&&(b=c=u),a=e(a),b=_a(ab({},c||b),d,$a),c=_a(ab({},b.imports),d.imports,$a);var f,g,h=Mf(c),i=Ib(c,h),j=0;c=b.interpolate||Da;var k="__p+='";c=Ud((b.escape||Da).source+"|"+c.source+"|"+(c===pa?xa:Da).source+"|"+(b.evaluate||Da).source+"|$","g");var m="sourceURL"in b?"//# sourceURL="+b.sourceURL+"\n":"";if(a.replace(c,function(b,c,d,e,h,i){return d||(d=e),k+=a.slice(j,i).replace(Ea,l),c&&(f=!0,k+="'+__e("+c+")+'"),h&&(g=!0,k+="';"+h+";\n__p+='"),d&&(k+="'+((__t=("+d+"))==null?'':__t)+'"),j=i+b.length,b}),k+="';",(b=b.variable)||(k="with(obj){"+k+"}"),k=(g?k.replace(ga,""):k).replace(ha,"$1").replace(ia,"$1;"),k="function("+(b||"obj")+"){"+(b?"":"obj||(obj={});")+"var __t,__p=''"+(f?",__e=_.escape":"")+(g?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+k+"return __p}",b=Xf(function(){return Qd(h,m+"return "+k).apply(u,i)}),b.source=k,nd(b))throw b;return b},Ja.trim=Fd,Ja.trimLeft=function(a,b,c){var d=a;return(a=e(a))?a.slice((c?Ec(d,b,c):null==b)?q(a):f(a,b+"")):a},Ja.trimRight=function(a,b,c){var d=a;return(a=e(a))?(c?Ec(d,b,c):null==b)?a.slice(0,r(a)+1):a.slice(0,g(a,b+"")+1):a},Ja.trunc=function(a,b,c){c&&Ec(a,b,c)&&(b=u);var d=F;if(c=G,null!=b)if(pd(b)){var f="separator"in b?b.separator:f,d="length"in b?+b.length||0:d;c="omission"in b?e(b.omission):c}else d=+b||0;if(a=e(a),d>=a.length)return a;if(d-=c.length,1>d)return c;if(b=a.slice(0,d),null==f)return b+c;if(td(f)){if(a.slice(d).search(f)){var g,h=a.slice(0,d);for(f.global||(f=Ud(f.source,(ya.exec(f)||"")+"g")),f.lastIndex=0;a=f.exec(h);)g=a.index;b=b.slice(0,null==g?d:g)}}else a.indexOf(f,d)!=d&&(f=b.lastIndexOf(f),-1e.__dir__?"Right":"")}),e},Ma.prototype[a+"Right"]=function(b){return this.reverse()[a](b).reverse()}}),Ra(["filter","map","takeWhile"],function(a,b){var c=b+1,d=c!=L;Ma.prototype[a]=function(a,b){var e=this.clone();return e.__iteratees__.push({iteratee:tc(a,b,1),type:c}),e.__filtered__=e.__filtered__||d,e}}),Ra(["first","last"],function(a,b){var c="take"+(b?"Right":"");Ma.prototype[a]=function(){return this[c](1).value()[0]}}),Ra(["initial","rest"],function(a,b){var c="drop"+(b?"":"Right");Ma.prototype[a]=function(){return this.__filtered__?new Ma(this):this[c](1)}}),Ra(["pluck","where"],function(a,b){var c=b?"filter":"map",d=b?ub:Md;Ma.prototype[a]=function(a){return this[c](d(a))}}),Ma.prototype.compact=function(){return this.filter(Id)},Ma.prototype.reject=function(a,b){return a=tc(a,b,1),this.filter(function(b){return!a(b)})},Ma.prototype.slice=function(a,b){a=null==a?0:+a||0;var c=this;return c.__filtered__&&(0b)?new Ma(c):(0>a?c=c.takeRight(-a):a&&(c=c.drop(a)),b!==u&&(b=+b||0,c=0>b?c.dropRight(-b):c.take(b-a)),c)},Ma.prototype.takeRightWhile=function(a,b){return this.reverse().takeWhile(a,b).reverse()},Ma.prototype.toArray=function(){return this.take(Ae)},nb(Ma.prototype,function(a,b){var c=/^(?:filter|map|reject)|While$/.test(b),d=/^(?:first|last)$/.test(b),e=Ja[d?"take"+("last"==b?"Right":""):b];e&&(Ja.prototype[b]=function(){function b(a){return d&&g?e(a,1)[0]:e.apply(u,Xa([a],f))}var f=d?[1]:arguments,g=this.__chain__,h=this.__wrapped__,i=!!this.__actions__.length,j=h instanceof Ma,k=f[0],l=j||Bf(h);return l&&c&&"function"==typeof k&&1!=k.length&&(j=l=!1),k={func:_c,args:[b],thisArg:u},i=j&&!i,d&&!g?i?(h=h.clone(),h.__actions__.push(k),a.call(h)):e.call(u,this.value())[0]:!d&&l?(h=i?h:new Ma(this),h=a.apply(h,f),h.__actions__.push(k),new La(h,g)):this.thru(b)})}),Ra("join pop push replace shift sort splice split unshift".split(" "),function(a){var b=(/^(?:replace|split)$/.test(a)?Zd:Xd)[a],c=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",d=/^(?:join|pop|replace|shift)$/.test(a);Ja.prototype[a]=function(){var a=arguments;return d&&!this.__chain__?b.apply(this.value(),a):this[c](function(c){return b.apply(c,a)})}}),nb(Ma.prototype,function(a,b){var c=Ja[b];if(c){var d=c.name+"";(Fe[d]||(Fe[d]=[])).push({name:b,func:c})}}),Fe[kc(u,x).name]=[{name:"wrapper",func:u}],Ma.prototype.clone=function(){var a=new Ma(this.__wrapped__);return a.__actions__=Qa(this.__actions__),a.__dir__=this.__dir__,a.__filtered__=this.__filtered__,a.__iteratees__=Qa(this.__iteratees__),a.__takeCount__=this.__takeCount__,a.__views__=Qa(this.__views__),a},Ma.prototype.reverse=function(){if(this.__filtered__){var a=new Ma(this);a.__dir__=-1,a.__filtered__=!0}else a=this.clone(),a.__dir__*=-1;return a},Ma.prototype.value=function(){var a,b=this.__wrapped__.value(),c=this.__dir__,d=Bf(b),e=0>c,f=d?b.length:0;a=f;for(var g=this.__views__,h=0,i=-1,j=g.length;++i"'`]/g,la=RegExp(ja.source),ma=RegExp(ka.source),na=/<%-([\s\S]+?)%>/g,oa=/<%([\s\S]+?)%>/g,pa=/<%=([\s\S]+?)%>/g,qa=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,ra=/^\w*$/,sa=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,ta=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,ua=RegExp(ta.source),va=/[\u0300-\u036f\ufe20-\ufe23]/g,wa=/\\(\\)?/g,xa=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ya=/\w*$/,za=/^0[xX]/,Aa=/^\[object .+?Constructor\]$/,Ba=/^\d+$/,Ca=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Da=/($^)/,Ea=/['\n\r\u2028\u2029\\]/g,Fa=RegExp("[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?=[A-Z\\xc0-\\xd6\\xd8-\\xde][a-z\\xdf-\\xf6\\xf8-\\xff]+)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+|[A-Z\\xc0-\\xd6\\xd8-\\xde]+|[0-9]+","g"),Ga="Array ArrayBuffer Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Math Number Object RegExp Set String _ clearTimeout isFinite parseFloat parseInt setTimeout TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap".split(" "),Ha={};Ha[Z]=Ha[$]=Ha[_]=Ha[aa]=Ha[ba]=Ha[ca]=Ha[da]=Ha[ea]=Ha[fa]=!0,Ha[O]=Ha[P]=Ha[Y]=Ha[Q]=Ha[R]=Ha[S]=Ha[T]=Ha["[object Map]"]=Ha[U]=Ha[V]=Ha[W]=Ha["[object Set]"]=Ha[X]=Ha["[object WeakMap]"]=!1;var Ia={};Ia[O]=Ia[P]=Ia[Y]=Ia[Q]=Ia[R]=Ia[Z]=Ia[$]=Ia[_]=Ia[aa]=Ia[ba]=Ia[U]=Ia[V]=Ia[W]=Ia[X]=Ia[ca]=Ia[da]=Ia[ea]=Ia[fa]=!0,Ia[S]=Ia[T]=Ia["[object Map]"]=Ia["[object Set]"]=Ia["[object WeakMap]"]=!1;var Ja={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},Ka={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},La={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Ma={"function":!0,object:!0},Na={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},Oa={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Pa=Ma[typeof exports]&&exports&&!exports.nodeType&&exports,Qa=Ma[typeof module]&&module&&!module.nodeType&&module,Ra=Ma[typeof self]&&self&&self.Object&&self,Sa=Ma[typeof window]&&window&&window.Object&&window,Ta=Qa&&Qa.exports===Pa&&Pa,Ua=Pa&&Qa&&"object"==typeof global&&global&&global.Object&&global||Sa!==(this&&this.window)&&Sa||Ra||this,Va=t();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Ua._=Va,define(function(){return Va})):Pa&&Qa?Ta?(Qa.exports=Va)._=Va:Pa._=Va:Ua._=Va}.call(this),function(a,b){a(function(){function a(a,b){return null!=a&&null!=b&&a.toLowerCase()===b.toLowerCase()}function c(a,b){var c,d,e=a.length;if(!e||!b)return!1;for(c=b.toLowerCase(),d=0;d=0&&(c=c.substring(0,j)+"([\\w._\\+]+)"+c.substring(j+5)),b[e]=new RegExp(c,"i");k.props[a]=b}d(k.oss),d(k.phones),d(k.tablets),d(k.uas),d(k.utils),k.oss0={WindowsPhoneOS:k.oss.WindowsPhoneOS,WindowsMobileOS:k.oss.WindowsMobileOS}}(),f.findMatch=function(a,b){for(var c in a)if(h.call(a,c)&&a[c].test(b))return c;return null},f.findMatches=function(a,b){var c=[];for(var d in a)h.call(a,d)&&a[d].test(b)&&c.push(d);return c},f.getVersionStr=function(a,b){var c,d,e,g,i=f.mobileDetectRules.props;if(h.call(i,a))for(c=i[a],e=c.length,d=0;d1&&(a=b[0]+".",b.shift(),a+=b.join("")),Number(a)},f.isMobileFallback=function(a){return f.detectMobileBrowsers.fullPattern.test(a)||f.detectMobileBrowsers.shortPattern.test(a.substr(0,4))},f.isTabletFallback=function(a){return f.detectMobileBrowsers.tabletPattern.test(a)},f.prepareDetectionCache=function(a,c,d){if(a.mobile===b){var g,h,i;return(h=f.findMatch(f.mobileDetectRules.tablets,c))?(a.mobile=a.tablet=h,void(a.phone=null)):(g=f.findMatch(f.mobileDetectRules.phones,c))?(a.mobile=a.phone=g,void(a.tablet=null)):void(f.isMobileFallback(c)?(i=e.isPhoneSized(d),i===b?(a.mobile=f.FALLBACK_MOBILE,a.tablet=a.phone=null):i?(a.mobile=a.phone=f.FALLBACK_PHONE,a.tablet=null):(a.mobile=a.tablet=f.FALLBACK_TABLET,a.phone=null)):f.isTabletFallback(c)?(a.mobile=a.tablet=f.FALLBACK_TABLET,a.phone=null):a.mobile=a.tablet=a.phone=null)}},f.mobileGrade=function(a){var b=null!==a.mobile();return a.os("iOS")&&a.version("iPad")>=4.3||a.os("iOS")&&a.version("iPhone")>=3.1||a.os("iOS")&&a.version("iPod")>=3.1||a.version("Android")>2.1&&a.is("Webkit")||a.version("Windows Phone OS")>=7||a.is("BlackBerry")&&a.version("BlackBerry")>=6||a.match("Playbook.*Tablet")||a.version("webOS")>=1.4&&a.match("Palm|Pre|Pixi")||a.match("hp.*TouchPad")||a.is("Firefox")&&a.version("Firefox")>=12||a.is("Chrome")&&a.is("AndroidOS")&&a.version("Android")>=4||a.is("Skyfire")&&a.version("Skyfire")>=4.1&&a.is("AndroidOS")&&a.version("Android")>=2.3||a.is("Opera")&&a.version("Opera Mobi")>11&&a.is("AndroidOS")||a.is("MeeGoOS")||a.is("Tizen")||a.is("Dolfin")&&a.version("Bada")>=2||(a.is("UC Browser")||a.is("Dolfin"))&&a.version("Android")>=2.3||a.match("Kindle Fire")||a.is("Kindle")&&a.version("Kindle")>=3||a.is("AndroidOS")&&a.is("NookTablet")||a.version("Chrome")>=11&&!b||a.version("Safari")>=5&&!b||a.version("Firefox")>=4&&!b||a.version("MSIE")>=7&&!b||a.version("Opera")>=10&&!b?"A":a.os("iOS")&&a.version("iPad")<4.3||a.os("iOS")&&a.version("iPhone")<3.1||a.os("iOS")&&a.version("iPod")<3.1||a.is("Blackberry")&&a.version("BlackBerry")>=5&&a.version("BlackBerry")<6||a.version("Opera Mini")>=5&&a.version("Opera Mini")<=6.5&&(a.version("Android")>=2.3||a.is("iOS"))||a.match("NokiaN8|NokiaC7|N97.*Series60|Symbian/3")||a.version("Opera Mobi")>=11&&a.is("SymbianOS")?"B":(a.version("BlackBerry")<5||a.match("MSIEMobile|Windows CE.*Mobile")||a.version("Windows Mobile")<=5.2,"C")},f.detectOS=function(a){return f.findMatch(f.mobileDetectRules.oss0,a)||f.findMatch(f.mobileDetectRules.oss,a)},f.getDeviceSmallerSide=function(){return window.screen.widthd&&" "!==a[o+1],o=f);else if(!k(g))return ka;p=p&&l(g)}i=i||n&&f-o-1>d&&" "!==a[o+1]}return h||i?" "===a[0]&&c>9?ka:i?ja:ia:p&&!e(a)?ga:ha}function o(a,b,c,d){a.dump=function(){function e(b){return i(a,b)}if(0===b.length)return"''";if(!a.noCompatMode&&fa.indexOf(b)!==-1)return"'"+b+"'";var f=a.indent*Math.max(1,c),h=a.lineWidth===-1?-1:Math.max(Math.min(a.lineWidth,40),a.lineWidth-f),j=d||a.flowLevel>-1&&c>=a.flowLevel;switch(n(b,j,a.indent,h,e)){case ga:return b;case ha:return"'"+b.replace(/'/g,"''")+"'";case ia:return"|"+p(b,a.indent)+q(g(b,f));case ja:return">"+p(b,a.indent)+q(g(r(b,h),f));case ka:return'"'+t(b,h)+'"';default:throw new F("impossible error: invalid scalar style")}}()}function p(a,b){var c=" "===a[0]?String(b):"",d="\n"===a[a.length-1],e=d&&("\n"===a[a.length-2]||"\n"===a),f=e?"+":d?"":"-";return c+f+"\n"}function q(a){return"\n"===a[a.length-1]?a.slice(0,-1):a}function r(a,b){for(var c,d,e=/(\n+)([^\n]*)/g,f=function(){var c=a.indexOf("\n");return c=c!==-1?c:a.length,e.lastIndex=c,s(a.slice(0,c),b)}(),g="\n"===a[0]||" "===a[0];d=e.exec(a);){var h=d[1],i=d[2];c=" "===i[0],f+=h+(g||c||""===i?"":"\n")+s(i,b),g=c}return f}function s(a,b){if(""===a||" "===a[0])return a;for(var c,d,e=/ [^ ]/g,f=0,g=0,h=0,i="";c=e.exec(a);)h=c.index,h-f>b&&(d=g>f?g:h,i+="\n"+a.slice(f,d),f=d+1),g=h;return i+="\n",i+=a.length-f>b&&g>f?a.slice(f,g)+"\n"+a.slice(g+1):a.slice(f),i.slice(1)}function t(a){for(var b,c,d="",f=0;f1024&&(h+="? "),h+=a.dump+": ",z(a,b,g,!1,!1)&&(h+=a.dump,i+=h));a.tag=j,a.dump="{"+i+"}"}function x(a,b,c,d){var e,f,g,i,j,k,l="",m=a.tag,n=Object.keys(c);if(a.sortKeys===!0)n.sort();else if("function"==typeof a.sortKeys)n.sort(a.sortKeys);else if(a.sortKeys)throw new F("sortKeys must be a boolean or a function");for(e=0,f=n.length;e1024,j&&(k+=a.dump&&L===a.dump.charCodeAt(0)?"?":"? "),k+=a.dump,j&&(k+=h(a,b)),z(a,b+1,i,!0,j)&&(k+=a.dump&&L===a.dump.charCodeAt(0)?":":": ",k+=a.dump,l+=k));a.tag=m,a.dump=l||"{}"}function y(a,b,c){var d,e,f,g,h,i;for(e=c?a.explicitTypes:a.implicitTypes,f=0,g=e.length;f tag resolver accepts not "'+i+'" style');d=h.represent[i](b,i)}a.dump=d}return!0}return!1}function z(a,b,c,d,e,f){a.tag=null,a.dump=c,y(a,c,!1)||y(a,c,!0);var g=I.call(a.dump);d&&(d=a.flowLevel<0||a.flowLevel>b);var h,i,j="[object Object]"===g||"[object Array]"===g;if(j&&(h=a.duplicates.indexOf(c),i=h!==-1),(null!==a.tag&&"?"!==a.tag||i||2!==a.indent&&b>0)&&(e=!1),i&&a.usedDuplicates[h])a.dump="*ref_"+h;else{if(j&&i&&!a.usedDuplicates[h]&&(a.usedDuplicates[h]=!0),"[object Object]"===g)d&&0!==Object.keys(a.dump).length?(x(a,b,a.dump,e),i&&(a.dump="&ref_"+h+a.dump)):(w(a,b,a.dump),i&&(a.dump="&ref_"+h+" "+a.dump));else if("[object Array]"===g)d&&0!==a.dump.length?(v(a,b,a.dump,e),i&&(a.dump="&ref_"+h+a.dump)):(u(a,b,a.dump),i&&(a.dump="&ref_"+h+" "+a.dump));else{if("[object String]"!==g){if(a.skipInvalid)return!1;throw new F("unacceptable kind of an object to dump "+g)}"?"!==a.tag&&o(a,a.dump,b,f)}null!==a.tag&&"?"!==a.tag&&(a.dump="!<"+a.tag+"> "+a.dump)}return!0}function A(a,b){var c,d,e=[],f=[];for(B(a,e,f),c=0,d=f.length;c>10)+55296,(a-65536&1023)+56320)}function m(a,b){this.input=a,this.filename=b.filename||null,this.schema=b.schema||S,this.onWarning=b.onWarning||null,this.legacy=b.legacy||!1,this.json=b.json||!1,this.listener=b.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=a.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function n(a,b){return new P(b,new Q(a.filename,a.input,a.position,a.line,a.position-a.lineStart))}function o(a,b){throw n(a,b)}function p(a,b){a.onWarning&&a.onWarning.call(null,n(a,b))}function q(a,b,c,d){var e,f,g,h;if(b1&&(a.result+=O.repeat("\n",b-1))}function x(a,b,c){var h,i,j,k,l,m,n,o,p,r=a.kind,s=a.result;if(p=a.input.charCodeAt(a.position),f(p)||g(p)||35===p||38===p||42===p||33===p||124===p||62===p||39===p||34===p||37===p||64===p||96===p)return!1;if((63===p||45===p)&&(i=a.input.charCodeAt(a.position+1),f(i)||c&&g(i)))return!1;for(a.kind="scalar",a.result="",j=k=a.position,l=!1;0!==p;){if(58===p){if(i=a.input.charCodeAt(a.position+1),f(i)||c&&g(i))break}else if(35===p){if(h=a.input.charCodeAt(a.position-1),f(h))break}else{if(a.position===a.lineStart&&v(a)||c&&g(p))break;if(d(p)){if(m=a.line,n=a.lineStart,o=a.lineIndent,u(a,!1,-1),a.lineIndent>=b){l=!0,p=a.input.charCodeAt(a.position);continue}a.position=k,a.line=m,a.lineStart=n,a.lineIndent=o;break}}l&&(q(a,j,k,!1),w(a,a.line-m),j=k=a.position,l=!1),e(p)||(k=a.position+1),p=a.input.charCodeAt(++a.position)}return q(a,j,k,!1),!!a.result||(a.kind=r,a.result=s,!1)}function y(a,b){var c,e,f;if(c=a.input.charCodeAt(a.position),39!==c)return!1;for(a.kind="scalar",a.result="",a.position++,e=f=a.position;0!==(c=a.input.charCodeAt(a.position));)if(39===c){if(q(a,e,a.position,!0),c=a.input.charCodeAt(++a.position),39!==c)return!0;e=f=a.position,a.position++}else d(c)?(q(a,e,f,!0),w(a,u(a,!1,b)),e=f=a.position):a.position===a.lineStart&&v(a)?o(a,"unexpected end of the document within a single quoted scalar"):(a.position++,f=a.position);o(a,"unexpected end of the stream within a single quoted scalar")}function z(a,b){var c,e,f,g,j,k;if(k=a.input.charCodeAt(a.position),34!==k)return!1;for(a.kind="scalar",a.result="",a.position++,c=e=a.position;0!==(k=a.input.charCodeAt(a.position));){if(34===k)return q(a,c,a.position,!0),a.position++,!0;if(92===k){if(q(a,c,a.position,!0),k=a.input.charCodeAt(++a.position),d(k))u(a,!1,b);else if(k<256&&ea[k])a.result+=fa[k],a.position++;else if((j=i(k))>0){for(f=j,g=0;f>0;f--)k=a.input.charCodeAt(++a.position),(j=h(k))>=0?g=(g<<4)+j:o(a,"expected hexadecimal character");a.result+=l(g),a.position++}else o(a,"unknown escape sequence");c=e=a.position}else d(k)?(q(a,c,e,!0),w(a,u(a,!1,b)),c=e=a.position):a.position===a.lineStart&&v(a)?o(a,"unexpected end of the document within a double quoted scalar"):(a.position++,e=a.position)}o(a,"unexpected end of the stream within a double quoted scalar")}function A(a,b){var c,d,e,g,h,i,j,k,l,m,n,p=!0,q=a.tag,r=a.anchor,t={};if(n=a.input.charCodeAt(a.position),91===n)g=93,j=!1,d=[];else{if(123!==n)return!1;g=125,j=!0,d={}}for(null!==a.anchor&&(a.anchorMap[a.anchor]=d),n=a.input.charCodeAt(++a.position);0!==n;){if(u(a,!0,b),n=a.input.charCodeAt(a.position),n===g)return a.position++,a.tag=q,a.anchor=r,a.kind=j?"mapping":"sequence",a.result=d,!0;p||o(a,"missed comma between flow collection entries"),l=k=m=null,h=i=!1,63===n&&(e=a.input.charCodeAt(a.position+1),f(e)&&(h=i=!0,a.position++,u(a,!0,b))),c=a.line,H(a,b,U,!1,!0),l=a.tag,k=a.result,u(a,!0,b),n=a.input.charCodeAt(a.position),!i&&a.line!==c||58!==n||(h=!0,n=a.input.charCodeAt(++a.position),u(a,!0,b),H(a,b,U,!1,!0),m=a.result),j?s(a,d,t,l,k,m):h?d.push(s(a,null,t,l,k,m)):d.push(k),u(a,!0,b),n=a.input.charCodeAt(a.position),44===n?(p=!0,n=a.input.charCodeAt(++a.position)):p=!1}o(a,"unexpected end of the stream within a flow collection")}function B(a,b){var c,f,g,h,i=Y,k=!1,l=!1,m=b,n=0,p=!1;if(h=a.input.charCodeAt(a.position),124===h)f=!1;else{if(62!==h)return!1;f=!0}for(a.kind="scalar",a.result="";0!==h;)if(h=a.input.charCodeAt(++a.position),43===h||45===h)Y===i?i=43===h?$:Z:o(a,"repeat of a chomping mode identifier");else{if(!((g=j(h))>=0))break;0===g?o(a,"bad explicit indentation width of a block scalar; it cannot be less than one"):l?o(a,"repeat of an indentation width identifier"):(m=b+g-1,l=!0)}if(e(h)){do h=a.input.charCodeAt(++a.position);while(e(h));if(35===h)do h=a.input.charCodeAt(++a.position);while(!d(h)&&0!==h)}for(;0!==h;){for(t(a),a.lineIndent=0,h=a.input.charCodeAt(a.position);(!l||a.lineIndentm&&(m=a.lineIndent),d(h))n++;else{if(a.lineIndentb)&&0!==e)o(a,"bad indentation of a sequence entry");else if(a.lineIndentb)&&(H(a,b,X,!0,g)&&(r?p=a.result:q=a.result),r||(s(a,l,m,n,p,q),n=p=q=null),u(a,!0,-1),i=a.input.charCodeAt(a.position)),a.lineIndent>b&&0!==i)o(a,"bad indentation of a mapping entry");else if(a.lineIndentb?n=1:a.lineIndent===b?n=0:a.lineIndentb?n=1:a.lineIndent===b?n=0:a.lineIndent tag; it should be "'+k.kind+'", not "'+a.kind+'"'),k.resolve(a.result)?(a.result=k.construct(a.result),null!==a.anchor&&(a.anchorMap[a.anchor]=a.result)):o(a,"cannot resolve a node with !<"+a.tag+"> explicit tag")):o(a,"unknown tag !<"+a.tag+">");return null!==a.listener&&a.listener("close",a),null!==a.tag||null!==a.anchor||q}function I(a){var b,c,g,h,i=a.position,j=!1;for(a.version=null,a.checkLineBreaks=a.legacy,a.tagMap={}, -a.anchorMap={};0!==(h=a.input.charCodeAt(a.position))&&(u(a,!0,-1),h=a.input.charCodeAt(a.position),!(a.lineIndent>0||37!==h));){for(j=!0,h=a.input.charCodeAt(++a.position),b=a.position;0!==h&&!f(h);)h=a.input.charCodeAt(++a.position);for(c=a.input.slice(b,a.position),g=[],c.length<1&&o(a,"directive name must not be less than one character in length");0!==h;){for(;e(h);)h=a.input.charCodeAt(++a.position);if(35===h){do h=a.input.charCodeAt(++a.position);while(0!==h&&!d(h));break}if(d(h))break;for(b=a.position;0!==h&&!f(h);)h=a.input.charCodeAt(++a.position);g.push(a.input.slice(b,a.position))}0!==h&&t(a),T.call(ha,c)?ha[c](a,c,g):p(a,'unknown document directive "'+c+'"')}return u(a,!0,-1),0===a.lineIndent&&45===a.input.charCodeAt(a.position)&&45===a.input.charCodeAt(a.position+1)&&45===a.input.charCodeAt(a.position+2)?(a.position+=3,u(a,!0,-1)):j&&o(a,"directives end mark is expected"),H(a,a.lineIndent-1,X,!1,!0),u(a,!0,-1),a.checkLineBreaks&&aa.test(a.input.slice(i,a.position))&&p(a,"non-ASCII line breaks are interpreted as content"),a.documents.push(a.result),a.position===a.lineStart&&v(a)?void(46===a.input.charCodeAt(a.position)&&(a.position+=3,u(a,!0,-1))):void(a.position0&&"\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(d-1))===-1;)if(d-=1,this.position-d>b/2-1){c=" ... ",d+=5;break}for(f="",g=this.position;gb/2-1){f=" ... ",g-=5;break}return h=this.buffer.slice(d,g),e.repeat(" ",a)+c+h+f+"\n"+e.repeat(" ",a+this.position-d+c.length)+"^"},d.prototype.toString=function(a){var b,c="";return this.name&&(c+='in "'+this.name+'" '),c+="at line "+(this.line+1)+", column "+(this.column+1),a||(b=this.getSnippet(),b&&(c+=":\n"+b)),c},b.exports=d},{"./common":2}],7:[function(a,b,c){function d(a,b,c){var e=[];return a.include.forEach(function(a){c=d(a,b,c)}),a[b].forEach(function(a){c.forEach(function(b,c){b.tag===a.tag&&e.push(c)}),c.push(a)}),c.filter(function(a,b){return e.indexOf(b)===-1})}function e(){function a(a){d[a.tag]=a}var b,c,d={};for(b=0,c=arguments.length;b64)){if(b<0)return!1;d+=6}return d%8===0}function e(a){var b,c,d=a.replace(/[\r\n=]/g,""),e=d.length,f=l,g=0,i=[];for(b=0;b>16&255),i.push(g>>8&255),i.push(255&g)),g=g<<6|f.indexOf(d.charAt(b));return c=e%4*6,0===c?(i.push(g>>16&255),i.push(g>>8&255),i.push(255&g)):18===c?(i.push(g>>10&255),i.push(g>>2&255)):12===c&&i.push(g>>4&255),h?new h(i):i}function f(a){var b,c,d="",e=0,f=a.length,g=l;for(b=0;b>18&63],d+=g[e>>12&63],d+=g[e>>6&63],d+=g[63&e]),e=(e<<8)+a[b];return c=f%3,0===c?(d+=g[e>>18&63],d+=g[e>>12&63],d+=g[e>>6&63],d+=g[63&e]):2===c?(d+=g[e>>10&63],d+=g[e>>4&63],d+=g[e<<2&63],d+=g[64]):1===c&&(d+=g[e>>2&63],d+=g[e<<4&63],d+=g[64],d+=g[64]),d}function g(a){return h&&h.isBuffer(a)}var h;try{var i=a;h=i("buffer").Buffer}catch(j){}var k=a("../type"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";b.exports=new k("tag:yaml.org,2002:binary",{kind:"scalar",resolve:d,construct:e,predicate:g,represent:f})},{"../type":13}],15:[function(a,b,c){function d(a){if(null===a)return!1;var b=a.length;return 4===b&&("true"===a||"True"===a||"TRUE"===a)||5===b&&("false"===a||"False"===a||"FALSE"===a)}function e(a){return"true"===a||"True"===a||"TRUE"===a}function f(a){return"[object Boolean]"===Object.prototype.toString.call(a)}var g=a("../type");b.exports=new g("tag:yaml.org,2002:bool",{kind:"scalar",resolve:d,construct:e,predicate:f,represent:{lowercase:function(a){return a?"true":"false"},uppercase:function(a){return a?"TRUE":"FALSE"},camelcase:function(a){return a?"True":"False"}},defaultStyle:"lowercase"})},{"../type":13}],16:[function(a,b,c){function d(a){return null!==a&&!!j.test(a)}function e(a){var b,c,d,e;return b=a.replace(/_/g,"").toLowerCase(),c="-"===b[0]?-1:1,e=[],"+-".indexOf(b[0])>=0&&(b=b.slice(1)),".inf"===b?1===c?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===b?NaN:b.indexOf(":")>=0?(b.split(":").forEach(function(a){e.unshift(parseFloat(a,10))}),b=0,d=1,e.forEach(function(a){b+=a*d,d*=60}),c*b):c*parseFloat(b,10)}function f(a,b){var c;if(isNaN(a))switch(b){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===a)switch(b){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===a)switch(b){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(h.isNegativeZero(a))return"-0.0";return c=a.toString(10),k.test(c)?c.replace("e",".e"):c}function g(a){return"[object Number]"===Object.prototype.toString.call(a)&&(a%1!==0||h.isNegativeZero(a))}var h=a("../common"),i=a("../type"),j=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?|\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),k=/^[-+]?[0-9]+e/;b.exports=new i("tag:yaml.org,2002:float",{kind:"scalar",resolve:d,construct:e,predicate:g,represent:f,defaultStyle:"lowercase"})},{"../common":2,"../type":13}],17:[function(a,b,c){function d(a){return 48<=a&&a<=57||65<=a&&a<=70||97<=a&&a<=102}function e(a){return 48<=a&&a<=55}function f(a){return 48<=a&&a<=57}function g(a){if(null===a)return!1;var b,c=a.length,g=0,h=!1;if(!c)return!1;if(b=a[g],"-"!==b&&"+"!==b||(b=a[++g]),"0"===b){if(g+1===c)return!0;if(b=a[++g],"b"===b){for(g++;g3)return!1;if("/"!==b[b.length-d.length-1])return!1}return!0}function e(a){var b=a,c=/\/([gim]*)$/.exec(a),d="";return"/"===b[0]&&(c&&(d=c[1]),b=b.slice(1,b.length-d.length-1)),new RegExp(b,d)}function f(a){var b="/"+a.source+"/";return a.global&&(b+="g"),a.multiline&&(b+="m"),a.ignoreCase&&(b+="i"),b}function g(a){return"[object RegExp]"===Object.prototype.toString.call(a)}var h=a("../../type");b.exports=new h("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:d,construct:e,predicate:g,represent:f})},{"../../type":13}],20:[function(a,b,c){function d(){return!0}function e(){}function f(){return""}function g(a){return"undefined"==typeof a}var h=a("../../type");b.exports=new h("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:d,construct:e,predicate:g,represent:f})},{"../../type":13}],21:[function(a,b,c){var d=a("../type");b.exports=new d("tag:yaml.org,2002:map",{kind:"mapping",construct:function(a){return null!==a?a:{}}})},{"../type":13}],22:[function(a,b,c){function d(a){return"<<"===a||null===a}var e=a("../type");b.exports=new e("tag:yaml.org,2002:merge",{kind:"scalar",resolve:d})},{"../type":13}],23:[function(a,b,c){function d(a){if(null===a)return!0;var b=a.length;return 1===b&&"~"===a||4===b&&("null"===a||"Null"===a||"NULL"===a)}function e(){return null}function f(a){return null===a}var g=a("../type");b.exports=new g("tag:yaml.org,2002:null",{kind:"scalar",resolve:d,construct:e,predicate:f,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},{"../type":13}],24:[function(a,b,c){function d(a){if(null===a)return!0;var b,c,d,e,f,i=[],j=a;for(b=0,c=j.length;b=f;e--)c.end&&c.end(s[e]);s.length=f}}"string"!=typeof a&&(a=null===a||"undefined"==typeof a?"":""+a);var f,h,i,s=[],t=a;for(s.last=function(){return s[s.length-1]};a;){if(i="",h=!0,s.last()&&y[s.last()]?(a=a.replace(new RegExp("([\\W\\w]*)<\\s*\\/\\s*"+s.last()+"[^>]*>","i"),function(a,b){return b=b.replace(p,"$1").replace(r,"$1"),c.chars&&c.chars(g(b)),""}),e("",s.last())):(0===a.indexOf("",f)===f&&(c.comment&&c.comment(a.substring(4,f)),a=a.substring(f+3),h=!1)):q.test(a)?(f=a.match(q))&&(a=a.replace(f[0],""),h=!1):o.test(a)?(f=a.match(l))&&(a=a.substring(f[0].length),f[0].replace(l,e),h=!1):n.test(a)&&((f=a.match(k))?(f[4]&&(a=a.substring(f[0].length),f[0].replace(k,d)),h=!1):(i+="<",a=a.substring(1))),h&&(f=a.indexOf("<"),i+=0>f?a:a.substring(0,f),a=0>f?"":a.substring(f),c.chars&&c.chars(g(i)))),a==t)throw j("badparse",a);t=a}e()}function g(a){return a?(C.innerHTML=a.replace(//g,">")}function i(a,c){var d=!1,e=b.bind(a,a.push);return{start:function(a,f,g){a=b.lowercase(a),!d&&y[a]&&(d=a),d||!0!==z[a]||(e("<"),e(a),b.forEach(f,function(d,f){var g=b.lowercase(f),i="img"===a&&"src"===g||"background"===g;!0!==B[g]||!0===A[g]&&!c(d,i)||(e(" "),e(f),e('="'),e(h(d)),e('"'))}),e(g?"/>":">"))},end:function(a){a=b.lowercase(a),d||!0!==z[a]||(e("")),a==d&&(d=!1)},chars:function(a){d||e(h(a))}}}var j=b.$$minErr("$sanitize"),k=/^<((?:[a-zA-Z])[\w:-]*)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*(>?)/,l=/^<\/\s*([\w:-]+)[^>]*>/,m=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,n=/^]*?)>/i,r=/"\u201d\u2019]/i,e=/^mailto:/i;return function(f,g){function h(a){a&&n.push(d(a))}function i(a,c){n.push("'),h(c),n.push("")}if(!f)return f;for(var j,k,l,m=f,n=[];j=m.match(c);)k=j[0],j[2]||j[4]||(k=(j[3]?"http://":"mailto:")+k),l=j.index,h(m.substr(0,l)),i(k,j[0].replace(e,"")),m=m.substring(l+j[0].length);return h(m),a(n.join(""))}}])}(window,window.angular); \ No newline at end of file +}]),angular.module("template/carousel/slide.html",[]).run(["$templateCache",function(a){a.put("template/carousel/slide.html",'
\n')}]),angular.module("template/datepicker/datepicker.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/datepicker.html",'
\n \n \n \n
')}]),angular.module("template/datepicker/day.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/day.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
{{::label.abbr}}
{{ weekNumbers[$index] }}\n \n
\n')}]),angular.module("template/datepicker/month.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/month.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n')}]),angular.module("template/datepicker/popup.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/popup.html",'\n')}]),angular.module("template/datepicker/year.html",[]).run(["$templateCache",function(a){a.put("template/datepicker/year.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n')}]),angular.module("template/modal/backdrop.html",[]).run(["$templateCache",function(a){a.put("template/modal/backdrop.html",'
\n')}]),angular.module("template/modal/window.html",[]).run(["$templateCache",function(a){a.put("template/modal/window.html",'\n')}]),angular.module("template/pagination/pager.html",[]).run(["$templateCache",function(a){a.put("template/pagination/pager.html",'\n')}]),angular.module("template/pagination/pagination.html",[]).run(["$templateCache",function(a){a.put("template/pagination/pagination.html",'\n')}]),angular.module("template/tooltip/tooltip-html-popup.html",[]).run(["$templateCache",function(a){a.put("template/tooltip/tooltip-html-popup.html",'\n
\n
\n\n')}]),angular.module("template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function(a){a.put("template/tooltip/tooltip-popup.html",'\n
\n
\n\n')}]),angular.module("template/tooltip/tooltip-template-popup.html",[]).run(["$templateCache",function(a){a.put("template/tooltip/tooltip-template-popup.html",'\n
\n
\n\n')}]),angular.module("template/popover/popover-html.html",[]).run(["$templateCache",function(a){a.put("template/popover/popover-html.html",'
\n
\n\n
\n

\n
\n
\n
\n')}]),angular.module("template/popover/popover-template.html",[]).run(["$templateCache",function(a){a.put("template/popover/popover-template.html",'
\n
\n\n
\n

\n
\n
\n
\n')}]),angular.module("template/popover/popover.html",[]).run(["$templateCache",function(a){a.put("template/popover/popover.html",'
\n
\n\n
\n

\n
\n
\n
\n')}]),angular.module("template/progressbar/bar.html",[]).run(["$templateCache",function(a){a.put("template/progressbar/bar.html",'
\n')}]),angular.module("template/progressbar/progress.html",[]).run(["$templateCache",function(a){a.put("template/progressbar/progress.html",'
')}]),angular.module("template/progressbar/progressbar.html",[]).run(["$templateCache",function(a){a.put("template/progressbar/progressbar.html",'
\n
\n
\n')}]),angular.module("template/rating/rating.html",[]).run(["$templateCache",function(a){a.put("template/rating/rating.html",'\n ({{ $index < value ? \'*\' : \' \' }})\n \n\n')}]),angular.module("template/tabs/tab.html",[]).run(["$templateCache",function(a){a.put("template/tabs/tab.html",'
  • \n {{heading}}\n
  • \n')}]),angular.module("template/tabs/tabset.html",[]).run(["$templateCache",function(a){a.put("template/tabs/tabset.html",'
    \n \n
    \n
    \n
    \n
    \n
    \n')}]),angular.module("template/timepicker/timepicker.html",[]).run(["$templateCache",function(a){a.put("template/timepicker/timepicker.html",'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
     
    \n \n :\n \n
     
    \n')}]),angular.module("template/typeahead/typeahead-match.html",[]).run(["$templateCache",function(a){a.put("template/typeahead/typeahead-match.html",'\n')}]),angular.module("template/typeahead/typeahead-popup.html",[]).run(["$templateCache",function(a){a.put("template/typeahead/typeahead-popup.html",'\n')}]),!angular.$$csp()&&angular.element(document).find("head").prepend(''),!function(a,b){"function"==typeof define&&define.amd?define([],function(){return b()}):"object"==typeof exports?module.exports=b():b()}(this,function(){function a(a){var b=a.storageKey(),c=a.storage(),d=function(){var d=a.preferredLanguage();angular.isString(d)?a.use(d):c.put(b,a.use())};d.displayName="fallbackFromIncorrectStorageValue",c?c.get(b)?a.use(c.get(b))["catch"](d):d():angular.isString(a.preferredLanguage())&&a.use(a.preferredLanguage())}function b(){var a,b,c=null,d=!1,e=!1;b={sanitize:function(a,b){return"text"===b&&(a=g(a)),a},escape:function(a,b){return"text"===b&&(a=f(a)),a},sanitizeParameters:function(a,b){return"params"===b&&(a=h(a,g)),a},escapeParameters:function(a,b){return"params"===b&&(a=h(a,f)),a}},b.escaped=b.escapeParameters,this.addStrategy=function(a,c){return b[a]=c,this},this.removeStrategy=function(a){return delete b[a],this},this.useStrategy=function(a){return d=!0,c=a,this},this.$get=["$injector","$log",function(f,g){var h={},i=function(a,c,d){return angular.forEach(d,function(d){if(angular.isFunction(d))a=d(a,c);else if(angular.isFunction(b[d]))a=b[d](a,c);else{if(!angular.isString(b[d]))throw new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '"+d+"'");if(!h[b[d]])try{h[b[d]]=f.get(b[d])}catch(e){throw h[b[d]]=function(){},new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '"+d+"'")}a=h[b[d]](a,c)}}),a},j=function(){d||e||(g.warn("pascalprecht.translate.$translateSanitization: No sanitization strategy has been configured. This can have serious security implications. See http://angular-translate.github.io/docs/#/guide/19_security for details."),e=!0)};return f.has("$sanitize")&&(a=f.get("$sanitize")),{useStrategy:function(a){return function(b){a.useStrategy(b)}}(this),sanitize:function(a,b,d){if(c||j(),arguments.length<3&&(d=c),!d)return a;var e=angular.isArray(d)?d:[d];return i(a,b,e)}}}];var f=function(a){var b=angular.element("
    ");return b.text(a),b.html()},g=function(b){if(!a)throw new Error("pascalprecht.translate.$translateSanitization: Error cannot find $sanitize service. Either include the ngSanitize module (https://docs.angularjs.org/api/ngSanitize) or use a sanitization strategy which does not depend on $sanitize, such as 'escape'.");return a(b)},h=function(a,b,c){if(angular.isObject(a)){var d=angular.isArray(a)?[]:{};if(c){if(c.indexOf(a)>-1)throw new Error("pascalprecht.translate.$translateSanitization: Error cannot interpolate parameter due recursive object")}else c=[];return c.push(a),angular.forEach(a,function(a,e){angular.isFunction(a)||(d[e]=h(a,b,c))}),c.splice(-1,1),d}return angular.isNumber(a)?a:b(a)}}function c(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u={},v=[],w=a,x=[],y="translate-cloak",z=!1,A=!1,B=".",C=!1,D=!1,E=0,F=!0,G="default",H={"default":function(a){return(a||"").split("-").join("_")},java:function(a){var b=(a||"").split("-").join("_"),c=b.split("_");return c.length>1?c[0].toLowerCase()+"_"+c[1].toUpperCase():b},bcp47:function(a){var b=(a||"").split("_").join("-"),c=b.split("-");return c.length>1?c[0].toLowerCase()+"-"+c[1].toUpperCase():b},"iso639-1":function(a){var b=(a||"").split("_").join("-"),c=b.split("-");return c[0].toLowerCase()}},I="2.11.1",J=function(){if(angular.isFunction(d.getLocale))return d.getLocale();var a,c,e=b.$get().navigator,f=["language","browserLanguage","systemLanguage","userLanguage"];if(angular.isArray(e.languages))for(a=0;a-1)return a;if(f){var g;for(var h in f)if(f.hasOwnProperty(h)){var i=!1,j=Object.prototype.hasOwnProperty.call(f,h)&&angular.lowercase(h)===angular.lowercase(a);if("*"===h.slice(-1)&&(i=h.slice(0,-1)===a.slice(0,h.length-1)),(j||i)&&(g=f[h],L(b,angular.lowercase(g))>-1))return g}}var k=a.split("_");return k.length>1&&L(b,angular.lowercase(k[0]))>-1?k[0]:void 0}},O=function(a,b){if(!a&&!b)return u;if(a&&!b){if(angular.isString(a))return u[a]}else angular.isObject(u[a])||(u[a]={}),angular.extend(u[a],P(b));return this};this.translations=O,this.cloakClassName=function(a){return a?(y=a,this):y},this.nestedObjectDelimeter=function(a){return a?(B=a,this):B};var P=function(a,b,c,d){var e,f,g,h;b||(b=[]),c||(c={});for(e in a)Object.prototype.hasOwnProperty.call(a,e)&&(h=a[e],angular.isObject(h)?P(h,b.concat(e),c,e):(f=b.length?""+b.join(B)+B+e:e,b.length&&e===d&&(g=""+b.join(B),c[g]="@:"+f),c[f]=h));return c};P.displayName="flatObject",this.addInterpolation=function(a){return x.push(a),this},this.useMessageFormatInterpolation=function(){return this.useInterpolation("$translateMessageFormatInterpolation")},this.useInterpolation=function(a){return n=a,this},this.useSanitizeValueStrategy=function(a){return c.useStrategy(a),this},this.preferredLanguage=function(a){return a?(Q(a),this):e};var Q=function(a){return a&&(e=a),e};this.translationNotFoundIndicator=function(a){return this.translationNotFoundIndicatorLeft(a),this.translationNotFoundIndicatorRight(a),this},this.translationNotFoundIndicatorLeft=function(a){return a?(q=a,this):q},this.translationNotFoundIndicatorRight=function(a){return a?(r=a,this):r},this.fallbackLanguage=function(a){return R(a),this};var R=function(a){return a?(angular.isString(a)?(h=!0,g=[a]):angular.isArray(a)&&(h=!1,g=a),angular.isString(e)&&L(g,e)<0&&g.push(e),this):h?g[0]:g};this.use=function(a){if(a){if(!u[a]&&!o)throw new Error("$translateProvider couldn't find translationTable for langKey: '"+a+"'");return i=a,this}return i},this.resolveClientLocale=function(){return K()};var S=function(a){return a?(w=a,this):l?l+w:w};this.storageKey=S,this.useUrlLoader=function(a,b){return this.useLoader("$translateUrlLoader",angular.extend({url:a},b))},this.useStaticFilesLoader=function(a){return this.useLoader("$translateStaticFilesLoader",a)},this.useLoader=function(a,b){return o=a,p=b||{},this},this.useLocalStorage=function(){return this.useStorage("$translateLocalStorage")},this.useCookieStorage=function(){return this.useStorage("$translateCookieStorage")},this.useStorage=function(a){return k=a,this},this.storagePrefix=function(a){return a?(l=a,this):a},this.useMissingTranslationHandlerLog=function(){return this.useMissingTranslationHandler("$translateMissingTranslationHandlerLog")},this.useMissingTranslationHandler=function(a){return m=a,this},this.usePostCompiling=function(a){return z=!!a,this},this.forceAsyncReload=function(a){return A=!!a,this},this.uniformLanguageTag=function(a){return a?angular.isString(a)&&(a={standard:a}):a={},G=a.standard,this},this.determinePreferredLanguage=function(a){var b=a&&angular.isFunction(a)?a():K();return e=v.length?N(b)||b:b,this},this.registerAvailableLanguageKeys=function(a,b){return a?(v=a,b&&(f=b),this):v},this.useLoaderCache=function(a){return a===!1?s=void 0:a===!0?s=!0:"undefined"==typeof a?s="$translationCache":a&&(s=a),this},this.directivePriority=function(a){return void 0===a?E:(E=a,this)},this.statefulFilter=function(a){return void 0===a?F:(F=a,this)},this.postProcess=function(a){return t=a?a:void 0,this},this.keepContent=function(a){return D=!!a,this},this.$get=["$log","$injector","$rootScope","$q",function(a,b,c,d){var f,l,G,H=b.get(n||"$translateDefaultInterpolation"),J=!1,T={},U={},V=function(a,b,c,h,j){!i&&e&&(i=e);var m=j&&j!==i?N(j)||j:i;if(j&&ka(j),angular.isArray(a)){var n=function(a){for(var e={},f=[],g=function(a){var f=d.defer(),g=function(b){e[a]=b,f.resolve([a,b])};return V(a,b,c,h,j).then(g,g),f.promise},i=0,k=a.length;i0?G:l,a,b,c,d)},fa=function(a,b,c){return da(G>0?G:l,a,b,c)},ga=function(a,b,c,e,f){var h=d.defer(),i=f?u[f]:u,j=c?T[c]:H;if(i&&Object.prototype.hasOwnProperty.call(i,a)){var k=i[a];if("@:"===k.substr(0,2))V(k.substr(2),b,c,e,f).then(h.resolve,h.reject);else{var l=j.interpolate(k,b);l=ja(a,k,l,b,f),h.resolve(l)}}else{var n;m&&!J&&(n=ba(a,b,e)),f&&g&&g.length?ea(a,b,j,e).then(function(a){h.resolve(a)},function(a){h.reject(W(a))}):m&&!J&&n?e?h.resolve(e):h.resolve(n):e?h.resolve(e):h.reject(W(a))}return h.promise},ha=function(a,b,c,d){var e,f=d?u[d]:u,h=H;if(T&&Object.prototype.hasOwnProperty.call(T,c)&&(h=T[c]),f&&Object.prototype.hasOwnProperty.call(f,a)){var i=f[a];"@:"===i.substr(0,2)?e=ha(i.substr(2),b,c,d):(e=h.interpolate(i,b),e=ja(a,i,e,b,d))}else{var j;m&&!J&&(j=ba(a,b)),d&&g&&g.length?(l=0,e=fa(a,b,h)):e=m&&!J&&j?j:W(a)}return e},ia=function(a){j===a&&(j=void 0),U[a]=void 0},ja=function(a,c,d,e,f){var g=t;return g&&("string"==typeof g&&(g=b.get(g)),g)?g(a,c,d,e,f):d},ka=function(a){u[a]||!o||U[a]||(U[a]=Y(a).then(function(a){return O(a.key,a.table),a}))};V.preferredLanguage=function(a){return a&&Q(a),e},V.cloakClassName=function(){return y},V.nestedObjectDelimeter=function(){return B},V.fallbackLanguage=function(a){if(void 0!==a&&null!==a){if(R(a),o&&g&&g.length)for(var b=0,c=g.length;b-1&&(G=b)}else G=0},V.proposedLanguage=function(){return j},V.storage=function(){return f},V.negotiateLocale=N,V.use=function(a){if(!a)return i;var b=d.defer();c.$emit("$translateChangeStart",{language:a});var e=N(a);return v.length>0&&!e?d.reject(a):(e&&(a=e),j=a,!A&&u[a]||!o||U[a]?U[a]?U[a].then(function(a){return j===a.key&&X(a.key),b.resolve(a.key),a},function(a){return!i&&g&&g.length>0?V.use(g[0]).then(b.resolve,b.reject):b.reject(a)}):(b.resolve(a),X(a)):(U[a]=Y(a).then(function(c){return O(c.key,c.table),b.resolve(c.key),j===a&&X(c.key),c},function(a){return c.$emit("$translateChangeError",{language:a}),b.reject(a),c.$emit("$translateChangeEnd",{language:a}),d.reject(a)}),U[a]["finally"](function(){ia(a)})),b.promise)},V.resolveClientLocale=function(){return K()},V.storageKey=function(){return S()},V.isPostCompilingEnabled=function(){return z},V.isForceAsyncReloadEnabled=function(){return A},V.isKeepContent=function(){return D},V.refresh=function(a){function b(){f.resolve(),c.$emit("$translateRefreshEnd",{language:a})}function e(){f.reject(),c.$emit("$translateRefreshEnd",{language:a})}if(!o)throw new Error("Couldn't refresh translation table, no loader registered!");var f=d.defer();if(c.$emit("$translateRefreshStart",{language:a}),a)if(u[a]){var h=function(c){return O(c.key,c.table),a===i&&X(i),b(),c};h.displayName="refreshPostProcessor",Y(a).then(h,e)}else e();else{var j=[],k={};if(g&&g.length)for(var l=0,m=g.length;l0?v:null};var ma=c.$on("$translateReady",function(){la.resolve(),ma(),ma=null}),na=c.$on("$translateChangeEnd",function(){la.resolve(),na(),na=null});if(o){if(angular.equals(u,{})&&V.use()&&V.use(V.use()),g&&g.length)for(var oa=function(a){return O(a.key,a.table),c.$emit("$translateChangeEnd",{language:a.key}),a},pa=0,qa=g.length;pa-1&&(this.__origError=f,a.apply(this,[b,"_fix_for_ie_crossdomain__",e]))}}}),a("getResponseHeader",function(a){return function(b){return this.__fileApiXHR&&this.__fileApiXHR.getResponseHeader?this.__fileApiXHR.getResponseHeader(b):null==a?null:a.apply(this,[b])}}),a("getAllResponseHeaders",function(a){return function(){return this.__fileApiXHR&&this.__fileApiXHR.getAllResponseHeaders?this.__fileApiXHR.getAllResponseHeaders():null==a?null:a.apply(this)}}),a("abort",function(a){return function(){return this.__fileApiXHR&&this.__fileApiXHR.abort?this.__fileApiXHR.abort():null==a?null:a.apply(this)}}),a("setRequestHeader",function(a){return function(b,d){if("__setXHR_"===b){c(this);var e=d(this);e instanceof Function&&e(this)}else this.__requestHeaders=this.__requestHeaders||{},this.__requestHeaders[b]=d,a.apply(this,arguments)}}),a("send",function(a){return function(){var c=this;if(arguments[0]&&arguments[0].__isFileAPIShim){var d=arguments[0],e={url:c.__url,jsonp:!1,cache:!0,complete:function(a,d){a&&angular.isString(a)&&-1!==a.indexOf("#2174")&&(a=null),c.__completed=!0,!a&&c.__listeners.load&&c.__listeners.load({type:"load",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),!a&&c.__listeners.loadend&&c.__listeners.loadend({type:"loadend",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),"abort"===a&&c.__listeners.abort&&c.__listeners.abort({type:"abort",loaded:c.__loaded,total:c.__total,target:c,lengthComputable:!0}),void 0!==d.status&&b(c,"status",function(){return 0===d.status&&a&&"abort"!==a?500:d.status}),void 0!==d.statusText&&b(c,"statusText",function(){return d.statusText}),b(c,"readyState",function(){return 4}),void 0!==d.response&&b(c,"response",function(){return d.response});var e=d.responseText||(a&&0===d.status&&"abort"!==a?a:void 0);b(c,"responseText",function(){return e}),b(c,"response",function(){return e}),a&&b(c,"err",function(){return a}),c.__fileApiXHR=d,c.onreadystatechange&&c.onreadystatechange(),c.onload&&c.onload()},progress:function(a){if(a.target=c,c.__listeners.progress&&c.__listeners.progress(a),c.__total=a.total,c.__loaded=a.loaded,a.total===a.loaded){var b=this;setTimeout(function(){c.__completed||(c.getAllResponseHeaders=function(){},b.complete(null,{status:204,statusText:"No Content"}))},FileAPI.noContentTimeout||1e4)}},headers:c.__requestHeaders};e.data={},e.files={};for(var f=0;f-1){e=h.substring(0,g+1);break}null==FileAPI.staticPath&&(FileAPI.staticPath=e),i.setAttribute("src",d||e+"FileAPI.min.js"),document.getElementsByTagName("head")[0].appendChild(i)}FileAPI.ngfFixIE=function(d,e,f){if(!b())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';var g=function(){var b=e.parent();d.attr("disabled")?b&&b.removeClass("js-fileapi-wrapper"):(e.attr("__ngf_flash_")||(e.unbind("change"),e.unbind("click"),e.bind("change",function(a){h.apply(this,[a]),f.apply(this,[a])}),e.attr("__ngf_flash_","true")),b.addClass("js-fileapi-wrapper"),a(d)||(b.css("position","absolute").css("top",c(d[0]).top+"px").css("left",c(d[0]).left+"px").css("width",d[0].offsetWidth+"px").css("height",d[0].offsetHeight+"px").css("filter","alpha(opacity=0)").css("display",d.css("display")).css("overflow","hidden").css("z-index","900000").css("visibility","visible"),e.css("width",d[0].offsetWidth+"px").css("height",d[0].offsetHeight+"px").css("position","absolute").css("top","0px").css("left","0px")))};d.bind("mouseenter",g);var h=function(a){for(var b=FileAPI.getFiles(a),c=0;c0},this.rename=function(a,b){return a.ngfName=b,a},this.jsonBlob=function(a){null==a||angular.isString(a)||(a=JSON.stringify(a));var b=new window.Blob([a],{type:"application/json"});return b._ngfBlob=!0,b},this.json=function(a){return angular.toJson(a)},this.isFile=function(a){return null!=a&&(a instanceof window.Blob||a.flashId&&a.name&&a.size)},this.upload=function(a,b){function c(b,c){if(b._ngfBlob)return b;if(a._file=a._file||b,null!=a._start&&g){a._end&&a._end>=b.size&&(a._finished=!0,a._end=b.size);var d=b.slice(a._start,a._end||b.size);return d.name=b.name,d.ngfName=b.ngfName,a._chunkSize&&(c.append("_chunkSize",a._chunkSize),c.append("_currentChunkSize",a._end-a._start),c.append("_chunkNumber",Math.floor(a._start/a._chunkSize)),c.append("_totalSize",a._file.size)),d}return b}function h(b,d,e){if(void 0!==d)if(angular.isDate(d)&&(d=d.toISOString()),angular.isString(d))b.append(e,d);else if(f.isFile(d)){var g=c(d,b),i=e.split(",");i[1]&&(g.ngfName=i[1].replace(/^\s+|\s+$/g,""),e=i[0]),a._fileKey=a._fileKey||e,b.append(e,g,g.ngfName||g.name)}else if(angular.isObject(d)){if(d.$$ngfCircularDetection)throw"ngFileUpload: Circular reference in config.data. Make sure specified data for Upload.upload() has no circular reference: "+e;d.$$ngfCircularDetection=!0;try{for(var j in d)if(d.hasOwnProperty(j)&&"$$ngfCircularDetection"!==j){var k=null==a.objectKey?"[i]":a.objectKey;d.length&&parseInt(j)>-1&&(k=null==a.arrayKey?k:a.arrayKey),h(b,d[j],e+k.replace(/[ik]/g,j))}}finally{delete d.$$ngfCircularDetection}}else b.append(e,d)}function i(){a._chunkSize=f.translateScalars(a.resumeChunkSize),a._chunkSize=a._chunkSize?parseInt(a._chunkSize.toString()):null,a.headers=a.headers||{},a.headers["Content-Type"]=void 0,a.transformRequest=a.transformRequest?angular.isArray(a.transformRequest)?a.transformRequest:[a.transformRequest]:[],a.transformRequest.push(function(b){var c,d=new window.FormData;b=b||a.fields||{},a.file&&(b.file=a.file);for(c in b)if(b.hasOwnProperty(c)){var e=b[c];a.formDataAppender?a.formDataAppender(d,c,e):h(d,e,c)}return d})}return b||(a=e(a)),a._isDigested||(a._isDigested=!0,i()),d(a)},this.http=function(b){return b=e(b),b.transformRequest=b.transformRequest||function(b){return window.ArrayBuffer&&b instanceof window.ArrayBuffer||b instanceof window.Blob?b:a.defaults.transformRequest[0].apply(this,arguments)},b._chunkSize=f.translateScalars(b.resumeChunkSize),b._chunkSize=b._chunkSize?parseInt(b._chunkSize.toString()):null,d(b)},this.translateScalars=function(a){if(angular.isString(a)){if(a.search(/kb/i)===a.length-2)return parseFloat(1024*a.substring(0,a.length-2));if(a.search(/mb/i)===a.length-2)return parseFloat(1048576*a.substring(0,a.length-2));if(a.search(/gb/i)===a.length-2)return parseFloat(1073741824*a.substring(0,a.length-2));if(a.search(/b/i)===a.length-1)return parseFloat(a.substring(0,a.length-1));if(a.search(/s/i)===a.length-1)return parseFloat(a.substring(0,a.length-1));if(a.search(/m/i)===a.length-1)return parseFloat(60*a.substring(0,a.length-1));if(a.search(/h/i)===a.length-1)return parseFloat(3600*a.substring(0,a.length-1))}return a},this.urlToBlob=function(c){var d=b.defer();return a({url:c,method:"get",responseType:"arraybuffer"}).then(function(a){var b=new Uint8Array(a.data),e=a.headers("content-type")||"image/WebP",f=new window.Blob([b],{type:e}),g=c.match(/.*\/(.+?)(\?.*)?$/);g.length>1&&(f.name=g[1]),d.resolve(f)},function(a){d.reject(a)}),d.promise},this.setDefaults=function(a){this.defaults=a||{}},this.defaults={},this.version=ngFileUpload.version}]),ngFileUpload.service("Upload",["$parse","$timeout","$compile","$q","UploadExif",function(a,b,c,d,e){function f(a,b,c){var e=[i.emptyPromise()];return angular.forEach(a,function(d,f){0===d.type.indexOf("image/jpeg")&&i.attrGetter("ngfFixOrientation",b,c,{$file:d})&&e.push(i.happyPromise(i.applyExifRotation(d),d).then(function(b){a.splice(f,1,b)}))}),d.all(e)}function g(a,b,c,e){var f=i.attrGetter("ngfResize",b,c);if(!f||!i.isResizeSupported()||!a.length)return i.emptyPromise();if(f instanceof Function){var g=d.defer();return f(a).then(function(d){h(d,a,b,c,e).then(function(a){g.resolve(a)},function(a){g.reject(a)})},function(a){g.reject(a)})}return h(f,a,b,c,e)}function h(a,b,c,e,f){function g(d,g){if(0===d.type.indexOf("image")){if(a.pattern&&!i.validatePattern(d,a.pattern))return;a.resizeIf=function(a,b){return i.attrGetter("ngfResizeIf",c,e,{$width:a,$height:b,$file:d})};var j=i.resize(d,a);h.push(j),j.then(function(a){b.splice(g,1,a)},function(a){d.$error="resize",(d.$errorMessages=d.$errorMessages||{}).resize=!0,d.$errorParam=(a?(a.message?a.message:a)+": ":"")+(d&&d.name),f.$ngfValidations.push({name:"resize",valid:!1}),i.applyModelValidation(f,b)})}}for(var h=[i.emptyPromise()],j=0;j-1},i.emptyPromise=function(){var a=d.defer(),c=arguments;return b(function(){a.resolve.apply(a,c)}),a.promise},i.rejectPromise=function(){var a=d.defer(),c=arguments;return b(function(){a.reject.apply(a,c)}),a.promise},i.happyPromise=function(a,c){var e=d.defer();return a.then(function(a){e.resolve(a)},function(a){b(function(){throw a}),e.resolve(c)}),e.promise},i.updateModel=function(c,d,e,h,j,k,l){function m(f,g,j,l,m){d.$$ngfPrevValidFiles=f,d.$$ngfPrevInvalidFiles=g;var n=f&&f.length?f[0]:null,o=g&&g.length?g[0]:null;c&&(i.applyModelValidation(c,f),c.$setViewValue(m?n:f)),h&&a(h)(e,{$files:f,$file:n,$newFiles:j,$duplicateFiles:l,$invalidFiles:g,$invalidFile:o,$event:k});var p=i.attrGetter("ngfModelInvalid",d);p&&b(function(){a(p).assign(e,m?o:g)}),b(function(){})}function n(){function a(a,b){return a.name===b.name&&(a.$ngfOrigSize||a.size)===(b.$ngfOrigSize||b.size)&&a.type===b.type}function b(b){var c;for(c=0;c-1&&(v.splice(d,1),u.push(c)),a()}}})}var q,r,s,t=[],u=[],v=[];r=d.$$ngfPrevValidFiles||[],s=d.$$ngfPrevInvalidFiles||[],c&&c.$modelValue&&(r=o(c.$modelValue));var w=i.attrGetter("ngfKeep",d,e);q=(j||[]).slice(0),("distinct"===w||i.attrGetter("ngfKeepDistinct",d,e)===!0)&&n(d,e);var x=!w&&!i.attrGetter("ngfMultiple",d,e)&&!i.attrGetter("multiple",d);if(!w||q.length){i.attrGetter("ngfBeforeModelChange",d,e,{$files:j,$file:j&&j.length?j[0]:null,$newFiles:q,$duplicateFiles:t,$event:k});var y=i.attrGetter("ngfValidateAfterResize",d,e),z=i.attrGetter("ngfModelOptions",d,e);i.validate(q,w?r.length:0,c,d,e).then(function(a){l?m(q,[],j,t,x):(z&&z.allowInvalid||y?v=q:(v=a.validFiles,u=a.invalidFiles),i.attrGetter("ngfFixOrientation",d,e)&&i.isExifSupported()?f(v,d,e).then(function(){p()}):p())})}},i}]),ngFileUpload.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(a,b,c,d){function e(a){var b=a.match(/Android[^\d]*(\d+)\.(\d+)/);if(b&&b.length>2){var c=d.defaults.androidFixMinorVersion||4;return parseInt(b[1])<4||parseInt(b[1])===c&&parseInt(b[2])'),c=angular.element("");return c.css("visibility","hidden").css("position","absolute").css("overflow","hidden").css("width","0px").css("height","0px").css("border","none").css("margin","0px").css("padding","0px").attr("tabindex","-1"),n(a,c),g.push({el:b,ref:c}),document.body.appendChild(c.append(a)[0]),a}function p(c){if(b.attr("disabled"))return!1;if(!t("ngfSelectDisabled",a)){var d=q(c);if(null!=d)return d;r(c);try{k()||document.body.contains(x[0])||(g.push({el:b,ref:x.parent()}),document.body.appendChild(x.parent()[0]),x.bind("change",m))}catch(f){}return e(navigator.userAgent)?setTimeout(function(){x[0].click()},0):x[0].click(),!1}}function q(a){var b=a.changedTouches||a.originalEvent&&a.originalEvent.changedTouches;if(b){if("touchstart"===a.type)return w=b[0].clientX,v=b[0].clientY,!0;if("touchend"===a.type){var c=b[0].clientX,d=b[0].clientY;if(Math.abs(c-w)>20||Math.abs(d-v)>20)return a.stopPropagation(),a.preventDefault(),!1}return!0}}function r(b){j.shouldUpdateOn("click",c,a)&&x.val()&&(x.val(null),j.updateModel(d,c,a,l(),null,b,!0))}function s(a){if(x&&!x.attr("__ngf_ie10_Fix_")){if(!x[0].parentNode)return void(x=null);a.preventDefault(),a.stopPropagation(),x.unbind("click");var b=x.clone();return x.replaceWith(b),x=b,x.attr("__ngf_ie10_Fix_","true"),x.bind("change",m),x.bind("click",s),x[0].click(),!1}x.removeAttr("__ngf_ie10_Fix_")}var t=function(a,b){return j.attrGetter(a,c,b)};j.registerModelChangeValidator(d,c,a);var u=[];t("ngfMultiple")&&u.push(a.$watch(t("ngfMultiple"),function(){x.attr("multiple",t("ngfMultiple",a))})),t("ngfCapture")&&u.push(a.$watch(t("ngfCapture"),function(){x.attr("capture",t("ngfCapture",a))})),t("ngfAccept")&&u.push(a.$watch(t("ngfAccept"),function(){x.attr("accept",t("ngfAccept",a))})),u.push(c.$observe("accept",function(){x.attr("accept",t("accept"))}));var v=0,w=0,x=b;k()||(x=o()),x.bind("change",m),k()?b.bind("click",r):b.bind("click touchstart touchend",p),-1!==navigator.appVersion.indexOf("MSIE 10")&&x.bind("click",s),d&&d.$formatters.push(function(a){return(null==a||0===a.length)&&x.val()&&x.val(null),a}),a.$on("$destroy",function(){k()||x.parent().remove(),angular.forEach(u,function(a){a()})}),h(function(){for(var a=0;a-1&&l.height&&l.height.indexOf("px")>-1&&(k={width:parseInt(l.width.slice(0,-2)),height:parseInt(l.height.slice(0,-2))})}return angular.isString(c)?(e.removeClass("ng-hide"),i?e.css("background-image","url('"+c+"')"):e.attr("src",c)):void(!c||!c.type||0!==c.type.search(a(e[0]))||i&&0!==c.type.indexOf("image")?e.addClass("ng-hide"):k&&b.isResizeSupported()?(k.resizeIf=function(a,e){return b.attrGetter("ngfResizeIf",f,d,{$width:a,$height:e,$file:c})},b.resize(c,k).then(function(a){j(a)},function(a){throw a})):j(c))});d.$on("$destroy",function(){c()})})}ngFileUpload.service("UploadDataUrl",["UploadBase","$timeout","$q",function(a,b,c){var d=a;return d.base64DataUrl=function(a){if(angular.isArray(a)){var b=c.defer(),e=0;return angular.forEach(a,function(c){d.dataUrl(c,!0)["finally"](function(){if(e++,e===a.length){var c=[];angular.forEach(a,function(a){c.push(a.$ngfDataUrl)}),b.resolve(c,a)}})}),b.promise}return d.dataUrl(a,!0)},d.dataUrl=function(a,e){if(!a)return d.emptyPromise(a,a);if(e&&null!=a.$ngfDataUrl||!e&&null!=a.$ngfBlobUrl)return d.emptyPromise(e?a.$ngfDataUrl:a.$ngfBlobUrl,a);var f=e?a.$$ngfDataUrlPromise:a.$$ngfBlobUrlPromise;if(f)return f;var g=c.defer();return b(function(){if(window.FileReader&&a&&(!window.FileAPI||-1===navigator.userAgent.indexOf("MSIE 8")||a.size<2e4)&&(!window.FileAPI||-1===navigator.userAgent.indexOf("MSIE 9")||a.size<4e6)){var c=window.URL||window.webkitURL;if(c&&c.createObjectURL&&!e){var f;try{f=c.createObjectURL(a)}catch(h){return void b(function(){a.$ngfBlobUrl="",g.reject()})}b(function(){if(a.$ngfBlobUrl=f,f){g.resolve(f,a),d.blobUrls=d.blobUrls||[],d.blobUrlsTotalSize=d.blobUrlsTotalSize||0,d.blobUrls.push({url:f,size:a.size}),d.blobUrlsTotalSize+=a.size||0;for(var b=d.defaults.blobUrlsMaxMemory||268435456,e=d.defaults.blobUrlsMaxQueueSize||200;(d.blobUrlsTotalSize>b||d.blobUrls.length>e)&&d.blobUrls.length>1;){var h=d.blobUrls.splice(0,1)[0];c.revokeObjectURL(h.url),d.blobUrlsTotalSize-=h.size}}})}else{var i=new FileReader;i.onload=function(c){b(function(){a.$ngfDataUrl=c.target.result,g.resolve(c.target.result,a),b(function(){delete a.$ngfDataUrl},1e3)})},i.onerror=function(){b(function(){a.$ngfDataUrl="",g.reject()})},i.readAsDataURL(a)}}else b(function(){a[e?"$ngfDataUrl":"$ngfBlobUrl"]="",g.reject()})}),f=e?a.$$ngfDataUrlPromise=g.promise:a.$$ngfBlobUrlPromise=g.promise,f["finally"](function(){delete a[e?"$$ngfDataUrlPromise":"$$ngfBlobUrlPromise"]}),f},d}]),ngFileUpload.directive("ngfSrc",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){b(a,c,d,e,f,"ngfSrc",a.attrGetter("ngfResize",f,d),!1)}}}]),ngFileUpload.directive("ngfBackground",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){b(a,c,d,e,f,"ngfBackground",a.attrGetter("ngfResize",f,d),!0)}}}]),ngFileUpload.directive("ngfThumbnail",["Upload","$timeout",function(a,c){return{restrict:"AE",link:function(d,e,f){var g=a.attrGetter("ngfSize",f,d);b(a,c,d,e,f,"ngfThumbnail",g,a.attrGetter("ngfAsBackground",f,d))}}}]),ngFileUpload.config(["$compileProvider",function(a){a.imgSrcSanitizationWhitelist&&a.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/),a.aHrefSanitizationWhitelist&&a.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/); +}]),ngFileUpload.filter("ngfDataUrl",["UploadDataUrl","$sce",function(a,b){return function(c,d,e){if(angular.isString(c))return b.trustAsResourceUrl(c);var f=c&&((d?c.$ngfDataUrl:c.$ngfBlobUrl)||c.$ngfDataUrl);return c&&!f?(!c.$ngfDataUrlFilterInProgress&&angular.isObject(c)&&(c.$ngfDataUrlFilterInProgress=!0,a.dataUrl(c,d)),""):(c&&delete c.$ngfDataUrlFilterInProgress,(c&&f?e?b.trustAsResourceUrl(f):f:c)||"")}}])}(),ngFileUpload.service("UploadValidate",["UploadDataUrl","$q","$timeout",function(a,b,c){function d(a){var b="",c=[];if(a.length>2&&"/"===a[0]&&"/"===a[a.length-1])b=a.substring(1,a.length-1);else{var e=a.split(",");if(e.length>1)for(var f=0;f|:\\-]","g"),"\\$&")+"$",b=b.replace(/\\\*/g,".*").replace(/\\\?/g,"."))}return{regexp:b,excludes:c}}function e(a,b){null==b||a.$dirty||(a.$setDirty?a.$setDirty():a.$dirty=!0)}var f=a;return f.validatePattern=function(a,b){if(!b)return!0;var c=d(b),e=!0;if(c.regexp&&c.regexp.length){var f=new RegExp(c.regexp,"i");e=null!=a.type&&f.test(a.type)||null!=a.name&&f.test(a.name)}for(var g=c.excludes.length;g--;){var h=new RegExp(c.excludes[g],"i");e=e&&(null==a.type||h.test(a.type))&&(null==a.name||h.test(a.name))}return e},f.ratioToFloat=function(a){var b=a.toString(),c=b.search(/[x:]/i);return b=c>-1?parseFloat(b.substring(0,c))/parseFloat(b.substring(c+1)):parseFloat(b)},f.registerModelChangeValidator=function(a,b,c){a&&a.$formatters.push(function(d){if(a.$dirty){var e=d;d&&!angular.isArray(d)&&(e=[d]),f.validate(e,0,a,b,c).then(function(){f.applyModelValidation(a,e)})}return d})},f.applyModelValidation=function(a,b){e(a,b),angular.forEach(a.$ngfValidations,function(b){a.$setValidity(b.name,b.valid)})},f.getValidationAttr=function(a,b,c,d,e){var g="ngf"+c[0].toUpperCase()+c.substr(1),h=f.attrGetter(g,a,b,{$file:e});if(null==h&&(h=f.attrGetter("ngfValidate",a,b,{$file:e}))){var i=(d||c).split(".");h=h[i[0]],i.length>1&&(h=h&&h[i[1]])}return h},f.validate=function(a,c,d,e,g){function h(b,c,h){if(a){for(var i=a.length,j=null;i--;){var n=a[i];if(n){var o=f.getValidationAttr(e,g,b,c,n);null!=o&&(h(n,o,i)||(-1===k.indexOf(b)?(n.$error=b,(n.$errorMessages=n.$errorMessages||{})[b]=!0,n.$errorParam=o,-1===m.indexOf(n)&&m.push(n),l||a.splice(i,1),j=!1):a.splice(i,1)))}}null!==j&&d.$ngfValidations.push({name:b,valid:j})}}function i(c,h,i,n,o){function p(b,d,e){function f(f){if(f())if(-1===k.indexOf(c)){if(d.$error=c,(d.$errorMessages=d.$errorMessages||{})[c]=!0,d.$errorParam=e,-1===m.indexOf(d)&&m.push(d),!l){var g=a.indexOf(d);g>-1&&a.splice(g,1)}b.resolve(!1)}else{var h=a.indexOf(d);h>-1&&a.splice(h,1),b.resolve(!0)}else b.resolve(!0)}null!=e?n(d,e).then(function(a){f(function(){return!o(a,e)})},function(){f(function(){return j("ngfValidateForce",{$file:d})})}):b.resolve(!0)}var q=[f.emptyPromise(!0)];a&&(a=void 0===a.length?[a]:a,angular.forEach(a,function(a){var d=b.defer();return q.push(d.promise),!i||null!=a.type&&0===a.type.search(i)?void("dimensions"===c&&null!=f.attrGetter("ngfDimensions",e)?f.imageDimensions(a).then(function(b){p(d,a,j("ngfDimensions",{$file:a,$width:b.width,$height:b.height}))},function(){d.resolve(!1)}):"duration"===c&&null!=f.attrGetter("ngfDuration",e)?f.mediaDuration(a).then(function(b){p(d,a,j("ngfDuration",{$file:a,$duration:b}))},function(){d.resolve(!1)}):p(d,a,f.getValidationAttr(e,g,c,h,a))):void d.resolve(!0)}));var r=b.defer();return b.all(q).then(function(a){for(var b=!0,e=0;e=f.translateScalars(b)}),h("maxSize","size.max",function(a,b){return a.size-.1<=f.translateScalars(b)});var n=0;if(h("maxTotalSize",null,function(b,c){return n+=b.size,!(n>f.translateScalars(c))||(a.splice(0,a.length),!1)}),h("validateFn",null,function(a,b){return b===!0||null===b||""===b}),!a.length)return f.emptyPromise({validFiles:[],invalidFiles:m});var o=b.defer(),p=[];return p.push(i("maxHeight","height.max",/image/,this.imageDimensions,function(a,b){return a.height<=b})),p.push(i("minHeight","height.min",/image/,this.imageDimensions,function(a,b){return a.height>=b})),p.push(i("maxWidth","width.max",/image/,this.imageDimensions,function(a,b){return a.width<=b})),p.push(i("minWidth","width.min",/image/,this.imageDimensions,function(a,b){return a.width>=b})),p.push(i("dimensions",null,/image/,function(a,b){return f.emptyPromise(b)},function(a){return a})),p.push(i("ratio",null,/image/,this.imageDimensions,function(a,b){for(var c=b.toString().split(","),d=!1,e=0;e-1e-4})),p.push(i("maxDuration","duration.max",/audio|video/,this.mediaDuration,function(a,b){return a<=f.translateScalars(b)})),p.push(i("minDuration","duration.min",/audio|video/,this.mediaDuration,function(a,b){return a>=f.translateScalars(b)})),p.push(i("duration",null,/audio|video/,function(a,b){return f.emptyPromise(b)},function(a){return a})),p.push(i("validateAsyncFn",null,null,function(a,b){return b},function(a){return a===!0||null===a||""===a})),b.all(p).then(function(){if(l)for(var b=0;bc+d}),o.resolve({validFiles:a,invalidFiles:m})}),o.promise},f.imageDimensions=function(a){if(a.$ngfWidth&&a.$ngfHeight){var d=b.defer();return c(function(){d.resolve({width:a.$ngfWidth,height:a.$ngfHeight})}),d.promise}if(a.$ngfDimensionPromise)return a.$ngfDimensionPromise;var e=b.defer();return c(function(){return 0!==a.type.indexOf("image")?void e.reject("not image"):void f.dataUrl(a).then(function(b){function d(){var b=h[0].naturalWidth||h[0].clientWidth,c=h[0].naturalHeight||h[0].clientHeight;h.remove(),a.$ngfWidth=b,a.$ngfHeight=c,e.resolve({width:b,height:c})}function f(){h.remove(),e.reject("load error")}function g(){c(function(){h[0].parentNode&&(h[0].clientWidth?d():i++>10?f():g())},1e3)}var h=angular.element("").attr("src",b).css("visibility","hidden").css("position","fixed").css("max-width","none !important").css("max-height","none !important");h.on("load",d),h.on("error",f);var i=0;g(),angular.element(document.getElementsByTagName("body")[0]).append(h)},function(){e.reject("load error")})}),a.$ngfDimensionPromise=e.promise,a.$ngfDimensionPromise["finally"](function(){delete a.$ngfDimensionPromise}),a.$ngfDimensionPromise},f.mediaDuration=function(a){if(a.$ngfDuration){var d=b.defer();return c(function(){d.resolve(a.$ngfDuration)}),d.promise}if(a.$ngfDurationPromise)return a.$ngfDurationPromise;var e=b.defer();return c(function(){return 0!==a.type.indexOf("audio")&&0!==a.type.indexOf("video")?void e.reject("not media"):void f.dataUrl(a).then(function(b){function d(){var b=h[0].duration;a.$ngfDuration=b,h.remove(),e.resolve(b)}function f(){h.remove(),e.reject("load error")}function g(){c(function(){h[0].parentNode&&(h[0].duration?d():i>10?f():g())},1e3)}var h=angular.element(0===a.type.indexOf("audio")?"