UNPKG

getting-started

Version:

Tutoral for Getting Started with Taunus

1,840 lines (1,570 loc) 279 kB
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; process.nextTick = (function () { var canSetImmediate = typeof window !== 'undefined' && window.setImmediate; var canMutationObserver = typeof window !== 'undefined' && window.MutationObserver; var canPost = typeof window !== 'undefined' && window.postMessage && window.addEventListener ; if (canSetImmediate) { return function (f) { return window.setImmediate(f) }; } var queue = []; if (canMutationObserver) { var hiddenDiv = document.createElement("div"); var observer = new MutationObserver(function () { var queueList = queue.slice(); queue.length = 0; queueList.forEach(function (fn) { fn(); }); }); observer.observe(hiddenDiv, { attributes: true }); return function nextTick(fn) { if (!queue.length) { hiddenDiv.setAttribute('yes', 'no'); } queue.push(fn); }; } if (canPost) { window.addEventListener('message', function (ev) { var source = ev.source; if ((source === window || source === null) && ev.data === 'process-tick') { ev.stopPropagation(); if (queue.length > 0) { var fn = queue.shift(); fn(); } } }, true); return function nextTick(fn) { queue.push(fn); window.postMessage('process-tick', '*'); }; } return function nextTick(fn) { setTimeout(fn, 0); }; })(); process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.binding = function (name) { throw new Error('process.binding is not supported'); }; // TODO(shtylman) process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; },{}],2:[function(require,module,exports){ (function (global){ /*! http://mths.be/punycode v1.2.4 by @mathias */ ;(function(root) { /** Detect free variables */ var freeExports = typeof exports == 'object' && exports; var freeModule = typeof module == 'object' && module && module.exports == freeExports && module; var freeGlobal = typeof global == 'object' && global; if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { root = freeGlobal; } /** * The `punycode` object. * @name punycode * @type Object */ var punycode, /** Highest positive signed 32-bit float value */ maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 /** Bootstring parameters */ base = 36, tMin = 1, tMax = 26, skew = 38, damp = 700, initialBias = 72, initialN = 128, // 0x80 delimiter = '-', // '\x2D' /** Regular expressions */ regexPunycode = /^xn--/, regexNonASCII = /[^ -~]/, // unprintable ASCII chars + non-ASCII chars regexSeparators = /\x2E|\u3002|\uFF0E|\uFF61/g, // RFC 3490 separators /** Error messages */ errors = { 'overflow': 'Overflow: input needs wider integers to process', 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', 'invalid-input': 'Invalid input' }, /** Convenience shortcuts */ baseMinusTMin = base - tMin, floor = Math.floor, stringFromCharCode = String.fromCharCode, /** Temporary variable */ key; /*--------------------------------------------------------------------------*/ /** * A generic error utility function. * @private * @param {String} type The error type. * @returns {Error} Throws a `RangeError` with the applicable error message. */ function error(type) { throw RangeError(errors[type]); } /** * A generic `Array#map` utility function. * @private * @param {Array} array The array to iterate over. * @param {Function} callback The function that gets called for every array * item. * @returns {Array} A new array of values returned by the callback function. */ function map(array, fn) { var length = array.length; while (length--) { array[length] = fn(array[length]); } return array; } /** * A simple `Array#map`-like wrapper to work with domain name strings. * @private * @param {String} domain The domain name. * @param {Function} callback The function that gets called for every * character. * @returns {Array} A new string of characters returned by the callback * function. */ function mapDomain(string, fn) { return map(string.split(regexSeparators), fn).join('.'); } /** * Creates an array containing the numeric code points of each Unicode * character in the string. While JavaScript uses UCS-2 internally, * this function will convert a pair of surrogate halves (each of which * UCS-2 exposes as separate characters) into a single code point, * matching UTF-16. * @see `punycode.ucs2.encode` * @see <http://mathiasbynens.be/notes/javascript-encoding> * @memberOf punycode.ucs2 * @name decode * @param {String} string The Unicode input string (UCS-2). * @returns {Array} The new array of code points. */ function ucs2decode(string) { var output = [], counter = 0, length = string.length, value, extra; while (counter < length) { value = string.charCodeAt(counter++); if (value >= 0xD800 && value <= 0xDBFF && counter < length) { // high surrogate, and there is a next character extra = string.charCodeAt(counter++); if ((extra & 0xFC00) == 0xDC00) { // low surrogate output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); } else { // unmatched surrogate; only append this code unit, in case the next // code unit is the high surrogate of a surrogate pair output.push(value); counter--; } } else { output.push(value); } } return output; } /** * Creates a string based on an array of numeric code points. * @see `punycode.ucs2.decode` * @memberOf punycode.ucs2 * @name encode * @param {Array} codePoints The array of numeric code points. * @returns {String} The new Unicode string (UCS-2). */ function ucs2encode(array) { return map(array, function(value) { var output = ''; if (value > 0xFFFF) { value -= 0x10000; output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); value = 0xDC00 | value & 0x3FF; } output += stringFromCharCode(value); return output; }).join(''); } /** * Converts a basic code point into a digit/integer. * @see `digitToBasic()` * @private * @param {Number} codePoint The basic numeric code point value. * @returns {Number} The numeric value of a basic code point (for use in * representing integers) in the range `0` to `base - 1`, or `base` if * the code point does not represent a value. */ function basicToDigit(codePoint) { if (codePoint - 48 < 10) { return codePoint - 22; } if (codePoint - 65 < 26) { return codePoint - 65; } if (codePoint - 97 < 26) { return codePoint - 97; } return base; } /** * Converts a digit/integer into a basic code point. * @see `basicToDigit()` * @private * @param {Number} digit The numeric value of a basic code point. * @returns {Number} The basic code point whose value (when used for * representing integers) is `digit`, which needs to be in the range * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is * used; else, the lowercase form is used. The behavior is undefined * if `flag` is non-zero and `digit` has no uppercase form. */ function digitToBasic(digit, flag) { // 0..25 map to ASCII a..z or A..Z // 26..35 map to ASCII 0..9 return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); } /** * Bias adaptation function as per section 3.4 of RFC 3492. * http://tools.ietf.org/html/rfc3492#section-3.4 * @private */ function adapt(delta, numPoints, firstTime) { var k = 0; delta = firstTime ? floor(delta / damp) : delta >> 1; delta += floor(delta / numPoints); for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { delta = floor(delta / baseMinusTMin); } return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); } /** * Converts a Punycode string of ASCII-only symbols to a string of Unicode * symbols. * @memberOf punycode * @param {String} input The Punycode string of ASCII-only symbols. * @returns {String} The resulting string of Unicode symbols. */ function decode(input) { // Don't use UCS-2 var output = [], inputLength = input.length, out, i = 0, n = initialN, bias = initialBias, basic, j, index, oldi, w, k, digit, t, /** Cached calculation results */ baseMinusT; // Handle the basic code points: let `basic` be the number of input code // points before the last delimiter, or `0` if there is none, then copy // the first basic code points to the output. basic = input.lastIndexOf(delimiter); if (basic < 0) { basic = 0; } for (j = 0; j < basic; ++j) { // if it's not a basic code point if (input.charCodeAt(j) >= 0x80) { error('not-basic'); } output.push(input.charCodeAt(j)); } // Main decoding loop: start just after the last delimiter if any basic code // points were copied; start at the beginning otherwise. for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { // `index` is the index of the next character to be consumed. // Decode a generalized variable-length integer into `delta`, // which gets added to `i`. The overflow checking is easier // if we increase `i` as we go, then subtract off its starting // value at the end to obtain `delta`. for (oldi = i, w = 1, k = base; /* no condition */; k += base) { if (index >= inputLength) { error('invalid-input'); } digit = basicToDigit(input.charCodeAt(index++)); if (digit >= base || digit > floor((maxInt - i) / w)) { error('overflow'); } i += digit * w; t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); if (digit < t) { break; } baseMinusT = base - t; if (w > floor(maxInt / baseMinusT)) { error('overflow'); } w *= baseMinusT; } out = output.length + 1; bias = adapt(i - oldi, out, oldi == 0); // `i` was supposed to wrap around from `out` to `0`, // incrementing `n` each time, so we'll fix that now: if (floor(i / out) > maxInt - n) { error('overflow'); } n += floor(i / out); i %= out; // Insert `n` at position `i` of the output output.splice(i++, 0, n); } return ucs2encode(output); } /** * Converts a string of Unicode symbols to a Punycode string of ASCII-only * symbols. * @memberOf punycode * @param {String} input The string of Unicode symbols. * @returns {String} The resulting Punycode string of ASCII-only symbols. */ function encode(input) { var n, delta, handledCPCount, basicLength, bias, j, m, q, k, t, currentValue, output = [], /** `inputLength` will hold the number of code points in `input`. */ inputLength, /** Cached calculation results */ handledCPCountPlusOne, baseMinusT, qMinusT; // Convert the input in UCS-2 to Unicode input = ucs2decode(input); // Cache the length inputLength = input.length; // Initialize the state n = initialN; delta = 0; bias = initialBias; // Handle the basic code points for (j = 0; j < inputLength; ++j) { currentValue = input[j]; if (currentValue < 0x80) { output.push(stringFromCharCode(currentValue)); } } handledCPCount = basicLength = output.length; // `handledCPCount` is the number of code points that have been handled; // `basicLength` is the number of basic code points. // Finish the basic string - if it is not empty - with a delimiter if (basicLength) { output.push(delimiter); } // Main encoding loop: while (handledCPCount < inputLength) { // All non-basic code points < n have been handled already. Find the next // larger one: for (m = maxInt, j = 0; j < inputLength; ++j) { currentValue = input[j]; if (currentValue >= n && currentValue < m) { m = currentValue; } } // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, // but guard against overflow handledCPCountPlusOne = handledCPCount + 1; if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { error('overflow'); } delta += (m - n) * handledCPCountPlusOne; n = m; for (j = 0; j < inputLength; ++j) { currentValue = input[j]; if (currentValue < n && ++delta > maxInt) { error('overflow'); } if (currentValue == n) { // Represent delta as a generalized variable-length integer for (q = delta, k = base; /* no condition */; k += base) { t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); if (q < t) { break; } qMinusT = q - t; baseMinusT = base - t; output.push( stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) ); q = floor(qMinusT / baseMinusT); } output.push(stringFromCharCode(digitToBasic(q, 0))); bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); delta = 0; ++handledCPCount; } } ++delta; ++n; } return output.join(''); } /** * Converts a Punycode string representing a domain name to Unicode. Only the * Punycoded parts of the domain name will be converted, i.e. it doesn't * matter if you call it on a string that has already been converted to * Unicode. * @memberOf punycode * @param {String} domain The Punycode domain name to convert to Unicode. * @returns {String} The Unicode representation of the given Punycode * string. */ function toUnicode(domain) { return mapDomain(domain, function(string) { return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string; }); } /** * Converts a Unicode string representing a domain name to Punycode. Only the * non-ASCII parts of the domain name will be converted, i.e. it doesn't * matter if you call it with a domain that's already in ASCII. * @memberOf punycode * @param {String} domain The domain name to convert, as a Unicode string. * @returns {String} The Punycode representation of the given domain name. */ function toASCII(domain) { return mapDomain(domain, function(string) { return regexNonASCII.test(string) ? 'xn--' + encode(string) : string; }); } /*--------------------------------------------------------------------------*/ /** Define the public API */ punycode = { /** * A string representing the current Punycode.js version number. * @memberOf punycode * @type String */ 'version': '1.2.4', /** * An object of methods to convert from JavaScript's internal character * representation (UCS-2) to Unicode code points, and back. * @see <http://mathiasbynens.be/notes/javascript-encoding> * @memberOf punycode * @type Object */ 'ucs2': { 'decode': ucs2decode, 'encode': ucs2encode }, 'decode': decode, 'encode': encode, 'toASCII': toASCII, 'toUnicode': toUnicode }; /** Expose `punycode` */ // Some AMD build optimizers, like r.js, check for specific condition patterns // like the following: if ( typeof define == 'function' && typeof define.amd == 'object' && define.amd ) { define('punycode', function() { return punycode; }); } else if (freeExports && !freeExports.nodeType) { if (freeModule) { // in Node.js or RingoJS v0.8.0+ freeModule.exports = punycode; } else { // in Narwhal or RingoJS v0.7.0- for (key in punycode) { punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); } } } else { // in Rhino or a web browser root.punycode = punycode; } }(this)); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],3:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; // If obj.hasOwnProperty has been overridden, then calling // obj.hasOwnProperty(prop) will break. // See: https://github.com/joyent/node/issues/1707 function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } module.exports = function(qs, sep, eq, options) { sep = sep || '&'; eq = eq || '='; var obj = {}; if (typeof qs !== 'string' || qs.length === 0) { return obj; } var regexp = /\+/g; qs = qs.split(sep); var maxKeys = 1000; if (options && typeof options.maxKeys === 'number') { maxKeys = options.maxKeys; } var len = qs.length; // maxKeys <= 0 means that we should not limit keys count if (maxKeys > 0 && len > maxKeys) { len = maxKeys; } for (var i = 0; i < len; ++i) { var x = qs[i].replace(regexp, '%20'), idx = x.indexOf(eq), kstr, vstr, k, v; if (idx >= 0) { kstr = x.substr(0, idx); vstr = x.substr(idx + 1); } else { kstr = x; vstr = ''; } k = decodeURIComponent(kstr); v = decodeURIComponent(vstr); if (!hasOwnProperty(obj, k)) { obj[k] = v; } else if (isArray(obj[k])) { obj[k].push(v); } else { obj[k] = [obj[k], v]; } } return obj; }; var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; },{}],4:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; var stringifyPrimitive = function(v) { switch (typeof v) { case 'string': return v; case 'boolean': return v ? 'true' : 'false'; case 'number': return isFinite(v) ? v : ''; default: return ''; } }; module.exports = function(obj, sep, eq, name) { sep = sep || '&'; eq = eq || '='; if (obj === null) { obj = undefined; } if (typeof obj === 'object') { return map(objectKeys(obj), function(k) { var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; if (isArray(obj[k])) { return map(obj[k], function(v) { return ks + encodeURIComponent(stringifyPrimitive(v)); }).join(sep); } else { return ks + encodeURIComponent(stringifyPrimitive(obj[k])); } }).join(sep); } if (!name) return ''; return encodeURIComponent(stringifyPrimitive(name)) + eq + encodeURIComponent(stringifyPrimitive(obj)); }; var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; function map (xs, f) { if (xs.map) return xs.map(f); var res = []; for (var i = 0; i < xs.length; i++) { res.push(f(xs[i], i)); } return res; } var objectKeys = Object.keys || function (obj) { var res = []; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); } return res; }; },{}],5:[function(require,module,exports){ 'use strict'; exports.decode = exports.parse = require('./decode'); exports.encode = exports.stringify = require('./encode'); },{"./decode":3,"./encode":4}],6:[function(require,module,exports){ (function (global){ !function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.jade=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ 'use strict'; /** * Merge two attribute objects giving precedence * to values in object `b`. Classes are special-cased * allowing for arrays and merging/joining appropriately * resulting in a string. * * @param {Object} a * @param {Object} b * @return {Object} a * @api private */ exports.merge = function merge(a, b) { if (arguments.length === 1) { var attrs = a[0]; for (var i = 1; i < a.length; i++) { attrs = merge(attrs, a[i]); } return attrs; } var ac = a['class']; var bc = b['class']; if (ac || bc) { ac = ac || []; bc = bc || []; if (!Array.isArray(ac)) ac = [ac]; if (!Array.isArray(bc)) bc = [bc]; a['class'] = ac.concat(bc).filter(nulls); } for (var key in b) { if (key != 'class') { a[key] = b[key]; } } return a; }; /** * Filter null `val`s. * * @param {*} val * @return {Boolean} * @api private */ function nulls(val) { return val != null && val !== ''; } /** * join array as classes. * * @param {*} val * @return {String} */ exports.joinClasses = joinClasses; function joinClasses(val) { return Array.isArray(val) ? val.map(joinClasses).filter(nulls).join(' ') : val; } /** * Render the given classes. * * @param {Array} classes * @param {Array.<Boolean>} escaped * @return {String} */ exports.cls = function cls(classes, escaped) { var buf = []; for (var i = 0; i < classes.length; i++) { if (escaped && escaped[i]) { buf.push(exports.escape(joinClasses([classes[i]]))); } else { buf.push(joinClasses(classes[i])); } } var text = joinClasses(buf); if (text.length) { return ' class="' + text + '"'; } else { return ''; } }; /** * Render the given attribute. * * @param {String} key * @param {String} val * @param {Boolean} escaped * @param {Boolean} terse * @return {String} */ exports.attr = function attr(key, val, escaped, terse) { if ('boolean' == typeof val || null == val) { if (val) { return ' ' + (terse ? key : key + '="' + key + '"'); } else { return ''; } } else if (0 == key.indexOf('data') && 'string' != typeof val) { return ' ' + key + "='" + JSON.stringify(val).replace(/'/g, '&apos;') + "'"; } else if (escaped) { return ' ' + key + '="' + exports.escape(val) + '"'; } else { return ' ' + key + '="' + val + '"'; } }; /** * Render the given attributes object. * * @param {Object} obj * @param {Object} escaped * @return {String} */ exports.attrs = function attrs(obj, terse){ var buf = []; var keys = Object.keys(obj); if (keys.length) { for (var i = 0; i < keys.length; ++i) { var key = keys[i] , val = obj[key]; if ('class' == key) { if (val = joinClasses(val)) { buf.push(' ' + key + '="' + val + '"'); } } else { buf.push(exports.attr(key, val, false, terse)); } } } return buf.join(''); }; /** * Escape the given string of `html`. * * @param {String} html * @return {String} * @api private */ exports.escape = function escape(html){ var result = String(html) .replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;'); if (result === '' + html) return html; else return result; }; /** * Re-throw the given `err` in context to the * the jade in `filename` at the given `lineno`. * * @param {Error} err * @param {String} filename * @param {String} lineno * @api private */ exports.rethrow = function rethrow(err, filename, lineno, str){ if (!(err instanceof Error)) throw err; if ((typeof window != 'undefined' || !filename) && !str) { err.message += ' on line ' + lineno; throw err; } try { str = str || _dereq_('fs').readFileSync(filename, 'utf8') } catch (ex) { rethrow(err, null, lineno) } var context = 3 , lines = str.split('\n') , start = Math.max(lineno - context, 0) , end = Math.min(lines.length, lineno + context); // Error context var context = lines.slice(start, end).map(function(line, i){ var curr = i + start + 1; return (curr == lineno ? ' > ' : ' ') + curr + '| ' + line; }).join('\n'); // Alter exception message err.path = filename; err.message = (filename || 'Jade') + ':' + lineno + '\n' + context + '\n\n' + err.message; throw err; }; },{"fs":2}],2:[function(_dereq_,module,exports){ },{}]},{},[1]) (1) }); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],7:[function(require,module,exports){ module.exports = require('jade/runtime'); },{"jade/runtime":6}],8:[function(require,module,exports){ var jade = require("jadum/runtime"); module.exports = function index(locals) { var jade_debug = [{ lineno: 1, filename: "views/home/index.jade" }]; try { var buf = []; var jade_mixins = {}; var jade_interp; ;var locals_for_with = (locals || {});(function (undefined) { jade_debug.unshift({ lineno: 0, filename: "views/home/index.jade" }); jade_debug.unshift({ lineno: 1, filename: "views/home/index.jade" }); buf.push("<p>"); jade_debug.unshift({ lineno: undefined, filename: jade_debug[0].filename }); jade_debug.unshift({ lineno: 1, filename: jade_debug[0].filename }); buf.push("Hello Taunus!"); jade_debug.shift(); jade_debug.shift(); buf.push("</p>"); jade_debug.shift(); jade_debug.shift();}.call(this,"undefined" in locals_for_with?locals_for_with.undefined:typeof undefined!=="undefined"?undefined:undefined));;return buf.join(""); } catch (err) { jade.rethrow(err, jade_debug[0].filename, jade_debug[0].lineno, "p Hello Taunus!\n"); } } },{"jadum/runtime":7}],9:[function(require,module,exports){ var jade = require("jadum/runtime"); module.exports = function layout(locals) { var jade_debug = [{ lineno: 1, filename: "views/layout.jade" }]; try { var buf = []; var jade_mixins = {}; var jade_interp; ;var locals_for_with = (locals || {});(function (model, undefined, partial) { jade_debug.unshift({ lineno: 0, filename: "views/layout.jade" }); jade_debug.unshift({ lineno: 1, filename: "views/layout.jade" }); buf.push("<title>" + (jade.escape(null == (jade_interp = model.title) ? "" : jade_interp))); jade_debug.unshift({ lineno: undefined, filename: jade_debug[0].filename }); jade_debug.shift(); buf.push("</title>"); jade_debug.shift(); jade_debug.unshift({ lineno: 2, filename: "views/layout.jade" }); buf.push("<main>" + (null == (jade_interp = partial) ? "" : jade_interp)); jade_debug.unshift({ lineno: undefined, filename: jade_debug[0].filename }); jade_debug.shift(); buf.push("</main>"); jade_debug.shift(); jade_debug.unshift({ lineno: 3, filename: "views/layout.jade" }); buf.push("<script src=\"/js/all.js\">"); jade_debug.unshift({ lineno: undefined, filename: jade_debug[0].filename }); jade_debug.shift(); buf.push("</script>"); jade_debug.shift(); jade_debug.shift();}.call(this,"model" in locals_for_with?locals_for_with.model:typeof model!=="undefined"?model:undefined,"undefined" in locals_for_with?locals_for_with.undefined:typeof undefined!=="undefined"?undefined:undefined,"partial" in locals_for_with?locals_for_with.partial:typeof partial!=="undefined"?partial:undefined));;return buf.join(""); } catch (err) { jade.rethrow(err, jade_debug[0].filename, jade_debug[0].lineno, "title=model.title\nmain!=partial\nscript(src='/js/all.js')\n"); } } },{"jadum/runtime":7}],10:[function(require,module,exports){ 'use strict'; var templates = { 'home/index': require('./views/home/index.js'), 'layout': require('./views/layout.js') }; var controllers = { 'home/index': require('../client/js/controllers/home/index.js') }; var routes = { '/': { action: 'home/index' } }; module.exports = { templates: templates, controllers: controllers, routes: routes }; },{"../client/js/controllers/home/index.js":11,"./views/home/index.js":8,"./views/layout.js":9}],11:[function(require,module,exports){ 'use strict'; module.exports = function (model, container, route) { console.log('Rendered view %s using model:\n%s', route.action, JSON.stringify(model, null, 2)); }; },{}],12:[function(require,module,exports){ (function (global){ 'use strict'; var taunus = require('taunus'); var wiring = require('../../.bin/wiring'); var main = document.getElementsByTagName('main')[0]; taunus.mount(main, wiring); global.taunus = taunus; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../../.bin/wiring":10,"taunus":20}],13:[function(require,module,exports){ 'use strict'; var emitter = require('./emitter'); var fetcher = require('./fetcher'); var partial = require('./partial'); var router = require('./router'); var state = require('./state'); var isNative = require('./isNative'); var modern = 'history' in window && 'pushState' in history; // Google Chrome 38 on iOS makes weird changes to history.replaceState, breaking it var nativeReplace = modern && isNative(window.history.replaceState); function go (url, o) { var options = o || {}; var context = options.context || null; if (!modern) { location.href = url; return; } var route = router(url); if (!route) { location.href = url; return; } fetcher.abortPending(); fetcher(route, { element: context, source: 'intent' }, resolved); function resolved (err, model) { if (err) { return; } navigation(route, model, 'pushState'); partial(state.container, null, model, route); } } function start (model) { var route = replaceWith(model); emitter.emit('start', state.container, model); partial(state.container, null, model, route, { render: false }); window.onpopstate = back; } function back (e) { var empty = !(e && e.state && e.state.model); if (empty) { return; } var model = e.state.model; var route = replaceWith(model); partial(state.container, null, model, route); } function replaceWith (model) { var url = location.pathname; var query = orEmpty(location.search) + orEmpty(location.hash); var route = router(url + query); navigation(route, model, 'replaceState'); return route; } function orEmpty (value) { return value || ''; } function navigation (route, model, direction) { state.model = model; if (model.title) { document.title = model.title; } if (modern && direction !== 'replaceState' || nativeReplace) { history[direction]({ model: model }, model.title, route.url); } } module.exports = { start: start, go: go }; },{"./emitter":16,"./fetcher":18,"./isNative":22,"./partial":26,"./router":27,"./state":28}],14:[function(require,module,exports){ 'use strict'; var once = require('./once'); var raw = require('./stores/raw'); var idb = require('./stores/idb'); var stores = [raw, idb]; function clone (value) { return JSON.parse(JSON.stringify(value)); } function get (url, done) { var i = 0; function next () { var gotOnce = once(got); var store = stores[i++]; if (store) { store.get(url, gotOnce); setTimeout(gotOnce, store === idb ? 100 : 50); // at worst, spend 150ms on caching layers } else { done(true); } function got (err, item) { if (err) { next(); } else if (item && typeof item.expires === 'number' && Date.now() < item.expires) { done(false, clone(item.data)); // always return a unique copy } else { next(); } } } next(); } function set (url, data, duration) { if (duration < 1) { // sanity return; } var cloned = clone(data); // freeze a copy for our records stores.forEach(store); function store (s) { s.set(url, { data: cloned, expires: Date.now() + duration }); } } module.exports = { get: get, set: set }; },{"./once":25,"./stores/idb":29,"./stores/raw":30}],15:[function(require,module,exports){ 'use strict'; var cache = require('./cache'); var idb = require('./stores/idb'); var state = require('./state'); var emitter = require('./emitter'); var interceptor = require('./interceptor'); var defaults = 15; var baseline; function e (value) { return value || ''; } function setup (duration, route) { baseline = parseDuration(duration); if (baseline < 1) { state.cache = false; return; } interceptor.add(intercept); emitter.on('fetch.done', persist); state.cache = true; } function intercept (e) { cache.get(e.url, result); function result (err, data) { if (!err && data) { e.preventDefault(data); } } } function parseDuration (value) { if (value === true) { return baseline || defaults; } if (typeof value === 'number') { return value; } return 0; } function persist (route, context, data) { if (!state.cache) { return; } if (route.cache === false) { return; } var d = baseline; if (typeof route.cache === 'number') { d = route.cache; } var key = route.parts.pathname + e(route.parts.query); cache.set(key, data, parseDuration(d) * 1000); } function ready (fn) { if (state.cache) { idb.tested(fn); // wait on idb compatibility tests } else { fn(); // caching is a no-op } } module.exports = { setup: setup, persist: persist, ready: ready }; },{"./cache":14,"./emitter":16,"./interceptor":21,"./state":28,"./stores/idb":29}],16:[function(require,module,exports){ 'use strict'; var emitter = require('contra.emitter'); module.exports = emitter({}, { throws: false }); },{"contra.emitter":33}],17:[function(require,module,exports){ 'use strict'; function add (element, type, fn) { if (element.addEventListener) { element.addEventListener(type, fn); } else if (element.attachEvent) { element.attachEvent('on' + type, wrapperFactory(element, fn)); } else { element['on' + type] = fn; } } function wrapperFactory (element, fn) { return function wrapper (originalEvent) { var e = originalEvent || window.event; e.target = e.target || e.srcElement; e.preventDefault = e.preventDefault || function preventDefault () { e.returnValue = false; }; e.stopPropagation = e.stopPropagation || function stopPropagation () { e.cancelBubble = true; }; fn.call(element, e); }; } module.exports = { add: add }; },{}],18:[function(require,module,exports){ 'use strict'; var xhr = require('./xhr'); var emitter = require('./emitter'); var interceptor = require('./interceptor'); var lastXhr = {}; function e (value) { return value || ''; } function jsonify (route) { var parts = route.parts; var qs = e(parts.search); var p = qs ? '&' : '?'; return parts.pathname + qs + p + 'json'; } function abort (source) { if (lastXhr[source]) { lastXhr[source].abort(); } } function abortPending () { Object.keys(lastXhr).forEach(abort); lastXhr = {}; } function fetcher (route, context, done) { var url = route.url; if (lastXhr[context.source]) { lastXhr[context.source].abort(); lastXhr[context.source] = null; } interceptor.execute(route, afterInterceptors); function afterInterceptors (err, result) { if (!err && result.defaultPrevented) { done(null, result.model); } else { emitter.emit('fetch.start', route, context); lastXhr[context.source] = xhr(jsonify(route), notify); } } function notify (err, data) { if (err) { if (err.message === 'aborted') { emitter.emit('fetch.abort', route, context); } else { emitter.emit('fetch.error', route, context, err); } } else { emitter.emit('fetch.done', route, context, data); } done(err, data); } } fetcher.abortPending = abortPending; module.exports = fetcher; },{"./emitter":16,"./interceptor":21,"./xhr":32}],19:[function(require,module,exports){ 'use strict'; var emitter = require('./emitter'); var links = require('./links'); function attach () { emitter.on('start', links); } module.exports = { attach: attach }; },{"./emitter":16,"./links":23}],20:[function(require,module,exports){ 'use strict'; var state = require('./state'); var interceptor = require('./interceptor'); var activator = require('./activator'); var emitter = require('./emitter'); var hooks = require('./hooks'); var partial = require('./partial'); var mount = require('./mount'); var router = require('./router'); hooks.attach(); module.exports = { mount: mount, partial: partial.standalone, on: emitter.on.bind(emitter), once: emitter.once.bind(emitter), off: emitter.off.bind(emitter), intercept: interceptor.add, navigate: activator.go, state: state, route: router }; },{"./activator":13,"./emitter":16,"./hooks":19,"./interceptor":21,"./mount":24,"./partial":26,"./router":27,"./state":28}],21:[function(require,module,exports){ 'use strict'; var emitter = require('contra.emitter'); var once = require('./once'); var router = require('./router'); var interceptors = emitter({ count: 0 }, { async: true }); function getInterceptorEvent (route) { var e = { url: route.url, route: route, parts: route.parts, model: null, canPreventDefault: true, defaultPrevented: false, preventDefault: once(preventDefault) }; function preventDefault (model) { if (!e.canPreventDefault) { return; } e.canPreventDefault = false; e.defaultPrevented = true; e.model = model; } return e; } function add (action, fn) { if (arguments.length === 1) { fn = action; action = '*'; } interceptors.count++; interceptors.on(action, fn); } function executeSync (route) { var e = getInterceptorEvent(route); interceptors.emit('*', e); interceptors.emit(route.action, e); return e; } function execute (route, done) { var e = getInterceptorEvent(route); if (interceptors.count === 0) { // fail fast end(); return; } var fn = once(end); var preventDefaultBase = e.preventDefault; e.preventDefault = once(preventDefaultEnds); interceptors.emit('*', e); interceptors.emit(route.action, e); setTimeout(fn, 200); // at worst, spend 200ms waiting on interceptors function preventDefaultEnds () { preventDefaultBase.apply(null, arguments); fn(); } function end () { e.canPreventDefault = false; done(null, e); } } module.exports = { add: add, execute: execute }; },{"./once":25,"./router":27,"contra.emitter":33}],22:[function(require,module,exports){ 'use strict'; // source: https://gist.github.com/jdalton/5e34d890105aca44399f // thanks @jdalton! var toString = Object.prototype.toString; // used to resolve the internal `[[Class]]` of values var fnToString = Function.prototype.toString; // used to resolve the decompiled source of functions var host = /^\[object .+?Constructor\]$/; // used to detect host constructors (Safari > 4; really typed array specific) // Escape any special regexp characters. var specials = /[.*+?^${}()|[\]\/\\]/g; // Replace mentions of `toString` with `.*?` to keep the template generic. // Replace thing like `for ...` to support environments, like Rhino, which add extra // info such as method arity. var extras = /toString|(function).*?(?=\\\()| for .+?(?=\\\])/g; // Compile a regexp using a common native method as a template. // We chose `Object#toString` because there's a good chance it is not being mucked with. var fnString = String(toString).replace(specials, '\\$&').replace(extras, '$1.*?'); var reNative = new RegExp('^' + fnString + '$'); function isNative (value) { var type = typeof value; if (type === 'function') { // Use `Function#toString` to bypass the value's own `toString` method // and avoid being faked out. return reNative.test(fnToString.call(value)); } // Fallback to a host object check because some environments will represent // things like typed arrays as DOM methods which may not conform to the // normal native pattern. return (value && type === 'object' && host.test(toString.call(value))) || false; } module.exports = isNative; },{}],23:[function(require,module,exports){ 'use strict'; var state = require('./state'); var router = require('./router'); var events = require('./events'); var fetcher = require('./fetcher'); var activator = require('./activator'); var origin = document.location.origin; var leftClick = 1; var prefetching = []; var clicksOnHold = []; function links () { if (state.prefetch && state.cache) { // prefetch without cache makes no sense events.add(document.body, 'mouseover', maybePrefetch); events.add(document.body, 'touchstart', maybePrefetch); } events.add(document.body, 'click', maybeReroute); } function so (anchor) { return anchor.origin === origin; } function leftClickOnAnchor (e, anchor) { return anchor.pathname && e.which === leftClick && !e.metaKey && !e.ctrlKey; } function targetOrAnchor (e) { var anchor = e.target; while (anchor) { if (anchor.tagName === 'A') { return anchor; } anchor = anchor.parentElement; } } function maybeReroute (e) { var anchor = targetOrAnchor(e); if (anchor && so(anchor) && leftClickOnAnchor(e, anchor)) { reroute(e, anchor); } } function maybePrefetch (e) { var anchor = targetOrAnchor(e); if (anchor && so(anchor)) { prefetch(e, anchor); } } function scrollInto (id) { var elem = document.getElementById(id); if (elem && elem.scrollIntoView) { elem.scrollIntoView(); } } function noop () {} function getRoute (anchor, fail) { var url = anchor.pathname + anchor.search + anchor.hash; if (url === location.pathname + location.search + anchor.hash) { (fail || noop)(); return; // anchor hash-navigation on same page ignores router } var route = router(url); if (!route || route.ignore) { return; } return route; } function reroute (e, anchor) { var route = getRoute(anchor, fail); if (!route) { return; } prevent(); if (prefetching.indexOf(anchor) !== -1) { clicksOnHold.push(anchor); return; } activator.go(route.url, { context: anchor }); function fail () { if (anchor.hash === location.hash) { scrollInto(anchor.hash.substr(1)); prevent(); } } function prevent () { e.preventDefault(); } } function prefetch (e, anchor) { var route = getRoute(anchor); if (!route) { return; } if (prefetching.indexOf(anchor) !== -1) { return; } prefetching.push(anchor); fetcher(route, { element: anchor, source: 'prefetch' }, resolved); function resolved (err, data) { prefetching.splice(prefetching.indexOf(anchor), 1); if (clicksOnHold.indexOf(anchor) !== -1) { clicksOnHold.splice(clicksOnHold.indexOf(anchor), 1); activator.go(route.url, { context: anchor }); } } } module.exports = links; },{"./activator":13,"./events":17,"./fetcher":18,"./router":27,"./state":28}],24:[function(require,module,exports){ (function (global){ 'use strict'; var unescape = require('./unescape'); var state = require('./state'); var router = require('./router'); var activator = require('./activator'); var caching = require('./caching'); var fetcher = require('./fetcher'); var g = global; var mounted; var booted; function orEmpty (value) { return value || ''; } function mount (container, wiring, options) { var o = options || {}; if (mounted) { throw new Error('Taunus already mounted!'); } if (!container || !container.tagName) { // naïve is enough throw new Error('You must define an application root container!'); } mounted = true; state.container = container; state.controllers = wiring.controllers; state.templates = wiring.templates; state.routes = wiring.routes; state.prefetch = !!o.prefetch; router.setup(wiring.routes); var url = location.pathname; var query = orEmpty(location.search) + orEmpty(location.hash); var route = router(url + query); caching.setup(o.cache, route); caching.ready(kickstart); function kickstart () { if (!o.bootstrap) { o.bootstrap = 'auto'; } if (o.bootstrap === 'auto') { autoboot(); } else if (o.bootstrap === 'inline') { inlineboot(); } else if (o.bootstrap === 'manual') { manualboot(); } else { throw new Error(o.bootstrap + ' is not a valid bootstrap mode!'); } } function autoboot () { fetcher(route, { element: container, source: 'boot' }, fetched); } function fetched (err, data) { if (err) { throw new Error('Fetching JSON data model for first view failed.'); } boot(data); } function inlineboot () { var id = container.getAttribute('data-taunus'); var script = document.getElementById(id); var model = JSON.parse(unescape(script.innerText || script.textContent)); boot(model); } function manualboot () { if (typeof g.taunusReady === 'function') { g.taunusReady = boot; // not yet an object? turn it into the boot method } else if (g.taunusReady && typeof g.taunusReady === 'object') { boot(g.taunusReady); // already an object? boot with that as the model } else { throw new Error('Did you forget to add the taunusReady global?'); } } function boot (model) { if (booted) { // sanity return; } if (!model || typeof model !== 'object') { throw new Error('Taunus model must be an object!'); } booted = true; caching.persist(route, state.container, model); activator.start(model); } } module.exports = mount; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"./activator":13,"./caching":15,"./fetcher":18,"./router":27,"./state":28,"./unescape":31}],25:[function(require,module,exports){ 'use strict'; module.exports = function (fn) { var used; return function once () { if (used) { return; } used = true; return fn.apply(this, arguments); }; }; },{}],26:[function(require,module,exports){ 'use strict'; var raf = require('raf'); var state = require('./state'); var emitter = require('./emitter'); function positioning () { var target; var hash = location.hash; if (hash) { target = document.getElementById(hash.slice(1)); } if (!target) { target = document.documentElement; } raf(focusin); function focusin () { target.scrollIntoView(); } } function partial (container, enforcedAction, model, route, options) { var action = enforcedAction || model && model.action || route && route.action; var controller = state.controllers[action]; var internals = options || {}; if (internals.render !== false) { container.innerHTML = render(action, model); if (internals.routed !== false) { positioning(); } } emitter.emit('render', container, model); if (controller) { controller(model