Full Code of tomdyson/wagalytics for AI

master e38d6e748051 cached
19 files
152.3 KB
52.2k tokens
266 symbols
1 requests
Download .txt
Repository: tomdyson/wagalytics
Branch: master
Commit: e38d6e748051
Files: 19
Total size: 152.3 KB

Directory structure:
gitextract_vh81vh8u/

├── .gitignore
├── LICENSE
├── MANIFEST.in
├── README.md
├── client/
│   ├── src/
│   │   └── wagalytics.js
│   └── webpack.config.js
├── package.json
├── pytest.ini
├── setup.cfg
├── setup.py
└── wagalytics/
    ├── __init__.py
    ├── static/
    │   └── wagalytics/
    │       ├── .gitkeep
    │       ├── vendors.bundle.js
    │       └── wagalytics.bundle.js
    ├── templates/
    │   └── wagalytics/
    │       └── dashboard.html
    ├── tests/
    │   └── tests.py
    ├── urls.py
    ├── views.py
    └── wagtail_hooks.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
dist/
build/
*.pyc
.DS_Store
*.egg-info
npm-debug.log
node_modules


================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2017 Tom Dyson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: MANIFEST.in
================================================
graft wagalytics
global-exclude __pycache__
global-exclude *.py[co]


================================================
FILE: README.md
================================================
# Wagtail Analytics

(Last Updated 12/17/19 for Wagtail v2.x)

This module provides a simple dashboard of Google Analytics data, integrated into the Wagtail admin UI. Tested on Wagtail 2.0+.

![Screenshot](screenshot.png)

![Screenshot](wagalytics-page-stats.png)

## Instructions

