HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/ehbo.today/wwwroot/js/site/app.js
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

(function (global, factory) {
    (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? factory() : typeof define === 'function' && define.amd ? define(factory) : factory();
})(this, function () {
    'use strict';

    /**
     * @this {Promise}
     */

    function finallyConstructor(callback) {
        var constructor = this.constructor;
        return this.then(function (value) {
            return constructor.resolve(callback()).then(function () {
                return value;
            });
        }, function (reason) {
            return constructor.resolve(callback()).then(function () {
                return constructor.reject(reason);
            });
        });
    }

    // Store setTimeout reference so promise-polyfill will be unaffected by
    // other code modifying setTimeout (like sinon.useFakeTimers())
    var setTimeoutFunc = setTimeout;

    function noop() {}

    // Polyfill for Function.prototype.bind
    function bind(fn, thisArg) {
        return function () {
            fn.apply(thisArg, arguments);
        };
    }

    /**
     * @constructor
     * @param {Function} fn
     */
    function Promise(fn) {
        if (!(this instanceof Promise)) throw new TypeError('Promises must be constructed via new');
        if (typeof fn !== 'function') throw new TypeError('not a function');
        /** @type {!number} */
        this._state = 0;
        /** @type {!boolean} */
        this._handled = false;
        /** @type {Promise|undefined} */
        this._value = undefined;
        /** @type {!Array<!Function>} */
        this._deferreds = [];

        doResolve(fn, this);
    }

    function handle(self, deferred) {
        while (self._state === 3) {
            self = self._value;
        }
        if (self._state === 0) {
            self._deferreds.push(deferred);
            return;
        }
        self._handled = true;
        Promise._immediateFn(function () {
            var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
            if (cb === null) {
                (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
                return;
            }
            var ret;
            try {
                ret = cb(self._value);
            } catch (e) {
                reject(deferred.promise, e);
                return;
            }
            resolve(deferred.promise, ret);
        });
    }

    function resolve(self, newValue) {
        try {
            // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
            if (newValue === self) throw new TypeError('A promise cannot be resolved with itself.');
            if (newValue && ((typeof newValue === 'undefined' ? 'undefined' : _typeof(newValue)) === 'object' || typeof newValue === 'function')) {
                var then = newValue.then;
                if (newValue instanceof Promise) {
                    self._state = 3;
                    self._value = newValue;
                    finale(self);
                    return;
                } else if (typeof then === 'function') {
                    doResolve(bind(then, newValue), self);
                    return;
                }
            }
            self._state = 1;
            self._value = newValue;
            finale(self);
        } catch (e) {
            reject(self, e);
        }
    }

    function reject(self, newValue) {
        self._state = 2;
        self._value = newValue;
        finale(self);
    }

    function finale(self) {
        if (self._state === 2 && self._deferreds.length === 0) {
            Promise._immediateFn(function () {
                if (!self._handled) {
                    Promise._unhandledRejectionFn(self._value);
                }
            });
        }

        for (var i = 0, len = self._deferreds.length; i < len; i++) {
            handle(self, self._deferreds[i]);
        }
        self._deferreds = null;
    }

    /**
     * @constructor
     */
    function Handler(onFulfilled, onRejected, promise) {
        this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
        this.onRejected = typeof onRejected === 'function' ? onRejected : null;
        this.promise = promise;
    }

    /**
     * Take a potentially misbehaving resolver function and make sure
     * onFulfilled and onRejected are only called once.
     *
     * Makes no guarantees about asynchrony.
     */
    function doResolve(fn, self) {
        var done = false;
        try {
            fn(function (value) {
                if (done) return;
                done = true;
                resolve(self, value);
            }, function (reason) {
                if (done) return;
                done = true;
                reject(self, reason);
            });
        } catch (ex) {
            if (done) return;
            done = true;
            reject(self, ex);
        }
    }

    Promise.prototype['catch'] = function (onRejected) {
        return this.then(null, onRejected);
    };

    Promise.prototype.then = function (onFulfilled, onRejected) {
        // @ts-ignore
        var prom = new this.constructor(noop);

        handle(this, new Handler(onFulfilled, onRejected, prom));
        return prom;
    };

    Promise.prototype['finally'] = finallyConstructor;

    Promise.all = function (arr) {
        return new Promise(function (resolve, reject) {
            if (!arr || typeof arr.length === 'undefined') throw new TypeError('Promise.all accepts an array');
            var args = Array.prototype.slice.call(arr);
            if (args.length === 0) return resolve([]);
            var remaining = args.length;

            function res(i, val) {
                try {
                    if (val && ((typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object' || typeof val === 'function')) {
                        var then = val.then;
                        if (typeof then === 'function') {
                            then.call(val, function (val) {
                                res(i, val);
                            }, reject);
                            return;
                        }
                    }
                    args[i] = val;
                    if (--remaining === 0) {
                        resolve(args);
                    }
                } catch (ex) {
                    reject(ex);
                }
            }

            for (var i = 0; i < args.length; i++) {
                res(i, args[i]);
            }
        });
    };

    Promise.resolve = function (value) {
        if (value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.constructor === Promise) {
            return value;
        }

        return new Promise(function (resolve) {
            resolve(value);
        });
    };

    Promise.reject = function (value) {
        return new Promise(function (resolve, reject) {
            reject(value);
        });
    };

    Promise.race = function (values) {
        return new Promise(function (resolve, reject) {
            for (var i = 0, len = values.length; i < len; i++) {
                values[i].then(resolve, reject);
            }
        });
    };

    // Use polyfill for setImmediate for performance gains
    Promise._immediateFn = typeof setImmediate === 'function' && function (fn) {
        setImmediate(fn);
    } || function (fn) {
        setTimeoutFunc(fn, 0);
    };

    Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
        if (typeof console !== 'undefined' && console) {
            console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
        }
    };

    /** @suppress {undefinedVars} */
    var globalNS = function () {
        // the only reliable means to get the global object is
        // `Function('return this')()`
        // However, this causes CSP violations in Chrome apps.
        if (typeof self !== 'undefined') {
            return self;
        }
        if (typeof window !== 'undefined') {
            return window;
        }
        if (typeof global !== 'undefined') {
            return global;
        }
        throw new Error('unable to locate global object');
    }();

    if (!('Promise' in globalNS)) {
        globalNS['Promise'] = Promise;
    } else if (!globalNS.Promise.prototype['finally']) {
        globalNS.Promise.prototype['finally'] = finallyConstructor;
    }
});
!function (global, factory) {
    "use strict";
    "object" == (typeof module === 'undefined' ? 'undefined' : _typeof(module)) && "object" == _typeof(module.exports) ? module.exports = factory(global) : factory(global);
}("undefined" != typeof window ? window : global, function (global) {
    "use strict";
    var defineProperty = Object.defineProperty,
        defineProperties = Object.defineProperties,
        symbolHiddenCounter = 0,
        globalSymbolRegistry = [],
        slice = Array.prototype.slice,
        ES6 = "object" == _typeof(global.ES6) ? global.ES6 : global.ES6 = {},
        isArray = Array.isArray,
        objectToString = Object.prototype.toString,
        push = Array.prototype.push,
        emptyFunction = function emptyFunction() {},
        simpleFunction = function simpleFunction(arg) {
        return arg;
    },
        isCallable = function isCallable(fn) {
        return "function" == typeof fn;
    },
        Iterator = function Iterator() {},
        ArrayIterator = function ArrayIterator(array, flag) {
        this._array = array, this._flag = flag, this._nextIndex = 0;
    },
        StringIterator = function StringIterator(string, flag) {
        this._string = string, this._flag = flag, this._nextIndex = 0;
    },
        isObject = function isObject(value) {
        return null !== value && ("object" == (typeof value === 'undefined' ? 'undefined' : _typeof(value)) || "function" == typeof value);
    },
        setupSymbolInternals = function setupSymbolInternals(symbol, desc) {
        return defineProperties(symbol, { _description: { value: desc }, _isSymbol: { value: !0 }, _id: { value: symbolHiddenCounter++ } }), symbol;
    },
        appendArray = function appendArray(array1, array2) {
        if ("number" == typeof array1.length && array1.length >= 0 && "number" == typeof array2.length && array2.length >= 0) {
            var length1 = Math.floor(array1.length),
                length2 = Math.floor(array2.length),
                i = 0;for (array1.length = length1 + length2; i < length2; ++i) {
                array2.hasOwnProperty(i) && (array1[length1 + i] = array2[i]);
            }
        }
    },
        simpleInheritance = function simpleInheritance(child, parent) {
        if ("function" != typeof child || "function" != typeof parent) throw new TypeError("Child and Parent must be function type");child.prototype = Object.create(parent.prototype), child.prototype.constructor = child;
    },
        _Symbol = function _Symbol2(desc) {
        if (desc = void 0 === desc ? "" : String(desc), this instanceof _Symbol2) throw new TypeError("Symbol is not a constructor");return setupSymbolInternals(Object.create(_Symbol2.prototype), desc);
    };defineProperties(_Symbol, { for: { value: function value(key) {
                key = String(key);for (var record, registryLength = globalSymbolRegistry.length, i = 0; i < registryLength; ++i) {
                    if ((record = globalSymbolRegistry[i]).key === key) return record.symbol;
                }return record = { key: key, symbol: _Symbol(key) }, globalSymbolRegistry.push(record), record.symbol;
            }, writable: !0, configurable: !0 }, keyFor: { value: function value(symbol) {
                if (!ES6.isSymbol(symbol)) throw new TypeError(String(symbol) + " is not a symbol");for (var record, registryLength = globalSymbolRegistry.length, i = 0; i < registryLength; ++i) {
                    if ((record = globalSymbolRegistry[i]).symbol === symbol) return record.key;
                }
            }, writable: !0, configurable: !0 }, hasInstance: { value: _Symbol("Symbol.hasInstance") }, isConcatSpreadable: { value: _Symbol("Symbol.isConcatSpreadable") }, iterator: { value: _Symbol("Symbol.iterator") }, toStringTag: { value: _Symbol("Symbol.toStringTag") } }), _Symbol.prototype.toString = function () {
        return "@@_____" + this._id + "_____";
    }, _Symbol.prototype.valueOf = function () {
        return this;
    }, defineProperty(Iterator.prototype, _Symbol.iterator.toString(), { value: function value() {
            return this;
        }, writable: !0, configurable: !0 }), simpleInheritance(ArrayIterator, Iterator), simpleInheritance(StringIterator, Iterator), defineProperty(ArrayIterator.prototype, _Symbol.toStringTag.toString(), { value: "Array Iterator", configurable: !0 }), defineProperty(StringIterator.prototype, _Symbol.toStringTag.toString(), { value: "String Iterator", configurable: !0 }), ArrayIterator.prototype.next = function () {
        if (!(this instanceof ArrayIterator)) throw new TypeError("Method Array Iterator.prototype.next called on incompatible receiver " + String(this));var nextValue;return -1 === this._nextIndex ? { done: !0, value: void 0 } : "number" == typeof this._array.length && this._array.length >= 0 && this._nextIndex < Math.floor(this._array.length) ? (1 === this._flag ? nextValue = [this._nextIndex, this._array[this._nextIndex]] : 2 === this._flag ? nextValue = this._array[this._nextIndex] : 3 === this._flag && (nextValue = this._nextIndex), this._nextIndex++, { done: !1, value: nextValue }) : (this._nextIndex = -1, { done: !0, value: void 0 });
    }, StringIterator.prototype.next = function () {
        if (!(this instanceof StringIterator)) throw new TypeError("Method String Iterator.prototype.next called on incompatible receiver " + String(this));var nextValue,
            stringObject = new String(this._string);return -1 === this._nextIndex ? { done: !0, value: void 0 } : this._nextIndex < stringObject.length ? (nextValue = stringObject[this._nextIndex], this._nextIndex++, { done: !1, value: nextValue }) : (this._nextIndex = -1, { done: !0, value: void 0 });
    };var SpreadOperatorImpl = function SpreadOperatorImpl(target, thisArg) {
        this._target = target, this._values = [], this._thisArg = thisArg;
    };SpreadOperatorImpl.prototype.spread = function () {
        var self = this;return slice.call(arguments).forEach(function (iterable) {
            ES6.forOf(iterable, function (value) {
                self._values.push(value);
            });
        }), self;
    }, SpreadOperatorImpl.prototype.add = function () {
        var self = this;return slice.call(arguments).forEach(function (value) {
            self._values.push(value);
        }), self;
    }, SpreadOperatorImpl.prototype.call = function (thisArg) {
        if ("function" != typeof this._target) throw new TypeError("Target is not a function");return thisArg = arguments.length <= 0 ? this._thisArg : thisArg, this._target.apply(thisArg, this._values);
    }, SpreadOperatorImpl.prototype.new = function () {
        if ("function" != typeof this._target) throw new TypeError("Target is not a constructor");var temp, returnValue;return temp = Object.create(this._target.prototype), returnValue = this._target.apply(temp, this._values), isObject(returnValue) ? returnValue : temp;
    }, SpreadOperatorImpl.prototype.array = function () {
        if (!isArray(this._target)) throw new TypeError("Target is not a array");return push.apply(this._target, this._values), this._target;
    };return defineProperties(ES6, { isSymbol: { value: function value(symbol) {
                return symbol instanceof _Symbol && function (symbol) {
                    return !0 === symbol._isSymbol && "number" == typeof symbol._id && "string" == typeof symbol._description;
                }(symbol);
            }, writable: !0, configurable: !0 }, instanceOf: { value: function value(object, constructor) {
                if (!isObject(constructor)) throw new TypeError("Right-hand side of 'instanceof' is not an object");var hasInstanceSymbolProp = constructor[_Symbol.hasInstance];if (void 0 === hasInstanceSymbolProp) return object instanceof constructor;if ("function" != typeof hasInstanceSymbolProp) throw new TypeError((typeof hasInstanceSymbolProp === 'undefined' ? 'undefined' : _typeof(hasInstanceSymbolProp)) + " is not a function");return hasInstanceSymbolProp.call(constructor, object);
            }, writable: !0, configurable: !0 }, forOf: { value: function value(iterable, callback, thisArg) {
                if (callback = "function" != typeof callback ? emptyFunction : callback, "function" != typeof iterable[_Symbol.iterator]) throw new TypeError("Iterable[Symbol.iterator] is not a function");var iterationResult,
                    iterator = iterable[_Symbol.iterator]();if ("function" != typeof iterator.next) throw new TypeError(".iterator.next is not a function");for (;;) {
                    if (iterationResult = iterator.next(), !isObject(iterationResult)) throw new TypeError("Iterator result " + iterationResult + " is not an object");if (iterationResult.done) break;callback.call(thisArg, iterationResult.value);
                }
            }, writable: !0, configurable: !0 }, spreadOperator: { value: function value(target, thisArg) {
                if ("function" != typeof target && !isArray(target)) throw new TypeError("Spread operator only supports on array and function objects at this moment");return new SpreadOperatorImpl(target, thisArg);
            }, writable: !0, configurable: !0 } }), defineProperty(global, "Symbol", { value: _Symbol, writable: !0, configurable: !0 }), defineProperty(Function.prototype, _Symbol.hasInstance.toString(), { value: function value(instance) {
            return "function" == typeof this && instance instanceof this;
        } }), defineProperty(Array.prototype, "concat", { value: function value() {
            if (void 0 === this || null === this) throw new TypeError("Array.prototype.concat called on null or undefined");var self = Object(this),
                targets = slice.call(arguments),
                outputs = [];return targets.unshift(self), targets.forEach(function (target) {
                isObject(target) ? void 0 !== target[_Symbol.isConcatSpreadable] ? target[_Symbol.isConcatSpreadable] ? appendArray(outputs, target) : outputs.push(target) : isArray(target) ? appendArray(outputs, target) : outputs.push(target) : outputs.push(target);
            }), outputs;
        }, writable: !0, configurable: !0 }), defineProperty(Object.prototype, "toString", { value: function value() {
            return void 0 === this || null === this ? objectToString.call(this) : "string" == typeof this[_Symbol.toStringTag] ? "[object " + this[_Symbol.toStringTag] + "]" : objectToString.call(this);
        }, writable: !0, configurable: !0 }), defineProperty(Array.prototype, _Symbol.iterator.toString(), { value: function value() {
            if (void 0 === this || null === this) throw new TypeError("Cannot convert undefined or null to object");var self = Object(this);return new ArrayIterator(self, 2);
        }, writable: !0, configurable: !0 }), defineProperty(Array, "from", { value: function value(arrayLike, mapFn, thisArg) {
            var constructor,
                length,
                outputs,
                i = 0;if (constructor = isCallable(this) ? this : Array, void 0 === arrayLike || null === arrayLike) throw new TypeError("Cannot convert undefined or null to object");if (arrayLike = Object(arrayLike), void 0 === mapFn) mapFn = simpleFunction;else if (!isCallable(mapFn)) throw new TypeError(mapFn + " is not a function");if (void 0 === arrayLike[_Symbol.iterator]) {
                if (!("number" == typeof arrayLike.length && arrayLike.length >= 0)) return (outputs = new constructor(0)).length = 0, outputs;for (length = Math.floor(arrayLike.length), (outputs = new constructor(length)).length = length; i < length; ++i) {
                    outputs[i] = mapFn.call(thisArg, arrayLike[i]);
                }
            } else (outputs = new constructor()).length = 0, ES6.forOf(arrayLike, function (value) {
                outputs.length++, outputs[outputs.length - 1] = mapFn.call(thisArg, value);
            });return outputs;
        }, writable: !0, configurable: !0 }), defineProperty(Array.prototype, "entries", { value: function value() {
            if (void 0 === this || null === this) throw new TypeError("Cannot convert undefined or null to object");var self = Object(this);return new ArrayIterator(self, 1);
        }, writable: !0, configurable: !0 }), defineProperty(Array.prototype, "keys", { value: function value() {
            if (void 0 === this || null === this) throw new TypeError("Cannot convert undefined or null to object");var self = Object(this);return new ArrayIterator(self, 3);
        }, writable: !0, configurable: !0 }), defineProperty(String.prototype, _Symbol.iterator.toString(), { value: function value() {
            if (void 0 === this || null === this) throw new TypeError("String.prototype[Symbol.iterator] called on null or undefined");return new StringIterator(String(this), 0);
        }, writable: !0, configurable: !0 }), ES6;
});
/* axios v0.17.1 | (c) 2017 by Matt Zabriskie */
!function (e, t) {
    "object" == (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) && "object" == (typeof module === 'undefined' ? 'undefined' : _typeof(module)) ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) ? exports.axios = t() : e.axios = t();
}(this, function () {
    return function (e) {
        function t(r) {
            if (n[r]) return n[r].exports;var o = n[r] = { exports: {}, id: r, loaded: !1 };return e[r].call(o.exports, o, o.exports, t), o.loaded = !0, o.exports;
        }var n = {};return t.m = e, t.c = n, t.p = "", t(0);
    }([function (e, t, n) {
        e.exports = n(1);
    }, function (e, t, n) {
        "use strict";
        function r(e) {
            var t = new s(e),
                n = i(s.prototype.request, t);return o.extend(n, s.prototype, t), o.extend(n, t), n;
        }var o = n(2),
            i = n(3),
            s = n(5),
            u = n(6),
            a = r(u);a.Axios = s, a.create = function (e) {
            return r(o.merge(u, e));
        }, a.Cancel = n(23), a.CancelToken = n(24), a.isCancel = n(20), a.all = function (e) {
            return Promise.all(e);
        }, a.spread = n(25), e.exports = a, e.exports.default = a;
    }, function (e, t, n) {
        "use strict";
        function r(e) {
            return "[object Array]" === R.call(e);
        }function o(e) {
            return "[object ArrayBuffer]" === R.call(e);
        }function i(e) {
            return "undefined" != typeof FormData && e instanceof FormData;
        }function s(e) {
            var t;return t = "undefined" != typeof ArrayBuffer && ArrayBuffer.isView ? ArrayBuffer.isView(e) : e && e.buffer && e.buffer instanceof ArrayBuffer;
        }function u(e) {
            return "string" == typeof e;
        }function a(e) {
            return "number" == typeof e;
        }function c(e) {
            return "undefined" == typeof e;
        }function f(e) {
            return null !== e && "object" == (typeof e === 'undefined' ? 'undefined' : _typeof(e));
        }function p(e) {
            return "[object Date]" === R.call(e);
        }function d(e) {
            return "[object File]" === R.call(e);
        }function l(e) {
            return "[object Blob]" === R.call(e);
        }function h(e) {
            return "[object Function]" === R.call(e);
        }function m(e) {
            return f(e) && h(e.pipe);
        }function y(e) {
            return "undefined" != typeof URLSearchParams && e instanceof URLSearchParams;
        }function w(e) {
            return e.replace(/^\s*/, "").replace(/\s*$/, "");
        }function g() {
            return ("undefined" == typeof navigator || "ReactNative" !== navigator.product) && "undefined" != typeof window && "undefined" != typeof document;
        }function v(e, t) {
            if (null !== e && "undefined" != typeof e) if ("object" != (typeof e === 'undefined' ? 'undefined' : _typeof(e)) && (e = [e]), r(e)) for (var n = 0, o = e.length; n < o; n++) {
                t.call(null, e[n], n, e);
            } else for (var i in e) {
                Object.prototype.hasOwnProperty.call(e, i) && t.call(null, e[i], i, e);
            }
        }function x() {
            function e(e, n) {
                "object" == _typeof(t[n]) && "object" == (typeof e === 'undefined' ? 'undefined' : _typeof(e)) ? t[n] = x(t[n], e) : t[n] = e;
            }for (var t = {}, n = 0, r = arguments.length; n < r; n++) {
                v(arguments[n], e);
            }return t;
        }function b(e, t, n) {
            return v(t, function (t, r) {
                n && "function" == typeof t ? e[r] = E(t, n) : e[r] = t;
            }), e;
        }var E = n(3),
            C = n(4),
            R = Object.prototype.toString;e.exports = { isArray: r, isArrayBuffer: o, isBuffer: C, isFormData: i, isArrayBufferView: s, isString: u, isNumber: a, isObject: f, isUndefined: c, isDate: p, isFile: d, isBlob: l, isFunction: h, isStream: m, isURLSearchParams: y, isStandardBrowserEnv: g, forEach: v, merge: x, extend: b, trim: w };
    }, function (e, t) {
        "use strict";
        e.exports = function (e, t) {
            return function () {
                for (var n = new Array(arguments.length), r = 0; r < n.length; r++) {
                    n[r] = arguments[r];
                }return e.apply(t, n);
            };
        };
    }, function (e, t) {
        function n(e) {
            return !!e.constructor && "function" == typeof e.constructor.isBuffer && e.constructor.isBuffer(e);
        }function r(e) {
            return "function" == typeof e.readFloatLE && "function" == typeof e.slice && n(e.slice(0, 0));
        } /*!
          * Determine if an object is a Buffer
          *
          * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
          * @license  MIT
          */
        e.exports = function (e) {
            return null != e && (n(e) || r(e) || !!e._isBuffer);
        };
    }, function (e, t, n) {
        "use strict";
        function r(e) {
            this.defaults = e, this.interceptors = { request: new s(), response: new s() };
        }var o = n(6),
            i = n(2),
            s = n(17),
            u = n(18);r.prototype.request = function (e) {
            "string" == typeof e && (e = i.merge({ url: arguments[0] }, arguments[1])), e = i.merge(o, this.defaults, { method: "get" }, e), e.method = e.method.toLowerCase();var t = [u, void 0],
                n = Promise.resolve(e);for (this.interceptors.request.forEach(function (e) {
                t.unshift(e.fulfilled, e.rejected);
            }), this.interceptors.response.forEach(function (e) {
                t.push(e.fulfilled, e.rejected);
            }); t.length;) {
                n = n.then(t.shift(), t.shift());
            }return n;
        }, i.forEach(["delete", "get", "head", "options"], function (e) {
            r.prototype[e] = function (t, n) {
                return this.request(i.merge(n || {}, { method: e, url: t }));
            };
        }), i.forEach(["post", "put", "patch"], function (e) {
            r.prototype[e] = function (t, n, r) {
                return this.request(i.merge(r || {}, { method: e, url: t, data: n }));
            };
        }), e.exports = r;
    }, function (e, t, n) {
        "use strict";
        function r(e, t) {
            !i.isUndefined(e) && i.isUndefined(e["Content-Type"]) && (e["Content-Type"] = t);
        }function o() {
            var e;return "undefined" != typeof XMLHttpRequest ? e = n(8) : "undefined" != typeof process && (e = n(8)), e;
        }var i = n(2),
            s = n(7),
            u = { "Content-Type": "application/x-www-form-urlencoded" },
            a = { adapter: o(), transformRequest: [function (e, t) {
                return s(t, "Content-Type"), i.isFormData(e) || i.isArrayBuffer(e) || i.isBuffer(e) || i.isStream(e) || i.isFile(e) || i.isBlob(e) ? e : i.isArrayBufferView(e) ? e.buffer : i.isURLSearchParams(e) ? (r(t, "application/x-www-form-urlencoded;charset=utf-8"), e.toString()) : i.isObject(e) ? (r(t, "application/json;charset=utf-8"), JSON.stringify(e)) : e;
            }], transformResponse: [function (e) {
                if ("string" == typeof e) try {
                    e = JSON.parse(e);
                } catch (e) {}return e;
            }], timeout: 0, xsrfCookieName: "XSRF-TOKEN", xsrfHeaderName: "X-XSRF-TOKEN", maxContentLength: -1, validateStatus: function validateStatus(e) {
                return e >= 200 && e < 300;
            } };a.headers = { common: { Accept: "application/json, text/plain, */*" } }, i.forEach(["delete", "get", "head"], function (e) {
            a.headers[e] = {};
        }), i.forEach(["post", "put", "patch"], function (e) {
            a.headers[e] = i.merge(u);
        }), e.exports = a;
    }, function (e, t, n) {
        "use strict";
        var r = n(2);e.exports = function (e, t) {
            r.forEach(e, function (n, r) {
                r !== t && r.toUpperCase() === t.toUpperCase() && (e[t] = n, delete e[r]);
            });
        };
    }, function (e, t, n) {
        "use strict";
        var r = n(2),
            o = n(9),
            i = n(12),
            s = n(13),
            u = n(14),
            a = n(10),
            c = "undefined" != typeof window && window.btoa && window.btoa.bind(window) || n(15);e.exports = function (e) {
            return new Promise(function (t, f) {
                var p = e.data,
                    d = e.headers;r.isFormData(p) && delete d["Content-Type"];var l = new XMLHttpRequest(),
                    h = "onreadystatechange",
                    m = !1;if ("undefined" == typeof window || !window.XDomainRequest || "withCredentials" in l || u(e.url) || (l = new window.XDomainRequest(), h = "onload", m = !0, l.onprogress = function () {}, l.ontimeout = function () {}), e.auth) {
                    var y = e.auth.username || "",
                        w = e.auth.password || "";d.Authorization = "Basic " + c(y + ":" + w);
                }if (l.open(e.method.toUpperCase(), i(e.url, e.params, e.paramsSerializer), !0), l.timeout = e.timeout, l[h] = function () {
                    if (l && (4 === l.readyState || m) && (0 !== l.status || l.responseURL && 0 === l.responseURL.indexOf("file:"))) {
                        var n = "getAllResponseHeaders" in l ? s(l.getAllResponseHeaders()) : null,
                            r = e.responseType && "text" !== e.responseType ? l.response : l.responseText,
                            i = { data: r, status: 1223 === l.status ? 204 : l.status, statusText: 1223 === l.status ? "No Content" : l.statusText, headers: n, config: e, request: l };o(t, f, i), l = null;
                    }
                }, l.onerror = function () {
                    f(a("Network Error", e, null, l)), l = null;
                }, l.ontimeout = function () {
                    f(a("timeout of " + e.timeout + "ms exceeded", e, "ECONNABORTED", l)), l = null;
                }, r.isStandardBrowserEnv()) {
                    var g = n(16),
                        v = (e.withCredentials || u(e.url)) && e.xsrfCookieName ? g.read(e.xsrfCookieName) : void 0;v && (d[e.xsrfHeaderName] = v);
                }if ("setRequestHeader" in l && r.forEach(d, function (e, t) {
                    "undefined" == typeof p && "content-type" === t.toLowerCase() ? delete d[t] : l.setRequestHeader(t, e);
                }), e.withCredentials && (l.withCredentials = !0), e.responseType) try {
                    l.responseType = e.responseType;
                } catch (t) {
                    if ("json" !== e.responseType) throw t;
                }"function" == typeof e.onDownloadProgress && l.addEventListener("progress", e.onDownloadProgress), "function" == typeof e.onUploadProgress && l.upload && l.upload.addEventListener("progress", e.onUploadProgress), e.cancelToken && e.cancelToken.promise.then(function (e) {
                    l && (l.abort(), f(e), l = null);
                }), void 0 === p && (p = null), l.send(p);
            });
        };
    }, function (e, t, n) {
        "use strict";
        var r = n(10);e.exports = function (e, t, n) {
            var o = n.config.validateStatus;n.status && o && !o(n.status) ? t(r("Request failed with status code " + n.status, n.config, null, n.request, n)) : e(n);
        };
    }, function (e, t, n) {
        "use strict";
        var r = n(11);e.exports = function (e, t, n, o, i) {
            var s = new Error(e);return r(s, t, n, o, i);
        };
    }, function (e, t) {
        "use strict";
        e.exports = function (e, t, n, r, o) {
            return e.config = t, n && (e.code = n), e.request = r, e.response = o, e;
        };
    }, function (e, t, n) {
        "use strict";
        function r(e) {
            return encodeURIComponent(e).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
        }var o = n(2);e.exports = function (e, t, n) {
            if (!t) return e;var i;if (n) i = n(t);else if (o.isURLSearchParams(t)) i = t.toString();else {
                var s = [];o.forEach(t, function (e, t) {
                    null !== e && "undefined" != typeof e && (o.isArray(e) && (t += "[]"), o.isArray(e) || (e = [e]), o.forEach(e, function (e) {
                        o.isDate(e) ? e = e.toISOString() : o.isObject(e) && (e = JSON.stringify(e)), s.push(r(t) + "=" + r(e));
                    }));
                }), i = s.join("&");
            }return i && (e += (e.indexOf("?") === -1 ? "?" : "&") + i), e;
        };
    }, function (e, t, n) {
        "use strict";
        var r = n(2),
            o = ["age", "authorization", "content-length", "content-type", "etag", "expires", "from", "host", "if-modified-since", "if-unmodified-since", "last-modified", "location", "max-forwards", "proxy-authorization", "referer", "retry-after", "user-agent"];e.exports = function (e) {
            var t,
                n,
                i,
                s = {};return e ? (r.forEach(e.split("\n"), function (e) {
                if (i = e.indexOf(":"), t = r.trim(e.substr(0, i)).toLowerCase(), n = r.trim(e.substr(i + 1)), t) {
                    if (s[t] && o.indexOf(t) >= 0) return;"set-cookie" === t ? s[t] = (s[t] ? s[t] : []).concat([n]) : s[t] = s[t] ? s[t] + ", " + n : n;
                }
            }), s) : s;
        };
    }, function (e, t, n) {
        "use strict";
        var r = n(2);e.exports = r.isStandardBrowserEnv() ? function () {
            function e(e) {
                var t = e;return n && (o.setAttribute("href", t), t = o.href), o.setAttribute("href", t), { href: o.href, protocol: o.protocol ? o.protocol.replace(/:$/, "") : "", host: o.host, search: o.search ? o.search.replace(/^\?/, "") : "", hash: o.hash ? o.hash.replace(/^#/, "") : "", hostname: o.hostname, port: o.port, pathname: "/" === o.pathname.charAt(0) ? o.pathname : "/" + o.pathname };
            }var t,
                n = /(msie|trident)/i.test(navigator.userAgent),
                o = document.createElement("a");return t = e(window.location.href), function (n) {
                var o = r.isString(n) ? e(n) : n;return o.protocol === t.protocol && o.host === t.host;
            };
        }() : function () {
            return function () {
                return !0;
            };
        }();
    }, function (e, t) {
        "use strict";
        function n() {
            this.message = "String contains an invalid character";
        }function r(e) {
            for (var t, r, i = String(e), s = "", u = 0, a = o; i.charAt(0 | u) || (a = "=", u % 1); s += a.charAt(63 & t >> 8 - u % 1 * 8)) {
                if (r = i.charCodeAt(u += .75), r > 255) throw new n();t = t << 8 | r;
            }return s;
        }var o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.prototype = new Error(), n.prototype.code = 5, n.prototype.name = "InvalidCharacterError", e.exports = r;
    }, function (e, t, n) {
        "use strict";
        var r = n(2);e.exports = r.isStandardBrowserEnv() ? function () {
            return { write: function write(e, t, n, o, i, s) {
                    var u = [];u.push(e + "=" + encodeURIComponent(t)), r.isNumber(n) && u.push("expires=" + new Date(n).toGMTString()), r.isString(o) && u.push("path=" + o), r.isString(i) && u.push("domain=" + i), s === !0 && u.push("secure"), document.cookie = u.join("; ");
                }, read: function read(e) {
                    var t = document.cookie.match(new RegExp("(^|;\\s*)(" + e + ")=([^;]*)"));return t ? decodeURIComponent(t[3]) : null;
                }, remove: function remove(e) {
                    this.write(e, "", Date.now() - 864e5);
                } };
        }() : function () {
            return { write: function write() {}, read: function read() {
                    return null;
                }, remove: function remove() {} };
        }();
    }, function (e, t, n) {
        "use strict";
        function r() {
            this.handlers = [];
        }var o = n(2);r.prototype.use = function (e, t) {
            return this.handlers.push({ fulfilled: e, rejected: t }), this.handlers.length - 1;
        }, r.prototype.eject = function (e) {
            this.handlers[e] && (this.handlers[e] = null);
        }, r.prototype.forEach = function (e) {
            o.forEach(this.handlers, function (t) {
                null !== t && e(t);
            });
        }, e.exports = r;
    }, function (e, t, n) {
        "use strict";
        function r(e) {
            e.cancelToken && e.cancelToken.throwIfRequested();
        }var o = n(2),
            i = n(19),
            s = n(20),
            u = n(6),
            a = n(21),
            c = n(22);e.exports = function (e) {
            r(e), e.baseURL && !a(e.url) && (e.url = c(e.baseURL, e.url)), e.headers = e.headers || {}, e.data = i(e.data, e.headers, e.transformRequest), e.headers = o.merge(e.headers.common || {}, e.headers[e.method] || {}, e.headers || {}), o.forEach(["delete", "get", "head", "post", "put", "patch", "common"], function (t) {
                delete e.headers[t];
            });var t = e.adapter || u.adapter;return t(e).then(function (t) {
                return r(e), t.data = i(t.data, t.headers, e.transformResponse), t;
            }, function (t) {
                return s(t) || (r(e), t && t.response && (t.response.data = i(t.response.data, t.response.headers, e.transformResponse))), Promise.reject(t);
            });
        };
    }, function (e, t, n) {
        "use strict";
        var r = n(2);e.exports = function (e, t, n) {
            return r.forEach(n, function (n) {
                e = n(e, t);
            }), e;
        };
    }, function (e, t) {
        "use strict";
        e.exports = function (e) {
            return !(!e || !e.__CANCEL__);
        };
    }, function (e, t) {
        "use strict";
        e.exports = function (e) {
            return (/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)
            );
        };
    }, function (e, t) {
        "use strict";
        e.exports = function (e, t) {
            return t ? e.replace(/\/+$/, "") + "/" + t.replace(/^\/+/, "") : e;
        };
    }, function (e, t) {
        "use strict";
        function n(e) {
            this.message = e;
        }n.prototype.toString = function () {
            return "Cancel" + (this.message ? ": " + this.message : "");
        }, n.prototype.__CANCEL__ = !0, e.exports = n;
    }, function (e, t, n) {
        "use strict";
        function r(e) {
            if ("function" != typeof e) throw new TypeError("executor must be a function.");var t;this.promise = new Promise(function (e) {
                t = e;
            });var n = this;e(function (e) {
                n.reason || (n.reason = new o(e), t(n.reason));
            });
        }var o = n(23);r.prototype.throwIfRequested = function () {
            if (this.reason) throw this.reason;
        }, r.source = function () {
            var e,
                t = new r(function (t) {
                e = t;
            });return { token: t, cancel: e };
        }, e.exports = r;
    }, function (e, t) {
        "use strict";
        e.exports = function (e) {
            return function (t) {
                return e.apply(null, t);
            };
        };
    }]);
});
//# sourceMappingURL=axios.min.map
/* ==========================================================================
   Browser Handler
 ========================================================================== */

var BrowserHandler = {

    userAgent: '',
    browserInfo: '',

    init: function init() {
        BrowserHandler.userAgent = window.navigator.userAgent;
        BrowserHandler.browserInfo = BrowserHandler.getBrowserInfo();
        BrowserHandler.handleIE();
        BrowserHandler.handleSafari();
    },

    handleIE: function handleIE() {

        // Detect versions below ie11
        var msie = BrowserHandler.userAgent.indexOf('MSIE ');
        var ielt11 = msie > 0;

        // Detect ie11
        var ie11 = !!navigator.userAgent.match(/Trident.*rv\:11\./);

        // If Internet Explorer
        if (ielt11 || ie11) {
            // Default version
            var version = '11';

            // Way to detect version < 11
            if (ielt11) version = parseInt(BrowserHandler.userAgent.substring(msie + 5, BrowserHandler.userAgent.indexOf(".", msie)));

            // Append classes to HTML (we have to do this separately because else ie will fail)
            document.body.classList.add('ie');
            document.body.classList.add('v' + version);
        }
    },

    // Fallback for older safari version
    handleSafari: function handleSafari() {

        if (BrowserHandler.browserInfo.name === 'Safari' && BrowserHandler.browserInfo.version <= 10) {
            document.getElementsByTagName('html')[0].classList.add('ie');
        }
    },

    getBrowserInfo: function getBrowserInfo() {
        var ua = navigator.userAgent,
            tem = void 0,
            M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
        if (/trident/i.test(M[1])) {
            tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
            return { name: 'IE ', version: tem[1] || '' };
        }
        if (M[1] === 'Chrome') {
            tem = ua.match(/\bOPR\/(\d+)/);
            if (tem != null) {
                return { name: 'Opera', version: tem[1] };
            }
        }
        M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
        if ((tem = ua.match(/version\/(\d+)/i)) != null) {
            M.splice(1, 1, tem[1]);
        }
        return {
            name: M[0],
            version: M[1]
        };
    }
};

BrowserHandler.init();
/* ==========================================================================
   Cookie handler
   - Primary usage for toggling the cookie message and/or switch
 ========================================================================== */

var CookieHandler = {

    cookieMessage: null,
    cookieSwitch: null,
    cookieFadeOutAnimationDuration: 400,
    acceptTracking: false,

    // Initialize cookie handler
    init: function init() {
        // Bind cookie message without tracking to Handler
        CookieHandler.cookieMessage = document.getElementById('cookie-message');

        // If isset init the functions for cookie message without tracking
        if (isset(CookieHandler.cookieMessage)) {
            CookieHandler.initCookieMessageWithoutTracking();
        } else {
            // Else try to connect cookie message with tracking to Handler
            CookieHandler.cookieMessage = document.getElementById('cookie-message-overlay');

            // If isset init the functions for cookie message with tracking
            if (isset(CookieHandler.cookieMessage)) {
                CookieHandler.initCookieMessageWithTracking();
            }
        }

        // If either type of cookie has been found check if settings are defined
        if (isset(CookieHandler.cookieMessage)) {
            CookieHandler.checkForCookieSettings();
        }

        // Bind cookie switch to Handler
        CookieHandler.cookieSwitch = document.getElementById('cookie-switch');
        // If isset init the functions for cookie switch
        if (isset(CookieHandler.cookieSwitch)) {
            CookieHandler.initCookieSwitch();
        }
    },

    // Init the cookie message actions without tracking
    initCookieMessageWithoutTracking: function initCookieMessageWithoutTracking() {
        var closeButton = CookieHandler.cookieMessage.querySelector('.close-button');
        if (isset(closeButton)) {
            closeButton.addEventListener('click', CookieHandler.closeCookieMessage);
        }
    },

    // Init the cookie message actions with tracking
    initCookieMessageWithTracking: function initCookieMessageWithTracking() {

        // Open the cookie settings event
        var openCookieSettingsButton = CookieHandler.cookieMessage.querySelector('.open-menu');
        if (isset(openCookieSettingsButton)) {
            openCookieSettingsButton.addEventListener('click', CookieHandler.openCookieSettings);
        }

        // Toggle of the tracking input
        var toggleTrackingInputWrapper = CookieHandler.cookieMessage.querySelector('#cookie-settings-menu #trackingCookie');
        if (isset(toggleTrackingInputWrapper)) {
            var toggleTrackingInput = toggleTrackingInputWrapper.querySelector('input');
            toggleTrackingInput.addEventListener('change', CookieHandler.toggleTrackingSetting);

            if (toggleTrackingInput.checked === true) {
                CookieHandler.acceptTracking = true;
            }
        }

        // Accept / Save cookies button event
        var acceptButton = CookieHandler.cookieMessage.querySelector('.accept-cookie-button');
        if (isset(acceptButton)) {
            acceptButton.addEventListener('click', CookieHandler.setCookieSettings);
        }
    },

    // Init the cookie switch actions
    initCookieSwitch: function initCookieSwitch() {

        // Toggle of the tracking input
        var toggleTrackingInputWrapper = CookieHandler.cookieSwitch.querySelector('#trackingCookie');
        if (isset(toggleTrackingInputWrapper)) {
            var toggleTrackingInput = toggleTrackingInputWrapper.querySelector('input');
            toggleTrackingInput.addEventListener('change', CookieHandler.toggleTrackingSetting);

            // Force the state of the cookie switch input because the pop-up is forced on checked
            // while the switch checks by php if the cookie really exist or not
            if (toggleTrackingInput.checked === true) {
                CookieHandler.acceptTracking = true;
            } else {
                CookieHandler.acceptTracking = false;
            }
        }

        // Save cookies button event
        var saveButton = CookieHandler.cookieSwitch.querySelector('#save-cookie-settings');
        if (isset(saveButton)) {
            saveButton.addEventListener('click', function () {
                CookieHandler.cookieFadeOutAnimationDuration = 0; // On the switch click we want no delay :)
                CookieHandler.setCookieSettings();
            });
        }
    },

    checkForCookieSettings: function checkForCookieSettings() {
        if (Cookie.get('cookieMessage')) {
            CookieHandler.cookieMessage.classList.add('accepted');
        } else {
            CookieHandler.cookieMessage.classList.remove('accepted');
        }
    },

    closeCookieMessage: function closeCookieMessage() {
        Cookie.set('cookieMessage', true, 90);
        CookieHandler.cookieMessage.classList.add('transition-out');
    },

    openCookieSettings: function openCookieSettings() {
        CookieHandler.cookieMessage.querySelector('#cookie-settings-menu').classList.add('edit');
        CookieHandler.cookieMessage.querySelector('#message-description').classList.add('hide');
    },

    toggleTrackingSetting: function toggleTrackingSetting() {
        if (CookieHandler.acceptTracking) {
            CookieHandler.acceptTracking = false;
        } else {
            CookieHandler.acceptTracking = true;
        }
    },

    setCookieSettings: function setCookieSettings() {
        // Set tracking cookie or delete it if isset according to the desired settings
        if (CookieHandler.acceptTracking) {
            Cookie.set('trackingCookieAccepted', 'true', 90);
        } else {
            if (Cookie.get('trackingCookieAccepted')) {
                Cookie.erase('trackingCookieAccepted');
            }
        }

        CookieHandler.closeCookieMessage();

        // Reload after animation to automatically trigger the tracking after accepting it
        setTimeout(function () {
            location.reload();
        }, CookieHandler.cookieFadeOutAnimationDuration);
    }

};

CookieHandler.init();
document.addEventListener("DOMContentLoaded", function (event) {
    $.datepicker.regional['nl'] = { clearText: 'Effacer', clearStatus: '',
        closeText: 'sluiten', closeStatus: 'Onveranderd sluiten ',
        prevText: '<vorige', prevStatus: 'Zie de vorige maand',
        nextText: 'volgende>', nextStatus: 'Zie de volgende maand',
        currentText: 'Huidige', currentStatus: 'Bekijk de huidige maand',
        monthNames: ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december'],
        monthNamesShort: ['jan', 'feb', 'mrt', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
        monthStatus: 'Bekijk een andere maand', yearStatus: 'Bekijk nog een jaar',
        weekHeader: 'Sm', weekStatus: '',
        dayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
        dayNamesShort: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
        dayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
        dayStatus: 'Gebruik DD als de eerste dag van de week', dateStatus: 'Kies DD, MM d',
        dateFormat: 'dd/mm/yy', firstDay: 1,
        initStatus: 'Kies een datum', isRTL: false };
    $.datepicker.setDefaults($.datepicker.regional['nl']);

    $(".datepicker").datepicker({
        dateFormat: 'dd-mm-yy',
        maxDate: "today()",
        changeMonth: true,
        changeYear: true,
        yearRange: "-118:-10",
        onSelect: function onSelect(dateText) {
            $('input.age').val(calculateAge(new Date(dateText)));
        }
    });

    //LOAD PRESENCE MANAGER IF NEEDED
    var presenceManagerInput = document.querySelector('#certificate_number');
    var presenceManagerOuput = document.querySelector('.checkin-result');
    if (presenceManagerInput && presenceManagerInput.dataset.courseId) {
        var presenceManager = new PresenceManager('#certificate_number', '/presence');

        console.log('checking subscriptions');

        //Track the present and subscribed users in li's
        presenceManager.trackCheckedInUsersInList('#presentUsers');
        presenceManager.trackSubscribedUsersInList('#subscribedUsers');

        //let presenceManagerInput = document.querySelector(presenceManagerInputSelector);

        //Listen to the events of the manager
        presenceManager.on('check-in', function (userModel) {
            console.log('Checked in user: ' + userModel.first_name + " " + userModel.last_name);
            console.log(userModel);
            presenceManagerOuput.classList.remove('failed', 'success');
            presenceManagerOuput.classList.add('show', 'success');
            presenceManagerOuput.innerHTML = 'Cursist: ' + userModel.first_name + " " + userModel.last_name + " is ingelogd.";

            setTimeout(function () {
                presenceManagerOuput.classList.remove('show');
            }, 5000);
        });

        presenceManager.on('check-in-fail', function (error) {
            console.error('User could not be checked in: ' + error);
            presenceManagerOuput.classList.remove('failed', 'success');
            presenceManagerOuput.classList.add('show', 'failed');
            presenceManagerOuput.innerHTML = 'De cursist kon niet ingelogd worden: <br>' + error;

            setTimeout(function () {
                presenceManagerOuput.classList.remove('show');
            }, 5000);
        });

        presenceManager.on('api-error', function (error) {
            presenceManagerOuput.classList.remove('failed', 'success');
            presenceManagerOuput.classList.add('show', 'failed');
            presenceManagerOuput.innerHTML = 'Er ging iets fout in het systeem: <br>' + error;
            console.error('Api error: ' + error);

            setTimeout(function () {
                presenceManagerOuput.classList.remove('show');
            }, 5000);
        });
    }
});
/* ==========================================================================
    Google Maps handler
    - https://developers.google.com/maps/documentation/javascript/adding-a-google-map
 ========================================================================== */

var MapsHandler = {

    map: '',
    key: 'AIzaSyCVGPUmRmQRxXvzzWu3Xyu77XebQxQ-f4Y',
    location: { lat: 51.2618222, lng: 5.5965538 },
    styling: '',

    init: function init() {
        // Get map by id
        MapsHandler.map = document.getElementById('map');

        // Check if a map is defined
        if (isset(MapsHandler.map)) {

            if (MapsHandler.map.hasAttribute('data-google-lat')) MapsHandler.location.lat = parseFloat(MapsHandler.map.getAttribute('data-google-lat'));
            if (MapsHandler.map.hasAttribute('data-google-lng')) MapsHandler.location.lng = parseFloat(MapsHandler.map.getAttribute('data-google-lng'));

            MapsHandler.setCustomStyling();

            // See if google variable exists
            if (typeof google == 'undefined' || typeof google.maps == 'undefined') {
                // Load external script
                getScript('https://maps.googleapis.com/maps/api/js?key=' + MapsHandler.key, MapsHandler.drawMap);
            } else {
                MapsHandler.drawMap();
            }
        }
    },

    drawMap: function drawMap() {
        // Create a map
        var map = new google.maps.Map(MapsHandler.map, {
            zoom: 11,
            center: MapsHandler.location,
            disableDefaultUI: true,
            styles: MapsHandler.styling
        });
        // Add a marker
        var marker = new google.maps.Marker({
            position: MapsHandler.location,
            map: map
        });
    },

    setCustomStyling: function setCustomStyling() {

        MapsHandler.styling = [{
            "featureType": "poi",
            "elementType": "labels.text.fill",
            "stylers": [{
                "color": "#747474"
            }, {
                "lightness": "23"
            }]
        }, {
            "featureType": "poi.attraction",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#f38eb0"
            }]
        }, {
            "featureType": "poi.government",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#ced7db"
            }]
        }, {
            "featureType": "poi.medical",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#ffa5a8"
            }]
        }, {
            "featureType": "poi.park",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#c7e5c8"
            }]
        }, {
            "featureType": "poi.place_of_worship",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#d6cbc7"
            }]
        }, {
            "featureType": "poi.school",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#c4c9e8"
            }]
        }, {
            "featureType": "poi.sports_complex",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#b1eaf1"
            }]
        }, {
            "featureType": "road",
            "elementType": "geometry",
            "stylers": [{
                "lightness": "100"
            }]
        }, {
            "featureType": "road",
            "elementType": "labels",
            "stylers": [{
                "visibility": "off"
            }, {
                "lightness": "100"
            }]
        }, {
            "featureType": "road.highway",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#ffd4a5"
            }]
        }, {
            "featureType": "road.arterial",
            "elementType": "geometry.fill",
            "stylers": [{
                "color": "#ffe9d2"
            }]
        }, {
            "featureType": "road.local",
            "elementType": "all",
            "stylers": [{
                "visibility": "simplified"
            }]
        }, {
            "featureType": "road.local",
            "elementType": "geometry.fill",
            "stylers": [{
                "weight": "3.00"
            }]
        }, {
            "featureType": "road.local",
            "elementType": "geometry.stroke",
            "stylers": [{
                "weight": "0.30"
            }]
        }, {
            "featureType": "road.local",
            "elementType": "labels.text",
            "stylers": [{
                "visibility": "on"
            }]
        }, {
            "featureType": "road.local",
            "elementType": "labels.text.fill",
            "stylers": [{
                "color": "#747474"
            }, {
                "lightness": "36"
            }]
        }, {
            "featureType": "road.local",
            "elementType": "labels.text.stroke",
            "stylers": [{
                "color": "#e9e5dc"
            }, {
                "lightness": "30"
            }]
        }, {
            "featureType": "transit.line",
            "elementType": "geometry",
            "stylers": [{
                "visibility": "on"
            }, {
                "lightness": "100"
            }]
        }, {
            "featureType": "water",
            "elementType": "all",
            "stylers": [{
                "color": "#d2e7f7"
            }]
        }];
    }
};

