ionic 中的折线图与柱状图

来源:互联网 发布:java调用系统api接口 编辑:程序博客网 时间:2024/05/16 05:10

转自 github : https://github.com/anilkumar007/Charts

效果图:

  • 折线图

    这里写图片描述

  • 柱状图

    这里写图片描述

插件组成:

js:                        ng-cordova.min.js                           Chart.min.js                            angular-chart.min.js
css:                      angular-chart.css
  • 使用方法:

(1) 在index.html 页面

      <link rel="stylesheet" href="css/angular-chart.css">

(2)在相关module加入

angular.module('status-controller', ['ngCordova','chart.js'])

(3)controller中

$scope.labels = ["2016.1", "2016.2", "2016.3", "2016.4", "2016.5", "2016.6", "2016.7","2016.8"];    $scope.series = ['同比', '环比','基础'];    $scope.data = [        [65, 59, 80, 81, 56, 55, 40,11],        [28, 48, 40, 19, 86, 27, 90,80],        [12, 38, 45, 54, 20, 7, 67,20]    ];      

(4)相关html中添加

<div class="item item-text-wrap" >      <canvas id="line" class="chart chart-line" data="data" labels="labels" legend="true" series="series" options="{showTooltips:true}">      </canvas> </div><div  class="item item-text-wrap">      <canvas id="bar" class="chart chart-bar" data="data" labels="labels" legend="true" series="series" options="{showTooltips:true}">    </canvas></div>

代码:

  • ng-cordova.min.js
