/* ---- /1MaiL5gfBM1cyb4a8e3iiL8L5gXmoAJu27/js/lib/Base64Number.js ---- */ window.Base64Number = { _Rixits : "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/", fromNumber : function(number) { if (isNaN(Number(number)) || number === null || number === Number.POSITIVE_INFINITY) throw "The input is not valid"; if (number < 0) throw "Can't represent negative numbers now"; var rixit; // like 'digit', only in some non-decimal radix var residual = Math.floor(number); var result = ''; while (true) { rixit = residual % 64 result = this._Rixits.charAt(rixit) + result; residual = Math.floor(residual / 64); if (residual == 0) break; } return result; }, toNumber : function(rixits) { var result = 0; rixits = rixits.split(''); for (var e = 0; e < rixits.length; e++) { result = (result * 64) + this._Rixits.indexOf(rixits[e]); } return result; } }; /* ---- /1MaiL5gfBM1cyb4a8e3iiL8L5gXmoAJu27/js/lib/Promise.coffee ---- */ (function() { var Promise, __slice = [].slice; Promise = (function() { Promise.when = function() { var args, num_uncompleted, promise, task, task_id, tasks, _fn, _i, _len; tasks = 1 <= arguments.length ? __slice.call(arguments, 0) : []; num_uncompleted = tasks.length; args = new Array(num_uncompleted); promise = new Promise(); _fn = function(task_id) { return task.then(function() { args[task_id] = Array.prototype.slice.call(arguments); num_uncompleted--; if (num_uncompleted === 0) { return promise.complete.apply(promise, args); } }); }; for (task_id = _i = 0, _len = tasks.length; _i < _len; task_id = ++_i) { task = tasks[task_id]; _fn(task_id); } return promise; }; function Promise() { this.resolved = false; this.end_promise = null; this.result = null; this.callbacks = []; } Promise.prototype.resolve = function() { var back, callback, _i, _len, _ref; if (this.resolved) { return false; } this.resolved = true; this.data = arguments; if (!arguments.length) { this.data = [true]; } this.result = this.data[0]; _ref = this.callbacks; for (_i = 0, _len = _ref.length; _i < _len; _i++) { callback = _ref[_i]; back = callback.apply(callback, this.data); } if (this.end_promise) { return this.end_promise.resolve(back); } }; Promise.prototype.fail = function() { return this.resolve(false); }; Promise.prototype.then = function(callback) { if (this.resolved === true) { callback.apply(callback, this.data); return; } this.callbacks.push(callback); return this.end_promise = new Promise(); }; return Promise; })(); window.Promise = Promise; /* s = Date.now() log = (text) -> console.log Date.now()-s, Array.prototype.slice.call(arguments).join(", ") log "Started" cmd = (query) -> p = new Promise() setTimeout ( -> p.resolve query+" Result" ), 100 return p back = cmd("SELECT * FROM message").then (res) -> log res return "Return from query" .then (res) -> log "Back then", res log "Query started", back */ }).call(this); /* ---- /1MaiL5gfBM1cyb4a8e3iiL8L5gXmoAJu27/js/lib/Property.coffee ---- */ (function() { Function.prototype.property = function(prop, desc) { return Object.defineProperty(this.prototype, prop, desc); }; }).call(this); /* ---- /1MaiL5gfBM1cyb4a8e3iiL8L5gXmoAJu27/js/lib/maquette.js ---- */ (function (global) { "use strict"; // Utilities var emptyArray = []; var extend = function (base, overrides) { var result = {}; Object.keys(base).forEach(function (key) { result[key] = base[key]; }); if(overrides) { Object.keys(overrides).forEach(function (key) { result[key] = overrides[key]; }); } return result; }; // Hyperscript helper functions var appendChildren = function (parentSelector, insertions, main) { for(var i = 0; i < insertions.length; i++) { var item = insertions[i]; if(Array.isArray(item)) { appendChildren(parentSelector, item, main); } else { if(item !== null && item !== undefined) { if(!item.hasOwnProperty("vnodeSelector")) { item = toTextVNode(item); } main.push(item); } } } }; var toTextVNode = function (data) { return { vnodeSelector: "", properties: undefined, children: undefined, text: (data === null || data === undefined) ? "" : data.toString(), domNode: null }; }; // Render helper functions var missingTransition = function() { throw new Error("Provide a transitions object to the projectionOptions to do animations"); }; var defaultProjectionOptions = { namespace: undefined, eventHandlerInterceptor: undefined, styleApplyer: function(domNode, styleName, value) { // Provides a hook to add vendor prefixes for browsers that still need it. domNode.style[styleName] = value; }, transitions: { enter: missingTransition, exit: missingTransition } }; var applyDefaultProjectionOptions = function (projectionOptions) { return extend(defaultProjectionOptions, projectionOptions); }; var setProperties = function (domNode, properties, projectionOptions) { if(!properties) { return; } var eventHandlerInterceptor = projectionOptions.eventHandlerInterceptor; for(var propName in properties) { var propValue = properties[propName]; if(propName === "class" || propName === "className" || propName === "classList") { throw new Error("Property " + propName + " is not supported, use 'classes' instead."); } else if(propName === "classes") { // object with string keys and boolean values for(var className in propValue) { if(propValue[className]) { domNode.classList.add(className); } } } else if(propName === "styles") { // object with string keys and string (!) values for(var styleName in propValue) { var styleValue = propValue[styleName]; if(styleValue) { if(typeof styleValue !== "string") { throw new Error("Style values may only be strings"); } projectionOptions.styleApplyer(domNode, styleName, styleValue); } } } else if(propName === "key") { continue; } else if(propValue === null || propValue === undefined) { continue; } else { var type = typeof propValue; if(type === "function") { if(eventHandlerInterceptor && (propName.lastIndexOf("on", 0) === 0)) { // lastIndexOf(,0)===0 -> startsWith propValue = eventHandlerInterceptor(propName, propValue, domNode, properties); // intercept eventhandlers if(propName === "oninput") { (function () { // record the evt.target.value, because IE sometimes does a requestAnimationFrame between changing value and running oninput var oldPropValue = propValue; propValue = function (evt) { evt.target["oninput-value"] = evt.target.value; oldPropValue.apply(this, [evt]); }; }()); } } domNode[propName] = propValue; } else if(type === "string" && propName !== "value") { domNode.setAttribute(propName, propValue); } else { domNode[propName] = propValue; } } } }; var updateProperties = function (domNode, previousProperties, properties, projectionOptions) { if(!properties) { return; } var propertiesUpdated = false; for(var propName in properties) { // assuming that properties will be nullified instead of missing is by design var propValue = properties[propName]; var previousValue = previousProperties[propName]; if(propName === "classes") { var classList = domNode.classList; for(var className in propValue) { var on = !!propValue[className]; var previousOn = !!previousValue[className]; if(on === previousOn) { continue; } propertiesUpdated = true; if(on) { classList.add(className); } else { classList.remove(className); } } } else if(propName === "styles") { for(var styleName in propValue) { var newStyleValue = propValue[styleName]; var oldStyleValue = previousValue[styleName]; if(newStyleValue === oldStyleValue) { continue; } propertiesUpdated = true; if(newStyleValue) { if(typeof newStyleValue !== "string") { throw new Error("Style values may only be strings"); } projectionOptions.styleApplyer(domNode, styleName, newStyleValue); } else { projectionOptions.styleApplyer(domNode, styleName, ""); } } } else { if(!propValue && typeof previousValue === "string") { propValue = ""; } if(propName === "value") { // value can be manipulated by the user directly and using event.preventDefault() is not an option if(domNode[propName] !== propValue && domNode["oninput-value"] !== propValue) { domNode[propName] = propValue; // Reset the value, even if the virtual DOM did not change domNode["oninput-value"] = undefined; } // else do not update the domNode, otherwise the cursor position would be changed if(propValue !== previousValue) { propertiesUpdated = true; } } else if(propValue !== previousValue) { var type = typeof propValue; if(type === "function") { throw new Error("Functions may not be updated on subsequent renders (property: " + propName + "). Hint: declare event handler functions outside the render() function."); } if(type === "string") { domNode.setAttribute(propName, propValue); } else { if(domNode[propName] !== propValue) { // Comparison is here for side-effects in Edge with scrollLeft and scrollTop domNode[propName] = propValue; } } propertiesUpdated = true; } } } return propertiesUpdated; }; var addChildren = function (domNode, children, projectionOptions) { if(!children) { return; } for(var i = 0; i < children.length; i++) { createDom(children[i], domNode, undefined, projectionOptions); } }; var same = function (vnode1, vnode2) { if(vnode1.vnodeSelector !== vnode2.vnodeSelector) { return false; } if(vnode1.properties && vnode2.properties) { return vnode1.properties.key === vnode2.properties.key; } return !vnode1.properties && !vnode2.properties; }; var findIndexOfChild = function (children, sameAs, start) { if(sameAs.vnodeSelector !== "") { // Never scan for text-nodes for(var i = start; i < children.length; i++) { if(same(children[i], sameAs)) { return i; } } } return -1; }; var nodeAdded = function (vNode, transitions) { if(vNode.properties) { var enterAnimation = vNode.properties.enterAnimation; if(enterAnimation) { if(typeof enterAnimation === "function") { enterAnimation(vNode.domNode, vNode.properties); } else { transitions.enter(vNode.domNode, vNode.properties, enterAnimation); } } } }; var nodeToRemove = function (vNode, transitions) { var domNode = vNode.domNode; if(vNode.properties) { var exitAnimation = vNode.properties.exitAnimation; if(exitAnimation) { domNode.style.pointerEvents = "none"; var removeDomNode = function () { if(domNode.parentNode) { domNode.parentNode.removeChild(domNode); } }; if(typeof exitAnimation === "function") { exitAnimation(domNode, removeDomNode, vNode.properties); return; } else { transitions.exit(vNode.domNode, vNode.properties, exitAnimation, removeDomNode); return; } } } if(domNode.parentNode) { domNode.parentNode.removeChild(domNode); } }; var checkDistinguishable = function(childNodes, indexToCheck, parentVNode, operation) { var childNode = childNodes[indexToCheck]; if (childNode.vnodeSelector === "") { return; // Text nodes need not be distinguishable } var key = childNode.properties ? childNode.properties.key : undefined; if (!key) { // A key is just assumed to be unique for (var i = 0; i < childNodes.length; i++) { if (i !== indexToCheck) { var node = childNodes[i]; if (same(node, childNode)) { if (operation === "added") { throw new Error(parentVNode.vnodeSelector + " had a " + childNode.vnodeSelector + " child " + "added, but there is now more than one. You must add unique key properties to make them distinguishable."); } else { throw new Error(parentVNode.vnodeSelector + " had a " + childNode.vnodeSelector + " child " + "removed, but there were more than one. You must add unique key properties to make them distinguishable."); } } } } } }; var updateChildren = function (vnode, domNode, oldChildren, newChildren, projectionOptions) { if(oldChildren === newChildren) { return false; } oldChildren = oldChildren || emptyArray; newChildren = newChildren || emptyArray; var oldChildrenLength = oldChildren.length; var newChildrenLength = newChildren.length; var transitions = projectionOptions.transitions; var oldIndex = 0; var newIndex = 0; var i; var textUpdated = false; while(newIndex < newChildrenLength) { var oldChild = (oldIndex < oldChildrenLength) ? oldChildren[oldIndex] : undefined; var newChild = newChildren[newIndex]; if(oldChild !== undefined && same(oldChild, newChild)) { textUpdated = updateDom(oldChild, newChild, projectionOptions) || textUpdated; oldIndex++; } else { var findOldIndex = findIndexOfChild(oldChildren, newChild, oldIndex + 1); if(findOldIndex >= 0) { // Remove preceding missing children for(i = oldIndex; i < findOldIndex; i++) { nodeToRemove(oldChildren[i], transitions); checkDistinguishable(oldChildren, i, vnode, "removed"); } textUpdated = updateDom(oldChildren[findOldIndex], newChild, projectionOptions) || textUpdated; oldIndex = findOldIndex + 1; } else { // New child createDom(newChild, domNode, (oldIndex < oldChildrenLength) ? oldChildren[oldIndex].domNode : undefined, projectionOptions); nodeAdded(newChild, transitions); checkDistinguishable(newChildren, newIndex, vnode, "added"); } } newIndex++; } if(oldChildrenLength > oldIndex) { // Remove child fragments for(i = oldIndex; i < oldChildrenLength; i++) { nodeToRemove(oldChildren[i], transitions); checkDistinguishable(oldChildren, i, vnode, "removed"); } } return textUpdated; }; var createDom = function (vnode, parentNode, insertBefore, projectionOptions) { var domNode, i, c, start = 0, type, found; var vnodeSelector = vnode.vnodeSelector; if(vnodeSelector === "") { domNode = vnode.domNode = document.createTextNode(vnode.text); if(insertBefore !== undefined) { parentNode.insertBefore(domNode, insertBefore); } else { parentNode.appendChild(domNode); } } else { for (i = 0; i <= vnodeSelector.length; ++i) { c = vnodeSelector.charAt(i); if (i === vnodeSelector.length || c === '.' || c === '#') { type = vnodeSelector.charAt(start - 1); found = vnodeSelector.slice(start, i); if (type === ".") { domNode.classList.add(found); } else if (type === "#") { domNode.id = found; } else { if (found === "svg") { projectionOptions = extend(projectionOptions, { namespace: "http://www.w3.org/2000/svg" }); } if (projectionOptions.namespace !== undefined) { domNode = vnode.domNode = document.createElementNS(projectionOptions.namespace, found); } else { domNode = vnode.domNode = document.createElement(found); } if (insertBefore !== undefined) { parentNode.insertBefore(domNode, insertBefore); } else { parentNode.appendChild(domNode); } } start = i + 1; } } initPropertiesAndChildren(domNode, vnode, projectionOptions); } }; var initPropertiesAndChildren = function (domNode, vnode, projectionOptions) { addChildren(domNode, vnode.children, projectionOptions); // children before properties, needed for value property of