UNPKG

coffeescript-ui

Version:
1,888 lines (1,719 loc) 1.89 MB
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 6); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { (function webpackUniversalModuleDefinition(root, factory) { if(true) module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["CUI"] = factory(); else root["CUI"] = factory(); })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 168); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { /* * coffeescript-ui - Coffeescript User Interface System (CUI) * Copyright (c) 2013 - 2016 Programmfabrik GmbH * MIT Licence * https://github.com/programmfabrik/coffeescript-ui, http://www.coffeescript-ui.org */ var CUI, marked; marked = __webpack_require__(2); CUI = (function() { function CUI() {} CUI.__readyFuncs = []; CUI.__themes = []; CUI.__ng__ = true; CUI.start = function() { var icons, trigger_viewport_resize; trigger_viewport_resize = (function(_this) { return function() { console.info("CUI: trigger viewport resize."); return CUI.Events.trigger({ type: "viewport-resize" }); }; })(this); CUI.Events.listen({ type: "resize", node: window, call: (function(_this) { return function(ev, info) { console.info("CUI: caught window resize event."); if (!CUI.browser.ie) { trigger_viewport_resize(); } else { CUI.scheduleCallback({ ms: 500, call: trigger_viewport_resize }); } }; })(this) }); CUI.Events.listen({ type: "drop", node: document.documentElement, call: function(ev) { return ev.preventDefault(); } }); CUI.Events.listen({ type: "keyup", node: window, capture: true, call: function(ev) { if (ev.getKeyboard() === "C+U+I") { return CUI.toaster({ text: "CUI!" }); } } }); CUI.Events.listen({ type: "keydown", node: window, call: function(ev) { var j, len1, node, ref, ref1; if (ev.getKeyboard() === "c+") { CUI.toaster({ text: "CUI!" }); } if (ev.keyCode() === 8) { ref = CUI.dom.elementsUntil(ev.getTarget(), null, document.documentElement); for (j = 0, len1 = ref.length; j < len1; j++) { node = ref[j]; if ((ref1 = node.tagName) === "INPUT" || ref1 === "TEXTAREA") { return; } if (node.getAttribute("contenteditable") === "true") { return; } } ev.preventDefault(); } } }); document.body.scrollTop = 0; icons = __webpack_require__(199); CUI.Template.loadText(icons); CUI.Template.load(); this.chainedCall.apply(this, this.__readyFuncs).always((function(_this) { return function() { return _this.__ready = true; }; })(this)); return this; }; CUI.getPathToScript = function() { var cui_script, m, scripts; if (!this.__pathToScript) { scripts = document.getElementsByTagName('script'); cui_script = scripts[scripts.length - 1]; if (m = cui_script.src.match("(.*/).*?\.js$")) { this.__pathToScript = m[1]; } else { CUI.util.assert(this.__pathToScript, "CUI", "Could not determine script path."); } } return this.__pathToScript; }; CUI.ready = function(func) { if (this.__ready) { return func.call(this); } return this.__readyFuncs.push(func); }; CUI.defaults = { FileUpload: { name: "files[]" }, debug: true, asserts: true, asserts_alert: 'js', "class": {} }; CUI.resolvedPromise = function() { var dfr; dfr = new CUI.Deferred(); dfr.resolve.apply(dfr, arguments); return dfr.promise(); }; CUI.rejectedPromise = function() { var dfr; dfr = new CUI.Deferred(); dfr.reject.apply(dfr, arguments); return dfr.promise(); }; CUI.chainedCall = function() { var __this, args, dfr, get_args, get_return_value, idx, init_next, return_values; idx = 0; __this = this; get_args = function(_arguments) { var _args, arg, j, len1; _args = []; for (j = 0, len1 = _arguments.length; j < len1; j++) { arg = _arguments[j]; _args.push(arg); } return _args; }; get_return_value = function(_arguments) { var _args; _args = get_args(_arguments); if (_args.length === 0) { return void 0; } else if (_args.length === 1) { return _args[0]; } else { return _args; } }; args = get_args(arguments); return_values = []; init_next = (function(_this) { return function() { var ret; if (idx === args.length) { dfr.resolve.apply(dfr, return_values); return; } if (CUI.isFunction(args[idx])) { if (__this !== CUI) { ret = args[idx].call(__this); } else { ret = args[idx](); } } else { ret = args[idx]; } idx++; if (CUI.util.isPromise(ret)) { ret.done(function() { return_values.push(get_return_value(arguments)); return init_next(); }).fail(function() { return_values.push(get_return_value(arguments)); return dfr.reject.apply(dfr, return_values); }); } else { return_values.push(ret); init_next(); } }; })(this); dfr = new CUI.Deferred(); init_next(); return dfr.promise(); }; CUI.chunkWork = function(_opts) { var chunk_size, dfr, idx, len, next_chunk, opts, timeout; if (_opts == null) { _opts = {}; } opts = CUI.Element.readOpts(_opts, "CUI.chunkWork", { items: { mandatory: true, check: function(v) { return CUI.isArray(v); } }, chunk_size: { mandatory: true, "default": 10, check: function(v) { return v >= 1; } }, timeout: { mandatory: true, "default": 0, check: function(v) { return v >= -1; } }, call: { mandatory: true, check: function(v) { return v instanceof Function; } } }); chunk_size = opts.chunk_size; timeout = opts.timeout; CUI.util.assert(this !== CUI, "CUI.chunkWork", "Cannot call CUI.chunkWork with 'this' not set to the caller."); idx = 0; len = opts.items.length; next_chunk = (function(_this) { return function() { var go_on, progress, ret; progress = (idx + 1) + " - " + Math.min(len, idx + chunk_size) + " / " + len; dfr.notify({ progress: progress, idx: idx, len: len, chunk_size: chunk_size }); go_on = function() { if (idx + chunk_size >= len) { dfr.resolve(); } else { idx = idx + chunk_size; if (timeout === -1) { next_chunk(); } else { CUI.setTimeout({ ms: timeout, call: next_chunk }); } } }; ret = opts.call.call(_this, opts.items.slice(idx, idx + opts.chunk_size), idx, len); if (ret === false) { dfr.reject(); return; } if (CUI.util.isPromise(ret)) { ret.fail(dfr.reject).done(go_on); } else { go_on(); } }; })(this); dfr = new CUI.Deferred(); CUI.setTimeout({ ms: Math.min(0, timeout), call: (function(_this) { return function() { if (len > 0) { return next_chunk(); } else { return dfr.resolve(); } }; })(this) }); return dfr.promise(); }; CUI.chunkWorkOLD = function(objects, chunkSize, timeout) { var dfr, do_next_chunk, idx; if (chunkSize == null) { chunkSize = 10; } if (timeout == null) { timeout = 0; } dfr = new CUI.Deferred(); idx = 0; do_next_chunk = (function(_this) { return function() { var chunk; chunk = 0; while (idx < objects.length && (chunk < chunkSize || chunkSize === 0)) { if (dfr.state() === "rejected") { return; } dfr.notify(objects[idx], idx); if (idx === objects.length - 1) { dfr.resolve(); return; } idx++; chunk++; } if (idx < objects.length) { return CUI.setTimeout(do_next_chunk, timeout); } }; })(this); if (objects.length === 0) { CUI.setTimeout((function(_this) { return function() { if (dfr.state() === "rejected") { return; } return dfr.resolve(); }; })(this)); } else { CUI.setTimeout(do_next_chunk); } return dfr; }; CUI.proxyMethods = function(target, source, methods) { var j, k, len1, results1; results1 = []; for (j = 0, len1 = methods.length; j < len1; j++) { k = methods[j]; results1.push(target.prototype[k] = source.prototype[k]); } return results1; }; CUI.__timeouts = []; CUI.__timeoutCallbacks = []; CUI.__callTimeoutChangeCallbacks = function() { var cb, j, len1, ref, tracked; tracked = this.countTimeouts(); ref = this.__timeoutCallbacks; for (j = 0, len1 = ref.length; j < len1; j++) { cb = ref[j]; cb(tracked); } }; CUI.__removeTimeout = function(timeout) { if (CUI.util.removeFromArray(timeout, this.__timeouts)) { if (timeout.track) { this.__callTimeoutChangeCallbacks(); } } }; CUI.__getTimeoutById = function(timeoutID, ignoreNotFound) { var j, len1, ref, timeout; if (ignoreNotFound == null) { ignoreNotFound = false; } ref = this.__timeouts; for (j = 0, len1 = ref.length; j < len1; j++) { timeout = ref[j]; if (timeout.id === timeoutID) { return timeout; } } CUI.util.assert(ignoreNotFound, "CUI.__getTimeoutById", "Timeout #" + timeoutID + " not found."); return null; }; CUI.resetTimeout = function(timeoutID) { var old_real_id, tid, timeout; timeout = this.__getTimeoutById(timeoutID); CUI.util.assert(!timeout.__isRunning, "CUI.resetTimeout", "Timeout " + timeoutID + " cannot be resetted while running.", { timeout: timeout }); if (typeof timeout.onReset === "function") { timeout.onReset(timeout); } window.clearTimeout(timeout.real_id); old_real_id = timeout.real_id; tid = this.__startTimeout(timeout); return tid; }; CUI.registerTimeoutChangeCallback = function(cb) { return this.__timeoutCallbacks.push(cb); }; CUI.setTimeout = function(_func, ms, track) { var func, onDone, onReset, timeout; if (ms == null) { ms = 0; } if (CUI.isPlainObject(_func)) { ms = _func.ms || 0; track = _func.track; func = _func.call; onDone = _func.onDone; onReset = _func.onReset; } else { func = _func; } if (CUI.util.isNull(track)) { if (ms === 0) { track = false; } else { track = true; } } CUI.util.assert(CUI.isFunction(func), "CUI.setTimeout", "Function needs to be a Function (opts.call)", { parameter: _func }); timeout = { call: (function(_this) { return function() { timeout.__isRunning = true; func(); _this.__removeTimeout(timeout); return typeof timeout.onDone === "function" ? timeout.onDone(timeout) : void 0; }; })(this), ms: ms, func: func, track: track, onDone: onDone, onReset: onReset }; this.__timeouts.push(timeout); if (track && ms > 0) { this.__callTimeoutChangeCallbacks(); } return this.__startTimeout(timeout); }; CUI.__scheduledCallbacks = []; CUI.scheduleCallback = function(_opts) { var cb, dfr, idx, opts, timeoutID; opts = CUI.Element.readOpts(_opts, "CUI.scheduleCallback", { call: { mandatory: true, check: Function }, ms: { "default": 0, check: function(v) { return CUI.util.isInteger(v) && v >= 0; } }, track: { "default": false, check: Boolean } }); idx = CUI.util.idxInArray(opts.call, this.__scheduledCallbacks, function(v) { return v.call === opts.call; }); if (idx > -1 && CUI.isTimeoutRunning(this.__scheduledCallbacks[idx].timeoutID)) { idx = -1; } if (idx === -1) { idx = this.__scheduledCallbacks.length; } else { CUI.resetTimeout(this.__scheduledCallbacks[idx].timeoutID); return this.__scheduledCallbacks[idx].promise; } dfr = new CUI.Deferred(); timeoutID = CUI.setTimeout({ ms: opts.ms, track: opts.track, call: (function(_this) { return function() { opts.call(); return dfr.resolve(); }; })(this) }); cb = this.__scheduledCallbacks[idx] = { call: opts.call, timeoutID: timeoutID, promise: dfr.promise() }; dfr.done((function(_this) { return function() { return CUI.util.removeFromArray(opts.call, _this.__scheduledCallbacks, function(v) { return v.call === opts.call; }); }; })(this)); return cb.promise; }; CUI.scheduleCallbackCancel = function(_opts) { var idx, opts; opts = CUI.Element.readOpts(_opts, "CUI.scheduleCallbackCancel", { call: { mandatory: true, check: Function } }); idx = CUI.util.idxInArray(opts.call, this.__scheduledCallbacks, function(v) { return v.call === opts.call; }); if (idx > -1 && !CUI.isTimeoutRunning(this.__scheduledCallbacks[idx].timeoutID)) { CUI.clearTimeout(this.__scheduledCallbacks[idx].timeoutID); this.__scheduledCallbacks.splice(idx, 1); return true; } else { return false; } }; CUI.utf8ArrayBufferToString = function(arrayBuffer) { var array, c, char2, char3, i, len, out; out = []; array = new Uint8Array(arrayBuffer); len = array.length; i = 0; while (i < len) { c = array[i++]; switch (c >> 4) { case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: out.push(String.fromCharCode(c)); break; case 12: case 13: char2 = array[i++]; out.push(String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F))); break; case 14: char2 = array[i++]; char3 = array[i++]; out.push(String.fromCharCode(((c & 0x0F) << 12) | ((char2 & 0x3F) << 6) | ((char3 & 0x3F) << 0))); } } return out.join(""); }; CUI.__startTimeout = function(timeout) { var real_id; real_id = window.setTimeout(timeout.call, timeout.ms); if (!timeout.id) { timeout.id = real_id; } timeout.real_id = real_id; return timeout.id; }; CUI.countTimeouts = function() { var j, len1, ref, timeout, tracked; tracked = 0; ref = this.__timeouts; for (j = 0, len1 = ref.length; j < len1; j++) { timeout = ref[j]; if (timeout.track) { tracked++; } } return tracked; }; CUI.clearTimeout = function(timeoutID) { var timeout; timeout = this.__getTimeoutById(timeoutID, true); if (!timeout) { return; } window.clearTimeout(timeout.real_id); this.__removeTimeout(timeout); return timeout.id; }; CUI.isTimeoutRunning = function(timeoutID) { var timeout; timeout = this.__getTimeoutById(timeoutID, true); if (!(timeout != null ? timeout.__isRunning : void 0)) { return false; } else { return true; } }; CUI.setInterval = function(func, ms) { return window.setInterval(func, ms); }; CUI.clearInterval = function(interval) { return window.clearInterval(interval); }; CUI.startWebdriverTest = function() { var a; a = "body"; return CUI.dom.addClass(a, "cui-webdriver-test"); }; CUI.mergeMap = function(targetMap, mergeMap) { var k, v; for (k in mergeMap) { v = mergeMap[k]; if (!targetMap.hasOwnProperty(k)) { targetMap[k] = v; } else if (CUI.isPlainObject(targetMap[k]) && CUI.isPlainObject(v)) { CUI.mergeMap(targetMap[k], v); } } return targetMap; }; CUI.getParameterByName = function(name, search) { var regex, results; if (search == null) { search = document.location.search; } name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); regex = new RegExp("[\\?&]" + name + "=([^&#]*)"); results = regex.exec(search); if (results === null) { return ""; } else { return decodeURIComponent(results[1].replace(/\+/g, " ")); } }; CUI.setSessionStorage = function(key, value) { return this.__setStorage("sessionStorage", key, value); }; CUI.getSessionStorage = function(key) { if (key == null) { key = null; } return this.__getStorage("sessionStorage", key); }; CUI.clearSessionStorage = function() { return this.__clearStorage("sessionStorage"); }; CUI.setLocalStorage = function(key, value) { return this.__setStorage("localStorage", key, value); }; CUI.getLocalStorage = function(key) { if (key == null) { key = null; } return this.__getStorage("localStorage", key); }; CUI.clearLocalStorage = function() { return this.__clearStorage("localStorage"); }; CUI.__storage = { localStorage: null, sessionStorage: null }; CUI.__setStorage = function(skey, key, value) { var data, e; data = this.__getStorage(skey); if (value === void 0) { delete data[key]; } else { data[key] = value; } try { window[skey].setItem("CUI", JSON.stringify(data)); } catch (error) { e = error; console.warn("CUI.__setStorage: Storage not available.", e); this.__storage[skey] = JSON.stringify(data); } return data; }; CUI.__getStorage = function(skey, key) { var data, data_json, e; if (key == null) { key = null; } try { data_json = window[skey].getItem("CUI"); } catch (error) { e = error; console.warn("CUI.__getStorage: Storage not available.", e); data_json = this.__storage[skey]; } if (data_json) { data = JSON.parse(data_json); } else { data = {}; } if (key !== null) { return data[key]; } else { return data; } }; CUI.__clearStorage = function(skey) { var e; try { return window[skey].removeItem("CUI"); } catch (error) { e = error; console.warn("CUI.__clearStorage: Storage not available.", e); return this.__storage[skey] = null; } }; CUI.encodeUrlData = function(params, replacer, connect, connect_pair) { var _v, encode_func, j, k, len1, url, v; if (replacer == null) { replacer = null; } if (connect == null) { connect = "&"; } if (connect_pair == null) { connect_pair = "="; } url = []; if (replacer) { if (CUI.isFunction(replacer)) { encode_func = replacer; } else { encode_func = function(v) { return CUI.stringMapReplace(v + "", replace_map); }; } } else { encode_func = function(v) { return encodeURIComponent(v); }; } for (k in params) { v = params[k]; if (CUI.isArray(v)) { for (j = 0, len1 = v.length; j < len1; j++) { _v = v[j]; url.push(encode_func(k) + connect_pair + encode_func(_v)); } } else if (!CUI.util.isEmpty(v)) { url.push(encode_func(k) + connect_pair + encode_func(v)); } else if (v !== void 0) { url.push(encode_func(k)); } } return url.join(connect); }; CUI.encodeURIComponentNicely = function(str) { var j, len1, ref, s, v; if (str == null) { str = ""; } s = []; ref = (str + "").split(""); for (j = 0, len1 = ref.length; j < len1; j++) { v = ref[j]; if (v === "," || v === ":") { s.push(v); } else { s.push(encodeURIComponent(v)); } } return s.join(""); }; CUI.decodeURIComponentNicely = function(v) { return decodeURIComponent(v); }; CUI.decodeUrlData = function(url, replacer, connect, connect_pair, use_array) { var decode_func, j, key, len1, pair, params, part, ref, value; if (replacer == null) { replacer = null; } if (connect == null) { connect = "&"; } if (connect_pair == null) { connect_pair = "="; } if (use_array == null) { use_array = false; } params = {}; if (replacer) { if (CUI.isFunction(replacer)) { decode_func = replacer; } else { decode_func = function(v) { return CUI.stringMapReplace(v + "", replacer); }; } } else { decode_func = function(v) { return decodeURIComponent(v); }; } ref = url.split(connect); for (j = 0, len1 = ref.length; j < len1; j++) { part = ref[j]; if (part.length === 0) { continue; } if (part.indexOf(connect_pair) > -1) { pair = part.split(connect_pair); key = decode_func(pair[0]); value = decode_func(pair[1]); } else { key = decode_func(part); value = ""; } if (use_array) { if (!params[key]) { params[key] = []; } params[key].push(value); } else { params[key] = value; } } return params; }; CUI.decodeUrlDataArray = function(url, replace_map, connect, connect_pair) { if (replace_map == null) { replace_map = null; } if (connect == null) { connect = "&"; } if (connect_pair == null) { connect_pair = "="; } return this.decodeUrlData(url, replace_map, connect, connect_pair, true); }; CUI.revertMap = function(map) { var k, map_reverted, v; map_reverted = {}; for (k in map) { v = map[k]; map_reverted[v] = k; } return map_reverted; }; CUI.stringMapReplace = function(s, map) { var key, regex; regex = []; for (key in map) { if (CUI.util.isEmpty(key)) { continue; } regex.push(key.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")); } if (regex.length > 0) { return s.replace(new RegExp(regex.join('|'), "g"), function(word) { return map[word]; }); } else { return s; } }; CUI.isFunction = function(v) { return v && typeof v === "function"; }; CUI.isPlainObject = function(v) { var ref; return v && typeof v === "object" && ((ref = v.constructor) != null ? ref.prototype.hasOwnProperty("isPrototypeOf") : void 0); }; CUI.isEmptyObject = function(v) { var k; for (k in v) { return false; } return true; }; CUI.isMap = function(v) { return this.isPlainObject(v); }; CUI.isArray = function(v) { return Array.isArray(v); }; CUI.inArray = function(value, array) { return array.indexOf(value); }; CUI.isString = function(s) { return typeof s === "string"; }; CUI.downloadData = function(data, fileName) { var blob, url; blob = new Blob([data], { type: "octet/stream" }); url = window.URL.createObjectURL(blob); this.__downloadDataElement.href = url; this.__downloadDataElement.download = fileName; this.__downloadDataElement.click(); return window.URL.revokeObjectURL(url); }; CUI.urlRegex = new RegExp("^" + "(?:(?:(ftp|ftps|https|http))://|)" + "(?:(\\S+?)(?::(\\S*))?@)?" + "((?:(?:" + "(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" + "(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" + "(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" + "|" + "(?:[a-z\\u00a1-\\uffff0-9-*][a-z\\u00a1-\\uffff0-9-]*\\.)*" + "(?:[a-z\\u00a1-\\uffff]{2,})" + "))|)" + "(?::(\\d{2,5}))?" + "(?:([/?#]\\S*))?" + "$", "i"); CUI.evalCode = function(code) { var script; script = document.createElement("script"); script.text = code; return document.head.appendChild(script).parentNode.removeChild(script); }; CUI.appendToUrl = function(url, data) { var key, value; for (key in data) { value = data[key]; if (value === void 0) { continue; } if (url.match(/\?/)) { url += "&"; } else { url += "?"; } url += encodeURIComponent(key) + "=" + encodeURIComponent(value); } return url; }; CUI.parseLocation = function(url) { var _match, match, p; if (!CUI.isFunction(url != null ? url.match : void 0) || url.length === 0) { return null; } match = url.match(this.urlRegex); if (!match) { return null; } p = { protocol: match[1] || "", user: match[2] || "", password: match[3] || "", hostname: match[4] || "", port: match[5] || "", path: match[6] || "", origin: "" }; if (p.hostname) { if (!p.protocol) { p.protocol = "http"; } p.origin = p.protocol + "://" + p.hostname; if (p.port) { p.origin += ":" + p.port; } p.url = p.protocol + "://"; if (p.user) { p.url = p.url + p.user + ":" + p.password + "@"; } p.url = p.url + p.hostname; if (p.port) { p.url = p.url + ":" + p.port; } } else { p.url = ""; } if (p.path.length > 0) { _match = p.path.match(/(.*?)(|\?.*?)(|\#.*)$/); p.pathname = _match[1]; p.search = _match[2]; if (p.search === "?") { p.search = ""; } p.fragment = _match[3]; } else { p.search = ""; p.pathname = ""; p.fragment = ""; } p.href = p.origin + p.path; p.hash = p.fragment; if (p.login) { p.auth = btoa(p.user + ":" + p.password); } p.url = p.url + p.path; return p; }; CUI.escapeAttribute = function(data) { if (CUI.util.isNull(data) || !CUI.util.isString(data)) { return ""; } data = data.replace(/"/g, "&quot;").replace(/\'/g, "&#39;"); return data; }; CUI.browser = (function() { var map; map = { opera: (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0, firefox: typeof InstallTrigger !== 'undefined', safari: Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0, ie: /*@cc_on!@*/false || !!document.documentMode, chrome: !!window.chrome && !!window.chrome.webstore }; map.edge = !map.ie && !!window.StyleMedia; map.blink = (map.chrome || map.opera) && !!window.CSS; return map; })(); return CUI; })(); CUI.ready((function(_this) { return function() { var k, nodes; for (k in CUI.browser) { if (CUI.browser[k]) { document.body.classList.add("cui-browser-" + k); } } CUI.defaults.marked_opts = { renderer: new marked.Renderer(), gfm: true, tables: true, breaks: false, pedantic: false, sanitize: true, smartLists: true, smartypants: false }; marked.setOptions(CUI.defaults.marked_opts); nodes = CUI.dom.htmlToNodes("<!-- CUI.CUI --><a style='display: none;'></a><!-- /CUI.CUI -->"); CUI.__downloadDataElement = nodes[1]; return CUI.dom.append(document.body, nodes); }; })(this)); if (!window.addEventListener) { alert("Your browser is not supported. Please update to a current version of Google Chrome, Mozilla Firefox or Internet Explorer."); } else { window.addEventListener("load", (function(_this) { return function() { return CUI.start(); }; })(this)); } module.exports = CUI; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {//! moment.js //! version : 2.18.1 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com ;(function (global, factory) { true ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.moment = factory() }(this, (function () { 'use strict'; var hookCallback; function hooks () { return hookCallback.apply(null, arguments); } // This is done to register the method called with moment() // without creating circular dependencies. function setHookCallback (callback) { hookCallback = callback; } function isArray(input) { return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; } function isObject(input) { // IE8 will treat undefined and null as object if it wasn't for // input != null return input != null && Object.prototype.toString.call(input) === '[object Object]'; } function isObjectEmpty(obj) { var k; for (k in obj) { // even if its not own property I'd still call it non-empty return false; } return true; } function isUndefined(input) { return input === void 0; } function isNumber(input) { return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; } function isDate(input) { return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; } function map(arr, fn) { var res = [], i; for (i = 0; i < arr.length; ++i) { res.push(fn(arr[i], i)); } return res; } function hasOwnProp(a, b) { return Object.prototype.hasOwnProperty.call(a, b); } function extend(a, b) { for (var i in b) { if (hasOwnProp(b, i)) { a[i] = b[i]; } } if (hasOwnProp(b, 'toString')) { a.toString = b.toString; } if (hasOwnProp(b, 'valueOf')) { a.valueOf = b.valueOf; } return a; } function createUTC (input, format, locale, strict) { return createLocalOrUTC(input, format, locale, strict, true).utc(); } function defaultParsingFlags() { // We need to deep clone this object. return { empty : false, unusedTokens : [], unusedInput : [], overflow : -2, charsLeftOver : 0, nullInput : false, invalidMonth : null, invalidFormat : false, userInvalidated : false, iso : false, parsedDateParts : [], meridiem : null, rfc2822 : false, weekdayMismatch : false }; } function getParsingFlags(m) { if (m._pf == null) { m._pf = defaultParsingFlags(); } return m._pf; } var some; if (Array.prototype.some) { some = Array.prototype.some; } else { some = function (fun) { var t = Object(this); var len = t.length >>> 0; for (var i = 0; i < len; i++) { if (i in t && fun.call(this, t[i], i, t)) { return true; } } return false; }; } var some$1 = some; function isValid(m) { if (m._isValid == null) { var flags = getParsingFlags(m); var parsedParts = some$1.call(flags.parsedDateParts, function (i) { return i != null; }); var isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidMonth && !flags.invalidWeekday && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || (flags.meridiem && parsedParts)); if (m._strict) { isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === undefined; } if (Object.isFrozen == null || !Object.isFrozen(m)) { m._isValid = isNowValid; } else { return isNowValid; } } return m._isValid; } function createInvalid (flags) { var m = createUTC(NaN); if (flags != null) { extend(getParsingFlags(m), flags); } else { getParsingFlags(m).userInvalidated = true; } return m; } // Plugins that add properties should also add the key here (null value), // so we can properly clone ourselves. var momentProperties = hooks.momentProperties = []; function copyConfig(to, from) { var i, prop, val; if (!isUndefined(from._isAMomentObject)) { to._isAMomentObject = from._isAMomentObject; } if (!isUndefined(from._i)) { to._i = from._i; } if (!isUndefined(from._f)) { to._f = from._f; } if (!isUndefined(from._l)) { to._l = from._l; } if (!isUndefined(from._strict)) { to._strict = from._strict; } if (!isUndefined(from._tzm)) { to._tzm = from._tzm; } if (!isUndefined(from._isUTC)) { to._isUTC = from._isUTC; } if (!isUndefined(from._offset)) { to._offset = from._offset; } if (!isUndefined(from._pf)) { to._pf = getParsingFlags(from); } if (!isUndefined(from._locale)) { to._locale = from._locale; } if (momentProperties.length > 0) { for (i = 0; i < momentProperties.length; i++) { prop = momentProperties[i]; val = from[prop]; if (!isUndefined(val)) { to[prop] = val; } } } return to; } var updateInProgress = false; // Moment prototype object function Moment(config) { copyConfig(this, config); this._d = new Date(config._d != null ? config._d.getTime() : NaN); if (!this.isValid()) { this._d = new Date(NaN); } // Prevent infinite loop in case updateOffset creates new moment // objects. if (updateInProgress === false) { updateInProgress = true; hooks.updateOffset(this); updateInProgress = false; } } function isMoment (obj) { return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); } function absFloor (number) { if (number < 0) { // -0 -> 0 return Math.ceil(number) || 0; } else { return Math.floor(number); } } function toInt(argumentForCoercion) { var coercedNumber = +argumentForCoercion, value = 0; if (coercedNumber !== 0 && isFinite(coercedNumber)) { value = absFloor(coercedNumber); } return value; } // compare two arrays, return the number of differences function compareArrays(array1, array2, dontConvert) { var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i; for (i = 0; i < len; i++) { if ((dontConvert && array1[i] !== array2[i]) || (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { diffs++; } } return diffs + lengthDiff; } function warn(msg) { if (hooks.suppressDeprecationWarnings === false && (typeof console !== 'undefined') && console.warn) { console.warn('Deprecation warning: ' + msg); } } function deprecate(msg, fn) { var firstTime = true; return extend(function () { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(null, msg); } if (firstTime) { var args = []; var arg; for (var i = 0; i < arguments.length; i++) { arg = ''; if (typeof arguments[i] === 'object') { arg += '\n[' + i + '] '; for (var key in arguments[0]) { arg += key + ': ' + arguments[0][key] + ', '; } arg = arg.slice(0, -2); // Remove trailing comma and space } else { arg = arguments[i]; } args.push(arg); } warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments); }, fn); } var deprecations = {}; function deprecateSimple(name, msg) { if (hooks.deprecationHandler != null) { hooks.deprecationHandler(name, msg); } if (!deprecations[name]) { warn(msg); deprecations[name] = true; } } hooks.suppressDeprecationWarnings = false; hooks.deprecationHandler = null; function isFunction(input) { return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; } function set (config) { var prop, i; for (i in config) { prop = config[i]; if (isFunction(prop)) { this[i] = prop; } else { this['_' + i] = prop; } } this._config = config; // Lenient ordinal parsing accepts just a number in addition to // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. // TODO: Remove "ordinalParse" fallback in next major release. this._dayOfMonthOrdinalParseLenient = new RegExp( (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + (/\d{1,2}/).source); } function mergeConfigs(parentConfig, childConfig) { var res = extend({}, parentConfig), prop; for (prop in childConfig) { if (hasOwnProp(childConfig, prop)) { if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { res[prop] = {}; extend(res[prop], parentConfig[prop]); extend(res[prop], childConfig[prop]); } else if (childConfig[prop] != null) { res[prop] = childConfig[prop]; } else { delete res[prop]; } } } for (prop in parentConfig) { if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) { // make sure changes to properties don't modify parent config res[prop] = extend({}, res[prop]); } } return res; } function Locale(config) { if (config != null) { this.set(config); } } var keys; if (Object.keys) { keys = Object.keys; } else { keys = function (obj) { var i, res = []; for (i in obj) { if (hasOwnProp(obj, i)) { res.push(i); } } return res; }; } var keys$1 = keys; var defaultCalendar = { sameDay : '[Today at] LT', nextDay : '[Tomorrow at] LT', nextWeek : 'dddd [at] LT', lastDay : '[Yesterday at] LT', lastWeek : '[Last] dddd [at] LT', sameElse : 'L' }; function calendar (key, mom, now) { var output = this._calendar[key] || this._calendar['sameElse']; return isFunction(output) ? output.call(mom, now) : output; } var defaultLongDateFormat = { LTS : 'h:mm:ss A', LT : 'h:mm A', L : 'MM/DD/YYYY', LL : 'MMMM D, YYYY', LLL : 'MMMM D, YYYY h:mm A', LLLL : 'dddd, MMMM D, YYYY h:mm A' }; function longDateFormat (key) { var format = this._longDateFormat[key], formatUpper = this._longDateFormat[key.toUpperCase()]; if (format || !formatUpper) { return format; } this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { return val.slice(1); }); return this._longDateFormat[key]; } var defaultInvalidDate = 'Invalid date'; function invalidDate () { return this._invalidDate; } var defaultOrdinal = '%d'; var defaultDayOfMonthOrdinalParse = /\d{1,2}/; function ordinal (number) { return this._ordinal.replace('%d', number); } var defaultRelativeTime = { future : 'in %s', past : '%s ago', s : 'a few seconds', ss : '%d seconds', m : 'a minute', mm : '%d minutes', h : 'an hour', hh : '%d hours', d : 'a day', dd : '%d days', M : 'a month', MM : '%d months', y : 'a year', yy : '%d years' }; function relativeTime (number, withoutSuffix, string, isFuture) { var output = this._relativeTime[string]; return (isFunction(output)) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number); } function pastFuture (diff, output) { var format = this._relativeTime[diff > 0 ? 'future' : 'past']; return isFunction(format) ? format(output) : format.replace(/%s/i, output); } var aliases = {}; function addUnitAlias (unit, shorthand) { var lowerCase = unit.toLowerCase(); aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; } function normalizeUnits(units) { return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; } function normalizeObjectUnits(inputObject) { var normalizedInput = {}, normalizedProp, prop; for (prop in inputObject) { if (hasOwnProp(inputObject, prop)) { normalizedProp = normalizeUnits(prop); if (normalizedProp) { normalizedInput[normalizedProp] = inputObject[prop]; } } } return normalizedInput; } var priorities = {}; function addUnitPriority(unit, priority) { priorities[unit] = priority; } function getPrioritizedUnits(unitsObj) { var units = []; for (var u in unitsObj) { units.push({unit: u, priority: priorities[u]}); } units.sort(function (a, b) { return a.priority - b.priority; }); return units; } function makeGetSet (unit, keepTime) { return function (value) { if (value != null) { set$1(this, unit, value); hooks.updateOffset(this, keepTime); return this; } else { return get(this, unit); } }; } function get (mom, unit) { return mom.isValid() ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; } function set$1 (mom, unit, value) { if (mom.isValid()) { mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); } } // MOMENTS function stringGet (units) { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](); } return this; } function stringSet (units, value) { if (typeof units === 'object') { units = normalizeObjectUnits(units); var prioritized = getPrioritizedUnits(units); for (var i = 0; i < prioritized.length; i++) { this[prioritized[i].unit](units[prioritized[i].unit]); } } else { units = normalizeUnits(units); if (isFunction(this[units])) { return this[units](value); } } return this; } function zeroFill(number, targetLength, forceSign) { var absNumber = '' + Math.abs(number), zerosToFill = targetLength - absNumber.length, sign = number >= 0; return (sign ? (forceSign ? '+' : '') : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; } var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; var formatFunctions = {}; var formatTokenFunctions = {}; // token: 'M' // padded: ['MM', 2] // ordinal: 'Mo' // callback: function () { this.month() + 1 } function addFormatToken (token, padded, ordinal, callback) { var func = callback; if (typeof callback === 'string') { func = function () { return this[callback](); }; } if (token) { formatTokenFunctions[token] = func; } if (padded) { formatTokenFunctions[padded[0]] = function () { return zeroFill(func.apply(this, arguments), padded[1], padded[2]); }; } if (ordinal) { formatTokenFunctions[ordinal] = function () { return this.localeData().ordinal(func.apply(this, arguments), token); }; } } function removeFormattingTokens(input) { if (input.match(/\[[\s\S]/))