MapsHandler.init();
/* ==========================================================================
   NavigationHandler handler
   - Primary usage for mobile NavigationHandler
   - Secondary if site used a pop-up/slide-in menu
 ========================================================================== */

var NavigationHandler = {

    navElement: '',
    scrolled: 0,
    isActive: false,

    // Initialize click event
    init: function init() {
        // Bind Navigation to Handler
        NavigationHandler.navElement = document.getElementById('mobile-navigation');

        // Bind clicks to menu button
        var mobileMenuButton = document.getElementById('mobile-menu-trigger');
        if (isset(mobileMenuButton)) {
            mobileMenuButton.addEventListener('click', function () {
                NavigationHandler.open();
            });
        }

        // Bind clicks to sticky menu button
        var stickyMenuButton = document.getElementById('sticky-menu-trigger');
        if (isset(stickyMenuButton)) {
            stickyMenuButton.addEventListener('click', function () {
                NavigationHandler.open();
            });
        }

        var mobileShade = document.getElementById('mobile-shader');
        if (isset(mobileShade)) {
            mobileShade.addEventListener('click', function () {
                NavigationHandler.close();
            });
        }

        var mobileClose = document.getElementById('mobile-close');
        if (isset(mobileClose)) {
            mobileClose.addEventListener('click', function () {
                NavigationHandler.close();
            });
        }

        if (isset(NavigationHandler.navElement)) {
            setTimeout(function () {
                NavigationHandler.navElement.classList.add('allow-animation');
            }, 500);
        }

        var sidebarHeader = document.querySelector('.sidebar h1');
        var sidebar = document.querySelector('.sidebar');
        if (window.innerWidth <= 900 && isset(sidebar) && isset(sidebarHeader)) {
            sidebar.addEventListener('click', function () {
                this.classList.toggle("open");
            });
        }
    },

    // Toggle navigation
    toggle: function toggle() {
        if (!NavigationHandler.isActive) NavigationHandler.open();else NavigationHandler.close();
    },

    // Open Navigation
    open: function open() {
        NavigationHandler.scrolled = window.pageYOffset;
        NavigationHandler.navElement.classList.add('active');
        NavigationHandler.navElement.classList.add('shader-active');
        NavigationHandler.isActive = true;

        setTimeout(function () {
            document.body.classList.add('preventScroll');
        }, 400);
    },

    // Close Navigation
    close: function close() {

        NavigationHandler.navElement.classList.remove('active');
        NavigationHandler.navElement.classList.remove('shader-active');
        NavigationHandler.isActive = false;

        document.body.classList.remove('preventScroll');
        window.scrollTo(0, NavigationHandler.scrolled);
    }
};