/*! * ngCordova * v0.1.18-alpha * Copyright 2014 Drifty Co. http://drifty.com/ * See LICENSE in this repository for license information */! function() {    angular.module("ngCordova", ["ngCordova.plugins"]), angular.module("ngCordova.plugins.actionSheet", []).factory("$cordovaActionSheet", ["$q", "$window", function(e, n) {            return { show: function(t) {                    var r = e.defer();                    return n.plugins.actionsheet.show(t, function(e) { r.resolve(e) }), r.promise }, hide: function() {                    return n.plugins.actionsheet.hide() } } }]), angular.module("ngCordova.plugins.adMob", []).factory("$cordovaAdMob", ["$q", "$window", function(e, n) {            return { createBannerView: function(t) {                    var r = e.defer();                    return n.plugins.AdMob.createBannerView(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, createInterstitialView: function(t) {                    var r = e.defer();                    return n.plugins.AdMob.createInterstitialView(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, requestAd: function(t) {                    var r = e.defer();                    return n.plugins.AdMob.requestAd(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showAd: function(t) {                    var r = e.defer();                    return n.plugins.AdMob.showAd(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, requestInterstitialAd: function(t) {                    var r = e.defer();                    return n.plugins.AdMob.requestInterstitialAd(t, function() { r.resolve() }, function() { r.reject() }), r.promise } } }]), angular.module("ngCordova.plugins.appAvailability", []).factory("$cordovaAppAvailability", ["$q", function(e) {            return { check: function(n) {                    var t = e.defer();                    return appAvailability.check(n, function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise } } }]), angular.module("ngCordova.plugins.appRate", []).provider("$cordovaAppRate", [function() { this.setPreferences = function(e) { e && angular.isObject(e) && (AppRate.preferences.useLanguage = e.language || null, AppRate.preferences.displayAppName = e.appName || "", AppRate.preferences.promptAgainForEachNewVersion = e.promptForNewVersion || !0, AppRate.preferences.openStoreInApp = e.openStoreInApp || !1, AppRate.preferences.usesUntilPrompt = e.usesUntilPrompt || 3, AppRate.preferences.useCustomRateDialog = e.useCustomRateDialog || !1, AppRate.preferences.storeAppURL.ios = e.iosURL || null, AppRate.preferences.storeAppURL.android = e.androidURL || null, AppRate.preferences.storeAppURL.blackberry = e.blackberryURL || null, AppRate.preferences.storeAppURL.windows8 = e.windowsURL || null) }, this.setCustomLocale = function(e) {                var n = { title: "Rate %@", message: "If you enjoy using %@, would you mind taking a moment to rate it? It won’t take more than a minute. Thanks for your support!", cancelButtonLabel: "No, Thanks", laterButtonLabel: "Remind Me Later", rateButtonLabel: "Rate It Now" };                n = angular.extend(n, e), AppRate.preferences.customLocale = n }, this.$get = ["$q", function(e) {                return { promptForRating: function(n) {                        var t = e.defer(),                            r = AppRate.promptForRating(n);                        return t.resolve(r), t.promise }, navigateToAppStore: function() {                        var n = e.defer(),                            t = AppRate.navigateToAppStore();                        return n.resolve(t), n.promise }, onButtonClicked: function(e) { AppRate.onButtonClicked = function(n) { e.call(this, n) } }, onRateDialogShow: function(e) { AppRate.onRateDialogShow = e() } } }] }]), angular.module("ngCordova.plugins.appVersion", []).factory("$cordovaAppVersion", ["$q", function(e) {            return { getVersionNumber: function() {                    var n = e.defer();                    return cordova.getAppVersion.getVersionNumber(function(e) { n.resolve(e) }), n.promise }, getVersionCode: function() {                    var n = e.defer();                    return cordova.getAppVersion.getVersionCode(function(e) { n.resolve(e) }), n.promise } } }]), angular.module("ngCordova.plugins.backgroundGeolocation", []).factory("$cordovaBackgroundGeolocation", ["$q", "$window", function(e, n) {            return { init: function() { n.navigator.geolocation.getCurrentPosition(function(e) {                        return e }) }, configure: function(t) { this.init();                    var r = e.defer();                    return n.plugins.backgroundGeoLocation.configure(function(e) { r.notify(e), n.plugins.backgroundGeoLocation.finish() }, function(e) { r.reject(e) }, t), this.start(), r.promise }, start: function() {                    var t = e.defer();                    return n.plugins.backgroundGeoLocation.start(function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, stop: function() {                    var t = e.defer();                    return n.plugins.backgroundGeoLocation.stop(function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise } } }]), angular.module("ngCordova.plugins.badge", []).factory("$cordovaBadge", ["$q", function(e) {            return { hasPermission: function() {                    var n = e.defer();                    return cordova.plugins.notification.badge.hasPermission(function(e) { e ? n.resolve(!0) : n.reject("You do not have permission") }), n.promise }, promptForPermission: function() {                    return cordova.plugins.notification.badge.promptForPermission() }, set: function(n, t, r) {                    var o = e.defer();                    return cordova.plugins.notification.badge.hasPermission(function(e) { e ? o.resolve(cordova.plugins.notification.badge.set(n, t, r)) : o.reject("You do not have permission to set Badge") }), o.promise }, get: function() {                    var n = e.defer();                    return cordova.plugins.notification.badge.hasPermission(function(e) { e ? cordova.plugins.notification.badge.get(function(e) { n.resolve(e) }) : n.reject("You do not have permission to get Badge") }), n.promise }, clear: function(n, t) {                    var r = e.defer();                    return cordova.plugins.notification.badge.hasPermission(function(e) { e ? r.resolve(cordova.plugins.notification.badge.clear(n, t)) : r.reject("You do not have permission to clear Badge") }), r.promise }, increase: function(n, t, r) {                    var o = e.defer();                    return this.hasPermission().then(function() { o.resolve(cordova.plugins.notification.badge.increase(n, t, r)) }, function() { o.reject("You do not have permission to increase Badge") }), o.promise }, decrease: function(n, t, r) {                    var o = e.defer();                    return this.hasPermission().then(function() { o.resolve(cordova.plugins.notification.badge.decrease(n, t, r)) }, function() { o.reject("You do not have permission to decrease Badge") }), o.promise }, configure: function(e) {                    return cordova.plugins.notification.badge.configure(e) } } }]), angular.module("ngCordova.plugins.barcodeScanner", []).factory("$cordovaBarcodeScanner", ["$q", function(e) {            return { scan: function(n) {                    var t = e.defer();                    return cordova.plugins.barcodeScanner.scan(function(e) { t.resolve(e) }, function(e) { t.reject(e) }, n), t.promise }, encode: function(n, t) {                    var r = e.defer();                    return n = n || "TEXT_TYPE", cordova.plugins.barcodeScanner.encode(n, t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise } } }]), angular.module("ngCordova.plugins.batteryStatus", []).factory("$cordovaBatteryStatus", ["$rootScope", "$window", "$timeout", function(e, n, t) {            var r = function(n) { t(function() { e.$broadcast("$cordovaBatteryStatus:status", n) }) },                o = function(n) { t(function() { e.$broadcast("$cordovaBatteryStatus:critical", n) }) },                i = function(n) { t(function() { e.$broadcast("$cordovaBatteryStatus:low", n) }) };            return document.addEventListener("deviceready", function() { navigator.battery && (n.addEventListener("batterystatus", r, !1), n.addEventListener("batterycritical", o, !1), n.addEventListener("batterylow", i, !1)) }, !1), !0 }]).run(["$cordovaBatteryStatus", function(e) {}]), angular.module("ngCordova.plugins.ble", []).factory("$cordovaBLE", ["$q", "$timeout", function(e, n) {            return { scan: function(t, r) {                    var o = e.defer();                    return ble.startScan(t, function(e) { o.notify(e) }, function(e) { o.reject(e) }), n(function() { ble.stopScan(function() { o.resolve() }, function(e) { o.reject(e) }) }, 1e3 * r), o.promise }, connect: function(n) {                    var t = e.defer();                    return ble.connect(n, function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, disconnect: function(n) {                    var t = e.defer();                    return ble.disconnect(n, function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, read: function(n, t, r) {                    var o = e.defer();                    return ble.read(n, t, r, function(e) { o.resolve(e) }, function(e) { o.reject(e) }), o.promise }, write: function(n, t, r, o) {                    var i = e.defer();                    return ble.write(n, t, r, o, function(e) { i.resolve(e) }, function(e) { i.reject(e) }), i.promise }, writeCommand: function(n, t, r, o) {                    var i = e.defer();                    return ble.writeCommand(n, t, r, o, function(e) { i.resolve(e) }, function(e) { i.reject(e) }), i.promise }, startNotification: function(n, t, r) {                    var o = e.defer();                    return ble.startNotification(n, t, r, function(e) { o.resolve(e) }, function(e) { o.reject(e) }), o.promise }, stopNotification: function(n, t, r) {                    var o = e.defer();                    return ble.stopNotification(n, t, r, function(e) { o.resolve(e) }, function(e) { o.reject(e) }), o.promise }, isConnected: function(n) {                    var t = e.defer();                    return ble.isConnected(n, function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, isEnabled: function() {                    var n = e.defer();                    return ble.isEnabled(function(e) { n.resolve(e) }, function(e) { n.reject(e) }), n.promise } } }]), angular.module("ngCordova.plugins.bluetoothSerial", []).factory("$cordovaBluetoothSerial", ["$q", "$window", function(e, n) {            return { connect: function(t) {                    var r = e.defer(),                        o = e.defer(),                        i = !1;                    return n.bluetoothSerial.connect(t, function() { i = !0, r.resolve(o) }, function(e) { i === !1 && o.reject(e), r.reject(e) }), r.promise }, connectInsecure: function(t) {                    var r = e.defer();                    return n.bluetoothSerial.connectInsecure(t, function() { r.resolve() }, function(e) { r.reject(e) }), r.promise }, disconnect: function() {                    var t = e.defer();                    return n.bluetoothSerial.disconnect(function() { t.resolve() }, function(e) { t.reject(e) }), t.promise }, list: function() {                    var t = e.defer();                    return n.bluetoothSerial.list(function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, discoverUnpaired: function() {                    var t = e.defer();                    return n.bluetoothSerial.discoverUnpaired(function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, setDeviceDiscoveredListener: function() {                    var t = e.defer();                    return n.bluetoothSerial.setDeviceDiscoveredListener(function(e) { t.notify(e) }), t.promise }, clearDeviceDiscoveredListener: function() { n.bluetoothSerial.clearDeviceDiscoveredListener() }, showBluetoothSettings: function() {                    var t = e.defer();                    return n.bluetoothSerial.showBluetoothSettings(function() { t.resolve() }, function(e) { t.reject(e) }), t.promise }, isEnabled: function() {                    var t = e.defer();                    return n.bluetoothSerial.isEnabled(function() { t.resolve() }, function() { t.reject() }), t.promise }, enable: function() {                    var t = e.defer();                    return n.bluetoothSerial.enable(function() { t.resolve() }, function() { t.reject() }), t.promise }, isConnected: function() {                    var t = e.defer();                    return n.bluetoothSerial.isConnected(function() { t.resolve() }, function() { t.reject() }), t.promise }, available: function() {                    var t = e.defer();                    return n.bluetoothSerial.available(function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, read: function() {                    var t = e.defer();                    return n.bluetoothSerial.read(function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, readUntil: function(t) {                    var r = e.defer();                    return n.bluetoothSerial.readUntil(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, write: function(t) {                    var r = e.defer();                    return n.bluetoothSerial.write(t, function() { r.resolve() }, function(e) { r.reject(e) }), r.promise }, subscribe: function(t) {                    var r = e.defer();                    return n.bluetoothSerial.subscribe(t, function(e) { r.notify(e) }, function(e) { r.reject(e) }), r.promise }, subscribeRawData: function() {                    var t = e.defer();                    return n.bluetoothSerial.subscribeRawData(function(e) { t.notify(e) }, function(e) { t.reject(e) }), t.promise }, unsubscribe: function() {                    var t = e.defer();                    return n.bluetoothSerial.unsubscribe(function() { t.resolve() }, function(e) { t.reject(e) }), t.promise }, unsubscribeRawData: function() {                    var t = e.defer();                    return n.bluetoothSerial.unsubscribeRawData(function() { t.resolve() }, function(e) { t.reject(e) }), t.promise }, clear: function() {                    var t = e.defer();                    return n.bluetoothSerial.clear(function() { t.resolve() }, function(e) { t.reject(e) }), t.promise }, readRSSI: function() {                    var t = e.defer();                    return n.bluetoothSerial.readRSSI(function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise } } }]), angular.module("ngCordova.plugins.brightness", []).factory("$cordovaBrightness", ["$q", "$window", function(e, n) {            return { get: function() {                    var t = e.defer();                    return n.cordova ? n.cordova.plugins.brightness.getBrightness(function(e) { t.resolve(e) }, function(e) { t.reject(e) }) : t.reject("Not supported without cordova.js"), t.promise }, set: function(t) {                    var r = e.defer();                    return n.cordova ? n.cordova.plugins.brightness.setBrightness(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }) : r.reject("Not supported without cordova.js"), r.promise }, setKeepScreenOn: function(t) {                    var r = e.defer();                    return n.cordova ? n.cordova.plugins.brightness.setKeepScreenOn(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }) : r.reject("Not supported without cordova.js"), r.promise } } }]), angular.module("ngCordova.plugins.calendar", []).factory("$cordovaCalendar", ["$q", "$window", function(e, n) {            return { createCalendar: function(t) {                    var r = e.defer(),                        o = n.plugins.calendar.getCreateCalendarOptions();                    return "string" == typeof t ? o.calendarName = t : o = angular.extend(o, t), n.plugins.calendar.createCalendar(o, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, deleteCalendar: function(t) {                    var r = e.defer();                    return n.plugins.calendar.deleteCalendar(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, createEvent: function(t) {                    var r = e.defer(),                        o = { title: null, location: null, notes: null, startDate: null, endDate: null };                    return o = angular.extend(o, t), n.plugins.calendar.createEvent(o.title, o.location, o.notes, new Date(o.startDate), new Date(o.endDate), function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, createEventWithOptions: function(t) {                    var r = e.defer(),                        o = [],                        i = window.plugins.calendar.getCalendarOptions(),                        a = { title: null, location: null, notes: null, startDate: null, endDate: null };                    o = Object.keys(a);                    for (var c in t) - 1 === o.indexOf(c) ? i[c] = t[c] : a[c] = t[c];                    return n.plugins.calendar.createEventWithOptions(a.title, a.location, a.notes, new Date(a.startDate), new Date(a.endDate), i, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, createEventInteractively: function(t) {                    var r = e.defer(),                        o = { title: null, location: null, notes: null, startDate: null, endDate: null };                    return o = angular.extend(o, t), n.plugins.calendar.createEventInteractively(o.title, o.location, o.notes, new Date(o.startDate), new Date(o.endDate), function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, createEventInNamedCalendar: function(t) {                    var r = e.defer(),                        o = { title: null, location: null, notes: null, startDate: null, endDate: null, calendarName: null };                    return o = angular.extend(o, t), n.plugins.calendar.createEventInNamedCalendar(o.title, o.location, o.notes, new Date(o.startDate), new Date(o.endDate), o.calendarName, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, findEvent: function(t) {                    var r = e.defer(),                        o = { title: null, location: null, notes: null, startDate: null, endDate: null };                    return o = angular.extend(o, t), n.plugins.calendar.findEvent(o.title, o.location, o.notes, new Date(o.startDate), new Date(o.endDate), function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, listEventsInRange: function(t, r) {                    var o = e.defer();                    return n.plugins.calendar.listEventsInRange(t, r, function(e) { o.resolve(e) }, function(e) { o.reject(e) }), o.promise }, listCalendars: function() {                    var t = e.defer();                    return n.plugins.calendar.listCalendars(function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, findAllEventsInNamedCalendar: function(t) {                    var r = e.defer();                    return n.plugins.calendar.findAllEventsInNamedCalendar(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, modifyEvent: function(t) {                    var r = e.defer(),                        o = { title: null, location: null, notes: null, startDate: null, endDate: null, newTitle: null, newLocation: null, newNotes: null, newStartDate: null, newEndDate: null };                    return o = angular.extend(o, t), n.plugins.calendar.modifyEvent(o.title, o.location, o.notes, new Date(o.startDate), new Date(o.endDate), o.newTitle, o.newLocation, o.newNotes, new Date(o.newStartDate), new Date(o.newEndDate), function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, deleteEvent: function(t) {                    var r = e.defer(),                        o = { newTitle: null, location: null, notes: null, startDate: null, endDate: null };                    return o = angular.extend(o, t), n.plugins.calendar.deleteEvent(o.newTitle, o.location, o.notes, new Date(o.startDate), new Date(o.endDate), function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise } } }]), angular.module("ngCordova.plugins.camera", []).factory("$cordovaCamera", ["$q", function(e) {            return { getPicture: function(n) {                    var t = e.defer();                    return navigator.camera ? (navigator.camera.getPicture(function(e) { t.resolve(e) }, function(e) { t.reject(e) }, n), t.promise) : (t.resolve(null), t.promise) }, cleanup: function() {                    var n = e.defer();                    return navigator.camera.cleanup(function() { n.resolve() }, function(e) { n.reject(e) }), n.promise } } }]), angular.module("ngCordova.plugins.capture", []).factory("$cordovaCapture", ["$q", function(e) {            return { captureAudio: function(n) {                    var t = e.defer();                    return navigator.device.capture ? (navigator.device.capture.captureAudio(function(e) { t.resolve(e) }, function(e) { t.reject(e) }, n), t.promise) : (t.resolve(null), t.promise) }, captureImage: function(n) {                    var t = e.defer();                    return navigator.device.capture ? (navigator.device.capture.captureImage(function(e) { t.resolve(e) }, function(e) { t.reject(e) }, n), t.promise) : (t.resolve(null), t.promise) }, captureVideo: function(n) {                    var t = e.defer();                    return navigator.device.capture ? (navigator.device.capture.captureVideo(function(e) { t.resolve(e) }, function(e) { t.reject(e) }, n), t.promise) : (t.resolve(null), t.promise) } } }]), angular.module("ngCordova.plugins.cardIO", []).provider("$cordovaNgCardIO", [function() {            var e = ["card_type", "redacted_card_number", "card_number", "expiry_month", "expiry_year", "short_expiry_year", "cvv", "zip"],                n = { expiry: !0, cvv: !0, zip: !1, suppressManual: !1, suppressConfirm: !1, hideLogo: !0 };            this.setCardIOResponseFields = function(n) { n && angular.isArray(n) && (e = n) }, this.setScanerConfig = function(e) { e && angular.isObject(e) && (n.expiry = e.expiry || !0, n.cvv = e.cvv || !0, n.zip = e.zip || !1, n.suppressManual = e.suppressManual || !1, n.suppressConfirm = e.suppressConfirm || !1, n.hideLogo = e.hideLogo || !0) }, this.$get = ["$q", function(t) {                return { scanCard: function() {                        var r = t.defer();                        return CardIO.scan(n, function(n) {                            if (null == n) r.reject(null);                            else {                                for (var t = {}, o = 0, i = e.length; i > o; o++) {                                    var a = e[o]; "short_expiry_year" == a ? t[a] = String(n.expiry_year).substr(2, 2) || "" : t[a] = n[a] || "" }                                r.resolve(t) } }, function() { r.reject(null) }), r.promise } } }] }]), angular.module("ngCordova.plugins.clipboard", []).factory("$cordovaClipboard", ["$q", "$window", function(e, n) {            return { copy: function(t) {                    var r = e.defer();                    return n.cordova.plugins.clipboard.copy(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, paste: function() {                    var t = e.defer();                    return n.cordova.plugins.clipboard.paste(function(e) { t.resolve(e) }, function() { t.reject() }), t.promise } } }]), angular.module("ngCordova.plugins.contacts", []).factory("$cordovaContacts", ["$q", function(e) {            return { save: function(n) {                    var t = e.defer(),                        r = navigator.contacts.create(n);                    return r.save(function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, remove: function(n) {                    var t = e.defer(),                        r = navigator.contacts.create(n);                    return r.remove(function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, clone: function(e) {                    var n = navigator.contacts.create(e);                    return n.clone(e) }, find: function(n) {                    var t = e.defer(),                        r = n.fields || ["id", "displayName"];                    return delete n.fields, 0 === Object.keys(n).length ? navigator.contacts.find(r, function(e) { t.resolve(e) }, function(e) { t.reject(e) }) : navigator.contacts.find(r, function(e) { t.resolve(e) }, function(e) { t.reject(e) }, n), t.promise }, pickContact: function() {                    var n = e.defer();                    return navigator.contacts.pickContact(function(e) { n.resolve(e) }, function(e) { n.reject(e) }), n.promise } } }]), angular.module("ngCordova.plugins.datePicker", []).factory("$cordovaDatePicker", ["$window", "$q", function(e, n) {            return { show: function(t) {                    var r = n.defer();                    return t = t || { date: new Date, mode: "date" }, e.datePicker.show(t, function(e) { r.resolve(e) }), r.promise } } }]), angular.module("ngCordova.plugins.device", []).factory("$cordovaDevice", [function() {            return { getDevice: function() {                    return device }, getCordova: function() {                    return device.cordova }, getModel: function() {                    return device.model }, getName: function() {                    return device.name }, getPlatform: function() {                    return device.platform }, getUUID: function() {                    return device.uuid }, getVersion: function() {                    return device.version }, getManufacturer: function() {                    return device.manufacturer } } }]), angular.module("ngCordova.plugins.deviceMotion", []).factory("$cordovaDeviceMotion", ["$q", function(e) {            return { getCurrentAcceleration: function() {                    var n = e.defer();                    return (angular.isUndefined(navigato.accelerometer) || !angular.isFunction(navigator.accelerometer.getCurrentAcceleration)) && n.reject("Device do not support watchAcceleration"), navigator.accelerometer.getCurrentAcceleration(function(e) { n.resolve(e) }, function(e) { n.reject(e) }), n.promise }, watchAcceleration: function(n) {                    var t = e.defer();                    (angular.isUndefined(navigato.accelerometer) || !angular.isFunction(navigator.accelerometer.watchAcceleration)) && t.reject("Device do not support watchAcceleration");                    var r = navigator.accelerometer.watchAcceleration(function(e) { t.notify(e) }, function(e) { t.reject(e) }, n);                    return t.promise.cancel = function() { navigator.accelerometer.clearWatch(r) }, t.promise.clearWatch = function(e) { navigator.accelerometer.clearWatch(e || r) }, t.promise.watchID = r, t.promise }, clearWatch: function(e) {                    return navigator.accelerometer.clearWatch(e) } } }]), angular.module("ngCordova.plugins.deviceOrientation", []).factory("$cordovaDeviceOrientation", ["$q", function(e) {            var n = { frequency: 3e3 };            return { getCurrentHeading: function() {                    var n = e.defer();                    return navigator.compass ? (navigator.compass.getCurrentHeading(function(e) { n.resolve(e) }, function(e) { n.reject(e) }), n.promise) : (n.reject("No compass on Device"), n.promise) }, watchHeading: function(t) {                    var r = e.defer();                    if (!navigator.compass) return r.reject("No compass on Device"), r.promise;                    var o = angular.extend(n, t),                        i = navigator.compass.watchHeading(function(e) { r.notify(e) }, function(e) { r.reject(e) }, o);                    return r.promise.cancel = function() { navigator.compass.clearWatch(i) }, r.promise.clearWatch = function(e) { navigator.compass.clearWatch(e || i) }, r.promise.watchID = i, r.promise }, clearWatch: function(e) {                    return navigator.compass.clearWatch(e) } } }]), angular.module("ngCordova.plugins.dialogs", []).factory("$cordovaDialogs", ["$q", "$window", function(e, n) {            return { alert: function(t, r, o) {                    var i = e.defer();                    return n.navigator.notification ? navigator.notification.alert(t, function() { i.resolve() }, r, o) : (n.alert(t), i.resolve()), i.promise }, confirm: function(t, r, o) {                    var i = e.defer();                    return n.navigator.notification ? navigator.notification.confirm(t, function(e) { i.resolve(e) }, r, o) : n.confirm(t) ? i.resolve(1) : i.resolve(2), i.promise }, prompt: function(t, r, o, i) {                    var a = e.defer();                    if (n.navigator.notification) navigator.notification.prompt(t, function(e) { a.resolve(e) }, r, o, i);                    else {                        var c = n.prompt(t, i);                        null !== c ? a.resolve({ input1: c, buttonIndex: 1 }) : a.resolve({ input1: c, buttonIndex: 2 }) }                    return a.promise }, beep: function(e) {                    return navigator.notification.beep(e) } } }]), angular.module("ngCordova.plugins.emailComposer", []).factory("$cordovaEmailComposer", ["$q", function(e) {            return { isAvailable: function() {                    var n = e.defer();                    return cordova.plugins.email.isAvailable(function(e) { e ? n.resolve() : n.reject() }), n.promise }, open: function(n) {                    var t = e.defer();                    return cordova.plugins.email.open(n, function() { t.reject() }), t.promise }, addAlias: function(e, n) { cordova.plugins.email.addAlias(e, n) } } }]), angular.module("ngCordova.plugins.facebook", []).provider("$cordovaFacebook", [function() { this.browserInit = function(e, n) { this.appID = e, this.appVersion = n || "v2.0", facebookConnectPlugin.browserInit(this.appID, this.appVersion) }, this.$get = ["$q", function(e) {                return { login: function(n) {                        var t = e.defer();                        return facebookConnectPlugin.login(n, function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, showDialog: function(n) {                        var t = e.defer();                        return facebookConnectPlugin.showDialog(n, function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, api: function(n, t) {                        var r = e.defer();                        return facebookConnectPlugin.api(n, t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, getAccessToken: function() {                        var n = e.defer();                        return facebookConnectPlugin.getAccessToken(function(e) { n.resolve(e) }, function(e) { n.reject(e) }), n.promise }, getLoginStatus: function() {                        var n = e.defer();                        return facebookConnectPlugin.getLoginStatus(function(e) { n.resolve(e) }, function(e) { n.reject(e) }), n.promise }, logout: function() {                        var n = e.defer();                        return facebookConnectPlugin.logout(function(e) { n.resolve(e) }, function(e) { n.reject(e) }), n.promise } } }] }]), angular.module("ngCordova.plugins.facebookAds", []).factory("$cordovaFacebookAds", ["$q", "$window", function(e, n) {            return { setOptions: function(t) {                    var r = e.defer();                    return n.FacebookAds.setOptions(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, createBanner: function(t) {                    var r = e.defer();                    return n.FacebookAds.createBanner(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, removeBanner: function() {                    var t = e.defer();                    return n.FacebookAds.removeBanner(function() { t.resolve() }, function() { t.reject() }), t.promise }, showBanner: function(t) {                    var r = e.defer();                    return n.FacebookAds.showBanner(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showBannerAtXY: function(t, r) {                    var o = e.defer();                    return n.FacebookAds.showBannerAtXY(t, r, function() { o.resolve() }, function() { o.reject() }), o.promise }, hideBanner: function() {                    var t = e.defer();                    return n.FacebookAds.hideBanner(function() { t.resolve() }, function() { t.reject() }), t.promise }, prepareInterstitial: function(t) {                    var r = e.defer();                    return n.FacebookAds.prepareInterstitial(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showInterstitial: function() {                    var t = e.defer();                    return n.FacebookAds.showInterstitial(function() { t.resolve() }, function() { t.reject() }), t.promise } } }]), angular.module("ngCordova.plugins.file", []).constant("$cordovaFileError", { 1: "NOT_FOUND_ERR", 2: "SECURITY_ERR", 3: "ABORT_ERR", 4: "NOT_READABLE_ERR", 5: "ENCODING_ERR", 6: "NO_MODIFICATION_ALLOWED_ERR", 7: "INVALID_STATE_ERR", 8: "SYNTAX_ERR", 9: "INVALID_MODIFICATION_ERR", 10: "QUOTA_EXCEEDED_ERR", 11: "TYPE_MISMATCH_ERR", 12: "PATH_EXISTS_ERR" }).provider("$cordovaFile", [function() {            this.$get = ["$q", "$window", "$cordovaFileError", function(e, n, t) {                return {                    getFreeDiskSpace: function() {                        var n = e.defer();                        return cordova.exec(function(e) { n.resolve(e) }, function(e) { n.reject(e) }, "File", "getFreeDiskSpace", []), n.promise },                    checkDir: function(r, o) {                        var i = e.defer(); /^\//.test(o) && i.reject("directory cannot start with /");                        try {                            var a = r + o;                            n.resolveLocalFileSystemURL(a, function(e) { e.isDirectory === !0 ? i.resolve(e) : i.reject({ code: 13, message: "input is not a directory" }) }, function(e) { e.message = t[e.code], i.reject(e) }) } catch (c) { c.message = t[c.code], i.reject(c) }                        return i.promise },                    checkFile: function(r, o) {                        var i = e.defer(); /^\//.test(o) && i.reject("directory cannot start with /");                        try {                            var a = r + o;                            n.resolveLocalFileSystemURL(a, function(e) { e.isFile === !0 ? i.resolve(e) : i.reject({ code: 13, message: "input is not a file" }) }, function(e) { e.message = t[e.code], i.reject(e) }) } catch (c) { c.message = t[c.code], i.reject(c) }                        return i.promise },                    createDir: function(r, o, i) {                        var a = e.defer(); /^\//.test(o) && a.reject("directory cannot start with /"), i = i ? !1 : !0;                        var c = { create: !0, exclusive: i };                        try { n.resolveLocalFileSystemURL(r, function(e) { e.getDirectory(o, c, function(e) { a.resolve(e) }, function(e) { e.message = t[e.code], a.reject(e) }) }, function(e) { e.message = t[e.code], a.reject(e) }) } catch (s) { s.message = t[s.code], a.reject(s) }                        return a.promise },                    createFile: function(r, o, i) {                        var a = e.defer(); /^\//.test(o) && a.reject("file-name cannot start with /"), i = i ? !1 : !0;                        var c = { create: !0, exclusive: i };                        try { n.resolveLocalFileSystemURL(r, function(e) { e.getFile(o, c, function(e) { a.resolve(e) }, function(e) { e.message = t[e.code], a.reject(e) }) }, function(e) { e.message = t[e.code], a.reject(e) }) } catch (s) { s.message = t[s.code], a.reject(s) }                        return a.promise },                    removeDir: function(r, o) {                        var i = e.defer(); /^\//.test(o) && i.reject("file-name cannot start with /");                        try { n.resolveLocalFileSystemURL(r, function(e) { e.getDirectory(o, { create: !1 }, function(e) { e.remove(function() { i.resolve({ success: !0, fileRemoved: e }) }, function(e) { e.message = t[e.code], i.reject(e) }) }, function(e) { e.message = t[e.code], i.reject(e) }) }, function(e) { e.message = t[e.code], i.reject(e) }) } catch (a) { a.message = t[a.code], i.reject(a) }                        return i.promise },                    removeFile: function(r, o) {                        var i = e.defer(); /^\//.test(o) && i.reject("file-name cannot start with /");                        try { n.resolveLocalFileSystemURL(r, function(e) { e.getFile(o, { create: !1 }, function(e) { e.remove(function() { i.resolve({ success: !0, fileRemoved: e }) }, function(e) { e.message = t[e.code], i.reject(e) }) }, function(e) { e.message = t[e.code], i.reject(e) }) }, function(e) { e.message = t[e.code], i.reject(e) }) } catch (a) { a.message = t[a.code], i.reject(a) }                        return i.promise },                    removeRecursively: function(r, o) {                        var i = e.defer(); /^\//.test(o) && i.reject("file-name cannot start with /");                        try { n.resolveLocalFileSystemURL(r, function(e) { e.getDirectory(o, { create: !1 }, function(e) { e.removeRecursively(function() { i.resolve({ success: !0, fileRemoved: e }) }, function(e) { e.message = t[e.code], i.reject(e) }) }, function(e) { e.message = t[e.code], i.reject(e) }) }, function(e) { e.message = t[e.code], i.reject(e) }) } catch (a) { a.message = t[a.code], i.reject(a) }                        return i.promise },                    writeFile: function(r, o, i, a) {                        var c = e.defer(); /^\//.test(o) && c.reject("file-name cannot start with /"), a = a ? !1 : !0;                        var s = { create: !0, exclusive: a };                        try { n.resolveLocalFileSystemURL(r, function(e) { e.getFile(o, s, function(e) { e.createWriter(function(e) { s.append === !0 && e.seek(e.length), s.truncate && e.truncate(s.truncate), e.onwriteend = function(e) { this.error ? c.reject(this.error) : c.resolve(e) }, e.write(i), c.promise.abort = function() { e.abort() } }) }, function(e) { e.message = t[e.code], c.reject(e) }) }, function(e) { e.message = t[e.code], c.reject(e) }) } catch (u) { u.message = t[u.code], c.reject(u) }                        return c.promise },                    writeExistingFile: function(r, o, i) {                        var a = e.defer(); /^\//.test(o) && a.reject("file-name cannot start with /");                        try { n.resolveLocalFileSystemURL(r, function(e) { e.getFile(o, { create: !1 }, function(e) { e.createWriter(function(e) { e.seek(e.length), e.onwriteend = function(e) { this.error ? a.reject(this.error) : a.resolve(e) }, e.write(i), a.promise.abort = function() { e.abort() } }) }, function(e) { e.message = t[e.code], a.reject(e) }) }, function(e) { e.message = t[e.code], a.reject(e) }) } catch (c) { c.message = t[c.code], a.reject(c) }                        return a.promise },                    readAsText: function(r, o) {                        var i = e.defer(); /^\//.test(o) && i.reject("file-name cannot start with /");                        try { n.resolveLocalFileSystemURL(r, function(e) { e.getFile(o, { create: !1 }, function(e) { e.file(function(e) {                                        var n = new FileReader;                                        n.onloadend = function(e) { void 0 !== e.target.result || null !== e.target.result ? i.resolve(e.target.result) : void 0 !== e.target.error || null !== e.target.error ? i.reject(e.target.error) : i.reject({ code: null, message: "READER_ONLOADEND_ERR" }) }, n.readAsText(e) }) }, function(e) { e.message = t[e.code], i.reject(e) }) }, function(e) { e.message = t[e.code], i.reject(e) }) } catch (a) { a.message = t[a.code], i.reject(a) }                        return i.promise },                    readAsDataURL: function(r, o) {                        var i = e.defer(); /^\//.test(o) && i.reject("file-name cannot start with /");                        try { n.resolveLocalFileSystemURL(r, function(e) { e.getFile(o, { create: !1 }, function(e) { e.file(function(e) {                                        var n = new FileReader;                                        n.onloadend = function(e) { void 0 !== e.target.result || null !== e.target.result ? i.resolve(e.target.result) : void 0 !== e.target.error || null !== e.target.error ? i.reject(e.target.error) : i.reject({ code: null, message: "READER_ONLOADEND_ERR" }) }, n.readAsDataURL(e) }) }, function(e) { e.message = t[e.code], i.reject(e) }) }, function(e) { e.message = t[e.code], i.reject(e) }) } catch (a) { a.message = t[a.code], i.reject(a) }                        return i.promise },                    readAsBinaryString: function(r, o) {                        var i = e.defer(); /^\//.test(o) && i.reject("file-name cannot start with /");                        try { n.resolveLocalFileSystemURL(r, function(e) { e.getFile(o, { create: !1 }, function(e) { e.file(function(e) {                                        var n = new FileReader;                                        n.onloadend = function(e) { void 0 !== e.target.result || null !== e.target.result ? i.resolve(e.target.result) : void 0 !== e.target.error || null !== e.target.error ? i.reject(e.target.error) : i.reject({ code: null, message: "READER_ONLOADEND_ERR" }) }, n.readAsBinaryString(e) }) }, function(e) { e.message = t[e.code], i.reject(e) }) }, function(e) { e.message = t[e.code], i.reject(e) }) } catch (a) { a.message = t[a.code], i.reject(a) }                        return i.promise },                    readAsArrayBuffer: function(r, o) {                        var i = e.defer(); /^\//.test(o) && i.reject("file-name cannot start with /");                        try { n.resolveLocalFileSystemURL(r, function(e) { e.getFile(o, { create: !1 }, function(e) { e.file(function(e) {                                        var n = new FileReader;                                        n.onloadend = function(e) { void 0 !== e.target.result || null !== e.target.result ? i.resolve(e.target.result) : void 0 !== e.target.error || null !== e.target.error ? i.reject(e.target.error) : i.reject({ code: null, message: "READER_ONLOADEND_ERR" }) }, n.readAsArrayBuffer(e) }) }, function(e) { e.message = t[e.code], i.reject(e) }) }, function(e) { e.message = t[e.code], i.reject(e) }) } catch (a) { a.message = t[a.code], i.reject(a) }                        return i.promise },                    moveFile: function(t, r, o, i) {                        var a = e.defer();                        i = i || r, (/^\//.test(r) || /^\//.test(i)) && a.reject("file-name cannot start with /");                        try {                            n.resolveLocalFileSystemURL(t, function(e) { e.getFile(r, { create: !1 }, function(e) { n.resolveLocalFileSystemURL(o, function(n) { e.moveTo(n, i, function(e) { a.resolve(e) }, function(e) { a.reject(e) }) }, function(e) { a.reject(e) }) }, function(e) { a.reject(e) }) }, function(e) {                                a.reject(e);                            })                        } catch (c) { a.reject(c) }                        return a.promise                    },                    moveDir: function(t, r, o, i) {                        var a = e.defer();                        i = i || r, (/^\//.test(r) || /^\//.test(i)) && a.reject("file-name cannot start with /");                        try { n.resolveLocalFileSystemURL(t, function(e) { e.getDirectory(r, { create: !1 }, function(e) { n.resolveLocalFileSystemURL(o, function(n) { e.moveTo(n, i, function(e) { a.resolve(e) }, function(e) { a.reject(e) }) }, function(e) { a.reject(e) }) }, function(e) { a.reject(e) }) }, function(e) { a.reject(e) }) } catch (c) { a.reject(c) }                        return a.promise },                    copyDir: function(r, o, i, a) {                        var c = e.defer();                        a = a || o, (/^\//.test(o) || /^\//.test(a)) && c.reject("file-name cannot start with /");                        try { n.resolveLocalFileSystemURL(r, function(e) { e.getDirectory(o, { create: !1, exclusive: !1 }, function(e) { n.resolveLocalFileSystemURL(i, function(n) { e.copyTo(n, a, function(e) { c.resolve(e) }, function(e) { e.message = t[e.code], c.reject(e) }) }, function(e) { e.message = t[e.code], c.reject(e) }) }, function(e) { e.message = t[e.code], c.reject(e) }) }, function(e) { e.message = t[e.code], c.reject(e) }) } catch (s) { s.message = t[s.code], c.reject(s) }                        return c.promise },                    copyFile: function(r, o, i, a) {                        var c = e.defer();                        a = a || o, /^\//.test(o) && c.reject("file-name cannot start with /");                        try { n.resolveLocalFileSystemURL(r, function(e) { e.getFile(o, { create: !1, exclusive: !1 }, function(e) { n.resolveLocalFileSystemURL(i, function(n) { e.copyTo(n, a, function(e) { c.resolve(e) }, function(e) { e.message = t[e.code], c.reject(e) }) }, function(e) { e.message = t[e.code], c.reject(e) }) }, function(e) { e.message = t[e.code], c.reject(e) }) }, function(e) { e.message = t[e.code], c.reject(e) }) } catch (s) { s.message = t[s.code], c.reject(s) }                        return c.promise }                }            }]        }]), angular.module("ngCordova.plugins.fileOpener2", []).factory("$cordovaFileOpener2", ["$q", function(e) {            return { open: function(n, t) {                    var r = e.defer();                    return cordova.plugins.fileOpener2.open(n, t, { error: function(e) { r.reject(e) }, success: function() { r.resolve() } }), r.promise }, uninstall: function(n) {                    var t = e.defer();                    return cordova.plugins.fileOpener2.uninstall(n, { error: function(e) { t.reject(e) }, success: function() { t.resolve() } }), t.promise }, appIsInstalled: function(n) {                    var t = e.defer();                    return cordova.plugins.fileOpener2.appIsInstalled(n, { success: function(e) { t.resolve(e) } }), t.promise } } }]), angular.module("ngCordova.plugins.fileTransfer", []).factory("$cordovaFileTransfer", ["$q", "$timeout", function(e, n) {            return { download: function(t, r, o, i) {                    var a = e.defer(),                        c = new FileTransfer,                        s = o && o.encodeURI === !1 ? t : encodeURI(t);                    return o && void 0 !== o.timeout && null !== o.timeout && (n(function() { c.abort() }, o.timeout), o.timeout = null), c.onprogress = function(e) { a.notify(e) }, a.promise.abort = function() { c.abort() }, c.download(s, r, a.resolve, a.reject, i, o), a.promise }, upload: function(t, r, o, i) {                    var a = e.defer(),                        c = new FileTransfer,                        s = o && o.encodeURI === !1 ? t : encodeURI(t);                    return o && void 0 !== o.timeout && null !== o.timeout && (n(function() { c.abort() }, o.timeout), o.timeout = null), c.onprogress = function(e) { a.notify(e) }, a.promise.abort = function() { c.abort() }, c.upload(r, s, a.resolve, a.reject, o, i), a.promise } } }]), angular.module("ngCordova.plugins.flashlight", []).factory("$cordovaFlashlight", ["$q", "$window", function(e, n) {            return { available: function() {                    var t = e.defer();                    return n.plugins.flashlight.available(function(e) { t.resolve(e) }), t.promise }, switchOn: function() {                    var t = e.defer();                    return n.plugins.flashlight.switchOn(function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, switchOff: function() {                    var t = e.defer();                    return n.plugins.flashlight.switchOff(function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, toggle: function() {                    var t = e.defer();                    return n.plugins.flashlight.toggle(function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise } } }]), angular.module("ngCordova.plugins.flurryAds", []).factory("$cordovaFlurryAds", ["$q", "$window", function(e, n) {            return { setOptions: function(t) {                    var r = e.defer();                    return n.FlurryAds.setOptions(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, createBanner: function(t) {                    var r = e.defer();                    return n.FlurryAds.createBanner(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, removeBanner: function() {                    var t = e.defer();                    return n.FlurryAds.removeBanner(function() { t.resolve() }, function() { t.reject() }), t.promise }, showBanner: function(t) {                    var r = e.defer();                    return n.FlurryAds.showBanner(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showBannerAtXY: function(t, r) {                    var o = e.defer();                    return n.FlurryAds.showBannerAtXY(t, r, function() { o.resolve() }, function() { o.reject() }), o.promise }, hideBanner: function() {                    var t = e.defer();                    return n.FlurryAds.hideBanner(function() { t.resolve() }, function() { t.reject() }), t.promise }, prepareInterstitial: function(t) {                    var r = e.defer();                    return n.FlurryAds.prepareInterstitial(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showInterstitial: function() {                    var t = e.defer();                    return n.FlurryAds.showInterstitial(function() { t.resolve() }, function() { t.reject() }), t.promise } } }]), angular.module("ngCordova.plugins.ga", []).factory("$cordovaGA", ["$q", "$window", function(e, n) {            return { init: function(t, r) {                    var o = e.defer();                    return r = r >= 0 ? r : 10, n.plugins.gaPlugin.init(function(e) { o.resolve(e) }, function(e) { o.reject(e) }, t, r), o.promise }, trackEvent: function(t, r, o, i, a, c) {                    var s = e.defer();                    return n.plugins.gaPlugin.trackEvent(function(e) { s.resolve(e) }, function(e) { s.reject(e) }, o, i, a, c), s.promise }, trackPage: function(t, r, o) {                    var i = e.defer();                    return n.plugins.gaPlugin.trackPage(function(e) { i.resolve(e) }, function(e) { i.reject(e) }, o), i.promise }, setVariable: function(t, r, o, i) {                    var a = e.defer();                    return n.plugins.gaPlugin.setVariable(function(e) { a.resolve(e) }, function(e) { a.reject(e) }, o, i), a.promise }, exit: function(t, r) {                    var o = e.defer();                    return n.plugins.gaPlugin.exit(function(e) { o.resolve(e) }, function(e) { o.reject(e) }), o.promise } } }]), angular.module("ngCordova.plugins.geolocation", []).factory("$cordovaGeolocation", ["$q", function(e) {            return { getCurrentPosition: function(n) {                    var t = e.defer();                    return navigator.geolocation.getCurrentPosition(function(e) { t.resolve(e) }, function(e) { t.reject(e) }, n), t.promise }, watchPosition: function(n) {                    var t = e.defer(),                        r = navigator.geolocation.watchPosition(function(e) { t.notify(e) }, function(e) { t.reject(e) }, n);                    return t.promise.cancel = function() { navigator.geolocation.clearWatch(r) }, t.promise.clearWatch = function(e) { navigator.geolocation.clearWatch(e || r) }, t.promise.watchID = r, t.promise }, clearWatch: function(e) {                    return navigator.geolocation.clearWatch(e) } } }]), angular.module("ngCordova.plugins.globalization", []).factory("$cordovaGlobalization", ["$q", function(e) {            return { getPreferredLanguage: function() {                    var n = e.defer();                    return navigator.globalization.getPreferredLanguage(function(e) { n.resolve(e) }, function(e) { n.reject(e) }), n.promise }, getLocaleName: function() {                    var n = e.defer();                    return navigator.globalization.getLocaleName(function(e) { n.resolve(e) }, function(e) { n.reject(e) }), n.promise }, getFirstDayOfWeek: function() {                    var n = e.defer();                    return navigator.globalization.getFirstDayOfWeek(function(e) { n.resolve(e) }, function(e) { n.reject(e) }), n.promise }, dateToString: function(n, t) {                    var r = e.defer();                    return navigator.globalization.dateToString(n, function(e) { r.resolve(e) }, function(e) { r.reject(e) }, t), r.promise }, stringToDate: function(n, t) {                    var r = e.defer();                    return navigator.globalization.stringToDate(n, function(e) { r.resolve(e) }, function(e) { r.reject(e) }, t), r.promise }, getDatePattern: function(n) {                    var t = e.defer();                    return navigator.globalization.getDatePattern(function(e) { t.resolve(e) }, function(e) { t.reject(e) }, n), t.promise }, getDateNames: function(n) {                    var t = e.defer();                    return navigator.globalization.getDateNames(function(e) { t.resolve(e) }, function(e) { t.reject(e) }, n), t.promise }, isDayLightSavingsTime: function(n) {                    var t = e.defer();                    return navigator.globalization.isDayLightSavingsTime(n, function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, numberToString: function(n, t) {                    var r = e.defer();                    return navigator.globalization.numberToString(n, function(e) { r.resolve(e) }, function(e) { r.reject(e) }, t), r.promise }, stringToNumber: function(n, t) {                    var r = e.defer();                    return navigator.globalization.stringToNumber(n, function(e) { r.resolve(e) }, function(e) { r.reject(e) }, t), r.promise }, getNumberPattern: function(n) {                    var t = e.defer();                    return navigator.globalization.getNumberPattern(function(e) { t.resolve(e) }, function(e) { t.reject(e) }, n), t.promise }, getCurrencyPattern: function(n) {                    var t = e.defer();                    return navigator.globalization.getCurrencyPattern(n, function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise } } }]), angular.module("ngCordova.plugins.googleAds", []).factory("$cordovaGoogleAds", ["$q", "$window", function(e, n) {            return { setOptions: function(t) {                    var r = e.defer();                    return n.AdMob.setOptions(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, createBanner: function(t) {                    var r = e.defer();                    return n.AdMob.createBanner(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, removeBanner: function() {                    var t = e.defer();                    return n.AdMob.removeBanner(function() { t.resolve() }, function() { t.reject() }), t.promise }, showBanner: function(t) {                    var r = e.defer();                    return n.AdMob.showBanner(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showBannerAtXY: function(t, r) {                    var o = e.defer();                    return n.AdMob.showBannerAtXY(t, r, function() { o.resolve() }, function() { o.reject() }), o.promise }, hideBanner: function() {                    var t = e.defer();                    return n.AdMob.hideBanner(function() { t.resolve() }, function() { t.reject() }), t.promise }, prepareInterstitial: function(t) {                    var r = e.defer();                    return n.AdMob.prepareInterstitial(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showInterstitial: function() {                    var t = e.defer();                    return n.AdMob.showInterstitial(function() { t.resolve() }, function() { t.reject() }), t.promise } } }]), angular.module("ngCordova.plugins.googleAnalytics", []).factory("$cordovaGoogleAnalytics", ["$q", "$window", function(e, n) {            return { startTrackerWithId: function(t) {                    var r = e.defer();                    return n.analytics.startTrackerWithId(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, setUserId: function(t) {                    var r = e.defer();                    return n.analytics.setUserId(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, debugMode: function() {                    var t = e.defer();                    return n.analytics.debugMode(function(e) { t.resolve(e) }, function() { t.reject() }), t.promise }, trackView: function(t) {                    var r = e.defer();                    return n.analytics.trackView(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, addCustomDimension: function(t, r) {                    var o = e.defer();                    return n.analytics.addCustomDimension(t, r, function() { o.resolve() }, function(e) { o.reject(e) }), o.promise }, trackEvent: function(t, r, o, i) {                    var a = e.defer();                    return n.analytics.trackEvent(t, r, o, i, function(e) { a.resolve(e) }, function(e) { a.reject(e) }), a.promise }, trackException: function(t, r) {                    var o = e.defer();                    return n.analytics.trackException(t, r, function(e) { o.resolve(e) }, function(e) { o.reject(e) }), o.promise }, trackTiming: function(t, r, o, i) {                    var a = e.defer();                    return n.analytics.trackTiming(t, r, o, i, function(e) { a.resolve(e) }, function(e) { a.reject(e) }), a.promise }, addTransaction: function(t, r, o, i, a, c) {                    var s = e.defer();                    return n.analytics.addTransaction(t, r, o, i, a, c, function(e) { s.resolve(e) }, function(e) { s.reject(e) }), s.promise }, addTransactionItem: function(t, r, o, i, a, c, s) {                    var u = e.defer();                    return n.analytics.addTransactionItem(t, r, o, i, a, c, s, function(e) { u.resolve(e) }, function(e) { u.reject(e) }), u.promise } } }]), angular.module("ngCordova.plugins.googleMap", []).factory("$cordovaGoogleMap", ["$q", "$window", function(e, n) {            var t = null;            return { getMap: function(r) {                    var o = e.defer();                    if (n.plugin.google.maps) {                        var i = document.getElementById("map_canvas");                        t = n.plugin.google.maps.Map.getMap(r), t.setDiv(i), o.resolve(t) } else o.reject(null);                    return o.promise }, isMapLoaded: function() {                    return !!t }, addMarker: function(n) {                    var r = e.defer();                    return t.addMarker(n, function(e) { r.resolve(e) }), r.promise }, getMapTypeIds: function() {                    return n.plugin.google.maps.mapTypeId }, setVisible: function(n) {                    var r = e.defer();                    return t.setVisible(n), r.promise }, cleanup: function() { t = null } } }]), angular.module("ngCordova.plugins.googlePlayGame", []).factory("$cordovaGooglePlayGame", ["$q", function(e) {            return { auth: function() {                    var n = e.defer();                    return googleplaygame.auth(function(e) {                        return n.resolve(e) }, function(e) {                        return n.reject(e) }), n.promise }, signout: function() {                    var n = e.defer();                    return googleplaygame.signout(function(e) {                        return n.resolve(e) }, function(e) {                        return n.reject(e) }), n.promise }, isSignedIn: function() {                    var n = e.defer();                    return googleplaygame.isSignedIn(function(e) {                        return n.resolve(e) }, function(e) {                        return n.reject(e) }), n.promise }, showPlayer: function() {                    var n = e.defer();                    return googleplaygame.showPlayer(function(e) {                        return n.resolve(e) }, function(e) {                        return n.reject(e) }), n.promise }, submitScore: function(n) {                    var t = e.defer();                    return googleplaygame.submitScore(n, function(e) {                        return t.resolve(e) }, function(e) {                        return t.reject(e) }), t.promise }, showAllLeaderboards: function() {                    var n = e.defer();                    return googleplaygame.showAllLeaderboards(function(e) {                        return n.resolve(e) }, function(e) {                        return n.reject(e) }), n.promise }, showLeaderboard: function(n) {                    var t = e.defer();                    return googleplaygame.showLeaderboard(n, function(e) {                        return t.resolve(e) }, function(e) {                        return t.reject(e) }), t.promise }, unlockAchievement: function(n) {                    var t = e.defer();                    return googleplaygame.unlockAchievement(n, function(e) {                        return t.resolve(e) }, function(e) {                        return t.reject(e) }), t.promise }, incrementAchievement: function(n) {                    var t = e.defer();                    return googleplaygame.incrementAchievement(n, function(e) {                        return t.resolve(e) }, function(e) {                        return t.reject(e) }), t.promise }, showAchievements: function() {                    var n = e.defer();                    return googleplaygame.showAchievements(function(e) {                        return n.resolve(e) }, function(e) {                        return n.reject(e) }), n.promise } } }]), angular.module("ngCordova.plugins.googlePlus", []).factory("$cordovaGooglePlus", ["$q", "$window", function(e, n) {            return { login: function(t) {                    var r = e.defer();                    return void 0 === t && (t = {}), n.plugins.googleplus.login({ iOSApiKey: t }, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, silentLogin: function(t) {                    var r = e.defer();                    return void 0 === t && (t = {}), n.plugins.googleplus.trySilentLogin({ iOSApiKey: t }, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, logout: function() {                    var t = e.defer();                    n.plugins.googleplus.logout(function(e) { t.resolve(e) }) }, disconnect: function() {                    var t = e.defer();                    n.plugins.googleplus.disconnect(function(e) { t.resolve(e) }) }, isAvailable: function() {                    var t = e.defer();                    return n.plugins.googleplus.isAvailable(function(e) { e ? t.resolve(e) : t.reject(e) }), t.promise } } }]), angular.module("ngCordova.plugins.healthKit", []).factory("$cordovaHealthKit", ["$q", "$window", function(e, n) {            return { isAvailable: function() {                    var t = e.defer();                    return n.plugins.healthkit.available(function(e) { t.resolve(e) }, function(e) { t.reject(e) }), t.promise }, checkAuthStatus: function(t) {                    var r = e.defer();                    return t = t || "HKQuantityTypeIdentifierHeight", n.plugins.healthkit.checkAuthStatus({ type: t }, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, requestAuthorization: function(t, r) {                    var o = e.defer();                    return t = t || ["HKCharacteristicTypeIdentifierDateOfBirth", "HKQuantityTypeIdentifierActiveEnergyBurned", "HKQuantityTypeIdentifierHeight"], r = r || ["HKQuantityTypeIdentifierActiveEnergyBurned", "HKQuantityTypeIdentifierHeight", "HKQuantityTypeIdentifierDistanceCycling"], n.plugins.healthkit.requestAuthorization({ readTypes: t, writeTypes: r }, function(e) { o.resolve(e) }, function(e) { o.reject(e) }), o.promise }, readDateOfBirth: function() {                    var t = e.defer();                    return n.plugins.healthkit.readDateOfBirth(function(e) { t.resolve(e) }, function(e) { t.resolve(e) }), t.promise }, readGender: function() {                    var t = e.defer();                    return n.plugins.healthkit.readGender(function(e) { t.resolve(e) }, function(e) { t.resolve(e) }), t.promise }, saveWeight: function(t, r, o) {                    var i = e.defer();                    return n.plugins.healthkit.saveWeight({ unit: r || "lb", amount: t, date: o || new Date }, function(e) { i.resolve(e) }, function(e) { i.resolve(e) }), i.promise }, readWeight: function(t) {                    var r = e.defer();                    return n.plugins.healthkit.readWeight({ unit: t || "lb" }, function(e) { r.resolve(e) }, function(e) { r.resolve(e) }), r.promise }, saveHeight: function(t, r, o) {                    var i = e.defer();                    return n.plugins.healthkit.saveHeight({ unit: r || "in", amount: t, date: o || new Date }, function(e) { i.resolve(e) }, function(e) { i.resolve(e) }), i.promise }, readHeight: function(t) {                    var r = e.defer();                    return n.plugins.healthkit.readHeight({ unit: t || "in" }, function(e) { r.resolve(e) }, function(e) { r.resolve(e) }), r.promise }, findWorkouts: function() {                    var t = e.defer();                    return n.plugins.healthkit.findWorkouts({}, function(e) { t.resolve(e) }, function(e) { t.resolve(e) }), t.promise }, saveWorkout: function(t) {                    var r = e.defer();                    return n.plugins.healthkit.saveWorkout(t, function(e) { r.resolve(e) }, function(e) { r.resolve(e) }), r.promise }, querySampleType: function(t) {                    var r = e.defer();                    return n.plugins.healthkit.querySampleType(t, function(e) { r.resolve(e) }, function(e) { r.resolve(e) }), r.promise } } }]), angular.module("ngCordova.plugins.httpd", []).factory("$cordovaHttpd", ["$q", function(e) {            return { startServer: function(n) {                    var t = e.defer();                    return cordova.plugins.CorHttpd.startServer(n, function() { t.resolve() }, function() { t.reject() }), t.promise }, stopServer: function() {                    var n = e.defer();                    return cordova.plugins.CorHttpd.stopServer(function() { n.resolve() }, function() { n.reject() }), n.promise }, getURL: function() {                    var n = e.defer();                    return cordova.plugins.CorHttpd.getURL(function(e) { n.resolve(e) }, function() { n.reject() }), n.promise }, getLocalPath: function() {                    var n = e.defer();                    return cordova.plugins.CorHttpd.getLocalPath(function(e) { n.resolve(e) }, function() { n.reject() }), n.promise } } }]), angular.module("ngCordova.plugins.iAd", []).factory("$cordovaiAd", ["$q", "$window", function(e, n) {            return { setOptions: function(t) {                    var r = e.defer();                    return n.iAd.setOptions(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, createBanner: function(t) {                    var r = e.defer();                    return n.iAd.createBanner(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, removeBanner: function() {                    var t = e.defer();                    return n.iAd.removeBanner(function() { t.resolve() }, function() { t.reject() }), t.promise }, showBanner: function(t) {                    var r = e.defer();                    return n.iAd.showBanner(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showBannerAtXY: function(t, r) {                    var o = e.defer();                    return n.iAd.showBannerAtXY(t, r, function() { o.resolve() }, function() { o.reject() }), o.promise }, hideBanner: function() {                    var t = e.defer();                    return n.iAd.hideBanner(function() { t.resolve() }, function() { t.reject() }), t.promise }, prepareInterstitial: function(t) {                    var r = e.defer();                    return n.iAd.prepareInterstitial(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showInterstitial: function() {                    var t = e.defer();                    return n.iAd.showInterstitial(function() { t.resolve() }, function() { t.reject() }), t.promise } } }]), angular.module("ngCordova.plugins.imagePicker", []).factory("$cordovaImagePicker", ["$q", "$window", function(e, n) {            return { getPictures: function(t) {                    var r = e.defer();                    return n.imagePicker.getPictures(function(e) { r.resolve(e) }, function(e) { r.reject(e) }, t), r.promise } } }]), angular.module("ngCordova.plugins.inAppBrowser", []).provider("$cordovaInAppBrowser", [function() {            var e, n = this.defaultOptions = {};            this.setDefaultOptions = function(e) { n = angular.extend(n, e) }, this.$get = ["$rootScope", "$q", "$window", "$timeout", function(t, r, o, i) {                return { open: function(a, c, s) {                        var u = r.defer();                        if (s && !angular.isObject(s)) return u.reject("options must be an object"), u.promise;                        var l = angular.extend({}, n, s),                            d = [];                        angular.forEach(l, function(e, n) { d.push(n + "=" + e) });                        var f = d.join();                        return e = o.open(a, c, f), e.addEventListener("loadstart", function(e) { i(function() { t.$broadcast("$cordovaInAppBrowser:loadstart", e) }) }, !1), e.addEventListener("loadstop", function(e) { u.resolve(e), i(function() { t.$broadcast("$cordovaInAppBrowser:loadstop", e) }) }, !1), e.addEventListener("loaderror", function(e) { u.reject(e), i(function() { t.$broadcast("$cordovaInAppBrowser:loaderror", e) }) }, !1), e.addEventListener("exit", function(e) { i(function() { t.$broadcast("$cordovaInAppBrowser:exit", e) }) }, !1), u.promise }, close: function() { e.close(), e = null }, show: function() { e.show() }, executeScript: function(n) {                        var t = r.defer();                        return e.executeScript(n, function(e) { t.resolve(e) }), t.promise }, insertCSS: function(n) {                        var t = r.defer();                        return e.insertCSS(n, function(e) { t.resolve(e) }), t.promise } } }] }]), angular.module("ngCordova.plugins.insomnia", []).factory("$cordovaInsomnia", ["$window", function(e) {            return { keepAwake: function() {                    return e.plugins.insomnia.keepAwake() }, allowSleepAgain: function() {                    return e.plugins.insomnia.allowSleepAgain() } } }]), angular.module("ngCordova.plugins.instagram", []).factory("$cordovaInstagram", ["$q", function(e) {            return { share: function(n) {                    var t = e.defer();                    return window.Instagram ? (Instagram.share(n.image, n.caption, function(e) { e ? t.reject(e) : t.resolve(!0) }), t.promise) : (console.error("Tried to call Instagram.share but the Instagram plugin isn't installed!"), t.resolve(null), t.promise) }, isInstalled: function() {                    var n = e.defer();                    return window.Instagram ? (Instagram.isInstalled(function(e, t) { e ? n.reject(e) : n.resolve(t || !0) }), n.promise) : (console.error("Tried to call Instagram.isInstalled but the Instagram plugin isn't installed!"), n.resolve(null), n.promise) } } }]), angular.module("ngCordova.plugins.keyboard", []).factory("$cordovaKeyboard", ["$rootScope", function(e) {            var n = function() { e.$evalAsync(function() { e.$broadcast("$cordovaKeyboard:show") }) },                t = function() { e.$evalAsync(function() { e.$broadcast("$cordovaKeyboard:hide") }) };            return document.addEventListener("deviceready", function() { cordova.plugins.Keyboard && (window.addEventListener("native.keyboardshow", n, !1), window.addEventListener("native.keyboardhide", t, !1)) }), { hideAccessoryBar: function(e) {                    return cordova.plugins.Keyboard.hideKeyboardAccessoryBar(e) }, close: function() {                    return cordova.plugins.Keyboard.close() }, show: function() {                    return cordova.plugins.Keyboard.show() }, disableScroll: function(e) {                    return cordova.plugins.Keyboard.disableScroll(e) }, isVisible: function() {                    return cordova.plugins.Keyboard.isVisible }, clearShowWatch: function() { document.removeEventListener("native.keyboardshow", n), e.$$listeners["$cordovaKeyboard:show"] = [] }, clearHideWatch: function() { document.removeEventListener("native.keyboardhide", t), e.$$listeners["$cordovaKeyboard:hide"] = [] } } }]), angular.module("ngCordova.plugins.keychain", []).factory("$cordovaKeychain", ["$q", function(e) {            return { getForKey: function(n, t) {                    var r = e.defer(),                        o = new Keychain;                    return o.getForKey(r.resolve, r.reject, n, t), r.promise }, setForKey: function(n, t, r) {                    var o = e.defer(),                        i = new Keychain;                    return i.setForKey(o.resolve, o.reject, n, t, r), o.promise }, removeForKey: function(n, t) {                    var r = e.defer(),                        o = new Keychain;                    return o.removeForKey(r.resolve, r.reject, n, t), r.promise } } }]), angular.module("ngCordova.plugins.launchNavigator", []).factory("$cordovaLaunchNavigator", ["$q", function(e) {            return { navigate: function(n, t, r, o, i) {                    var a = e.defer();                    return launchnavigator.navigate(n, t, function() { a.resolve() }, function(e) { a.reject(e) }, i), a.promise } } }]), angular.module("ngCordova.plugins.localNotification", []).factory("$cordovaLocalNotification", ["$q", "$window", "$rootScope", "$timeout", function(e, n, t, r) {            return document.addEventListener("deviceready", function() { n.cordova && n.cordova.plugins && n.cordova.plugins.notification && n.cordova.plugins.notification.local && (n.cordova.plugins.notification.local.on("schedule", function(e, n) { r(function() { t.$broadcast("$cordovaLocalNotification:schedule", e, n) }) }), n.cordova.plugins.notification.local.on("trigger", function(e, n) { r(function() { t.$broadcast("$cordovaLocalNotification:trigger", e, n) }) }), n.cordova.plugins.notification.local.on("update", function(e, n) { r(function() { t.$broadcast("$cordovaLocalNotification:update", e, n) }) }), n.cordova.plugins.notification.local.on("clear", function(e, n) { r(function() { t.$broadcast("$cordovaLocalNotification:clear", e, n) }) }), n.cordova.plugins.notification.local.on("clearall", function(e) { r(function() { t.$broadcast("$cordovaLocalNotification:clearall", e) }) }), n.cordova.plugins.notification.local.on("cancel", function(e, n) { r(function() { t.$broadcast("$cordovaLocalNotification:cancel", e, n) }) }), n.cordova.plugins.notification.local.on("cancelall", function(e) { r(function() { t.$broadcast("$cordovaLocalNotification:cancelall", e) }) }), n.cordova.plugins.notification.local.on("click", function(e, n) { r(function() { t.$broadcast("$cordovaLocalNotification:click", e, n) }) })) }, !1), { schedule: function(t, r) {                    var o = e.defer();                    return r = r || null, n.cordova.plugins.notification.local.schedule(t, function(e) { o.resolve(e) }, r), o.promise }, add: function(t, r) { console.warn('Deprecated: use "schedule" instead.');                    var o = e.defer();                    return r = r || null, n.cordova.plugins.notification.local.schedule(t, function(e) { o.resolve(e) }, r), o.promise }, update: function(t, r) {                    var o = e.defer();                    return r = r || null, n.cordova.plugins.notification.local.update(t, function(e) { o.resolve(e) }, r), o.promise }, clear: function(t, r) {                    var o = e.defer();                    return r = r || null, n.cordova.plugins.notification.local.clear(t, function(e) { o.resolve(e) }, r), o.promise }, clearAll: function(t) {                    var r = e.defer();                    return t = t || null, n.cordova.plugins.notification.local.clearAll(function(e) { r.resolve(e) }, t), r.promise }, cancel: function(t, r) {                    var o = e.defer();                    return r = r || null, n.cordova.plugins.notification.local.cancel(t, function(e) { o.resolve(e) }, r), o.promise }, cancelAll: function(t) {                    var r = e.defer();                    return t = t || null, n.cordova.plugins.notification.local.cancelAll(function(e) { r.resolve(e) }, t), r.promise }, isPresent: function(t, r) {                    var o = e.defer();                    return r = r || null, n.cordova.plugins.notification.local.isPresent(t, function(e) { o.resolve(e) }, r), o.promise }, isScheduled: function(t, r) {                    var o = e.defer();                    return r = r || null, n.cordova.plugins.notification.local.isScheduled(t, function(e) { o.resolve(e) }, r), o.promise }, isTriggered: function(t, r) {                    var o = e.defer();                    return r = r || null, n.cordova.plugins.notification.local.isTriggered(t, function(e) { o.resolve(e) }, r), o.promise }, hasPermission: function(t) {                    var r = e.defer();                    return t = t || null, n.cordova.plugins.notification.local.hasPermission(function(e) { e ? r.resolve(e) : r.reject(e) }, t), r.promise }, registerPermission: function(t) {                    var r = e.defer();                    return t = t || null, n.cordova.plugins.notification.local.registerPermission(function(e) { e ? r.resolve(e) : r.reject(e) }, t), r.promise }, promptForPermission: function(t) { console.warn('Deprecated: use "registerPermission" instead.');                    var r = e.defer();                    return t = t || null, n.cordova.plugins.notification.local.registerPermission(function(e) { e ? r.resolve(e) : r.reject(e) }, t), r.promise }, getAllIds: function(t) {                    var r = e.defer();                    return t = t || null, n.cordova.plugins.notification.local.getAllIds(function(e) { r.resolve(e) }, t), r.promise }, getIds: function(t) {                    var r = e.defer();                    return t = t || null, n.cordova.plugins.notification.local.getIds(function(e) { r.resolve(e) }, t), r.promise }, getScheduledIds: function(t) {                    var r = e.defer();                    return t = t || null, n.cordova.plugins.notification.local.getScheduledIds(function(e) { r.resolve(e) }, t), r.promise }, getTriggeredIds: function(t) {                    var r = e.defer();                    return t = t || null, n.cordova.plugins.notification.local.getTriggeredIds(function(e) { r.resolve(e) }, t), r.promise }, get: function(t, r) {                    var o = e.defer();                    return r = r || null, n.cordova.plugins.notification.local.get(t, function(e) { o.resolve(e) }, r), o.promise }, getAll: function(t) {                    var r = e.defer();                    return t = t || null, n.cordova.plugins.notification.local.getAll(function(e) { r.resolve(e) }, t), r.promise }, getScheduled: function(t, r) {                    var o = e.defer();                    return r = r || null, n.cordova.plugins.notification.local.getScheduled(t, function(e) { o.resolve(e) }, r), o.promise }, getAllScheduled: function(t) {                    var r = e.defer();                    return t = t || null, n.cordova.plugins.notification.local.getAllScheduled(function(e) { r.resolve(e) }, t), r.promise }, getTriggered: function(t, r) {                    var o = e.defer();                    return r = r || null, n.cordova.plugins.notification.local.getTriggered(t, function(e) { o.resolve(e) }, r), o.promise }, getAllTriggered: function(t) {                    var r = e.defer();                    return t = t || null, n.cordova.plugins.notification.local.getAllTriggered(function(e) { r.resolve(e) }, t), r.promise }, getDefaults: function() {                    return n.cordova.plugins.notification.local.getDefaults() }, setDefaults: function(e) { n.cordova.plugins.notification.local.setDefaults(e) } } }]), angular.module("ngCordova.plugins.mMediaAds", []).factory("$cordovaMMediaAds", ["$q", "$window", function(e, n) {            return { setOptions: function(t) {                    var r = e.defer();                    return n.mMedia.setOptions(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, createBanner: function(t) {                    var r = e.defer();                    return n.mMedia.createBanner(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, removeBanner: function() {                    var t = e.defer();                    return n.mMedia.removeBanner(function() { t.resolve() }, function() { t.reject() }), t.promise }, showBanner: function(t) {                    var r = e.defer();                    return n.mMedia.showBanner(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showBannerAtXY: function(t, r) {                    var o = e.defer();                    return n.mMedia.showBannerAtXY(t, r, function() { o.resolve() }, function() { o.reject() }), o.promise }, hideBanner: function() {                    var t = e.defer();                    return n.mMedia.hideBanner(function() { t.resolve() }, function() { t.reject() }), t.promise }, prepareInterstitial: function(t) {                    var r = e.defer();                    return n.mMedia.prepareInterstitial(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showInterstitial: function() {                    var t = e.defer();                    return n.mMedia.showInterstitial(function() { t.resolve() }, function() { t.reject() }), t.promise } } }]), angular.module("ngCordova.plugins.media", []).service("NewMedia", ["$q", "$interval", function(e, n) {            function t(e) { angular.isDefined(u) || (u = n(function() { 0 > f && (f = e.getDuration(), a && f > 0 && a.notify({ duration: f })), e.getCurrentPosition(function(e) { e > -1 && (d = e) }, function(e) { console.log("Error getting pos=" + e) }), a && a.notify({ position: d }) }, 1e3)) }            function r() { angular.isDefined(u) && (n.cancel(u), u = void 0) }            function o() { d = -1, f = -1 }            function i(e) { this.media = new Media(e, function(e) { r(), o(), a.resolve(e) }, function(e) { r(), o(), a.reject(e) }, function(e) { l = e, a.notify({ status: l }) }) }            var a, c, s, u, l = null,                d = -1,                f = -1;            return i.prototype.play = function(n) {                return a = e.defer(), "object" != typeof n && (n = {}), this.media.play(n), t(this.media), a.promise }, i.prototype.pause = function() { r(), this.media.pause() }, i.prototype.stop = function() { this.media.stop() }, i.prototype.release = function() { this.media.release(), this.media = void 0 }, i.prototype.seekTo = function(e) { this.media.seekTo(e) }, i.prototype.setVolume = function(e) { this.media.setVolume(e) }, i.prototype.startRecord = function() { this.media.startRecord() }, i.prototype.stopRecord = function() { this.media.stopRecord() }, i.prototype.currentTime = function() {                return c = e.defer(), this.media.getCurrentPosition(function(e) { c.resolve(e) }), c.promise }, i.prototype.getDuration = function() {                return s = e.defer(), this.media.getDuration(function(e) { s.resolve(e) }), s.promise }, i }]).factory("$cordovaMedia2", ["NewMedia", function(e) {            return { newMedia: function(n) {                    return new e(n) } } }]), angular.module("ngCordova.plugins.mobfoxAds", []).factory("$cordovaMobFoxAds", ["$q", "$window", function(e, n) {            return { setOptions: function(t) {                    var r = e.defer();                    return n.MobFox.setOptions(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, createBanner: function(t) {                    var r = e.defer();                    return n.MobFox.createBanner(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, removeBanner: function() {                    var t = e.defer();                    return n.MobFox.removeBanner(function() { t.resolve() }, function() { t.reject() }), t.promise }, showBanner: function(t) {                    var r = e.defer();                    return n.MobFox.showBanner(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showBannerAtXY: function(t, r) {                    var o = e.defer();                    return n.MobFox.showBannerAtXY(t, r, function() { o.resolve() }, function() { o.reject() }), o.promise }, hideBanner: function() {                    var t = e.defer();                    return n.MobFox.hideBanner(function() { t.resolve() }, function() { t.reject() }), t.promise }, prepareInterstitial: function(t) {                    var r = e.defer();                    return n.MobFox.prepareInterstitial(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showInterstitial: function() {                    var t = e.defer();                    return n.MobFox.showInterstitial(function() { t.resolve() }, function() { t.reject() }), t.promise } } }]), angular.module("ngCordova.plugins", ["ngCordova.plugins.actionSheet", "ngCordova.plugins.adMob", "ngCordova.plugins.appAvailability", "ngCordova.plugins.appRate", "ngCordova.plugins.appVersion", "ngCordova.plugins.backgroundGeolocation", "ngCordova.plugins.badge", "ngCordova.plugins.barcodeScanner", "ngCordova.plugins.batteryStatus", "ngCordova.plugins.ble", "ngCordova.plugins.bluetoothSerial", "ngCordova.plugins.brightness", "ngCordova.plugins.calendar", "ngCordova.plugins.camera", "ngCordova.plugins.capture", "ngCordova.plugins.clipboard", "ngCordova.plugins.contacts", "ngCordova.plugins.datePicker", "ngCordova.plugins.device", "ngCordova.plugins.deviceMotion", "ngCordova.plugins.deviceOrientation", "ngCordova.plugins.dialogs", "ngCordova.plugins.emailComposer", "ngCordova.plugins.facebook", "ngCordova.plugins.facebookAds", "ngCordova.plugins.file", "ngCordova.plugins.fileTransfer", "ngCordova.plugins.fileOpener2", "ngCordova.plugins.flashlight", "ngCordova.plugins.flurryAds", "ngCordova.plugins.ga", "ngCordova.plugins.geolocation", "ngCordova.plugins.globalization", "ngCordova.plugins.googleAds", "ngCordova.plugins.googleAnalytics", "ngCordova.plugins.googleMap", "ngCordova.plugins.googlePlayGame", "ngCordova.plugins.googlePlus", "ngCordova.plugins.healthKit", "ngCordova.plugins.httpd", "ngCordova.plugins.iAd", "ngCordova.plugins.imagePicker", "ngCordova.plugins.inAppBrowser", "ngCordova.plugins.instagram", "ngCordova.plugins.keyboard", "ngCordova.plugins.keychain", "ngCordova.plugins.launchNavigator", "ngCordova.plugins.localNotification", "ngCordova.plugins.media", "ngCordova.plugins.mMediaAds", "ngCordova.plugins.mobfoxAds", "ngCordova.plugins.mopubAds", "ngCordova.plugins.nativeAudio", "ngCordova.plugins.network", "ngCordovaOauth", "ngCordova.plugins.pinDialog", "ngCordova.plugins.prefs", "ngCordova.plugins.printer", "ngCordova.plugins.progressIndicator", "ngCordova.plugins.push", "ngCordova.plugins.sms", "ngCordova.plugins.socialSharing", "ngCordova.plugins.spinnerDialog", "ngCordova.plugins.splashscreen", "ngCordova.plugins.sqlite", "ngCordova.plugins.statusbar", "ngCordova.plugins.toast", "ngCordova.plugins.touchid", "ngCordova.plugins.vibration", "ngCordova.plugins.videoCapturePlus", "ngCordova.plugins.zip", "ngCordova.plugins.insomnia"]),        angular.module("ngCordova.plugins.mopubAds", []).factory("$cordovaMoPubAds", ["$q", "$window", function(e, n) {            return { setOptions: function(t) {                    var r = e.defer();                    return n.MoPub.setOptions(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, createBanner: function(t) {                    var r = e.defer();                    return n.MoPub.createBanner(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, removeBanner: function() {                    var t = e.defer();                    return n.MoPub.removeBanner(function() { t.resolve() }, function() { t.reject() }), t.promise }, showBanner: function(t) {                    var r = e.defer();                    return n.MoPub.showBanner(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showBannerAtXY: function(t, r) {                    var o = e.defer();                    return n.MoPub.showBannerAtXY(t, r, function() { o.resolve() }, function() { o.reject() }), o.promise }, hideBanner: function() {                    var t = e.defer();                    return n.MoPub.hideBanner(function() { t.resolve() }, function() { t.reject() }), t.promise }, prepareInterstitial: function(t) {                    var r = e.defer();                    return n.MoPub.prepareInterstitial(t, function() { r.resolve() }, function() { r.reject() }), r.promise }, showInterstitial: function() {                    var t = e.defer();                    return n.MoPub.showInterstitial(function() { t.resolve() }, function() { t.reject() }), t.promise } } }]), angular.module("ngCordova.plugins.nativeAudio", []).factory("$cordovaNativeAudio", ["$q", "$window", function(e, n) {            return { preloadSimple: function(t, r) {                    var o = e.defer();                    return n.plugins.NativeAudio.preloadSimple(t, r, function(e) { o.resolve(e) }, function(e) { o.reject(e) }), o.promise }, preloadComplex: function(t, r, o, i) {                    var a = e.defer();                    return n.plugins.NativeAudio.preloadComplex(t, r, o, i, function(e) { a.resolve(e) }, function(e) { a.reject(e) }), a.promise }, play: function(t, r) {                    var o = e.defer();                    return n.plugins.NativeAudio.play(t, r, function(e) { o.reject(e) }, function(e) { o.resolve(e) }), o.promise }, stop: function(t) {                    var r = e.defer();                    return n.plugins.NativeAudio.stop(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, loop: function(t) {                    var r = e.defer();                    return n.plugins.NativeAudio.loop(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, unload: function(t) {                    var r = e.defer();                    return n.plugins.NativeAudio.unload(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, setVolumeForComplexAsset: function(t, r) {                    var o = e.defer();                    return n.plugins.NativeAudio.setVolumeForComplexAsset(t, r, function(e) { o.resolve(e) }, function(e) { o.reject(e) }), o.promise } } }]), angular.module("ngCordova.plugins.network", []).factory("$cordovaNetwork", ["$rootScope", "$timeout", function(e, n) {            var t = function() {                    var t = navigator.connection.type;                    n(function() { e.$broadcast("$cordovaNetwork:offline", t) }) },                r = function() {                    var t = navigator.connection.type;                    n(function() { e.$broadcast("$cordovaNetwork:online", t) }) };            return document.addEventListener("deviceready", function() { navigator.connection && (document.addEventListener("offline", t, !1), document.addEventListener("online", r, !1)) }), { getNetwork: function() {                    return navigator.connection.type }, isOnline: function() {                    var e = navigator.connection.type;                    return e !== Connection.UNKNOWN && e !== Connection.NONE }, isOffline: function() {                    var e = navigator.connection.type;                    return e === Connection.UNKNOWN || e === Connection.NONE }, clearOfflineWatch: function() { document.removeEventListener("offline", t), e.$$listeners["$cordovaNetwork:offline"] = [] }, clearOnlineWatch: function() { document.removeEventListener("online", r), e.$$listeners["$cordovaNetwork:online"] = [] } } }]).run(["$cordovaNetwork", function(e) {}]), angular.module("ngCordova.plugins.pinDialog", []).factory("$cordovaPinDialog", ["$q", "$window", function(e, n) {            return { prompt: function(t, r, o) {                    var i = e.defer();                    return n.plugins.pinDialog.prompt(t, function(e) { i.resolve(e) }, r, o), i.promise } } }]), angular.module("ngCordova.plugins.prefs", []).factory("$cordovaPreferences", ["$window", "$q", function(e, n) {            return { set: function(t, r) {                    var o = n.defer();                    return e.appgiraffe.plugins.applicationPreferences.set(t, r, function(e) { o.resolve(e) }, function(e) { o.reject(e) }), o.promise }, get: function(t) {                    var r = n.defer();                    return e.appgiraffe.plugins.applicationPreferences.get(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise } } }]), angular.module("ngCordova.plugins.printer", []).factory("$cordovaPrinter", ["$q", "$window", function(e, n) {            return { isAvailable: function() {                    var t = e.defer();                    return n.plugin.printer.isAvailable(function(e) { t.resolve(e) }), t.promise }, print: function(t, r) {                    var o = e.defer();                    return n.plugin.printer.print(t, r, function() { o.resolve() }), o.promise } } }]), angular.module("ngCordova.plugins.progressIndicator", []).factory("$cordovaProgress", ["$q", function(e) {            return { show: function(e) {                    var n = e || "Please wait...";                    return ProgressIndicator.show(n) }, showSimple: function(e) {                    var n = e || !1;                    return ProgressIndicator.showSimple(n) }, showSimpleWithLabel: function(e, n) {                    var t = e || !1,                        r = n || "Loading...";                    return ProgressIndicator.showSimpleWithLabel(t, r) }, showSimpleWithLabelDetail: function(e, n, t) {                    var r = e || !1,                        o = n || "Loading...",                        i = t || "Please wait";                    return ProgressIndicator.showSimpleWithLabelDetail(r, o, i) }, showDeterminate: function(e, n) {                    var t = e || !1,                        r = n || 5e4;                    return ProgressIndicator.showDeterminate(t, r) }, showDeterminateWithLabel: function(e, n, t) {                    var r = e || !1,                        o = n || 5e4,                        i = t || "Loading...";                    return ProgressIndicator.showDeterminateWithLabel(r, o, i) }, showAnnular: function(e, n) {                    var t = e || !1,                        r = n || 5e4;                    return ProgressIndicator.showAnnular(t, r) }, showAnnularWithLabel: function(e, n, t) {                    var r = e || !1,                        o = n || 5e4,                        i = t || "Loading...";                    return ProgressIndicator.showAnnularWithLabel(r, o, i) }, showBar: function(e, n) {                    var t = e || !1,                        r = n || 5e4;                    return ProgressIndicator.showBar(t, r) }, showBarWithLabel: function(e, n, t) {                    var r = e || !1,                        o = n || 5e4,                        i = t || "Loading...";                    return ProgressIndicator.showBarWithLabel(r, o, i) }, showSuccess: function(e, n) {                    var t = e || !1,                        r = n || "Success";                    return ProgressIndicator.showSuccess(t, r) }, showText: function(e, n, t) {                    var r = e || !1,                        o = n || "Warning",                        i = t || "center";                    return ProgressIndicator.showText(r, o, i) }, hide: function() {                    return ProgressIndicator.hide() } } }]), angular.module("ngCordova.plugins.push", []).factory("$cordovaPush", ["$q", "$window", "$rootScope", "$timeout", function(e, n, t, r) {            return { onNotification: function(e) { r(function() { t.$broadcast("$cordovaPush:notificationReceived", e) }) }, register: function(t) {                    var r, o = e.defer();                    return void 0 !== t && void 0 === t.ecb && (r = null === document.querySelector("[ng-app]") ? "document.body" : "document.querySelector('[ng-app]')", t.ecb = "angular.element(" + r + ").injector().get('$cordovaPush').onNotification"), n.plugins.pushNotification.register(function(e) { o.resolve(e) }, function(e) { o.reject(e) }, t), o.promise }, unregister: function(t) {                    var r = e.defer();                    return n.plugins.pushNotification.unregister(function(e) { r.resolve(e) }, function(e) { r.reject(e) }, t), r.promise }, setBadgeNumber: function(t) {                    var r = e.defer();                    return n.plugins.pushNotification.setApplicationIconBadgeNumber(function(e) { r.resolve(e) }, function(e) { r.reject(e) }, t), r.promise } } }]), angular.module("ngCordova.plugins.sms", []).factory("$cordovaSms", ["$q", function(e) {            return { send: function(n, t, r) {                    var o = e.defer();                    return sms.send(n, t, r, function(e) { o.resolve(e) }, function(e) { o.reject(e) }), o.promise } } }]), angular.module("ngCordova.plugins.socialSharing", []).factory("$cordovaSocialSharing", ["$q", "$window", function(e, n) {            return { share: function(t, r, o, i) {                    var a = e.defer();                    return r = r || null, o = o || null, i = i || null, n.plugins.socialsharing.share(t, r, o, i, function() { a.resolve(!0) }, function() { a.reject(!1) }), a.promise }, shareViaTwitter: function(t, r, o) {                    var i = e.defer();                    return r = r || null, o = o || null, n.plugins.socialsharing.shareViaTwitter(t, r, o, function() { i.resolve(!0) }, function() { i.reject(!1) }), i.promise }, shareViaWhatsApp: function(t, r, o) {                    var i = e.defer();                    return r = r || null, o = o || null, n.plugins.socialsharing.shareViaWhatsApp(t, r, o, function() { i.resolve(!0) }, function() { i.reject(!1) }), i.promise }, shareViaFacebook: function(t, r, o) {                    var i = e.defer();                    return t = t || null, r = r || null, o = o || null, n.plugins.socialsharing.shareViaFacebook(t, r, o, function() { i.resolve(!0) }, function() { i.reject(!1) }), i.promise }, shareViaFacebookWithPasteMessageHint: function(t, r, o, i) {                    var a = e.defer();                    return r = r || null, o = o || null, n.plugins.socialsharing.shareViaFacebookWithPasteMessageHint(t, r, o, i, function() { a.resolve(!0) }, function() { a.reject(!1) }), a.promise }, shareViaSMS: function(t, r) {                    var o = e.defer();                    return n.plugins.socialsharing.shareViaSMS(t, r, function() { o.resolve(!0) }, function() { o.reject(!1) }), o.promise }, shareViaEmail: function(t, r, o, i, a, c) {                    var s = e.defer();                    return o = o || null, i = i || null, a = a || null, c = c || null, n.plugins.socialsharing.shareViaEmail(t, r, o, i, a, c, function() { s.resolve(!0) }, function() { s.reject(!1) }), s.promise }, shareVia: function(t, r, o, i, a) {                    var c = e.defer();                    return r = r || null, o = o || null, i = i || null, a = a || null, n.plugins.socialsharing.shareVia(t, r, o, i, a, function() { c.resolve(!0) }, function() { c.reject(!1) }), c.promise }, canShareViaEmail: function() {                    var t = e.defer();                    return n.plugins.socialsharing.canShareViaEmail(function() { t.resolve(!0) }, function() { t.reject(!1) }), t.promise }, canShareVia: function(t, r, o, i, a) {                    var c = e.defer();                    return n.plugins.socialsharing.canShareVia(t, r, o, i, a, function(e) { c.resolve(e) }, function(e) { c.reject(e) }), c.promise }, available: function() {                    var n = e.defer();                    window.plugins.socialsharing.available(function(e) { e ? n.resolve() : n.reject() }) } } }]), angular.module("ngCordova.plugins.spinnerDialog", []).factory("$cordovaSpinnerDialog", ["$window", function(e) {            return { show: function(n, t, r) {                    return r = r || !1, e.plugins.spinnerDialog.show(n, t, r) }, hide: function() {                    return e.plugins.spinnerDialog.hide() } } }]), angular.module("ngCordova.plugins.splashscreen", []).factory("$cordovaSplashscreen", [function() {            return { hide: function() {                    return navigator.splashscreen.hide() }, show: function() {                    return navigator.splashscreen.show() } } }]), angular.module("ngCordova.plugins.sqlite", []).factory("$cordovaSQLite", ["$q", "$window", function(e, n) {            return { openDB: function(e, t) {                    return "object" != typeof e && (e = { name: e }), "undefined" != typeof t && (e.bgType = t), n.sqlitePlugin.openDatabase(e) }, execute: function(n, t, r) {                    var o = e.defer();                    return n.transaction(function(e) { e.executeSql(t, r, function(e, n) { o.resolve(n) }, function(e, n) { o.reject(n) }) }), o.promise }, insertCollection: function(n, t, r) {                    var o = e.defer(),                        i = r.slice(0);                    return n.transaction(function(e) {! function n() {                            var r = i.splice(0, 1)[0];                            try { e.executeSql(t, r, function(e, t) { 0 === i.length ? o.resolve(t) : n() }, function(e, n) { o.reject(n) }) } catch (a) { o.reject(a) } }() }), o.promise }, nestedExecute: function(n, t, r, o, i) {                    var a = e.defer();                    return n.transaction(function(e) { e.executeSql(t, o, function(e, n) { a.resolve(n), e.executeSql(r, i, function(e, n) { a.resolve(n) }) }) }, function(e, n) { a.reject(n) }), a.promise }, deleteDB: function(t) {                    var r = e.defer();                    return n.sqlitePlugin.deleteDatabase(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise } } }]), angular.module("ngCordova.plugins.statusbar", []).factory("$cordovaStatusbar", [function() {            return { overlaysWebView: function(e) {                    return StatusBar.overlaysWebView(!!e) }, STYLES: { DEFAULT: 0, LIGHT_CONTENT: 1, BLACK_TRANSLUCENT: 2, BLACK_OPAQUE: 3 }, style: function(e) {                    switch (e) {                        case 0:                            return StatusBar.styleDefault();                        case 1:                            return StatusBar.styleLightContent();                        case 2:                            return StatusBar.styleBlackTranslucent();                        case 3:                            return StatusBar.styleBlackOpaque();                        default:                            return StatusBar.styleDefault() } }, styleColor: function(e) {                    return StatusBar.backgroundColorByName(e) }, styleHex: function(e) {                    return StatusBar.backgroundColorByHexString(e) }, hide: function() {                    return StatusBar.hide() }, show: function() {                    return StatusBar.show() }, isVisible: function() {                    return StatusBar.isVisible } } }]), angular.module("ngCordova.plugins.toast", []).factory("$cordovaToast", ["$q", "$window", function(e, n) {            return { showShortTop: function(t) {                    var r = e.defer();                    return n.plugins.toast.showShortTop(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, showShortCenter: function(t) {                    var r = e.defer();                    return n.plugins.toast.showShortCenter(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, showShortBottom: function(t) {                    var r = e.defer();                    return n.plugins.toast.showShortBottom(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, showLongTop: function(t) {                    var r = e.defer();                    return n.plugins.toast.showLongTop(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, showLongCenter: function(t) {                    var r = e.defer();                    return n.plugins.toast.showLongCenter(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, showLongBottom: function(t) {                    var r = e.defer();                    return n.plugins.toast.showLongBottom(t, function(e) { r.resolve(e) }, function(e) { r.reject(e) }), r.promise }, show: function(t, r, o) {                    var i = e.defer();                    return n.plugins.toast.show(t, r, o, function(e) { i.resolve(e) }, function(e) { i.reject(e) }), i.promise } } }]), angular.module("ngCordova.plugins.touchid", []).factory("$cordovaTouchID", ["$q", function(e) {            return { checkSupport: function() {                    var n = e.defer();                    return window.cordova ? touchid.checkSupport(function(e) { n.resolve(e) }, function(e) { n.reject(e) }) : n.reject("Not supported without cordova.js"), n.promise }, authenticate: function(n) {                    var t = e.defer();                    return window.cordova ? touchid.authenticate(function(e) { t.resolve(e) }, function(e) { t.reject(e) }, n) : t.reject("Not supported without cordova.js"), t.promise } } }]), angular.module("ngCordova.plugins.vibration", []).factory("$cordovaVibration", [function() {            return { vibrate: function(e) {                    return navigator.notification.vibrate(e) }, vibrateWithPattern: function(e, n) {                    return navigator.notification.vibrateWithPattern(e, n) }, cancelVibration: function() {                    return navigator.notification.cancelVibration() } } }]), angular.module("ngCordova.plugins.videoCapturePlus", []).provider("$cordovaVideoCapturePlus", [function() {            var e = {};            this.setLimit = function(n) { e.limit = n }, this.setMaxDuration = function(n) { e.duration = n }, this.setHighQuality = function(n) { e.highquality = n }, this.useFrontCamera = function(n) { e.frontcamera = n }, this.setPortraitOverlay = function(n) { e.portraitOverlay = n }, this.setLandscapeOverlay = function(n) { e.landscapeOverlay = n }, this.setOverlayText = function(n) { e.overlayText = n }, this.$get = ["$q", "$window", function(n, t) {                return { captureVideo: function(r) {                        var o = n.defer();                        return t.plugins.videocaptureplus ? (t.plugins.videocaptureplus.captureVideo(o.resolve, o.reject, angular.extend({}, e, r)), o.promise) : (o.resolve(null), o.promise) } } }] }]), angular.module("ngCordova.plugins.zip", []).factory("$cordovaZip", ["$q", "$window", function(e, n) {            return { unzip: function(t, r) {                    var o = e.defer();                    return n.zip.unzip(t, r, function(e) { 0 === e ? o.resolve() : o.reject() }, function(e) { o.notify(e) }), o.promise } } }]), angular.module("oauth.providers", ["oauth.utils"]).factory("$cordovaOauth", ["$q", "$http", "$cordovaOauthUtility", function(e, n, t) {            return {                adfs: function(r, o, i) {                    var a = e.defer();                    if (window.cordova) {                        var c = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(c) === !0) {                            var s = window.open(o + "/adfs/oauth2/authorize?response_type=code&client_id=" + r + "&redirect_uri=http://localhost/callback&resource=" + i, "_blank", "location=no");                            s.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf("http://localhost/callback")) {                                    var t = e.url.split("code=")[1];                                    n.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded", n({ method: "post", url: o + "/adfs/oauth2/token", data: "client_id=" + r + "&code=" + t + "&redirect_uri=http://localhost/callback&grant_type=authorization_code" }).success(function(e) { a.resolve(e) }).error(function(e, n) { a.reject("Problem authenticating") })["finally"](function() { setTimeout(function() { s.close() }, 10) }) } }), s.addEventListener("exit", function(e) { a.reject("The sign in flow was canceled") }) } else a.reject("Could not find InAppBrowser plugin") } else a.reject("Cannot authenticate via a web browser");                    return a.promise },                dropbox: function(n, r) {                    var o = e.defer();                    if (window.cordova) {                        var i = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(i) === !0) {                            var a = "http://localhost/callback";                            void 0 !== r && r.hasOwnProperty("redirect_uri") && (a = r.redirect_uri);                            var c = window.open("https://www.dropbox.com/1/oauth2/authorize?client_id=" + n + "&redirect_uri=" + a + "&response_type=token", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            c.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(a)) { c.removeEventListener("exit", function(e) {}), c.close();                                    for (var n = e.url.split("#")[1], t = n.split("&"), r = [], i = 0; i < t.length; i++) r[t[i].split("=")[0]] = t[i].split("=")[1];                                    void 0 !== r.access_token && null !== r.access_token ? o.resolve({ access_token: r.access_token, token_type: r.token_type, uid: r.uid }) : o.reject("Problem authenticating") } }), c.addEventListener("exit", function(e) { o.reject("The sign in flow was canceled") }) } else o.reject("Could not find InAppBrowser plugin") } else o.reject("Cannot authenticate via a web browser");                    return o.promise },                digitalOcean: function(r, o, i) {                    var a = e.defer();                    if (window.cordova) {                        var c = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(c) === !0) {                            var s = "http://localhost/callback";                            void 0 !== i && i.hasOwnProperty("redirect_uri") && (s = i.redirect_uri);                            var u = window.open("https://cloud.digitalocean.com/v1/oauth/authorize?client_id=" + r + "&redirect_uri=" + s + "&response_type=code&scope=read%20write", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            u.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(s)) {                                    var t = e.url.split("code=")[1];                                    n.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded", n({ method: "post", url: "https://cloud.digitalocean.com/v1/oauth/token", data: "client_id=" + r + "&client_secret=" + o + "&redirect_uri=" + s + "&grant_type=authorization_code&code=" + t }).success(function(e) { a.resolve(e) }).error(function(e, n) { a.reject("Problem authenticating") })["finally"](function() { setTimeout(function() { u.close() }, 10) }) } }), u.addEventListener("exit", function(e) { a.reject("The sign in flow was canceled") }) } else a.reject("Could not find InAppBrowser plugin") } else a.reject("Cannot authenticate via a web browser");                    return a.promise },                google: function(n, r, o) {                    var i = e.defer();                    if (window.cordova) {                        var a = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(a) === !0) {                            var c = "http://localhost/callback";                            void 0 !== o && o.hasOwnProperty("redirect_uri") && (c = o.redirect_uri);                            var s = window.open("https://accounts.google.com/o/oauth2/auth?client_id=" + n + "&redirect_uri=" + c + "&scope=" + r.join(" ") + "&approval_prompt=force&response_type=token", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            s.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(c)) { s.removeEventListener("exit", function(e) {}), s.close();                                    for (var n = e.url.split("#")[1], t = n.split("&"), r = [], o = 0; o < t.length; o++) r[t[o].split("=")[0]] = t[o].split("=")[1];                                    void 0 !== r.access_token && null !== r.access_token ? i.resolve({ access_token: r.access_token, token_type: r.token_type, expires_in: r.expires_in }) : i.reject("Problem authenticating") } }), s.addEventListener("exit", function(e) { i.reject("The sign in flow was canceled") }) } else i.reject("Could not find InAppBrowser plugin") } else i.reject("Cannot authenticate via a web browser");                    return i.promise },                github: function(r, o, i, a) {                    var c = e.defer();                    if (window.cordova) {                        var s = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(s) === !0) {                            var u = "http://localhost/callback";                            void 0 !== a && a.hasOwnProperty("redirect_uri") && (u = a.redirect_uri);                            var l = window.open("https://github.com/login/oauth/authorize?client_id=" + r + "&redirect_uri=" + u + "&scope=" + i.join(","), "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            l.addEventListener("loadstart", function(e) { 0 === e.url.indexOf(u) && (requestToken = e.url.split("code=")[1], n.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded", n.defaults.headers.post.accept = "application/json", n({ method: "post", url: "https://github.com/login/oauth/access_token", data: "client_id=" + r + "&client_secret=" + o + "&redirect_uri=" + u + "&code=" + requestToken }).success(function(e) { c.resolve(e) }).error(function(e, n) { c.reject("Problem authenticating") })["finally"](function() { setTimeout(function() { l.close() }, 10) })) }), l.addEventListener("exit", function(e) { c.reject("The sign in flow was canceled") }) } else c.reject("Could not find InAppBrowser plugin") } else c.reject("Cannot authenticate via a web browser");                    return c.promise },                facebook: function(n, r, o) {                    var i = e.defer();                    if (window.cordova) {                        var a = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(a) === !0) {                            var c = "http://localhost/callback";                            void 0 !== o && o.hasOwnProperty("redirect_uri") && (c = o.redirect_uri);                            var s = "https://www.facebook.com/v2.0/dialog/oauth?client_id=" + n + "&redirect_uri=" + c + "&response_type=token&scope=" + r.join(",");                            void 0 !== o && o.hasOwnProperty("auth_type") && (s += "&auth_type=" + o.auth_type);                            var u = window.open(s, "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            u.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(c)) { u.removeEventListener("exit", function(e) {}), u.close();                                    for (var n = e.url.split("#")[1], t = n.split("&"), r = [], o = 0; o < t.length; o++) r[t[o].split("=")[0]] = t[o].split("=")[1];                                    void 0 !== r.access_token && null !== r.access_token ? i.resolve({ access_token: r.access_token, expires_in: r.expires_in }) : 0 !== e.url.indexOf("error_code=100") ? i.reject("Facebook returned error_code=100: Invalid permissions") : i.reject("Problem authenticating") } }), u.addEventListener("exit", function(e) { i.reject("The sign in flow was canceled") }) } else i.reject("Could not find InAppBrowser plugin") } else i.reject("Cannot authenticate via a web browser");                    return i.promise },                linkedin: function(r, o, i, a, c) {                    var s = e.defer();                    if (window.cordova) {                        var u = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(u) === !0) {                            var l = "http://localhost/callback";                            void 0 !== c && c.hasOwnProperty("redirect_uri") && (l = c.redirect_uri);                            var d = window.open("https://www.linkedin.com/uas/oauth2/authorization?client_id=" + r + "&redirect_uri=" + l + "&scope=" + i.join(" ") + "&response_type=code&state=" + a, "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            d.addEventListener("loadstart", function(e) { 0 === e.url.indexOf(l) && (requestToken = e.url.split("code=")[1], n.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded", n({ method: "post", url: "https://www.linkedin.com/uas/oauth2/accessToken", data: "client_id=" + r + "&client_secret=" + o + "&redirect_uri=" + l + "&grant_type=authorization_code&code=" + requestToken }).success(function(e) { s.resolve(e) }).error(function(e, n) { s.reject("Problem authenticating") })["finally"](function() { setTimeout(function() { d.close() }, 10) })) }), d.addEventListener("exit", function(e) { s.reject("The sign in flow was canceled") }) } else s.reject("Could not find InAppBrowser plugin") } else s.reject("Cannot authenticate via a web browser");                    return s.promise },                instagram: function(n, r, o) {                    var i = e.defer(),                        a = { code: "?", token: "#" };                    if (window.cordova) {                        var c = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(c) === !0) {                            var s = "http://localhost/callback",                                u = "token";                            void 0 !== o && (o.hasOwnProperty("redirect_uri") && (s = o.redirect_uri), o.hasOwnProperty("response_type") && (u = o.response_type));                            var l = window.open("https://api.instagram.com/oauth/authorize/?client_id=" + n + "&redirect_uri=" + s + "&scope=" + r.join(" ") + "&response_type=" + u, "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            l.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(s)) { l.removeEventListener("exit", function(e) {}), l.close();                                    var n = e.url.split(a[u])[1],                                        r = t.parseResponseParameters(n);                                    void 0 !== r.access_token && null !== r.access_token ? i.resolve({ access_token: r.access_token }) : void 0 !== r.code && null !== r.code ? i.resolve({ code: r.code }) : i.reject("Problem authenticating") } }), l.addEventListener("exit", function(e) { i.reject("The sign in flow was canceled") }) } else i.reject("Could not find InAppBrowser plugin") } else i.reject("Cannot authenticate via a web browser");                    return i.promise },                box: function(r, o, i, a) {                    var c = e.defer();                    if (window.cordova) {                        var s = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(s) === !0) {                            var u = "http://localhost/callback";                            void 0 !== a && a.hasOwnProperty("redirect_uri") && (u = a.redirect_uri);                            var l = window.open("https://app.box.com/api/oauth2/authorize/?client_id=" + r + "&redirect_uri=" + u + "&state=" + i + "&response_type=code", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            l.addEventListener("loadstart", function(e) { 0 === e.url.indexOf(u) && (requestToken = e.url.split("code=")[1], n.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded", n({ method: "post", url: "https://app.box.com/api/oauth2/token", data: "client_id=" + r + "&client_secret=" + o + "&redirect_uri=" + u + "&grant_type=authorization_code&code=" + requestToken }).success(function(e) { c.resolve(e) }).error(function(e, n) { c.reject("Problem authenticating") })["finally"](function() { setTimeout(function() { l.close() }, 10) })) }), l.addEventListener("exit", function(e) { c.reject("The sign in flow was canceled") }) } else c.reject("Could not find InAppBrowser plugin") } else c.reject("Cannot authenticate via a web browser");                    return c.promise },                reddit: function(r, o, i, a, c) {                    var s = e.defer();                    if (window.cordova) {                        var u = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(u) === !0) {                            var l = "http://localhost/callback";                            void 0 !== c && c.hasOwnProperty("redirect_uri") && (l = c.redirect_uri);                            var d = window.open("https://ssl.reddit.com/api/v1/authorize?client_id=" + r + "&redirect_uri=" + l + "&duration=permanent&state=ngcordovaoauth&scope=" + i.join(",") + "&response_type=code", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            d.addEventListener("loadstart", function(e) { 0 === e.url.indexOf(l) && (requestToken = e.url.split("code=")[1], n.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded", n.defaults.headers.post.Authorization = "Basic " + btoa(r + ":" + o), n({ method: "post", url: "https://ssl.reddit.com/api/v1/access_token", data: "redirect_uri=" + l + "&grant_type=authorization_code&code=" + requestToken }).success(function(e) { s.resolve(e) }).error(function(e, n) { s.reject("Problem authenticating") })["finally"](function() { setTimeout(function() { d.close() }, 10) })) }), d.addEventListener("exit", function(e) { s.reject("The sign in flow was canceled") }) } else s.reject("Could not find InAppBrowser plugin") } else s.reject("Cannot authenticate via a web browser");                    return s.promise },                twitter: function(r, o, i) {                    var a = e.defer();                    if (window.cordova) {                        var c = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(c) === !0) {                            var s = "http://localhost/callback";                            if (void 0 !== i && i.hasOwnProperty("redirect_uri") && (s = i.redirect_uri), "undefined" != typeof jsSHA) {                                var u = { oauth_consumer_key: r, oauth_nonce: t.createNonce(10), oauth_signature_method: "HMAC-SHA1", oauth_timestamp: Math.round((new Date).getTime() / 1e3), oauth_version: "1.0" },                                    l = t.createSignature("POST", "https://api.twitter.com/oauth/request_token", u, { oauth_callback: s }, o);                                n({ method: "post", url: "https://api.twitter.com/oauth/request_token", headers: { Authorization: l.authorization_header, "Content-Type": "application/x-www-form-urlencoded" }, data: "oauth_callback=" + encodeURIComponent(s) }).success(function(e) {                                    for (var r = e.split("&"), i = {}, c = 0; c < r.length; c++) i[r[c].split("=")[0]] = r[c].split("=")[1];                                    i.hasOwnProperty("oauth_token") === !1 && a.reject("Oauth request token was not received");                                    var l = window.open("https://api.twitter.com/oauth/authenticate?oauth_token=" + i.oauth_token, "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                                    l.addEventListener("loadstart", function(e) {                                        if (0 === e.url.indexOf(s)) {                                            for (var r = e.url.split("?")[1], i = r.split("&"), c = {}, d = 0; d < i.length; d++) c[i[d].split("=")[0]] = i[d].split("=")[1];                                            c.hasOwnProperty("oauth_verifier") === !1 && a.reject("Browser authentication failed to complete.  No oauth_verifier was returned"), delete u.oauth_signature, u.oauth_token = c.oauth_token;                                            var f = t.createSignature("POST", "https://api.twitter.com/oauth/access_token", u, { oauth_verifier: c.oauth_verifier }, o);                                            n({ method: "post", url: "https://api.twitter.com/oauth/access_token", headers: { Authorization: f.authorization_header }, params: { oauth_verifier: c.oauth_verifier } }).success(function(e) {                                                for (var n = e.split("&"), t = {}, r = 0; r < n.length; r++) t[n[r].split("=")[0]] = n[r].split("=")[1];                                                t.hasOwnProperty("oauth_token_secret") === !1 && a.reject("Oauth access token was not received"), a.resolve(t) }).error(function(e) { a.reject(e) })["finally"](function() { setTimeout(function() { l.close() }, 10) }) } }), l.addEventListener("exit", function(e) { a.reject("The sign in flow was canceled") }) }).error(function(e) { a.reject(e) }) } else a.reject("Missing jsSHA JavaScript library") } else a.reject("Could not find InAppBrowser plugin") } else a.reject("Cannot authenticate via a web browser");                    return a.promise },                meetup: function(n, r) {                    var o = e.defer();                    if (window.cordova) {                        var i = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(i) === !0) {                            var a = "http://localhost/callback";                            void 0 !== r && r.hasOwnProperty("redirect_uri") && (a = r.redirect_uri);                            var c = window.open("https://secure.meetup.com/oauth2/authorize/?client_id=" + n + "&redirect_uri=" + a + "&response_type=token", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            c.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(a)) { c.removeEventListener("exit", function(e) {}), c.close();                                    for (var n = e.url.split("#")[1], t = n.split("&"), r = {}, i = 0; i < t.length; i++) r[t[i].split("=")[0]] = t[i].split("=")[1];                                    void 0 !== r.access_token && null !== r.access_token ? o.resolve(r) : o.reject("Problem authenticating") } }), c.addEventListener("exit", function(e) { o.reject("The sign in flow was canceled") }) } else o.reject("Could not find InAppBrowser plugin") } else o.reject("Cannot authenticate via a web browser");                    return o.promise },                salesforce: function(n, r) {                    var o = "http://localhost/callback",                        i = function(e, n, t) {                            return e + "services/oauth2/authorize?display=touch&response_type=token&client_id=" + escape(n) + "&redirect_uri=" + escape(t) },                        a = function(e, n) {                            return e.substr(0, n.length) === n },                        c = e.defer();                    if (window.cordova) {                        var s = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(s) === !0) {                            var u = window.open(i(n, r, o), "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            u.addEventListener("loadstart", function(e) {                                if (a(e.url, o)) {                                    var n = {},                                        t = e.url.split("#")[1];                                    if (t) {                                        var r = t.split("&");                                        for (var i in r) {                                            var s = r[i].split("=");                                            n[s[0]] = unescape(s[1]) } } "undefined" == typeof n || "undefined" == typeof n.access_token ? c.reject("Problem authenticating") : c.resolve(n), setTimeout(function() { u.close() }, 10) } }), u.addEventListener("exit", function(e) { c.reject("The sign in flow was canceled") }) } else c.reject("Could not find InAppBrowser plugin") } else c.reject("Cannot authenticate via a web browser");                    return c.promise },                strava: function(r, o, i, a) {                    var c = e.defer();                    if (window.cordova) {                        var s = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(s) === !0) {                            var u = "http://localhost/callback";                            void 0 !== a && a.hasOwnProperty("redirect_uri") && (u = a.redirect_uri);                            var l = window.open("https://www.strava.com/oauth/authorize?client_id=" + r + "&redirect_uri=" + u + "&scope=" + i.join(",") + "&response_type=code&approval_prompt=force", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            l.addEventListener("loadstart", function(e) { 0 === e.url.indexOf(u) && (requestToken = e.url.split("code=")[1], n.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded", n({ method: "post", url: "https://www.strava.com/oauth/token", data: "client_id=" + r + "&client_secret=" + o + "&code=" + requestToken }).success(function(e) { c.resolve(e) }).error(function(e, n) { c.reject("Problem authenticating") })["finally"](function() { setTimeout(function() { l.close() }, 10) })) }), l.addEventListener("exit", function(e) { c.reject("The sign in flow was canceled") }) } else c.reject("Could not find InAppBrowser plugin") } else c.reject("Cannot authenticate via a web browser");                    return c.promise },                withings: function(r, o) {                    var i = e.defer();                    if (window.cordova) {                        var a = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(a) === !0)                            if ("undefined" != typeof jsSHA) {                                var c = t.generateOauthParametersInstance(r);                                c.oauth_callback = "http://localhost/callback";                                var s = "https://oauth.withings.com/account/request_token",                                    u = t.createSignature("GET", s, {}, c, o);                                c.oauth_signature = u.signature;                                var l = t.generateUrlParameters(c);                                n({ method: "get", url: s + "?" + l }).success(function(e) {                                    var a = t.parseResponseParameters(e);                                    a.hasOwnProperty("oauth_token") === !1 && i.reject("Oauth request token was not received");                                    var c = t.generateOauthParametersInstance(r);                                    c.oauth_token = a.oauth_token;                                    var s = a.oauth_token_secret,                                        u = "https://oauth.withings.com/account/authorize",                                        l = t.createSignature("GET", u, {}, c, o);                                    c.oauth_signature = l.signature;                                    var d = t.generateUrlParameters(c),                                        f = window.open(u + "?" + d, "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                                    f.addEventListener("loadstart", function(e) {                                        if (0 === e.url.indexOf("http://localhost/callback")) {                                            var c = e.url.split("?")[1];                                            a = t.parseResponseParameters(c), a.hasOwnProperty("oauth_verifier") === !1 && i.reject("Browser authentication failed to complete.  No oauth_verifier was returned");                                            var u = t.generateOauthParametersInstance(r);                                            u.oauth_token = a.oauth_token;                                            var l = "https://oauth.withings.com/account/access_token",                                                d = t.createSignature("GET", l, {}, u, o, s);                                            u.oauth_signature = d.signature;                                            var p = t.generateUrlParameters(u);                                            n({ method: "get", url: l + "?" + p }).success(function(e) {                                                var n = t.parseResponseParameters(e);                                                n.hasOwnProperty("oauth_token_secret") === !1 && i.reject("Oauth access token was not received"), i.resolve(n) }).error(function(e) { i.reject(e) })["finally"](function() { setTimeout(function() { f.close() }, 10) })                                        }                                    }), f.addEventListener("exit", function(e) { i.reject("The sign in flow was canceled") })                                }).error(function(e) { i.reject(e) })                            } else i.reject("Missing jsSHA JavaScript library");                        else i.reject("Could not find InAppBrowser plugin")                    } else i.reject("Cannot authenticate via a web browser");                    return i.promise                },                foursquare: function(n, r) {                    var o = e.defer();                    if (window.cordova) {                        var i = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(i) === !0) {                            var a = "http://localhost/callback";                            void 0 !== r && r.hasOwnProperty("redirect_uri") && (a = r.redirect_uri);                            var c = window.open("https://foursquare.com/oauth2/authenticate?client_id=" + n + "&redirect_uri=" + a + "&response_type=token", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            c.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(a)) { c.removeEventListener("exit", function(e) {}), c.close();                                    for (var n = e.url.split("#")[1], t = n.split("&"), r = [], i = 0; i < t.length; i++) r[t[i].split("=")[0]] = t[i].split("=")[1];                                    if (void 0 !== r.access_token && null !== r.access_token) {                                        var s = { access_token: r.access_token, expires_in: r.expires_in };                                        o.resolve(s) } else o.reject("Problem authenticating") } }), c.addEventListener("exit", function(e) { o.reject("The sign in flow was canceled") }) } else o.reject("Could not find InAppBrowser plugin") } else o.reject("Cannot authenticate via a web browser");                    return o.promise },                magento: function(r, o, i) {                    var a = e.defer();                    if (window.cordova) {                        var c = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(c) === !0)                            if ("undefined" != typeof jsSHA) {                                var s = { oauth_callback: "http://localhost/callback", oauth_consumer_key: o, oauth_nonce: t.createNonce(5), oauth_signature_method: "HMAC-SHA1", oauth_timestamp: Math.round((new Date).getTime() / 1e3), oauth_version: "1.0" },                                    u = t.createSignature("POST", r + "/oauth/initiate", s, { oauth_callback: "http://localhost/callback" }, i);                                n.defaults.headers.post.Authorization = u.authorization_header, n.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded", n({ method: "post", url: r + "/oauth/initiate", data: "oauth_callback=http://localhost/callback" }).success(function(e) {                                    for (var o = e.split("&"), c = {}, u = 0; u < o.length; u++) c[o[u].split("=")[0]] = o[u].split("=")[1];                                    c.hasOwnProperty("oauth_token") === !1 && a.reject("Oauth request token was not received");                                    var l = c.oauth_token_secret,                                        d = window.open(r + "/oauth/authorize?oauth_token=" + c.oauth_token, "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                                    d.addEventListener("loadstart", function(e) {                                        if (0 === e.url.indexOf("http://localhost/callback")) {                                            for (var o = e.url.split("?")[1], c = o.split("&"), u = {}, f = 0; f < c.length; f++) u[c[f].split("=")[0]] = c[f].split("=")[1];                                            u.hasOwnProperty("oauth_verifier") === !1 && a.reject("Browser authentication failed to complete.  No oauth_verifier was returned"), delete s.oauth_signature, delete s.oauth_callback, s.oauth_token = u.oauth_token, s.oauth_nonce = t.createNonce(5), s.oauth_verifier = u.oauth_verifier;                                            var p = t.createSignature("POST", r + "/oauth/token", s, {}, i, l);                                            n.defaults.headers.post.Authorization = p.authorization_header, n.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded", n({ method: "post", url: r + "/oauth/token" }).success(function(e) {                                                for (var n = e.split("&"), t = {}, r = 0; r < n.length; r++) t[n[r].split("=")[0]] = n[r].split("=")[1];                                                t.hasOwnProperty("oauth_token_secret") === !1 && a.reject("Oauth access token was not received"), a.resolve(t) }).error(function(e) { a.reject(e) })["finally"](function() { setTimeout(function() { d.close() }, 10) }) } }), d.addEventListener("exit", function(e) { a.reject("The sign in flow was canceled") }) }).error(function(e) { a.reject(e) }) } else a.reject("Missing jsSHA JavaScript library");                        else a.reject("Could not find InAppBrowser plugin") } else a.reject("Cannot authenticate via a web browser");                    return a.promise },                vkontakte: function(n, r) {                    var o = e.defer();                    if (window.cordova) {                        var i = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(i) === !0) {                            var a = window.open("https://oauth.vk.com/authorize?client_id=" + n + "&redirect_uri=http://oauth.vk.com/blank.html&response_type=token&scope=" + r.join(",") + "&display=touch&response_type=token", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            a.addEventListener("loadstart", function(e) {                                var n = e.url.split("#");                                if ("https://oauth.vk.com/blank.html" == n[0] || "http://oauth.vk.com/blank.html" == n[0]) { a.removeEventListener("exit", function(e) {}), a.close();                                    for (var t = e.url.split("#")[1], r = t.split("&"), i = [], c = 0; c < r.length; c++) i[r[c].split("=")[0]] = r[c].split("=")[1];                                    if (void 0 !== i.access_token && null !== i.access_token) {                                        var s = { access_token: i.access_token, expires_in: i.expires_in };                                        void 0 !== i.email && null !== i.email && (s.email = i.email), o.resolve(s) } else o.reject("Problem authenticating") } }), a.addEventListener("exit", function(e) { o.reject("The sign in flow was canceled") }) } else o.reject("Could not find InAppBrowser plugin") } else o.reject("Cannot authenticate via a web browser");                    return o.promise },                odnoklassniki: function(n, r) {                    var o = e.defer();                    if (window.cordova) {                        var i = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(i) === !0) {                            var a = window.open("http://www.odnoklassniki.ru/oauth/authorize?client_id=" + n + "&scope=" + r.join(",") + "&response_type=token&redirect_uri=http://localhost/callback&layout=m", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            a.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf("http://localhost/callback")) {                                    for (var n = e.url.split("#")[1], t = n.split("&"), r = [], i = 0; i < t.length; i++) r[t[i].split("=")[0]] = t[i].split("=")[1];                                    void 0 !== r.access_token && null !== r.access_token ? o.resolve({ access_token: r.access_token, session_secret_key: r.session_secret_key }) : o.reject("Problem authenticating"), setTimeout(function() { a.close() }, 10) } }), a.addEventListener("exit", function(e) { o.reject("The sign in flow was canceled") }) } else o.reject("Could not find InAppBrowser plugin") } else o.reject("Cannot authenticate via a web browser");                    return o.promise },                imgur: function(n, r) {                    var o = e.defer();                    if (window.cordova) {                        var i = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(i) === !0) {                            var a = "http://localhost/callback";                            void 0 !== r && r.hasOwnProperty("redirect_uri") && (a = r.redirect_uri);                            var c = window.open("https://api.imgur.com/oauth2/authorize?client_id=" + n + "&response_type=token", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            c.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(a)) { c.removeEventListener("exit", function(e) {}), c.close();                                    for (var n = e.url.split("#")[1], t = n.split("&"), r = [], i = 0; i < t.length; i++) r[t[i].split("=")[0]] = t[i].split("=")[1];                                    void 0 !== r.access_token && null !== r.access_token ? o.resolve({ access_token: r.access_token, expires_in: r.expires_in, account_username: r.account_username }) : o.reject("Problem authenticating") } }), c.addEventListener("exit", function(e) { o.reject("The sign in flow was canceled") }) } else o.reject("Could not find InAppBrowser plugin") } else o.reject("Cannot authenticate via a web browser");                    return o.promise },                spotify: function(n, r, o) {                    var i = e.defer();                    if (window.cordova) {                        var a = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(a) === !0) {                            var c = "http://localhost/callback";                            void 0 !== o && o.hasOwnProperty("redirect_uri") && (c = o.redirect_uri);                            var s = window.open("https://accounts.spotify.com/authorize?client_id=" + n + "&redirect_uri=" + c + "&response_type=token&scope=" + r.join(" "), "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            s.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(c)) { s.removeEventListener("exit", function(e) {}), s.close();                                    for (var n = e.url.split("#")[1], t = n.split("&"), r = [], o = 0; o < t.length; o++) r[t[o].split("=")[0]] = t[o].split("=")[1];                                    void 0 !== r.access_token && null !== r.access_token ? i.resolve({ access_token: r.access_token, expires_in: r.expires_in, account_username: r.account_username }) : i.reject("Problem authenticating") } }), s.addEventListener("exit", function(e) { i.reject("The sign in flow was canceled") }) } else i.reject("Could not find InAppBrowser plugin") } else i.reject("Cannot authenticate via a web browser");                    return i.promise },                uber: function(n, r, o) {                    var i = e.defer();                    if (window.cordova) {                        var a = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(a) === !0) {                            var c = "http://localhost/callback";                            void 0 !== o && o.hasOwnProperty("redirect_uri") && (c = o.redirect_uri);                            var s = window.open("https://login.uber.com/oauth/authorize?client_id=" + n + "&redirect_uri=" + c + "&response_type=token&scope=" + r.join(" "), "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            s.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(c)) { s.removeEventListener("exit", function(e) {}), s.close();                                    for (var n = e.url.split("#")[1], t = n.split("&"), r = [], o = 0; o < t.length; o++) r[t[o].split("=")[0]] = t[o].split("=")[1];                                    void 0 !== r.access_token && null !== r.access_token ? i.resolve({ access_token: r.access_token, token_type: r.token_type, expires_in: r.expires_in, scope: r.scope }) : i.reject("Problem authenticating") } }), s.addEventListener("exit", function(e) { i.reject("The sign in flow was canceled") }) } else i.reject("Could not find InAppBrowser plugin") } else i.reject("Cannot authenticate via a web browser");                    return i.promise },                windowsLive: function(n, r, o) {                    var i = e.defer();                    if (window.cordova) {                        var a = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(a) === !0) {                            var c = "https://login.live.com/oauth20_desktop.srf";                            void 0 !== o && o.hasOwnProperty("redirect_uri") && (c = o.redirect_uri);                            var s = window.open("https://login.live.com/oauth20_authorize.srf?client_id=" + n + "&scope=" + r.join(",") + "&response_type=token&display=touch&redirect_uri=" + c, "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            s.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(c)) { s.removeEventListener("exit", function(e) {}), s.close();                                    for (var n = e.url.split("#")[1], t = n.split("&"), r = [], o = 0; o < t.length; o++) r[t[o].split("=")[0]] = t[o].split("=")[1];                                    void 0 !== r.access_token && null !== r.access_token ? i.resolve({ access_token: r.access_token, expires_in: r.expires_in }) : i.reject("Problem authenticating") } }), s.addEventListener("exit", function(e) { i.reject("The sign in flow was canceled") }) } else i.reject("Could not find InAppBrowser plugin") } else i.reject("Cannot authenticate via a web browser");                    return i.promise },                yammer: function(n, r) {                    var o = e.defer();                    if (window.cordova) {                        var i = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(i) === !0) {                            var a = "http://localhost/callback";                            void 0 !== r && r.hasOwnProperty("redirect_uri") && (a = r.redirect_uri);                            var c = window.open("https://www.yammer.com/dialog/oauth?client_id=" + n + "&redirect_uri=" + a + "&response_type=token", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            c.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(a)) { c.removeEventListener("exit", function(e) {}), c.close();                                    for (var n = e.url.split("#")[1], t = n.split("&"), r = [], i = 0; i < t.length; i++) r[t[i].split("=")[0]] = t[i].split("=")[1];                                    void 0 !== r.access_token && null !== r.access_token ? o.resolve({ access_token: r.access_token }) : o.reject("Problem authenticating") } }), c.addEventListener("exit", function(e) { o.reject("The sign in flow was canceled") }) } else o.reject("Could not find InAppBrowser plugin") } else o.reject("Cannot authenticate via a web browser");                    return o.promise },                venmo: function(n, r, o) {                    var i = e.defer();                    if (window.cordova) {                        var a = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(a) === !0) {                            var c = "http://localhost/callback";                            void 0 !== o && o.hasOwnProperty("redirect_uri") && (c = o.redirect_uri);                            var s = window.open("https://api.venmo.com/v1/oauth/authorize?client_id=" + n + "&redirect_uri=" + c + "&response_type=token&scope=" + r.join(" "), "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            s.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(c)) { s.removeEventListener("exit", function(e) {}), s.close();                                    for (var n = e.url.split("#")[1], t = n.split("&"), r = [], o = 0; o < t.length; o++) r[t[o].split("=")[0]] = t[o].split("=")[1];                                    void 0 !== r.access_token && null !== r.access_token ? i.resolve({ access_token: r.access_token, expires_in: r.expires_in }) : i.reject("Problem authenticating") } }), s.addEventListener("exit", function(e) { i.reject("The sign in flow was canceled") }) } else i.reject("Could not find InAppBrowser plugin") } else i.reject("Cannot authenticate via a web browser");                    return i.promise },                stripe: function(r, o, i, a) {                    var c = e.defer();                    if (window.cordova) {                        var s = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(s) === !0) {                            var u = "http://localhost/callback";                            void 0 !== a && a.hasOwnProperty("redirect_uri") && (u = a.redirect_uri);                            var l = window.open("https://connect.stripe.com/oauth/authorize?client_id=" + r + "&redirect_uri=" + u + "&scope=" + i + "&response_type=code", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            l.addEventListener("loadstart", function(e) { 0 === e.url.indexOf("http://localhost/callback") && (requestToken = e.url.split("code=")[1], n.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded", n({ method: "post", url: "https://connect.stripe.com/oauth/token", data: "client_id=" + r + "&client_secret=" + o + "&redirect_uri=" + u + "&grant_type=authorization_code&code=" + requestToken }).success(function(e) { c.resolve(e) }).error(function(e, n) { c.reject("Problem authenticating") })["finally"](function() { setTimeout(function() { l.close() }, 10) })) }), l.addEventListener("exit", function(e) { c.reject("The sign in flow was canceled") }) } else c.reject("Could not find InAppBrowser plugin") } else c.reject("Cannot authenticate via a web browser");                    return c.promise },                rally: function(r, o, i, a) {                    var c = e.defer();                    if (window.cordova) {                        var s = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(s) === !0) {                            var u = "http://localhost/callback";                            void 0 !== a && a.hasOwnProperty("redirect_uri") && (u = a.redirect_uri);                            var l = window.open("https://rally1.rallydev.com/login/oauth2/auth?client_id=" + r + "&redirect_uri=" + u + "&scope=" + i + "&response_type=code", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            l.addEventListener("loadstart", function(e) { 0 === e.url.indexOf("http://localhost/callback") && (requestToken = e.url.split("code=")[1], n.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded", n({ method: "post", url: "https://rally1.rallydev.com/login/oauth2/auth", data: "client_id=" + r + "&client_secret=" + o + "&redirect_uri=" + u + "&grant_type=authorization_code&code=" + requestToken }).success(function(e) { c.resolve(e) }).error(function(e, n) { c.reject("Problem authenticating") })["finally"](function() { setTimeout(function() { l.close() }, 10) })) }), l.addEventListener("exit", function(e) { c.reject("The sign in flow was canceled") }) } else c.reject("Could not find InAppBrowser plugin") } else c.reject("Cannot authenticate via a web browser");                    return c.promise },                familySearch: function(t, r, o) {                    var i = e.defer();                    if (window.cordova) {                        var a = cordova.require("cordova/plugin_list").metadata;                        if (a.hasOwnProperty("cordova-plugin-inappbrowser") === !0) {                            var c = "http://localhost/callback";                            void 0 !== o && o.hasOwnProperty("redirect_uri") && (c = o.redirect_uri);                            var s = window.open("https://ident.familysearch.org/cis-web/oauth2/v3/authorization?client_id=" + t + "&redirect_uri=" + c + "&response_type=code&state=" + r, "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            s.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(c)) {                                    var r = e.url.split("code=")[1];                                    n.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded", n({ method: "post", url: "https://ident.familysearch.org/cis-web/oauth2/v3/token", data: "client_id=" + t + "&redirect_uri=" + c + "&grant_type=authorization_code&code=" + r }).success(function(e) { i.resolve(e) }).error(function(e, n) { i.reject("Problem authenticating") })["finally"](function() { setTimeout(function() { s.close() }, 10) }) } }), s.addEventListener("exit", function(e) { i.reject("The sign in flow was canceled") }) } else i.reject("Could not find InAppBrowser plugin") } else i.reject("Cannot authenticate via a web browser");                    return i.promise },                envato: function(n, r) {                    var o = e.defer();                    if (window.cordova) {                        var i = cordova.require("cordova/plugin_list").metadata;                        if (t.isInAppBrowserInstalled(i) === !0) {                            var a = "http://localhost/callback";                            void 0 !== r && r.hasOwnProperty("redirect_uri") && (a = r.redirect_uri);                            var c = window.open("https://api.envato.com/authorization?client_id=" + n + "&redirect_uri=" + a + "&response_type=token", "_blank", "location=no,clearsessioncache=yes,clearcache=yes");                            c.addEventListener("loadstart", function(e) {                                if (0 === e.url.indexOf(a)) { c.removeEventListener("exit", function(e) {}), c.close();                                    for (var n = e.url.split("#")[1], t = n.split("&"), r = [], i = 0; i < t.length; i++) r[t[i].split("=")[0]] = t[i].split("=")[1];                                    void 0 !== r.access_token && null !== r.access_token ? o.resolve({ access_token: r.access_token, expires_in: r.expires_in }) : o.reject("Problem authenticating") } }), c.addEventListener("exit", function(e) { o.reject("The sign in flow was canceled") }) } else o.reject("Could not find InAppBrowser plugin") } else o.reject("Cannot authenticate via a web browser");                    return o.promise }            }        }]), angular.module("ngCordovaOauth", ["oauth.providers", "oauth.utils"]), angular.module("oauth.utils", []).factory("$cordovaOauthUtility", ["$q", function(e) {            return { isInAppBrowserInstalled: function(e) {                    var n = ["cordova-plugin-inappbrowser", "org.apache.cordova.inappbrowser"];                    return n.some(function(n) {                        return e.hasOwnProperty(n) }) }, createSignature: function(e, n, t, r, o, i) {                    if ("undefined" != typeof jsSHA) {                        for (var a = angular.copy(t), c = Object.keys(r), s = 0; s < c.length; s++) a[c[s]] = encodeURIComponent(r[c[s]]);                        var u = e + "&" + encodeURIComponent(n) + "&",                            l = Object.keys(a).sort();                        for (s = 0; s < l.length; s++) u += s == l.length - 1 ? encodeURIComponent(l[s] + "=" + a[l[s]]) : encodeURIComponent(l[s] + "=" + a[l[s]] + "&");                        var d = new jsSHA(u, "TEXT"),                            f = "";                        i && (f = encodeURIComponent(i)), t.oauth_signature = encodeURIComponent(d.getHMAC(encodeURIComponent(o) + "&" + f, "TEXT", "SHA-1", "B64"));                        var p = Object.keys(t),                            v = "OAuth ";                        for (s = 0; s < p.length; s++) v += s == p.length - 1 ? p[s] + '="' + t[p[s]] + '"' : p[s] + '="' + t[p[s]] + '",';                        return { signature_base_string: u, authorization_header: v, signature: t.oauth_signature } }                    return "Missing jsSHA JavaScript library" }, createNonce: function(e) {                    for (var n = "", t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", r = 0; e > r; r++) n += t.charAt(Math.floor(Math.random() * t.length));                    return n }, generateUrlParameters: function(e) {                    var n = Object.keys(e);                    n.sort();                    for (var t = "", r = "", o = 0; o < n.length; o++) t += r + n[o] + "=" + e[n[o]], r = "&";                    return t }, parseResponseParameters: function(e) {                    if (e.split) {                        for (var n = e.split("&"), t = {}, r = 0; r < n.length; r++) t[n[r].split("=")[0]] = n[r].split("=")[1];                        return t }                    return {} }, generateOauthParametersInstance: function(e) {                    var n = new jsSHA(Math.round((new Date).getTime() / 1e3), "TEXT"),                        t = { oauth_consumer_key: e, oauth_nonce: n.getHash("SHA-1", "HEX"), oauth_signature_method: "HMAC-SHA1", oauth_timestamp: Math.round((new Date).getTime() / 1e3), oauth_version: "1.0" };                    return t } } }])}();
  • angular-chart.min.js
(function (factory) {  'use strict';  if (typeof define === 'function' && define.amd) {    // AMD. Register as an anonymous module.    define(['angular', 'chart.js'], factory);  } else if (typeof exports === 'object') {    // Node/CommonJS    module.exports = factory(require('angular'), require('chart.js'));  } else {    // Browser globals    factory(angular, Chart);  }}(function (angular, Chart) {  'use strict';  Chart.defaults.global.responsive = true;  Chart.defaults.global.multiTooltipTemplate = '<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>';  Chart.defaults.global.colours = [    '#97BBCD', // blue    '#DCDCDC', // light grey    '#F7464A', // red    '#46BFBD', // green    '#FDB45C', // yellow    '#949FB1', // grey    '#4D5360'  // dark grey  ];  var usingExcanvas = typeof window.G_vmlCanvasManager === 'object' &&    window.G_vmlCanvasManager !== null &&    typeof window.G_vmlCanvasManager.initElement === 'function';  if (usingExcanvas) Chart.defaults.global.animation = false;  angular.module('chart.js', [])    .provider('ChartJs', ChartJsProvider)    .factory('ChartJsFactory', ['ChartJs', '$timeout', ChartJsFactory])    .directive('chartBase', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory(); }])    .directive('chartLine', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Line'); }])    .directive('chartBar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Bar'); }])    .directive('chartRadar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Radar'); }])    .directive('chartDoughnut', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Doughnut'); }])    .directive('chartPie', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('Pie'); }])    .directive('chartPolarArea', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('PolarArea'); }]);  /**   * Wrapper for chart.js   * Allows configuring chart js using the provider   *   * angular.module('myModule', ['chart.js']).config(function(ChartJsProvider) {   *   ChartJsProvider.setOptions({ responsive: true });   *   ChartJsProvider.setOptions('Line', { responsive: false });   * })))   */  function ChartJsProvider () {    var options = {};    var ChartJs = {      Chart: Chart,      getOptions: function (type) {        var typeOptions = type && options[type] || {};        return angular.extend({}, options, typeOptions);      }    };    /**     * Allow to set global options during configuration     */    this.setOptions = function (type, customOptions) {      // If no type was specified set option for the global object      if (! customOptions) {        customOptions = type;        options = angular.extend(options, customOptions);        return;      }      // Set options for the specific chart      options[type] = angular.extend(options[type] || {}, customOptions);    };    this.$get = function () {      return ChartJs;    };  }  function ChartJsFactory (ChartJs, $timeout) {    return function chart (type) {      return {        restrict: 'CA',        scope: {          data: '=',          labels: '=',          options: '=',          series: '=',          colours: '=?',          getColour: '=?',          chartType: '=',          legend: '@',          click: '=',          hover: '='        },        link: function (scope, elem/*, attrs */) {          var chart, container = document.createElement('div');          container.className = 'chart-container';          elem.replaceWith(container);          container.appendChild(elem[0]);          if (usingExcanvas) window.G_vmlCanvasManager.initElement(elem[0]);          // Order of setting "watch" matter          scope.$watch('data', function (newVal, oldVal) {            if (! newVal || ! newVal.length || (Array.isArray(newVal[0]) && ! newVal[0].length)) return;            var chartType = type || scope.chartType;            if (! chartType) return;            if (chart) {              if (canUpdateChart(newVal, oldVal)) return updateChart(chart, newVal, scope, elem);              chart.destroy();            }            createChart(chartType);          }, true);          scope.$watch('series', resetChart, true);          scope.$watch('labels', resetChart, true);          scope.$watch('options', resetChart, true);          scope.$watch('colours', resetChart, true);          scope.$watch('chartType', function (newVal, oldVal) {            if (isEmpty(newVal)) return;            if (angular.equals(newVal, oldVal)) return;            if (chart) chart.destroy();            createChart(newVal);          });          scope.$on('$destroy', function () {            if (chart) chart.destroy();          });          function resetChart (newVal, oldVal) {            if (isEmpty(newVal)) return;            if (angular.equals(newVal, oldVal)) return;            var chartType = type || scope.chartType;            if (! chartType) return;            // chart.update() doesn't work for series and labels            // so we have to re-create the chart entirely            if (chart) chart.destroy();            createChart(chartType);          }          function createChart (type) {            if (isResponsive(type, scope) && elem[0].clientHeight === 0 && container.clientHeight === 0) {              return $timeout(function () {                createChart(type);              }, 50);            }            if (! scope.data || ! scope.data.length) return;            scope.getColour = typeof scope.getColour === 'function' ? scope.getColour : getRandomColour;            scope.colours = getColours(type, scope);            var cvs = elem[0], ctx = cvs.getContext('2d');            var data = Array.isArray(scope.data[0]) ?              getDataSets(scope.labels, scope.data, scope.series || [], scope.colours) :              getData(scope.labels, scope.data, scope.colours);            var options = angular.extend({}, ChartJs.getOptions(type), scope.options);            chart = new ChartJs.Chart(ctx)[type](data, options);            scope.$emit('create', chart);            ['hover', 'click'].forEach(function (action) {              if (scope[action])                cvs[action === 'click' ? 'onclick' : 'onmousemove'] = getEventHandler(scope, chart, action);            });            if (scope.legend && scope.legend !== 'false') setLegend(elem, chart);          }        }      };    };    function canUpdateChart (newVal, oldVal) {      if (newVal && oldVal && newVal.length && oldVal.length) {        return Array.isArray(newVal[0]) ?        newVal.length === oldVal.length && newVal.every(function (element, index) {          return element.length === oldVal[index].length; }) :          oldVal.reduce(sum, 0) > 0 ? newVal.length === oldVal.length : false;      }      return false;    }    function sum (carry, val) {      return carry + val;    }    function getEventHandler (scope, chart, action) {      return function (evt) {        var atEvent = chart.getPointsAtEvent || chart.getBarsAtEvent || chart.getSegmentsAtEvent;        if (atEvent) {          var activePoints = atEvent.call(chart, evt);          scope[action](activePoints, evt);          scope.$apply();        }      };    }    function getColours (type, scope) {      var colours = angular.copy(scope.colours ||        ChartJs.getOptions(type).colours ||        Chart.defaults.global.colours      );      while (colours.length < scope.data.length) {        colours.push(scope.getColour());      }      return colours.map(convertColour);    }    function convertColour (colour) {      if (typeof colour === 'object' && colour !== null) return colour;      if (typeof colour === 'string' && colour[0] === '#') return getColour(hexToRgb(colour.substr(1)));      return getRandomColour();    }    function getRandomColour () {      var colour = [getRandomInt(0, 255), getRandomInt(0, 255), getRandomInt(0, 255)];      return getColour(colour);    }    function getColour (colour) {      return {        fillColor: rgba(colour, 0.2),        strokeColor: rgba(colour, 1),        pointColor: rgba(colour, 1),        pointStrokeColor: '#fff',        pointHighlightFill: '#fff',        pointHighlightStroke: rgba(colour, 0.8)      };    }    function getRandomInt (min, max) {      return Math.floor(Math.random() * (max - min + 1)) + min;    }    function rgba (colour, alpha) {      if (usingExcanvas) {        // rgba not supported by IE8        return 'rgb(' + colour.join(',') + ')';      } else {        return 'rgba(' + colour.concat(alpha).join(',') + ')';      }    }    // Credit: http://stackoverflow.com/a/11508164/1190235    function hexToRgb (hex) {      var bigint = parseInt(hex, 16),        r = (bigint >> 16) & 255,        g = (bigint >> 8) & 255,        b = bigint & 255;      return [r, g, b];    }    function getDataSets (labels, data, series, colours) {      return {        labels: labels,        datasets: data.map(function (item, i) {          return angular.extend({}, colours[i], {            label: series[i],            data: item          });        })      };    }    function getData (labels, data, colours) {      return labels.map(function (label, i) {        return angular.extend({}, colours[i], {          label: label,          value: data[i],          color: colours[i].strokeColor,          highlight: colours[i].pointHighlightStroke        });      });    }    function setLegend (elem, chart) {      var $parent = elem.parent(),          $oldLegend = $parent.find('chart-legend'),          legend = '<chart-legend>' + chart.generateLegend() + '</chart-legend>';      if ($oldLegend.length) $oldLegend.replaceWith(legend);      else $parent.append(legend);    }    function updateChart (chart, values, scope, elem) {      if (Array.isArray(scope.data[0])) {        chart.datasets.forEach(function (dataset, i) {          (dataset.points || dataset.bars).forEach(function (dataItem, j) {            dataItem.value = values[i][j];          });        });      } else {        chart.segments.forEach(function (segment, i) {          segment.value = values[i];        });      }      chart.update();      scope.$emit('update', chart);      if (scope.legend && scope.legend !== 'false') setLegend(elem, chart);    }    function isEmpty (value) {      return ! value ||        (Array.isArray(value) && ! value.length) ||        (typeof value === 'object' && ! Object.keys(value).length);    }    function isResponsive (type, scope) {      var options = angular.extend({}, Chart.defaults.global, ChartJs.getOptions(type), scope.options);      return options.responsive;    }  }}));
  • Chart.min.js
/*! * Chart.js * http://chartjs.org/ * Version: 1.0.2 * * Copyright 2015 Nick Downie * Released under the MIT license * https://github.com/nnnick/Chart.js/blob/master/LICENSE.md */(function(){    "use strict";    //Declare root variable - window in the browser, global on the server    var root = this,        previous = root.Chart;    //Occupy the global variable of Chart, and create a simple base class    var Chart = function(context){        var chart = this;        this.canvas = context.canvas;        this.ctx = context;        //Variables global to the chart        var computeDimension = function(element,dimension)        {            if (element['offset'+dimension])            {                return element['offset'+dimension];            }            else            {                return document.defaultView.getComputedStyle(element).getPropertyValue(dimension);            }        }        var width = this.width = computeDimension(context.canvas,'Width');        var height = this.height = computeDimension(context.canvas,'Height');        // Firefox requires this to work correctly        context.canvas.width  = width;        context.canvas.height = height;        var width = this.width = context.canvas.width;        var height = this.height = context.canvas.height;        this.aspectRatio = this.width / this.height;        //High pixel density displays - multiply the size of the canvas height/width by the device pixel ratio, then scale.        helpers.retinaScale(this);        return this;    };    //Globally expose the defaults to allow for user updating/changing    Chart.defaults = {        global: {            // Boolean - Whether to animate the chart            animation: true,            // Number - Number of animation steps            animationSteps: 60,            // String - Animation easing effect            animationEasing: "easeOutQuart",            // Boolean - If we should show the scale at all            showScale: true,            // Boolean - If we want to override with a hard coded scale            scaleOverride: false,            // ** Required if scaleOverride is true **            // Number - The number of steps in a hard coded scale            scaleSteps: null,            // Number - The value jump in the hard coded scale            scaleStepWidth: null,            // Number - The scale starting value            scaleStartValue: null,            // String - Colour of the scale line            scaleLineColor: "rgba(0,0,0,.1)",            // Number - Pixel width of the scale line            scaleLineWidth: 1,            // Boolean - Whether to show labels on the scale            scaleShowLabels: true,            // Interpolated JS string - can access value            scaleLabel: "<%=value%>",            // Boolean - Whether the scale should stick to integers, and not show any floats even if drawing space is there            scaleIntegersOnly: true,            // Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value            scaleBeginAtZero: false,            // String - Scale label font declaration for the scale label            scaleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",            // Number - Scale label font size in pixels            scaleFontSize: 12,            // String - Scale label font weight style            scaleFontStyle: "normal",            // String - Scale label font colour            scaleFontColor: "#666",            // Boolean - whether or not the chart should be responsive and resize when the browser does.            responsive: false,            // Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container            maintainAspectRatio: true,            // Boolean - Determines whether to draw tooltips on the canvas or not - attaches events to touchmove & mousemove            showTooltips: true,            // Boolean - Determines whether to draw built-in tooltip or call custom tooltip function            customTooltips: false,            // Array - Array of string names to attach tooltip events            tooltipEvents: ["mousemove", "touchstart", "touchmove", "mouseout"],            // String - Tooltip background colour            tooltipFillColor: "rgba(0,0,0,0.8)",            // String - Tooltip label font declaration for the scale label            tooltipFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",            // Number - Tooltip label font size in pixels            tooltipFontSize: 14,            // String - Tooltip font weight style            tooltipFontStyle: "normal",            // String - Tooltip label font colour            tooltipFontColor: "#fff",            // String - Tooltip title font declaration for the scale label            tooltipTitleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",            // Number - Tooltip title font size in pixels            tooltipTitleFontSize: 14,            // String - Tooltip title font weight style            tooltipTitleFontStyle: "bold",            // String - Tooltip title font colour            tooltipTitleFontColor: "#fff",            // Number - pixel width of padding around tooltip text            tooltipYPadding: 6,            // Number - pixel width of padding around tooltip text            tooltipXPadding: 6,            // Number - Size of the caret on the tooltip            tooltipCaretSize: 8,            // Number - Pixel radius of the tooltip border            tooltipCornerRadius: 6,            // Number - Pixel offset from point x to tooltip edge            tooltipXOffset: 10,            // String - Template string for single tooltips            tooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>",            // String - Template string for single tooltips            multiTooltipTemplate: "<%= value %>",            // String - Colour behind the legend colour block            multiTooltipKeyBackground: '#fff',            // Function - Will fire on animation progression.            onAnimationProgress: function(){},            // Function - Will fire on animation completion.            onAnimationComplete: function(){}        }    };    //Create a dictionary of chart types, to allow for extension of existing types    Chart.types = {};    //Global Chart helpers object for utility methods and classes    var helpers = Chart.helpers = {};        //-- Basic js utility methods    var each = helpers.each = function(loopable,callback,self){            var additionalArgs = Array.prototype.slice.call(arguments, 3);            // Check to see if null or undefined firstly.            if (loopable){                if (loopable.length === +loopable.length){                    var i;                    for (i=0; i<loopable.length; i++){                        callback.apply(self,[loopable[i], i].concat(additionalArgs));                    }                }                else{                    for (var item in loopable){                        callback.apply(self,[loopable[item],item].concat(additionalArgs));                    }                }            }        },        clone = helpers.clone = function(obj){            var objClone = {};            each(obj,function(value,key){                if (obj.hasOwnProperty(key)) objClone[key] = value;            });            return objClone;        },        extend = helpers.extend = function(base){            each(Array.prototype.slice.call(arguments,1), function(extensionObject) {                each(extensionObject,function(value,key){                    if (extensionObject.hasOwnProperty(key)) base[key] = value;                });            });            return base;        },        merge = helpers.merge = function(base,master){            //Merge properties in left object over to a shallow clone of object right.            var args = Array.prototype.slice.call(arguments,0);            args.unshift({});            return extend.apply(null, args);        },        indexOf = helpers.indexOf = function(arrayToSearch, item){            if (Array.prototype.indexOf) {                return arrayToSearch.indexOf(item);            }            else{                for (var i = 0; i < arrayToSearch.length; i++) {                    if (arrayToSearch[i] === item) return i;                }                return -1;            }        },        where = helpers.where = function(collection, filterCallback){            var filtered = [];            helpers.each(collection, function(item){                if (filterCallback(item)){                    filtered.push(item);                }            });            return filtered;        },        findNextWhere = helpers.findNextWhere = function(arrayToSearch, filterCallback, startIndex){            // Default to start of the array            if (!startIndex){                startIndex = -1;            }            for (var i = startIndex + 1; i < arrayToSearch.length; i++) {                var currentItem = arrayToSearch[i];                if (filterCallback(currentItem)){                    return currentItem;                }            }        },        findPreviousWhere = helpers.findPreviousWhere = function(arrayToSearch, filterCallback, startIndex){            // Default to end of the array            if (!startIndex){                startIndex = arrayToSearch.length;            }            for (var i = startIndex - 1; i >= 0; i--) {                var currentItem = arrayToSearch[i];                if (filterCallback(currentItem)){                    return currentItem;                }            }        },        inherits = helpers.inherits = function(extensions){            //Basic javascript inheritance based on the model created in Backbone.js            var parent = this;            var ChartElement = (extensions && extensions.hasOwnProperty("constructor")) ? extensions.constructor : function(){ return parent.apply(this, arguments); };            var Surrogate = function(){ this.constructor = ChartElement;};            Surrogate.prototype = parent.prototype;            ChartElement.prototype = new Surrogate();            ChartElement.extend = inherits;            if (extensions) extend(ChartElement.prototype, extensions);            ChartElement.__super__ = parent.prototype;            return ChartElement;        },        noop = helpers.noop = function(){},        uid = helpers.uid = (function(){            var id=0;            return function(){                return "chart-" + id++;            };        })(),        warn = helpers.warn = function(str){            //Method for warning of errors            if (window.console && typeof window.console.warn == "function") console.warn(str);        },        amd = helpers.amd = (typeof define == 'function' && define.amd),        //-- Math methods        isNumber = helpers.isNumber = function(n){            return !isNaN(parseFloat(n)) && isFinite(n);        },        max = helpers.max = function(array){            return Math.max.apply( Math, array );        },        min = helpers.min = function(array){            return Math.min.apply( Math, array );        },        cap = helpers.cap = function(valueToCap,maxValue,minValue){            if(isNumber(maxValue)) {                if( valueToCap > maxValue ) {                    return maxValue;                }            }            else if(isNumber(minValue)){                if ( valueToCap < minValue ){                    return minValue;                }            }            return valueToCap;        },        getDecimalPlaces = helpers.getDecimalPlaces = function(num){            if (num%1!==0 && isNumber(num)){                return num.toString().split(".")[1].length;            }            else {                return 0;            }        },        toRadians = helpers.radians = function(degrees){            return degrees * (Math.PI/180);        },        // Gets the angle from vertical upright to the point about a centre.        getAngleFromPoint = helpers.getAngleFromPoint = function(centrePoint, anglePoint){            var distanceFromXCenter = anglePoint.x - centrePoint.x,                distanceFromYCenter = anglePoint.y - centrePoint.y,                radialDistanceFromCenter = Math.sqrt( distanceFromXCenter * distanceFromXCenter + distanceFromYCenter * distanceFromYCenter);            var angle = Math.PI * 2 + Math.atan2(distanceFromYCenter, distanceFromXCenter);            //If the segment is in the top left quadrant, we need to add another rotation to the angle            if (distanceFromXCenter < 0 && distanceFromYCenter < 0){                angle += Math.PI*2;            }            return {                angle: angle,                distance: radialDistanceFromCenter            };        },        aliasPixel = helpers.aliasPixel = function(pixelWidth){            return (pixelWidth % 2 === 0) ? 0 : 0.5;        },        splineCurve = helpers.splineCurve = function(FirstPoint,MiddlePoint,AfterPoint,t){            //Props to Rob Spencer at scaled innovation for his post on splining between points            //http://scaledinnovation.com/analytics/splines/aboutSplines.html            var d01=Math.sqrt(Math.pow(MiddlePoint.x-FirstPoint.x,2)+Math.pow(MiddlePoint.y-FirstPoint.y,2)),                d12=Math.sqrt(Math.pow(AfterPoint.x-MiddlePoint.x,2)+Math.pow(AfterPoint.y-MiddlePoint.y,2)),                fa=t*d01/(d01+d12),// scaling factor for triangle Ta                fb=t*d12/(d01+d12);            return {                inner : {                    x : MiddlePoint.x-fa*(AfterPoint.x-FirstPoint.x),                    y : MiddlePoint.y-fa*(AfterPoint.y-FirstPoint.y)                },                outer : {                    x: MiddlePoint.x+fb*(AfterPoint.x-FirstPoint.x),                    y : MiddlePoint.y+fb*(AfterPoint.y-FirstPoint.y)                }            };        },        calculateOrderOfMagnitude = helpers.calculateOrderOfMagnitude = function(val){            return Math.floor(Math.log(val) / Math.LN10);        },        calculateScaleRange = helpers.calculateScaleRange = function(valuesArray, drawingSize, textSize, startFromZero, integersOnly){            //Set a minimum step of two - a point at the top of the graph, and a point at the base            var minSteps = 2,                maxSteps = Math.floor(drawingSize/(textSize * 1.5)),                skipFitting = (minSteps >= maxSteps);            var maxValue = max(valuesArray),                minValue = min(valuesArray);            // We need some degree of seperation here to calculate the scales if all the values are the same            // Adding/minusing 0.5 will give us a range of 1.            if (maxValue === minValue){                maxValue += 0.5;                // So we don't end up with a graph with a negative start value if we've said always start from zero                if (minValue >= 0.5 && !startFromZero){                    minValue -= 0.5;                }                else{                    // Make up a whole number above the values                    maxValue += 0.5;                }            }            var valueRange = Math.abs(maxValue - minValue),                rangeOrderOfMagnitude = calculateOrderOfMagnitude(valueRange),                graphMax = Math.ceil(maxValue / (1 * Math.pow(10, rangeOrderOfMagnitude))) * Math.pow(10, rangeOrderOfMagnitude),                graphMin = (startFromZero) ? 0 : Math.floor(minValue / (1 * Math.pow(10, rangeOrderOfMagnitude))) * Math.pow(10, rangeOrderOfMagnitude),                graphRange = graphMax - graphMin,                stepValue = Math.pow(10, rangeOrderOfMagnitude),                numberOfSteps = Math.round(graphRange / stepValue);            //If we have more space on the graph we'll use it to give more definition to the data            while((numberOfSteps > maxSteps || (numberOfSteps * 2) < maxSteps) && !skipFitting) {                if(numberOfSteps > maxSteps){                    stepValue *=2;                    numberOfSteps = Math.round(graphRange/stepValue);                    // Don't ever deal with a decimal number of steps - cancel fitting and just use the minimum number of steps.                    if (numberOfSteps % 1 !== 0){                        skipFitting = true;                    }                }                //We can fit in double the amount of scale points on the scale                else{                    //If user has declared ints only, and the step value isn't a decimal                    if (integersOnly && rangeOrderOfMagnitude >= 0){                        //If the user has said integers only, we need to check that making the scale more granular wouldn't make it a float                        if(stepValue/2 % 1 === 0){                            stepValue /=2;                            numberOfSteps = Math.round(graphRange/stepValue);                        }                        //If it would make it a float break out of the loop                        else{                            break;                        }                    }                    //If the scale doesn't have to be an int, make the scale more granular anyway.                    else{                        stepValue /=2;                        numberOfSteps = Math.round(graphRange/stepValue);                    }                }            }            if (skipFitting){                numberOfSteps = minSteps;                stepValue = graphRange / numberOfSteps;            }            return {                steps : numberOfSteps,                stepValue : stepValue,                min : graphMin,                max : graphMin + (numberOfSteps * stepValue)            };        },        /* jshint ignore:start */        // Blows up jshint errors based on the new Function constructor        //Templating methods        //Javascript micro templating by John Resig - source at http://ejohn.org/blog/javascript-micro-templating/        template = helpers.template = function(templateString, valuesObject){            // If templateString is function rather than string-template - call the function for valuesObject            if(templateString instanceof Function){                return templateString(valuesObject);            }            var cache = {};            function tmpl(str, data){                // Figure out if we're getting a template, or if we need to                // load the template - and be sure to cache the result.                var fn = !/\W/.test(str) ?                cache[str] = cache[str] :                // Generate a reusable function that will serve as a template                // generator (and which will be cached).                new Function("obj",                    "var p=[],print=function(){p.push.apply(p,arguments);};" +                    // Introduce the data as local variables using with(){}                    "with(obj){p.push('" +                    // Convert the template into pure JavaScript                    str                        .replace(/[\r\t\n]/g, " ")                        .split("<%").join("\t")                        .replace(/((^|%>)[^\t]*)'/g, "$1\r")                        .replace(/\t=(.*?)%>/g, "',$1,'")                        .split("\t").join("');")                        .split("%>").join("p.push('")                        .split("\r").join("\\'") +                    "');}return p.join('');"                );                // Provide some basic currying to the user                return data ? fn( data ) : fn;            }            return tmpl(templateString,valuesObject);        },        /* jshint ignore:end */        generateLabels = helpers.generateLabels = function(templateString,numberOfSteps,graphMin,stepValue){            var labelsArray = new Array(numberOfSteps);            if (labelTemplateString){                each(labelsArray,function(val,index){                    labelsArray[index] = template(templateString,{value: (graphMin + (stepValue*(index+1)))});                });            }            return labelsArray;        },        //--Animation methods        //Easing functions adapted from Robert Penner's easing equations        //http://www.robertpenner.com/easing/        easingEffects = helpers.easingEffects = {            linear: function (t) {                return t;            },            easeInQuad: function (t) {                return t * t;            },            easeOutQuad: function (t) {                return -1 * t * (t - 2);            },            easeInOutQuad: function (t) {                if ((t /= 1 / 2) < 1) return 1 / 2 * t * t;                return -1 / 2 * ((--t) * (t - 2) - 1);            },            easeInCubic: function (t) {                return t * t * t;            },            easeOutCubic: function (t) {                return 1 * ((t = t / 1 - 1) * t * t + 1);            },            easeInOutCubic: function (t) {                if ((t /= 1 / 2) < 1) return 1 / 2 * t * t * t;                return 1 / 2 * ((t -= 2) * t * t + 2);            },            easeInQuart: function (t) {                return t * t * t * t;            },            easeOutQuart: function (t) {                return -1 * ((t = t / 1 - 1) * t * t * t - 1);            },            easeInOutQuart: function (t) {                if ((t /= 1 / 2) < 1) return 1 / 2 * t * t * t * t;                return -1 / 2 * ((t -= 2) * t * t * t - 2);            },            easeInQuint: function (t) {                return 1 * (t /= 1) * t * t * t * t;            },            easeOutQuint: function (t) {                return 1 * ((t = t / 1 - 1) * t * t * t * t + 1);            },            easeInOutQuint: function (t) {                if ((t /= 1 / 2) < 1) return 1 / 2 * t * t * t * t * t;                return 1 / 2 * ((t -= 2) * t * t * t * t + 2);            },            easeInSine: function (t) {                return -1 * Math.cos(t / 1 * (Math.PI / 2)) + 1;            },            easeOutSine: function (t) {                return 1 * Math.sin(t / 1 * (Math.PI / 2));            },            easeInOutSine: function (t) {                return -1 / 2 * (Math.cos(Math.PI * t / 1) - 1);            },            easeInExpo: function (t) {                return (t === 0) ? 1 : 1 * Math.pow(2, 10 * (t / 1 - 1));            },            easeOutExpo: function (t) {                return (t === 1) ? 1 : 1 * (-Math.pow(2, -10 * t / 1) + 1);            },            easeInOutExpo: function (t) {                if (t === 0) return 0;                if (t === 1) return 1;                if ((t /= 1 / 2) < 1) return 1 / 2 * Math.pow(2, 10 * (t - 1));                return 1 / 2 * (-Math.pow(2, -10 * --t) + 2);            },            easeInCirc: function (t) {                if (t >= 1) return t;                return -1 * (Math.sqrt(1 - (t /= 1) * t) - 1);            },            easeOutCirc: function (t) {                return 1 * Math.sqrt(1 - (t = t / 1 - 1) * t);            },            easeInOutCirc: function (t) {                if ((t /= 1 / 2) < 1) return -1 / 2 * (Math.sqrt(1 - t * t) - 1);                return 1 / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1);            },            easeInElastic: function (t) {                var s = 1.70158;                var p = 0;                var a = 1;                if (t === 0) return 0;                if ((t /= 1) == 1) return 1;                if (!p) p = 1 * 0.3;                if (a < Math.abs(1)) {                    a = 1;                    s = p / 4;                } else s = p / (2 * Math.PI) * Math.asin(1 / a);                return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * 1 - s) * (2 * Math.PI) / p));            },            easeOutElastic: function (t) {                var s = 1.70158;                var p = 0;                var a = 1;                if (t === 0) return 0;                if ((t /= 1) == 1) return 1;                if (!p) p = 1 * 0.3;                if (a < Math.abs(1)) {                    a = 1;                    s = p / 4;                } else s = p / (2 * Math.PI) * Math.asin(1 / a);                return a * Math.pow(2, -10 * t) * Math.sin((t * 1 - s) * (2 * Math.PI) / p) + 1;            },            easeInOutElastic: function (t) {                var s = 1.70158;                var p = 0;                var a = 1;                if (t === 0) return 0;                if ((t /= 1 / 2) == 2) return 1;                if (!p) p = 1 * (0.3 * 1.5);                if (a < Math.abs(1)) {                    a = 1;                    s = p / 4;                } else s = p / (2 * Math.PI) * Math.asin(1 / a);                if (t < 1) return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * 1 - s) * (2 * Math.PI) / p));                return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * 1 - s) * (2 * Math.PI) / p) * 0.5 + 1;            },            easeInBack: function (t) {                var s = 1.70158;                return 1 * (t /= 1) * t * ((s + 1) * t - s);            },            easeOutBack: function (t) {                var s = 1.70158;                return 1 * ((t = t / 1 - 1) * t * ((s + 1) * t + s) + 1);            },            easeInOutBack: function (t) {                var s = 1.70158;                if ((t /= 1 / 2) < 1) return 1 / 2 * (t * t * (((s *= (1.525)) + 1) * t - s));                return 1 / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2);            },            easeInBounce: function (t) {                return 1 - easingEffects.easeOutBounce(1 - t);            },            easeOutBounce: function (t) {                if ((t /= 1) < (1 / 2.75)) {                    return 1 * (7.5625 * t * t);                } else if (t < (2 / 2.75)) {                    return 1 * (7.5625 * (t -= (1.5 / 2.75)) * t + 0.75);                } else if (t < (2.5 / 2.75)) {                    return 1 * (7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375);                } else {                    return 1 * (7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375);                }            },            easeInOutBounce: function (t) {                if (t < 1 / 2) return easingEffects.easeInBounce(t * 2) * 0.5;                return easingEffects.easeOutBounce(t * 2 - 1) * 0.5 + 1 * 0.5;            }        },        //Request animation polyfill - http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/        requestAnimFrame = helpers.requestAnimFrame = (function(){            return window.requestAnimationFrame ||                window.webkitRequestAnimationFrame ||                window.mozRequestAnimationFrame ||                window.oRequestAnimationFrame ||                window.msRequestAnimationFrame ||                function(callback) {                    return window.setTimeout(callback, 1000 / 60);                };        })(),        cancelAnimFrame = helpers.cancelAnimFrame = (function(){            return window.cancelAnimationFrame ||                window.webkitCancelAnimationFrame ||                window.mozCancelAnimationFrame ||                window.oCancelAnimationFrame ||                window.msCancelAnimationFrame ||                function(callback) {                    return window.clearTimeout(callback, 1000 / 60);                };        })(),        animationLoop = helpers.animationLoop = function(callback,totalSteps,easingString,onProgress,onComplete,chartInstance){            var currentStep = 0,                easingFunction = easingEffects[easingString] || easingEffects.linear;            var animationFrame = function(){                currentStep++;                var stepDecimal = currentStep/totalSteps;                var easeDecimal = easingFunction(stepDecimal);                callback.call(chartInstance,easeDecimal,stepDecimal, currentStep);                onProgress.call(chartInstance,easeDecimal,stepDecimal);                if (currentStep < totalSteps){                    chartInstance.animationFrame = requestAnimFrame(animationFrame);                } else{                    onComplete.apply(chartInstance);                }            };            requestAnimFrame(animationFrame);        },        //-- DOM methods        getRelativePosition = helpers.getRelativePosition = function(evt){            var mouseX, mouseY;            var e = evt.originalEvent || evt,                canvas = evt.currentTarget || evt.srcElement,                boundingRect = canvas.getBoundingClientRect();            if (e.touches){                mouseX = e.touches[0].clientX - boundingRect.left;                mouseY = e.touches[0].clientY - boundingRect.top;            }            else{                mouseX = e.clientX - boundingRect.left;                mouseY = e.clientY - boundingRect.top;            }            return {                x : mouseX,                y : mouseY            };        },        addEvent = helpers.addEvent = function(node,eventType,method){            if (node.addEventListener){                node.addEventListener(eventType,method);            } else if (node.attachEvent){                node.attachEvent("on"+eventType, method);            } else {                node["on"+eventType] = method;            }        },        removeEvent = helpers.removeEvent = function(node, eventType, handler){            if (node.removeEventListener){                node.removeEventListener(eventType, handler, false);            } else if (node.detachEvent){                node.detachEvent("on"+eventType,handler);            } else{                node["on" + eventType] = noop;            }        },        bindEvents = helpers.bindEvents = function(chartInstance, arrayOfEvents, handler){            // Create the events object if it's not already present            if (!chartInstance.events) chartInstance.events = {};            each(arrayOfEvents,function(eventName){                chartInstance.events[eventName] = function(){                    handler.apply(chartInstance, arguments);                };                addEvent(chartInstance.chart.canvas,eventName,chartInstance.events[eventName]);            });        },        unbindEvents = helpers.unbindEvents = function (chartInstance, arrayOfEvents) {            each(arrayOfEvents, function(handler,eventName){                removeEvent(chartInstance.chart.canvas, eventName, handler);            });        },        getMaximumWidth = helpers.getMaximumWidth = function(domNode){            var container = domNode.parentNode;            // TODO = check cross browser stuff with this.            return container.clientWidth;        },        getMaximumHeight = helpers.getMaximumHeight = function(domNode){            var container = domNode.parentNode;            // TODO = check cross browser stuff with this.            return container.clientHeight;        },        getMaximumSize = helpers.getMaximumSize = helpers.getMaximumWidth, // legacy support        retinaScale = helpers.retinaScale = function(chart){            var ctx = chart.ctx,                width = chart.canvas.width,                height = chart.canvas.height;            if (window.devicePixelRatio) {                ctx.canvas.style.width = width + "px";                ctx.canvas.style.height = height + "px";                ctx.canvas.height = height * window.devicePixelRatio;                ctx.canvas.width = width * window.devicePixelRatio;                ctx.scale(window.devicePixelRatio, window.devicePixelRatio);            }        },        //-- Canvas methods        clear = helpers.clear = function(chart){            chart.ctx.clearRect(0,0,chart.width,chart.height);        },        fontString = helpers.fontString = function(pixelSize,fontStyle,fontFamily){            return fontStyle + " " + pixelSize+"px " + fontFamily;        },        longestText = helpers.longestText = function(ctx,font,arrayOfStrings){            ctx.font = font;            var longest = 0;            each(arrayOfStrings,function(string){                var textWidth = ctx.measureText(string).width;                longest = (textWidth > longest) ? textWidth : longest;            });            return longest;        },        drawRoundedRectangle = helpers.drawRoundedRectangle = function(ctx,x,y,width,height,radius){            ctx.beginPath();            ctx.moveTo(x + radius, y);            ctx.lineTo(x + width - radius, y);            ctx.quadraticCurveTo(x + width, y, x + width, y + radius);            ctx.lineTo(x + width, y + height - radius);            ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);            ctx.lineTo(x + radius, y + height);            ctx.quadraticCurveTo(x, y + height, x, y + height - radius);            ctx.lineTo(x, y + radius);            ctx.quadraticCurveTo(x, y, x + radius, y);            ctx.closePath();        };    //Store a reference to each instance - allowing us to globally resize chart instances on window resize.    //Destroy method on the chart will remove the instance of the chart from this reference.    Chart.instances = {};    Chart.Type = function(data,options,chart){        this.options = options;        this.chart = chart;        this.id = uid();        //Add the chart instance to the global namespace        Chart.instances[this.id] = this;        // Initialize is always called when a chart type is created        // By default it is a no op, but it should be extended        if (options.responsive){            this.resize();        }        this.initialize.call(this,data);    };    //Core methods that'll be a part of every chart type    extend(Chart.Type.prototype,{        initialize : function(){return this;},        clear : function(){            clear(this.chart);            return this;        },        stop : function(){            // Stops any current animation loop occuring            cancelAnimFrame(this.animationFrame);            return this;        },        resize : function(callback){            this.stop();            var canvas = this.chart.canvas,                newWidth = getMaximumWidth(this.chart.canvas),                newHeight = this.options.maintainAspectRatio ? newWidth / this.chart.aspectRatio : getMaximumHeight(this.chart.canvas);            canvas.width = this.chart.width = newWidth;            canvas.height = this.chart.height = newHeight;            retinaScale(this.chart);            if (typeof callback === "function"){                callback.apply(this, Array.prototype.slice.call(arguments, 1));            }            return this;        },        reflow : noop,        render : function(reflow){            if (reflow){                this.reflow();            }            if (this.options.animation && !reflow){                helpers.animationLoop(                    this.draw,                    this.options.animationSteps,                    this.options.animationEasing,                    this.options.onAnimationProgress,                    this.options.onAnimationComplete,                    this                );            }            else{                this.draw();                this.options.onAnimationComplete.call(this);            }            return this;        },        generateLegend : function(){            return template(this.options.legendTemplate,this);        },        destroy : function(){            this.clear();            unbindEvents(this, this.events);            var canvas = this.chart.canvas;            // Reset canvas height/width attributes starts a fresh with the canvas context            canvas.width = this.chart.width;            canvas.height = this.chart.height;            // < IE9 doesn't support removeProperty            if (canvas.style.removeProperty) {                canvas.style.removeProperty('width');                canvas.style.removeProperty('height');            } else {                canvas.style.removeAttribute('width');                canvas.style.removeAttribute('height');            }            delete Chart.instances[this.id];        },        showTooltip : function(ChartElements, forceRedraw){            // Only redraw the chart if we've actually changed what we're hovering on.            if (typeof this.activeElements === 'undefined') this.activeElements = [];            var isChanged = (function(Elements){                var changed = false;                if (Elements.length !== this.activeElements.length){                    changed = true;                    return changed;                }                each(Elements, function(element, index){                    if (element !== this.activeElements[index]){                        changed = true;                    }                }, this);                return changed;            }).call(this, ChartElements);            if (!isChanged && !forceRedraw){                return;            }            else{                this.activeElements = ChartElements;            }            this.draw();            if(this.options.customTooltips){                this.options.customTooltips(false);            }            if (ChartElements.length > 0){                // If we have multiple datasets, show a MultiTooltip for all of the data points at that index                if (this.datasets && this.datasets.length > 1) {                    var dataArray,                        dataIndex;                    for (var i = this.datasets.length - 1; i >= 0; i--) {                        dataArray = this.datasets[i].points || this.datasets[i].bars || this.datasets[i].segments;                        dataIndex = indexOf(dataArray, ChartElements[0]);                        if (dataIndex !== -1){                            break;                        }                    }                    var tooltipLabels = [],                        tooltipColors = [],                        medianPosition = (function(index) {                            // Get all the points at that particular index                            var Elements = [],                                dataCollection,                                xPositions = [],                                yPositions = [],                                xMax,                                yMax,                                xMin,                                yMin;                            helpers.each(this.datasets, function(dataset){                                dataCollection = dataset.points || dataset.bars || dataset.segments;                                if (dataCollection[dataIndex] && dataCollection[dataIndex].hasValue()){                                    Elements.push(dataCollection[dataIndex]);                                }                            });                            helpers.each(Elements, function(element) {                                xPositions.push(element.x);                                yPositions.push(element.y);                                //Include any colour information about the element                                tooltipLabels.push(helpers.template(this.options.multiTooltipTemplate, element));                                tooltipColors.push({                                    fill: element._saved.fillColor || element.fillColor,                                    stroke: element._saved.strokeColor || element.strokeColor                                });                            }, this);                            yMin = min(yPositions);                            yMax = max(yPositions);                            xMin = min(xPositions);                            xMax = max(xPositions);                            return {                                x: (xMin > this.chart.width/2) ? xMin : xMax,                                y: (yMin + yMax)/2                            };                        }).call(this, dataIndex);                    new Chart.MultiTooltip({                        x: medianPosition.x,                        y: medianPosition.y,                        xPadding: this.options.tooltipXPadding,                        yPadding: this.options.tooltipYPadding,                        xOffset: this.options.tooltipXOffset,                        fillColor: this.options.tooltipFillColor,                        textColor: this.options.tooltipFontColor,                        fontFamily: this.options.tooltipFontFamily,                        fontStyle: this.options.tooltipFontStyle,                        fontSize: this.options.tooltipFontSize,                        titleTextColor: this.options.tooltipTitleFontColor,                        titleFontFamily: this.options.tooltipTitleFontFamily,                        titleFontStyle: this.options.tooltipTitleFontStyle,                        titleFontSize: this.options.tooltipTitleFontSize,                        cornerRadius: this.options.tooltipCornerRadius,                        labels: tooltipLabels,                        legendColors: tooltipColors,                        legendColorBackground : this.options.multiTooltipKeyBackground,                        title: ChartElements[0].label,                        chart: this.chart,                        ctx: this.chart.ctx,                        custom: this.options.customTooltips                    }).draw();                } else {                    each(ChartElements, function(Element) {                        var tooltipPosition = Element.tooltipPosition();                        new Chart.Tooltip({                            x: Math.round(tooltipPosition.x),                            y: Math.round(tooltipPosition.y),                            xPadding: this.options.tooltipXPadding,                            yPadding: this.options.tooltipYPadding,                            fillColor: this.options.tooltipFillColor,                            textColor: this.options.tooltipFontColor,                            fontFamily: this.options.tooltipFontFamily,                            fontStyle: this.options.tooltipFontStyle,                            fontSize: this.options.tooltipFontSize,                            caretHeight: this.options.tooltipCaretSize,                            cornerRadius: this.options.tooltipCornerRadius,                            text: template(this.options.tooltipTemplate, Element),                            chart: this.chart,                            custom: this.options.customTooltips                        }).draw();                    }, this);                }            }            return this;        },        toBase64Image : function(){            return this.chart.canvas.toDataURL.apply(this.chart.canvas, arguments);        }    });    Chart.Type.extend = function(extensions){        var parent = this;        var ChartType = function(){            return parent.apply(this,arguments);        };        //Copy the prototype object of the this class        ChartType.prototype = clone(parent.prototype);        //Now overwrite some of the properties in the base class with the new extensions        extend(ChartType.prototype, extensions);        ChartType.extend = Chart.Type.extend;        if (extensions.name || parent.prototype.name){            var chartName = extensions.name || parent.prototype.name;            //Assign any potential default values of the new chart type            //If none are defined, we'll use a clone of the chart type this is being extended from.            //I.e. if we extend a line chart, we'll use the defaults from the line chart if our new chart            //doesn't define some defaults of their own.            var baseDefaults = (Chart.defaults[parent.prototype.name]) ? clone(Chart.defaults[parent.prototype.name]) : {};            Chart.defaults[chartName] = extend(baseDefaults,extensions.defaults);            Chart.types[chartName] = ChartType;            //Register this new chart type in the Chart prototype            Chart.prototype[chartName] = function(data,options){                var config = merge(Chart.defaults.global, Chart.defaults[chartName], options || {});                return new ChartType(data,config,this);            };        } else{            warn("Name not provided for this chart, so it hasn't been registered");        }        return parent;    };    Chart.Element = function(configuration){        extend(this,configuration);        this.initialize.apply(this,arguments);        this.save();    };    extend(Chart.Element.prototype,{        initialize : function(){},        restore : function(props){            if (!props){                extend(this,this._saved);            } else {                each(props,function(key){                    this[key] = this._saved[key];                },this);            }            return this;        },        save : function(){            this._saved = clone(this);            delete this._saved._saved;            return this;        },        update : function(newProps){            each(newProps,function(value,key){                this._saved[key] = this[key];                this[key] = value;            },this);            return this;        },        transition : function(props,ease){            each(props,function(value,key){                this[key] = ((value - this._saved[key]) * ease) + this._saved[key];            },this);            return this;        },        tooltipPosition : function(){            return {                x : this.x,                y : this.y            };        },        hasValue: function(){            return isNumber(this.value);        }    });    Chart.Element.extend = inherits;    Chart.Point = Chart.Element.extend({        display: true,        inRange: function(chartX,chartY){            var hitDetectionRange = this.hitDetectionRadius + this.radius;            return ((Math.pow(chartX-this.x, 2)+Math.pow(chartY-this.y, 2)) < Math.pow(hitDetectionRange,2));        },        draw : function(){            if (this.display){                var ctx = this.ctx;                ctx.beginPath();                ctx.arc(this.x, this.y, this.radius, 0, Math.PI*2);                ctx.closePath();                ctx.strokeStyle = this.strokeColor;                ctx.lineWidth = this.strokeWidth;                ctx.fillStyle = this.fillColor;                ctx.fill();                ctx.stroke();            }            //Quick debug for bezier curve splining            //Highlights control points and the line between them.            //Handy for dev - stripped in the min version.            // ctx.save();            // ctx.fillStyle = "black";            // ctx.strokeStyle = "black"            // ctx.beginPath();            // ctx.arc(this.controlPoints.inner.x,this.controlPoints.inner.y, 2, 0, Math.PI*2);            // ctx.fill();            // ctx.beginPath();            // ctx.arc(this.controlPoints.outer.x,this.controlPoints.outer.y, 2, 0, Math.PI*2);            // ctx.fill();            // ctx.moveTo(this.controlPoints.inner.x,this.controlPoints.inner.y);            // ctx.lineTo(this.x, this.y);            // ctx.lineTo(this.controlPoints.outer.x,this.controlPoints.outer.y);            // ctx.stroke();            // ctx.restore();        }    });    Chart.Arc = Chart.Element.extend({        inRange : function(chartX,chartY){            var pointRelativePosition = helpers.getAngleFromPoint(this, {                x: chartX,                y: chartY            });            //Check if within the range of the open/close angle            var betweenAngles = (pointRelativePosition.angle >= this.startAngle && pointRelativePosition.angle <= this.endAngle),                withinRadius = (pointRelativePosition.distance >= this.innerRadius && pointRelativePosition.distance <= this.outerRadius);            return (betweenAngles && withinRadius);            //Ensure within the outside of the arc centre, but inside arc outer        },        tooltipPosition : function(){            var centreAngle = this.startAngle + ((this.endAngle - this.startAngle) / 2),                rangeFromCentre = (this.outerRadius - this.innerRadius) / 2 + this.innerRadius;            return {                x : this.x + (Math.cos(centreAngle) * rangeFromCentre),                y : this.y + (Math.sin(centreAngle) * rangeFromCentre)            };        },        draw : function(animationPercent){            var easingDecimal = animationPercent || 1;            var ctx = this.ctx;            ctx.beginPath();            ctx.arc(this.x, this.y, this.outerRadius, this.startAngle, this.endAngle);            ctx.arc(this.x, this.y, this.innerRadius, this.endAngle, this.startAngle, true);            ctx.closePath();            ctx.strokeStyle = this.strokeColor;            ctx.lineWidth = this.strokeWidth;            ctx.fillStyle = this.fillColor;            ctx.fill();            ctx.lineJoin = 'bevel';            if (this.showStroke){                ctx.stroke();            }        }    });    Chart.Rectangle = Chart.Element.extend({        draw : function(){            var ctx = this.ctx,                halfWidth = this.width/2,                leftX = this.x - halfWidth,                rightX = this.x + halfWidth,                top = this.base - (this.base - this.y),                halfStroke = this.strokeWidth / 2;            // Canvas doesn't allow us to stroke inside the width so we can            // adjust the sizes to fit if we're setting a stroke on the line            if (this.showStroke){                leftX += halfStroke;                rightX -= halfStroke;                top += halfStroke;            }            ctx.beginPath();            ctx.fillStyle = this.fillColor;            ctx.strokeStyle = this.strokeColor;            ctx.lineWidth = this.strokeWidth;            // It'd be nice to keep this class totally generic to any rectangle            // and simply specify which border to miss out.            ctx.moveTo(leftX, this.base);            ctx.lineTo(leftX, top);            ctx.lineTo(rightX, top);            ctx.lineTo(rightX, this.base);            ctx.fill();            if (this.showStroke){                ctx.stroke();            }        },        height : function(){            return this.base - this.y;        },        inRange : function(chartX,chartY){            return (chartX >= this.x - this.width/2 && chartX <= this.x + this.width/2) && (chartY >= this.y && chartY <= this.base);        }    });    Chart.Tooltip = Chart.Element.extend({        draw : function(){            var ctx = this.chart.ctx;            ctx.font = fontString(this.fontSize,this.fontStyle,this.fontFamily);            this.xAlign = "center";            this.yAlign = "above";            //Distance between the actual element.y position and the start of the tooltip caret            var caretPadding = this.caretPadding = 2;            var tooltipWidth = ctx.measureText(this.text).width + 2*this.xPadding,                tooltipRectHeight = this.fontSize + 2*this.yPadding,                tooltipHeight = tooltipRectHeight + this.caretHeight + caretPadding;            if (this.x + tooltipWidth/2 >this.chart.width){                this.xAlign = "left";            } else if (this.x - tooltipWidth/2 < 0){                this.xAlign = "right";            }            if (this.y - tooltipHeight < 0){                this.yAlign = "below";            }            var tooltipX = this.x - tooltipWidth/2,                tooltipY = this.y - tooltipHeight;            ctx.fillStyle = this.fillColor;            // Custom Tooltips            if(this.custom){                this.custom(this);            }            else{                switch(this.yAlign)                {                case "above":                    //Draw a caret above the x/y                    ctx.beginPath();                    ctx.moveTo(this.x,this.y - caretPadding);                    ctx.lineTo(this.x + this.caretHeight, this.y - (caretPadding + this.caretHeight));                    ctx.lineTo(this.x - this.caretHeight, this.y - (caretPadding + this.caretHeight));                    ctx.closePath();                    ctx.fill();                    break;                case "below":                    tooltipY = this.y + caretPadding + this.caretHeight;                    //Draw a caret below the x/y                    ctx.beginPath();                    ctx.moveTo(this.x, this.y + caretPadding);                    ctx.lineTo(this.x + this.caretHeight, this.y + caretPadding + this.caretHeight);                    ctx.lineTo(this.x - this.caretHeight, this.y + caretPadding + this.caretHeight);                    ctx.closePath();                    ctx.fill();                    break;                }                switch(this.xAlign)                {                case "left":                    tooltipX = this.x - tooltipWidth + (this.cornerRadius + this.caretHeight);                    break;                case "right":                    tooltipX = this.x - (this.cornerRadius + this.caretHeight);                    break;                }                drawRoundedRectangle(ctx,tooltipX,tooltipY,tooltipWidth,tooltipRectHeight,this.cornerRadius);                ctx.fill();                ctx.fillStyle = this.textColor;                ctx.textAlign = "center";                ctx.textBaseline = "middle";                ctx.fillText(this.text, tooltipX + tooltipWidth/2, tooltipY + tooltipRectHeight/2);            }        }    });    Chart.MultiTooltip = Chart.Element.extend({        initialize : function(){            this.font = fontString(this.fontSize,this.fontStyle,this.fontFamily);            this.titleFont = fontString(this.titleFontSize,this.titleFontStyle,this.titleFontFamily);            this.height = (this.labels.length * this.fontSize) + ((this.labels.length-1) * (this.fontSize/2)) + (this.yPadding*2) + this.titleFontSize *1.5;            this.ctx.font = this.titleFont;            var titleWidth = this.ctx.measureText(this.title).width,                //Label has a legend square as well so account for this.                labelWidth = longestText(this.ctx,this.font,this.labels) + this.fontSize + 3,                longestTextWidth = max([labelWidth,titleWidth]);            this.width = longestTextWidth + (this.xPadding*2);            var halfHeight = this.height/2;            //Check to ensure the height will fit on the canvas            if (this.y - halfHeight < 0 ){                this.y = halfHeight;            } else if (this.y + halfHeight > this.chart.height){                this.y = this.chart.height - halfHeight;            }            //Decide whether to align left or right based on position on canvas            if (this.x > this.chart.width/2){                this.x -= this.xOffset + this.width;            } else {                this.x += this.xOffset;            }        },        getLineHeight : function(index){            var baseLineHeight = this.y - (this.height/2) + this.yPadding,                afterTitleIndex = index-1;            //If the index is zero, we're getting the title            if (index === 0){                return baseLineHeight + this.titleFontSize/2;            } else{                return baseLineHeight + ((this.fontSize*1.5*afterTitleIndex) + this.fontSize/2) + this.titleFontSize * 1.5;            }        },        draw : function(){            // Custom Tooltips            if(this.custom){                this.custom(this);            }            else{                drawRoundedRectangle(this.ctx,this.x,this.y - this.height/2,this.width,this.height,this.cornerRadius);                var ctx = this.ctx;                ctx.fillStyle = this.fillColor;                ctx.fill();                ctx.closePath();                ctx.textAlign = "left";                ctx.textBaseline = "middle";                ctx.fillStyle = this.titleTextColor;                ctx.font = this.titleFont;                ctx.fillText(this.title,this.x + this.xPadding, this.getLineHeight(0));                ctx.font = this.font;                helpers.each(this.labels,function(label,index){                    ctx.fillStyle = this.textColor;                    ctx.fillText(label,this.x + this.xPadding + this.fontSize + 3, this.getLineHeight(index + 1));                    //A bit gnarly, but clearing this rectangle breaks when using explorercanvas (clears whole canvas)                    //ctx.clearRect(this.x + this.xPadding, this.getLineHeight(index + 1) - this.fontSize/2, this.fontSize, this.fontSize);                    //Instead we'll make a white filled block to put the legendColour palette over.                    ctx.fillStyle = this.legendColorBackground;                    ctx.fillRect(this.x + this.xPadding, this.getLineHeight(index + 1) - this.fontSize/2, this.fontSize, this.fontSize);                    ctx.fillStyle = this.legendColors[index].fill;                    ctx.fillRect(this.x + this.xPadding, this.getLineHeight(index + 1) - this.fontSize/2, this.fontSize, this.fontSize);                },this);            }        }    });    Chart.Scale = Chart.Element.extend({        initialize : function(){            this.fit();        },        buildYLabels : function(){            this.yLabels = [];            var stepDecimalPlaces = getDecimalPlaces(this.stepValue);            for (var i=0; i<=this.steps; i++){                this.yLabels.push(template(this.templateString,{value:(this.min + (i * this.stepValue)).toFixed(stepDecimalPlaces)}));            }            this.yLabelWidth = (this.display && this.showLabels) ? longestText(this.ctx,this.font,this.yLabels) : 0;        },        addXLabel : function(label){            this.xLabels.push(label);            this.valuesCount++;            this.fit();        },        removeXLabel : function(){            this.xLabels.shift();            this.valuesCount--;            this.fit();        },        // Fitting loop to rotate x Labels and figure out what fits there, and also calculate how many Y steps to use        fit: function(){            // First we need the width of the yLabels, assuming the xLabels aren't rotated            // To do that we need the base line at the top and base of the chart, assuming there is no x label rotation            this.startPoint = (this.display) ? this.fontSize : 0;            this.endPoint = (this.display) ? this.height - (this.fontSize * 1.5) - 5 : this.height; // -5 to pad labels            // Apply padding settings to the start and end point.            this.startPoint += this.padding;            this.endPoint -= this.padding;            // Cache the starting height, so can determine if we need to recalculate the scale yAxis            var cachedHeight = this.endPoint - this.startPoint,                cachedYLabelWidth;            // Build the current yLabels so we have an idea of what size they'll be to start            /*             *  This sets what is returned from calculateScaleRange as static properties of this class:             *                this.steps;                this.stepValue;                this.min;                this.max;             *             */            this.calculateYRange(cachedHeight);            // With these properties set we can now build the array of yLabels            // and also the width of the largest yLabel            this.buildYLabels();            this.calculateXLabelRotation();            while((cachedHeight > this.endPoint - this.startPoint)){                cachedHeight = this.endPoint - this.startPoint;                cachedYLabelWidth = this.yLabelWidth;                this.calculateYRange(cachedHeight);                this.buildYLabels();                // Only go through the xLabel loop again if the yLabel width has changed                if (cachedYLabelWidth < this.yLabelWidth){                    this.calculateXLabelRotation();                }            }        },        calculateXLabelRotation : function(){            //Get the width of each grid by calculating the difference            //between x offsets between 0 and 1.            this.ctx.font = this.font;            var firstWidth = this.ctx.measureText(this.xLabels[0]).width,                lastWidth = this.ctx.measureText(this.xLabels[this.xLabels.length - 1]).width,                firstRotated,                lastRotated;            this.xScalePaddingRight = lastWidth/2 + 3;            this.xScalePaddingLeft = (firstWidth/2 > this.yLabelWidth + 10) ? firstWidth/2 : this.yLabelWidth + 10;            this.xLabelRotation = 0;            if (this.display){                var originalLabelWidth = longestText(this.ctx,this.font,this.xLabels),                    cosRotation,                    firstRotatedWidth;                this.xLabelWidth = originalLabelWidth;                //Allow 3 pixels x2 padding either side for label readability                var xGridWidth = Math.floor(this.calculateX(1) - this.calculateX(0)) - 6;                //Max label rotate should be 90 - also act as a loop counter                while ((this.xLabelWidth > xGridWidth && this.xLabelRotation === 0) || (this.xLabelWidth > xGridWidth && this.xLabelRotation <= 90 && this.xLabelRotation > 0)){                    cosRotation = Math.cos(toRadians(this.xLabelRotation));                    firstRotated = cosRotation * firstWidth;                    lastRotated = cosRotation * lastWidth;                    // We're right aligning the text now.                    if (firstRotated + this.fontSize / 2 > this.yLabelWidth + 8){                        this.xScalePaddingLeft = firstRotated + this.fontSize / 2;                    }                    this.xScalePaddingRight = this.fontSize/2;                    this.xLabelRotation++;                    this.xLabelWidth = cosRotation * originalLabelWidth;                }                if (this.xLabelRotation > 0){                    this.endPoint -= Math.sin(toRadians(this.xLabelRotation))*originalLabelWidth + 3;                }            }            else{                this.xLabelWidth = 0;                this.xScalePaddingRight = this.padding;                this.xScalePaddingLeft = this.padding;            }        },        // Needs to be overidden in each Chart type        // Otherwise we need to pass all the data into the scale class        calculateYRange: noop,        drawingArea: function(){            return this.startPoint - this.endPoint;        },        calculateY : function(value){            var scalingFactor = this.drawingArea() / (this.min - this.max);            return this.endPoint - (scalingFactor * (value - this.min));        },        calculateX : function(index){            var isRotated = (this.xLabelRotation > 0),                // innerWidth = (this.offsetGridLines) ? this.width - offsetLeft - this.padding : this.width - (offsetLeft + halfLabelWidth * 2) - this.padding,                innerWidth = this.width - (this.xScalePaddingLeft + this.xScalePaddingRight),                valueWidth = innerWidth/Math.max((this.valuesCount - ((this.offsetGridLines) ? 0 : 1)), 1),                valueOffset = (valueWidth * index) + this.xScalePaddingLeft;            if (this.offsetGridLines){                valueOffset += (valueWidth/2);            }            return Math.round(valueOffset);        },        update : function(newProps){            helpers.extend(this, newProps);            this.fit();        },        draw : function(){            var ctx = this.ctx,                yLabelGap = (this.endPoint - this.startPoint) / this.steps,                xStart = Math.round(this.xScalePaddingLeft);            if (this.display){                ctx.fillStyle = this.textColor;                ctx.font = this.font;                each(this.yLabels,function(labelString,index){                    var yLabelCenter = this.endPoint - (yLabelGap * index),                        linePositionY = Math.round(yLabelCenter),                        drawHorizontalLine = this.showHorizontalLines;                    ctx.textAlign = "right";                    ctx.textBaseline = "middle";                    if (this.showLabels){                        ctx.fillText(labelString,xStart - 10,yLabelCenter);                    }                    // This is X axis, so draw it                    if (index === 0 && !drawHorizontalLine){                        drawHorizontalLine = true;                    }                    if (drawHorizontalLine){                        ctx.beginPath();                    }                    if (index > 0){                        // This is a grid line in the centre, so drop that                        ctx.lineWidth = this.gridLineWidth;                        ctx.strokeStyle = this.gridLineColor;                    } else {                        // This is the first line on the scale                        ctx.lineWidth = this.lineWidth;                        ctx.strokeStyle = this.lineColor;                    }                    linePositionY += helpers.aliasPixel(ctx.lineWidth);                    if(drawHorizontalLine){                        ctx.moveTo(xStart, linePositionY);                        ctx.lineTo(this.width, linePositionY);                        ctx.stroke();                        ctx.closePath();                    }                    ctx.lineWidth = this.lineWidth;                    ctx.strokeStyle = this.lineColor;                    ctx.beginPath();                    ctx.moveTo(xStart - 5, linePositionY);                    ctx.lineTo(xStart, linePositionY);                    ctx.stroke();                    ctx.closePath();                },this);                each(this.xLabels,function(label,index){                    var xPos = this.calculateX(index) + aliasPixel(this.lineWidth),                        // Check to see if line/bar here and decide where to place the line                        linePos = this.calculateX(index - (this.offsetGridLines ? 0.5 : 0)) + aliasPixel(this.lineWidth),                        isRotated = (this.xLabelRotation > 0),                        drawVerticalLine = this.showVerticalLines;                    // This is Y axis, so draw it                    if (index === 0 && !drawVerticalLine){                        drawVerticalLine = true;                    }                    if (drawVerticalLine){                        ctx.beginPath();                    }                    if (index > 0){                        // This is a grid line in the centre, so drop that                        ctx.lineWidth = this.gridLineWidth;                        ctx.strokeStyle = this.gridLineColor;                    } else {                        // This is the first line on the scale                        ctx.lineWidth = this.lineWidth;                        ctx.strokeStyle = this.lineColor;                    }                    if (drawVerticalLine){                        ctx.moveTo(linePos,this.endPoint);                        ctx.lineTo(linePos,this.startPoint - 3);                        ctx.stroke();                        ctx.closePath();                    }                    ctx.lineWidth = this.lineWidth;                    ctx.strokeStyle = this.lineColor;                    // Small lines at the bottom of the base grid line                    ctx.beginPath();                    ctx.moveTo(linePos,this.endPoint);                    ctx.lineTo(linePos,this.endPoint + 5);                    ctx.stroke();                    ctx.closePath();                    ctx.save();                    ctx.translate(xPos,(isRotated) ? this.endPoint + 12 : this.endPoint + 8);                    ctx.rotate(toRadians(this.xLabelRotation)*-1);                    ctx.font = this.font;                    ctx.textAlign = (isRotated) ? "right" : "center";                    ctx.textBaseline = (isRotated) ? "middle" : "top";                    ctx.fillText(label, 0, 0);                    ctx.restore();                },this);            }        }    });    Chart.RadialScale = Chart.Element.extend({        initialize: function(){            this.size = min([this.height, this.width]);            this.drawingArea = (this.display) ? (this.size/2) - (this.fontSize/2 + this.backdropPaddingY) : (this.size/2);        },        calculateCenterOffset: function(value){            // Take into account half font size + the yPadding of the top value            var scalingFactor = this.drawingArea / (this.max - this.min);            return (value - this.min) * scalingFactor;        },        update : function(){            if (!this.lineArc){                this.setScaleSize();            } else {                this.drawingArea = (this.display) ? (this.size/2) - (this.fontSize/2 + this.backdropPaddingY) : (this.size/2);            }            this.buildYLabels();        },        buildYLabels: function(){            this.yLabels = [];            var stepDecimalPlaces = getDecimalPlaces(this.stepValue);            for (var i=0; i<=this.steps; i++){                this.yLabels.push(template(this.templateString,{value:(this.min + (i * this.stepValue)).toFixed(stepDecimalPlaces)}));            }        },        getCircumference : function(){            return ((Math.PI*2) / this.valuesCount);        },        setScaleSize: function(){            /*             * Right, this is really confusing and there is a lot of maths going on here             * The gist of the problem is here: https://gist.github.com/nnnick/696cc9c55f4b0beb8fe9             *             * Reaction: https://dl.dropboxusercontent.com/u/34601363/toomuchscience.gif             *             * Solution:             *             * We assume the radius of the polygon is half the size of the canvas at first             * at each index we check if the text overlaps.             *             * Where it does, we store that angle and that index.             *             * After finding the largest index and angle we calculate how much we need to remove             * from the shape radius to move the point inwards by that x.             *             * We average the left and right distances to get the maximum shape radius that can fit in the box             * along with labels.             *             * Once we have that, we can find the centre point for the chart, by taking the x text protrusion             * on each side, removing that from the size, halving it and adding the left x protrusion width.             *             * This will mean we have a shape fitted to the canvas, as large as it can be with the labels             * and position it in the most space efficient manner             *             * https://dl.dropboxusercontent.com/u/34601363/yeahscience.gif             */            // Get maximum radius of the polygon. Either half the height (minus the text width) or half the width.            // Use this to calculate the offset + change. - Make sure L/R protrusion is at least 0 to stop issues with centre points            var largestPossibleRadius = min([(this.height/2 - this.pointLabelFontSize - 5), this.width/2]),                pointPosition,                i,                textWidth,                halfTextWidth,                furthestRight = this.width,                furthestRightIndex,                furthestRightAngle,                furthestLeft = 0,                furthestLeftIndex,                furthestLeftAngle,                xProtrusionLeft,                xProtrusionRight,                radiusReductionRight,                radiusReductionLeft,                maxWidthRadius;            this.ctx.font = fontString(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily);            for (i=0;i<this.valuesCount;i++){                // 5px to space the text slightly out - similar to what we do in the draw function.                pointPosition = this.getPointPosition(i, largestPossibleRadius);                textWidth = this.ctx.measureText(template(this.templateString, { value: this.labels[i] })).width + 5;                if (i === 0 || i === this.valuesCount/2){                    // If we're at index zero, or exactly the middle, we're at exactly the top/bottom                    // of the radar chart, so text will be aligned centrally, so we'll half it and compare                    // w/left and right text sizes                    halfTextWidth = textWidth/2;                    if (pointPosition.x + halfTextWidth > furthestRight) {                        furthestRight = pointPosition.x + halfTextWidth;                        furthestRightIndex = i;                    }                    if (pointPosition.x - halfTextWidth < furthestLeft) {                        furthestLeft = pointPosition.x - halfTextWidth;                        furthestLeftIndex = i;                    }                }                else if (i < this.valuesCount/2) {                    // Less than half the values means we'll left align the text                    if (pointPosition.x + textWidth > furthestRight) {                        furthestRight = pointPosition.x + textWidth;                        furthestRightIndex = i;                    }                }                else if (i > this.valuesCount/2){                    // More than half the values means we'll right align the text                    if (pointPosition.x - textWidth < furthestLeft) {                        furthestLeft = pointPosition.x - textWidth;                        furthestLeftIndex = i;                    }                }            }            xProtrusionLeft = furthestLeft;            xProtrusionRight = Math.ceil(furthestRight - this.width);            furthestRightAngle = this.getIndexAngle(furthestRightIndex);            furthestLeftAngle = this.getIndexAngle(furthestLeftIndex);            radiusReductionRight = xProtrusionRight / Math.sin(furthestRightAngle + Math.PI/2);            radiusReductionLeft = xProtrusionLeft / Math.sin(furthestLeftAngle + Math.PI/2);            // Ensure we actually need to reduce the size of the chart            radiusReductionRight = (isNumber(radiusReductionRight)) ? radiusReductionRight : 0;            radiusReductionLeft = (isNumber(radiusReductionLeft)) ? radiusReductionLeft : 0;            this.drawingArea = largestPossibleRadius - (radiusReductionLeft + radiusReductionRight)/2;            //this.drawingArea = min([maxWidthRadius, (this.height - (2 * (this.pointLabelFontSize + 5)))/2])            this.setCenterPoint(radiusReductionLeft, radiusReductionRight);        },        setCenterPoint: function(leftMovement, rightMovement){            var maxRight = this.width - rightMovement - this.drawingArea,                maxLeft = leftMovement + this.drawingArea;            this.xCenter = (maxLeft + maxRight)/2;            // Always vertically in the centre as the text height doesn't change            this.yCenter = (this.height/2);        },        getIndexAngle : function(index){            var angleMultiplier = (Math.PI * 2) / this.valuesCount;            // Start from the top instead of right, so remove a quarter of the circle            return index * angleMultiplier - (Math.PI/2);        },        getPointPosition : function(index, distanceFromCenter){            var thisAngle = this.getIndexAngle(index);            return {                x : (Math.cos(thisAngle) * distanceFromCenter) + this.xCenter,                y : (Math.sin(thisAngle) * distanceFromCenter) + this.yCenter            };        },        draw: function(){            if (this.display){                var ctx = this.ctx;                each(this.yLabels, function(label, index){                    // Don't draw a centre value                    if (index > 0){                        var yCenterOffset = index * (this.drawingArea/this.steps),                            yHeight = this.yCenter - yCenterOffset,                            pointPosition;                        // Draw circular lines around the scale                        if (this.lineWidth > 0){                            ctx.strokeStyle = this.lineColor;                            ctx.lineWidth = this.lineWidth;                            if(this.lineArc){                                ctx.beginPath();                                ctx.arc(this.xCenter, this.yCenter, yCenterOffset, 0, Math.PI*2);                                ctx.closePath();                                ctx.stroke();                            } else{                                ctx.beginPath();                                for (var i=0;i<this.valuesCount;i++)                                {                                    pointPosition = this.getPointPosition(i, this.calculateCenterOffset(this.min + (index * this.stepValue)));                                    if (i === 0){                                        ctx.moveTo(pointPosition.x, pointPosition.y);                                    } else {                                        ctx.lineTo(pointPosition.x, pointPosition.y);                                    }                                }                                ctx.closePath();                                ctx.stroke();                            }                        }                        if(this.showLabels){                            ctx.font = fontString(this.fontSize,this.fontStyle,this.fontFamily);                            if (this.showLabelBackdrop){                                var labelWidth = ctx.measureText(label).width;                                ctx.fillStyle = this.backdropColor;                                ctx.fillRect(                                    this.xCenter - labelWidth/2 - this.backdropPaddingX,                                    yHeight - this.fontSize/2 - this.backdropPaddingY,                                    labelWidth + this.backdropPaddingX*2,                                    this.fontSize + this.backdropPaddingY*2                                );                            }                            ctx.textAlign = 'center';                            ctx.textBaseline = "middle";                            ctx.fillStyle = this.fontColor;                            ctx.fillText(label, this.xCenter, yHeight);                        }                    }                }, this);                if (!this.lineArc){                    ctx.lineWidth = this.angleLineWidth;                    ctx.strokeStyle = this.angleLineColor;                    for (var i = this.valuesCount - 1; i >= 0; i--) {                        if (this.angleLineWidth > 0){                            var outerPosition = this.getPointPosition(i, this.calculateCenterOffset(this.max));                            ctx.beginPath();                            ctx.moveTo(this.xCenter, this.yCenter);                            ctx.lineTo(outerPosition.x, outerPosition.y);                            ctx.stroke();                            ctx.closePath();                        }                        // Extra 3px out for some label spacing                        var pointLabelPosition = this.getPointPosition(i, this.calculateCenterOffset(this.max) + 5);                        ctx.font = fontString(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily);                        ctx.fillStyle = this.pointLabelFontColor;                        var labelsCount = this.labels.length,                            halfLabelsCount = this.labels.length/2,                            quarterLabelsCount = halfLabelsCount/2,                            upperHalf = (i < quarterLabelsCount || i > labelsCount - quarterLabelsCount),                            exactQuarter = (i === quarterLabelsCount || i === labelsCount - quarterLabelsCount);                        if (i === 0){                            ctx.textAlign = 'center';                        } else if(i === halfLabelsCount){                            ctx.textAlign = 'center';                        } else if (i < halfLabelsCount){                            ctx.textAlign = 'left';                        } else {                            ctx.textAlign = 'right';                        }                        // Set the correct text baseline based on outer positioning                        if (exactQuarter){                            ctx.textBaseline = 'middle';                        } else if (upperHalf){                            ctx.textBaseline = 'bottom';                        } else {                            ctx.textBaseline = 'top';                        }                        ctx.fillText(this.labels[i], pointLabelPosition.x, pointLabelPosition.y);                    }                }            }        }    });    // Attach global event to resize each chart instance when the browser resizes    helpers.addEvent(window, "resize", (function(){        // Basic debounce of resize function so it doesn't hurt performance when resizing browser.        var timeout;        return function(){            clearTimeout(timeout);            timeout = setTimeout(function(){                each(Chart.instances,function(instance){                    // If the responsive flag is set in the chart instance config                    // Cascade the resize event down to the chart.                    if (instance.options.responsive){                        instance.resize(instance.render, true);                    }                });            }, 50);        };    })());    if (amd) {        define(function(){            return Chart;        });    } else if (typeof module === 'object' && module.exports) {        module.exports = Chart;    }    root.Chart = Chart;    Chart.noConflict = function(){        root.Chart = previous;        return Chart;    };}).call(this);(function(){    "use strict";    var root = this,        Chart = root.Chart,        helpers = Chart.helpers;    var defaultConfig = {        //Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value        scaleBeginAtZero : true,        //Boolean - Whether grid lines are shown across the chart        scaleShowGridLines : true,        //String - Colour of the grid lines        scaleGridLineColor : "rgba(0,0,0,.05)",        //Number - Width of the grid lines        scaleGridLineWidth : 1,        //Boolean - Whether to show horizontal lines (except X axis)        scaleShowHorizontalLines: true,        //Boolean - Whether to show vertical lines (except Y axis)        scaleShowVerticalLines: true,        //Boolean - If there is a stroke on each bar        barShowStroke : true,        //Number - Pixel width of the bar stroke        barStrokeWidth : 2,        //Number - Spacing between each of the X value sets        barValueSpacing : 5,        //Number - Spacing between data sets within X values        barDatasetSpacing : 1,        //String - A legend template        legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].fillColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"    };    Chart.Type.extend({        name: "Bar",        defaults : defaultConfig,        initialize:  function(data){            //Expose options as a scope variable here so we can access it in the ScaleClass            var options = this.options;            this.ScaleClass = Chart.Scale.extend({                offsetGridLines : true,                calculateBarX : function(datasetCount, datasetIndex, barIndex){                    //Reusable method for calculating the xPosition of a given bar based on datasetIndex & width of the bar                    var xWidth = this.calculateBaseWidth(),                        xAbsolute = this.calculateX(barIndex) - (xWidth/2),                        barWidth = this.calculateBarWidth(datasetCount);                    return xAbsolute + (barWidth * datasetIndex) + (datasetIndex * options.barDatasetSpacing) + barWidth/2;                },                calculateBaseWidth : function(){                    return (this.calculateX(1) - this.calculateX(0)) - (2*options.barValueSpacing);                },                calculateBarWidth : function(datasetCount){                    //The padding between datasets is to the right of each bar, providing that there are more than 1 dataset                    var baseWidth = this.calculateBaseWidth() - ((datasetCount - 1) * options.barDatasetSpacing);                    return (baseWidth / datasetCount);                }            });            this.datasets = [];            //Set up tooltip events on the chart            if (this.options.showTooltips){                helpers.bindEvents(this, this.options.tooltipEvents, function(evt){                    var activeBars = (evt.type !== 'mouseout') ? this.getBarsAtEvent(evt) : [];                    this.eachBars(function(bar){                        bar.restore(['fillColor', 'strokeColor']);                    });                    helpers.each(activeBars, function(activeBar){                        activeBar.fillColor = activeBar.highlightFill;                        activeBar.strokeColor = activeBar.highlightStroke;                    });                    this.showTooltip(activeBars);                });            }            //Declare the extension of the default point, to cater for the options passed in to the constructor            this.BarClass = Chart.Rectangle.extend({                strokeWidth : this.options.barStrokeWidth,                showStroke : this.options.barShowStroke,                ctx : this.chart.ctx            });            //Iterate through each of the datasets, and build this into a property of the chart            helpers.each(data.datasets,function(dataset,datasetIndex){                var datasetObject = {                    label : dataset.label || null,                    fillColor : dataset.fillColor,                    strokeColor : dataset.strokeColor,                    bars : []                };                this.datasets.push(datasetObject);                helpers.each(dataset.data,function(dataPoint,index){                    //Add a new point for each piece of data, passing any required data to draw.                    datasetObject.bars.push(new this.BarClass({                        value : dataPoint,                        label : data.labels[index],                        datasetLabel: dataset.label,                        strokeColor : dataset.strokeColor,                        fillColor : dataset.fillColor,                        highlightFill : dataset.highlightFill || dataset.fillColor,                        highlightStroke : dataset.highlightStroke || dataset.strokeColor                    }));                },this);            },this);            this.buildScale(data.labels);            this.BarClass.prototype.base = this.scale.endPoint;            this.eachBars(function(bar, index, datasetIndex){                helpers.extend(bar, {                    width : this.scale.calculateBarWidth(this.datasets.length),                    x: this.scale.calculateBarX(this.datasets.length, datasetIndex, index),                    y: this.scale.endPoint                });                bar.save();            }, this);            this.render();        },        update : function(){            this.scale.update();            // Reset any highlight colours before updating.            helpers.each(this.activeElements, function(activeElement){                activeElement.restore(['fillColor', 'strokeColor']);            });            this.eachBars(function(bar){                bar.save();            });            this.render();        },        eachBars : function(callback){            helpers.each(this.datasets,function(dataset, datasetIndex){                helpers.each(dataset.bars, callback, this, datasetIndex);            },this);        },        getBarsAtEvent : function(e){            var barsArray = [],                eventPosition = helpers.getRelativePosition(e),                datasetIterator = function(dataset){                    barsArray.push(dataset.bars[barIndex]);                },                barIndex;            for (var datasetIndex = 0; datasetIndex < this.datasets.length; datasetIndex++) {                for (barIndex = 0; barIndex < this.datasets[datasetIndex].bars.length; barIndex++) {                    if (this.datasets[datasetIndex].bars[barIndex].inRange(eventPosition.x,eventPosition.y)){                        helpers.each(this.datasets, datasetIterator);                        return barsArray;                    }                }            }            return barsArray;        },        buildScale : function(labels){            var self = this;            var dataTotal = function(){                var values = [];                self.eachBars(function(bar){                    values.push(bar.value);                });                return values;            };            var scaleOptions = {                templateString : this.options.scaleLabel,                height : this.chart.height,                width : this.chart.width,                ctx : this.chart.ctx,                textColor : this.options.scaleFontColor,                fontSize : this.options.scaleFontSize,                fontStyle : this.options.scaleFontStyle,                fontFamily : this.options.scaleFontFamily,                valuesCount : labels.length,                beginAtZero : this.options.scaleBeginAtZero,                integersOnly : this.options.scaleIntegersOnly,                calculateYRange: function(currentHeight){                    var updatedRanges = helpers.calculateScaleRange(                        dataTotal(),                        currentHeight,                        this.fontSize,                        this.beginAtZero,                        this.integersOnly                    );                    helpers.extend(this, updatedRanges);                },                xLabels : labels,                font : helpers.fontString(this.options.scaleFontSize, this.options.scaleFontStyle, this.options.scaleFontFamily),                lineWidth : this.options.scaleLineWidth,                lineColor : this.options.scaleLineColor,                showHorizontalLines : this.options.scaleShowHorizontalLines,                showVerticalLines : this.options.scaleShowVerticalLines,                gridLineWidth : (this.options.scaleShowGridLines) ? this.options.scaleGridLineWidth : 0,                gridLineColor : (this.options.scaleShowGridLines) ? this.options.scaleGridLineColor : "rgba(0,0,0,0)",                padding : (this.options.showScale) ? 0 : (this.options.barShowStroke) ? this.options.barStrokeWidth : 0,                showLabels : this.options.scaleShowLabels,                display : this.options.showScale            };            if (this.options.scaleOverride){                helpers.extend(scaleOptions, {                    calculateYRange: helpers.noop,                    steps: this.options.scaleSteps,                    stepValue: this.options.scaleStepWidth,                    min: this.options.scaleStartValue,                    max: this.options.scaleStartValue + (this.options.scaleSteps * this.options.scaleStepWidth)                });            }            this.scale = new this.ScaleClass(scaleOptions);        },        addData : function(valuesArray,label){            //Map the values array for each of the datasets            helpers.each(valuesArray,function(value,datasetIndex){                //Add a new point for each piece of data, passing any required data to draw.                this.datasets[datasetIndex].bars.push(new this.BarClass({                    value : value,                    label : label,                    x: this.scale.calculateBarX(this.datasets.length, datasetIndex, this.scale.valuesCount+1),                    y: this.scale.endPoint,                    width : this.scale.calculateBarWidth(this.datasets.length),                    base : this.scale.endPoint,                    strokeColor : this.datasets[datasetIndex].strokeColor,                    fillColor : this.datasets[datasetIndex].fillColor                }));            },this);            this.scale.addXLabel(label);            //Then re-render the chart.            this.update();        },        removeData : function(){            this.scale.removeXLabel();            //Then re-render the chart.            helpers.each(this.datasets,function(dataset){                dataset.bars.shift();            },this);            this.update();        },        reflow : function(){            helpers.extend(this.BarClass.prototype,{                y: this.scale.endPoint,                base : this.scale.endPoint            });            var newScaleProps = helpers.extend({                height : this.chart.height,                width : this.chart.width            });            this.scale.update(newScaleProps);        },        draw : function(ease){            var easingDecimal = ease || 1;            this.clear();            var ctx = this.chart.ctx;            this.scale.draw(easingDecimal);            //Draw all the bars for each dataset            helpers.each(this.datasets,function(dataset,datasetIndex){                helpers.each(dataset.bars,function(bar,index){                    if (bar.hasValue()){                        bar.base = this.scale.endPoint;                        //Transition then draw                        bar.transition({                            x : this.scale.calculateBarX(this.datasets.length, datasetIndex, index),                            y : this.scale.calculateY(bar.value),                            width : this.scale.calculateBarWidth(this.datasets.length)                        }, easingDecimal).draw();                    }                },this);            },this);        }    });}).call(this);(function(){    "use strict";    var root = this,        Chart = root.Chart,        //Cache a local reference to Chart.helpers        helpers = Chart.helpers;    var defaultConfig = {        //Boolean - Whether we should show a stroke on each segment        segmentShowStroke : true,        //String - The colour of each segment stroke        segmentStrokeColor : "#fff",        //Number - The width of each segment stroke        segmentStrokeWidth : 2,        //The percentage of the chart that we cut out of the middle.        percentageInnerCutout : 50,        //Number - Amount of animation steps        animationSteps : 100,        //String - Animation easing effect        animationEasing : "easeOutBounce",        //Boolean - Whether we animate the rotation of the Doughnut        animateRotate : true,        //Boolean - Whether we animate scaling the Doughnut from the centre        animateScale : false,        //String - A legend template        legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"    };    Chart.Type.extend({        //Passing in a name registers this chart in the Chart namespace        name: "Doughnut",        //Providing a defaults will also register the deafults in the chart namespace        defaults : defaultConfig,        //Initialize is fired when the chart is initialized - Data is passed in as a parameter        //Config is automatically merged by the core of Chart.js, and is available at this.options        initialize:  function(data){            //Declare segments as a static property to prevent inheriting across the Chart type prototype            this.segments = [];            this.outerRadius = (helpers.min([this.chart.width,this.chart.height]) - this.options.segmentStrokeWidth/2)/2;            this.SegmentArc = Chart.Arc.extend({                ctx : this.chart.ctx,                x : this.chart.width/2,                y : this.chart.height/2            });            //Set up tooltip events on the chart            if (this.options.showTooltips){                helpers.bindEvents(this, this.options.tooltipEvents, function(evt){                    var activeSegments = (evt.type !== 'mouseout') ? this.getSegmentsAtEvent(evt) : [];                    helpers.each(this.segments,function(segment){                        segment.restore(["fillColor"]);                    });                    helpers.each(activeSegments,function(activeSegment){                        activeSegment.fillColor = activeSegment.highlightColor;                    });                    this.showTooltip(activeSegments);                });            }            this.calculateTotal(data);            helpers.each(data,function(datapoint, index){                this.addData(datapoint, index, true);            },this);            this.render();        },        getSegmentsAtEvent : function(e){            var segmentsArray = [];            var location = helpers.getRelativePosition(e);            helpers.each(this.segments,function(segment){                if (segment.inRange(location.x,location.y)) segmentsArray.push(segment);            },this);            return segmentsArray;        },        addData : function(segment, atIndex, silent){            var index = atIndex || this.segments.length;            this.segments.splice(index, 0, new this.SegmentArc({                value : segment.value,                outerRadius : (this.options.animateScale) ? 0 : this.outerRadius,                innerRadius : (this.options.animateScale) ? 0 : (this.outerRadius/100) * this.options.percentageInnerCutout,                fillColor : segment.color,                highlightColor : segment.highlight || segment.color,                showStroke : this.options.segmentShowStroke,                strokeWidth : this.options.segmentStrokeWidth,                strokeColor : this.options.segmentStrokeColor,                startAngle : Math.PI * 1.5,                circumference : (this.options.animateRotate) ? 0 : this.calculateCircumference(segment.value),                label : segment.label            }));            if (!silent){                this.reflow();                this.update();            }        },        calculateCircumference : function(value){            return (Math.PI*2)*(Math.abs(value) / this.total);        },        calculateTotal : function(data){            this.total = 0;            helpers.each(data,function(segment){                this.total += Math.abs(segment.value);            },this);        },        update : function(){            this.calculateTotal(this.segments);            // Reset any highlight colours before updating.            helpers.each(this.activeElements, function(activeElement){                activeElement.restore(['fillColor']);            });            helpers.each(this.segments,function(segment){                segment.save();            });            this.render();        },        removeData: function(atIndex){            var indexToDelete = (helpers.isNumber(atIndex)) ? atIndex : this.segments.length-1;            this.segments.splice(indexToDelete, 1);            this.reflow();            this.update();        },        reflow : function(){            helpers.extend(this.SegmentArc.prototype,{                x : this.chart.width/2,                y : this.chart.height/2            });            this.outerRadius = (helpers.min([this.chart.width,this.chart.height]) - this.options.segmentStrokeWidth/2)/2;            helpers.each(this.segments, function(segment){                segment.update({                    outerRadius : this.outerRadius,                    innerRadius : (this.outerRadius/100) * this.options.percentageInnerCutout                });            }, this);        },        draw : function(easeDecimal){            var animDecimal = (easeDecimal) ? easeDecimal : 1;            this.clear();            helpers.each(this.segments,function(segment,index){                segment.transition({                    circumference : this.calculateCircumference(segment.value),                    outerRadius : this.outerRadius,                    innerRadius : (this.outerRadius/100) * this.options.percentageInnerCutout                },animDecimal);                segment.endAngle = segment.startAngle + segment.circumference;                segment.draw();                if (index === 0){                    segment.startAngle = Math.PI * 1.5;                }                //Check to see if it's the last segment, if not get the next and update the start angle                if (index < this.segments.length-1){                    this.segments[index+1].startAngle = segment.endAngle;                }            },this);        }    });    Chart.types.Doughnut.extend({        name : "Pie",        defaults : helpers.merge(defaultConfig,{percentageInnerCutout : 0})    });}).call(this);(function(){    "use strict";    var root = this,        Chart = root.Chart,        helpers = Chart.helpers;    var defaultConfig = {        ///Boolean - Whether grid lines are shown across the chart        scaleShowGridLines : true,        //String - Colour of the grid lines        scaleGridLineColor : "rgba(0,0,0,.05)",        //Number - Width of the grid lines        scaleGridLineWidth : 1,        //Boolean - Whether to show horizontal lines (except X axis)        scaleShowHorizontalLines: true,        //Boolean - Whether to show vertical lines (except Y axis)        scaleShowVerticalLines: true,        //Boolean - Whether the line is curved between points        bezierCurve : true,        //Number - Tension of the bezier curve between points        bezierCurveTension : 0.4,        //Boolean - Whether to show a dot for each point        pointDot : true,        //Number - Radius of each point dot in pixels        pointDotRadius : 4,        //Number - Pixel width of point dot stroke        pointDotStrokeWidth : 1,        //Number - amount extra to add to the radius to cater for hit detection outside the drawn point        pointHitDetectionRadius : 20,        //Boolean - Whether to show a stroke for datasets        datasetStroke : true,        //Number - Pixel width of dataset stroke        datasetStrokeWidth : 2,        //Boolean - Whether to fill the dataset with a colour        datasetFill : true,        //String - A legend template        legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"    };    Chart.Type.extend({        name: "Line",        defaults : defaultConfig,        initialize:  function(data){            //Declare the extension of the default point, to cater for the options passed in to the constructor            this.PointClass = Chart.Point.extend({                strokeWidth : this.options.pointDotStrokeWidth,                radius : this.options.pointDotRadius,                display: this.options.pointDot,                hitDetectionRadius : this.options.pointHitDetectionRadius,                ctx : this.chart.ctx,                inRange : function(mouseX){                    return (Math.pow(mouseX-this.x, 2) < Math.pow(this.radius + this.hitDetectionRadius,2));                }            });            this.datasets = [];            //Set up tooltip events on the chart            if (this.options.showTooltips){                helpers.bindEvents(this, this.options.tooltipEvents, function(evt){                    var activePoints = (evt.type !== 'mouseout') ? this.getPointsAtEvent(evt) : [];                    this.eachPoints(function(point){                        point.restore(['fillColor', 'strokeColor']);                    });                    helpers.each(activePoints, function(activePoint){                        activePoint.fillColor = activePoint.highlightFill;                        activePoint.strokeColor = activePoint.highlightStroke;                    });                    this.showTooltip(activePoints);                });            }            //Iterate through each of the datasets, and build this into a property of the chart            helpers.each(data.datasets,function(dataset){                var datasetObject = {                    label : dataset.label || null,                    fillColor : dataset.fillColor,                    strokeColor : dataset.strokeColor,                    pointColor : dataset.pointColor,                    pointStrokeColor : dataset.pointStrokeColor,                    points : []                };                this.datasets.push(datasetObject);                helpers.each(dataset.data,function(dataPoint,index){                    //Add a new point for each piece of data, passing any required data to draw.                    datasetObject.points.push(new this.PointClass({                        value : dataPoint,                        label : data.labels[index],                        datasetLabel: dataset.label,                        strokeColor : dataset.pointStrokeColor,                        fillColor : dataset.pointColor,                        highlightFill : dataset.pointHighlightFill || dataset.pointColor,                        highlightStroke : dataset.pointHighlightStroke || dataset.pointStrokeColor                    }));                },this);                this.buildScale(data.labels);                this.eachPoints(function(point, index){                    helpers.extend(point, {                        x: this.scale.calculateX(index),                        y: this.scale.endPoint                    });                    point.save();                }, this);            },this);            this.render();        },        update : function(){            this.scale.update();            // Reset any highlight colours before updating.            helpers.each(this.activeElements, function(activeElement){                activeElement.restore(['fillColor', 'strokeColor']);            });            this.eachPoints(function(point){                point.save();            });            this.render();        },        eachPoints : function(callback){            helpers.each(this.datasets,function(dataset){                helpers.each(dataset.points,callback,this);            },this);        },        getPointsAtEvent : function(e){            var pointsArray = [],                eventPosition = helpers.getRelativePosition(e);            helpers.each(this.datasets,function(dataset){                helpers.each(dataset.points,function(point){                    if (point.inRange(eventPosition.x,eventPosition.y)) pointsArray.push(point);                });            },this);            return pointsArray;        },        buildScale : function(labels){            var self = this;            var dataTotal = function(){                var values = [];                self.eachPoints(function(point){                    values.push(point.value);                });                return values;            };            var scaleOptions = {                templateString : this.options.scaleLabel,                height : this.chart.height,                width : this.chart.width,                ctx : this.chart.ctx,                textColor : this.options.scaleFontColor,                fontSize : this.options.scaleFontSize,                fontStyle : this.options.scaleFontStyle,                fontFamily : this.options.scaleFontFamily,                valuesCount : labels.length,                beginAtZero : this.options.scaleBeginAtZero,                integersOnly : this.options.scaleIntegersOnly,                calculateYRange : function(currentHeight){                    var updatedRanges = helpers.calculateScaleRange(                        dataTotal(),                        currentHeight,                        this.fontSize,                        this.beginAtZero,                        this.integersOnly                    );                    helpers.extend(this, updatedRanges);                },                xLabels : labels,                font : helpers.fontString(this.options.scaleFontSize, this.options.scaleFontStyle, this.options.scaleFontFamily),                lineWidth : this.options.scaleLineWidth,                lineColor : this.options.scaleLineColor,                showHorizontalLines : this.options.scaleShowHorizontalLines,                showVerticalLines : this.options.scaleShowVerticalLines,                gridLineWidth : (this.options.scaleShowGridLines) ? this.options.scaleGridLineWidth : 0,                gridLineColor : (this.options.scaleShowGridLines) ? this.options.scaleGridLineColor : "rgba(0,0,0,0)",                padding: (this.options.showScale) ? 0 : this.options.pointDotRadius + this.options.pointDotStrokeWidth,                showLabels : this.options.scaleShowLabels,                display : this.options.showScale            };            if (this.options.scaleOverride){                helpers.extend(scaleOptions, {                    calculateYRange: helpers.noop,                    steps: this.options.scaleSteps,                    stepValue: this.options.scaleStepWidth,                    min: this.options.scaleStartValue,                    max: this.options.scaleStartValue + (this.options.scaleSteps * this.options.scaleStepWidth)                });            }            this.scale = new Chart.Scale(scaleOptions);        },        addData : function(valuesArray,label){            //Map the values array for each of the datasets            helpers.each(valuesArray,function(value,datasetIndex){                //Add a new point for each piece of data, passing any required data to draw.                this.datasets[datasetIndex].points.push(new this.PointClass({                    value : value,                    label : label,                    x: this.scale.calculateX(this.scale.valuesCount+1),                    y: this.scale.endPoint,                    strokeColor : this.datasets[datasetIndex].pointStrokeColor,                    fillColor : this.datasets[datasetIndex].pointColor                }));            },this);            this.scale.addXLabel(label);            //Then re-render the chart.            this.update();        },        removeData : function(){            this.scale.removeXLabel();            //Then re-render the chart.            helpers.each(this.datasets,function(dataset){                dataset.points.shift();            },this);            this.update();        },        reflow : function(){            var newScaleProps = helpers.extend({                height : this.chart.height,                width : this.chart.width            });            this.scale.update(newScaleProps);        },        draw : function(ease){            var easingDecimal = ease || 1;            this.clear();            var ctx = this.chart.ctx;            // Some helper methods for getting the next/prev points            var hasValue = function(item){                return item.value !== null;            },            nextPoint = function(point, collection, index){                return helpers.findNextWhere(collection, hasValue, index) || point;            },            previousPoint = function(point, collection, index){                return helpers.findPreviousWhere(collection, hasValue, index) || point;            };            this.scale.draw(easingDecimal);            helpers.each(this.datasets,function(dataset){                var pointsWithValues = helpers.where(dataset.points, hasValue);                //Transition each point first so that the line and point drawing isn't out of sync                //We can use this extra loop to calculate the control points of this dataset also in this loop                helpers.each(dataset.points, function(point, index){                    if (point.hasValue()){                        point.transition({                            y : this.scale.calculateY(point.value),                            x : this.scale.calculateX(index)                        }, easingDecimal);                    }                },this);                // Control points need to be calculated in a seperate loop, because we need to know the current x/y of the point                // This would cause issues when there is no animation, because the y of the next point would be 0, so beziers would be skewed                if (this.options.bezierCurve){                    helpers.each(pointsWithValues, function(point, index){                        var tension = (index > 0 && index < pointsWithValues.length - 1) ? this.options.bezierCurveTension : 0;                        point.controlPoints = helpers.splineCurve(                            previousPoint(point, pointsWithValues, index),                            point,                            nextPoint(point, pointsWithValues, index),                            tension                        );                        // Prevent the bezier going outside of the bounds of the graph                        // Cap puter bezier handles to the upper/lower scale bounds                        if (point.controlPoints.outer.y > this.scale.endPoint){                            point.controlPoints.outer.y = this.scale.endPoint;                        }                        else if (point.controlPoints.outer.y < this.scale.startPoint){                            point.controlPoints.outer.y = this.scale.startPoint;                        }                        // Cap inner bezier handles to the upper/lower scale bounds                        if (point.controlPoints.inner.y > this.scale.endPoint){                            point.controlPoints.inner.y = this.scale.endPoint;                        }                        else if (point.controlPoints.inner.y < this.scale.startPoint){                            point.controlPoints.inner.y = this.scale.startPoint;                        }                    },this);                }                //Draw the line between all the points                ctx.lineWidth = this.options.datasetStrokeWidth;                ctx.strokeStyle = dataset.strokeColor;                ctx.beginPath();                helpers.each(pointsWithValues, function(point, index){                    if (index === 0){                        ctx.moveTo(point.x, point.y);                    }                    else{                        if(this.options.bezierCurve){                            var previous = previousPoint(point, pointsWithValues, index);                            ctx.bezierCurveTo(                                previous.controlPoints.outer.x,                                previous.controlPoints.outer.y,                                point.controlPoints.inner.x,                                point.controlPoints.inner.y,                                point.x,                                point.y                            );                        }                        else{                            ctx.lineTo(point.x,point.y);                        }                    }                }, this);                ctx.stroke();                if (this.options.datasetFill && pointsWithValues.length > 0){                    //Round off the line by going to the base of the chart, back to the start, then fill.                    ctx.lineTo(pointsWithValues[pointsWithValues.length - 1].x, this.scale.endPoint);                    ctx.lineTo(pointsWithValues[0].x, this.scale.endPoint);                    ctx.fillStyle = dataset.fillColor;                    ctx.closePath();                    ctx.fill();                }                //Now draw the points over the line                //A little inefficient double looping, but better than the line                //lagging behind the point positions                helpers.each(pointsWithValues,function(point){                    point.draw();                });            },this);        }    });}).call(this);(function(){    "use strict";    var root = this,        Chart = root.Chart,        //Cache a local reference to Chart.helpers        helpers = Chart.helpers;    var defaultConfig = {        //Boolean - Show a backdrop to the scale label        scaleShowLabelBackdrop : true,        //String - The colour of the label backdrop        scaleBackdropColor : "rgba(255,255,255,0.75)",        // Boolean - Whether the scale should begin at zero        scaleBeginAtZero : true,        //Number - The backdrop padding above & below the label in pixels        scaleBackdropPaddingY : 2,        //Number - The backdrop padding to the side of the label in pixels        scaleBackdropPaddingX : 2,        //Boolean - Show line for each value in the scale        scaleShowLine : true,        //Boolean - Stroke a line around each segment in the chart        segmentShowStroke : true,        //String - The colour of the stroke on each segement.        segmentStrokeColor : "#fff",        //Number - The width of the stroke value in pixels        segmentStrokeWidth : 2,        //Number - Amount of animation steps        animationSteps : 100,        //String - Animation easing effect.        animationEasing : "easeOutBounce",        //Boolean - Whether to animate the rotation of the chart        animateRotate : true,        //Boolean - Whether to animate scaling the chart from the centre        animateScale : false,        //String - A legend template        legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"    };    Chart.Type.extend({        //Passing in a name registers this chart in the Chart namespace        name: "PolarArea",        //Providing a defaults will also register the deafults in the chart namespace        defaults : defaultConfig,        //Initialize is fired when the chart is initialized - Data is passed in as a parameter        //Config is automatically merged by the core of Chart.js, and is available at this.options        initialize:  function(data){            this.segments = [];            //Declare segment class as a chart instance specific class, so it can share props for this instance            this.SegmentArc = Chart.Arc.extend({                showStroke : this.options.segmentShowStroke,                strokeWidth : this.options.segmentStrokeWidth,                strokeColor : this.options.segmentStrokeColor,                ctx : this.chart.ctx,                innerRadius : 0,                x : this.chart.width/2,                y : this.chart.height/2            });            this.scale = new Chart.RadialScale({                display: this.options.showScale,                fontStyle: this.options.scaleFontStyle,                fontSize: this.options.scaleFontSize,                fontFamily: this.options.scaleFontFamily,                fontColor: this.options.scaleFontColor,                showLabels: this.options.scaleShowLabels,                showLabelBackdrop: this.options.scaleShowLabelBackdrop,                backdropColor: this.options.scaleBackdropColor,                backdropPaddingY : this.options.scaleBackdropPaddingY,                backdropPaddingX: this.options.scaleBackdropPaddingX,                lineWidth: (this.options.scaleShowLine) ? this.options.scaleLineWidth : 0,                lineColor: this.options.scaleLineColor,                lineArc: true,                width: this.chart.width,                height: this.chart.height,                xCenter: this.chart.width/2,                yCenter: this.chart.height/2,                ctx : this.chart.ctx,                templateString: this.options.scaleLabel,                valuesCount: data.length            });            this.updateScaleRange(data);            this.scale.update();            helpers.each(data,function(segment,index){                this.addData(segment,index,true);            },this);            //Set up tooltip events on the chart            if (this.options.showTooltips){                helpers.bindEvents(this, this.options.tooltipEvents, function(evt){                    var activeSegments = (evt.type !== 'mouseout') ? this.getSegmentsAtEvent(evt) : [];                    helpers.each(this.segments,function(segment){                        segment.restore(["fillColor"]);                    });                    helpers.each(activeSegments,function(activeSegment){                        activeSegment.fillColor = activeSegment.highlightColor;                    });                    this.showTooltip(activeSegments);                });            }            this.render();        },        getSegmentsAtEvent : function(e){            var segmentsArray = [];            var location = helpers.getRelativePosition(e);            helpers.each(this.segments,function(segment){                if (segment.inRange(location.x,location.y)) segmentsArray.push(segment);            },this);            return segmentsArray;        },        addData : function(segment, atIndex, silent){            var index = atIndex || this.segments.length;            this.segments.splice(index, 0, new this.SegmentArc({                fillColor: segment.color,                highlightColor: segment.highlight || segment.color,                label: segment.label,                value: segment.value,                outerRadius: (this.options.animateScale) ? 0 : this.scale.calculateCenterOffset(segment.value),                circumference: (this.options.animateRotate) ? 0 : this.scale.getCircumference(),                startAngle: Math.PI * 1.5            }));            if (!silent){                this.reflow();                this.update();            }        },        removeData: function(atIndex){            var indexToDelete = (helpers.isNumber(atIndex)) ? atIndex : this.segments.length-1;            this.segments.splice(indexToDelete, 1);            this.reflow();            this.update();        },        calculateTotal: function(data){            this.total = 0;            helpers.each(data,function(segment){                this.total += segment.value;            },this);            this.scale.valuesCount = this.segments.length;        },        updateScaleRange: function(datapoints){            var valuesArray = [];            helpers.each(datapoints,function(segment){                valuesArray.push(segment.value);            });            var scaleSizes = (this.options.scaleOverride) ?                {                    steps: this.options.scaleSteps,                    stepValue: this.options.scaleStepWidth,                    min: this.options.scaleStartValue,                    max: this.options.scaleStartValue + (this.options.scaleSteps * this.options.scaleStepWidth)                } :                helpers.calculateScaleRange(                    valuesArray,                    helpers.min([this.chart.width, this.chart.height])/2,                    this.options.scaleFontSize,                    this.options.scaleBeginAtZero,                    this.options.scaleIntegersOnly                );            helpers.extend(                this.scale,                scaleSizes,                {                    size: helpers.min([this.chart.width, this.chart.height]),                    xCenter: this.chart.width/2,                    yCenter: this.chart.height/2                }            );        },        update : function(){            this.calculateTotal(this.segments);            helpers.each(this.segments,function(segment){                segment.save();            });            this.reflow();            this.render();        },        reflow : function(){            helpers.extend(this.SegmentArc.prototype,{                x : this.chart.width/2,                y : this.chart.height/2            });            this.updateScaleRange(this.segments);            this.scale.update();            helpers.extend(this.scale,{                xCenter: this.chart.width/2,                yCenter: this.chart.height/2            });            helpers.each(this.segments, function(segment){                segment.update({                    outerRadius : this.scale.calculateCenterOffset(segment.value)                });            }, this);        },        draw : function(ease){            var easingDecimal = ease || 1;            //Clear & draw the canvas            this.clear();            helpers.each(this.segments,function(segment, index){                segment.transition({                    circumference : this.scale.getCircumference(),                    outerRadius : this.scale.calculateCenterOffset(segment.value)                },easingDecimal);                segment.endAngle = segment.startAngle + segment.circumference;                // If we've removed the first segment we need to set the first one to                // start at the top.                if (index === 0){                    segment.startAngle = Math.PI * 1.5;                }                //Check to see if it's the last segment, if not get the next and update the start angle                if (index < this.segments.length - 1){                    this.segments[index+1].startAngle = segment.endAngle;                }                segment.draw();            }, this);            this.scale.draw();        }    });}).call(this);(function(){    "use strict";    var root = this,        Chart = root.Chart,        helpers = Chart.helpers;    Chart.Type.extend({        name: "Radar",        defaults:{            //Boolean - Whether to show lines for each scale point            scaleShowLine : true,            //Boolean - Whether we show the angle lines out of the radar            angleShowLineOut : true,            //Boolean - Whether to show labels on the scale            scaleShowLabels : false,            // Boolean - Whether the scale should begin at zero            scaleBeginAtZero : true,            //String - Colour of the angle line            angleLineColor : "rgba(0,0,0,.1)",            //Number - Pixel width of the angle line            angleLineWidth : 1,            //String - Point label font declaration            pointLabelFontFamily : "'Arial'",            //String - Point label font weight            pointLabelFontStyle : "normal",            //Number - Point label font size in pixels            pointLabelFontSize : 10,            //String - Point label font colour            pointLabelFontColor : "#666",            //Boolean - Whether to show a dot for each point            pointDot : true,            //Number - Radius of each point dot in pixels            pointDotRadius : 3,            //Number - Pixel width of point dot stroke            pointDotStrokeWidth : 1,            //Number - amount extra to add to the radius to cater for hit detection outside the drawn point            pointHitDetectionRadius : 20,            //Boolean - Whether to show a stroke for datasets            datasetStroke : true,            //Number - Pixel width of dataset stroke            datasetStrokeWidth : 2,            //Boolean - Whether to fill the dataset with a colour            datasetFill : true,            //String - A legend template            legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"        },        initialize: function(data){            this.PointClass = Chart.Point.extend({                strokeWidth : this.options.pointDotStrokeWidth,                radius : this.options.pointDotRadius,                display: this.options.pointDot,                hitDetectionRadius : this.options.pointHitDetectionRadius,                ctx : this.chart.ctx            });            this.datasets = [];            this.buildScale(data);            //Set up tooltip events on the chart            if (this.options.showTooltips){                helpers.bindEvents(this, this.options.tooltipEvents, function(evt){                    var activePointsCollection = (evt.type !== 'mouseout') ? this.getPointsAtEvent(evt) : [];                    this.eachPoints(function(point){                        point.restore(['fillColor', 'strokeColor']);                    });                    helpers.each(activePointsCollection, function(activePoint){                        activePoint.fillColor = activePoint.highlightFill;                        activePoint.strokeColor = activePoint.highlightStroke;                    });                    this.showTooltip(activePointsCollection);                });            }            //Iterate through each of the datasets, and build this into a property of the chart            helpers.each(data.datasets,function(dataset){                var datasetObject = {                    label: dataset.label || null,                    fillColor : dataset.fillColor,                    strokeColor : dataset.strokeColor,                    pointColor : dataset.pointColor,                    pointStrokeColor : dataset.pointStrokeColor,                    points : []                };                this.datasets.push(datasetObject);                helpers.each(dataset.data,function(dataPoint,index){                    //Add a new point for each piece of data, passing any required data to draw.                    var pointPosition;                    if (!this.scale.animation){                        pointPosition = this.scale.getPointPosition(index, this.scale.calculateCenterOffset(dataPoint));                    }                    datasetObject.points.push(new this.PointClass({                        value : dataPoint,                        label : data.labels[index],                        datasetLabel: dataset.label,                        x: (this.options.animation) ? this.scale.xCenter : pointPosition.x,                        y: (this.options.animation) ? this.scale.yCenter : pointPosition.y,                        strokeColor : dataset.pointStrokeColor,                        fillColor : dataset.pointColor,                        highlightFill : dataset.pointHighlightFill || dataset.pointColor,                        highlightStroke : dataset.pointHighlightStroke || dataset.pointStrokeColor                    }));                },this);            },this);            this.render();        },        eachPoints : function(callback){            helpers.each(this.datasets,function(dataset){                helpers.each(dataset.points,callback,this);            },this);        },        getPointsAtEvent : function(evt){            var mousePosition = helpers.getRelativePosition(evt),                fromCenter = helpers.getAngleFromPoint({                    x: this.scale.xCenter,                    y: this.scale.yCenter                }, mousePosition);            var anglePerIndex = (Math.PI * 2) /this.scale.valuesCount,                pointIndex = Math.round((fromCenter.angle - Math.PI * 1.5) / anglePerIndex),                activePointsCollection = [];            // If we're at the top, make the pointIndex 0 to get the first of the array.            if (pointIndex >= this.scale.valuesCount || pointIndex < 0){                pointIndex = 0;            }            if (fromCenter.distance <= this.scale.drawingArea){                helpers.each(this.datasets, function(dataset){                    activePointsCollection.push(dataset.points[pointIndex]);                });            }            return activePointsCollection;        },        buildScale : function(data){            this.scale = new Chart.RadialScale({                display: this.options.showScale,                fontStyle: this.options.scaleFontStyle,                fontSize: this.options.scaleFontSize,                fontFamily: this.options.scaleFontFamily,                fontColor: this.options.scaleFontColor,                showLabels: this.options.scaleShowLabels,                showLabelBackdrop: this.options.scaleShowLabelBackdrop,                backdropColor: this.options.scaleBackdropColor,                backdropPaddingY : this.options.scaleBackdropPaddingY,                backdropPaddingX: this.options.scaleBackdropPaddingX,                lineWidth: (this.options.scaleShowLine) ? this.options.scaleLineWidth : 0,                lineColor: this.options.scaleLineColor,                angleLineColor : this.options.angleLineColor,                angleLineWidth : (this.options.angleShowLineOut) ? this.options.angleLineWidth : 0,                // Point labels at the edge of each line                pointLabelFontColor : this.options.pointLabelFontColor,                pointLabelFontSize : this.options.pointLabelFontSize,                pointLabelFontFamily : this.options.pointLabelFontFamily,                pointLabelFontStyle : this.options.pointLabelFontStyle,                height : this.chart.height,                width: this.chart.width,                xCenter: this.chart.width/2,                yCenter: this.chart.height/2,                ctx : this.chart.ctx,                templateString: this.options.scaleLabel,                labels: data.labels,                valuesCount: data.datasets[0].data.length            });            this.scale.setScaleSize();            this.updateScaleRange(data.datasets);            this.scale.buildYLabels();        },        updateScaleRange: function(datasets){            var valuesArray = (function(){                var totalDataArray = [];                helpers.each(datasets,function(dataset){                    if (dataset.data){                        totalDataArray = totalDataArray.concat(dataset.data);                    }                    else {                        helpers.each(dataset.points, function(point){                            totalDataArray.push(point.value);                        });                    }                });                return totalDataArray;            })();            var scaleSizes = (this.options.scaleOverride) ?                {                    steps: this.options.scaleSteps,                    stepValue: this.options.scaleStepWidth,                    min: this.options.scaleStartValue,                    max: this.options.scaleStartValue + (this.options.scaleSteps * this.options.scaleStepWidth)                } :                helpers.calculateScaleRange(                    valuesArray,                    helpers.min([this.chart.width, this.chart.height])/2,                    this.options.scaleFontSize,                    this.options.scaleBeginAtZero,                    this.options.scaleIntegersOnly                );            helpers.extend(                this.scale,                scaleSizes            );        },        addData : function(valuesArray,label){            //Map the values array for each of the datasets            this.scale.valuesCount++;            helpers.each(valuesArray,function(value,datasetIndex){                var pointPosition = this.scale.getPointPosition(this.scale.valuesCount, this.scale.calculateCenterOffset(value));                this.datasets[datasetIndex].points.push(new this.PointClass({                    value : value,                    label : label,                    x: pointPosition.x,                    y: pointPosition.y,                    strokeColor : this.datasets[datasetIndex].pointStrokeColor,                    fillColor : this.datasets[datasetIndex].pointColor                }));            },this);            this.scale.labels.push(label);            this.reflow();            this.update();        },        removeData : function(){            this.scale.valuesCount--;            this.scale.labels.shift();            helpers.each(this.datasets,function(dataset){                dataset.points.shift();            },this);            this.reflow();            this.update();        },        update : function(){            this.eachPoints(function(point){                point.save();            });            this.reflow();            this.render();        },        reflow: function(){            helpers.extend(this.scale, {                width : this.chart.width,                height: this.chart.height,                size : helpers.min([this.chart.width, this.chart.height]),                xCenter: this.chart.width/2,                yCenter: this.chart.height/2            });            this.updateScaleRange(this.datasets);            this.scale.setScaleSize();            this.scale.buildYLabels();        },        draw : function(ease){            var easeDecimal = ease || 1,                ctx = this.chart.ctx;            this.clear();            this.scale.draw();            helpers.each(this.datasets,function(dataset){                //Transition each point first so that the line and point drawing isn't out of sync                helpers.each(dataset.points,function(point,index){                    if (point.hasValue()){                        point.transition(this.scale.getPointPosition(index, this.scale.calculateCenterOffset(point.value)), easeDecimal);                    }                },this);                //Draw the line between all the points                ctx.lineWidth = this.options.datasetStrokeWidth;                ctx.strokeStyle = dataset.strokeColor;                ctx.beginPath();                helpers.each(dataset.points,function(point,index){                    if (index === 0){                        ctx.moveTo(point.x,point.y);                    }                    else{                        ctx.lineTo(point.x,point.y);                    }                },this);                ctx.closePath();                ctx.stroke();                ctx.fillStyle = dataset.fillColor;                ctx.fill();                //Now draw the points over the line                //A little inefficient double looping, but better than the line                //lagging behind the point positions                helpers.each(dataset.points,function(point){                    if (point.hasValue()){                        point.draw();                    }                });            },this);        }    });}).call(this);
  • angular-chart.css
    .chart-legend,.bar-legend,.line-legend,.pie-legend,.radar-legend,.polararea-legend,.doughnut-legend {    list-style-type: none;    margin-top: 5px;    text-align: center;    -webkit-padding-start: 0;    -moz-padding-start: 0;    padding-left: 0}.chart-legend li,.bar-legend li,.line-legend li,.pie-legend li,.radar-legend li,.polararea-legend li,.doughnut-legend li {    display: inline-block;    white-space: nowrap;    position: relative;    margin-bottom: 4px;    border-radius: 5px;    padding: 2px 8px 2px 28px;    font-size: smaller;    cursor: default}.chart-legend li span,.bar-legend li span,.line-legend li span,.pie-legend li span,.radar-legend li span,.polararea-legend li span,.doughnut-legend li span {    display: block;    position: absolute;    left: 0;    top: 0;    width: 20px;    height: 20px;    border-radius: 5px}/*# sourceMappingURL=angular-chart.css.map */
0 0
原创粉丝点击