!function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return i(n?n:e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a>18&63,o=u>>12&63,a=u>>6&63,s=63&u,h[f++]=c.charAt(i)+c.charAt(o)+c.charAt(a)+c.charAt(s);while(l299)&&n.error){e=new Error("CouchDB error: "+(n.error.reason||n.error.error));for(var i in n)e[i]=n[i];return r(e,t,n)}return r(e,t,n)}"string"==typeof t&&(t={uri:t}),t.json=!0,t.body&&(t.json=t.body),delete t.body,r=r||n;var o=e(t,i);return o},e})},{}],2:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!o(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,o,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(r=arguments.length,o=new Array(r-1),u=1;r>u;u++)o[u-1]=arguments[u];n.apply(this,o)}else if(a(n)){for(r=arguments.length,o=new Array(r-1),u=1;r>u;u++)o[u-1]=arguments[u];for(c=n.slice(),r=c.length,u=0;r>u;u++)c[u].apply(this,o)}return!0},r.prototype.addListener=function(e,t){var n;if(!i(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned){var n;n=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())}return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,o,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],o=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=o;s-->0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(0>r)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],i(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?i(e._events[t])?1:e._events[t].length:0}},{}],3:[function(e,t,n){function r(){l=!1,s.length?c=s.concat(c):f=-1,c.length&&i()}function i(){if(!l){var e=setTimeout(r);l=!0;for(var t=c.length;t;){for(s=c,c=[];++f1)for(var n=1;ne;e+=2){var t=te[e],n=te[e+1];t(n),te[e]=void 0,te[e+1]=void 0}K=0}function p(){try{var t=e,n=t("vertx");return J=n.runOnLoop||n.runOnContext,l()}catch(r){return h()}}function v(){}function y(){return new TypeError("You cannot resolve a promise with itself")}function _(){return new TypeError("A promises callback cannot return that same promise.")}function m(e){try{return e.then}catch(t){return oe.error=t,oe}}function k(e,t,n,r){try{e.call(t,n,r)}catch(i){return i}}function w(e,t,n){Y(function(e){var r=!1,i=k(n,t,function(n){r||(r=!0,t!==n?I(e,n):S(e,n))},function(t){r||(r=!0,j(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&i&&(r=!0,j(e,i))},e)}function b(e,t){t._state===re?S(e,t._result):t._state===ie?j(e,t._result):E(t,void 0,function(t){I(e,t)},function(t){j(e,t)})}function P(e,t){if(t.constructor===e.constructor)b(e,t);else{var n=m(t);n===oe?j(e,oe.error):void 0===n?S(e,t):o(n)?w(e,t,n):S(e,t)}}function I(e,t){e===t?j(e,y()):i(t)?P(e,t):S(e,t)}function T(e){e._onerror&&e._onerror(e._result),O(e)}function S(e,t){e._state===ne&&(e._result=t,e._state=re,0!==e._subscribers.length&&Y(O,e))}function j(e,t){e._state===ne&&(e._state=ie,e._result=t,Y(T,e))}function E(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+re]=n,i[o+ie]=r,0===o&&e._state&&Y(O,e)}function O(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,i,o=e._result,a=0;aa;a++)E(r.resolve(e[a]),void 0,t,n);return i}function q(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(v);return I(n,e),n}function M(e){var t=this,n=new t(v);return j(n,e),n}function U(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function $(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function G(e){this._id=de++,this._state=void 0,this._result=void 0,this._subscribers=[],v!==e&&(o(e)||U(),this instanceof G||$(),D(this,e))}function F(){var e;if("undefined"!=typeof r)e=r;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=e.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(e.Promise=he)}var z;z=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var J,B,V,H=z,K=0,Y=({}.toString,function(e,t){te[K]=e,te[K+1]=t,K+=2,2===K&&(B?B(g):V())}),X="undefined"!=typeof window?window:void 0,Q=X||{},W=Q.MutationObserver||Q.WebKitMutationObserver,Z="undefined"!=typeof n&&"[object process]"==={}.toString.call(n),ee="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,te=new Array(1e3);V=Z?c():W?f():ee?d():void 0===X&&"function"==typeof e?p():h();var ne=void 0,re=1,ie=2,oe=new C,ae=new C;L.prototype._validateInput=function(e){return H(e)},L.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},L.prototype._init=function(){this._result=new Array(this.length)};var se=L;L.prototype._enumerate=function(){for(var e=this,t=e.length,n=e.promise,r=e._input,i=0;n._state===ne&&t>i;i++)e._eachEntry(r[i],i)},L.prototype._eachEntry=function(e,t){var n=this,r=n._instanceConstructor;a(e)?e.constructor===r&&e._state!==ne?(e._onerror=null,n._settledAt(e._state,t,e._result)):n._willSettleAt(r.resolve(e),t):(n._remaining--,n._result[t]=e)},L.prototype._settledAt=function(e,t,n){var r=this,i=r.promise;i._state===ne&&(r._remaining--,e===ie?j(i,n):r._result[t]=n),0===r._remaining&&S(i,r._result)},L.prototype._willSettleAt=function(e,t){var n=this;E(e,void 0,function(e){n._settledAt(re,t,e)},function(e){n._settledAt(ie,t,e)})};var ue=x,ce=N,le=q,fe=M,de=0,he=G;G.all=ue,G.race=ce,G.resolve=le,G.reject=fe,G._setScheduler=s,G._setAsap=u,G._asap=Y,G.prototype={constructor:G,then:function(e,t){var n=this,r=n._state;if(r===re&&!e||r===ie&&!t)return this;var i=new this.constructor(v),o=n._result;if(r){var a=arguments[r-1];Y(function(){A(r,i,a,o)})}else E(n,i,e,t);return i},"catch":function(e){return this.then(null,e)}};var ge=F,pe={Promise:he,polyfill:ge};"function"==typeof define&&define.amd?define(function(){return pe}):"undefined"!=typeof t&&t.exports?t.exports=pe:"undefined"!=typeof this&&(this.ES6Promise=pe),ge()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:3}],5:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n0?(this._dispatcher=window.setInterval(function(){t._dispatchQueue()},1e3*e),this._useEventCaching=!0):this._useEventCaching=!1},get:function(){return this._dispatchIntervalTime}}]),e}();n.Analytics=m},{"../core/core":15,"../core/logger":19,"../core/promise":20,"../core/request":21,"../core/settings":22,"../core/user":24,"../util/util":34,"./storage":9}],6:[function(e,t,n){"use strict";if("object"==typeof angular&&angular.module){var r=function(e){return["$ionicAnalytics","$ionicGesture",function(t,n){for(var r=["drag","dragstart","dragend","dragleft","dragright","dragup","dragdown","swipe","swipeleft","swiperight","swipeup","swipedown","tap","doubletap","hold","transform","pinch","pinchin","pinchout","rotate"],i=!1,o=0;o")}},{key:"elementName",value:function(e){var t=e.getAttribute("ion-track-name");if(t)return t;var n=e.getAttribute("id");return n?n:null}}]),e}();n.DOMSerializer=o},{}],9:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n"}},{key:"id",get:function(){return i("id")}},{key:"apiKey",get:function(){return i("apiKey")}}]),e}();n.App=u},{"./logger":19}],15:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;nr;r++){var i=t[r].getAttribute("src");if(i){var o=i.split("/"),a=0;try{if(a=o.length,"cordova.js"===o[a-1])return e.logger.info("cordova.js has previously been included."),!0}catch(s){e.logger.info("encountered error while testing for cordova.js presence, "+s.toString())}}}return!1}},{key:"loadCordova",value:function(){var t=this;if(!this._isCordovaAvailable()){var n=document.createElement("script"),r="cordova.js";switch(e.getDeviceTypeByNavigator()){case"android":"file"===window.location.href.substring(0,4)&&(r="file:///android_asset/www/cordova.js");break;case"ipad":case"iphone":try{var i=window.location.search.match(/cordova_js_bootstrap_resource=(.*?)(&|#|$)/i);i&&(r=decodeURI(i[1]))}catch(o){t.logger.info("could not find cordova_js_bootstrap_resource query param"),t.logger.info(o)}break;case"unknown":return t.cordovaPlatformUnknown=!0,!1}n.setAttribute("src",r),document.head.appendChild(n),t.logger.info("injecting cordova.js")}}},{key:"_bootstrap",value:function(){this.loadCordova()}},{key:"onReady",value:function(e){var t=this;this._pluginsReady?e(t):t.emitter.on("ionic_core:plugins_ready",function(){e(t)})}}],[{key:"getEmitter",value:function(){return u}},{key:"getStorage",value:function(){return c}},{key:"getMain",value:function(){return"undefined"!=typeof Ionic&&Ionic.IO&&Ionic.IO.main?Ionic.IO.main:null}},{key:"getDeviceTypeByNavigator",value:function(){var e=navigator.userAgent,t=e.match(/iPad/i);if(t&&"ipad"===t[0].toLowerCase())return"ipad";var n=e.match(/iPhone/i);if(n&&"iphone"===n[0].toLowerCase())return"iphone";var r=e.match(/Android/i);return r&&"android"===r[0].toLowerCase()?"android":"unknown"}},{key:"isAndroidDevice",value:function(){var t=e.getDeviceTypeByNavigator();return"android"===t?!0:!1}},{key:"isIOSDevice",value:function(){var t=e.getDeviceTypeByNavigator();return"iphone"===t||"ipad"===t?!0:!1}},{key:"deviceConnectedToNetwork",value:function(e){if("undefined"==typeof e&&(e=!1),"undefined"==typeof navigator.connection||"undefined"==typeof navigator.connection.type||"undefined"==typeof Connection)return e?!1:!0;switch(navigator.connection.type){case Connection.ETHERNET:case Connection.WIFI:case Connection.CELL_2G:case Connection.CELL_3G:case Connection.CELL_4G:case Connection.CELL:return!0;default:return!1}}},{key:"Version",get:function(){return"0.7.1"}}]),e}();n.IonicPlatform=l},{"./events":18,"./logger":19,"./storage":23}],16:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n=400){var a=new Error("Request Failed with status code of "+i.statusCode);n({response:i,error:a})}else t({response:i,payload:o})})});return c.requestInfo=r,c}return r(t,e),t}(c);n.APIRequest=d},{"../auth/auth":11,"./promise":20,"browser-request":1}],22:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n"}},{key:"set",value:function(e,t){return delete this._unset[e],this.data.set(e,t)}},{key:"get",value:function(e,t){return this.data.get(e,t)}},{key:"unset",value:function(e){return this._unset[e]=!0,this.data.unset(e)}},{key:"id",set:function(e){return e&&"string"==typeof e&&""!==e?(this._id=e,!0):!1},get:function(){return this._id||null}}],[{key:"current",value:function(t){return t?(d=t,y.store(),d):(d||(d=y.load()),d||(d=new e),d)}},{key:"fromContext",value:function(t){var n=new e;return n.id=t._id,n.data=new _(t.data.data),n.details=t.details||{},n._fresh=t._fresh,n._dirty=t._dirty,n}},{key:"self",value:function(){var t=new s.DeferredPromise,n=new e;return n._blockLoad?(n.logger.info("a load operation is already in progress for "+this+"."),t.reject(!1)):(n._blockLoad=!0,new a.APIRequest({uri:v.self(),method:"GET",json:!0}).then(function(r){n._blockLoad=!1,n.logger.info("loaded user"),n.id=r.payload.data.uuid,n.data=new _(r.payload.data.custom),n.details=r.payload.data.details,n._fresh=!1,e.current(n),t.resolve(n)},function(e){n._blockLoad=!1,n.logger.error(e),t.reject(e)})),t.promise}},{key:"load",value:function(t){var n=new s.DeferredPromise,r=new e;return r.id=t,r._blockLoad?(r.logger.info("a load operation is already in progress for "+this+"."),n.reject(!1)):(r._blockLoad=!0,new a.APIRequest({uri:v.get(r),method:"GET",json:!0}).then(function(e){r._blockLoad=!1,r.logger.info("loaded user"),r.data=new _(e.payload.data.custom),r.details=e.payload.data.details,r._fresh=!1,n.resolve(r)},function(e){r._blockLoad=!1,r.logger.error(e),n.reject(e)})),n.promise}}]),e}();n.User=m},{"../auth/auth":11,"./data-types.js":16,"./logger":19,"./promise":20,"./request":21,"./settings":22,"./storage":23}],25:[function(e,t,n){"use strict";if("object"==typeof angular&&angular.module){var r=null;angular.module("ionic.service.deploy",[]).factory("$ionicDeploy",[function(){return r||(r=new Ionic.Deploy),r}])}},{}],26:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n"}},{key:"payload",get:function(){return this._payload||{}}}],[{key:"fromPluginJSON",value:function(t){var n=new e(t);return n.processRaw(),n}}]),e}();n.PushMessage=a},{}],32:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n"}},{key:"token",set:function(e){this._token=e},get:function(){return this._token}}]),e}();n.PushToken=o},{}],33:[function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n