1. [Create a service account](https://ga-dev-tools.appspot.com/embed-api/server-side-authorization) and download the JSON key (Credentials > Create Credentials > API key)
1. Make sure the [Analytics API is enabled for your project](https://console.developers.google.com/apis/api/analytics.googleapis.com) (See [issue 2](https://github.com/tomdyson/wagalytics/issues/2))
1. Add the [service account email address](https://console.developers.google.com/permissions/serviceaccounts) as a read-only user in Google Analytics (Admin > User Management)
1. Find the ID for your Google Analytics property (Admin > Property > View Settings, note: this is NOT the key that begins with "UA-")
1. Store your JSON key somewhere safe, and do not check it into your repo
1. `pip install wagalytics`
1. Add 'wagalytics' to your INSTALLED_APPS
1. Add 'wagtailfontawesome' to INSTALLED_APPS if it's not there already
1. Update your settings:
 - `GA_KEY_FILEPATH = '/path/to/secure/directory/your-key.json'`

 or when using environment variables (e.g. Heroku):
 - `GA_KEY_CONTENT = 'content_of_your_key.json'`
 - `GA_VIEW_ID = 'ga:xxxxxxxx'`

If you get CryptoUnavailableError errors, you probably need to `pip install PyOpenSSL` and/or `pip install pycrypto`. See [StackOverflow](http://stackoverflow.com/questions/27305867/google-api-access-using-service-account-oauth2client-client-cryptounavailableerr).

Ensure that your code snippet is included on each page you want to be tracked (likely by putting it in your base.html template.) (Admin > Property > Tracking Code)

## Multisite Support

To enable multisite support you'll need to update your Wagalytics settings _and_ have `wagtail.contrib.settings` installed. Sites can use a `GA_KEY_FILEPATH` or a `GA_KEY_CONTENT` key, but it's best not to use both.

In the snippet below, you'll see `site_id`. This is the ID (Primary Key) of your Wagtail Site.
```python
# Use either the GA_KEY_FILEPATH or the GA_KEY_CONTENT setting on your sites,
# but don't use both
WAGALYTICS_SETTINGS = {
    site_id: {
        'GA_VIEW_ID': 'ga:xxxxxxxx',
        'GA_KEY_FILEPATH': '/path/to/secure/directory/your-key.json',
    },
    site_id: {
        'GA_VIEW_ID': 'ga:xxxxxxxx',
        'GA_KEY_CONTENT': 'content_of_your_key.json',
	}
}
```
For every Wagalytics site you add in your multisite `WAGALYTICS_SETTINGS` you'll need to make sure you have the proper GA View ID and API Key. One View ID and API Key won't work for all your sites automatically.

Here's a working example of multisite WAGALYTICS_SETTINGS:

```python
WAGALYTICS_SETTINGS = {
	# My default site. 2 is the site ID. This one uses GA_KEY_FILEPATH.
    2: {
        'GA_VIEW_ID': 'ga:xxxxxxxx',
        'GA_KEY_FILEPATH': '/path/to/secure/directory/your-key.json',
    },
    # The secondary site. 3 is the Site ID. This one uses GA_KEY_CONTENT.
    3: {
        'GA_KEY_CONTENT': 'content_of_your_key.json',
        'GA_VIEW_ID': 'ga:xxxxxxxx',
    }
}
```

## Wagalytics Developers

Developers will need to carry out the following steps after cloning wagalytics:

- Ensure NodeJS & NPM are installed
- Run `npm install` then `npm run build` in the top level wagalytics directory

You will need to run `npm run build` anytime the javascript source is updated.

### TODO

 - [ ] allow configuration of results
 - [x] better styling, e.g. using [chart.js](https://ga-dev-tools.appspot.com/embed-api/third-party-visualizations/)
 - [ ] Throw an error if the relevant settings aren't available
 - [x] add [per-page results](https://github.com/tomdyson/wagalytics/issues/12)

### Notes

This module doesn't help with recording user activity. See [the Wagtail docs](http://docs.wagtail.io/en/latest/topics/writing_templates.html?highlight=analytics#varying-output-between-preview-and-live) and [StackOverflow](http://stackoverflow.com/a/1272312/181793) for pointers on how to avoid gathering data during preview and testing.

### Contributors

 - Thijs Kramer
 - Stefan Schärmeli
 - Alex Gleason
 - James Ramm
 - Jake Kent
 - Kalob Taulien
 - Julius Parishy


================================================
FILE: client/src/wagalytics.js
================================================
import moment from 'moment';

$(document).ready(() => {
    const el = document.getElementById('wagalytics-data');
    setup(el.dataset.token, el.dataset.viewId);
});

/**
 * Initialises google analytics and creates the dashboard charts
 * @param {*} token_url
 * @param {*} view_id
 */
function setup(token_url, view_id) {
    if (!window.google || !window.google.load) {
        var tag = document.createElement('script');
        tag.type = 'text/javascript';
        tag.src = 'https://www.google.com/jsapi';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(tag, s);
    }

    gapi.analytics.ready(function () {
        $.get(token_url, function (data) {
            gapi.analytics.auth.authorize({
                'serverAuth': {
                    'access_token': data
                }
            });
        });

        // Create the dashboard controller
        const dashboard = new Dashboard(view_id);
        dashboard.refresh();
    });
}

/**
 * Wagtails' colour palette
 */
const colors = {
    BLUE: '#71b2d4',
    GREEN: '#189370',
    ORANGE: '#e9b04d',
    RED: '#cd3238',
    SALMON: '#f37e77',
    SALMON_LIGHT: '#fcf2f2',
    TEAL: '#43b1b0',
    TEAL_DARKER: '#358c8b',
    TEAL_DARK: '#246060'
};

/**
 * Sets up the various charts and controls their UI functionality
 */
class Dashboard {
    constructor(view_id) {
        this.view_id = view_id;
        this.start_date_input = document.getElementById("id_date_from");
        this.end_date_input = document.getElementById("id_date_to");
        this.export_btn = document.getElementById("export-button");
        this.start_date_input.addEventListener('change', () => this.refresh());
        this.end_date_input.addEventListener('change', () => this.refresh());
        $(document.getElementById("export")).submit(() => {
            $(document.getElementById('export-data')).val(JSON.stringify(this.data));
        });

        this.data = {};

        this.tooltips = {
            enabled: true,
            mode: 'label',
            callbacks: {
                title: function (tooltipItems, data) {
                    var idx = tooltipItems[0].index;
                    return 'Title:' + data.labels[idx];//do something with title
                },
                label: function (tooltipItems, data) {
                    return tooltipItems.xLabel;
                }
            }
        }
    }

    setLoading(id) {
        document.getElementById(id).innerHTML = '<i class="icon icon-spinner"></i>';
    }

    /**
     * Setup the charts within the specified date range (last 7 or last 30 days)
     * @param {int} range - use the `ranges` enum to select. (Can be 1 or 2)
     */
    refresh() {
        this.sessionsLineChart();
        this.popularPagesTable();
        this.topReferrersTable();
    }

    /**
     * Query the google API for data within
     * the set range.
     * @param {Object} options Options specifying metrics, dimensions and any
     *  other keys accepted by gapi.
     */
    getQuery(options) {
      $(this.export_btn).prop('disabled', true);
      return query(Object.assign({
          ids: this.view_id,
          'start-date': $(this.start_date_input).val(),
          'end-date': $(this.end_date_input).val()
      }, options));
    }

    /**
     * Create a line chart showing number of sessions per day
     */
    sessionsLineChart() {
        const id = 'sessions-line-chart-container';
        this.setLoading(id);
        this.getQuery(
            {
                dimensions: 'ga:date,ga:nthDay',
                metrics: 'ga:sessions'
            }).then(results => {
                this.data['sessions'] = results.rows;
                $(this.export_btn).prop('disabled', false);
                $(this.export_btn).removeClass('button-longrunning-active');

                var data1 = results.rows.map(row => row[2]);
                var labels = results.rows.map(row => row[0]);
                labels = labels.map(function (label) {
                    return moment(label, 'YYYYMMDD').format('ll');
                });

                var data = {
                    labels: labels,
                    datasets: [
                        {
                            label: 'Sessions',
                            backgroundColor: colors.SALMON_LIGHT,
                            borderColor: colors.SALMON,
                            pointBackgroundColor: colors.SALMON,
                            pointBorderColor: '#fff',
                            data: data1
                        }
                    ]
                };
                new Chart(makeCanvas(id), {
                    type: 'line',
                    data: data,
                    options: {
                        legend: {
                            display: false
                        },
                        scales: {
                            xAxes: [{
                                ticks: {
                                    autoSkip: true,
                                    maxTicksLimit: 4,
                                    maxRotation: 0
                                }
                            }]
                        }
                    }
                });
                //generateLegend('legend-1-container', data.datasets);
            });
    }

    /**
     * Create table showing 25 most popular pages
     */
    popularPagesTable() {
        const id = 'popular-pages-table-container';
        this.setLoading(id);
        const queryData = {
            'metrics': 'ga:pageviews',
            'dimensions': 'ga:hostname,ga:pagePath',
            'sort': '-ga:pageviews',
            'max-results': 25
        };
        this.getQuery(queryData).then(results => {

            // The results contain duplicates for variations in hostname
            // e.g. if someone visit http://mywebsite.com vs http://www.mywebsite.com
            // Here we aggregate these results into single values per page, regardless
            // of hostname
            var i = 0;
            const rows = results.rows;
            const l = rows.length;
            const bars = {};
            for (i; i < l; ++i) {
                const key = rows[i][1]
                if (bars.hasOwnProperty(key)) {
                    bars[key][1] += parseInt(rows[i][2], 10);
                }
                else {
                    bars[key] = [key, parseInt(rows[i][2], 10)];
                }
            }

            this.data['pages'] = Object.values(bars);
            $(this.export_btn).prop('disabled', false);
            $(this.export_btn).removeClass('button-longrunning-active');

            const table = createTable(['Page URL', 'Views'], Object.values(bars));
            const pager = paginateTable(table);
            const container = document.getElementById(id);
            container.innerHTML = '';
            container.appendChild(table);
            $(container).append(pager);
        });
    }

    /**
     * Create table showing 25 top referrers
     */
    topReferrersTable() {
        const id = 'top-referrers-table-container';
        this.setLoading(id);
        const queryData = {
            'metrics': 'ga:pageviews',
            'dimensions': 'ga:fullReferrer',
            'sort': '-ga:pageviews',
            'max-results': 25
        };

        this.getQuery(queryData).then(results => {
            this.data['referrers'] = results.rows;
            $(this.export_btn).prop('disabled', false);
            $(this.export_btn).removeClass('button-longrunning-active');

            const table = createTable(['Source', 'Views'], results.rows);
            const pager = paginateTable(table);
            const container = document.getElementById(id);
            container.innerHTML = '';
            container.appendChild(table);
            $(container).append(pager);
        });
    }
}

/**
 * Create a table
 * @param {*} headings
 * @param {*} rows
 */
function createTable(headings, rows){
    const table = document.createElement('table');
    table.className = 'listing';
    const head = table.createTHead();
    const headerRow = head.insertRow(0);
    let i = 0;
    for (i; i < headings.length; ++i) {
        const heading = headerRow.insertCell(i);
        heading.innerHTML = headings[i];
        heading.className = 'title';
    }
    const body = table.createTBody();
    for (i = 0; i < rows.length; ++i) {
        const rowData = rows[i];
        const row = body.insertRow(i);
        for (let j = 0; j < rowData.length; ++j) {
            row.insertCell(j).innerHTML = rowData[j];
        }
    }
    return table;
}

/**
 * Client side pagination of a table.
 * Table rows are hidden/shown according to the page number
 * @param {*} table
 */
function paginateTable(table) {
    let currentPage = 0;
    const numPerPage = 5;
    const $table = $(table);

    // This is the function which controls display of content
    $table.bind('repaginate', function() {
        $table.find('tbody tr').hide().slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).show();
        let $pager = $table.next();
        if (currentPage <= 0) {
            $pager.find('.prev').addClass('disabled');
        } else {
            $pager.find('.prev').removeClass('disabled');
        }
        if (currentPage >= numPages - 1) {
            $pager.find('.next').addClass('disabled');
        } else {
            $pager.find('.next').removeClass('disabled');
        }
    });
    $table.trigger('repaginate');
    const numRows = $table.find('tbody tr').length;
    const numPages = Math.ceil(numRows / numPerPage);

    // Create the page selector element and add callbacks to handle setting the page
    const $pager = $(`
        <div class="pagination">
            <p>Page <span class="page-num">1</span> of ${numPages}</p>
            <ul>
                <li class="prev disabled">
                    <a class="icon icon-arrow-left" href="#">Previous</a>
                </li>
                <li class="next">
                    <a class="icon icon-arrow-right-after" href="#">Next</a>
                </li>
            </ul>
        </div>`);

    // Previous page click handler
    $pager.find('.prev a').bind('click', event => {
        event.preventDefault();
        currentPage -= 1;
        if (currentPage < 0) {
            currentPage = 0;
        }
        $pager.find('.page-num').text(`${currentPage + 1}`);
        $table.trigger('repaginate');
    });

    // Next page click handler
    $pager.find('.next a').bind('click', event => {
        event.preventDefault();
        currentPage += 1;
        if (currentPage >= numPages) {
            currentPage = numPages - 1;
        }
        $pager.find('.page-num').text(`${currentPage + 1}`);
        $table.trigger('repaginate');
    });
    return $pager;
}


/**
 * Extend the Embed APIs `gapi.analytics.report.Data` component to
 * return a promise the is fulfilled with the value returned by the API.
 * @param {Object} params The request parameters.
 * @return {Promise} A promise.
 */
function query(params) {
    return new Promise(function (resolve, reject) {
        var data = new gapi.analytics.report.Data({ query: params });
        data.once('success', function (response) { resolve(response); })
            .once('error', function (response) { reject(response); })
            .execute();
    });
}


/**
 * Create a new canvas inside the specified element. Set it to be the width
 * and height of its container.
 * @param {string} id The id attribute of the element to host the canvas.
 * @return {RenderingContext} The 2D canvas context.
 */
function makeCanvas(id) {
    var container = document.getElementById(id);
    var canvas = document.createElement('canvas');
    var ctx = canvas.getContext('2d');

    container.innerHTML = '';
    canvas.width = container.offsetWidth;
    canvas.height = container.offsetHeight;
    container.appendChild(canvas);

    return ctx;
}

/**
 * Create a visual legend inside the specified element based off of a
 * Chart.js dataset.
 * @param {string} id The id attribute of the element to host the legend.
 * @param {Array.<Object>} items A list of labels and colors for the legend.
 */
function generateLegend(id, items) {
    var legend = document.getElementById(id);
    legend.innerHTML = items.map(function (item) {
        var color = item.color || item.fillColor;
        var label = item.label;
        return '<li><i style="background:' + color + '"></i>' +
            escapeHtml(label) + '</li>';
    }).join('');
}

/**
 * Escapes a potentially unsafe HTML string.
 * @param {string} str An string that may contain HTML entities.
 * @return {string} The HTML-escaped string.
 */
function escapeHtml(str) {
    var div = document.createElement('div');
    div.appendChild(document.createTextNode(str));
    return div.innerHTML;
}

// Set some global Chart.js defaults.
Chart.defaults.global.animationSteps = 60;
Chart.defaults.global.animationEasing = 'easeInOutQuart';
Chart.defaults.global.responsive = true;
Chart.defaults.global.maintainAspectRatio = false;


================================================
FILE: client/webpack.config.js
================================================
var path = require('path');
var webpack = require('webpack');

module.exports = {
  context: __dirname,
  entry: {
    wagalytics: './src/wagalytics.js',
    vendors: [
      'moment',
    ]
  },
  output: {
      path: path.resolve('./wagalytics/static/wagalytics/'),
      filename: "[name].bundle.js"
  },

  module: {
    rules: [{
      test: /\.jsx?$/,
      exclude: /node_modules/,
      use: [{
        loader: 'babel-loader',
        options: {
          presets: [],
        },
      },
      ]
    }]
  },

  mode: 'production',

  plugins: [
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: JSON.stringify('production')
      }
    }),
    new webpack.SourceMapDevToolPlugin({
      filename: '[name].js.map',
      append: '\n//# sourceMappingURL=http://127.0.0.1:3001/dist/js/[url]'
    }),
    new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
  ]
}


================================================
FILE: package.json
================================================
{
  "name": "wagalytics",
  "version": "1.0.0",
  "description": "",
  "repository": {
    "type": "git",
    "url": "https://github.com/tomdyson/wagalytics.git"
  },
  "author": "Tom Dyson",
  "license": "MIT",
  "scripts": {
    "build": "npx webpack --config ./client/webpack.config.js",
    "watch": "npx webpack --config ./client/webpack.config.js --watch",
    "dist": "npm install && npx webpack --config ./client/webpack.config.js"
  },
  "babel": {
    "presets": [
      "@babel/preset-env"
    ]
  },
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/plugin-proposal-class-properties": "^7.0.0",
    "@babel/plugin-proposal-decorators": "^7.0.0",
    "@babel/plugin-proposal-do-expressions": "^7.0.0",
    "@babel/plugin-proposal-export-default-from": "^7.0.0",
    "@babel/plugin-proposal-export-namespace-from": "^7.0.0",
    "@babel/plugin-proposal-function-bind": "^7.0.0",
    "@babel/plugin-proposal-function-sent": "^7.0.0",
    "@babel/plugin-proposal-json-strings": "^7.0.0",
    "@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
    "@babel/plugin-proposal-numeric-separator": "^7.0.0",
    "@babel/plugin-proposal-optional-chaining": "^7.0.0",
    "@babel/plugin-proposal-pipeline-operator": "^7.0.0",
    "@babel/plugin-proposal-throw-expressions": "^7.0.0",
    "@babel/plugin-syntax-dynamic-import": "^7.0.0",
    "@babel/plugin-syntax-import-meta": "^7.0.0",
    "@babel/polyfill": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "babel-loader": "^8.0.0",
    "webpack": "^4.43.0",
    "webpack-cli": "^3.3.11"
  },
  "dependencies": {
    "moment": "^2.17.1"
  }
}


================================================
FILE: pytest.ini
================================================
[pytest]
DJANGO_SETTINGS_MODULE = wagalytics.tests.settings
python_files = tests.py test_*.py *_tests.py


================================================
FILE: setup.cfg
================================================
[metadata]
description-file = README.md

[bdist_wheel]
universal=1


================================================
FILE: setup.py
================================================
from os import path

from setuptools import setup, find_packages

try:
    from wagtail.utils.setup import sdist
    cmdclass = {
        'sdist': sdist
    }
except ModuleNotFoundError:
    cmdclass = {}

from wagalytics import __version__


testing_extras = [
    'pytest==5.3.1',
    'pytest-django==3.7.0',
    'wagtail-factories==2.0.0',
    'factory-boy==2.11.0',
]

setup(
    name='wagalytics',
    version=__version__,
    description='Show Google Analytics data in Wagtail.',
    long_description='See https://github.com/tomdyson/wagalytics for details',
    url='https://github.com/tomdyson/wagalytics',
    author='Tom Dyson',
    author_email='tom+wagalytics@torchbox.com',
    license='MIT',
    classifiers=[
        "Environment :: Web Environment",
        "Framework :: Django",
        "Intended Audience :: Developers",
        "Operating System :: OS Independent",
        "Programming Language :: Python",
        'Topic :: Internet :: WWW/HTTP',
        "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
    ],
    keywords='development',
    packages=find_packages(),
    include_package_data=True,
    zip_safe=False,
    install_requires=[
        "wagtail>=2.0",
        "Django>=2.0.13",
        "oauth2client",
        "wagtailfontawesome>=1.1.2",
        "pyexcel-ods==0.5.3"
    ],
    cmdclass=cmdclass,
    extras_require={
        'testing': testing_extras,
    },
)


================================================
FILE: wagalytics/__init__.py
================================================
__version__ = '1.3'


================================================
FILE: wagalytics/static/wagalytics/.gitkeep
================================================


================================================
FILE: wagalytics/static/wagalytics/vendors.bundle.js
================================================
!function(e){var t={};function n(s){if(t[s])return t[s].exports;var i=t[s]={i:s,l:!1,exports:{}};return e[s].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(s,i,function(t){return e[t]}.bind(null,i));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){(function(e){e.exports=function(){"use strict";var t,n;function s(){return t.apply(null,arguments)}function i(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function r(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function a(e){return void 0===e}function o(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function u(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function l(e,t){var n,s=[];for(n=0;n<e.length;++n)s.push(t(e[n],n));return s}function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function h(e,t){for(var n in t)d(t,n)&&(e[n]=t[n]);return d(t,"toString")&&(e.toString=t.toString),d(t,"valueOf")&&(e.valueOf=t.valueOf),e}function c(e,t,n,s){return St(e,t,n,s,!0).utc()}function f(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function m(e){if(null==e._isValid){var t=f(e),s=n.call(t.parsedDateParts,(function(e){return null!=e})),i=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&s);if(e._strict&&(i=i&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return i;e._isValid=i}return e._isValid}function _(e){var t=c(NaN);return null!=e?h(f(t),e):f(t).userInvalidated=!0,t}n=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};var y=s.momentProperties=[];function g(e,t){var n,s,i;if(a(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),a(t._i)||(e._i=t._i),a(t._f)||(e._f=t._f),a(t._l)||(e._l=t._l),a(t._strict)||(e._strict=t._strict),a(t._tzm)||(e._tzm=t._tzm),a(t._isUTC)||(e._isUTC=t._isUTC),a(t._offset)||(e._offset=t._offset),a(t._pf)||(e._pf=f(t)),a(t._locale)||(e._locale=t._locale),y.length>0)for(n=0;n<y.length;n++)a(i=t[s=y[n]])||(e[s]=i);return e}var p=!1;function v(e){g(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===p&&(p=!0,s.updateOffset(this),p=!1)}function w(e){return e instanceof v||null!=e&&null!=e._isAMomentObject}function M(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function S(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=M(t)),n}function D(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(s=0;s<i;s++)(n&&e[s]!==t[s]||!n&&S(e[s])!==S(t[s]))&&a++;return a+r}function k(e){!1===s.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function Y(e,t){var n=!0;return h((function(){if(null!=s.deprecationHandler&&s.deprecationHandler(null,e),n){for(var i,r=[],a=0;a<arguments.length;a++){if(i="","object"==typeof arguments[a]){for(var o in i+="\n["+a+"] ",arguments[0])i+=o+": "+arguments[0][o]+", ";i=i.slice(0,-2)}else i=arguments[a];r.push(i)}k(e+"\nArguments: "+Array.prototype.slice.call(r).join("")+"\n"+(new Error).stack),n=!1}return t.apply(this,arguments)}),t)}var O,T={};function b(e,t){null!=s.deprecationHandler&&s.deprecationHandler(e,t),T[e]||(k(t),T[e]=!0)}function x(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function P(e,t){var n,s=h({},e);for(n in t)d(t,n)&&(r(e[n])&&r(t[n])?(s[n]={},h(s[n],e[n]),h(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)d(e,n)&&!d(t,n)&&r(e[n])&&(s[n]=h({},s[n]));return s}function W(e){null!=e&&this.set(e)}s.suppressDeprecationWarnings=!1,s.deprecationHandler=null,O=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)d(e,t)&&n.push(t);return n};var C={};function H(e,t){var n=e.toLowerCase();C[n]=C[n+"s"]=C[t]=e}function R(e){return"string"==typeof e?C[e]||C[e.toLowerCase()]:void 0}function F(e){var t,n,s={};for(n in e)d(e,n)&&(t=R(n))&&(s[t]=e[n]);return s}var L={};function U(e,t){L[e]=t}function N(e,t,n){var s=""+Math.abs(e),i=t-s.length;return(e>=0?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}var G=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,V=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,E={},j={};function I(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return this[s]()}),e&&(j[e]=i),t&&(j[t[0]]=function(){return N(i.apply(this,arguments),t[1],t[2])}),n&&(j[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function A(e,t){return e.isValid()?(t=Z(t,e.localeData()),E[t]=E[t]||function(e){var t,n,s,i=e.match(G);for(t=0,n=i.length;t<n;t++)j[i[t]]?i[t]=j[i[t]]:i[t]=(s=i[t]).match(/\[[\s\S]/)?s.replace(/^\[|\]$/g,""):s.replace(/\\/g,"");return function(t){var s,r="";for(s=0;s<n;s++)r+=x(i[s])?i[s].call(t,e):i[s];return r}}(t),E[t](e)):e.localeData().invalidDate()}function Z(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(V.lastIndex=0;n>=0&&V.test(e);)e=e.replace(V,s),V.lastIndex=0,n-=1;return e}var z=/\d/,$=/\d\d/,J=/\d{3}/,q=/\d{4}/,B=/[+-]?\d{6}/,Q=/\d\d?/,X=/\d\d\d\d?/,K=/\d\d\d\d\d\d?/,ee=/\d{1,3}/,te=/\d{1,4}/,ne=/[+-]?\d{1,6}/,se=/\d+/,ie=/[+-]?\d+/,re=/Z|[+-]\d\d:?\d\d/gi,ae=/Z|[+-]\d\d(?::?\d\d)?/gi,oe=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,ue={};function le(e,t,n){ue[e]=x(t)?t:function(e,s){return e&&n?n:t}}function de(e,t){return d(ue,e)?ue[e](t._strict,t._locale):new RegExp(he(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(e,t,n,s,i){return t||n||s||i}))))}function he(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var ce={};function fe(e,t){var n,s=t;for("string"==typeof e&&(e=[e]),o(t)&&(s=function(e,n){n[t]=S(e)}),n=0;n<e.length;n++)ce[e[n]]=s}function me(e,t){fe(e,(function(e,n,s,i){s._w=s._w||{},t(e,s._w,s,i)}))}function _e(e,t,n){null!=t&&d(ce,e)&&ce[e](t,n._a,n,e)}function ye(e){return ge(e)?366:365}function ge(e){return e%4==0&&e%100!=0||e%400==0}I("Y",0,0,(function(){var e=this.year();return e<=9999?""+e:"+"+e})),I(0,["YY",2],0,(function(){return this.year()%100})),I(0,["YYYY",4],0,"year"),I(0,["YYYYY",5],0,"year"),I(0,["YYYYYY",6,!0],0,"year"),H("year","y"),U("year",1),le("Y",ie),le("YY",Q,$),le("YYYY",te,q),le("YYYYY",ne,B),le("YYYYYY",ne,B),fe(["YYYYY","YYYYYY"],0),fe("YYYY",(function(e,t){t[0]=2===e.length?s.parseTwoDigitYear(e):S(e)})),fe("YY",(function(e,t){t[0]=s.parseTwoDigitYear(e)})),fe("Y",(function(e,t){t[0]=parseInt(e,10)})),s.parseTwoDigitYear=function(e){return S(e)+(S(e)>68?1900:2e3)};var pe,ve=we("FullYear",!0);function we(e,t){return function(n){return null!=n?(Se(this,e,n),s.updateOffset(this,t),this):Me(this,e)}}function Me(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function Se(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&ge(e.year())&&1===e.month()&&29===e.date()?e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),De(n,e.month())):e._d["set"+(e._isUTC?"UTC":"")+t](n))}function De(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,s=(t%(n=12)+n)%n;return e+=(t-s)/12,1===s?ge(e)?29:28:31-s%7%2}pe=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},I("M",["MM",2],"Mo",(function(){return this.month()+1})),I("MMM",0,0,(function(e){return this.localeData().monthsShort(this,e)})),I("MMMM",0,0,(function(e){return this.localeData().months(this,e)})),H("month","M"),U("month",8),le("M",Q),le("MM",Q,$),le("MMM",(function(e,t){return t.monthsShortRegex(e)})),le("MMMM",(function(e,t){return t.monthsRegex(e)})),fe(["M","MM"],(function(e,t){t[1]=S(e)-1})),fe(["MMM","MMMM"],(function(e,t,n,s){var i=n._locale.monthsParse(e,s,n._strict);null!=i?t[1]=i:f(n).invalidMonth=e}));var ke=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ye="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),Oe="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function Te(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=c([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=pe.call(this._shortMonthsParse,a))?i:null:-1!==(i=pe.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=pe.call(this._shortMonthsParse,a))||-1!==(i=pe.call(this._longMonthsParse,a))?i:null:-1!==(i=pe.call(this._longMonthsParse,a))||-1!==(i=pe.call(this._shortMonthsParse,a))?i:null}function be(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=S(t);else if(!o(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),De(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function xe(e){return null!=e?(be(this,e),s.updateOffset(this,!0),this):Me(this,"Month")}var Pe=oe,We=oe;function Ce(){function e(e,t){return t.length-e.length}var t,n,s=[],i=[],r=[];for(t=0;t<12;t++)n=c([2e3,t]),s.push(this.monthsShort(n,"")),i.push(this.months(n,"")),r.push(this.months(n,"")),r.push(this.monthsShort(n,""));for(s.sort(e),i.sort(e),r.sort(e),t=0;t<12;t++)s[t]=he(s[t]),i[t]=he(i[t]);for(t=0;t<24;t++)r[t]=he(r[t]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+s.join("|")+")","i")}function He(e,t,n,s,i,r,a){var o=new Date(e,t,n,s,i,r,a);return e<100&&e>=0&&isFinite(o.getFullYear())&&o.setFullYear(e),o}function Re(e){var t=new Date(Date.UTC.apply(null,arguments));return e<100&&e>=0&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function Fe(e,t,n){var s=7+t-n;return-(7+Re(e,0,s).getUTCDay()-t)%7+s-1}function Le(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+Fe(e,s,i);return o<=0?a=ye(r=e-1)+o:o>ye(e)?(r=e+1,a=o-ye(e)):(r=e,a=o),{year:r,dayOfYear:a}}function Ue(e,t,n){var s,i,r=Fe(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+Ne(i=e.year()-1,t,n):a>Ne(e.year(),t,n)?(s=a-Ne(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function Ne(e,t,n){var s=Fe(e,t,n),i=Fe(e+1,t,n);return(ye(e)-s+i)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),H("week","w"),H("isoWeek","W"),U("week",5),U("isoWeek",5),le("w",Q),le("ww",Q,$),le("W",Q),le("WW",Q,$),me(["w","ww","W","WW"],(function(e,t,n,s){t[s.substr(0,1)]=S(e)})),I("d",0,"do","day"),I("dd",0,0,(function(e){return this.localeData().weekdaysMin(this,e)})),I("ddd",0,0,(function(e){return this.localeData().weekdaysShort(this,e)})),I("dddd",0,0,(function(e){return this.localeData().weekdays(this,e)})),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),H("day","d"),H("weekday","e"),H("isoWeekday","E"),U("day",11),U("weekday",11),U("isoWeekday",11),le("d",Q),le("e",Q),le("E",Q),le("dd",(function(e,t){return t.weekdaysMinRegex(e)})),le("ddd",(function(e,t){return t.weekdaysShortRegex(e)})),le("dddd",(function(e,t){return t.weekdaysRegex(e)})),me(["dd","ddd","dddd"],(function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:f(n).invalidWeekday=e})),me(["d","e","E"],(function(e,t,n,s){t[s]=S(e)}));var Ge="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ve="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Ee="Su_Mo_Tu_We_Th_Fr_Sa".split("_");function je(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=c([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=pe.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=pe.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=pe.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=pe.call(this._weekdaysParse,a))||-1!==(i=pe.call(this._shortWeekdaysParse,a))||-1!==(i=pe.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=pe.call(this._shortWeekdaysParse,a))||-1!==(i=pe.call(this._weekdaysParse,a))||-1!==(i=pe.call(this._minWeekdaysParse,a))?i:null:-1!==(i=pe.call(this._minWeekdaysParse,a))||-1!==(i=pe.call(this._weekdaysParse,a))||-1!==(i=pe.call(this._shortWeekdaysParse,a))?i:null}var Ie=oe,Ae=oe,Ze=oe;function ze(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=c([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=he(o[t]),u[t]=he(u[t]),l[t]=he(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function $e(){return this.hours()%12||12}function Je(e,t){I(e,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)}))}function qe(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,$e),I("k",["kk",2],0,(function(){return this.hours()||24})),I("hmm",0,0,(function(){return""+$e.apply(this)+N(this.minutes(),2)})),I("hmmss",0,0,(function(){return""+$e.apply(this)+N(this.minutes(),2)+N(this.seconds(),2)})),I("Hmm",0,0,(function(){return""+this.hours()+N(this.minutes(),2)})),I("Hmmss",0,0,(function(){return""+this.hours()+N(this.minutes(),2)+N(this.seconds(),2)})),Je("a",!0),Je("A",!1),H("hour","h"),U("hour",13),le("a",qe),le("A",qe),le("H",Q),le("h",Q),le("k",Q),le("HH",Q,$),le("hh",Q,$),le("kk",Q,$),le("hmm",X),le("hmmss",K),le("Hmm",X),le("Hmmss",K),fe(["H","HH"],3),fe(["k","kk"],(function(e,t,n){var s=S(e);t[3]=24===s?0:s})),fe(["a","A"],(function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e})),fe(["h","hh"],(function(e,t,n){t[3]=S(e),f(n).bigHour=!0})),fe("hmm",(function(e,t,n){var s=e.length-2;t[3]=S(e.substr(0,s)),t[4]=S(e.substr(s)),f(n).bigHour=!0})),fe("hmmss",(function(e,t,n){var s=e.length-4,i=e.length-2;t[3]=S(e.substr(0,s)),t[4]=S(e.substr(s,2)),t[5]=S(e.substr(i)),f(n).bigHour=!0})),fe("Hmm",(function(e,t,n){var s=e.length-2;t[3]=S(e.substr(0,s)),t[4]=S(e.substr(s))})),fe("Hmmss",(function(e,t,n){var s=e.length-4,i=e.length-2;t[3]=S(e.substr(0,s)),t[4]=S(e.substr(s,2)),t[5]=S(e.substr(i))}));var Be,Qe=we("Hours",!0),Xe={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Ye,monthsShort:Oe,week:{dow:0,doy:6},weekdays:Ge,weekdaysMin:Ee,weekdaysShort:Ve,meridiemParse:/[ap]\.?m?\.?/i},Ke={},et={};function tt(e){return e?e.toLowerCase().replace("_","-"):e}function nt(t){var n=null;if(!Ke[t]&&void 0!==e&&e&&e.exports)try{n=Be._abbr,!function(){var e=new Error("Cannot find module 'undefined'");throw e.code="MODULE_NOT_FOUND",e}(),st(n)}catch(e){}return Ke[t]}function st(e,t){var n;return e&&((n=a(t)?rt(e):it(e,t))?Be=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),Be._abbr}function it(e,t){if(null!==t){var n,s=Xe;if(t.abbr=e,null!=Ke[e])b("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=Ke[e]._config;else if(null!=t.parentLocale)if(null!=Ke[t.parentLocale])s=Ke[t.parentLocale]._config;else{if(null==(n=nt(t.parentLocale)))return et[t.parentLocale]||(et[t.parentLocale]=[]),et[t.parentLocale].push({name:e,config:t}),null;s=n._config}return Ke[e]=new W(P(s,t)),et[e]&&et[e].forEach((function(e){it(e.name,e.config)})),st(e),Ke[e]}return delete Ke[e],null}function rt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return Be;if(!i(e)){if(t=nt(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=tt(e[r]).split("-")).length,n=(n=tt(e[r+1]))?n.split("-"):null;t>0;){if(s=nt(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&D(i,n,!0)>=t-1)break;t--}r++}return Be}(e)}function at(e){var t,n=e._a;return n&&-2===f(e).overflow&&(t=n[1]<0||n[1]>11?1:n[2]<1||n[2]>De(n[0],n[1])?2:n[3]<0||n[3]>24||24===n[3]&&(0!==n[4]||0!==n[5]||0!==n[6])?3:n[4]<0||n[4]>59?4:n[5]<0||n[5]>59?5:n[6]<0||n[6]>999?6:-1,f(e)._overflowDayOfYear&&(t<0||t>2)&&(t=2),f(e)._overflowWeeks&&-1===t&&(t=7),f(e)._overflowWeekday&&-1===t&&(t=8),f(e).overflow=t),e}function ot(e,t,n){return null!=e?e:null!=t?t:n}function ut(e){var t,n,i,r,a,o=[];if(!e._d){for(i=function(e){var t=new Date(s.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}(e),e._w&&null==e._a[2]&&null==e._a[1]&&function(e){var t,n,s,i,r,a,o,u;if(null!=(t=e._w).GG||null!=t.W||null!=t.E)r=1,a=4,n=ot(t.GG,e._a[0],Ue(Dt(),1,4).year),s=ot(t.W,1),((i=ot(t.E,1))<1||i>7)&&(u=!0);else{r=e._locale._week.dow,a=e._locale._week.doy;var l=Ue(Dt(),r,a);n=ot(t.gg,e._a[0],l.year),s=ot(t.w,l.week),null!=t.d?((i=t.d)<0||i>6)&&(u=!0):null!=t.e?(i=t.e+r,(t.e<0||t.e>6)&&(u=!0)):i=r}s<1||s>Ne(n,r,a)?f(e)._overflowWeeks=!0:null!=u?f(e)._overflowWeekday=!0:(o=Le(n,s,i,r,a),e._a[0]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(a=ot(e._a[0],i[0]),(e._dayOfYear>ye(a)||0===e._dayOfYear)&&(f(e)._overflowDayOfYear=!0),n=Re(a,0,e._dayOfYear),e._a[1]=n.getUTCMonth(),e._a[2]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=o[t]=i[t];for(;t<7;t++)e._a[t]=o[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[3]&&0===e._a[4]&&0===e._a[5]&&0===e._a[6]&&(e._nextDay=!0,e._a[3]=0),e._d=(e._useUTC?Re:He).apply(null,o),r=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[3]=24),e._w&&void 0!==e._w.d&&e._w.d!==r&&(f(e).weekdayMismatch=!0)}}var lt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,dt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ht=/Z|[+-]\d\d(?::?\d\d)?/,ct=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],ft=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],mt=/^\/?Date\((\-?\d+)/i;function _t(e){var t,n,s,i,r,a,o=e._i,u=lt.exec(o)||dt.exec(o);if(u){for(f(e).iso=!0,t=0,n=ct.length;t<n;t++)if(ct[t][1].exec(u[1])){i=ct[t][0],s=!1!==ct[t][2];break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=ft.length;t<n;t++)if(ft[t][1].exec(u[3])){r=(u[2]||" ")+ft[t][0];break}if(null==r)return void(e._isValid=!1)}if(!s&&null!=r)return void(e._isValid=!1);if(u[4]){if(!ht.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),wt(e)}else e._isValid=!1}var yt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;function gt(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}var pt={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function vt(e){var t,n,s,i,r,a,o,u=yt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(u){var l=(t=u[4],n=u[3],s=u[2],i=u[5],r=u[6],a=u[7],o=[gt(t),Oe.indexOf(n),parseInt(s,10),parseInt(i,10),parseInt(r,10)],a&&o.push(parseInt(a,10)),o);if(!function(e,t,n){return!e||Ve.indexOf(e)===new Date(t[0],t[1],t[2]).getDay()||(f(n).weekdayMismatch=!0,n._isValid=!1,!1)}(u[1],l,e))return;e._a=l,e._tzm=function(e,t,n){if(e)return pt[e];if(t)return 0;var s=parseInt(n,10),i=s%100;return(s-i)/100*60+i}(u[8],u[9],u[10]),e._d=Re.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),f(e).rfc2822=!0}else e._isValid=!1}function wt(e){if(e._f!==s.ISO_8601)if(e._f!==s.RFC_2822){e._a=[],f(e).empty=!0;var t,n,i,r,a,o=""+e._i,u=o.length,l=0;for(i=Z(e._f,e._locale).match(G)||[],t=0;t<i.length;t++)r=i[t],(n=(o.match(de(r,e))||[])[0])&&((a=o.substr(0,o.indexOf(n))).length>0&&f(e).unusedInput.push(a),o=o.slice(o.indexOf(n)+n.length),l+=n.length),j[r]?(n?f(e).empty=!1:f(e).unusedTokens.push(r),_e(r,n,e)):e._strict&&!n&&f(e).unusedTokens.push(r);f(e).charsLeftOver=u-l,o.length>0&&f(e).unusedInput.push(o),e._a[3]<=12&&!0===f(e).bigHour&&e._a[3]>0&&(f(e).bigHour=void 0),f(e).parsedDateParts=e._a.slice(0),f(e).meridiem=e._meridiem,e._a[3]=function(e,t,n){var s;return null==n?t:null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((s=e.isPM(n))&&t<12&&(t+=12),s||12!==t||(t=0),t):t}(e._locale,e._a[3],e._meridiem),ut(e),at(e)}else vt(e);else _t(e)}function Mt(e){var t=e._i,n=e._f;return e._locale=e._locale||rt(e._l),null===t||void 0===n&&""===t?_({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),w(t)?new v(at(t)):(u(t)?e._d=t:i(n)?function(e){var t,n,s,i,r;if(0===e._f.length)return f(e).invalidFormat=!0,void(e._d=new Date(NaN));for(i=0;i<e._f.length;i++)r=0,t=g({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],wt(t),m(t)&&(r+=f(t).charsLeftOver,r+=10*f(t).unusedTokens.length,f(t).score=r,(null==s||r<s)&&(s=r,n=t));h(e,n||t)}(e):n?wt(e):function(e){var t=e._i;a(t)?e._d=new Date(s.now()):u(t)?e._d=new Date(t.valueOf()):"string"==typeof t?function(e){var t=mt.exec(e._i);null===t?(_t(e),!1===e._isValid&&(delete e._isValid,vt(e),!1===e._isValid&&(delete e._isValid,s.createFromInputFallback(e)))):e._d=new Date(+t[1])}(e):i(t)?(e._a=l(t.slice(0),(function(e){return parseInt(e,10)})),ut(e)):r(t)?function(e){if(!e._d){var t=F(e._i);e._a=l([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],(function(e){return e&&parseInt(e,10)})),ut(e)}}(e):o(t)?e._d=new Date(t):s.createFromInputFallback(e)}(e),m(e)||(e._d=null),e))}function St(e,t,n,s,a){var o,u={};return!0!==n&&!1!==n||(s=n,n=void 0),(r(e)&&function(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}(e)||i(e)&&0===e.length)&&(e=void 0),u._isAMomentObject=!0,u._useUTC=u._isUTC=a,u._l=n,u._i=e,u._f=t,u._strict=s,(o=new v(at(Mt(u))))._nextDay&&(o.add(1,"d"),o._nextDay=void 0),o}function Dt(e,t,n,s){return St(e,t,n,s,!1)}s.createFromInputFallback=Y("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",(function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))})),s.ISO_8601=function(){},s.RFC_2822=function(){};var kt=Y("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=Dt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:_()})),Yt=Y("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=Dt.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:_()}));function Ot(e,t){var n,s;if(1===t.length&&i(t[0])&&(t=t[0]),!t.length)return Dt();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Tt=["year","quarter","month","week","day","hour","minute","second","millisecond"];function bt(e){var t=F(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.week||0,a=t.day||0,o=t.hour||0,u=t.minute||0,l=t.second||0,d=t.millisecond||0;this._isValid=function(e){for(var t in e)if(-1===pe.call(Tt,t)||null!=e[t]&&isNaN(e[t]))return!1;for(var n=!1,s=0;s<Tt.length;++s)if(e[Tt[s]]){if(n)return!1;parseFloat(e[Tt[s]])!==S(e[Tt[s]])&&(n=!0)}return!0}(t),this._milliseconds=+d+1e3*l+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+i+3*s+12*n,this._data={},this._locale=rt(),this._bubble()}function xt(e){return e instanceof bt}function Pt(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Wt(e,t){I(e,0,0,(function(){var e=this.utcOffset(),n="+";return e<0&&(e=-e,n="-"),n+N(~~(e/60),2)+t+N(~~e%60,2)}))}Wt("Z",":"),Wt("ZZ",""),le("Z",ae),le("ZZ",ae),fe(["Z","ZZ"],(function(e,t,n){n._useUTC=!0,n._tzm=Ht(ae,e)}));var Ct=/([\+\-]|\d\d)/gi;function Ht(e,t){var n=(t||"").match(e);if(null===n)return null;var s=((n[n.length-1]||[])+"").match(Ct)||["-",0,0],i=60*s[1]+S(s[2]);return 0===i?0:"+"===s[0]?i:-i}function Rt(e,t){var n,i;return t._isUTC?(n=t.clone(),i=(w(e)||u(e)?e.valueOf():Dt(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+i),s.updateOffset(n,!1),n):Dt(e).local()}function Ft(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Lt(){return!!this.isValid()&&this._isUTC&&0===this._offset}s.updateOffset=function(){};var Ut=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Nt=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Gt(e,t){var n,s,i,r,a,u,l=e,h=null;return xt(e)?l={ms:e._milliseconds,d:e._days,M:e._months}:o(e)?(l={},t?l[t]=e:l.milliseconds=e):(h=Ut.exec(e))?(n="-"===h[1]?-1:1,l={y:0,d:S(h[2])*n,h:S(h[3])*n,m:S(h[4])*n,s:S(h[5])*n,ms:S(Pt(1e3*h[6]))*n}):(h=Nt.exec(e))?(n="-"===h[1]?-1:(h[1],1),l={y:Vt(h[2],n),M:Vt(h[3],n),w:Vt(h[4],n),d:Vt(h[5],n),h:Vt(h[6],n),m:Vt(h[7],n),s:Vt(h[8],n)}):null==l?l={}:"object"==typeof l&&("from"in l||"to"in l)&&(r=Dt(l.from),a=Dt(l.to),i=r.isValid()&&a.isValid()?(a=Rt(a,r),r.isBefore(a)?u=Et(r,a):((u=Et(a,r)).milliseconds=-u.milliseconds,u.months=-u.months),u):{milliseconds:0,months:0},(l={}).ms=i.milliseconds,l.M=i.months),s=new bt(l),xt(e)&&d(e,"_locale")&&(s._locale=e._locale),s}function Vt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Et(e,t){var n={milliseconds:0,months:0};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function jt(e,t){return function(n,s){var i;return null===s||isNaN(+s)||(b(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),i=n,n=s,s=i),It(this,Gt(n="string"==typeof n?+n:n,s),e),this}}function It(e,t,n,i){var r=t._milliseconds,a=Pt(t._days),o=Pt(t._months);e.isValid()&&(i=null==i||i,o&&be(e,Me(e,"Month")+o*n),a&&Se(e,"Date",Me(e,"Date")+a*n),r&&e._d.setTime(e._d.valueOf()+r*n),i&&s.updateOffset(e,a||o))}Gt.fn=bt.prototype,Gt.invalid=function(){return Gt(NaN)};var At=jt(1,"add"),Zt=jt(-1,"subtract");function zt(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(n,"months");return-(n+(t-s<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(n+1,"months")-s)))||0}function $t(e){var t;return void 0===e?this._locale._abbr:(null!=(t=rt(e))&&(this._locale=t),this)}s.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",s.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Jt=Y("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(e){return void 0===e?this.localeData():this.locale(e)}));function qt(){return this._locale}function Bt(e,t){I(0,[e,e.length],0,t)}function Qt(e,t,n,s,i){var r;return null==e?Ue(this,s,i).year:(t>(r=Ne(e,s,i))&&(t=r),Xt.call(this,e,t,n,s,i))}function Xt(e,t,n,s,i){var r=Le(e,t,n,s,i),a=Re(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}I(0,["gg",2],0,(function(){return this.weekYear()%100})),I(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),Bt("gggg","weekYear"),Bt("ggggg","weekYear"),Bt("GGGG","isoWeekYear"),Bt("GGGGG","isoWeekYear"),H("weekYear","gg"),H("isoWeekYear","GG"),U("weekYear",1),U("isoWeekYear",1),le("G",ie),le("g",ie),le("GG",Q,$),le("gg",Q,$),le("GGGG",te,q),le("gggg",te,q),le("GGGGG",ne,B),le("ggggg",ne,B),me(["gggg","ggggg","GGGG","GGGGG"],(function(e,t,n,s){t[s.substr(0,2)]=S(e)})),me(["gg","GG"],(function(e,t,n,i){t[i]=s.parseTwoDigitYear(e)})),I("Q",0,"Qo","quarter"),H("quarter","Q"),U("quarter",7),le("Q",z),fe("Q",(function(e,t){t[1]=3*(S(e)-1)})),I("D",["DD",2],"Do","date"),H("date","D"),U("date",9),le("D",Q),le("DD",Q,$),le("Do",(function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient})),fe(["D","DD"],2),fe("Do",(function(e,t){t[2]=S(e.match(Q)[0])}));var Kt=we("Date",!0);I("DDD",["DDDD",3],"DDDo","dayOfYear"),H("dayOfYear","DDD"),U("dayOfYear",4),le("DDD",ee),le("DDDD",J),fe(["DDD","DDDD"],(function(e,t,n){n._dayOfYear=S(e)})),I("m",["mm",2],0,"minute"),H("minute","m"),U("minute",14),le("m",Q),le("mm",Q,$),fe(["m","mm"],4);var en=we("Minutes",!1);I("s",["ss",2],0,"second"),H("second","s"),U("second",15),le("s",Q),le("ss",Q,$),fe(["s","ss"],5);var tn,nn=we("Seconds",!1);for(I("S",0,0,(function(){return~~(this.millisecond()/100)})),I(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),I(0,["SSS",3],0,"millisecond"),I(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),I(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),I(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),I(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),I(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),I(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),H("millisecond","ms"),U("millisecond",16),le("S",ee,z),le("SS",ee,$),le("SSS",ee,J),tn="SSSS";tn.length<=9;tn+="S")le(tn,se);function sn(e,t){t[6]=S(1e3*("0."+e))}for(tn="S";tn.length<=9;tn+="S")fe(tn,sn);var rn=we("Milliseconds",!1);I("z",0,0,"zoneAbbr"),I("zz",0,0,"zoneName");var an=v.prototype;function on(e){return e}an.add=At,an.calendar=function(e,t){var n=e||Dt(),i=Rt(n,this).startOf("day"),r=s.calendarFormat(this,i)||"sameElse",a=t&&(x(t[r])?t[r].call(this,n):t[r]);return this.format(a||this.localeData().calendar(r,this,Dt(n)))},an.clone=function(){return new v(this)},an.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Rt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=R(t)){case"year":r=zt(this,s)/12;break;case"month":r=zt(this,s);break;case"quarter":r=zt(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:M(r)},an.endOf=function(e){return void 0===(e=R(e))||"millisecond"===e?this:("date"===e&&(e="day"),this.startOf(e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms"))},an.format=function(e){e||(e=this.isUtc()?s.defaultFormatUtc:s.defaultFormat);var t=A(this,e);return this.localeData().postformat(t)},an.from=function(e,t){return this.isValid()&&(w(e)&&e.isValid()||Dt(e).isValid())?Gt({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},an.fromNow=function(e){return this.from(Dt(),e)},an.to=function(e,t){return this.isValid()&&(w(e)&&e.isValid()||Dt(e).isValid())?Gt({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},an.toNow=function(e){return this.to(Dt(),e)},an.get=function(e){return x(this[e=R(e)])?this[e]():this},an.invalidAt=function(){return f(this).overflow},an.isAfter=function(e,t){var n=w(e)?e:Dt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=R(a(t)?"millisecond":t))?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},an.isBefore=function(e,t){var n=w(e)?e:Dt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=R(a(t)?"millisecond":t))?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},an.isBetween=function(e,t,n,s){return("("===(s=s||"()")[0]?this.isAfter(e,n):!this.isBefore(e,n))&&(")"===s[1]?this.isBefore(t,n):!this.isAfter(t,n))},an.isSame=function(e,t){var n,s=w(e)?e:Dt(e);return!(!this.isValid()||!s.isValid())&&("millisecond"===(t=R(t||"millisecond"))?this.valueOf()===s.valueOf():(n=s.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},an.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},an.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},an.isValid=function(){return m(this)},an.lang=Jt,an.locale=$t,an.localeData=qt,an.max=Yt,an.min=kt,an.parsingFlags=function(){return h({},f(this))},an.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t=[];for(var n in e)t.push({unit:n,priority:L[n]});return t.sort((function(e,t){return e.priority-t.priority})),t}(e=F(e)),s=0;s<n.length;s++)this[n[s].unit](e[n[s].unit]);else if(x(this[e=R(e)]))return this[e](t);return this},an.startOf=function(e){switch(e=R(e)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e&&this.weekday(0),"isoWeek"===e&&this.isoWeekday(1),"quarter"===e&&this.month(3*Math.floor(this.month()/3)),this},an.subtract=Zt,an.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},an.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},an.toDate=function(){return new Date(this.valueOf())},an.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||n.year()>9999?A(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):x(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",A(n,"Z")):A(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},an.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i=t+'[")]';return this.format(n+s+"-MM-DD[T]HH:mm:ss.SSS"+i)},an.toJSON=function(){return this.isValid()?this.toISOString():null},an.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},an.unix=function(){return Math.floor(this.valueOf()/1e3)},an.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},an.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},an.year=ve,an.isLeapYear=function(){return ge(this.year())},an.weekYear=function(e){return Qt.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},an.isoWeekYear=function(e){return Qt.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},an.quarter=an.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},an.month=xe,an.daysInMonth=function(){return De(this.year(),this.month())},an.week=an.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},an.isoWeek=an.isoWeeks=function(e){var t=Ue(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},an.weeksInYear=function(){var e=this.localeData()._week;return Ne(this.year(),e.dow,e.doy)},an.isoWeeksInYear=function(){return Ne(this.year(),1,4)},an.date=Kt,an.day=an.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=function(e,t){return"string"!=typeof e?e:isNaN(e)?"number"==typeof(e=t.weekdaysParse(e))?e:null:parseInt(e,10)}(e,this.localeData()),this.add(e-t,"d")):t},an.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},an.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=function(e,t){return"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7},an.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},an.hour=an.hours=Qe,an.minute=an.minutes=en,an.second=an.seconds=nn,an.millisecond=an.milliseconds=rn,an.utcOffset=function(e,t,n){var i,r=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null!=e){if("string"==typeof e){if(null===(e=Ht(ae,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(i=Ft(this)),this._offset=e,this._isUTC=!0,null!=i&&this.add(i,"m"),r!==e&&(!t||this._changeInProgress?It(this,Gt(e-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,s.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?r:Ft(this)},an.utc=function(e){return this.utcOffset(0,e)},an.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Ft(this),"m")),this},an.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=Ht(re,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},an.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?Dt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},an.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},an.isLocal=function(){return!!this.isValid()&&!this._isUTC},an.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},an.isUtc=Lt,an.isUTC=Lt,an.zoneAbbr=function(){return this._isUTC?"UTC":""},an.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},an.dates=Y("dates accessor is deprecated. Use date instead.",Kt),an.months=Y("months accessor is deprecated. Use month instead",xe),an.years=Y("years accessor is deprecated. Use year instead",ve),an.zone=Y("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",(function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()})),an.isDSTShifted=Y("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",(function(){if(!a(this._isDSTShifted))return this._isDSTShifted;var e={};if(g(e,this),(e=Mt(e))._a){var t=e._isUTC?c(e._a):Dt(e._a);this._isDSTShifted=this.isValid()&&D(e._a,t.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}));var un=W.prototype;function ln(e,t,n,s){var i=rt(),r=c().set(s,t);return i[n](r,e)}function dn(e,t,n){if(o(e)&&(t=e,e=void 0),e=e||"",null!=t)return ln(e,t,n,"month");var s,i=[];for(s=0;s<12;s++)i[s]=ln(e,s,n,"month");return i}function hn(e,t,n,s){"boolean"==typeof e?(o(t)&&(n=t,t=void 0),t=t||""):(n=t=e,e=!1,o(t)&&(n=t,t=void 0),t=t||"");var i,r=rt(),a=e?r._week.dow:0;if(null!=n)return ln(t,(n+a)%7,s,"day");var u=[];for(i=0;i<7;i++)u[i]=ln(t,(i+a)%7,s,"day");return u}un.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return x(s)?s.call(t,n):s},un.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,(function(e){return e.slice(1)})),this._longDateFormat[e])},un.invalidDate=function(){return this._invalidDate},un.ordinal=function(e){return this._ordinal.replace("%d",e)},un.preparse=on,un.postformat=on,un.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return x(i)?i(e,t,n,s):i.replace(/%d/i,e)},un.pastFuture=function(e,t){var n=this._relativeTime[e>0?"future":"past"];return x(n)?n(t):n.replace(/%s/i,t)},un.set=function(e){var t,n;for(n in e)x(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},un.months=function(e,t){return e?i(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||ke).test(t)?"format":"standalone"][e.month()]:i(this._months)?this._months:this._months.standalone},un.monthsShort=function(e,t){return e?i(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[ke.test(t)?"format":"standalone"][e.month()]:i(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},un.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return Te.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=c([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},un.monthsRegex=function(e){return this._monthsParseExact?(d(this,"_monthsRegex")||Ce.call(this),e?this._monthsStrictRegex:this._monthsRegex):(d(this,"_monthsRegex")||(this._monthsRegex=We),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},un.monthsShortRegex=function(e){return this._monthsParseExact?(d(this,"_monthsRegex")||Ce.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(d(this,"_monthsShortRegex")||(this._monthsShortRegex=Pe),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},un.week=function(e){return Ue(e,this._week.dow,this._week.doy).week},un.firstDayOfYear=function(){return this._week.doy},un.firstDayOfWeek=function(){return this._week.dow},un.weekdays=function(e,t){return e?i(this._weekdays)?this._weekdays[e.day()]:this._weekdays[this._weekdays.isFormat.test(t)?"format":"standalone"][e.day()]:i(this._weekdays)?this._weekdays:this._weekdays.standalone},un.weekdaysMin=function(e){return e?this._weekdaysMin[e.day()]:this._weekdaysMin},un.weekdaysShort=function(e){return e?this._weekdaysShort[e.day()]:this._weekdaysShort},un.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return je.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=c([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},un.weekdaysRegex=function(e){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ze.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(d(this,"_weekdaysRegex")||(this._weekdaysRegex=Ie),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},un.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ze.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(d(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Ae),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},un.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||ze.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(d(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Ze),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},un.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},un.meridiem=function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},st("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===S(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),s.lang=Y("moment.lang is deprecated. Use moment.locale instead.",st),s.langData=Y("moment.langData is deprecated. Use moment.localeData instead.",rt);var cn=Math.abs;function fn(e,t,n,s){var i=Gt(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function mn(e){return e<0?Math.floor(e):Math.ceil(e)}function _n(e){return 4800*e/146097}function yn(e){return 146097*e/4800}function gn(e){return function(){return this.as(e)}}var pn=gn("ms"),vn=gn("s"),wn=gn("m"),Mn=gn("h"),Sn=gn("d"),Dn=gn("w"),kn=gn("M"),Yn=gn("y");function On(e){return function(){return this.isValid()?this._data[e]:NaN}}var Tn=On("milliseconds"),bn=On("seconds"),xn=On("minutes"),Pn=On("hours"),Wn=On("days"),Cn=On("months"),Hn=On("years"),Rn=Math.round,Fn={ss:44,s:45,m:45,h:22,d:26,M:11};function Ln(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}var Un=Math.abs;function Nn(e){return(e>0)-(e<0)||+e}function Gn(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n=Un(this._milliseconds)/1e3,s=Un(this._days),i=Un(this._months);e=M(n/60),t=M(e/60),n%=60,e%=60;var r=M(i/12),a=i%=12,o=s,u=t,l=e,d=n?n.toFixed(3).replace(/\.?0+$/,""):"",h=this.asSeconds();if(!h)return"P0D";var c=h<0?"-":"",f=Nn(this._months)!==Nn(h)?"-":"",m=Nn(this._days)!==Nn(h)?"-":"",_=Nn(this._milliseconds)!==Nn(h)?"-":"";return c+"P"+(r?f+r+"Y":"")+(a?f+a+"M":"")+(o?m+o+"D":"")+(u||l||d?"T":"")+(u?_+u+"H":"")+(l?_+l+"M":"")+(d?_+d+"S":"")}var Vn=bt.prototype;return Vn.isValid=function(){return this._isValid},Vn.abs=function(){var e=this._data;return this._milliseconds=cn(this._milliseconds),this._days=cn(this._days),this._months=cn(this._months),e.milliseconds=cn(e.milliseconds),e.seconds=cn(e.seconds),e.minutes=cn(e.minutes),e.hours=cn(e.hours),e.months=cn(e.months),e.years=cn(e.years),this},Vn.add=function(e,t){return fn(this,e,t,1)},Vn.subtract=function(e,t){return fn(this,e,t,-1)},Vn.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=R(e))||"year"===e)return t=this._days+s/864e5,n=this._months+_n(t),"month"===e?n:n/12;switch(t=this._days+Math.round(yn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},Vn.asMilliseconds=pn,Vn.asSeconds=vn,Vn.asMinutes=wn,Vn.asHours=Mn,Vn.asDays=Sn,Vn.asWeeks=Dn,Vn.asMonths=kn,Vn.asYears=Yn,Vn.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*S(this._months/12):NaN},Vn._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return r>=0&&a>=0&&o>=0||r<=0&&a<=0&&o<=0||(r+=864e5*mn(yn(o)+a),a=0,o=0),u.milliseconds=r%1e3,e=M(r/1e3),u.seconds=e%60,t=M(e/60),u.minutes=t%60,n=M(t/60),u.hours=n%24,a+=M(n/24),i=M(_n(a)),o+=i,a-=mn(yn(i)),s=M(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},Vn.clone=function(){return Gt(this)},Vn.get=function(e){return e=R(e),this.isValid()?this[e+"s"]():NaN},Vn.milliseconds=Tn,Vn.seconds=bn,Vn.minutes=xn,Vn.hours=Pn,Vn.days=Wn,Vn.weeks=function(){return M(this.days()/7)},Vn.months=Cn,Vn.years=Hn,Vn.humanize=function(e){if(!this.isValid())return this.localeData().invalidDate();var t=this.localeData(),n=function(e,t,n){var s=Gt(e).abs(),i=Rn(s.as("s")),r=Rn(s.as("m")),a=Rn(s.as("h")),o=Rn(s.as("d")),u=Rn(s.as("M")),l=Rn(s.as("y")),d=i<=Fn.ss&&["s",i]||i<Fn.s&&["ss",i]||r<=1&&["m"]||r<Fn.m&&["mm",r]||a<=1&&["h"]||a<Fn.h&&["hh",a]||o<=1&&["d"]||o<Fn.d&&["dd",o]||u<=1&&["M"]||u<Fn.M&&["MM",u]||l<=1&&["y"]||["yy",l];return d[2]=t,d[3]=+e>0,d[4]=n,Ln.apply(null,d)}(this,!e,t);return e&&(n=t.pastFuture(+this,n)),t.postformat(n)},Vn.toISOString=Gn,Vn.toString=Gn,Vn.toJSON=Gn,Vn.locale=$t,Vn.localeData=qt,Vn.toIsoString=Y("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Gn),Vn.lang=Jt,I("X",0,0,"unix"),I("x",0,0,"valueOf"),le("x",ie),le("X",/[+-]?\d+(\.\d{1,3})?/),fe("X",(function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))})),fe("x",(function(e,t,n){n._d=new Date(S(e))})),s.version="2.22.2",t=Dt,s.fn=an,s.min=function(){var e=[].slice.call(arguments,0);return Ot("isBefore",e)},s.max=function(){var e=[].slice.call(arguments,0);return Ot("isAfter",e)},s.now=function(){return Date.now?Date.now():+new Date},s.utc=c,s.unix=function(e){return Dt(1e3*e)},s.months=function(e,t){return dn(e,t,"months")},s.isDate=u,s.locale=st,s.invalid=_,s.duration=Gt,s.isMoment=w,s.weekdays=function(e,t,n){return hn(e,t,n,"weekdays")},s.parseZone=function(){return Dt.apply(null,arguments).parseZone()},s.localeData=rt,s.isDuration=xt,s.monthsShort=function(e,t){return dn(e,t,"monthsShort")},s.weekdaysMin=function(e,t,n){return hn(e,t,n,"weekdaysMin")},s.defineLocale=it,s.updateLocale=function(e,t){if(null!=t){var n,s,i=Xe;null!=(s=nt(e))&&(i=s._config),t=P(i,t),(n=new W(t)).parentLocale=Ke[e],Ke[e]=n,st(e)}else null!=Ke[e]&&(null!=Ke[e].parentLocale?Ke[e]=Ke[e].parentLocale:null!=Ke[e]&&delete Ke[e]);return Ke[e]},s.locales=function(){return O(Ke)},s.weekdaysShort=function(e,t,n){return hn(e,t,n,"weekdaysShort")},s.normalizeUnits=R,s.relativeTimeRounding=function(e){return void 0===e?Rn:"function"==typeof e&&(Rn=e,!0)},s.relativeTimeThreshold=function(e,t){return void 0!==Fn[e]&&(void 0===t?Fn[e]:(Fn[e]=t,"s"===e&&(Fn.ss=t-1),!0))},s.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},s.prototype=an,s.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"YYYY-[W]WW",MONTH:"YYYY-MM"},s}()}).call(this,n(1)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},,function(e,t,n){e.exports=n(0)}]);
//# sourceMappingURL=http://127.0.0.1:3001/dist/js/vendors.js.map

================================================
FILE: wagalytics/static/wagalytics/wagalytics.bundle.js
================================================
!function(e){var t={};function n(i){if(t[i])return t[i].exports;var s=t[i]={i:i,l:!1,exports:{}};return e[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(i,s,function(t){return e[t]}.bind(null,s));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){(function(e){e.exports=function(){"use strict";var t,n;function i(){return t.apply(null,arguments)}function s(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function r(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function a(e){return void 0===e}function o(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function u(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function l(e,t){var n,i=[];for(n=0;n<e.length;++n)i.push(t(e[n],n));return i}function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function h(e,t){for(var n in t)d(t,n)&&(e[n]=t[n]);return d(t,"toString")&&(e.toString=t.toString),d(t,"valueOf")&&(e.valueOf=t.valueOf),e}function c(e,t,n,i){return St(e,t,n,i,!0).utc()}function f(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function m(e){if(null==e._isValid){var t=f(e),i=n.call(t.parsedDateParts,(function(e){return null!=e})),s=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&i);if(e._strict&&(s=s&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return s;e._isValid=s}return e._isValid}function _(e){var t=c(NaN);return null!=e?h(f(t),e):f(t).userInvalidated=!0,t}n=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,i=0;i<n;i++)if(i in t&&e.call(this,t[i],i,t))return!0;return!1};var y=i.momentProperties=[];function g(e,t){var n,i,s;if(a(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),a(t._i)||(e._i=t._i),a(t._f)||(e._f=t._f),a(t._l)||(e._l=t._l),a(t._strict)||(e._strict=t._strict),a(t._tzm)||(e._tzm=t._tzm),a(t._isUTC)||(e._isUTC=t._isUTC),a(t._offset)||(e._offset=t._offset),a(t._pf)||(e._pf=f(t)),a(t._locale)||(e._locale=t._locale),y.length>0)for(n=0;n<y.length;n++)a(s=t[i=y[n]])||(e[i]=s);return e}var p=!1;function v(e){g(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===p&&(p=!0,i.updateOffset(this),p=!1)}function w(e){return e instanceof v||null!=e&&null!=e._isAMomentObject}function M(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function S(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=M(t)),n}function k(e,t,n){var i,s=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(i=0;i<s;i++)(n&&e[i]!==t[i]||!n&&S(e[i])!==S(t[i]))&&a++;return a+r}function D(e){!1===i.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function Y(e,t){var n=!0;return h((function(){if(null!=i.deprecationHandler&&i.deprecationHandler(null,e),n){for(var s,r=[],a=0;a<arguments.length;a++){if(s="","object"==typeof arguments[a]){for(var o in s+="\n["+a+"] ",arguments[0])s+=o+": "+arguments[0][o]+", ";s=s.slice(0,-2)}else s=arguments[a];r.push(s)}D(e+"\nArguments: "+Array.prototype.slice.call(r).join("")+"\n"+(new Error).stack),n=!1}return t.apply(this,arguments)}),t)}var b,O={};function T(e,t){null!=i.deprecationHandler&&i.deprecationHandler(e,t),O[e]||(D(t),O[e]=!0)}function x(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function P(e,t){var n,i=h({},e);for(n in t)d(t,n)&&(r(e[n])&&r(t[n])?(i[n]={},h(i[n],e[n]),h(i[n],t[n])):null!=t[n]?i[n]=t[n]:delete i[n]);for(n in e)d(e,n)&&!d(t,n)&&r(e[n])&&(i[n]=h({},i[n]));return i}function C(e){null!=e&&this.set(e)}i.suppressDeprecationWarnings=!1,i.deprecationHandler=null,b=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)d(e,t)&&n.push(t);return n};var W={};function L(e,t){var n=e.toLowerCase();W[n]=W[n+"s"]=W[t]=e}function H(e){return"string"==typeof e?W[e]||W[e.toLowerCase()]:void 0}function R(e){var t,n,i={};for(n in e)d(e,n)&&(t=H(n))&&(i[t]=e[n]);return i}var F={};function E(e,t){F[e]=t}function N(e,t,n){var i=""+Math.abs(e),s=t-i.length;return(e>=0?n?"+":"":"-")+Math.pow(10,Math.max(0,s)).toString().substr(1)+i}var U=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,I=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,V={},G={};function j(e,t,n,i){var s=i;"string"==typeof i&&(s=function(){return this[i]()}),e&&(G[e]=s),t&&(G[t[0]]=function(){return N(s.apply(this,arguments),t[1],t[2])}),n&&(G[n]=function(){return this.localeData().ordinal(s.apply(this,arguments),e)})}function A(e,t){return e.isValid()?(t=z(t,e.localeData()),V[t]=V[t]||function(e){var t,n,i,s=e.match(U);for(t=0,n=s.length;t<n;t++)G[s[t]]?s[t]=G[s[t]]:s[t]=(i=s[t]).match(/\[[\s\S]/)?i.replace(/^\[|\]$/g,""):i.replace(/\\/g,"");return function(t){var i,r="";for(i=0;i<n;i++)r+=x(s[i])?s[i].call(t,e):s[i];return r}}(t),V[t](e)):e.localeData().invalidDate()}function z(e,t){var n=5;function i(e){return t.longDateFormat(e)||e}for(I.lastIndex=0;n>=0&&I.test(e);)e=e.replace(I,i),I.lastIndex=0,n-=1;return e}var Z=/\d/,$=/\d\d/,B=/\d{3}/,J=/\d{4}/,q=/[+-]?\d{6}/,Q=/\d\d?/,X=/\d\d\d\d?/,K=/\d\d\d\d\d\d?/,ee=/\d{1,3}/,te=/\d{1,4}/,ne=/[+-]?\d{1,6}/,ie=/\d+/,se=/[+-]?\d+/,re=/Z|[+-]\d\d:?\d\d/gi,ae=/Z|[+-]\d\d(?::?\d\d)?/gi,oe=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,ue={};function le(e,t,n){ue[e]=x(t)?t:function(e,i){return e&&n?n:t}}function de(e,t){return d(ue,e)?ue[e](t._strict,t._locale):new RegExp(he(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(e,t,n,i,s){return t||n||i||s}))))}function he(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var ce={};function fe(e,t){var n,i=t;for("string"==typeof e&&(e=[e]),o(t)&&(i=function(e,n){n[t]=S(e)}),n=0;n<e.length;n++)ce[e[n]]=i}function me(e,t){fe(e,(function(e,n,i,s){i._w=i._w||{},t(e,i._w,i,s)}))}function _e(e,t,n){null!=t&&d(ce,e)&&ce[e](t,n._a,n,e)}function ye(e){return ge(e)?366:365}function ge(e){return e%4==0&&e%100!=0||e%400==0}j("Y",0,0,(function(){var e=this.year();return e<=9999?""+e:"+"+e})),j(0,["YY",2],0,(function(){return this.year()%100})),j(0,["YYYY",4],0,"year"),j(0,["YYYYY",5],0,"year"),j(0,["YYYYYY",6,!0],0,"year"),L("year","y"),E("year",1),le("Y",se),le("YY",Q,$),le("YYYY",te,J),le("YYYYY",ne,q),le("YYYYYY",ne,q),fe(["YYYYY","YYYYYY"],0),fe("YYYY",(function(e,t){t[0]=2===e.length?i.parseTwoDigitYear(e):S(e)})),fe("YY",(function(e,t){t[0]=i.parseTwoDigitYear(e)})),fe("Y",(function(e,t){t[0]=parseInt(e,10)})),i.parseTwoDigitYear=function(e){return S(e)+(S(e)>68?1900:2e3)};var pe,ve=we("FullYear",!0);function we(e,t){return function(n){return null!=n?(Se(this,e,n),i.updateOffset(this,t),this):Me(this,e)}}function Me(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function Se(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&ge(e.year())&&1===e.month()&&29===e.date()?e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),ke(n,e.month())):e._d["set"+(e._isUTC?"UTC":"")+t](n))}function ke(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,i=(t%(n=12)+n)%n;return e+=(t-i)/12,1===i?ge(e)?29:28:31-i%7%2}pe=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},j("M",["MM",2],"Mo",(function(){return this.month()+1})),j("MMM",0,0,(function(e){return this.localeData().monthsShort(this,e)})),j("MMMM",0,0,(function(e){return this.localeData().months(this,e)})),L("month","M"),E("month",8),le("M",Q),le("MM",Q,$),le("MMM",(function(e,t){return t.monthsShortRegex(e)})),le("MMMM",(function(e,t){return t.monthsRegex(e)})),fe(["M","MM"],(function(e,t){t[1]=S(e)-1})),fe(["MMM","MMMM"],(function(e,t,n,i){var s=n._locale.monthsParse(e,i,n._strict);null!=s?t[1]=s:f(n).invalidMonth=e}));var De=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,Ye="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),be="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function Oe(e,t,n){var i,s,r,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],i=0;i<12;++i)r=c([2e3,i]),this._shortMonthsParse[i]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[i]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(s=pe.call(this._shortMonthsParse,a))?s:null:-1!==(s=pe.call(this._longMonthsParse,a))?s:null:"MMM"===t?-1!==(s=pe.call(this._shortMonthsParse,a))||-1!==(s=pe.call(this._longMonthsParse,a))?s:null:-1!==(s=pe.call(this._longMonthsParse,a))||-1!==(s=pe.call(this._shortMonthsParse,a))?s:null}function Te(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=S(t);else if(!o(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),ke(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function xe(e){return null!=e?(Te(this,e),i.updateOffset(this,!0),this):Me(this,"Month")}var Pe=oe,Ce=oe;function We(){function e(e,t){return t.length-e.length}var t,n,i=[],s=[],r=[];for(t=0;t<12;t++)n=c([2e3,t]),i.push(this.monthsShort(n,"")),s.push(this.months(n,"")),r.push(this.months(n,"")),r.push(this.monthsShort(n,""));for(i.sort(e),s.sort(e),r.sort(e),t=0;t<12;t++)i[t]=he(i[t]),s[t]=he(s[t]);for(t=0;t<24;t++)r[t]=he(r[t]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+i.join("|")+")","i")}function Le(e,t,n,i,s,r,a){var o=new Date(e,t,n,i,s,r,a);return e<100&&e>=0&&isFinite(o.getFullYear())&&o.setFullYear(e),o}function He(e){var t=new Date(Date.UTC.apply(null,arguments));return e<100&&e>=0&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function Re(e,t,n){var i=7+t-n;return-(7+He(e,0,i).getUTCDay()-t)%7+i-1}function Fe(e,t,n,i,s){var r,a,o=1+7*(t-1)+(7+n-i)%7+Re(e,i,s);return o<=0?a=ye(r=e-1)+o:o>ye(e)?(r=e+1,a=o-ye(e)):(r=e,a=o),{year:r,dayOfYear:a}}function Ee(e,t,n){var i,s,r=Re(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?i=a+Ne(s=e.year()-1,t,n):a>Ne(e.year(),t,n)?(i=a-Ne(e.year(),t,n),s=e.year()+1):(s=e.year(),i=a),{week:i,year:s}}function Ne(e,t,n){var i=Re(e,t,n),s=Re(e+1,t,n);return(ye(e)-i+s)/7}j("w",["ww",2],"wo","week"),j("W",["WW",2],"Wo","isoWeek"),L("week","w"),L("isoWeek","W"),E("week",5),E("isoWeek",5),le("w",Q),le("ww",Q,$),le("W",Q),le("WW",Q,$),me(["w","ww","W","WW"],(function(e,t,n,i){t[i.substr(0,1)]=S(e)})),j("d",0,"do","day"),j("dd",0,0,(function(e){return this.localeData().weekdaysMin(this,e)})),j("ddd",0,0,(function(e){return this.localeData().weekdaysShort(this,e)})),j("dddd",0,0,(function(e){return this.localeData().weekdays(this,e)})),j("e",0,0,"weekday"),j("E",0,0,"isoWeekday"),L("day","d"),L("weekday","e"),L("isoWeekday","E"),E("day",11),E("weekday",11),E("isoWeekday",11),le("d",Q),le("e",Q),le("E",Q),le("dd",(function(e,t){return t.weekdaysMinRegex(e)})),le("ddd",(function(e,t){return t.weekdaysShortRegex(e)})),le("dddd",(function(e,t){return t.weekdaysRegex(e)})),me(["dd","ddd","dddd"],(function(e,t,n,i){var s=n._locale.weekdaysParse(e,i,n._strict);null!=s?t.d=s:f(n).invalidWeekday=e})),me(["d","e","E"],(function(e,t,n,i){t[i]=S(e)}));var Ue="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Ie="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Ve="Su_Mo_Tu_We_Th_Fr_Sa".split("_");function Ge(e,t,n){var i,s,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;i<7;++i)r=c([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(s=pe.call(this._weekdaysParse,a))?s:null:"ddd"===t?-1!==(s=pe.call(this._shortWeekdaysParse,a))?s:null:-1!==(s=pe.call(this._minWeekdaysParse,a))?s:null:"dddd"===t?-1!==(s=pe.call(this._weekdaysParse,a))||-1!==(s=pe.call(this._shortWeekdaysParse,a))||-1!==(s=pe.call(this._minWeekdaysParse,a))?s:null:"ddd"===t?-1!==(s=pe.call(this._shortWeekdaysParse,a))||-1!==(s=pe.call(this._weekdaysParse,a))||-1!==(s=pe.call(this._minWeekdaysParse,a))?s:null:-1!==(s=pe.call(this._minWeekdaysParse,a))||-1!==(s=pe.call(this._weekdaysParse,a))||-1!==(s=pe.call(this._shortWeekdaysParse,a))?s:null}var je=oe,Ae=oe,ze=oe;function Ze(){function e(e,t){return t.length-e.length}var t,n,i,s,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=c([2e3,1]).day(t),i=this.weekdaysMin(n,""),s=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(i),o.push(s),u.push(r),l.push(i),l.push(s),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=he(o[t]),u[t]=he(u[t]),l[t]=he(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function $e(){return this.hours()%12||12}function Be(e,t){j(e,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)}))}function Je(e,t){return t._meridiemParse}j("H",["HH",2],0,"hour"),j("h",["hh",2],0,$e),j("k",["kk",2],0,(function(){return this.hours()||24})),j("hmm",0,0,(function(){return""+$e.apply(this)+N(this.minutes(),2)})),j("hmmss",0,0,(function(){return""+$e.apply(this)+N(this.minutes(),2)+N(this.seconds(),2)})),j("Hmm",0,0,(function(){return""+this.hours()+N(this.minutes(),2)})),j("Hmmss",0,0,(function(){return""+this.hours()+N(this.minutes(),2)+N(this.seconds(),2)})),Be("a",!0),Be("A",!1),L("hour","h"),E("hour",13),le("a",Je),le("A",Je),le("H",Q),le("h",Q),le("k",Q),le("HH",Q,$),le("hh",Q,$),le("kk",Q,$),le("hmm",X),le("hmmss",K),le("Hmm",X),le("Hmmss",K),fe(["H","HH"],3),fe(["k","kk"],(function(e,t,n){var i=S(e);t[3]=24===i?0:i})),fe(["a","A"],(function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e})),fe(["h","hh"],(function(e,t,n){t[3]=S(e),f(n).bigHour=!0})),fe("hmm",(function(e,t,n){var i=e.length-2;t[3]=S(e.substr(0,i)),t[4]=S(e.substr(i)),f(n).bigHour=!0})),fe("hmmss",(function(e,t,n){var i=e.length-4,s=e.length-2;t[3]=S(e.substr(0,i)),t[4]=S(e.substr(i,2)),t[5]=S(e.substr(s)),f(n).bigHour=!0})),fe("Hmm",(function(e,t,n){var i=e.length-2;t[3]=S(e.substr(0,i)),t[4]=S(e.substr(i))})),fe("Hmmss",(function(e,t,n){var i=e.length-4,s=e.length-2;t[3]=S(e.substr(0,i)),t[4]=S(e.substr(i,2)),t[5]=S(e.substr(s))}));var qe,Qe=we("Hours",!0),Xe={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Ye,monthsShort:be,week:{dow:0,doy:6},weekdays:Ue,weekdaysMin:Ve,weekdaysShort:Ie,meridiemParse:/[ap]\.?m?\.?/i},Ke={},et={};function tt(e){return e?e.toLowerCase().replace("_","-"):e}function nt(t){var n=null;if(!Ke[t]&&void 0!==e&&e&&e.exports)try{n=qe._abbr,!function(){var e=new Error("Cannot find module 'undefined'");throw e.code="MODULE_NOT_FOUND",e}(),it(n)}catch(e){}return Ke[t]}function it(e,t){var n;return e&&((n=a(t)?rt(e):st(e,t))?qe=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),qe._abbr}function st(e,t){if(null!==t){var n,i=Xe;if(t.abbr=e,null!=Ke[e])T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),i=Ke[e]._config;else if(null!=t.parentLocale)if(null!=Ke[t.parentLocale])i=Ke[t.parentLocale]._config;else{if(null==(n=nt(t.parentLocale)))return et[t.parentLocale]||(et[t.parentLocale]=[]),et[t.parentLocale].push({name:e,config:t}),null;i=n._config}return Ke[e]=new C(P(i,t)),et[e]&&et[e].forEach((function(e){st(e.name,e.config)})),it(e),Ke[e]}return delete Ke[e],null}function rt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return qe;if(!s(e)){if(t=nt(e))return t;e=[e]}return function(e){for(var t,n,i,s,r=0;r<e.length;){for(t=(s=tt(e[r]).split("-")).length,n=(n=tt(e[r+1]))?n.split("-"):null;t>0;){if(i=nt(s.slice(0,t).join("-")))return i;if(n&&n.length>=t&&k(s,n,!0)>=t-1)break;t--}r++}return qe}(e)}function at(e){var t,n=e._a;return n&&-2===f(e).overflow&&(t=n[1]<0||n[1]>11?1:n[2]<1||n[2]>ke(n[0],n[1])?2:n[3]<0||n[3]>24||24===n[3]&&(0!==n[4]||0!==n[5]||0!==n[6])?3:n[4]<0||n[4]>59?4:n[5]<0||n[5]>59?5:n[6]<0||n[6]>999?6:-1,f(e)._overflowDayOfYear&&(t<0||t>2)&&(t=2),f(e)._overflowWeeks&&-1===t&&(t=7),f(e)._overflowWeekday&&-1===t&&(t=8),f(e).overflow=t),e}function ot(e,t,n){return null!=e?e:null!=t?t:n}function ut(e){var t,n,s,r,a,o=[];if(!e._d){for(s=function(e){var t=new Date(i.now());return e._useUTC?[t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()]:[t.getFullYear(),t.getMonth(),t.getDate()]}(e),e._w&&null==e._a[2]&&null==e._a[1]&&function(e){var t,n,i,s,r,a,o,u;if(null!=(t=e._w).GG||null!=t.W||null!=t.E)r=1,a=4,n=ot(t.GG,e._a[0],Ee(kt(),1,4).year),i=ot(t.W,1),((s=ot(t.E,1))<1||s>7)&&(u=!0);else{r=e._locale._week.dow,a=e._locale._week.doy;var l=Ee(kt(),r,a);n=ot(t.gg,e._a[0],l.year),i=ot(t.w,l.week),null!=t.d?((s=t.d)<0||s>6)&&(u=!0):null!=t.e?(s=t.e+r,(t.e<0||t.e>6)&&(u=!0)):s=r}i<1||i>Ne(n,r,a)?f(e)._overflowWeeks=!0:null!=u?f(e)._overflowWeekday=!0:(o=Fe(n,i,s,r,a),e._a[0]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(a=ot(e._a[0],s[0]),(e._dayOfYear>ye(a)||0===e._dayOfYear)&&(f(e)._overflowDayOfYear=!0),n=He(a,0,e._dayOfYear),e._a[1]=n.getUTCMonth(),e._a[2]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=o[t]=s[t];for(;t<7;t++)e._a[t]=o[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[3]&&0===e._a[4]&&0===e._a[5]&&0===e._a[6]&&(e._nextDay=!0,e._a[3]=0),e._d=(e._useUTC?He:Le).apply(null,o),r=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[3]=24),e._w&&void 0!==e._w.d&&e._w.d!==r&&(f(e).weekdayMismatch=!0)}}var lt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,dt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ht=/Z|[+-]\d\d(?::?\d\d)?/,ct=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],ft=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],mt=/^\/?Date\((\-?\d+)/i;function _t(e){var t,n,i,s,r,a,o=e._i,u=lt.exec(o)||dt.exec(o);if(u){for(f(e).iso=!0,t=0,n=ct.length;t<n;t++)if(ct[t][1].exec(u[1])){s=ct[t][0],i=!1!==ct[t][2];break}if(null==s)return void(e._isValid=!1);if(u[3]){for(t=0,n=ft.length;t<n;t++)if(ft[t][1].exec(u[3])){r=(u[2]||" ")+ft[t][0];break}if(null==r)return void(e._isValid=!1)}if(!i&&null!=r)return void(e._isValid=!1);if(u[4]){if(!ht.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=s+(r||"")+(a||""),wt(e)}else e._isValid=!1}var yt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;function gt(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}var pt={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function vt(e){var t,n,i,s,r,a,o,u=yt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(u){var l=(t=u[4],n=u[3],i=u[2],s=u[5],r=u[6],a=u[7],o=[gt(t),be.indexOf(n),parseInt(i,10),parseInt(s,10),parseInt(r,10)],a&&o.push(parseInt(a,10)),o);if(!function(e,t,n){return!e||Ie.indexOf(e)===new Date(t[0],t[1],t[2]).getDay()||(f(n).weekdayMismatch=!0,n._isValid=!1,!1)}(u[1],l,e))return;e._a=l,e._tzm=function(e,t,n){if(e)return pt[e];if(t)return 0;var i=parseInt(n,10),s=i%100;return(i-s)/100*60+s}(u[8],u[9],u[10]),e._d=He.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),f(e).rfc2822=!0}else e._isValid=!1}function wt(e){if(e._f!==i.ISO_8601)if(e._f!==i.RFC_2822){e._a=[],f(e).empty=!0;var t,n,s,r,a,o=""+e._i,u=o.length,l=0;for(s=z(e._f,e._locale).match(U)||[],t=0;t<s.length;t++)r=s[t],(n=(o.match(de(r,e))||[])[0])&&((a=o.substr(0,o.indexOf(n))).length>0&&f(e).unusedInput.push(a),o=o.slice(o.indexOf(n)+n.length),l+=n.length),G[r]?(n?f(e).empty=!1:f(e).unusedTokens.push(r),_e(r,n,e)):e._strict&&!n&&f(e).unusedTokens.push(r);f(e).charsLeftOver=u-l,o.length>0&&f(e).unusedInput.push(o),e._a[3]<=12&&!0===f(e).bigHour&&e._a[3]>0&&(f(e).bigHour=void 0),f(e).parsedDateParts=e._a.slice(0),f(e).meridiem=e._meridiem,e._a[3]=function(e,t,n){var i;return null==n?t:null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((i=e.isPM(n))&&t<12&&(t+=12),i||12!==t||(t=0),t):t}(e._locale,e._a[3],e._meridiem),ut(e),at(e)}else vt(e);else _t(e)}function Mt(e){var t=e._i,n=e._f;return e._locale=e._locale||rt(e._l),null===t||void 0===n&&""===t?_({nullInput:!0}):("string"==typeof t&&(e._i=t=e._locale.preparse(t)),w(t)?new v(at(t)):(u(t)?e._d=t:s(n)?function(e){var t,n,i,s,r;if(0===e._f.length)return f(e).invalidFormat=!0,void(e._d=new Date(NaN));for(s=0;s<e._f.length;s++)r=0,t=g({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[s],wt(t),m(t)&&(r+=f(t).charsLeftOver,r+=10*f(t).unusedTokens.length,f(t).score=r,(null==i||r<i)&&(i=r,n=t));h(e,n||t)}(e):n?wt(e):function(e){var t=e._i;a(t)?e._d=new Date(i.now()):u(t)?e._d=new Date(t.valueOf()):"string"==typeof t?function(e){var t=mt.exec(e._i);null===t?(_t(e),!1===e._isValid&&(delete e._isValid,vt(e),!1===e._isValid&&(delete e._isValid,i.createFromInputFallback(e)))):e._d=new Date(+t[1])}(e):s(t)?(e._a=l(t.slice(0),(function(e){return parseInt(e,10)})),ut(e)):r(t)?function(e){if(!e._d){var t=R(e._i);e._a=l([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],(function(e){return e&&parseInt(e,10)})),ut(e)}}(e):o(t)?e._d=new Date(t):i.createFromInputFallback(e)}(e),m(e)||(e._d=null),e))}function St(e,t,n,i,a){var o,u={};return!0!==n&&!1!==n||(i=n,n=void 0),(r(e)&&function(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}(e)||s(e)&&0===e.length)&&(e=void 0),u._isAMomentObject=!0,u._useUTC=u._isUTC=a,u._l=n,u._i=e,u._f=t,u._strict=i,(o=new v(at(Mt(u))))._nextDay&&(o.add(1,"d"),o._nextDay=void 0),o}function kt(e,t,n,i){return St(e,t,n,i,!1)}i.createFromInputFallback=Y("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",(function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))})),i.ISO_8601=function(){},i.RFC_2822=function(){};var Dt=Y("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=kt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:_()})),Yt=Y("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",(function(){var e=kt.apply(null,arguments);return this.isValid()&&e.isValid()?e>this?this:e:_()}));function bt(e,t){var n,i;if(1===t.length&&s(t[0])&&(t=t[0]),!t.length)return kt();for(n=t[0],i=1;i<t.length;++i)t[i].isValid()&&!t[i][e](n)||(n=t[i]);return n}var Ot=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Tt(e){var t=R(e),n=t.year||0,i=t.quarter||0,s=t.month||0,r=t.week||0,a=t.day||0,o=t.hour||0,u=t.minute||0,l=t.second||0,d=t.millisecond||0;this._isValid=function(e){for(var t in e)if(-1===pe.call(Ot,t)||null!=e[t]&&isNaN(e[t]))return!1;for(var n=!1,i=0;i<Ot.length;++i)if(e[Ot[i]]){if(n)return!1;parseFloat(e[Ot[i]])!==S(e[Ot[i]])&&(n=!0)}return!0}(t),this._milliseconds=+d+1e3*l+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+s+3*i+12*n,this._data={},this._locale=rt(),this._bubble()}function xt(e){return e instanceof Tt}function Pt(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ct(e,t){j(e,0,0,(function(){var e=this.utcOffset(),n="+";return e<0&&(e=-e,n="-"),n+N(~~(e/60),2)+t+N(~~e%60,2)}))}Ct("Z",":"),Ct("ZZ",""),le("Z",ae),le("ZZ",ae),fe(["Z","ZZ"],(function(e,t,n){n._useUTC=!0,n._tzm=Lt(ae,e)}));var Wt=/([\+\-]|\d\d)/gi;function Lt(e,t){var n=(t||"").match(e);if(null===n)return null;var i=((n[n.length-1]||[])+"").match(Wt)||["-",0,0],s=60*i[1]+S(i[2]);return 0===s?0:"+"===i[0]?s:-s}function Ht(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(w(e)||u(e)?e.valueOf():kt(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),i.updateOffset(n,!1),n):kt(e).local()}function Rt(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Ft(){return!!this.isValid()&&this._isUTC&&0===this._offset}i.updateOffset=function(){};var Et=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Nt=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function Ut(e,t){var n,i,s,r,a,u,l=e,h=null;return xt(e)?l={ms:e._milliseconds,d:e._days,M:e._months}:o(e)?(l={},t?l[t]=e:l.milliseconds=e):(h=Et.exec(e))?(n="-"===h[1]?-1:1,l={y:0,d:S(h[2])*n,h:S(h[3])*n,m:S(h[4])*n,s:S(h[5])*n,ms:S(Pt(1e3*h[6]))*n}):(h=Nt.exec(e))?(n="-"===h[1]?-1:(h[1],1),l={y:It(h[2],n),M:It(h[3],n),w:It(h[4],n),d:It(h[5],n),h:It(h[6],n),m:It(h[7],n),s:It(h[8],n)}):null==l?l={}:"object"==typeof l&&("from"in l||"to"in l)&&(r=kt(l.from),a=kt(l.to),s=r.isValid()&&a.isValid()?(a=Ht(a,r),r.isBefore(a)?u=Vt(r,a):((u=Vt(a,r)).milliseconds=-u.milliseconds,u.months=-u.months),u):{milliseconds:0,months:0},(l={}).ms=s.milliseconds,l.M=s.months),i=new Tt(l),xt(e)&&d(e,"_locale")&&(i._locale=e._locale),i}function It(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Vt(e,t){var n={milliseconds:0,months:0};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function Gt(e,t){return function(n,i){var s;return null===i||isNaN(+i)||(T(t,"moment()."+t+"(period, number) is deprecated. Please use moment()."+t+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),s=n,n=i,i=s),jt(this,Ut(n="string"==typeof n?+n:n,i),e),this}}function jt(e,t,n,s){var r=t._milliseconds,a=Pt(t._days),o=Pt(t._months);e.isValid()&&(s=null==s||s,o&&Te(e,Me(e,"Month")+o*n),a&&Se(e,"Date",Me(e,"Date")+a*n),r&&e._d.setTime(e._d.valueOf()+r*n),s&&i.updateOffset(e,a||o))}Ut.fn=Tt.prototype,Ut.invalid=function(){return Ut(NaN)};var At=Gt(1,"add"),zt=Gt(-1,"subtract");function Zt(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),i=e.clone().add(n,"months");return-(n+(t-i<0?(t-i)/(i-e.clone().add(n-1,"months")):(t-i)/(e.clone().add(n+1,"months")-i)))||0}function $t(e){var t;return void 0===e?this._locale._abbr:(null!=(t=rt(e))&&(this._locale=t),this)}i.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",i.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Bt=Y("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",(function(e){return void 0===e?this.localeData():this.locale(e)}));function Jt(){return this._locale}function qt(e,t){j(0,[e,e.length],0,t)}function Qt(e,t,n,i,s){var r;return null==e?Ee(this,i,s).year:(t>(r=Ne(e,i,s))&&(t=r),Xt.call(this,e,t,n,i,s))}function Xt(e,t,n,i,s){var r=Fe(e,t,n,i,s),a=He(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}j(0,["gg",2],0,(function(){return this.weekYear()%100})),j(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),qt("gggg","weekYear"),qt("ggggg","weekYear"),qt("GGGG","isoWeekYear"),qt("GGGGG","isoWeekYear"),L("weekYear","gg"),L("isoWeekYear","GG"),E("weekYear",1),E("isoWeekYear",1),le("G",se),le("g",se),le("GG",Q,$),le("gg",Q,$),le("GGGG",te,J),le("gggg",te,J),le("GGGGG",ne,q),le("ggggg",ne,q),me(["gggg","ggggg","GGGG","GGGGG"],(function(e,t,n,i){t[i.substr(0,2)]=S(e)})),me(["gg","GG"],(function(e,t,n,s){t[s]=i.parseTwoDigitYear(e)})),j("Q",0,"Qo","quarter"),L("quarter","Q"),E("quarter",7),le("Q",Z),fe("Q",(function(e,t){t[1]=3*(S(e)-1)})),j("D",["DD",2],"Do","date"),L("date","D"),E("date",9),le("D",Q),le("DD",Q,$),le("Do",(function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient})),fe(["D","DD"],2),fe("Do",(function(e,t){t[2]=S(e.match(Q)[0])}));var Kt=we("Date",!0);j("DDD",["DDDD",3],"DDDo","dayOfYear"),L("dayOfYear","DDD"),E("dayOfYear",4),le("DDD",ee),le("DDDD",B),fe(["DDD","DDDD"],(function(e,t,n){n._dayOfYear=S(e)})),j("m",["mm",2],0,"minute"),L("minute","m"),E("minute",14),le("m",Q),le("mm",Q,$),fe(["m","mm"],4);var en=we("Minutes",!1);j("s",["ss",2],0,"second"),L("second","s"),E("second",15),le("s",Q),le("ss",Q,$),fe(["s","ss"],5);var tn,nn=we("Seconds",!1);for(j("S",0,0,(function(){return~~(this.millisecond()/100)})),j(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),j(0,["SSS",3],0,"millisecond"),j(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),j(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),j(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),j(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),j(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),j(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),L("millisecond","ms"),E("millisecond",16),le("S",ee,Z),le("SS",ee,$),le("SSS",ee,B),tn="SSSS";tn.length<=9;tn+="S")le(tn,ie);function sn(e,t){t[6]=S(1e3*("0."+e))}for(tn="S";tn.length<=9;tn+="S")fe(tn,sn);var rn=we("Milliseconds",!1);j("z",0,0,"zoneAbbr"),j("zz",0,0,"zoneName");var an=v.prototype;function on(e){return e}an.add=At,an.calendar=function(e,t){var n=e||kt(),s=Ht(n,this).startOf("day"),r=i.calendarFormat(this,s)||"sameElse",a=t&&(x(t[r])?t[r].call(this,n):t[r]);return this.format(a||this.localeData().calendar(r,this,kt(n)))},an.clone=function(){return new v(this)},an.diff=function(e,t,n){var i,s,r;if(!this.isValid())return NaN;if(!(i=Ht(e,this)).isValid())return NaN;switch(s=6e4*(i.utcOffset()-this.utcOffset()),t=H(t)){case"year":r=Zt(this,i)/12;break;case"month":r=Zt(this,i);break;case"quarter":r=Zt(this,i)/3;break;case"second":r=(this-i)/1e3;break;case"minute":r=(this-i)/6e4;break;case"hour":r=(this-i)/36e5;break;case"day":r=(this-i-s)/864e5;break;case"week":r=(this-i-s)/6048e5;break;default:r=this-i}return n?r:M(r)},an.endOf=function(e){return void 0===(e=H(e))||"millisecond"===e?this:("date"===e&&(e="day"),this.startOf(e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms"))},an.format=function(e){e||(e=this.isUtc()?i.defaultFormatUtc:i.defaultFormat);var t=A(this,e);return this.localeData().postformat(t)},an.from=function(e,t){return this.isValid()&&(w(e)&&e.isValid()||kt(e).isValid())?Ut({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},an.fromNow=function(e){return this.from(kt(),e)},an.to=function(e,t){return this.isValid()&&(w(e)&&e.isValid()||kt(e).isValid())?Ut({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},an.toNow=function(e){return this.to(kt(),e)},an.get=function(e){return x(this[e=H(e)])?this[e]():this},an.invalidAt=function(){return f(this).overflow},an.isAfter=function(e,t){var n=w(e)?e:kt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(a(t)?"millisecond":t))?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},an.isBefore=function(e,t){var n=w(e)?e:kt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=H(a(t)?"millisecond":t))?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},an.isBetween=function(e,t,n,i){return("("===(i=i||"()")[0]?this.isAfter(e,n):!this.isBefore(e,n))&&(")"===i[1]?this.isBefore(t,n):!this.isAfter(t,n))},an.isSame=function(e,t){var n,i=w(e)?e:kt(e);return!(!this.isValid()||!i.isValid())&&("millisecond"===(t=H(t||"millisecond"))?this.valueOf()===i.valueOf():(n=i.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},an.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},an.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},an.isValid=function(){return m(this)},an.lang=Bt,an.locale=$t,an.localeData=Jt,an.max=Yt,an.min=Dt,an.parsingFlags=function(){return h({},f(this))},an.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t=[];for(var n in e)t.push({unit:n,priority:F[n]});return t.sort((function(e,t){return e.priority-t.priority})),t}(e=R(e)),i=0;i<n.length;i++)this[n[i].unit](e[n[i].unit]);else if(x(this[e=H(e)]))return this[e](t);return this},an.startOf=function(e){switch(e=H(e)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e&&this.weekday(0),"isoWeek"===e&&this.isoWeekday(1),"quarter"===e&&this.month(3*Math.floor(this.month()/3)),this},an.subtract=zt,an.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},an.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},an.toDate=function(){return new Date(this.valueOf())},an.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||n.year()>9999?A(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):x(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",A(n,"Z")):A(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},an.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var n="["+e+'("]',i=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",s=t+'[")]';return this.format(n+i+"-MM-DD[T]HH:mm:ss.SSS"+s)},an.toJSON=function(){return this.isValid()?this.toISOString():null},an.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},an.unix=function(){return Math.floor(this.valueOf()/1e3)},an.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},an.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},an.year=ve,an.isLeapYear=function(){return ge(this.year())},an.weekYear=function(e){return Qt.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},an.isoWeekYear=function(e){return Qt.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},an.quarter=an.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},an.month=xe,an.daysInMonth=function(){return ke(this.year(),this.month())},an.week=an.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},an.isoWeek=an.isoWeeks=function(e){var t=Ee(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},an.weeksInYear=function(){var e=this.localeData()._week;return Ne(this.year(),e.dow,e.doy)},an.isoWeeksInYear=function(){return Ne(this.year(),1,4)},an.date=Kt,an.day=an.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(e=function(e,t){return"string"!=typeof e?e:isNaN(e)?"number"==typeof(e=t.weekdaysParse(e))?e:null:parseInt(e,10)}(e,this.localeData()),this.add(e-t,"d")):t},an.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},an.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=function(e,t){return"string"==typeof e?t.weekdaysParse(e)%7||7:isNaN(e)?null:e}(e,this.localeData());return this.day(this.day()%7?t:t-7)}return this.day()||7},an.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},an.hour=an.hours=Qe,an.minute=an.minutes=en,an.second=an.seconds=nn,an.millisecond=an.milliseconds=rn,an.utcOffset=function(e,t,n){var s,r=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null!=e){if("string"==typeof e){if(null===(e=Lt(ae,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Rt(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),r!==e&&(!t||this._changeInProgress?jt(this,Ut(e-r,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,i.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?r:Rt(this)},an.utc=function(e){return this.utcOffset(0,e)},an.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Rt(this),"m")),this},an.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=Lt(re,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},an.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?kt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},an.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},an.isLocal=function(){return!!this.isValid()&&!this._isUTC},an.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},an.isUtc=Ft,an.isUTC=Ft,an.zoneAbbr=function(){return this._isUTC?"UTC":""},an.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},an.dates=Y("dates accessor is deprecated. Use date instead.",Kt),an.months=Y("months accessor is deprecated. Use month instead",xe),an.years=Y("years accessor is deprecated. Use year instead",ve),an.zone=Y("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",(function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()})),an.isDSTShifted=Y("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",(function(){if(!a(this._isDSTShifted))return this._isDSTShifted;var e={};if(g(e,this),(e=Mt(e))._a){var t=e._isUTC?c(e._a):kt(e._a);this._isDSTShifted=this.isValid()&&k(e._a,t.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}));var un=C.prototype;function ln(e,t,n,i){var s=rt(),r=c().set(i,t);return s[n](r,e)}function dn(e,t,n){if(o(e)&&(t=e,e=void 0),e=e||"",null!=t)return ln(e,t,n,"month");var i,s=[];for(i=0;i<12;i++)s[i]=ln(e,i,n,"month");return s}function hn(e,t,n,i){"boolean"==typeof e?(o(t)&&(n=t,t=void 0),t=t||""):(n=t=e,e=!1,o(t)&&(n=t,t=void 0),t=t||"");var s,r=rt(),a=e?r._week.dow:0;if(null!=n)return ln(t,(n+a)%7,i,"day");var u=[];for(s=0;s<7;s++)u[s]=ln(t,(s+a)%7,i,"day");return u}un.calendar=function(e,t,n){var i=this._calendar[e]||this._calendar.sameElse;return x(i)?i.call(t,n):i},un.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,(function(e){return e.slice(1)})),this._longDateFormat[e])},un.invalidDate=function(){return this._invalidDate},un.ordinal=function(e){return this._ordinal.replace("%d",e)},un.preparse=on,un.postformat=on,un.relativeTime=function(e,t,n,i){var s=this._relativeTime[n];return x(s)?s(e,t,n,i):s.replace(/%d/i,e)},un.pastFuture=function(e,t){var n=this._relativeTime[e>0?"future":"past"];return x(n)?n(t):n.replace(/%s/i,t)},un.set=function(e){var t,n;for(n in e)x(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},un.months=function(e,t){return e?s(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||De).test(t)?"format":"standalone"][e.month()]:s(this._months)?this._months:this._months.standalone},un.monthsShort=function(e,t){return e?s(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[De.test(t)?"format":"standalone"][e.month()]:s(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},un.monthsParse=function(e,t,n){var i,s,r;if(this._monthsParseExact)return Oe.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),i=0;i<12;i++){if(s=c([2e3,i]),n&&!this._longMonthsParse[i]&&(this._longMonthsParse[i]=new RegExp("^"+this.months(s,"").replace(".","")+"$","i"),this._shortMonthsParse[i]=new RegExp("^"+this.monthsShort(s,"").replace(".","")+"$","i")),n||this._monthsParse[i]||(r="^"+this.months(s,"")+"|^"+this.monthsShort(s,""),this._monthsParse[i]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[i].test(e))return i;if(n&&"MMM"===t&&this._shortMonthsParse[i].test(e))return i;if(!n&&this._monthsParse[i].test(e))return i}},un.monthsRegex=function(e){return this._monthsParseExact?(d(this,"_monthsRegex")||We.call(this),e?this._monthsStrictRegex:this._monthsRegex):(d(this,"_monthsRegex")||(this._monthsRegex=Ce),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},un.monthsShortRegex=function(e){return this._monthsParseExact?(d(this,"_monthsRegex")||We.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(d(this,"_monthsShortRegex")||(this._monthsShortRegex=Pe),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},un.week=function(e){return Ee(e,this._week.dow,this._week.doy).week},un.firstDayOfYear=function(){return this._week.doy},un.firstDayOfWeek=function(){return this._week.dow},un.weekdays=function(e,t){return e?s(this._weekdays)?this._weekdays[e.day()]:this._weekdays[this._weekdays.isFormat.test(t)?"format":"standalone"][e.day()]:s(this._weekdays)?this._weekdays:this._weekdays.standalone},un.weekdaysMin=function(e){return e?this._weekdaysMin[e.day()]:this._weekdaysMin},un.weekdaysShort=function(e){return e?this._weekdaysShort[e.day()]:this._weekdaysShort},un.weekdaysParse=function(e,t,n){var i,s,r;if(this._weekdaysParseExact)return Ge.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;i<7;i++){if(s=c([2e3,1]).day(i),n&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(s,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(s,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(s,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[i]||(r="^"+this.weekdays(s,"")+"|^"+this.weekdaysShort(s,"")+"|^"+this.weekdaysMin(s,""),this._weekdaysParse[i]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[i].test(e))return i;if(n&&"ddd"===t&&this._shortWeekdaysParse[i].test(e))return i;if(n&&"dd"===t&&this._minWeekdaysParse[i].test(e))return i;if(!n&&this._weekdaysParse[i].test(e))return i}},un.weekdaysRegex=function(e){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Ze.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(d(this,"_weekdaysRegex")||(this._weekdaysRegex=je),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},un.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Ze.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(d(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Ae),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},un.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Ze.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(d(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=ze),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},un.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},un.meridiem=function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},it("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===S(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),i.lang=Y("moment.lang is deprecated. Use moment.locale instead.",it),i.langData=Y("moment.langData is deprecated. Use moment.localeData instead.",rt);var cn=Math.abs;function fn(e,t,n,i){var s=Ut(t,n);return e._milliseconds+=i*s._milliseconds,e._days+=i*s._days,e._months+=i*s._months,e._bubble()}function mn(e){return e<0?Math.floor(e):Math.ceil(e)}function _n(e){return 4800*e/146097}function yn(e){return 146097*e/4800}function gn(e){return function(){return this.as(e)}}var pn=gn("ms"),vn=gn("s"),wn=gn("m"),Mn=gn("h"),Sn=gn("d"),kn=gn("w"),Dn=gn("M"),Yn=gn("y");function bn(e){return function(){return this.isValid()?this._data[e]:NaN}}var On=bn("milliseconds"),Tn=bn("seconds"),xn=bn("minutes"),Pn=bn("hours"),Cn=bn("days"),Wn=bn("months"),Ln=bn("years"),Hn=Math.round,Rn={ss:44,s:45,m:45,h:22,d:26,M:11};function Fn(e,t,n,i,s){return s.relativeTime(t||1,!!n,e,i)}var En=Math.abs;function Nn(e){return(e>0)-(e<0)||+e}function Un(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n=En(this._milliseconds)/1e3,i=En(this._days),s=En(this._months);e=M(n/60),t=M(e/60),n%=60,e%=60;var r=M(s/12),a=s%=12,o=i,u=t,l=e,d=n?n.toFixed(3).replace(/\.?0+$/,""):"",h=this.asSeconds();if(!h)return"P0D";var c=h<0?"-":"",f=Nn(this._months)!==Nn(h)?"-":"",m=Nn(this._days)!==Nn(h)?"-":"",_=Nn(this._milliseconds)!==Nn(h)?"-":"";return c+"P"+(r?f+r+"Y":"")+(a?f+a+"M":"")+(o?m+o+"D":"")+(u||l||d?"T":"")+(u?_+u+"H":"")+(l?_+l+"M":"")+(d?_+d+"S":"")}var In=Tt.prototype;return In.isValid=function(){return this._isValid},In.abs=function(){var e=this._data;return this._milliseconds=cn(this._milliseconds),this._days=cn(this._days),this._months=cn(this._months),e.milliseconds=cn(e.milliseconds),e.seconds=cn(e.seconds),e.minutes=cn(e.minutes),e.hours=cn(e.hours),e.months=cn(e.months),e.years=cn(e.years),this},In.add=function(e,t){return fn(this,e,t,1)},In.subtract=function(e,t){return fn(this,e,t,-1)},In.as=function(e){if(!this.isValid())return NaN;var t,n,i=this._milliseconds;if("month"===(e=H(e))||"year"===e)return t=this._days+i/864e5,n=this._months+_n(t),"month"===e?n:n/12;switch(t=this._days+Math.round(yn(this._months)),e){case"week":return t/7+i/6048e5;case"day":return t+i/864e5;case"hour":return 24*t+i/36e5;case"minute":return 1440*t+i/6e4;case"second":return 86400*t+i/1e3;case"millisecond":return Math.floor(864e5*t)+i;default:throw new Error("Unknown unit "+e)}},In.asMilliseconds=pn,In.asSeconds=vn,In.asMinutes=wn,In.asHours=Mn,In.asDays=Sn,In.asWeeks=kn,In.asMonths=Dn,In.asYears=Yn,In.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*S(this._months/12):NaN},In._bubble=function(){var e,t,n,i,s,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return r>=0&&a>=0&&o>=0||r<=0&&a<=0&&o<=0||(r+=864e5*mn(yn(o)+a),a=0,o=0),u.milliseconds=r%1e3,e=M(r/1e3),u.seconds=e%60,t=M(e/60),u.minutes=t%60,n=M(t/60),u.hours=n%24,a+=M(n/24),s=M(_n(a)),o+=s,a-=mn(yn(s)),i=M(o/12),o%=12,u.days=a,u.months=o,u.years=i,this},In.clone=function(){return Ut(this)},In.get=function(e){return e=H(e),this.isValid()?this[e+"s"]():NaN},In.milliseconds=On,In.seconds=Tn,In.minutes=xn,In.hours=Pn,In.days=Cn,In.weeks=function(){return M(this.days()/7)},In.months=Wn,In.years=Ln,In.humanize=function(e){if(!this.isValid())return this.localeData().invalidDate();var t=this.localeData(),n=function(e,t,n){var i=Ut(e).abs(),s=Hn(i.as("s")),r=Hn(i.as("m")),a=Hn(i.as("h")),o=Hn(i.as("d")),u=Hn(i.as("M")),l=Hn(i.as("y")),d=s<=Rn.ss&&["s",s]||s<Rn.s&&["ss",s]||r<=1&&["m"]||r<Rn.m&&["mm",r]||a<=1&&["h"]||a<Rn.h&&["hh",a]||o<=1&&["d"]||o<Rn.d&&["dd",o]||u<=1&&["M"]||u<Rn.M&&["MM",u]||l<=1&&["y"]||["yy",l];return d[2]=t,d[3]=+e>0,d[4]=n,Fn.apply(null,d)}(this,!e,t);return e&&(n=t.pastFuture(+this,n)),t.postformat(n)},In.toISOString=Un,In.toString=Un,In.toJSON=Un,In.locale=$t,In.localeData=Jt,In.toIsoString=Y("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Un),In.lang=Bt,j("X",0,0,"unix"),j("x",0,0,"valueOf"),le("x",se),le("X",/[+-]?\d+(\.\d{1,3})?/),fe("X",(function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))})),fe("x",(function(e,t,n){n._d=new Date(S(e))})),i.version="2.22.2",t=kt,i.fn=an,i.min=function(){var e=[].slice.call(arguments,0);return bt("isBefore",e)},i.max=function(){var e=[].slice.call(arguments,0);return bt("isAfter",e)},i.now=function(){return Date.now?Date.now():+new Date},i.utc=c,i.unix=function(e){return kt(1e3*e)},i.months=function(e,t){return dn(e,t,"months")},i.isDate=u,i.locale=it,i.invalid=_,i.duration=Ut,i.isMoment=w,i.weekdays=function(e,t,n){return hn(e,t,n,"weekdays")},i.parseZone=function(){return kt.apply(null,arguments).parseZone()},i.localeData=rt,i.isDuration=xt,i.monthsShort=function(e,t){return dn(e,t,"monthsShort")},i.weekdaysMin=function(e,t,n){return hn(e,t,n,"weekdaysMin")},i.defineLocale=st,i.updateLocale=function(e,t){if(null!=t){var n,i,s=Xe;null!=(i=nt(e))&&(s=i._config),t=P(s,t),(n=new C(t)).parentLocale=Ke[e],Ke[e]=n,it(e)}else null!=Ke[e]&&(null!=Ke[e].parentLocale?Ke[e]=Ke[e].parentLocale:null!=Ke[e]&&delete Ke[e]);return Ke[e]},i.locales=function(){return b(Ke)},i.weekdaysShort=function(e,t,n){return hn(e,t,n,"weekdaysShort")},i.normalizeUnits=H,i.relativeTimeRounding=function(e){return void 0===e?Hn:"function"==typeof e&&(Hn=e,!0)},i.relativeTimeThreshold=function(e,t){return void 0!==Rn[e]&&(void 0===t?Rn[e]:(Rn[e]=t,"s"===e&&(Rn.ss=t-1),!0))},i.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},i.prototype=an,i.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"YYYY-[W]WW",MONTH:"YYYY-MM"},i}()}).call(this,n(1)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";n.r(t);var i=n(0),s=n.n(i);function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}$(document).ready((function(){var e=document.getElementById("wagalytics-data");!function(e,t){if(!window.google||!window.google.load){var n=document.createElement("script");n.type="text/javascript",n.src="https://www.google.com/jsapi";var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(n,i)}gapi.analytics.ready((function(){$.get(e,(function(e){gapi.analytics.auth.authorize({serverAuth:{access_token:e}})})),new u(t).refresh()}))}(e.dataset.token,e.dataset.viewId)}));var a="#f37e77",o="#fcf2f2",u=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.view_id=t,this.start_date_input=document.getElementById("id_date_from"),this.end_date_input=document.getElementById("id_date_to"),this.export_btn=document.getElementById("export-button"),this.start_date_input.addEventListener("change",(function(){return n.refresh()})),this.end_date_input.addEventListener("change",(function(){return n.refresh()})),$(document.getElementById("export")).submit((function(){$(document.getElementById("export-data")).val(JSON.stringify(n.data))})),this.data={},this.tooltips={enabled:!0,mode:"label",callbacks:{title:function(e,t){var n=e[0].index;return"Title:"+t.labels[n]},label:function(e,t){return e.xLabel}}}}var t,n,i;return t=e,(n=[{key:"setLoading",value:function(e){document.getElementById(e).innerHTML='<i class="icon icon-spinner"></i>'}},{key:"refresh",value:function(){this.sessionsLineChart(),this.popularPagesTable(),this.topReferrersTable()}},{key:"getQuery",value:function(e){return $(this.export_btn).prop("disabled",!0),t=Object.assign({ids:this.view_id,"start-date":$(this.start_date_input).val(),"end-date":$(this.end_date_input).val()},e),new Promise((function(e,n){new gapi.analytics.report.Data({query:t}).once("success",(function(t){e(t)})).once("error",(function(e){n(e)})).execute()}));var t}},{key:"sessionsLineChart",value:function(){var e=this,t="sessions-line-chart-container";this.setLoading(t),this.getQuery({dimensions:"ga:date,ga:nthDay",metrics:"ga:sessions"}).then((function(n){e.data.sessions=n.rows,$(e.export_btn).prop("disabled",!1),$(e.export_btn).removeClass("button-longrunning-active");var i=n.rows.map((function(e){return e[2]})),r=n.rows.map((function(e){return e[0]})),u={labels:r=r.map((function(e){return s()(e,"YYYYMMDD").format("ll")})),datasets:[{label:"Sessions",backgroundColor:o,borderColor:a,pointBackgroundColor:a,pointBorderColor:"#fff",data:i}]};new Chart(function(e){var t=document.getElementById(e),n=document.createElement("canvas"),i=n.getContext("2d");return t.innerHTML="",n.width=t.offsetWidth,n.height=t.offsetHeight,t.appendChild(n),i}(t),{type:"line",data:u,options:{legend:{display:!1},scales:{xAxes:[{ticks:{autoSkip:!0,maxTicksLimit:4,maxRotation:0}}]}}})}))}},{key:"popularPagesTable",value:function(){var e=this,t="popular-pages-table-container";this.setLoading(t),this.getQuery({metrics:"ga:pageviews",dimensions:"ga:hostname,ga:pagePath",sort:"-ga:pageviews","max-results":25}).then((function(n){for(var i=0,s=n.rows,r=s.length,a={};i<r;++i){var o=s[i][1];a.hasOwnProperty(o)?a[o][1]+=parseInt(s[i][2],10):a[o]=[o,parseInt(s[i][2],10)]}e.data.pages=Object.values(a),$(e.export_btn).prop("disabled",!1),$(e.export_btn).removeClass("button-longrunning-active");var u=l(["Page URL","Views"],Object.values(a)),h=d(u),c=document.getElementById(t);c.innerHTML="",c.appendChild(u),$(c).append(h)}))}},{key:"topReferrersTable",value:function(){var e=this,t="top-referrers-table-container";this.setLoading(t),this.getQuery({metrics:"ga:pageviews",dimensions:"ga:fullReferrer",sort:"-ga:pageviews","max-results":25}).then((function(n){e.data.referrers=n.rows,$(e.export_btn).prop("disabled",!1),$(e.export_btn).removeClass("button-longrunning-active");var i=l(["Source","Views"],n.rows),s=d(i),r=document.getElementById(t);r.innerHTML="",r.appendChild(i),$(r).append(s)}))}}])&&r(t.prototype,n),i&&r(t,i),e}();function l(e,t){var n=document.createElement("table");n.className="listing";for(var i=n.createTHead().insertRow(0),s=0;s<e.length;++s){var r=i.insertCell(s);r.innerHTML=e[s],r.className="title"}var a=n.createTBody();for(s=0;s<t.length;++s)for(var o=t[s],u=a.insertRow(s),l=0;l<o.length;++l)u.insertCell(l).innerHTML=o[l];return n}function d(e){var t=0,n=$(e);n.bind("repaginate",(function(){n.find("tbody tr").hide().slice(5*t,5*(t+1)).show();var e=n.next();t<=0?e.find(".prev").addClass("disabled"):e.find(".prev").removeClass("disabled"),t>=s-1?e.find(".next").addClass("disabled"):e.find(".next").removeClass("disabled")})),n.trigger("repaginate");var i=n.find("tbody tr").length,s=Math.ceil(i/5),r=$('\n        <div class="pagination">\n            <p>Page <span class="page-num">1</span> of '.concat(s,'</p>\n            <ul>\n                <li class="prev disabled">\n                    <a class="icon icon-arrow-left" href="#">Previous</a>\n                </li>\n                <li class="next">\n                    <a class="icon icon-arrow-right-after" href="#">Next</a>\n                </li>\n            </ul>\n        </div>'));return r.find(".prev a").bind("click",(function(e){e.preventDefault(),(t-=1)<0&&(t=0),r.find(".page-num").text("".concat(t+1)),n.trigger("repaginate")})),r.find(".next a").bind("click",(function(e){e.preventDefault(),(t+=1)>=s&&(t=s-1),r.find(".page-num").text("".concat(t+1)),n.trigger("repaginate")})),r}Chart.defaults.global.animationSteps=60,Chart.defaults.global.animationEasing="easeInOutQuart",Chart.defaults.global.responsive=!0,Chart.defaults.global.maintainAspectRatio=!1}]);
//# sourceMappingURL=http://127.0.0.1:3001/dist/js/wagalytics.js.map

================================================
FILE: wagalytics/templates/wagalytics/dashboard.html
================================================
{% extends "wagtailadmin/base.html" %}
{% load wagtailadmin_tags i18n static %}

{% block extra_css %}
    {% include "wagtailadmin/pages/_editor_css.html" %}
    {{ block.super }}
    <script>
        (function(w,d,s,g,js,fs){
          g=w.gapi||(w.gapi={});g.analytics={q:[],ready:function(f){this.q.push(f);}};
          js=d.createElement(s);fs=d.getElementsByTagName(s)[0];
          js.src='https://apis.google.com/js/platform.js';
          fs.parentNode.insertBefore(js,fs);js.onload=function(){g.load('analytics');};
        }(window,document,'script'));
    </script>
    <style>
      .wagalytics .chart {
          height: 150px;
          margin-bottom: 50px;
      }

      .wagalytics .icon-spinner {
          margin-left: 50%;
      }

      .wagalytics .button-group {
        float: right;
      }

      .wagalytics .pagination {
        margin-bottom: 50px;
      }

      .wagalytics .pagination ul {
        margin-top: -1.265em;
      }

      .wagalytics .disabled a {
        cursor: default;
        pointer-events: none;
        color: #666;
        opacity: 0.5;
      }

      .wagalytics table.listing td.title:first-child {
        width: 90%;
      }

      footer .actions {
        width: auto;
      }

      footer .meta {
        float: none;
        text-align: left;
      }
    </style>
{% endblock %}

{% block titletag %}{% trans 'Analytics' %}{% endblock %}

{% block content %}
    <header class="col12">
        <div class="row nice-padding">
            <div class="left">
                <div class="col header-title">
                    <h1 class="icon icon-fa-bar-chart">
                        {% trans "Analytics" %}
                    </h1>
                </div>
            </div>
            <form class="left">
                <ul class="fields">
                    <li class="date_field col6">
                        <div class="field date_field admin_date_input field-small">
                            <label for="id_date_from">Start date:</label>
                            <div class="field-content">
                                <div class="input">
                                    <input id="id_date_from" type="date" value="{{ initial_start_date }}">
                                </div>
                            </div>
                        </div>
                    </li>
                    <li class="date_field col6">
                        <div class="field date_field admin_date_input field-small">
                            <label for="id_date_from">End date:</label>
                            <div class="field-content">
                                <div class="input">
                                    <input id="id_date_to" type="date" value="{% now "Y-m-d" %}">
                                </div>
                            </div>
                        </div>
                    </li>
                </ul>
            </form>
            {% if site_switcher %}
                <div class="right" style='margin-left: 20px;'>
                    <form method="get" id="settings-site-switch" novalidate>
                        <label for="{{ site_switcher.site.id_for_label }}">
                            Site:
                        </label>
                        {{ site_switcher.site }}
                    </form>
                </div>
            {% endif %}
        </div>
    </header>

    <div class="wagalytics nice-padding">
        <div class="col12 clearfix">
            <h2>Sessions</h2>
            <div id="sessions-line-chart-container" class="chart"><i class="icon icon-spinner"></i></div>
        </div>
        <div class="col6 clearfix">
            <h2>Popular content</h2>
            <div id="popular-pages-table-container"><i class="icon icon-spinner"></i></div>
        </div>
        <div class="col6 clearfix">
            <h2>Top referrers</h2>
            <div id="top-referrers-table-container" ><i class="icon icon-spinner"></i></div>
        </div>
    </div>

    <footer>
        <ul>
            <li class="actions">
                <form id="export" action="{% url 'wagalytics_export' %}" method="post">
                    {% csrf_token %}
                    <input id="export-data" type="hidden" name="data">
                    <button id="export-button" class="button icon icon-download button-longrunning" data-clicked-text="Exporting…" type="submit" disabled>
                        <span class="icon icon-spinner"></span><em>Export Data</em>
                    </button>
                </form>
            </li>
            <li class="meta">
                <p>{% trans "The current view will be exported to a spreadsheet file (*.ods)" %}</p>
            </li>
        </ul>
    </footer>

    <div hidden id="wagalytics-data" data-token="{% url 'wagalytics_site_token' site_id %}" data-view-id="{{ ga_view_id }}">
    </div>
{% endblock %}

{% block extra_js %}
    {{ block.super }}
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>
    <script src="{% static 'wagalytics/vendors.bundle.js' %}"></script>
    <script src="{% static 'wagalytics/wagalytics.bundle.js' %}"></script>
    {{ site_switcher.media.js }}
{% endblock %}


================================================
FILE: wagalytics/tests/tests.py
================================================
import pytest

from django.conf import settings
from django.test import TestCase
from django.urls import reverse

from wagtail.tests.utils import WagtailTestUtils
from wagtail.core.models import Site
import wagtail_factories

pytestmark = pytest.mark.django_db


@pytest.mark.django_db
class TestWagalyticsDashboard(TestCase, WagtailTestUtils):

    def setUp(self):
        self.dashboard_url = reverse('wagalytics_dashboard')
        # Clear KEY settings in case tests are being run inside of a project.
        self._clean_wagalytics_keys()
        # Login
        self.login()

    def _clean_wagalytics_keys(self):
        """Remove Wagalytics settings."""
        if hasattr(settings, 'WAGALYTICS_SETTINGS'):
            del settings.WAGALYTICS_SETTINGS
        if hasattr(settings, 'GA_VIEW_ID'):
            del settings.GA_VIEW_ID
        if hasattr(settings, 'GA_KEY_FILEPATH'):
            del settings.GA_KEY_FILEPATH
        if hasattr(settings, 'GA_KEY_CONTENT'):
            del settings.GA_KEY_CONTENT

    def _use_single_site_settings(self):
        if hasattr(settings, 'WAGALYTICS_SETTINGS'):
            del settings.WAGALYTICS_SETTINGS

        settings.GA_VIEW_ID = 'ga:xxxxxxxx'
        settings.GA_KEY_FILEPATH = '/path/to/your/analytics-key.json'

    def _use_multi_site_settings(self):
        settings.WAGALYTICS_SETTINGS = {
            # My default site.
            2: {
                'GA_VIEW_ID': 'ga:xxxxxxxx',
                'GA_KEY_FILEPATH': '/path/to/your/analytics-key.json',
            },
            # The secondary site.
            3: {
                'GA_KEY_CONTENT': 'content_of_your_key.json',
                'GA_VIEW_ID': 'ga:xxxxxxxx',
            }
        }


    def test_dashboard_view(self):
        self._use_single_site_settings()
        response_200 = self.client.get(self.dashboard_url)
        # Default URL should not redirect to ^analytics/dashboard/{num}/$
        self.assertEqual(response_200.status_code, 200)

    def test_dashboard_404_view(self):
        response_404 = self.client.get(reverse('wagalytics_site_dashboard', args=(999,)))
        self.assertEqual(response_404.status_code, 404)

    def test_single_site_missing_keys(self):
        self._clean_wagalytics_keys()
        response = self.client.get(self.dashboard_url)
        messages = list(response.context['messages'])
        self.assertEqual(len(messages), 2)
        self.assertEqual(messages[0].message, "You are missing your GA_VIEW_ID setting. Your analytics dashboard won't load without this setting.")
        self.assertEqual(messages[1].message, "You are missing your GA_KEY_FILEPATH or your GA_KEY_CONTENT setting.")

    def test_single_site_no_siteswitcher(self):
        """Make sure the site switcher does not show up in the dashboard context."""
        self._clean_wagalytics_keys()
        response = self.client.get(self.dashboard_url)
        self.assertEqual(response.context['site_switcher'], None)

    def test_single_site_dashboard(self):
        self._use_single_site_settings()
        response = self.client.get(self.dashboard_url)
        messages = list(response.context['messages'])
        self.assertEqual(len(messages), 0)

    def test_single_site_dashboard_on_multisite_url(self):
        self._use_single_site_settings()
        response = self.client.get(reverse('wagalytics_site_dashboard', args=(2,)))
        self.assertEqual(response.status_code, 200)  # Will still 200.

        messages = list(response.context['messages'])
        # Should have 1 message
        self.assertEqual(len(messages), 1)
        # The one message should be "You are missing Wagalytics Multisite settings."
        self.assertEqual(messages[0].message, "You are missing Wagalytics Multisite settings.")

    def test_multi_site_dashboard(self):
        self._use_multi_site_settings()
        wagtail_factories.SiteFactory(hostname="example.com")
        sites = Site.objects.all()
        # There should be 2 Wagtail Sites.
        self.assertEqual(len(sites), 2)

        # Go to ^analytics/dashboard/{num}/$. Should redirect.
        response = self.client.get(self.dashboard_url)
        self.assertEqual(response.status_code, 302)  # Redirect
        # Went to /dashboard/2/ by default
        self.assertEqual(response.url, reverse('wagalytics_site_dashboard', args=(2,)))

    def test_multi_site_siteswitcher(self):
        self._use_multi_site_settings()
        wagtail_factories.SiteFactory(hostname="example.com")

        response = self.client.get(reverse('wagalytics_site_dashboard', args=(2,)))
        self.assertNotEqual(response.context['site_switcher'], None)

    def test_multi_site_dashboard_change_site(self):
        self._use_multi_site_settings()
        wagtail_factories.SiteFactory(hostname="example.com")
        site = Site.objects.last()

        response = self.client.get(reverse('wagalytics_site_dashboard', args=(site.id,)))
        self.assertEqual(response.status_code, 200)

    def test_multi_site_token_no_api_keys(self):
        """Test the ^analytics/token/2/$ url. There will always be an id of 2 available."""
        self._clean_wagalytics_keys()
        url = reverse('wagalytics_site_token', args=(2,))
        response = self.client.get(url)
        self.assertEqual(response.status_code, 403)

    def test_single_site_token_no_api_keys(self):
        """Test the ^analytics/token/$ url. """
        self._clean_wagalytics_keys()
        url = reverse('wagalytics_token')
        response = self.client.get(url)
        self.assertEqual(response.status_code, 403)

    def test_multi_site_token_using_single_site_api_keys(self):
        self._use_single_site_settings()
        url = reverse('wagalytics_site_token', args=(2,))
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)

    def test_multi_site_token_using_multi_site_api_keys(self):
        self._use_multi_site_settings()
        url = reverse('wagalytics_site_token', args=(2,))
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)


================================================
FILE: wagalytics/urls.py
================================================
from __future__ import absolute_import, unicode_literals
from django.urls import path
from django.views.decorators.cache import cache_page

from .views import dashboard, token, export

urlpatterns = [
    path('dashboard/', dashboard, name='wagalytics_dashboard'),
    path('dashboard/<int:site_id>/', dashboard, name='wagalytics_site_dashboard'),
    path('token/', token, name='wagalytics_token'),
    path('token/<int:site_id>/', cache_page(3600)(token), name='wagalytics_site_token'),
    path('export/', export, name='wagalytics_export'),
]


================================================
FILE: wagalytics/views.py
================================================
import json
import datetime
from io import BytesIO
from oauth2client.service_account import ServiceAccountCredentials
from django.shortcuts import redirect, render, get_object_or_404
from django.conf import settings
from django.contrib import messages
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseForbidden
from django.utils import timezone
from django.urls import reverse
from collections import OrderedDict
from pyexcel_ods import save_data

from wagtail.contrib.settings.forms import SiteSwitchForm as SettingsSiteSwitchForm
from wagtail.core.models import Site


class SiteSwitchForm(SettingsSiteSwitchForm):
    """Overwrite the get_change_url() method from SiteSwitchForm."""

    @classmethod
    def get_change_url(cls, site, model):
        """Change the url based on the Site."""
        return reverse('wagalytics_site_dashboard', args=[site.pk])


def get_access_token(ga_key_filepath):
    """Get the access token for Google Analytics.

    from https://ga-dev-tools.appspot.com/embed-api/server-side-authorization/
    Defines a method to get an access token from the credentials object.
    The access token is automatically refreshed if it has expired.
    """

    # The scope for the OAuth2 request.
    SCOPE = 'https://www.googleapis.com/auth/analytics.readonly'

    # Construct a credentials objects from the key data and OAuth2 scope.
    _credentials = ServiceAccountCredentials.from_json_keyfile_name(
        ga_key_filepath, SCOPE)

    return _credentials.get_access_token().access_token


def get_access_token_from_str(ga_key_content):
    """Get the access token from a string.

    from https://ga-dev-tools.appspot.com/embed-api/server-side-authorization/
    Defines a method to get an access token from the credentials object.
    The access token is automatically refreshed if it has expired.
    """

    # The scope for the OAuth2 request.
    SCOPE = 'https://www.googleapis.com/auth/analytics.readonly'

    # Construct a credentials objects from the key data and OAuth2 scope.
    keyDict = json.loads(ga_key_content.replace('\n', '').replace('\r', ''))
    _credentials = ServiceAccountCredentials.from_json_keyfile_dict(
        keyDict, SCOPE)

    return _credentials.get_access_token().access_token


def token(request, site_id=None):
    """Generate the token.

    Will detect Wagalyics Multisite settings.
    Defaults to single-site settings.
    """

    if hasattr(settings, 'WAGALYTICS_SETTINGS'):
        if site_id is None:
            site_id = Site.find_for_request(request).id

        wagalytics_settings = settings.WAGALYTICS_SETTINGS[site_id]

        if wagalytics_settings.get('GA_KEY_CONTENT', None):
            access_token = get_access_token_from_str(wagalytics_settings['GA_KEY_CONTENT'])
        elif wagalytics_settings.get('GA_KEY_FILEPATH', None):
            access_token = get_access_token(wagalytics_settings['GA_KEY_FILEPATH'])
        else:
            return HttpResponseForbidden()
    else:
        if (hasattr(settings, 'GA_KEY_CONTENT') and settings.GA_KEY_CONTENT != ''):
            access_token = get_access_token_from_str(settings.GA_KEY_CONTENT)
        elif (hasattr(settings, 'GA_KEY_FILEPATH') and settings.GA_KEY_FILEPATH != ''):
            access_token = get_access_token(settings.GA_KEY_FILEPATH)
        else:
            return HttpResponseForbidden()

    return HttpResponse(access_token)


def dashboard(request, site_id=None):
    """Display the Wagalytics Dashboard.

    If a site_id is provided, the dashboard will display an instance of a multi site.
    """
    # If there is no site_id provided in the URL but WAGALYTICS_SETTINGS have been set,
    # Redirect the viewer to the site main site.
    # Default redirect will be to the current site they are. ie. ^analytics/dashboard/2/$
    if not site_id and (hasattr(settings, 'WAGALYTICS_SETTINGS') and len(settings.WAGALYTICS_SETTINGS) > 0):
        # This site has multi-site wagalytics enabled.
        # Redirect user to ^analytics/dashboard/{site_id}/$
        return redirect('wagalytics_site_dashboard', site_id=Site.find_for_request(request).id)

    initial_start_date = (timezone.now() - datetime.timedelta(days=30)).strftime("%Y-%m-%d")
    ga_view_id = None

    if site_id:
        # Multisite analytics URL is being used.
        # The URL being used looks something like this: ^/analytics/dashboard/2/$

        # Look for the site object, or 404.
        site = get_object_or_404(Site, id=site_id)

        # Check for wagtail.contrib.settings app. Without it, the SiteSwitcher is not available.
        if 'wagtail.contrib.settings' not in settings.INSTALLED_APPS:
            display_message = "You must enable the Wagtail Site Settings app for " \
                              "Multisite Wagalytics to work properly."
            messages.error(request, display_message)

        # Check for WAGALYTICS_SETTINGS
        if not hasattr(settings, 'WAGALYTICS_SETTINGS'):
            # Has no WAGALYTICS_SETTINGS at all
            messages.error(request, "You are missing Wagalytics Multisite settings.")
        elif not settings.WAGALYTICS_SETTINGS[site.id]:
            # Has WAGALYTICS_SETTINGS but doesn't have settings for this specific site.
            display_message = "You have Wagalytics Multisite settings, but not " \
                              "for this site. Please add your settings for this site."
            messages.error(request, display_message)
        else:
            # Has WAGALYTICS_SETTINGS for this specific site.
            # Assign WAGALYTICS_SETTINGS[site_id]['GA_VIEW_ID] to ga_view_id for local use
            ga_view_id = settings.WAGALYTICS_SETTINGS[site.id]['GA_VIEW_ID']
    else:
        # The regular ^analytics/dashboard/$ url is being viewed.
        site = Site.objects.get(hostname=Site.find_for_request(request).hostname)
        try:
            ga_view_id = settings.GA_VIEW_ID
        except AttributeError:
            display_message = "You are missing your GA_VIEW_ID setting. Your " \
                              "analytics dashboard won't load without this setting."
            messages.error(request, display_message)

        if not hasattr(settings, 'GA_KEY_FILEPATH') and not hasattr(settings, 'GA_KEY_CONTENT'):
            display_message = "You are missing your GA_KEY_FILEPATH or your "\
                              "GA_KEY_CONTENT setting."
            messages.error(request, display_message)

    # Check if a SiteSwitcher is required and add it. Otherwise return None.
    # SiteSwitcher is disabled by default.
    site_switcher = None
    if Site.objects.count() > 1 and hasattr(settings, 'WAGALYTICS_SETTINGS'):
        site_switcher = SiteSwitchForm(site, Site)

    return render(request, 'wagalytics/dashboard.html', {
        'ga_view_id': ga_view_id,
        'initial_start_date': initial_start_date,
        'site_switcher': site_switcher,
        'site_id': site.id,
    })


def export(request):
    """Export the data in the current view."""
    # Get JSON string posted to `data`
    raw_data = request.POST.get('data')

    # Reject a request without data
    if not raw_data:
        return HttpResponseBadRequest()

    # Convert JSON to a Python dict
    data = json.loads(raw_data)

    # Clean up session data
    for n in data["sessions"]:
        # Convert dates into datetime.date objects
        n[0] = datetime.datetime.strptime(n[0], '%Y%m%d').strftime("%Y-%m-%d")
        # Convert session counts into integers
        n[2] = int(n[2])
        # Second key is just the index, which isn't needed
        del n[1]

    # Clean up referrers data
    for n in data["referrers"]:
        # Convert counts into integers
        n[1] = int(n[1])

    # Format spreadsheet file
    ods = OrderedDict()
    ods["Sessions"] = [["Date", "Sessions"]] + data["sessions"]
    ods["Popular Content"] = [["Page URL", "Views"]] + data["pages"]
    ods["Top Referrers"] = [["Source", "Views"]] + data["referrers"]

    # Save the spreadsheet into memory
    io = BytesIO()
    save_data(io, ods)

    # Set response metadata
    response = HttpResponse(content_type='application/vnd.oasis.opendocument.spreadsheet')
    response['Content-Disposition'] = 'attachment; filename="wagalytics.ods"'

    # Write spreadsheet into response
    response.write(io.getvalue())
    return response


================================================
FILE: wagalytics/wagtail_hooks.py
================================================
from django.utils.translation import ugettext_lazy as _

try:
    from wagtail.core import hooks
    from wagtail.admin.menu import MenuItem
except ImportError:  # fallback for Wagtail <2.0
    from wagtail.wagtailcore import hooks
    from wagtail.wagtailadmin.menu import MenuItem

try:
    from django.urls import re_path, include
except ImportError:  # fallback for Django <2.0
    from django.conf.urls import url as re_path
    from django.conf.urls import include

try:
    from django.urls import reverse
except ImportError:  # fallback for Django <1.9
    from django.core.urlresolvers import reverse

from . import urls
from . import views


@hooks.register('register_admin_urls')
def register_admin_urls():
    return [
        re_path(r'^analytics/', include(urls)),
    ]

@hooks.register('register_admin_menu_item')
def register_styleguide_menu_item():
    return MenuItem(
        _('Analytics'),
        reverse('wagalytics_dashboard'),
        classnames='icon icon-fa-bar-chart',
        order=1000
    )
Download .txt
gitextract_vh81vh8u/

├── .gitignore
├── LICENSE
├── MANIFEST.in
├── README.md
├── client/
│   ├── src/
│   │   └── wagalytics.js
│   └── webpack.config.js
├── package.json
├── pytest.ini
├── setup.cfg
├── setup.py
└── wagalytics/
    ├── __init__.py
    ├── static/
    │   └── wagalytics/
    │       ├── .gitkeep
    │       ├── vendors.bundle.js
    │       └── wagalytics.bundle.js
    ├── templates/
    │   └── wagalytics/
    │       └── dashboard.html
    ├── tests/
    │   └── tests.py
    ├── urls.py
    ├── views.py
    └── wagtail_hooks.py
Download .txt
SYMBOL INDEX (266 symbols across 6 files)

FILE: client/src/wagalytics.js
  function setup (line 13) | function setup(token_url, view_id) {
  class Dashboard (line 55) | class Dashboard {
    method constructor (line 56) | constructor(view_id) {
    method setLoading (line 84) | setLoading(id) {
    method refresh (line 92) | refresh() {
    method getQuery (line 104) | getQuery(options) {
    method sessionsLineChart (line 116) | sessionsLineChart() {
    method popularPagesTable (line 172) | popularPagesTable() {
    method topReferrersTable (line 217) | topReferrersTable() {
  function createTable (line 247) | function createTable(headings, rows){
  function paginateTable (line 274) | function paginateTable(table) {
  function query (line 343) | function query(params) {
  function makeCanvas (line 359) | function makeCanvas(id) {
  function generateLegend (line 378) | function generateLegend(id, items) {
  function escapeHtml (line 393) | function escapeHtml(str) {

FILE: wagalytics/static/wagalytics/vendors.bundle.js
  function n (line 1) | function n(s){if(t[s])return t[s].exports;var i=t[s]={i:s,l:!1,exports:{...
  function s (line 1) | function s(){return t.apply(null,arguments)}
  function i (line 1) | function i(e){return e instanceof Array||"[object Array]"===Object.proto...
  function r (line 1) | function r(e){return null!=e&&"[object Object]"===Object.prototype.toStr...
  function a (line 1) | function a(e){return void 0===e}
  function o (line 1) | function o(e){return"number"==typeof e||"[object Number]"===Object.proto...
  function u (line 1) | function u(e){return e instanceof Date||"[object Date]"===Object.prototy...
  function l (line 1) | function l(e,t){var n,s=[];for(n=0;n<e.length;++n)s.push(t(e[n],n));retu...
  function d (line 1) | function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}
  function h (line 1) | function h(e,t){for(var n in t)d(t,n)&&(e[n]=t[n]);return d(t,"toString"...
  function c (line 1) | function c(e,t,n,s){return St(e,t,n,s,!0).utc()}
  function f (line 1) | function f(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unuse...
  function m (line 1) | function m(e){if(null==e._isValid){var t=f(e),s=n.call(t.parsedDateParts...
  function _ (line 1) | function _(e){var t=c(NaN);return null!=e?h(f(t),e):f(t).userInvalidated...
  function g (line 1) | function g(e,t){var n,s,i;if(a(t._isAMomentObject)||(e._isAMomentObject=...
  function v (line 1) | function v(e){g(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),...
  function w (line 1) | function w(e){return e instanceof v||null!=e&&null!=e._isAMomentObject}
  function M (line 1) | function M(e){return e<0?Math.ceil(e)||0:Math.floor(e)}
  function S (line 1) | function S(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=M(t)),n}
  function D (line 1) | function D(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.lengt...
  function k (line 1) | function k(e){!1===s.suppressDeprecationWarnings&&"undefined"!=typeof co...
  function Y (line 1) | function Y(e,t){var n=!0;return h((function(){if(null!=s.deprecationHand...
  function b (line 1) | function b(e,t){null!=s.deprecationHandler&&s.deprecationHandler(e,t),T[...
  function x (line 1) | function x(e){return e instanceof Function||"[object Function]"===Object...
  function P (line 1) | function P(e,t){var n,s=h({},e);for(n in t)d(t,n)&&(r(e[n])&&r(t[n])?(s[...
  function W (line 1) | function W(e){null!=e&&this.set(e)}
  function H (line 1) | function H(e,t){var n=e.toLowerCase();C[n]=C[n+"s"]=C[t]=e}
  function R (line 1) | function R(e){return"string"==typeof e?C[e]||C[e.toLowerCase()]:void 0}
  function F (line 1) | function F(e){var t,n,s={};for(n in e)d(e,n)&&(t=R(n))&&(s[t]=e[n]);retu...
  function U (line 1) | function U(e,t){L[e]=t}
  function N (line 1) | function N(e,t,n){var s=""+Math.abs(e),i=t-s.length;return(e>=0?n?"+":""...
  function I (line 1) | function I(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return thi...
  function A (line 1) | function A(e,t){return e.isValid()?(t=Z(t,e.localeData()),E[t]=E[t]||fun...
  function Z (line 1) | function Z(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(...
  function le (line 1) | function le(e,t,n){ue[e]=x(t)?t:function(e,s){return e&&n?n:t}}
  function de (line 1) | function de(e,t){return d(ue,e)?ue[e](t._strict,t._locale):new RegExp(he...
  function he (line 1) | function he(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}
  function fe (line 1) | function fe(e,t){var n,s=t;for("string"==typeof e&&(e=[e]),o(t)&&(s=func...
  function me (line 1) | function me(e,t){fe(e,(function(e,n,s,i){s._w=s._w||{},t(e,s._w,s,i)}))}
  function _e (line 1) | function _e(e,t,n){null!=t&&d(ce,e)&&ce[e](t,n._a,n,e)}
  function ye (line 1) | function ye(e){return ge(e)?366:365}
  function ge (line 1) | function ge(e){return e%4==0&&e%100!=0||e%400==0}
  function we (line 1) | function we(e,t){return function(n){return null!=n?(Se(this,e,n),s.updat...
  function Me (line 1) | function Me(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():...
  function Se (line 1) | function Se(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&ge(e.year())...
  function De (line 1) | function De(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,s=(t%(n=12)+n)%n...
  function Te (line 1) | function Te(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._monthsPar...
  function be (line 1) | function be(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if...
  function xe (line 1) | function xe(e){return null!=e?(be(this,e),s.updateOffset(this,!0),this):...
  function Ce (line 1) | function Ce(){function e(e,t){return t.length-e.length}var t,n,s=[],i=[]...
  function He (line 1) | function He(e,t,n,s,i,r,a){var o=new Date(e,t,n,s,i,r,a);return e<100&&e...
  function Re (line 1) | function Re(e){var t=new Date(Date.UTC.apply(null,arguments));return e<1...
  function Fe (line 1) | function Fe(e,t,n){var s=7+t-n;return-(7+Re(e,0,s).getUTCDay()-t)%7+s-1}
  function Le (line 1) | function Le(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+Fe(e,s,i);return o<...
  function Ue (line 1) | function Ue(e,t,n){var s,i,r=Fe(e.year(),t,n),a=Math.floor((e.dayOfYear(...
  function Ne (line 1) | function Ne(e,t,n){var s=Fe(e,t,n),i=Fe(e+1,t,n);return(ye(e)-s+i)/7}
  function je (line 1) | function je(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysP...
  function ze (line 1) | function ze(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[...
  function $e (line 1) | function $e(){return this.hours()%12||12}
  function Je (line 1) | function Je(e,t){I(e,0,0,(function(){return this.localeData().meridiem(t...
  function qe (line 1) | function qe(e,t){return t._meridiemParse}
  function tt (line 1) | function tt(e){return e?e.toLowerCase().replace("_","-"):e}
  function nt (line 1) | function nt(t){var n=null;if(!Ke[t]&&void 0!==e&&e&&e.exports)try{n=Be._...
  function st (line 1) | function st(e,t){var n;return e&&((n=a(t)?rt(e):it(e,t))?Be=n:"undefined...
  function it (line 1) | function it(e,t){if(null!==t){var n,s=Xe;if(t.abbr=e,null!=Ke[e])b("defi...
  function rt (line 1) | function rt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abb...
  function at (line 1) | function at(e){var t,n=e._a;return n&&-2===f(e).overflow&&(t=n[1]<0||n[1...
  function ot (line 1) | function ot(e,t,n){return null!=e?e:null!=t?t:n}
  function ut (line 1) | function ut(e){var t,n,i,r,a,o=[];if(!e._d){for(i=function(e){var t=new ...
  function _t (line 1) | function _t(e){var t,n,s,i,r,a,o=e._i,u=lt.exec(o)||dt.exec(o);if(u){for...
  function gt (line 1) | function gt(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}
  function vt (line 1) | function vt(e){var t,n,s,i,r,a,o,u=yt.exec(e._i.replace(/\([^)]*\)|[\n\t...
  function wt (line 1) | function wt(e){if(e._f!==s.ISO_8601)if(e._f!==s.RFC_2822){e._a=[],f(e).e...
  function Mt (line 1) | function Mt(e){var t=e._i,n=e._f;return e._locale=e._locale||rt(e._l),nu...
  function St (line 1) | function St(e,t,n,s,a){var o,u={};return!0!==n&&!1!==n||(s=n,n=void 0),(...
  function Dt (line 1) | function Dt(e,t,n,s){return St(e,t,n,s,!1)}
  function Ot (line 1) | function Ot(e,t){var n,s;if(1===t.length&&i(t[0])&&(t=t[0]),!t.length)re...
  function bt (line 1) | function bt(e){var t=F(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.we...
  function xt (line 1) | function xt(e){return e instanceof bt}
  function Pt (line 1) | function Pt(e){return e<0?-1*Math.round(-1*e):Math.round(e)}
  function Wt (line 1) | function Wt(e,t){I(e,0,0,(function(){var e=this.utcOffset(),n="+";return...
  function Ht (line 1) | function Ht(e,t){var n=(t||"").match(e);if(null===n)return null;var s=((...
  function Rt (line 1) | function Rt(e,t){var n,i;return t._isUTC?(n=t.clone(),i=(w(e)||u(e)?e.va...
  function Ft (line 1) | function Ft(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}
  function Lt (line 1) | function Lt(){return!!this.isValid()&&this._isUTC&&0===this._offset}
  function Gt (line 1) | function Gt(e,t){var n,s,i,r,a,u,l=e,h=null;return xt(e)?l={ms:e._millis...
  function Vt (line 1) | function Vt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)...
  function Et (line 1) | function Et(e,t){var n={milliseconds:0,months:0};return n.months=t.month...
  function jt (line 1) | function jt(e,t){return function(n,s){var i;return null===s||isNaN(+s)||...
  function It (line 1) | function It(e,t,n,i){var r=t._milliseconds,a=Pt(t._days),o=Pt(t._months)...
  function zt (line 1) | function zt(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e....
  function $t (line 1) | function $t(e){var t;return void 0===e?this._locale._abbr:(null!=(t=rt(e...
  function qt (line 1) | function qt(){return this._locale}
  function Bt (line 1) | function Bt(e,t){I(0,[e,e.length],0,t)}
  function Qt (line 1) | function Qt(e,t,n,s,i){var r;return null==e?Ue(this,s,i).year:(t>(r=Ne(e...
  function Xt (line 1) | function Xt(e,t,n,s,i){var r=Le(e,t,n,s,i),a=Re(r.year,0,r.dayOfYear);re...
  function sn (line 1) | function sn(e,t){t[6]=S(1e3*("0."+e))}
  function on (line 1) | function on(e){return e}
  function ln (line 1) | function ln(e,t,n,s){var i=rt(),r=c().set(s,t);return i[n](r,e)}
  function dn (line 1) | function dn(e,t,n){if(o(e)&&(t=e,e=void 0),e=e||"",null!=t)return ln(e,t...
  function hn (line 1) | function hn(e,t,n,s){"boolean"==typeof e?(o(t)&&(n=t,t=void 0),t=t||""):...
  function fn (line 1) | function fn(e,t,n,s){var i=Gt(t,n);return e._milliseconds+=s*i._millisec...
  function mn (line 1) | function mn(e){return e<0?Math.floor(e):Math.ceil(e)}
  function _n (line 1) | function _n(e){return 4800*e/146097}
  function yn (line 1) | function yn(e){return 146097*e/4800}
  function gn (line 1) | function gn(e){return function(){return this.as(e)}}
  function On (line 1) | function On(e){return function(){return this.isValid()?this._data[e]:NaN}}
  function Ln (line 1) | function Ln(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}
  function Nn (line 1) | function Nn(e){return(e>0)-(e<0)||+e}
  function Gn (line 1) | function Gn(){if(!this.isValid())return this.localeData().invalidDate();...

FILE: wagalytics/static/wagalytics/wagalytics.bundle.js
  function n (line 1) | function n(i){if(t[i])return t[i].exports;var s=t[i]={i:i,l:!1,exports:{...
  function i (line 1) | function i(){return t.apply(null,arguments)}
  function s (line 1) | function s(e){return e instanceof Array||"[object Array]"===Object.proto...
  function r (line 1) | function r(e){return null!=e&&"[object Object]"===Object.prototype.toStr...
  function a (line 1) | function a(e){return void 0===e}
  function o (line 1) | function o(e){return"number"==typeof e||"[object Number]"===Object.proto...
  function u (line 1) | function u(e){return e instanceof Date||"[object Date]"===Object.prototy...
  function l (line 1) | function l(e,t){var n,i=[];for(n=0;n<e.length;++n)i.push(t(e[n],n));retu...
  function d (line 1) | function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}
  function h (line 1) | function h(e,t){for(var n in t)d(t,n)&&(e[n]=t[n]);return d(t,"toString"...
  function c (line 1) | function c(e,t,n,i){return St(e,t,n,i,!0).utc()}
  function f (line 1) | function f(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unuse...
  function m (line 1) | function m(e){if(null==e._isValid){var t=f(e),i=n.call(t.parsedDateParts...
  function _ (line 1) | function _(e){var t=c(NaN);return null!=e?h(f(t),e):f(t).userInvalidated...
  function g (line 1) | function g(e,t){var n,i,s;if(a(t._isAMomentObject)||(e._isAMomentObject=...
  function v (line 1) | function v(e){g(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),...
  function w (line 1) | function w(e){return e instanceof v||null!=e&&null!=e._isAMomentObject}
  function M (line 1) | function M(e){return e<0?Math.ceil(e)||0:Math.floor(e)}
  function S (line 1) | function S(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=M(t)),n}
  function k (line 1) | function k(e,t,n){var i,s=Math.min(e.length,t.length),r=Math.abs(e.lengt...
  function D (line 1) | function D(e){!1===i.suppressDeprecationWarnings&&"undefined"!=typeof co...
  function Y (line 1) | function Y(e,t){var n=!0;return h((function(){if(null!=i.deprecationHand...
  function T (line 1) | function T(e,t){null!=i.deprecationHandler&&i.deprecationHandler(e,t),O[...
  function x (line 1) | function x(e){return e instanceof Function||"[object Function]"===Object...
  function P (line 1) | function P(e,t){var n,i=h({},e);for(n in t)d(t,n)&&(r(e[n])&&r(t[n])?(i[...
  function C (line 1) | function C(e){null!=e&&this.set(e)}
  function L (line 1) | function L(e,t){var n=e.toLowerCase();W[n]=W[n+"s"]=W[t]=e}
  function H (line 1) | function H(e){return"string"==typeof e?W[e]||W[e.toLowerCase()]:void 0}
  function R (line 1) | function R(e){var t,n,i={};for(n in e)d(e,n)&&(t=H(n))&&(i[t]=e[n]);retu...
  function E (line 1) | function E(e,t){F[e]=t}
  function N (line 1) | function N(e,t,n){var i=""+Math.abs(e),s=t-i.length;return(e>=0?n?"+":""...
  function j (line 1) | function j(e,t,n,i){var s=i;"string"==typeof i&&(s=function(){return thi...
  function A (line 1) | function A(e,t){return e.isValid()?(t=z(t,e.localeData()),V[t]=V[t]||fun...
  function z (line 1) | function z(e,t){var n=5;function i(e){return t.longDateFormat(e)||e}for(...
  function le (line 1) | function le(e,t,n){ue[e]=x(t)?t:function(e,i){return e&&n?n:t}}
  function de (line 1) | function de(e,t){return d(ue,e)?ue[e](t._strict,t._locale):new RegExp(he...
  function he (line 1) | function he(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}
  function fe (line 1) | function fe(e,t){var n,i=t;for("string"==typeof e&&(e=[e]),o(t)&&(i=func...
  function me (line 1) | function me(e,t){fe(e,(function(e,n,i,s){i._w=i._w||{},t(e,i._w,i,s)}))}
  function _e (line 1) | function _e(e,t,n){null!=t&&d(ce,e)&&ce[e](t,n._a,n,e)}
  function ye (line 1) | function ye(e){return ge(e)?366:365}
  function ge (line 1) | function ge(e){return e%4==0&&e%100!=0||e%400==0}
  function we (line 1) | function we(e,t){return function(n){return null!=n?(Se(this,e,n),i.updat...
  function Me (line 1) | function Me(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():...
  function Se (line 1) | function Se(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&ge(e.year())...
  function ke (line 1) | function ke(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,i=(t%(n=12)+n)%n...
  function Oe (line 1) | function Oe(e,t,n){var i,s,r,a=e.toLocaleLowerCase();if(!this._monthsPar...
  function Te (line 1) | function Te(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if...
  function xe (line 1) | function xe(e){return null!=e?(Te(this,e),i.updateOffset(this,!0),this):...
  function We (line 1) | function We(){function e(e,t){return t.length-e.length}var t,n,i=[],s=[]...
  function Le (line 1) | function Le(e,t,n,i,s,r,a){var o=new Date(e,t,n,i,s,r,a);return e<100&&e...
  function He (line 1) | function He(e){var t=new Date(Date.UTC.apply(null,arguments));return e<1...
  function Re (line 1) | function Re(e,t,n){var i=7+t-n;return-(7+He(e,0,i).getUTCDay()-t)%7+i-1}
  function Fe (line 1) | function Fe(e,t,n,i,s){var r,a,o=1+7*(t-1)+(7+n-i)%7+Re(e,i,s);return o<...
  function Ee (line 1) | function Ee(e,t,n){var i,s,r=Re(e.year(),t,n),a=Math.floor((e.dayOfYear(...
  function Ne (line 1) | function Ne(e,t,n){var i=Re(e,t,n),s=Re(e+1,t,n);return(ye(e)-i+s)/7}
  function Ge (line 1) | function Ge(e,t,n){var i,s,r,a=e.toLocaleLowerCase();if(!this._weekdaysP...
  function Ze (line 1) | function Ze(){function e(e,t){return t.length-e.length}var t,n,i,s,r,a=[...
  function $e (line 1) | function $e(){return this.hours()%12||12}
  function Be (line 1) | function Be(e,t){j(e,0,0,(function(){return this.localeData().meridiem(t...
  function Je (line 1) | function Je(e,t){return t._meridiemParse}
  function tt (line 1) | function tt(e){return e?e.toLowerCase().replace("_","-"):e}
  function nt (line 1) | function nt(t){var n=null;if(!Ke[t]&&void 0!==e&&e&&e.exports)try{n=qe._...
  function it (line 1) | function it(e,t){var n;return e&&((n=a(t)?rt(e):st(e,t))?qe=n:"undefined...
  function st (line 1) | function st(e,t){if(null!==t){var n,i=Xe;if(t.abbr=e,null!=Ke[e])T("defi...
  function rt (line 1) | function rt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abb...
  function at (line 1) | function at(e){var t,n=e._a;return n&&-2===f(e).overflow&&(t=n[1]<0||n[1...
  function ot (line 1) | function ot(e,t,n){return null!=e?e:null!=t?t:n}
  function ut (line 1) | function ut(e){var t,n,s,r,a,o=[];if(!e._d){for(s=function(e){var t=new ...
  function _t (line 1) | function _t(e){var t,n,i,s,r,a,o=e._i,u=lt.exec(o)||dt.exec(o);if(u){for...
  function gt (line 1) | function gt(e){var t=parseInt(e,10);return t<=49?2e3+t:t<=999?1900+t:t}
  function vt (line 1) | function vt(e){var t,n,i,s,r,a,o,u=yt.exec(e._i.replace(/\([^)]*\)|[\n\t...
  function wt (line 1) | function wt(e){if(e._f!==i.ISO_8601)if(e._f!==i.RFC_2822){e._a=[],f(e).e...
  function Mt (line 1) | function Mt(e){var t=e._i,n=e._f;return e._locale=e._locale||rt(e._l),nu...
  function St (line 1) | function St(e,t,n,i,a){var o,u={};return!0!==n&&!1!==n||(i=n,n=void 0),(...
  function kt (line 1) | function kt(e,t,n,i){return St(e,t,n,i,!1)}
  function bt (line 1) | function bt(e,t){var n,i;if(1===t.length&&s(t[0])&&(t=t[0]),!t.length)re...
  function Tt (line 1) | function Tt(e){var t=R(e),n=t.year||0,i=t.quarter||0,s=t.month||0,r=t.we...
  function xt (line 1) | function xt(e){return e instanceof Tt}
  function Pt (line 1) | function Pt(e){return e<0?-1*Math.round(-1*e):Math.round(e)}
  function Ct (line 1) | function Ct(e,t){j(e,0,0,(function(){var e=this.utcOffset(),n="+";return...
  function Lt (line 1) | function Lt(e,t){var n=(t||"").match(e);if(null===n)return null;var i=((...
  function Ht (line 1) | function Ht(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(w(e)||u(e)?e.va...
  function Rt (line 1) | function Rt(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}
  function Ft (line 1) | function Ft(){return!!this.isValid()&&this._isUTC&&0===this._offset}
  function Ut (line 1) | function Ut(e,t){var n,i,s,r,a,u,l=e,h=null;return xt(e)?l={ms:e._millis...
  function It (line 1) | function It(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)...
  function Vt (line 1) | function Vt(e,t){var n={milliseconds:0,months:0};return n.months=t.month...
  function Gt (line 1) | function Gt(e,t){return function(n,i){var s;return null===i||isNaN(+i)||...
  function jt (line 1) | function jt(e,t,n,s){var r=t._milliseconds,a=Pt(t._days),o=Pt(t._months)...
  function Zt (line 1) | function Zt(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),i=e....
  function $t (line 1) | function $t(e){var t;return void 0===e?this._locale._abbr:(null!=(t=rt(e...
  function Jt (line 1) | function Jt(){return this._locale}
  function qt (line 1) | function qt(e,t){j(0,[e,e.length],0,t)}
  function Qt (line 1) | function Qt(e,t,n,i,s){var r;return null==e?Ee(this,i,s).year:(t>(r=Ne(e...
  function Xt (line 1) | function Xt(e,t,n,i,s){var r=Fe(e,t,n,i,s),a=He(r.year,0,r.dayOfYear);re...
  function sn (line 1) | function sn(e,t){t[6]=S(1e3*("0."+e))}
  function on (line 1) | function on(e){return e}
  function ln (line 1) | function ln(e,t,n,i){var s=rt(),r=c().set(i,t);return s[n](r,e)}
  function dn (line 1) | function dn(e,t,n){if(o(e)&&(t=e,e=void 0),e=e||"",null!=t)return ln(e,t...
  function hn (line 1) | function hn(e,t,n,i){"boolean"==typeof e?(o(t)&&(n=t,t=void 0),t=t||""):...
  function fn (line 1) | function fn(e,t,n,i){var s=Ut(t,n);return e._milliseconds+=i*s._millisec...
  function mn (line 1) | function mn(e){return e<0?Math.floor(e):Math.ceil(e)}
  function _n (line 1) | function _n(e){return 4800*e/146097}
  function yn (line 1) | function yn(e){return 146097*e/4800}
  function gn (line 1) | function gn(e){return function(){return this.as(e)}}
  function bn (line 1) | function bn(e){return function(){return this.isValid()?this._data[e]:NaN}}
  function Fn (line 1) | function Fn(e,t,n,i,s){return s.relativeTime(t||1,!!n,e,i)}
  function Nn (line 1) | function Nn(e){return(e>0)-(e<0)||+e}
  function Un (line 1) | function Un(){if(!this.isValid())return this.localeData().invalidDate();...
  function r (line 1) | function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.en...
  function e (line 1) | function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new T...
  function l (line 1) | function l(e,t){var n=document.createElement("table");n.className="listi...
  function d (line 1) | function d(e){var t=0,n=$(e);n.bind("repaginate",(function(){n.find("tbo...

FILE: wagalytics/tests/tests.py
  class TestWagalyticsDashboard (line 15) | class TestWagalyticsDashboard(TestCase, WagtailTestUtils):
    method setUp (line 17) | def setUp(self):
    method _clean_wagalytics_keys (line 24) | def _clean_wagalytics_keys(self):
    method _use_single_site_settings (line 35) | def _use_single_site_settings(self):
    method _use_multi_site_settings (line 42) | def _use_multi_site_settings(self):
    method test_dashboard_view (line 57) | def test_dashboard_view(self):
    method test_dashboard_404_view (line 63) | def test_dashboard_404_view(self):
    method test_single_site_missing_keys (line 67) | def test_single_site_missing_keys(self):
    method test_single_site_no_siteswitcher (line 75) | def test_single_site_no_siteswitcher(self):
    method test_single_site_dashboard (line 81) | def test_single_site_dashboard(self):
    method test_single_site_dashboard_on_multisite_url (line 87) | def test_single_site_dashboard_on_multisite_url(self):
    method test_multi_site_dashboard (line 98) | def test_multi_site_dashboard(self):
    method test_multi_site_siteswitcher (line 111) | def test_multi_site_siteswitcher(self):
    method test_multi_site_dashboard_change_site (line 118) | def test_multi_site_dashboard_change_site(self):
    method test_multi_site_token_no_api_keys (line 126) | def test_multi_site_token_no_api_keys(self):
    method test_single_site_token_no_api_keys (line 133) | def test_single_site_token_no_api_keys(self):
    method test_multi_site_token_using_single_site_api_keys (line 140) | def test_multi_site_token_using_single_site_api_keys(self):
    method test_multi_site_token_using_multi_site_api_keys (line 146) | def test_multi_site_token_using_multi_site_api_keys(self):

FILE: wagalytics/views.py
  class SiteSwitchForm (line 18) | class SiteSwitchForm(SettingsSiteSwitchForm):
    method get_change_url (line 22) | def get_change_url(cls, site, model):
  function get_access_token (line 27) | def get_access_token(ga_key_filepath):
  function get_access_token_from_str (line 45) | def get_access_token_from_str(ga_key_content):
  function token (line 64) | def token(request, site_id=None):
  function dashboard (line 94) | def dashboard(request, site_id=None):
  function export (line 165) | def export(request):

FILE: wagalytics/wagtail_hooks.py
  function register_admin_urls (line 26) | def register_admin_urls():
  function register_styleguide_menu_item (line 32) | def register_styleguide_menu_item():
Condensed preview — 19 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (163K chars).
[
  {
    "path": ".gitignore",
    "chars": 67,
    "preview": "dist/\nbuild/\n*.pyc\n.DS_Store\n*.egg-info\nnpm-debug.log\nnode_modules\n"
  },
  {
    "path": "LICENSE",
    "chars": 1066,
    "preview": "MIT License\n\nCopyright (c) 2017 Tom Dyson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\n"
  },
  {
    "path": "MANIFEST.in",
    "chars": 68,
    "preview": "graft wagalytics\nglobal-exclude __pycache__\nglobal-exclude *.py[co]\n"
  },
  {
    "path": "README.md",
    "chars": 4327,
    "preview": "# Wagtail Analytics\n\n(Last Updated 12/17/19 for Wagtail v2.x)\n\nThis module provides a simple dashboard of Google Analyti"
  },
  {
    "path": "client/src/wagalytics.js",
    "chars": 13188,
    "preview": "import moment from 'moment';\n\n$(document).ready(() => {\n    const el = document.getElementById('wagalytics-data');\n    s"
  },
  {
    "path": "client/webpack.config.js",
    "chars": 891,
    "preview": "var path = require('path');\nvar webpack = require('webpack');\n\nmodule.exports = {\n  context: __dirname,\n  entry: {\n    w"
  },
  {
    "path": "package.json",
    "chars": 1690,
    "preview": "{\n  \"name\": \"wagalytics\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"ht"
  },
  {
    "path": "pytest.ini",
    "chars": 105,
    "preview": "[pytest]\nDJANGO_SETTINGS_MODULE = wagalytics.tests.settings\npython_files = tests.py test_*.py *_tests.py\n"
  },
  {
    "path": "setup.cfg",
    "chars": 67,
    "preview": "[metadata]\ndescription-file = README.md\n\n[bdist_wheel]\nuniversal=1\n"
  },
  {
    "path": "setup.py",
    "chars": 1403,
    "preview": "from os import path\n\nfrom setuptools import setup, find_packages\n\ntry:\n    from wagtail.utils.setup import sdist\n    cmd"
  },
  {
    "path": "wagalytics/__init__.py",
    "chars": 20,
    "preview": "__version__ = '1.3'\n"
  },
  {
    "path": "wagalytics/static/wagalytics/.gitkeep",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "wagalytics/static/wagalytics/vendors.bundle.js",
    "chars": 53013,
    "preview": "!function(e){var t={};function n(s){if(t[s])return t[s].exports;var i=t[s]={i:s,l:!1,exports:{}};return e[s].call(i.expo"
  },
  {
    "path": "wagalytics/static/wagalytics/wagalytics.bundle.js",
    "chars": 58809,
    "preview": "!function(e){var t={};function n(i){if(t[i])return t[i].exports;var s=t[i]={i:i,l:!1,exports:{}};return e[i].call(s.expo"
  },
  {
    "path": "wagalytics/templates/wagalytics/dashboard.html",
    "chars": 5247,
    "preview": "{% extends \"wagtailadmin/base.html\" %}\n{% load wagtailadmin_tags i18n static %}\n\n{% block extra_css %}\n    {% include \"w"
  },
  {
    "path": "wagalytics/tests/tests.py",
    "chars": 6089,
    "preview": "import pytest\n\nfrom django.conf import settings\nfrom django.test import TestCase\nfrom django.urls import reverse\n\nfrom w"
  },
  {
    "path": "wagalytics/urls.py",
    "chars": 546,
    "preview": "from __future__ import absolute_import, unicode_literals\nfrom django.urls import path\nfrom django.views.decorators.cache"
  },
  {
    "path": "wagalytics/views.py",
    "chars": 8374,
    "preview": "import json\nimport datetime\nfrom io import BytesIO\nfrom oauth2client.service_account import ServiceAccountCredentials\nfr"
  },
  {
    "path": "wagalytics/wagtail_hooks.py",
    "chars": 1023,
    "preview": "from django.utils.translation import ugettext_lazy as _\n\ntry:\n    from wagtail.core import hooks\n    from wagtail.admin."
  }
]

About this extraction

This page contains the full source code of the tomdyson/wagalytics GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 19 files (152.3 KB), approximately 52.2k tokens, and a symbol index with 266 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!