notifyjs
Version:
A handy wrapper for the Web Notifications API
1,516 lines • 1.38 MB
JavaScript
(function(){ var curSystem = typeof System != 'undefined' ? System : undefined;
(function(global) {
'use strict';
if (global.$traceurRuntime) {
return;
}
function setupGlobals(global) {
global.Reflect = global.Reflect || {};
global.Reflect.global = global.Reflect.global || global;
}
setupGlobals(global);
var typeOf = function(x) {
return typeof x;
};
global.$traceurRuntime = {
options: {},
setupGlobals: setupGlobals,
typeof: typeOf
};
})(typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this);
(function() {
function buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) {
var out = [];
if (opt_scheme) {
out.push(opt_scheme, ':');
}
if (opt_domain) {
out.push('//');
if (opt_userInfo) {
out.push(opt_userInfo, '@');
}
out.push(opt_domain);
if (opt_port) {
out.push(':', opt_port);
}
}
if (opt_path) {
out.push(opt_path);
}
if (opt_queryData) {
out.push('?', opt_queryData);
}
if (opt_fragment) {
out.push('#', opt_fragment);
}
return out.join('');
}
var splitRe = new RegExp('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$');
var ComponentIndex = {
SCHEME: 1,
USER_INFO: 2,
DOMAIN: 3,
PORT: 4,
PATH: 5,
QUERY_DATA: 6,
FRAGMENT: 7
};
function split(uri) {
return (uri.match(splitRe));
}
function removeDotSegments(path) {
if (path === '/')
return '/';
var leadingSlash = path[0] === '/' ? '/' : '';
var trailingSlash = path.slice(-1) === '/' ? '/' : '';
var segments = path.split('/');
var out = [];
var up = 0;
for (var pos = 0; pos < segments.length; pos++) {
var segment = segments[pos];
switch (segment) {
case '':
case '.':
break;
case '..':
if (out.length)
out.pop();
else
up++;
break;
default:
out.push(segment);
}
}
if (!leadingSlash) {
while (up-- > 0) {
out.unshift('..');
}
if (out.length === 0)
out.push('.');
}
return leadingSlash + out.join('/') + trailingSlash;
}
function joinAndCanonicalizePath(parts) {
var path = parts[ComponentIndex.PATH] || '';
path = removeDotSegments(path);
parts[ComponentIndex.PATH] = path;
return buildFromEncodedParts(parts[ComponentIndex.SCHEME], parts[ComponentIndex.USER_INFO], parts[ComponentIndex.DOMAIN], parts[ComponentIndex.PORT], parts[ComponentIndex.PATH], parts[ComponentIndex.QUERY_DATA], parts[ComponentIndex.FRAGMENT]);
}
function canonicalizeUrl(url) {
var parts = split(url);
return joinAndCanonicalizePath(parts);
}
function resolveUrl(base, url) {
var parts = split(url);
var baseParts = split(base);
if (parts[ComponentIndex.SCHEME]) {
return joinAndCanonicalizePath(parts);
} else {
parts[ComponentIndex.SCHEME] = baseParts[ComponentIndex.SCHEME];
}
for (var i = ComponentIndex.SCHEME; i <= ComponentIndex.PORT; i++) {
if (!parts[i]) {
parts[i] = baseParts[i];
}
}
if (parts[ComponentIndex.PATH][0] == '/') {
return joinAndCanonicalizePath(parts);
}
var path = baseParts[ComponentIndex.PATH];
var index = path.lastIndexOf('/');
path = path.slice(0, index + 1) + parts[ComponentIndex.PATH];
parts[ComponentIndex.PATH] = path;
return joinAndCanonicalizePath(parts);
}
function isAbsolute(name) {
if (!name)
return false;
if (name[0] === '/')
return true;
var parts = split(name);
if (parts[ComponentIndex.SCHEME])
return true;
return false;
}
$traceurRuntime.canonicalizeUrl = canonicalizeUrl;
$traceurRuntime.isAbsolute = isAbsolute;
$traceurRuntime.removeDotSegments = removeDotSegments;
$traceurRuntime.resolveUrl = resolveUrl;
})();
(function(global) {
'use strict';
var $__3 = $traceurRuntime,
canonicalizeUrl = $__3.canonicalizeUrl,
resolveUrl = $__3.resolveUrl,
isAbsolute = $__3.isAbsolute;
var moduleInstantiators = Object.create(null);
var baseURL;
if (global.location && global.location.href)
baseURL = resolveUrl(global.location.href, './');
else
baseURL = '';
function UncoatedModuleEntry(url, uncoatedModule) {
this.url = url;
this.value_ = uncoatedModule;
}
function ModuleEvaluationError(erroneousModuleName, cause) {
this.message = this.constructor.name + ': ' + this.stripCause(cause) + ' in ' + erroneousModuleName;
if (!(cause instanceof ModuleEvaluationError) && cause.stack)
this.stack = this.stripStack(cause.stack);
else
this.stack = '';
}
ModuleEvaluationError.prototype = Object.create(Error.prototype);
ModuleEvaluationError.prototype.constructor = ModuleEvaluationError;
ModuleEvaluationError.prototype.stripError = function(message) {
return message.replace(/.*Error:/, this.constructor.name + ':');
};
ModuleEvaluationError.prototype.stripCause = function(cause) {
if (!cause)
return '';
if (!cause.message)
return cause + '';
return this.stripError(cause.message);
};
ModuleEvaluationError.prototype.loadedBy = function(moduleName) {
this.stack += '\n loaded by ' + moduleName;
};
ModuleEvaluationError.prototype.stripStack = function(causeStack) {
var stack = [];
causeStack.split('\n').some(function(frame) {
if (/UncoatedModuleInstantiator/.test(frame))
return true;
stack.push(frame);
});
stack[0] = this.stripError(stack[0]);
return stack.join('\n');
};
function beforeLines(lines, number) {
var result = [];
var first = number - 3;
if (first < 0)
first = 0;
for (var i = first; i < number; i++) {
result.push(lines[i]);
}
return result;
}
function afterLines(lines, number) {
var last = number + 1;
if (last > lines.length - 1)
last = lines.length - 1;
var result = [];
for (var i = number; i <= last; i++) {
result.push(lines[i]);
}
return result;
}
function columnSpacing(columns) {
var result = '';
for (var i = 0; i < columns - 1; i++) {
result += '-';
}
return result;
}
function UncoatedModuleInstantiator(url, func) {
UncoatedModuleEntry.call(this, url, null);
this.func = func;
}
UncoatedModuleInstantiator.prototype = Object.create(UncoatedModuleEntry.prototype);
UncoatedModuleInstantiator.prototype.getUncoatedModule = function() {
var $__2 = this;
if (this.value_)
return this.value_;
try {
var relativeRequire;
if (typeof $traceurRuntime !== undefined && $traceurRuntime.require) {
relativeRequire = $traceurRuntime.require.bind(null, this.url);
}
return this.value_ = this.func.call(global, relativeRequire);
} catch (ex) {
if (ex instanceof ModuleEvaluationError) {
ex.loadedBy(this.url);
throw ex;
}
if (ex.stack) {
var lines = this.func.toString().split('\n');
var evaled = [];
ex.stack.split('\n').some(function(frame, index) {
if (frame.indexOf('UncoatedModuleInstantiator.getUncoatedModule') > 0)
return true;
var m = /(at\s[^\s]*\s).*>:(\d*):(\d*)\)/.exec(frame);
if (m) {
var line = parseInt(m[2], 10);
evaled = evaled.concat(beforeLines(lines, line));
if (index === 1) {
evaled.push(columnSpacing(m[3]) + '^ ' + $__2.url);
} else {
evaled.push(columnSpacing(m[3]) + '^');
}
evaled = evaled.concat(afterLines(lines, line));
evaled.push('= = = = = = = = =');
} else {
evaled.push(frame);
}
});
ex.stack = evaled.join('\n');
}
throw new ModuleEvaluationError(this.url, ex);
}
};
function getUncoatedModuleInstantiator(name) {
if (!name)
return;
var url = ModuleStore.normalize(name);
return moduleInstantiators[url];
}
;
var moduleInstances = Object.create(null);
var liveModuleSentinel = {};
function Module(uncoatedModule) {
var isLive = arguments[1];
var coatedModule = Object.create(null);
Object.getOwnPropertyNames(uncoatedModule).forEach(function(name) {
var getter,
value;
if (isLive === liveModuleSentinel) {
var descr = Object.getOwnPropertyDescriptor(uncoatedModule, name);
if (descr.get)
getter = descr.get;
}
if (!getter) {
value = uncoatedModule[name];
getter = function() {
return value;
};
}
Object.defineProperty(coatedModule, name, {
get: getter,
enumerable: true
});
});
Object.preventExtensions(coatedModule);
return coatedModule;
}
var ModuleStore = {
normalize: function(name, refererName, refererAddress) {
if (typeof name !== 'string')
throw new TypeError('module name must be a string, not ' + typeof name);
if (isAbsolute(name))
return canonicalizeUrl(name);
if (/[^\.]\/\.\.\//.test(name)) {
throw new Error('module name embeds /../: ' + name);
}
if (name[0] === '.' && refererName)
return resolveUrl(refererName, name);
return canonicalizeUrl(name);
},
get: function(normalizedName) {
var m = getUncoatedModuleInstantiator(normalizedName);
if (!m)
return undefined;
var moduleInstance = moduleInstances[m.url];
if (moduleInstance)
return moduleInstance;
moduleInstance = Module(m.getUncoatedModule(), liveModuleSentinel);
return moduleInstances[m.url] = moduleInstance;
},
set: function(normalizedName, module) {
normalizedName = String(normalizedName);
moduleInstantiators[normalizedName] = new UncoatedModuleInstantiator(normalizedName, function() {
return module;
});
moduleInstances[normalizedName] = module;
},
get baseURL() {
return baseURL;
},
set baseURL(v) {
baseURL = String(v);
},
registerModule: function(name, deps, func) {
var normalizedName = ModuleStore.normalize(name);
if (moduleInstantiators[normalizedName])
throw new Error('duplicate module named ' + normalizedName);
moduleInstantiators[normalizedName] = new UncoatedModuleInstantiator(normalizedName, func);
},
bundleStore: Object.create(null),
register: function(name, deps, func) {
if (!deps || !deps.length && !func.length) {
this.registerModule(name, deps, func);
} else {
this.bundleStore[name] = {
deps: deps,
execute: function() {
var $__2 = arguments;
var depMap = {};
deps.forEach(function(dep, index) {
return depMap[dep] = $__2[index];
});
var registryEntry = func.call(this, depMap);
registryEntry.execute.call(this);
return registryEntry.exports;
}
};
}
},
getAnonymousModule: function(func) {
return new Module(func.call(global), liveModuleSentinel);
}
};
var moduleStoreModule = new Module({ModuleStore: ModuleStore});
ModuleStore.set('@traceur/src/runtime/ModuleStore.js', moduleStoreModule);
var setupGlobals = $traceurRuntime.setupGlobals;
$traceurRuntime.setupGlobals = function(global) {
setupGlobals(global);
};
$traceurRuntime.ModuleStore = ModuleStore;
$traceurRuntime.registerModule = ModuleStore.registerModule.bind(ModuleStore);
$traceurRuntime.getModule = ModuleStore.get;
$traceurRuntime.setModule = ModuleStore.set;
$traceurRuntime.normalizeModuleName = ModuleStore.normalize;
})(typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this);
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/new-unique-string.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/new-unique-string.js";
var random = Math.random;
var counter = Date.now() % 1e9;
function newUniqueString() {
return '__$' + (random() * 1e9 >>> 1) + '$' + ++counter + '$__';
}
var $__default = newUniqueString;
return {get default() {
return $__default;
}};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/has-native-symbols.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/has-native-symbols.js";
var v = !!Object.getOwnPropertySymbols && typeof Symbol === 'function';
function hasNativeSymbol() {
return v;
}
var $__default = hasNativeSymbol;
return {get default() {
return $__default;
}};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/symbols.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/symbols.js";
var newUniqueString = $traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./new-unique-string.js", "traceur-runtime@0.0.102/src/runtime/symbols.js")).default;
var hasNativeSymbol = $traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./has-native-symbols.js", "traceur-runtime@0.0.102/src/runtime/symbols.js")).default;
var $create = Object.create;
var $defineProperty = Object.defineProperty;
var $freeze = Object.freeze;
var $getOwnPropertyNames = Object.getOwnPropertyNames;
var $keys = Object.keys;
var $TypeError = TypeError;
function nonEnum(value) {
return {
configurable: true,
enumerable: false,
value: value,
writable: true
};
}
var symbolInternalProperty = newUniqueString();
var symbolDescriptionProperty = newUniqueString();
var symbolDataProperty = newUniqueString();
var symbolValues = $create(null);
var SymbolImpl = function Symbol(description) {
var value = new SymbolValue(description);
if (!(this instanceof SymbolImpl))
return value;
throw new $TypeError('Symbol cannot be new\'ed');
};
$defineProperty(SymbolImpl.prototype, 'constructor', nonEnum(SymbolImpl));
$defineProperty(SymbolImpl.prototype, 'toString', nonEnum(function() {
var symbolValue = this[symbolDataProperty];
return symbolValue[symbolInternalProperty];
}));
$defineProperty(SymbolImpl.prototype, 'valueOf', nonEnum(function() {
var symbolValue = this[symbolDataProperty];
if (!symbolValue)
throw $TypeError('Conversion from symbol to string');
return symbolValue[symbolInternalProperty];
}));
function SymbolValue(description) {
var key = newUniqueString();
$defineProperty(this, symbolDataProperty, {value: this});
$defineProperty(this, symbolInternalProperty, {value: key});
$defineProperty(this, symbolDescriptionProperty, {value: description});
$freeze(this);
symbolValues[key] = this;
}
$defineProperty(SymbolValue.prototype, 'constructor', nonEnum(SymbolImpl));
$defineProperty(SymbolValue.prototype, 'toString', {
value: SymbolImpl.prototype.toString,
enumerable: false
});
$defineProperty(SymbolValue.prototype, 'valueOf', {
value: SymbolImpl.prototype.valueOf,
enumerable: false
});
$freeze(SymbolValue.prototype);
function isSymbolString(s) {
return symbolValues[s];
}
function removeSymbolKeys(array) {
var rv = [];
for (var i = 0; i < array.length; i++) {
if (!isSymbolString(array[i])) {
rv.push(array[i]);
}
}
return rv;
}
function getOwnPropertyNames(object) {
return removeSymbolKeys($getOwnPropertyNames(object));
}
function keys(object) {
return removeSymbolKeys($keys(object));
}
function getOwnPropertySymbols(object) {
var rv = [];
var names = $getOwnPropertyNames(object);
for (var i = 0; i < names.length; i++) {
var symbol = symbolValues[names[i]];
if (symbol) {
rv.push(symbol);
}
}
return rv;
}
function polyfillSymbol(global) {
var Object = global.Object;
if (!hasNativeSymbol()) {
global.Symbol = SymbolImpl;
Object.getOwnPropertyNames = getOwnPropertyNames;
Object.keys = keys;
$defineProperty(Object, 'getOwnPropertySymbols', nonEnum(getOwnPropertySymbols));
}
if (!global.Symbol.iterator) {
global.Symbol.iterator = global.Symbol('Symbol.iterator');
}
if (!global.Symbol.observer) {
global.Symbol.observer = global.Symbol('Symbol.observer');
}
}
var g = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this;
polyfillSymbol(g);
var typeOf = hasNativeSymbol() ? function(x) {
return typeof x;
} : function(x) {
return x instanceof SymbolValue ? 'symbol' : typeof x;
};
$traceurRuntime.typeof = typeOf;
return {};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/classes.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/classes.js";
var $Object = Object;
var $TypeError = TypeError;
var $__1 = Object,
create = $__1.create,
defineProperties = $__1.defineProperties,
defineProperty = $__1.defineProperty,
getOwnPropertyDescriptor = $__1.getOwnPropertyDescriptor,
getOwnPropertyNames = $__1.getOwnPropertyNames,
getOwnPropertySymbols = $__1.getOwnPropertySymbols,
getPrototypeOf = $__1.getPrototypeOf;
function superDescriptor(homeObject, name) {
var proto = getPrototypeOf(homeObject);
do {
var result = getOwnPropertyDescriptor(proto, name);
if (result)
return result;
proto = getPrototypeOf(proto);
} while (proto);
return undefined;
}
function superConstructor(ctor) {
return ctor.__proto__;
}
function superGet(self, homeObject, name) {
var descriptor = superDescriptor(homeObject, name);
if (descriptor) {
var value = descriptor.value;
if (value)
return value;
if (!descriptor.get)
return value;
return descriptor.get.call(self);
}
return undefined;
}
function superSet(self, homeObject, name, value) {
var descriptor = superDescriptor(homeObject, name);
if (descriptor && descriptor.set) {
descriptor.set.call(self, value);
return value;
}
throw $TypeError(("super has no setter '" + name + "'."));
}
function forEachPropertyKey(object, f) {
getOwnPropertyNames(object).forEach(f);
if (getOwnPropertySymbols) {
getOwnPropertySymbols(object).forEach(f);
}
}
function getDescriptors(object) {
var descriptors = {};
forEachPropertyKey(object, function(key) {
descriptors[key] = getOwnPropertyDescriptor(object, key);
descriptors[key].enumerable = false;
});
return descriptors;
}
var nonEnum = {enumerable: false};
function makePropertiesNonEnumerable(object) {
forEachPropertyKey(object, function(key) {
defineProperty(object, key, nonEnum);
});
}
function createClass(ctor, object, staticObject, superClass) {
defineProperty(object, 'constructor', {
value: ctor,
configurable: true,
enumerable: false,
writable: true
});
if (arguments.length > 3) {
if (typeof superClass === 'function')
ctor.__proto__ = superClass;
ctor.prototype = create(getProtoParent(superClass), getDescriptors(object));
} else {
makePropertiesNonEnumerable(object);
ctor.prototype = object;
}
defineProperty(ctor, 'prototype', {
configurable: false,
writable: false
});
return defineProperties(ctor, getDescriptors(staticObject));
}
function getProtoParent(superClass) {
if (typeof superClass === 'function') {
var prototype = superClass.prototype;
if ($Object(prototype) === prototype || prototype === null)
return superClass.prototype;
throw new $TypeError('super prototype must be an Object or null');
}
if (superClass === null)
return null;
throw new $TypeError(("Super expression must either be null or a function, not " + typeof superClass + "."));
}
$traceurRuntime.createClass = createClass;
$traceurRuntime.superConstructor = superConstructor;
$traceurRuntime.superGet = superGet;
$traceurRuntime.superSet = superSet;
return {};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/exportStar.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/exportStar.js";
var $__1 = Object,
defineProperty = $__1.defineProperty,
getOwnPropertyNames = $__1.getOwnPropertyNames;
function exportStar(object) {
var $__2 = arguments,
$__3 = function(i) {
var mod = $__2[i];
var names = getOwnPropertyNames(mod);
var $__5 = function(j) {
var name = names[j];
if (name === '__esModule' || name === 'default') {
return 0;
}
defineProperty(object, name, {
get: function() {
return mod[name];
},
enumerable: true
});
},
$__6;
$__4: for (var j = 0; j < names.length; j++) {
$__6 = $__5(j);
switch ($__6) {
case 0:
continue $__4;
}
}
};
for (var i = 1; i < arguments.length; i++) {
$__3(i);
}
return object;
}
$traceurRuntime.exportStar = exportStar;
return {};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/private-symbol.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/private-symbol.js";
var newUniqueString = $traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./new-unique-string.js", "traceur-runtime@0.0.102/src/runtime/private-symbol.js")).default;
var $Symbol = typeof Symbol === 'function' ? Symbol : undefined;
var $getOwnPropertySymbols = Object.getOwnPropertySymbols;
var $create = Object.create;
var privateNames = $create(null);
function isPrivateSymbol(s) {
return privateNames[s];
}
;
function createPrivateSymbol() {
var s = ($Symbol || newUniqueString)();
privateNames[s] = true;
return s;
}
;
function hasPrivate(obj, sym) {
return hasOwnProperty.call(obj, sym);
}
;
function deletePrivate(obj, sym) {
if (!hasPrivate(obj, sym)) {
return false;
}
delete obj[sym];
return true;
}
;
function setPrivate(obj, sym, val) {
obj[sym] = val;
}
;
function getPrivate(obj, sym) {
var val = obj[sym];
if (val === undefined)
return undefined;
return hasOwnProperty.call(obj, sym) ? val : undefined;
}
;
function init() {
if ($getOwnPropertySymbols) {
Object.getOwnPropertySymbols = function getOwnPropertySymbols(object) {
var rv = [];
var symbols = $getOwnPropertySymbols(object);
for (var i = 0; i < symbols.length; i++) {
var symbol = symbols[i];
if (!isPrivateSymbol(symbol)) {
rv.push(symbol);
}
}
return rv;
};
}
}
return {
get isPrivateSymbol() {
return isPrivateSymbol;
},
get createPrivateSymbol() {
return createPrivateSymbol;
},
get hasPrivate() {
return hasPrivate;
},
get deletePrivate() {
return deletePrivate;
},
get setPrivate() {
return setPrivate;
},
get getPrivate() {
return getPrivate;
},
get init() {
return init;
}
};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/private-weak-map.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/private-weak-map.js";
var $WeakMap = typeof WeakMap === 'function' ? WeakMap : undefined;
function isPrivateSymbol(s) {
return false;
}
function createPrivateSymbol() {
return new $WeakMap();
}
function hasPrivate(obj, sym) {
return sym.has(obj);
}
function deletePrivate(obj, sym) {
return sym.delete(obj);
}
function setPrivate(obj, sym, val) {
sym.set(obj, val);
}
function getPrivate(obj, sym) {
return sym.get(obj);
}
function init() {}
return {
get isPrivateSymbol() {
return isPrivateSymbol;
},
get createPrivateSymbol() {
return createPrivateSymbol;
},
get hasPrivate() {
return hasPrivate;
},
get deletePrivate() {
return deletePrivate;
},
get setPrivate() {
return setPrivate;
},
get getPrivate() {
return getPrivate;
},
get init() {
return init;
}
};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/private.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/private.js";
var sym = $traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./private-symbol.js", "traceur-runtime@0.0.102/src/runtime/private.js"));
var weak = $traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./private-weak-map.js", "traceur-runtime@0.0.102/src/runtime/private.js"));
var hasWeakMap = typeof WeakMap === 'function';
var m = hasWeakMap ? weak : sym;
var isPrivateSymbol = m.isPrivateSymbol;
var createPrivateSymbol = m.createPrivateSymbol;
var hasPrivate = m.hasPrivate;
var deletePrivate = m.deletePrivate;
var setPrivate = m.setPrivate;
var getPrivate = m.getPrivate;
m.init();
return {
get isPrivateSymbol() {
return isPrivateSymbol;
},
get createPrivateSymbol() {
return createPrivateSymbol;
},
get hasPrivate() {
return hasPrivate;
},
get deletePrivate() {
return deletePrivate;
},
get setPrivate() {
return setPrivate;
},
get getPrivate() {
return getPrivate;
}
};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/properTailCalls.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/properTailCalls.js";
var $__0 = $traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./private.js", "traceur-runtime@0.0.102/src/runtime/properTailCalls.js")),
getPrivate = $__0.getPrivate,
setPrivate = $__0.setPrivate,
createPrivateSymbol = $__0.createPrivateSymbol;
var $apply = Function.prototype.call.bind(Function.prototype.apply);
var CONTINUATION_TYPE = Object.create(null);
var isTailRecursiveName = null;
function createContinuation(operand, thisArg, argsArray) {
return [CONTINUATION_TYPE, operand, thisArg, argsArray];
}
function isContinuation(object) {
return object && object[0] === CONTINUATION_TYPE;
}
function $bind(operand, thisArg, args) {
var argArray = [thisArg];
for (var i = 0; i < args.length; i++) {
argArray[i + 1] = args[i];
}
var func = $apply(Function.prototype.bind, operand, argArray);
return func;
}
function $construct(func, argArray) {
var object = new ($bind(func, null, argArray));
return object;
}
function isTailRecursive(func) {
return !!getPrivate(func, isTailRecursiveName);
}
function tailCall(func, thisArg, argArray) {
var continuation = argArray[0];
if (isContinuation(continuation)) {
continuation = $apply(func, thisArg, continuation[3]);
return continuation;
}
continuation = createContinuation(func, thisArg, argArray);
while (true) {
if (isTailRecursive(func)) {
continuation = $apply(func, continuation[2], [continuation]);
} else {
continuation = $apply(func, continuation[2], continuation[3]);
}
if (!isContinuation(continuation)) {
return continuation;
}
func = continuation[1];
}
}
function construct() {
var object;
if (isTailRecursive(this)) {
object = $construct(this, [createContinuation(null, null, arguments)]);
} else {
object = $construct(this, arguments);
}
return object;
}
function setupProperTailCalls() {
isTailRecursiveName = createPrivateSymbol();
Function.prototype.call = initTailRecursiveFunction(function call(thisArg) {
var result = tailCall(function(thisArg) {
var argArray = [];
for (var i = 1; i < arguments.length; ++i) {
argArray[i - 1] = arguments[i];
}
var continuation = createContinuation(this, thisArg, argArray);
return continuation;
}, this, arguments);
return result;
});
Function.prototype.apply = initTailRecursiveFunction(function apply(thisArg, argArray) {
var result = tailCall(function(thisArg, argArray) {
var continuation = createContinuation(this, thisArg, argArray);
return continuation;
}, this, arguments);
return result;
});
}
function initTailRecursiveFunction(func) {
if (isTailRecursiveName === null) {
setupProperTailCalls();
}
setPrivate(func, isTailRecursiveName, true);
return func;
}
$traceurRuntime.initTailRecursiveFunction = initTailRecursiveFunction;
$traceurRuntime.call = tailCall;
$traceurRuntime.continuation = createContinuation;
$traceurRuntime.construct = construct;
return {};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/relativeRequire.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/relativeRequire.js";
var path;
function relativeRequire(callerPath, requiredPath) {
path = path || typeof require !== 'undefined' && require('path');
function isDirectory(path) {
return path.slice(-1) === '/';
}
function isAbsolute(path) {
return path[0] === '/';
}
function isRelative(path) {
return path[0] === '.';
}
if (isDirectory(requiredPath) || isAbsolute(requiredPath))
return;
return isRelative(requiredPath) ? require(path.resolve(path.dirname(callerPath), requiredPath)) : require(requiredPath);
}
$traceurRuntime.require = relativeRequire;
return {};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/checkObjectCoercible.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/checkObjectCoercible.js";
var $TypeError = TypeError;
function checkObjectCoercible(v) {
if (v === null || v === undefined) {
throw new $TypeError('Value cannot be converted to an Object');
}
return v;
}
var $__default = checkObjectCoercible;
return {get default() {
return $__default;
}};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/spread.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/spread.js";
var checkObjectCoercible = $traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./checkObjectCoercible.js", "traceur-runtime@0.0.102/src/runtime/spread.js")).default;
function spread() {
var rv = [],
j = 0,
iterResult;
for (var i = 0; i < arguments.length; i++) {
var valueToSpread = checkObjectCoercible(arguments[i]);
if (typeof valueToSpread[Symbol.iterator] !== 'function') {
throw new TypeError('Cannot spread non-iterable object.');
}
var iter = valueToSpread[Symbol.iterator]();
while (!(iterResult = iter.next()).done) {
rv[j++] = iterResult.value;
}
}
return rv;
}
$traceurRuntime.spread = spread;
return {};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/destructuring.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/destructuring.js";
function iteratorToArray(iter) {
var rv = [];
var i = 0;
var tmp;
while (!(tmp = iter.next()).done) {
rv[i++] = tmp.value;
}
return rv;
}
$traceurRuntime.iteratorToArray = iteratorToArray;
return {};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/async.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/async.js";
var $__0 = $traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./private.js", "traceur-runtime@0.0.102/src/runtime/async.js")),
createPrivateSymbol = $__0.createPrivateSymbol,
getPrivate = $__0.getPrivate,
setPrivate = $__0.setPrivate;
var $__12 = Object,
create = $__12.create,
defineProperty = $__12.defineProperty;
var observeName = createPrivateSymbol();
function AsyncGeneratorFunction() {}
function AsyncGeneratorFunctionPrototype() {}
AsyncGeneratorFunction.prototype = AsyncGeneratorFunctionPrototype;
AsyncGeneratorFunctionPrototype.constructor = AsyncGeneratorFunction;
defineProperty(AsyncGeneratorFunctionPrototype, 'constructor', {enumerable: false});
var AsyncGeneratorContext = function() {
function AsyncGeneratorContext(observer) {
var $__3 = this;
this.decoratedObserver = $traceurRuntime.createDecoratedGenerator(observer, function() {
$__3.done = true;
});
this.done = false;
this.inReturn = false;
}
return ($traceurRuntime.createClass)(AsyncGeneratorContext, {
throw: function(error) {
if (!this.inReturn) {
throw error;
}
},
yield: function(value) {
if (this.done) {
this.inReturn = true;
throw undefined;
}
var result;
try {
result = this.decoratedObserver.next(value);
} catch (e) {
this.done = true;
throw e;
}
if (result === undefined) {
return;
}
if (result.done) {
this.done = true;
this.inReturn = true;
throw undefined;
}
return result.value;
},
yieldFor: function(observable) {
var ctx = this;
return $traceurRuntime.observeForEach(observable[Symbol.observer].bind(observable), function(value) {
if (ctx.done) {
this.return();
return;
}
var result;
try {
result = ctx.decoratedObserver.next(value);
} catch (e) {
ctx.done = true;
throw e;
}
if (result === undefined) {
return;
}
if (result.done) {
ctx.done = true;
}
return result;
});
}
}, {});
}();
AsyncGeneratorFunctionPrototype.prototype[Symbol.observer] = function(observer) {
var observe = getPrivate(this, observeName);
var ctx = new AsyncGeneratorContext(observer);
$traceurRuntime.schedule(function() {
return observe(ctx);
}).then(function(value) {
if (!ctx.done) {
ctx.decoratedObserver.return(value);
}
}).catch(function(error) {
if (!ctx.done) {
ctx.decoratedObserver.throw(error);
}
});
return ctx.decoratedObserver;
};
defineProperty(AsyncGeneratorFunctionPrototype.prototype, Symbol.observer, {enumerable: false});
function initAsyncGeneratorFunction(functionObject) {
functionObject.prototype = create(AsyncGeneratorFunctionPrototype.prototype);
functionObject.__proto__ = AsyncGeneratorFunctionPrototype;
return functionObject;
}
function createAsyncGeneratorInstance(observe, functionObject) {
for (var args = [],
$__11 = 2; $__11 < arguments.length; $__11++)
args[$__11 - 2] = arguments[$__11];
var object = create(functionObject.prototype);
setPrivate(object, observeName, observe);
return object;
}
function observeForEach(observe, next) {
return new Promise(function(resolve, reject) {
var generator = observe({
next: function(value) {
return next.call(generator, value);
},
throw: function(error) {
reject(error);
},
return: function(value) {
resolve(value);
}
});
});
}
function schedule(asyncF) {
return Promise.resolve().then(asyncF);
}
var generator = Symbol();
var onDone = Symbol();
var DecoratedGenerator = function() {
function DecoratedGenerator(_generator, _onDone) {
this[generator] = _generator;
this[onDone] = _onDone;
}
return ($traceurRuntime.createClass)(DecoratedGenerator, {
next: function(value) {
var result = this[generator].next(value);
if (result !== undefined && result.done) {
this[onDone].call(this);
}
return result;
},
throw: function(error) {
this[onDone].call(this);
return this[generator].throw(error);
},
return: function(value) {
this[onDone].call(this);
return this[generator].return(value);
}
}, {});
}();
function createDecoratedGenerator(generator, onDone) {
return new DecoratedGenerator(generator, onDone);
}
Array.prototype[Symbol.observer] = function(observer) {
var done = false;
var decoratedObserver = createDecoratedGenerator(observer, function() {
return done = true;
});
var $__7 = true;
var $__8 = false;
var $__9 = undefined;
try {
for (var $__5 = void 0,
$__4 = (this)[Symbol.iterator](); !($__7 = ($__5 = $__4.next()).done); $__7 = true) {
var value = $__5.value;
{
decoratedObserver.next(value);
if (done) {
return;
}
}
}
} catch ($__10) {
$__8 = true;
$__9 = $__10;
} finally {
try {
if (!$__7 && $__4.return != null) {
$__4.return();
}
} finally {
if ($__8) {
throw $__9;
}
}
}
decoratedObserver.return();
return decoratedObserver;
};
defineProperty(Array.prototype, Symbol.observer, {enumerable: false});
$traceurRuntime.initAsyncGeneratorFunction = initAsyncGeneratorFunction;
$traceurRuntime.createAsyncGeneratorInstance = createAsyncGeneratorInstance;
$traceurRuntime.observeForEach = observeForEach;
$traceurRuntime.schedule = schedule;
$traceurRuntime.createDecoratedGenerator = createDecoratedGenerator;
return {};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/generators.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/generators.js";
var $__0 = $traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./private.js", "traceur-runtime@0.0.102/src/runtime/generators.js")),
createPrivateSymbol = $__0.createPrivateSymbol,
getPrivate = $__0.getPrivate,
setPrivate = $__0.setPrivate;
var $TypeError = TypeError;
var $__2 = Object,
create = $__2.create,
defineProperties = $__2.defineProperties,
defineProperty = $__2.defineProperty;
function nonEnum(value) {
return {
configurable: true,
enumerable: false,
value: value,
writable: true
};
}
var ST_NEWBORN = 0;
var ST_EXECUTING = 1;
var ST_SUSPENDED = 2;
var ST_CLOSED = 3;
var END_STATE = -2;
var RETHROW_STATE = -3;
function getInternalError(state) {
return new Error('Traceur compiler bug: invalid state in state machine: ' + state);
}
var RETURN_SENTINEL = {};
function GeneratorContext() {
this.state = 0;
this.GState = ST_NEWBORN;
this.storedException = undefined;
this.finallyFallThrough = undefined;
this.sent_ = undefined;
this.returnValue = undefined;
this.oldReturnValue = undefined;
this.tryStack_ = [];
}
GeneratorContext.prototype = {
pushTry: function(catchState, finallyState) {
if (finallyState !== null) {
var finallyFallThrough = null;
for (var i = this.tryStack_.length - 1; i >= 0; i--) {
if (this.tryStack_[i].catch !== undefined) {
finallyFallThrough = this.tryStack_[i].catch;
break;
}
}
if (finallyFallThrough === null)
finallyFallThrough = RETHROW_STATE;
this.tryStack_.push({
finally: finallyState,
finallyFallThrough: finallyFallThrough
});
}
if (catchState !== null) {
this.tryStack_.push({catch: catchState});
}
},
popTry: function() {
this.tryStack_.pop();
},
maybeUncatchable: function() {
if (this.storedException === RETURN_SENTINEL) {
throw RETURN_SENTINEL;
}
},
get sent() {
this.maybeThrow();
return this.sent_;
},
set sent(v) {
this.sent_ = v;
},
get sentIgnoreThrow() {
return this.sent_;
},
maybeThrow: function() {
if (this.action === 'throw') {
this.action = 'next';
throw this.sent_;
}
},
end: function() {
switch (this.state) {
case END_STATE:
return this;
case RETHROW_STATE:
throw this.storedException;
default:
throw getInternalError(this.state);
}
},
handleException: function(ex) {
this.GState = ST_CLOSED;
this.state = END_STATE;
throw ex;
},
wrapYieldStar: function(iterator) {
var ctx = this;
return {
next: function(v) {
return iterator.next(v);
},
throw: function(e) {
var result;
if (e === RETURN_SENTINEL) {
if (iterator.return) {
result = iterator.return(ctx.returnValue);
if (!result.done) {
ctx.returnValue = ctx.oldReturnValue;
return result;
}
ctx.returnValue = result.value;
}
throw e;
}
if (iterator.throw) {
return iterator.throw(e);
}
iterator.return && iterator.return();
throw $TypeError('Inner iterator does not have a throw method');
}
};
}
};
function nextOrThrow(ctx, moveNext, action, x) {
switch (ctx.GState) {
case ST_EXECUTING:
throw new Error(("\"" + action + "\" on executing generator"));
case ST_CLOSED:
if (action == 'next') {
return {
value: undefined,
done: true
};
}
if (x === RETURN_SENTINEL) {
return {
value: ctx.returnValue,
done: true
};
}
throw x;
case ST_NEWBORN:
if (action === 'throw') {
ctx.GState = ST_CLOSED;
if (x === RETURN_SENTINEL) {
return {
value: ctx.returnValue,
done: true
};
}
throw x;
}
if (x !== undefined)
throw $TypeError('Sent value to newborn generator');
case ST_SUSPENDED:
ctx.GState = ST_EXECUTING;
ctx.action = action;
ctx.sent = x;
var value;
try {
value = moveNext(ctx);
} catch (ex) {
if (ex === RETURN_SENTINEL) {
value = ctx;
} else {
throw ex;
}
}
var done = value === ctx;
if (done)
value = ctx.returnValue;
ctx.GState = done ? ST_CLOSED : ST_SUSPENDED;
return {
value: value,
done: done
};
}
}
var ctxName = createPrivateSymbol();
var moveNextName = createPrivateSymbol();
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
GeneratorFunction.prototype = GeneratorFunctionPrototype;
defineProperty(GeneratorFunctionPrototype, 'constructor', nonEnum(GeneratorFunction));
GeneratorFunctionPrototype.prototype = {
constructor: GeneratorFunctionPrototype,
next: function(v) {
return nextOrThrow(getPrivate(this, ctxName), getPrivate(this, moveNextName), 'next', v);
},
throw: function(v) {
return nextOrThrow(getPrivate(this, ctxName), getPrivate(this, moveNextName), 'throw', v);
},
return: function(v) {
var ctx = getPrivate(this, ctxName);
ctx.oldReturnValue = ctx.returnValue;
ctx.returnValue = v;
return nextOrThrow(ctx, getPrivate(this, moveNextName), 'throw', RETURN_SENTINEL);
}
};
defineProperties(GeneratorFunctionPrototype.prototype, {
constructor: {enumerable: false},
next: {enumerable: false},
throw: {enumerable: false},
return: {enumerable: false}
});
Object.defineProperty(GeneratorFunctionPrototype.prototype, Symbol.iterator, nonEnum(function() {
return this;
}));
function createGeneratorInstance(innerFunction, functionObject, self) {
var moveNext = getMoveNext(innerFunction, self);
var ctx = new GeneratorContext();
var object = create(functionObject.prototype);
setPrivate(object, ctxName, ctx);
setPrivate(object, moveNextName, moveNext);
return object;
}
function initGeneratorFunction(functionObject) {
functionObject.prototype = create(GeneratorFunctionPrototype.prototype);
functionObject.__proto__ = GeneratorFunctionPrototype;
return functionObject;
}
function AsyncFunctionContext() {
GeneratorContext.call(this);
this.err = undefined;
var ctx = this;
ctx.result = new Promise(function(resolve, reject) {
ctx.resolve = resolve;
ctx.reject = reject;
});
}
AsyncFunctionContext.prototype = create(GeneratorContext.prototype);
AsyncFunctionContext.prototype.end = function() {
switch (this.state) {
case END_STATE:
this.resolve(this.returnValue);
break;
case RETHROW_STATE:
this.reject(this.storedException);
break;
default:
this.reject(getInternalError(this.state));
}
};
AsyncFunctionContext.prototype.handleException = function() {
this.state = RETHROW_STATE;
};
function asyncWrap(innerFunction, self) {
var moveNext = getMoveNext(innerFunction, self);
var ctx = new AsyncFunctionContext();
ctx.createCallback = function(newState) {
return function(value) {
ctx.state = newState;
ctx.value = value;
moveNext(ctx);
};
};
ctx.errback = function(err) {
handleCatch(ctx, err);
moveNext(ctx);
};
moveNext(ctx);
return ctx.result;
}
function getMoveNext(innerFunction, self) {
return function(ctx) {
while (true) {
try {
return innerFunction.call(self, ctx);
} catch (ex) {
handleCatch(ctx, ex);
}
}
};
}
function handleCatch(ctx, ex) {
ctx.storedException = ex;
var last = ctx.tryStack_[ctx.tryStack_.length - 1];
if (!last) {
ctx.handleException(ex);
return;
}
ctx.state = last.catch !== undefined ? last.catch : last.finally;
if (last.finallyFallThrough !== undefined)
ctx.finallyFallThrough = last.finallyFallThrough;
}
$traceurRuntime.asyncWrap = asyncWrap;
$traceurRuntime.initGeneratorFunction = initGeneratorFunction;
$traceurRuntime.createGeneratorInstance = createGeneratorInstance;
return {};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/template.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/template.js";
var $__1 = Object,
defineProperty = $__1.defineProperty,
freeze = $__1.freeze;
var slice = Array.prototype.slice;
var map = Object.create(null);
function getTemplateObject(raw) {
var cooked = arguments[1];
var key = raw.join('${}');
var templateObject = map[key];
if (templateObject)
return templateObject;
if (!cooked) {
cooked = slice.call(raw);
}
return map[key] = freeze(defineProperty(cooked, 'raw', {value: freeze(raw)}));
}
$traceurRuntime.getTemplateObject = getTemplateObject;
return {};
});
$traceurRuntime.registerModule("traceur-runtime@0.0.102/src/runtime/runtime-modules.js", [], function() {
"use strict";
var __moduleName = "traceur-runtime@0.0.102/src/runtime/runtime-modules.js";
$traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./symbols.js", "traceur-runtime@0.0.102/src/runtime/runtime-modules.js"));
$traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./classes.js", "traceur-runtime@0.0.102/src/runtime/runtime-modules.js"));
$traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./exportStar.js", "traceur-runtime@0.0.102/src/runtime/runtime-modules.js"));
$traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./properTailCalls.js", "traceur-runtime@0.0.102/src/runtime/runtime-modules.js"));
$traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./relativeRequire.js", "traceur-runtime@0.0.102/src/runtime/runtime-modules.js"));
$traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./spread.js", "traceur-runtime@0.0.102/src/runtime/runtime-modules.js"));
$traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./destructuring.js", "traceur-runtime@0.0.102/src/runtime/runtime-modules.js"));
$traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./async.js", "traceur-runtime@0.0.102/src/runtime/runtime-modules.js"));
$traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./generators.js", "traceur-runtime@0.0.102/src/runtime/runtime-modules.js"));
$traceurRuntime.getModule($traceurRuntime.normalizeModuleName("./template.js", "traceur-runtime@0.0.102/src/runtime/runtime-modules.js"));
return {};
});
$traceurRuntime.getModule("traceur-runtime@0.0.102/src/runtime/runtime-modules.js" + '');
$traceurRuntime.registerModule("trac