NavigationHandler.init();
/**
 * Can do api calls to the backend to mark a user as present
 */

var PresenceManager = function () {
    /**
     * The constructor.
     *
     * @param inputSelector (string) must reference an text input element
     * @param courseId (int) the id of the course a user could check-in to
     * @param apiUrl The base url to the api to manage user presence without trailing slash.
     * Must support the following additional path suffixes: check-in
     */
    function PresenceManager(inputSelector) {
        var apiUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'presence';

        _classCallCheck(this, PresenceManager);

        //Create and initialize properties
        this.input = null; //The text input element
        this.apiUrl = apiUrl;
        this.eventMap = {};
        this.userTrackingLists = {};

        //Delegate control to specialist parts of the class
        this.validateInputSelectorAndSetInputAndCourseId(inputSelector);
        this.enableListeners();
        this.focusOnInput();
    }

    /**
     * Focusses the the cursor to the input field and puts the cursor in the ind
     */


    _createClass(PresenceManager, [{
        key: 'focusOnInput',
        value: function focusOnInput() {
            this.input.focus();
            if (this.input.value !== '') {
                var value = this.input.value;
                this.input.value = '';
                this.input.value = value; //set that value back. Cursor is at the end of the input
            }
        }

        /**
         * Validates the inout selector to make sure it references an text input
         */

    }, {
        key: 'validateInputSelectorAndSetInputAndCourseId',
        value: function validateInputSelectorAndSetInputAndCourseId(selector) {
            var element = document.querySelector(selector);
            console.log(element);
            if (!element) {
                console.error('PresenceManager: The input selector parameter was invalid. It does not match a text input element');
                return;
            }

            if (!element.dataset.courseId) {
                console.error('PresenceManager: The input selector parameter was invalid. It does not have a courseId data attribute');
                return;
            }

            this.courseId = element.dataset.courseId;
            this.input = element;
        }

        /**
         * @param enable
         */

    }, {
        key: 'enableListeners',
        value: function enableListeners() {
            var enable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;

            if (enable) {
                this.input.addEventListener('keypress', this.reactOnlyToKeyPressFromKeyCode(this.markUserAsPresentUsingCode.bind(this), 13)); //13 = Enter key
                this.input.addEventListener('focusout', this.focusOnInput.bind(this));
            }
        }

        /**
         * Returns a function for an event listener to call and lets that function call the callback when the enter key is pressed
         *
         * @param callback
         * @param reactToKeyCode The keyCode to react to (see: https://gist.github.com/tylerbuchea/8011573 for example)
         * @returns {Function}
         */

    }, {
        key: 'reactOnlyToKeyPressFromKeyCode',
        value: function reactOnlyToKeyPressFromKeyCode(callback, reactToKeyCode) {
            return function (event) {
                var keyCode = event.keyCode;
                if (keyCode === reactToKeyCode) callback();
            };
        }

        /**
         * Marks a user as present for the current course using a code from a badge
         */

    }, {
        key: 'markUserAsPresentUsingCode',
        value: function markUserAsPresentUsingCode() {
            var self = this;

            var userCode = self.input.value;

            if (userCode != "") {
                axios.post(this.apiUrl + '/check-in', {
                    userCode: userCode,
                    courseId: self.courseId
                }).then(function (response) {
                    self.input.value = '';
                    if (response.data.hasOwnProperty('user')) self.userCheckedInSuccessFully(response.data.user);else self.apiErrorOccurred('User was checked in successfully. But user information was not returned properly.');
                }).catch(function (error) {
                    self.input.value = '';
                    switch (error.response.status) {
                        case 400:
                            self.userFailedToCheckIn(userCode, error.response.data);
                            break;
                        default:
                            self.apiErrorOccurred(error.response.statusText);
                    }
                });
            }
        }

        /**
         * Triggered in response to markUserAsPresentUsingCode
         */

    }, {
        key: 'userCheckedInSuccessFully',
        value: function userCheckedInSuccessFully(user) {
            var audio = new Audio('/audio/success.mp3');
            audio.play();
            this.updateTrackingLists();

            this.dispatchEvent('check-in', [user]);
        }

        /**
         * Triggered in response to markUserAsPresentUsingCode
         */

    }, {
        key: 'userFailedToCheckIn',
        value: function userFailedToCheckIn(userCode, error) {
            var audio = new Audio('/audio/error.mp3');
            audio.play();
            this.updateTrackingLists();

            this.dispatchEvent('check-in-fail', [error]);
        }

        /**
         * Triggered in response to markUserAsPresentUsingCode
         */

    }, {
        key: 'apiErrorOccurred',
        value: function apiErrorOccurred(error) {
            var audio = new Audio('/audio/error.mp3');
            audio.play();

            this.dispatchEvent('api-error', [error]);
        }

        /**
         * Registers a event to a callback and returns the a reference to the event handler for that specific event
         *
         * @param event (string)
         * @param callback (callable)
         */

    }, {
        key: 'on',
        value: function on(event, callback) {
            if (!this.eventMap.hasOwnProperty(event)) this.eventMap[event] = [];
            return this.eventMap[event].push(callback);
        }

        /**
         * Call event callbacks
         *
         * @param event (string)
         * @param eventArgs (array) an array of arguments to pass to the callback
         */

    }, {
        key: 'dispatchEvent',
        value: function dispatchEvent(event, eventArgs) {
            if (!this.eventMap.hasOwnProperty(event)) return;
            var _iteratorNormalCompletion = true;
            var _didIteratorError = false;
            var _iteratorError = undefined;

            try {
                for (var _iterator = this.eventMap[event][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                    cb = _step.value;

                    if (eventArgs && eventArgs.length > 0) {
                        cb.apply(this, eventArgs);
                    } else {
                        cb.call(this);
                    }
                }
            } catch (err) {
                _didIteratorError = true;
                _iteratorError = err;
            } finally {
                try {
                    if (!_iteratorNormalCompletion && _iterator.return) {
                        _iterator.return();
                    }
                } finally {
                    if (_didIteratorError) {
                        throw _iteratorError;
                    }
                }
            }
        }

        /**
         * Updates ul or ol elements registered with the trackCheckedInUsersInList method
         * with present and subscribed users
         */

    }, {
        key: 'updateTrackingLists',
        value: function updateTrackingLists() {
            var self = this;

            if (self.userTrackingLists.hasOwnProperty('present') && self.userTrackingLists.present.length > 0) {
                this.getPresentUsers(function (users) {
                    var _iteratorNormalCompletion2 = true;
                    var _didIteratorError2 = false;
                    var _iteratorError2 = undefined;

                    try {
                        for (var _iterator2 = self.userTrackingLists['present'][Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
                            var listElement = _step2.value;

                            self.updateListElementWithUsers(listElement, users);
                        }
                    } catch (err) {
                        _didIteratorError2 = true;
                        _iteratorError2 = err;
                    } finally {
                        try {
                            if (!_iteratorNormalCompletion2 && _iterator2.return) {
                                _iterator2.return();
                            }
                        } finally {
                            if (_didIteratorError2) {
                                throw _iteratorError2;
                            }
                        }
                    }
                });
            }

            if (self.userTrackingLists.hasOwnProperty('subscribed') && self.userTrackingLists.subscribed.length > 0) {
                this.getSubscribedUsers(function (users) {
                    var _iteratorNormalCompletion3 = true;
                    var _didIteratorError3 = false;
                    var _iteratorError3 = undefined;

                    try {
                        for (var _iterator3 = self.userTrackingLists['subscribed'][Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
                            var listElement = _step3.value;

                            self.updateListElementWithUsers(listElement, users);
                        }
                    } catch (err) {
                        _didIteratorError3 = true;
                        _iteratorError3 = err;
                    } finally {
                        try {
                            if (!_iteratorNormalCompletion3 && _iterator3.return) {
                                _iterator3.return();
                            }
                        } finally {
                            if (_didIteratorError3) {
                                throw _iteratorError3;
                            }
                        }
                    }
                });
            }
        }

        /**
         * Updates a ul or ol element with li's that match the items in the user array which each have a first_name and last_name property
         *
         * @param listElement
         * @param users
         */

    }, {
        key: 'updateListElementWithUsers',
        value: function updateListElementWithUsers(listElement, users) {
            console.log(listElement, users);
            while (listElement.firstChild) {
                listElement.removeChild(listElement.firstChild);
            }
            var _iteratorNormalCompletion4 = true;
            var _didIteratorError4 = false;
            var _iteratorError4 = undefined;

            try {
                for (var _iterator4 = users[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
                    var user = _step4.value;

                    var userListItem = document.createElement('li');
                    if (!user.hasOwnProperty('first_name') || !user.hasOwnProperty('last_name')) {
                        console.error('Could not create an li element with user data.');
                        continue;
                    }
                    userListItem.innerText = user.first_name + ' ' + user.last_name;
                    listElement.append(userListItem);
                }
            } catch (err) {
                _didIteratorError4 = true;
                _iteratorError4 = err;
            } finally {
                try {
                    if (!_iteratorNormalCompletion4 && _iterator4.return) {
                        _iterator4.return();
                    }
                } finally {
                    if (_didIteratorError4) {
                        throw _iteratorError4;
                    }
                }
            }
        }

        /**
         * @param callback a callback function that will retrieve an array of present users
         */

    }, {
        key: 'getPresentUsers',
        value: function getPresentUsers(callback) {
            this.getUsersForACertainState('present', callback);
        }

        /**
         * @param callback a callback function that will retrieve an array of subscribed users
         */

    }, {
        key: 'getSubscribedUsers',
        value: function getSubscribedUsers(callback) {
            this.getUsersForACertainState('subscribed', callback);
        }

        /**
         * @param state (string) 'present' or 'subscribed'
         * @param callback a callback function that will retrieve an array of users
         */

    }, {
        key: 'getUsersForACertainState',
        value: function getUsersForACertainState(state, callback) {
            var self = this;

            axios.get(this.apiUrl + '/tracking/' + state + '/' + self.courseId).then(function (response) {
                if (response.data.hasOwnProperty('users')) callback.call(this, response.data.users);else self.apiErrorOccurred('Could not get the "' + state + '" users');
            }).catch(function (error) {
                console.log(error);
                switch (error.response.status) {
                    default:
                        self.apiErrorOccurred(error.response.statusText);
                }
            });
        }

        /**
         * Marks an ul or li that can be selected with the given selector so that it
         * automatically will be updated with the present users
         *
         * @param selector (string)
         */

    }, {
        key: 'trackCheckedInUsersInList',
        value: function trackCheckedInUsersInList(selector) {
            var presentUsersList = document.querySelector(selector);
            if (presentUsersList) {
                if (!this.userTrackingLists.hasOwnProperty('present')) this.userTrackingLists['present'] = [];
                this.userTrackingLists['present'].push(presentUsersList);
            } else {
                console.error('The selector "' + selector + '" does not reference a ul or li and therefore it cannot be used to track the users that are checked-in for the current training');
            }

            this.updateTrackingLists();
        }

        /**
         * Marks an ul or li that can be selected with the given selector so that it
         * automatically will be updated with the subscribed users
         *
         * @param selector
         */

    }, {
        key: 'trackSubscribedUsersInList',
        value: function trackSubscribedUsersInList(selector) {
            var subscribedUsersList = document.querySelector(selector);
            if (subscribedUsersList) {
                if (!this.userTrackingLists.hasOwnProperty('subscribed')) this.userTrackingLists['subscribed'] = [];
                this.userTrackingLists['subscribed'].push(subscribedUsersList);
            } else {
                console.error('The selector "' + selector + '" does not reference a ul or li and therefore it cannot be used to track the users that are signed up for the current training');
            }

            this.updateTrackingLists();
        }
    }]);

    return PresenceManager;
}();
/* ==========================================================================
   Resize handler
   - Handler the objects which are or need to be recalculated on resize
 ========================================================================== */

var ResizeHandler = {

    time: Date.now(),
    timeout: null,
    waitThrottle: 1000,
    waitDebounce: 500,

    //Initialisation
    init: function init() {

        // Trigger start up resize
        ResizeHandler.triggerOnInit();

        // Throttle Resize
        window.addEventListener('resize', function () {
            if (ResizeHandler.time + ResizeHandler.waitThrottle - Date.now() < 0) {
                ResizeHandler.triggerThrottle();
                ResizeHandler.time = Date.now();
            }
        });

        // Smooth Resize
        window.addEventListener('resize', function () {
            ResizeHandler.triggerSmooth();
        });

        // Debounce Resize
        window.addEventListener('resize', function () {
            if (isset(ResizeHandler.timeout)) clearTimeout(ResizeHandler.timeout);
            ResizeHandler.timeout = setTimeout(ResizeHandler.triggerDebounce, ResizeHandler.waitDebounce);
        });
    },

    // Trigger on start up
    // All function should be in here
    triggerOnInit: function triggerOnInit() {
        // ResizeHandler.resizeWhatDoesItCostAdvantageFigure();
        // console.log('Initial Resize');
    },

    // Trigger resize functions with throttle (preferred)
    triggerThrottle: function triggerThrottle() {
        // console.log('Throttled Resize');
    },

    // Trigger resize on debounce
    triggerDebounce: function triggerDebounce() {
        // console.log('Debounce Resize');
        // ResizeHandler.resizeWhatDoesItCostAdvantageFigure();
    },

    // Trigger resize on the flight
    triggerSmooth: function triggerSmooth() {
        // console.log('Smooth Resize');
    }

    // ------------------------------ CUSTOM SCROLL HANDLERS ------------------------------------

    // Example function
    // resizeWhatDoesItCostAdvantageFigure: function () {
    //     var el = document.querySelector('.advantages-own-guiding-row figure');
    //     if(isset(el)){
    //         el.style.maxHeight = 'none';
    //         el.style.maxHeight = el.offsetHeight + 'px';
    //     }
    // },

};

ResizeHandler.init();
/* ==========================================================================
   Scroll handler
   - Handler the objects which are bind on scroll events or visible in viewport
 ========================================================================== */

var ScrollHandler = {

    // Variables for debounce and throttle effects
    time: Date.now(),
    timeout: null,
    waitThrottle: 1000,
    waitDebounce: 300,

    // Variables for scroll direction
    lastScrollTopPosition: 0,
    scrollDirectionDown: true,
    scrollDirectionUp: false,

    //Initialisation
    init: function init() {

        // Trigger start on start up
        ScrollHandler.triggerOnInit();

        // Throttle scroll
        window.addEventListener('scroll', function () {
            if (ScrollHandler.time + ScrollHandler.waitThrottle - Date.now() < 0) {
                ScrollHandler.triggerThrottle();
                ScrollHandler.time = Date.now();
            }
        });

        // Smooth scroll
        window.addEventListener('scroll', function () {
            ScrollHandler.triggerSmooth();
        });

        // Debounce scroll
        window.addEventListener('scroll', function () {
            if (isset(ScrollHandler.timeout)) clearTimeout(ScrollHandler.timeout);
            ScrollHandler.timeout = setTimeout(ScrollHandler.triggerDebounce, ScrollHandler.waitDebounce);
        });
    },

    // Trigger on start up
    triggerOnInit: function triggerOnInit() {
        ScrollHandler.triggerElementInViewportAnimation();
    },

    // Trigger scroll functions with throttle (preferred)
    triggerThrottle: function triggerThrottle() {
        // console.log('Throttled scroll');
        ScrollHandler.triggerElementInViewportAnimation();
    },

    // Trigger scroll on debounce
    triggerDebounce: function triggerDebounce() {
        // console.log('Debounce scroll');
    },

    // Trigger scroll on the flight
    triggerSmooth: function triggerSmooth() {
        // console.log('Smooth scroll');
        ScrollHandler.detectScrollDirection();
        ScrollHandler.toggleStickyNavigation();
    },

    // Detect if part of a given element is visible in the viewport
    // El must be a node element
    detectIfElementIsPartlyInViewport: function detectIfElementIsPartlyInViewport(el) {
        if (isset(el)) {

            var rect = el.getBoundingClientRect();
            // DOMRect { x: 8, y: 8, width: 100, height: 100, top: 8, right: 108, bottom: 108, left: 8 }
            var windowHeight = window.innerHeight || document.documentElement.clientHeight;
            var windowWidth = window.innerWidth || document.documentElement.clientWidth;

            var verticalInView = rect.top <= windowHeight && rect.top + rect.height >= 0;
            var horizontalInView = rect.left <= windowWidth && rect.left + rect.width >= 0;

            return verticalInView && horizontalInView;
        }
    },

    // Detect if a given element is fully visible in the viewport
    // El must be a node element
    detectIfElementIsFullyInViewport: function detectIfElementIsFullyInViewport(el) {
        if (isset(el)) {
            var rect = el.getBoundingClientRect();

            return rect.top >= 0 && rect.bottom <= window.innerHeight;
        }
    },

    detectScrollDirection: function detectScrollDirection() {
        var scrollTopPosition = window.pageYOffset || document.documentElement.scrollTop; // Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
        if (scrollTopPosition >= ScrollHandler.lastScrollTopPosition) {
            ScrollHandler.scrollDirectionDown = true;
            ScrollHandler.scrollDirectionUp = false;
        } else {
            ScrollHandler.scrollDirectionDown = false;
            ScrollHandler.scrollDirectionUp = true;
        }
        ScrollHandler.lastScrollTopPosition = scrollTopPosition;
    },

    // Trigger animation on elements that have 'element-in-viewport' and that are in the viewport
    // These animation can only be triggered once, if you want more then that you should write an specific function for this
    triggerElementInViewportAnimation: function triggerElementInViewportAnimation() {
        var elements = document.querySelectorAll('.element-in-viewport');
        var elementsLength = elements.length;

        for (var e = 0; e < elementsLength; e++) {

            var element = elements[e];
            if (ScrollHandler.detectIfElementIsPartlyInViewport(element)) {
                element.classList.remove('element-in-viewport');
            }
        }
    },

    // ------------------------------ CUSTOM SCROLL HANDLERS ------------------------------------

    // Hide or show sticky navigation when header isn't visible
    toggleStickyNavigation: function toggleStickyNavigation() {

        var mainNavigation = document.querySelector('body >header');
        var stickyNavigation = document.getElementById('sticky-navigation');
        if (isset(stickyNavigation) && isset(mainNavigation)) {

            // Show sticky navigation
            if (!ScrollHandler.detectIfElementIsFullyInViewport(mainNavigation) && ScrollHandler.scrollDirectionUp) {
                stickyNavigation.classList.add('active');
            }

            // Hide sticky navigation
            if (ScrollHandler.scrollDirectionDown || ScrollHandler.detectIfElementIsPartlyInViewport(mainNavigation)) {
                stickyNavigation.classList.remove('active');
            }
        }
    }

};

ScrollHandler.init();
/* ==========================================================================
    Scroll To Click handler
 ========================================================================== */

var ScrollToHandler = {

    // Animation settings
    offset: 60, //pixel
    duration: 1400, //ms

    // Animation variables
    body: null,
    start: 0,
    change: 0,
    currentTime: 0,
    allowAnimation: false,
    scrollToAnimation: null,

    // Watch the EasingFunction helper for the available methods
    easing: 'easeInOutQuad',

    init: function init() {

        var anchorLinks = document.querySelectorAll('.scroll-to-target');
        var anchorLinksAmount = anchorLinks.length;

        for (var i = 0; i < anchorLinksAmount; i++) {

            var anchorLink = anchorLinks[i];

            anchorLink.addEventListener('click', function (event) {
                ScrollToHandler.prepareScrollTo(this.getAttribute('href'));
                event.preventDefault();
            });
        }
    },

    /**
     * Prepare the Handler for the animation
     */
    prepareScrollTo: function prepareScrollTo(elementId) {

        // Get the scroll to element
        elementId = elementId.substr(elementId.indexOf('#') + 1);
        var scrollToElement = document.getElementById(elementId);
        var scrollToElementPosition = scrollToElement.getBoundingClientRect();

        // Reset or define the Handler variables
        ScrollToHandler.body = document.documentElement;
        ScrollToHandler.start = Math.max(ScrollToHandler.body.scrollTop, document.body.scrollTop, window.pageYOffset); //Use Math.max because safari doesn't support document.documentElement.scrollTop
        ScrollToHandler.change = scrollToElementPosition.top + ScrollToHandler.start - ScrollToHandler.start - ScrollToHandler.offset;
        ScrollToHandler.startTime = 'now' in window.performance ? performance.now() : new Date().getTime();
        ScrollToHandler.allowAnimation = true;

        // Trigger animation
        scrollToAnimation = requestAnimationFrame(ScrollToHandler.animateScroll);

        // Stop on scroll
        window.addEventListener('mousedown', ScrollToHandler.abortScrollAnimation);
        window.addEventListener('wheel', ScrollToHandler.abortScrollAnimation);
        window.addEventListener('DOMMouseScroll', ScrollToHandler.abortScrollAnimation);
        window.addEventListener('mousewheel', ScrollToHandler.abortScrollAnimation);
        window.addEventListener('keyup', ScrollToHandler.abortScrollAnimation);
        window.addEventListener('touchmove', ScrollToHandler.abortScrollAnimation);
    },

    /*
     * Animate the scroll position
     */
    animateScroll: function animateScroll(timestamp) {

        // Calculate progress from 0 - 1
        var progress = Math.min(1, (timestamp - ScrollToHandler.startTime) / ScrollToHandler.duration);
        if (progress < 0) progress = 0;

        // Convert progress with easing function
        progress = EasingFunctions[ScrollToHandler.easing](progress);

        var newScrollTop = ScrollToHandler.start + ScrollToHandler.change * progress;

        ScrollToHandler.body.scrollTop = newScrollTop;
        if (ScrollToHandler.body.scrollTop === 0) document.body.scrollTop = newScrollTop; // Safari doesn't support so if ScrollToHandler.body.scrollTop is 0 force the scroll position through document.body.scrollTop

        if (progress < 1 && ScrollToHandler.allowAnimation) {
            scrollToAnimation = requestAnimationFrame(ScrollToHandler.animateScroll);
        }
    },

    /*
     * Abort the scroll animation
     */
    abortScrollAnimation: function abortScrollAnimation(event) {
        ScrollToHandler.allowAnimation = false;
        cancelAnimationFrame(ScrollToHandler.scrollToAnimation);
    }

};

ScrollToHandler.init();

var searchHandler = function () {
    function searchHandler(searchUrl) {
        _classCallCheck(this, searchHandler);

        console.debug('searchHandler initialized with searchUrl: ' + searchUrl);
        this.searchUrl = searchUrl;
    }

    _createClass(searchHandler, [{
        key: 'search',
        value: function search(term) {
            var page = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
            var amount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;

            if (term === "") return;

            self = this;

            $.ajax({
                type: "GET",
                url: this.searchUrl,
                data: {
                    page: page,
                    amount: amount,
                    term: term
                },
                success: function success(response) {
                    self.processSearchResponse(response);
                },
                error: function error() {
                    console.log("An error occured while searching");
                },
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                dataType: 'json'
            });
        }
    }, {
        key: 'processSearchResponse',
        value: function processSearchResponse(response) {
            if (!searchHandler.validateSearchResponse(response)) return;
            console.log(response);
        }
    }], [{
        key: 'validateSearchResponse',
        value: function validateSearchResponse(response) {
            if (response.hasOwnProperty('data') && response.hasOwnProperty('meta')) return true;

            console.error('Search response was not valid');
            console.log(response);
            return false;
        }
    }]);

    return searchHandler;
}();
/**
 * Created by Pascal on 06/12/17.
 */

/* Example

const headerImageSliderSetting = new SliderSetting({
    sliderId: 'header-image-slider',
    slideQuery: '#header-image-slider .placeholder figure',
    dots: '#header-image-slider .slider-navigation-labels .navigation span',
    captions: '#header-image-slider .slider-navigation-labels .caption p',
    autoSlider: true,
    sliderInterval: 4000
});
headerImageSliderSetting = headerImageSliderSetting.prepareParameters();

const headerImageSlider = new Slider(headerImageSliderSetting).init();

 */

var imageSliders = [];

var imageSliderContainers = document.querySelectorAll('.image-slider');
var imageSliderContainersLength = imageSliderContainers.length;

for (var i = 0; i < imageSliderContainersLength; i++) {

    var imageSlider = imageSliderContainers[i];
    var imageSliderId = imageSlider.getAttribute('id');

    if (imageSliderId !== null) {

        var imageSliderSetting = new SliderSetting({
            sliderId: imageSliderId,
            slideQuery: '#' + imageSliderId + ' .placeholder figure',
            navigationButtons: '#' + imageSliderId + ' .placeholder .controllers .nav-item',
            autoSlider: true,
            sliderInterval: 4000
        });

        imageSliders.push(new Slider(imageSliderSetting.prepareParameters()).init());
    } else console.log('An image slider has no id...');
}

function SliderSetting(settingsObject) {

    var self = this;

    this.sliderId = '';
    this.definedPreviousNext = true;
    this.autoSlider = false;
    this.sliderInterval = 4000;
    this.navigationButtons = '';
    this.dots = '';
    this.captions = '';
    this.slideQuery = '';

    this.setSliderId = function (string) {
        this.sliderId = string;
        return this;
    };
    this.setDefinedPreviousNext = function (boolean) {
        this.definedPreviousNext = boolean;
        return this;
    };
    this.setAutoSlider = function (boolean) {
        this.autoSlider = boolean;
        return this;
    };
    this.setSliderInterval = function (integer) {
        this.sliderInterval = integer;
        return this;
    };
    this.setSlideQuery = function (string) {
        this.slideQuery = string;
        return this;
    };
    this.setNavigationButtons = function (string) {
        this.navigationButtons = string;
        return this;
    };
    this.setDots = function (string) {
        this.dots = string;
        return this;
    };
    this.setCaptions = function (string) {
        this.captions = string;
        return this;
    };
    this.getSliderId = function () {
        return this.sliderId;
    };
    this.getDefinedPreviousNext = function () {
        return this.definedPreviousNext;
    };
    this.getAutoSlider = function () {
        return this.autoSlider;
    };
    this.getSliderInterval = function () {
        return this.sliderInterval;
    };
    this.getSlideQuery = function () {
        return this.slideQuery;
    };
    this.getNavigationButtons = function () {
        return this.navigationButtons;
    };
    this.getDots = function () {
        return this.dots;
    };
    this.getCaptions = function () {
        return this.captions;
    };

    // Invert setters to getters
    this.prepareParameters = function () {

        return {
            sliderId: self.getSliderId(),
            definedPreviousNext: self.getDefinedPreviousNext(),
            autoSlider: self.getAutoSlider(),
            sliderInterval: self.getSliderInterval(),
            navigationButtons: self.getNavigationButtons(),
            dots: self.getDots(),
            captions: self.getCaptions(),
            slideQuery: self.getSlideQuery()
        };
    };

    // Mass assign settings
    this.fill = function () {
        // Object.keys(settingsObject).forEach(function (key) {
        //     self[key] = settingsObject[key];
        // });

        var settingsObjectKeys = Object.keys(settingsObject);
        var settingsObjectLength = settingsObjectKeys.length;

        for (var _i = 0; _i < settingsObjectLength; _i++) {
            var key = settingsObjectKeys[_i];
            self[key] = settingsObject[key];
        }
    };

    this.fill();

    return {
        sliderId: self.setSliderId,
        definedPreviousNext: self.setDefinedPreviousNext,
        autoSlider: self.setAutoSlider,
        sliderInterval: self.setSliderInterval,
        navigationButtons: self.setNavigationButtons,
        dots: self.setDots,
        captions: self.setCaptions,
        slideQuery: self.setSlideQuery,
        prepareParameters: self.prepareParameters
    };
}

function Slider(settings) {

    //Define Slider object
    var self = this;
    this.sliderObject = '';

    //SlideParameters
    this.activeSlideId = 0;
    this.previousSlideId = 0;
    this.nextSlideId = 0;
    this.availableSlides = 1;
    this.slides = [];
    this.autoSliderInterval = null;

    this.settings = {};

    this.init = function () {

        //Append settings to self
        this.settings = settings;

        //Assign needed elements and calculations
        this.sliderObject = document.getElementById(this.settings.sliderId);
        this.slides = document.querySelectorAll(this.settings.slideQuery);
        this.availableSlides = this.slides.length;
        this.activeSlideId = 0;

        //Define previous and next if we want to use those
        if (self.settings.definedPreviousNext) this.setPreviousAndNextSlide();

        // Set active slide (and possible previous and next classes)
        this.setSlide();

        // Swipe interaction
        var swipeGestures = new Hammer(this.sliderObject);
        swipeGestures.on('swipeleft', function () {
            self.resetAutoSlider();
            self.nextSlide();
            self.setSlide();
        });
        swipeGestures.on('swiperight', function () {
            self.resetAutoSlider();
            self.previousSlide();
            self.setSlide();
        });

        if (this.settings.navigationButtons !== '') {

            // Click interaction
            var navigationButtons = document.querySelectorAll(this.settings.navigationButtons);
            var navigationButtonsLength = navigationButtons.length;
            for (var _i2 = 0; _i2 < navigationButtonsLength; _i2++) {
                var navigationButton = navigationButtons[_i2];
                navigationButton.addEventListener('click', function () {
                    self.clickNavigationButton(this);
                });
            }
        }

        if (this.settings.dots !== '') {
            // Click interaction
            var dots = document.querySelectorAll(this.settings.dots);
            var dotsLength = dots.length;
            // console.log(this.settings.dots);
            // console.log(dots);
            for (var _i3 = 0; _i3 < dotsLength; _i3++) {
                var dot = dots[_i3];
                // console.log('hier');
                dot.addEventListener('click', function () {
                    self.clickDot(this);
                });
            }
        }

        self.autoSlider();
    };

    this.autoSlider = function () {

        if (this.autoSliderInterval !== null) clearInterval(this.autoSliderInterval);

        if (this.settings.autoSlider && Number.isInteger(this.settings.sliderInterval)) {

            this.autoSliderInterval = setInterval(function () {
                self.nextSlide();
                self.setSlide();
            }, this.settings.sliderInterval);
        }
    };

    this.resetAutoSlider = self.autoSlider;

    this.nextSlide = function () {
        this.activeSlideId++;
        if (this.activeSlideId >= this.availableSlides) this.activeSlideId = 0;

        if (self.settings.definedPreviousNext) this.setPreviousAndNextSlide();
    };

    this.previousSlide = function () {
        this.activeSlideId--;
        if (this.activeSlideId < 0) this.activeSlideId = this.availableSlides - 1;

        if (self.settings.definedPreviousNext) this.setPreviousAndNextSlide();
    };

    this.setPreviousAndNextSlide = function () {
        this.nextSlideId = this.activeSlideId + 1;
        if (this.nextSlideId >= this.availableSlides) this.nextSlideId = 0;

        this.previousSlideId = this.activeSlideId - 1;
        if (this.previousSlideId < 0) this.previousSlideId = this.availableSlides - 1;
    };

    this.setSlide = function () {

        // Loop through the form elements
        var slidesLength = self.slides.length;
        for (var _i4 = 0; _i4 < slidesLength; _i4++) {
            var slide = self.slides[_i4];

            // Convert data set attribute to desired type
            var slideOrder = parseInt(slide.getAttribute('data-order'));

            // Remove and set active for all slides
            if (slideOrder !== self.activeSlideId) slide.classList.remove('active');else slide.classList.add('active');

            // If we use the previous and next, also set those classes
            if (self.settings.definedPreviousNext) {

                if (slideOrder !== self.previousSlideId) slide.classList.remove('previous');else slide.classList.add('previous');

                if (slideOrder !== self.nextSlideId) slide.classList.remove('next');else slide.classList.add('next');
            }
        }

        if (self.settings.dots !== '') {
            self.setActiveDot();
        }
        if (self.settings.captions !== '') {
            self.setActiveCaption();
        }
    };

    this.clickNavigationButton = function (navButton) {
        self.activeSlideId = parseInt(navButton.getAttribute('data-order'));
        if (self.settings.definedPreviousNext) self.setPreviousAndNextSlide();
        self.setSlide();

        var next = document.querySelector(self.settings.navigationButtons + '.next');
        var previous = document.querySelector(self.settings.navigationButtons + '.previous');

        next.setAttribute('data-order', self.nextSlideId);
        previous.setAttribute('data-order', self.previousSlideId);

        self.resetAutoSlider();

        // next.querySelector('p').innerHTML = self.slides[self.nextSlideId].dataset.name;
        // previous.querySelector('p').innerHTML = self.slides[self.previousSlideId].dataset.name;
    };

    this.clickDot = function (clickedDot) {
        self.activeSlideId = parseInt(clickedDot.getAttribute('data-order'));
        self.setSlide();
        self.resetAutoSlider();
    };

    this.setActiveDot = function () {

        var dots = document.querySelectorAll(this.settings.dots);
        var dotsLength = dots.length;
        for (var _i5 = 0; _i5 < dotsLength; _i5++) {
            var dot = dots[_i5];
            dotOrder = parseInt(dot.getAttribute('data-order'));

            if (dotOrder !== self.activeSlideId) dot.classList.remove('active');else dot.classList.add('active');
        }
    };

    this.setActiveCaption = function () {

        var captions = document.querySelectorAll(this.settings.captions);
        var captionsLength = captions.length;
        for (var _i6 = 0; _i6 < captionsLength; _i6++) {
            var caption = captions[_i6];
            captionOrder = parseInt(caption.getAttribute('data-order'));

            if (captionOrder !== self.activeSlideId) caption.classList.remove('active');else caption.classList.add('active');
        }
    };
}
/* ==========================================================================
    Youtube handler
 ========================================================================== */

var YoutubeHandler = {

    youtubeClass: '.youtube-player',
    players: [],

    init: function init() {
        // Get the youtube players containers
        var youtubePlayers = document.querySelectorAll(YoutubeHandler.youtubeClass);
        var youtubePlayersAmount = youtubePlayers.length;

        for (var _i7 = 0; _i7 < youtubePlayersAmount; _i7++) {

            var youtubePlayer = youtubePlayers[_i7];

            var youtubePlayerId = youtubePlayer.getAttribute('id');
            if (youtubePlayerId !== null) {
                // Strip the necessary data from the html and create objects from it
                var youtubeElement = {
                    id: youtubePlayer.getAttribute('id'),
                    link: youtubePlayer.getAttribute('data-youtube-link'),
                    autoPlay: parseInt(youtubePlayer.getAttribute('data-auto-play'))
                };

                YoutubeHandler.players.push(youtubeElement);
            } else {
                console.log("Element not include because there isn't a id on the player");
                console.log(youtubePlayer);
            }
        }

        if (youtubePlayersAmount >= 1) YoutubeHandler.initYoutube();
    },

    /**
     * Check if external script is loaded
     *
     */
    initYoutube: function initYoutube() {
        // See if YT variable exists
        if (typeof YT == 'undefined' || typeof YT.Player == 'undefined') {
            // Setup API ready function
            window.onYouTubePlayerAPIReady = function () {
                YoutubeHandler.loadPlayers();
            };
            // Load external script
            getScript('https://www.youtube.com/iframe_api');
            // If YT already exists load player
        } else {
            YoutubeHandler.loadPlayers();
        }
    },

    /**
     * Create the Youtube player(s) with parameters
     * And rewrite the players to key them by the element id
     *
     */
    loadPlayers: function loadPlayers() {

        var players = [];

        var youtubePlayersAmount = YoutubeHandler.players.length;
        for (var _i8 = 0; _i8 < youtubePlayersAmount; _i8++) {

            var youtubePlayer = YoutubeHandler.players[_i8];

            // Load player
            youtubePlayer.player = new YT.Player(youtubePlayer.id, {
                height: 200,
                width: 200,
                videoId: youtubePlayer.link,
                host: 'https://www.youtube-nocookie.com',
                playerVars: {
                    modestbranding: 0,
                    showinfo: 0,
                    rel: 0,
                    disablekb: 1,
                    autoplay: youtubePlayer.autoPlay
                },
                events: {
                    // 'onReady': YoutubeHandler.onReady,
                    'onStateChange': YoutubeHandler.onStateChange
                }
            });

            players[youtubePlayer.id] = youtubePlayer;
        }

        YoutubeHandler.players = players;
    },

    /**
     * When player is ready to play
     */
    onReady: function onReady(event) {

        var playerContainerId = event.target.getIframe().getAttribute('id');
        var player = YoutubeHandler.players[playerContainerId].player;

        // Show video
        // setTimeout(function(){ $('#' + playerContainerId).stop().animate({ opacity: 1 },1000) },800);

        // If not on tablet or mobile, play on high quality
        // player.mute();
        // player.playVideo();
        // player.setPlaybackQuality('hd1080');
    },

    /**
     * Listener for Youtube state change
     */
    onStateChange: function onStateChange(event) {

        var playerContainerId = event.target.getIframe().getAttribute('id');
        var player = YoutubeHandler.players[playerContainerId].player;

        var videoState = event.data;

        // Loop video
        if (event.data === YT.PlayerState.ENDED) {
            player.playVideo();
        }
    }
};

YoutubeHandler.init();